From 0a6a933a081f0a7c70d6eb33d2856a81cc87c8ae Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 18 May 2009 15:54:44 -0700 Subject: [PATCH] Fixed a bug in WebKit in which the current background color was sometimes not detected correctly. --- static/js/Editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index 8b8576d..ebb105d 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -1467,6 +1467,7 @@ Editor.prototype.state_enabled = function ( state_name, node_names, attribute_na DEFAULT_FOREGROUND_CODE = "#000000"; DEFAULT_BACKGROUND_CODE = "#ffffff"; +WEBKIT_DEFAULT_COLOR_CODE = "rgba(0, 0, 0, 0)"; // return a list of names for all the nodes containing the cursor Editor.prototype.current_node_names = function () { @@ -1551,12 +1552,15 @@ Editor.prototype.current_colors = function () { } else if ( name == "span" || name == "font" ) { if ( foreground == null ) { foreground = getStyle( node, "color" ) - if ( foreground == "transparent" || foreground == DEFAULT_FOREGROUND_CODE ) + if ( foreground == "transparent" || foreground == DEFAULT_FOREGROUND_CODE || + foreground == WEBKIT_DEFAULT_COLOR_CODE ) foreground = null; } if ( background == null ) { background = getStyle( node, "background-color" ) - if ( background == "transparent" || background == DEFAULT_BACKGROUND_CODE ) + console.log( ":" + background + ":" ); + if ( background == "transparent" || background == DEFAULT_BACKGROUND_CODE || + background == WEBKIT_DEFAULT_COLOR_CODE ) background = null; } }