add: if (gColorObj.Type == "Page" && gColorObj.BackgroundColor) {    var bodyelement = GetBodyElement(); if (bodyelement) { var defColors = GetDefaultBrowserColors(); if (defColors) { if (!bodyelement.getAttribute("text")) window.editorShell.SetAttribute(bodyelement, "text", defColors.TextColor);  if (!bodyelement.getAttribute("link")) window.editorShell.SetAttribute(bodyelement, "link", defColors.LinkColor);  if (!bodyelement.getAttribute("alink")) window.editorShell.SetAttribute(bodyelement, "alink", defColors.LinkColor);  if (!bodyelement.getAttribute("vlink")) window.editorShell.SetAttribute(bodyelement, "vlink", defColors.VisitedLinkColor); } } } window.editorShell.EndBatchChanges(); } 
context: function EditorSelectColor(colorType, mouseEvent){  if (!gColorObj)    return;  // Shift + mouse click automatically applies last color, if available  var useLastColor = mouseEvent ? ( mouseEvent.button == 0 && mouseEvent.shiftKey ) : false;  var element;  var table;  var currentColor = "";  var commandNode;  if (!colorType)    colorType = "";  if (colorType == "Text")  {    gColorObj.Type = colorType;    // Get color from command node state    commandNode = document.getElementById("cmd_fontColor");    currentColor = commandNode.getAttribute("state");    gColorObj.TextColor = currentColor;    if (useLastColor && gColorObj.LastTextColor )      gColorObj.TextColor = gColorObj.LastTextColor;    else      useLastColor = false;  }  else  {    element = GetBackgroundElementWithColor();    if (!element)      return;    // Get the table if we found a cell    if (gColorObj.Type == "Table")      table = element;    else if (gColorObj.Type == "Cell")      table = GetParentTable(element);    // Save to avoid resetting if not necessary    currentColor = gColorObj.BackgroundColor;    if (colorType == "TableOrCell" || colorType == "Cell")    {      if (gColorObj.Type == "Cell")        gColorObj.Type = colorType;      else if (gColorObj.Type != "Table")        return;    }    else if (colorType == "Table" && gColorObj.Type == "Page")      return;    if (colorType == "" && gColorObj.Type == "Cell")    {      // Using empty string for requested type means      //  we can let user select cell or table      gColorObj.Type = "TableOrCell";    }    if (useLastColor && gColorObj.LastBackgroundColor )      gColorObj.BackgroundColor = gColorObj.LastBackgroundColor;    else      useLastColor = false;  }  // Save the type we are really requesting  colorType = gColorObj.Type;  if (!useLastColor)  {    // Avoid the JS warning    gColorObj.NoDefault = false;    // Launch the ColorPicker dialog    // TODO: Figure out how to position this under the color buttons on the toolbar    window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", gColorObj);    // User canceled the dialog    if (gColorObj.Cancel)      return;  }  if (colorType == "Text")  {    if (currentColor != gColorObj.TextColor)    {      if (gColorObj.TextColor)        window.editorShell.SetTextProperty("font", "color", gColorObj.TextColor);      else        window.editorShell.RemoveTextProperty("font", "color");    }    // Update the command state (this will trigger color button update)    goUpdateCommand("cmd_fontColor");  }  else if (element)  {    if (gColorObj.Type == "Table")    {      // Set background on a table      // Note that we shouldn't trust "currentColor" because of "TableOrCell" behavior      if (table)      {        var bgcolor = table.getAttribute("bgcolor");        if (bgcolor != gColorObj.BackgroundColor)        {          if (gColorObj.BackgroundColor)            window.editorShell.SetAttribute(table, "bgcolor", gColorObj.BackgroundColor);          else            window.editorShell.RemoveAttribute(table, "bgcolor");        }      }    }    else if (currentColor != gColorObj.BackgroundColor)      window.editorShell.SetBackgroundColor(gColorObj.BackgroundColor);    goUpdateCommand("cmd_backgroundColor");  }  gContentWindow.focus();}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/54fc6b88b5d0c03e6849a4e7f01bc058e516c4d2/editor.js/clean/editor/ui/composer/content/editor.js