mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Fix updating toolbar color after page color is changed, b=115694, r=syd, sr=hewitt
This commit is contained in:
parent
95392cc913
commit
3549eafa09
@ -1661,6 +1661,7 @@ var nsColorPropertiesCommand =
|
||||
doCommand: function(aCommand)
|
||||
{
|
||||
window.openDialog("chrome://editor/content/EdColorProps.xul","_blank", "chrome,close,titlebar,modal", "");
|
||||
UpdateDefaultColors();
|
||||
window._content.focus();
|
||||
}
|
||||
};
|
||||
|
@ -812,6 +812,42 @@ function onBackgroundColorChange()
|
||||
}
|
||||
}
|
||||
|
||||
// Call this when user changes text and/or background colors of the page
|
||||
function UpdateDefaultColors()
|
||||
{
|
||||
var BrowserColors = GetDefaultBrowserColors();
|
||||
var bodyelement = GetBodyElement();
|
||||
var defTextColor = gDefaultTextColor;
|
||||
var defBackColor = gDefaultBackgroundColor;
|
||||
|
||||
if (bodyelement)
|
||||
{
|
||||
var color = bodyelement.getAttribute("text");
|
||||
if (color)
|
||||
gDefaultTextColor = color;
|
||||
else if (BrowserColors)
|
||||
gDefaultTextColor = BrowserColors.TextColor;
|
||||
|
||||
color = bodyelement.getAttribute("bgcolor");
|
||||
if (color)
|
||||
gDefaultBackgroundColor = color;
|
||||
else if (BrowserColors)
|
||||
gDefaultBackgroundColor = BrowserColors.BackgroundColor;
|
||||
}
|
||||
|
||||
// Trigger update on toolbar
|
||||
if (defTextColor != gDefaultTextColor)
|
||||
{
|
||||
goUpdateCommand("cmd_fontColor");
|
||||
onFontColorChange();
|
||||
}
|
||||
if (defBackColor != gDefaultBackgroundColor)
|
||||
{
|
||||
goUpdateCommand("cmd_backgroundColor");
|
||||
onBackgroundColorChange();
|
||||
}
|
||||
}
|
||||
|
||||
function GetBackgroundElementWithColor()
|
||||
{
|
||||
gColorObj.Type = "";
|
||||
|
Loading…
Reference in New Issue
Block a user