Bug 694226, merge nsWidgetAtoms and nsGkAtoms, r=roc

This commit is contained in:
Neil Deakin
2011-10-14 14:11:22 -04:00
parent ebba5fe04f
commit a80c765197
30 changed files with 258 additions and 520 deletions

View File

@@ -379,6 +379,7 @@ GK_ATOM(floating, "floating")
GK_ATOM(floor, "floor") GK_ATOM(floor, "floor")
GK_ATOM(flowlength, "flowlength") GK_ATOM(flowlength, "flowlength")
GK_ATOM(focus, "focus") GK_ATOM(focus, "focus")
GK_ATOM(focused, "focused")
GK_ATOM(following, "following") GK_ATOM(following, "following")
GK_ATOM(followingSibling, "following-sibling") GK_ATOM(followingSibling, "following-sibling")
GK_ATOM(font, "font") GK_ATOM(font, "font")
@@ -429,6 +430,7 @@ GK_ATOM(height, "height")
GK_ATOM(hgroup, "hgroup") GK_ATOM(hgroup, "hgroup")
GK_ATOM(hidden, "hidden") GK_ATOM(hidden, "hidden")
GK_ATOM(hidechrome, "hidechrome") GK_ATOM(hidechrome, "hidechrome")
GK_ATOM(hidecolumnpicker, "hidecolumnpicker")
GK_ATOM(high, "high") GK_ATOM(high, "high")
GK_ATOM(highest, "highest") GK_ATOM(highest, "highest")
GK_ATOM(horizontal, "horizontal") GK_ATOM(horizontal, "horizontal")
@@ -458,6 +460,7 @@ GK_ATOM(include, "include")
GK_ATOM(includes, "includes") GK_ATOM(includes, "includes")
GK_ATOM(increment, "increment") GK_ATOM(increment, "increment")
GK_ATOM(indent, "indent") GK_ATOM(indent, "indent")
GK_ATOM(indeterminate, "indeterminate")
GK_ATOM(index, "index") GK_ATOM(index, "index")
GK_ATOM(infer, "infer") GK_ATOM(infer, "infer")
GK_ATOM(infinity, "infinity") GK_ATOM(infinity, "infinity")
@@ -635,6 +638,7 @@ GK_ATOM(onafterscriptexecute, "onafterscriptexecute")
GK_ATOM(onanimationend, "onanimationend") GK_ATOM(onanimationend, "onanimationend")
GK_ATOM(onanimationiteration, "onanimationiteration") GK_ATOM(onanimationiteration, "onanimationiteration")
GK_ATOM(onanimationstart, "onanimationstart") GK_ATOM(onanimationstart, "onanimationstart")
GK_ATOM(onAppCommand, "onAppCommand")
GK_ATOM(onbeforecopy, "onbeforecopy") GK_ATOM(onbeforecopy, "onbeforecopy")
GK_ATOM(onbeforecut, "onbeforecut") GK_ATOM(onbeforecut, "onbeforecut")
GK_ATOM(onbeforepaste, "onbeforepaste") GK_ATOM(onbeforepaste, "onbeforepaste")
@@ -762,6 +766,7 @@ GK_ATOM(panel, "panel")
GK_ATOM(param, "param") GK_ATOM(param, "param")
GK_ATOM(parameter, "parameter") GK_ATOM(parameter, "parameter")
GK_ATOM(parent, "parent") GK_ATOM(parent, "parent")
GK_ATOM(parentfocused, "parentfocused")
GK_ATOM(parsetype, "parsetype") GK_ATOM(parsetype, "parsetype")
GK_ATOM(pattern, "pattern") GK_ATOM(pattern, "pattern")
GK_ATOM(patternSeparator, "pattern-separator") GK_ATOM(patternSeparator, "pattern-separator")
@@ -854,6 +859,7 @@ GK_ATOM(rev, "rev")
GK_ATOM(reverse, "reverse") GK_ATOM(reverse, "reverse")
GK_ATOM(reversed, "reversed") GK_ATOM(reversed, "reversed")
GK_ATOM(richlistbox, "richlistbox") GK_ATOM(richlistbox, "richlistbox")
GK_ATOM(richlistitem, "richlistitem")
GK_ATOM(right, "right") GK_ATOM(right, "right")
GK_ATOM(rightmargin, "rightmargin") GK_ATOM(rightmargin, "rightmargin")
GK_ATOM(rightpadding, "rightpadding") GK_ATOM(rightpadding, "rightpadding")
@@ -870,6 +876,7 @@ GK_ATOM(rule, "rule")
GK_ATOM(rules, "rules") GK_ATOM(rules, "rules")
GK_ATOM(s, "s") GK_ATOM(s, "s")
GK_ATOM(samp, "samp") GK_ATOM(samp, "samp")
GK_ATOM(sbattr, "sbattr")
GK_ATOM(scale, "scale") GK_ATOM(scale, "scale")
GK_ATOM(scan, "scan") GK_ATOM(scan, "scan")
GK_ATOM(scheme, "scheme") GK_ATOM(scheme, "scheme")
@@ -882,6 +889,10 @@ GK_ATOM(script, "script")
GK_ATOM(scriptEnabledBeforePrintOrPreview, "scriptEnabledBeforePrintOrPreview") GK_ATOM(scriptEnabledBeforePrintOrPreview, "scriptEnabledBeforePrintOrPreview")
GK_ATOM(scrollbar, "scrollbar") GK_ATOM(scrollbar, "scrollbar")
GK_ATOM(scrollbarbutton, "scrollbarbutton") GK_ATOM(scrollbarbutton, "scrollbarbutton")
GK_ATOM(scrollbarDownBottom, "scrollbarDownBottom")
GK_ATOM(scrollbarDownTop, "scrollbarDownTop")
GK_ATOM(scrollbarUpBottom, "scrollbarUpBottom")
GK_ATOM(scrollbarUpTop, "scrollbarUpTop")
GK_ATOM(scrollbox, "scrollbox") GK_ATOM(scrollbox, "scrollbox")
GK_ATOM(scrollcorner, "scrollcorner") GK_ATOM(scrollcorner, "scrollcorner")
GK_ATOM(scrolling, "scrolling") GK_ATOM(scrolling, "scrolling")
@@ -942,6 +953,7 @@ GK_ATOM(startsWith, "starts-with")
GK_ATOM(state, "state") GK_ATOM(state, "state")
GK_ATOM(statedatasource, "statedatasource") GK_ATOM(statedatasource, "statedatasource")
GK_ATOM(staticHint, "staticHint") GK_ATOM(staticHint, "staticHint")
GK_ATOM(statusbar, "statusbar")
GK_ATOM(statustext, "statustext") GK_ATOM(statustext, "statustext")
GK_ATOM(stop, "stop") GK_ATOM(stop, "stop")
GK_ATOM(stretch, "stretch") GK_ATOM(stretch, "stretch")
@@ -1016,6 +1028,7 @@ GK_ATOM(tree, "tree")
GK_ATOM(treecell, "treecell") GK_ATOM(treecell, "treecell")
GK_ATOM(treechildren, "treechildren") GK_ATOM(treechildren, "treechildren")
GK_ATOM(treecol, "treecol") GK_ATOM(treecol, "treecol")
GK_ATOM(treecolpicker, "treecolpicker")
GK_ATOM(treecols, "treecols") GK_ATOM(treecols, "treecols")
GK_ATOM(treeitem, "treeitem") GK_ATOM(treeitem, "treeitem")
GK_ATOM(treerow, "treerow") GK_ATOM(treerow, "treerow")
@@ -1903,6 +1916,19 @@ GK_ATOM(_moz_device_pixel_ratio, "-moz-device-pixel-ratio")
GK_ATOM(_moz_device_orientation, "-moz-device-orientation") GK_ATOM(_moz_device_orientation, "-moz-device-orientation")
GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document") GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document")
// application commands
GK_ATOM(Back, "Back")
GK_ATOM(Forward, "Forward")
GK_ATOM(Reload, "Reload")
GK_ATOM(Stop, "Stop")
GK_ATOM(Search, "Search")
GK_ATOM(Bookmarks, "Bookmarks")
GK_ATOM(Home, "Home")
GK_ATOM(Clear, "Clear")
GK_ATOM(VolumeUp, "VolumeUp")
GK_ATOM(VolumeDown, "VolumeDown")
GK_ATOM(Menu, "Menu")
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
GK_ATOM(anonid, "anonid") GK_ATOM(anonid, "anonid")
GK_ATOM(aria_activedescendant, "aria-activedescendant") GK_ATOM(aria_activedescendant, "aria-activedescendant")

View File

@@ -38,7 +38,7 @@
#include "nsToolkit.h" #include "nsToolkit.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit) NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit)
@@ -59,7 +59,6 @@ nsToolkit::~nsToolkit()
NS_IMETHODIMP NS_IMETHODIMP
nsToolkit::Init(PRThread *aThread) nsToolkit::Init(PRThread *aThread)
{ {
nsWidgetAtoms::RegisterAtoms();
return NS_OK; return NS_OK;
} }

View File

@@ -57,7 +57,7 @@ using mozilla::unused;
#include "nsRenderingContext.h" #include "nsRenderingContext.h"
#include "nsIDOMSimpleGestureEvent.h" #include "nsIDOMSimpleGestureEvent.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsWidgetsCID.h" #include "nsWidgetsCID.h"
#include "nsGfxCIID.h" #include "nsGfxCIID.h"
@@ -1530,16 +1530,16 @@ nsWindow::HandleSpecialKey(AndroidGeckoEvent *ae)
switch (keyCode) { switch (keyCode) {
case AndroidKeyEvent::KEYCODE_BACK: case AndroidKeyEvent::KEYCODE_BACK:
if (isLongPress) { if (isLongPress) {
command = nsWidgetAtoms::Clear; command = nsGkAtoms::Clear;
doCommand = PR_TRUE; doCommand = PR_TRUE;
} }
break; break;
case AndroidKeyEvent::KEYCODE_VOLUME_UP: case AndroidKeyEvent::KEYCODE_VOLUME_UP:
command = nsWidgetAtoms::VolumeUp; command = nsGkAtoms::VolumeUp;
doCommand = PR_TRUE; doCommand = PR_TRUE;
break; break;
case AndroidKeyEvent::KEYCODE_VOLUME_DOWN: case AndroidKeyEvent::KEYCODE_VOLUME_DOWN:
command = nsWidgetAtoms::VolumeDown; command = nsGkAtoms::VolumeDown;
doCommand = PR_TRUE; doCommand = PR_TRUE;
break; break;
case AndroidKeyEvent::KEYCODE_MENU: case AndroidKeyEvent::KEYCODE_MENU:
@@ -1558,12 +1558,12 @@ nsWindow::HandleSpecialKey(AndroidGeckoEvent *ae)
case AndroidKeyEvent::KEYCODE_MENU: case AndroidKeyEvent::KEYCODE_MENU:
gMenu = PR_FALSE; gMenu = PR_FALSE;
if (!gMenuConsumed) { if (!gMenuConsumed) {
command = nsWidgetAtoms::Menu; command = nsGkAtoms::Menu;
doCommand = PR_TRUE; doCommand = PR_TRUE;
} }
break; break;
case AndroidKeyEvent::KEYCODE_SEARCH: case AndroidKeyEvent::KEYCODE_SEARCH:
command = nsWidgetAtoms::Search; command = nsGkAtoms::Search;
doCommand = PR_TRUE; doCommand = PR_TRUE;
break; break;
default: default:
@@ -1572,7 +1572,7 @@ nsWindow::HandleSpecialKey(AndroidGeckoEvent *ae)
} }
} }
if (doCommand) { if (doCommand) {
nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, command, this); nsCommandEvent event(PR_TRUE, nsGkAtoms::onAppCommand, command, this);
InitEvent(event); InitEvent(event);
DispatchEvent(&event); DispatchEvent(&event);
} }

View File

@@ -50,7 +50,7 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsString.h" #include "nsString.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
#include "nsHashtable.h" #include "nsHashtable.h"
@@ -161,7 +161,7 @@ void nsMenuBarX::ConstructNativeMenus()
for (PRUint32 i = 0; i < count; i++) { for (PRUint32 i = 0; i < count; i++) {
nsIContent *menuContent = mContent->GetChildAt(i); nsIContent *menuContent = mContent->GetChildAt(i);
if (menuContent && if (menuContent &&
menuContent->Tag() == nsWidgetAtoms::menu && menuContent->Tag() == nsGkAtoms::menu &&
menuContent->IsXUL()) { menuContent->IsXUL()) {
nsMenuX* newMenu = new nsMenuX(); nsMenuX* newMenu = new nsMenuX();
if (newMenu) { if (newMenu) {
@@ -429,7 +429,7 @@ char nsMenuBarX::GetLocalizedAccelKey(const char *shortcutID)
return 0; return 0;
nsAutoString key; nsAutoString key;
shortcutContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, key); shortcutContent->GetAttr(kNameSpaceID_None, nsGkAtoms::key, key);
NS_LossyConvertUTF16toASCII keyASC(key.get()); NS_LossyConvertUTF16toASCII keyASC(key.get());
const char *keyASCPtr = keyASC.get(); const char *keyASCPtr = keyASC.get();
if (!keyASCPtr) if (!keyASCPtr)
@@ -453,7 +453,7 @@ void nsMenuBarX::HideItem(nsIDOMDocument* inDoc, const nsAString & inID, nsICont
inDoc->GetElementById(inID, getter_AddRefs(menuItem)); inDoc->GetElementById(inID, getter_AddRefs(menuItem));
nsCOMPtr<nsIContent> menuContent(do_QueryInterface(menuItem)); nsCOMPtr<nsIContent> menuContent(do_QueryInterface(menuItem));
if (menuContent) { if (menuContent) {
menuContent->SetAttr(kNameSpaceID_None, nsWidgetAtoms::hidden, NS_LITERAL_STRING("true"), false); menuContent->SetAttr(kNameSpaceID_None, nsGkAtoms::hidden, NS_LITERAL_STRING("true"), false);
if (outHiddenNode) { if (outHiddenNode) {
*outHiddenNode = menuContent.get(); *outHiddenNode = menuContent.get();
NS_IF_ADDREF(*outHiddenNode); NS_IF_ADDREF(*outHiddenNode);
@@ -540,13 +540,13 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
nsCOMPtr<nsIContent> keyContent (do_QueryInterface(keyElement)); nsCOMPtr<nsIContent> keyContent (do_QueryInterface(keyElement));
// first grab the key equivalent character // first grab the key equivalent character
nsAutoString keyChar(NS_LITERAL_STRING(" ")); nsAutoString keyChar(NS_LITERAL_STRING(" "));
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyChar); keyContent->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyChar);
if (!keyChar.EqualsLiteral(" ")) { if (!keyChar.EqualsLiteral(" ")) {
keyEquiv = [[NSString stringWithCharacters:keyChar.get() length:keyChar.Length()] lowercaseString]; keyEquiv = [[NSString stringWithCharacters:keyChar.get() length:keyChar.Length()] lowercaseString];
} }
// now grab the key equivalent modifiers // now grab the key equivalent modifiers
nsAutoString modifiersStr; nsAutoString modifiersStr;
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::modifiers, modifiersStr); keyContent->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiersStr);
PRUint8 geckoModifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr); PRUint8 geckoModifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr);
macKeyModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(geckoModifiers); macKeyModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(geckoModifiers);
} }

View File

@@ -47,7 +47,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsString.h" #include "nsString.h"
#include "nsWidgetAtoms.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
#include "nsHashtable.h" #include "nsHashtable.h"

View File

@@ -48,7 +48,7 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMCSSStyleDeclaration.h" #include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMCSSValue.h" #include "nsIDOMCSSValue.h"
@@ -188,8 +188,8 @@ nsMenuItemIconX::GetIconURI(nsIURI** aIconURI)
// First, look at the content node's "image" attribute. // First, look at the content node's "image" attribute.
nsAutoString imageURIString; nsAutoString imageURIString;
bool hasImageAttr = mContent->GetAttr(kNameSpaceID_None, bool hasImageAttr = mContent->GetAttr(kNameSpaceID_None,
nsWidgetAtoms::image, nsGkAtoms::image,
imageURIString); imageURIString);
nsresult rv; nsresult rv;
nsCOMPtr<nsIDOMCSSValue> cssValue; nsCOMPtr<nsIDOMCSSValue> cssValue;

View File

@@ -45,7 +45,7 @@
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
@@ -109,7 +109,7 @@ nsresult nsMenuItemX::Create(nsMenuX* aParent, const nsString& aLabel, EMenuItem
// to the command DOM node // to the command DOM node
if (doc) { if (doc) {
nsAutoString ourCommand; nsAutoString ourCommand;
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::command, ourCommand); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::command, ourCommand);
if (!ourCommand.IsEmpty()) { if (!ourCommand.IsEmpty()) {
nsIContent *commandElement = doc->GetElementById(ourCommand); nsIContent *commandElement = doc->GetElementById(ourCommand);
@@ -126,9 +126,9 @@ nsresult nsMenuItemX::Create(nsMenuX* aParent, const nsString& aLabel, EMenuItem
// on our own content // on our own content
bool isEnabled; bool isEnabled;
if (mCommandContent) if (mCommandContent)
isEnabled = !mCommandContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, nsWidgetAtoms::_true, eCaseMatters); isEnabled = !mCommandContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled, nsGkAtoms::_true, eCaseMatters);
else else
isEnabled = !mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, nsWidgetAtoms::_true, eCaseMatters); isEnabled = !mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled, nsGkAtoms::_true, eCaseMatters);
// set up the native menu item // set up the native menu item
if (mType == eSeparatorMenuItemType) { if (mType == eSeparatorMenuItemType) {
@@ -140,8 +140,8 @@ nsresult nsMenuItemX::Create(nsMenuX* aParent, const nsString& aLabel, EMenuItem
[mNativeMenuItem setEnabled:(BOOL)isEnabled]; [mNativeMenuItem setEnabled:(BOOL)isEnabled];
SetChecked(mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::checked, SetChecked(mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
nsWidgetAtoms::_true, eCaseMatters)); nsGkAtoms::_true, eCaseMatters));
SetKeyEquiv(); SetKeyEquiv();
} }
@@ -162,7 +162,7 @@ nsresult nsMenuItemX::SetChecked(bool aIsChecked)
// update the content model. This will also handle unchecking our siblings // update the content model. This will also handle unchecking our siblings
// if we are a radiomenu // if we are a radiomenu
mContent->SetAttr(kNameSpaceID_None, nsWidgetAtoms::checked, mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::checked,
mIsChecked ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"), true); mIsChecked ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"), true);
// update native menu item // update native menu item
@@ -188,8 +188,8 @@ void nsMenuItemX::DoCommand()
// flip "checked" state if we're a checkbox menu, or an un-checked radio menu // flip "checked" state if we're a checkbox menu, or an un-checked radio menu
if (mType == eCheckboxMenuItemType || if (mType == eCheckboxMenuItemType ||
(mType == eRadioMenuItemType && !mIsChecked)) { (mType == eRadioMenuItemType && !mIsChecked)) {
if (!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::autocheck, if (!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::autocheck,
nsWidgetAtoms::_false, eCaseMatters)) nsGkAtoms::_false, eCaseMatters))
SetChecked(!mIsChecked); SetChecked(!mIsChecked);
/* the AttributeChanged code will update all the internal state */ /* the AttributeChanged code will update all the internal state */
} }
@@ -245,7 +245,7 @@ nsresult nsMenuItemX::DispatchDOMEvent(const nsString &eventName, bool *preventD
void nsMenuItemX::UncheckRadioSiblings(nsIContent* inCheckedContent) void nsMenuItemX::UncheckRadioSiblings(nsIContent* inCheckedContent)
{ {
nsAutoString myGroupName; nsAutoString myGroupName;
inCheckedContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::name, myGroupName); inCheckedContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, myGroupName);
if (!myGroupName.Length()) // no groupname, nothing to do if (!myGroupName.Length()) // no groupname, nothing to do
return; return;
@@ -260,9 +260,9 @@ void nsMenuItemX::UncheckRadioSiblings(nsIContent* inCheckedContent)
if (sibling) { if (sibling) {
if (sibling != inCheckedContent) { // skip this node if (sibling != inCheckedContent) { // skip this node
// if the current sibling is in the same group, clear it // if the current sibling is in the same group, clear it
if (sibling->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::name, if (sibling->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
myGroupName, eCaseMatters)) myGroupName, eCaseMatters))
sibling->SetAttr(kNameSpaceID_None, nsWidgetAtoms::checked, NS_LITERAL_STRING("false"), true); sibling->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, NS_LITERAL_STRING("false"), true);
} }
} }
} }
@@ -274,15 +274,15 @@ void nsMenuItemX::SetKeyEquiv()
// Set key shortcut and modifiers // Set key shortcut and modifiers
nsAutoString keyValue; nsAutoString keyValue;
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyValue); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyValue);
if (!keyValue.IsEmpty() && mContent->GetCurrentDoc()) { if (!keyValue.IsEmpty() && mContent->GetCurrentDoc()) {
nsIContent *keyContent = mContent->GetCurrentDoc()->GetElementById(keyValue); nsIContent *keyContent = mContent->GetCurrentDoc()->GetElementById(keyValue);
if (keyContent) { if (keyContent) {
nsAutoString keyChar(NS_LITERAL_STRING(" ")); nsAutoString keyChar(NS_LITERAL_STRING(" "));
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::key, keyChar); keyContent->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyChar);
nsAutoString modifiersStr; nsAutoString modifiersStr;
keyContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::modifiers, modifiersStr); keyContent->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiersStr);
PRUint8 modifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr); PRUint8 modifiers = nsMenuUtilsX::GeckoModifiersForNodeAttribute(modifiersStr);
unsigned int macModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(modifiers); unsigned int macModifiers = nsMenuUtilsX::MacModifiersForGeckoModifiers(modifiers);
@@ -318,29 +318,29 @@ nsMenuItemX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConten
return; return;
if (aContent == mContent) { // our own content node changed if (aContent == mContent) { // our own content node changed
if (aAttribute == nsWidgetAtoms::checked) { if (aAttribute == nsGkAtoms::checked) {
// if we're a radio menu, uncheck our sibling radio items. No need to // if we're a radio menu, uncheck our sibling radio items. No need to
// do any of this if we're just a normal check menu. // do any of this if we're just a normal check menu.
if (mType == eRadioMenuItemType) { if (mType == eRadioMenuItemType) {
if (mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::checked, if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
nsWidgetAtoms::_true, eCaseMatters)) nsGkAtoms::_true, eCaseMatters))
UncheckRadioSiblings(mContent); UncheckRadioSiblings(mContent);
} }
mMenuParent->SetRebuild(true); mMenuParent->SetRebuild(true);
} }
else if (aAttribute == nsWidgetAtoms::hidden || else if (aAttribute == nsGkAtoms::hidden ||
aAttribute == nsWidgetAtoms::collapsed || aAttribute == nsGkAtoms::collapsed ||
aAttribute == nsWidgetAtoms::label) { aAttribute == nsGkAtoms::label) {
mMenuParent->SetRebuild(true); mMenuParent->SetRebuild(true);
} }
else if (aAttribute == nsWidgetAtoms::key) { else if (aAttribute == nsGkAtoms::key) {
SetKeyEquiv(); SetKeyEquiv();
} }
else if (aAttribute == nsWidgetAtoms::image) { else if (aAttribute == nsGkAtoms::image) {
SetupIcon(); SetupIcon();
} }
else if (aAttribute == nsWidgetAtoms::disabled) { else if (aAttribute == nsGkAtoms::disabled) {
if (aContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, nsWidgetAtoms::_true, eCaseMatters)) if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled, nsGkAtoms::_true, eCaseMatters))
[mNativeMenuItem setEnabled:NO]; [mNativeMenuItem setEnabled:NO];
else else
[mNativeMenuItem setEnabled:YES]; [mNativeMenuItem setEnabled:YES];
@@ -349,21 +349,21 @@ nsMenuItemX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConten
else if (aContent == mCommandContent) { else if (aContent == mCommandContent) {
// the only thing that really matters when the menu isn't showing is the // the only thing that really matters when the menu isn't showing is the
// enabled state since it enables/disables keyboard commands // enabled state since it enables/disables keyboard commands
if (aAttribute == nsWidgetAtoms::disabled) { if (aAttribute == nsGkAtoms::disabled) {
// first we sync our menu item DOM node with the command DOM node // first we sync our menu item DOM node with the command DOM node
nsAutoString commandDisabled; nsAutoString commandDisabled;
nsAutoString menuDisabled; nsAutoString menuDisabled;
aContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, commandDisabled); aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled);
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, menuDisabled); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, menuDisabled);
if (!commandDisabled.Equals(menuDisabled)) { if (!commandDisabled.Equals(menuDisabled)) {
// The menu's disabled state needs to be updated to match the command. // The menu's disabled state needs to be updated to match the command.
if (commandDisabled.IsEmpty()) if (commandDisabled.IsEmpty())
mContent->UnsetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, true); mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, true);
else else
mContent->SetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, commandDisabled, true); mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled, true);
} }
// now we sync our native menu item with the command DOM node // now we sync our native menu item with the command DOM node
if (aContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, nsWidgetAtoms::_true, eCaseMatters)) if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled, nsGkAtoms::_true, eCaseMatters))
[mNativeMenuItem setEnabled:NO]; [mNativeMenuItem setEnabled:NO];
else else
[mNativeMenuItem setEnabled:YES]; [mNativeMenuItem setEnabled:YES];

View File

@@ -44,7 +44,7 @@
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
#include "nsCocoaUtils.h" #include "nsCocoaUtils.h"
#include "nsCocoaWindow.h" #include "nsCocoaWindow.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMEventTarget.h" #include "nsIDOMEventTarget.h"
@@ -204,10 +204,10 @@ NSMenuItem* nsMenuUtilsX::GetStandardEditMenuItem()
bool nsMenuUtilsX::NodeIsHiddenOrCollapsed(nsIContent* inContent) bool nsMenuUtilsX::NodeIsHiddenOrCollapsed(nsIContent* inContent)
{ {
return (inContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::hidden, return (inContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsWidgetAtoms::_true, eCaseMatters) || nsGkAtoms::_true, eCaseMatters) ||
inContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::collapsed, inContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::collapsed,
nsWidgetAtoms::_true, eCaseMatters)); nsGkAtoms::_true, eCaseMatters));
} }
// Determines how many items are visible among the siblings in a menu that are // Determines how many items are visible among the siblings in a menu that are

View File

@@ -54,7 +54,7 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "plstr.h" #include "plstr.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsCRT.h" #include "nsCRT.h"
@@ -189,7 +189,7 @@ nsresult nsMenuX::Create(nsMenuObjectX* aParent, nsMenuGroupOwnerX* aMenuGroupOw
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
mContent = aNode; mContent = aNode;
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, mLabel); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, mLabel);
mNativeMenu = CreateMenuWithGeckoString(mLabel); mNativeMenu = CreateMenuWithGeckoString(mLabel);
// register this menu to be notified when changes are made to our content object // register this menu to be notified when changes are made to our content object
@@ -216,8 +216,8 @@ nsresult nsMenuX::Create(nsMenuObjectX* aParent, nsMenuGroupOwnerX* aMenuGroupOw
mNativeMenuItem = [[NSMenuItem alloc] initWithTitle:newCocoaLabelString action:nil keyEquivalent:@""]; mNativeMenuItem = [[NSMenuItem alloc] initWithTitle:newCocoaLabelString action:nil keyEquivalent:@""];
[mNativeMenuItem setSubmenu:mNativeMenu]; [mNativeMenuItem setSubmenu:mNativeMenu];
SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
nsWidgetAtoms::_true, eCaseMatters)); nsGkAtoms::_true, eCaseMatters));
// We call MenuConstruct here because keyboard commands are dependent upon // We call MenuConstruct here because keyboard commands are dependent upon
// native menu items being created. If we only call MenuConstruct when a menu // native menu items being created. If we only call MenuConstruct when a menu
@@ -367,7 +367,7 @@ nsresult nsMenuX::RemoveAll()
nsEventStatus nsMenuX::MenuOpened() nsEventStatus nsMenuX::MenuOpened()
{ {
// Open the node. // Open the node.
mContent->SetAttr(kNameSpaceID_None, nsWidgetAtoms::open, NS_LITERAL_STRING("true"), true); mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::open, NS_LITERAL_STRING("true"), true);
// Fire a handler. If we're told to stop, don't build the menu at all // Fire a handler. If we're told to stop, don't build the menu at all
bool keepProcessing = OnOpen(); bool keepProcessing = OnOpen();
@@ -404,7 +404,7 @@ void nsMenuX::MenuClosed()
if (mNeedsRebuild) if (mNeedsRebuild)
mConstructed = false; mConstructed = false;
mContent->UnsetAttr(kNameSpaceID_None, nsWidgetAtoms::open, true); mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::open, true);
nsEventStatus status = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nsnull, nsMouseEvent::eReal); nsMouseEvent event(true, NS_XUL_POPUP_HIDDEN, nsnull, nsMouseEvent::eReal);
@@ -469,9 +469,9 @@ void nsMenuX::MenuConstruct()
if (child) { if (child) {
// depending on the type, create a menu item, separator, or submenu // depending on the type, create a menu item, separator, or submenu
nsIAtom *tag = child->Tag(); nsIAtom *tag = child->Tag();
if (tag == nsWidgetAtoms::menuitem || tag == nsWidgetAtoms::menuseparator) if (tag == nsGkAtoms::menuitem || tag == nsGkAtoms::menuseparator)
LoadMenuItem(child); LoadMenuItem(child);
else if (tag == nsWidgetAtoms::menu) else if (tag == nsGkAtoms::menu)
LoadSubMenu(child); LoadSubMenu(child);
} }
} // for each menu item } // for each menu item
@@ -532,18 +532,18 @@ void nsMenuX::LoadMenuItem(nsIContent* inMenuItemContent)
return; return;
nsAutoString menuitemName; nsAutoString menuitemName;
inMenuItemContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, menuitemName); inMenuItemContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, menuitemName);
// printf("menuitem %s \n", NS_LossyConvertUTF16toASCII(menuitemName).get()); // printf("menuitem %s \n", NS_LossyConvertUTF16toASCII(menuitemName).get());
EMenuItemType itemType = eRegularMenuItemType; EMenuItemType itemType = eRegularMenuItemType;
if (inMenuItemContent->Tag() == nsWidgetAtoms::menuseparator) { if (inMenuItemContent->Tag() == nsGkAtoms::menuseparator) {
itemType = eSeparatorMenuItemType; itemType = eSeparatorMenuItemType;
} }
else { else {
static nsIContent::AttrValuesArray strings[] = static nsIContent::AttrValuesArray strings[] =
{&nsWidgetAtoms::checkbox, &nsWidgetAtoms::radio, nsnull}; {&nsGkAtoms::checkbox, &nsGkAtoms::radio, nsnull};
switch (inMenuItemContent->FindAttrValueIn(kNameSpaceID_None, nsWidgetAtoms::type, switch (inMenuItemContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
strings, eCaseMatters)) { strings, eCaseMatters)) {
case 0: itemType = eCheckboxMenuItemType; break; case 0: itemType = eCheckboxMenuItemType; break;
case 1: itemType = eRadioMenuItemType; break; case 1: itemType = eRadioMenuItemType; break;
@@ -621,10 +621,10 @@ bool nsMenuX::OnOpen()
PRUint32 count = popupContent->GetChildCount(); PRUint32 count = popupContent->GetChildCount();
for (PRUint32 i = 0; i < count; i++) { for (PRUint32 i = 0; i < count; i++) {
nsIContent *grandChild = popupContent->GetChildAt(i); nsIContent *grandChild = popupContent->GetChildAt(i);
if (grandChild->Tag() == nsWidgetAtoms::menuitem) { if (grandChild->Tag() == nsGkAtoms::menuitem) {
// See if we have a command attribute. // See if we have a command attribute.
nsAutoString command; nsAutoString command;
grandChild->GetAttr(kNameSpaceID_None, nsWidgetAtoms::command, command); grandChild->GetAttr(kNameSpaceID_None, nsGkAtoms::command, command);
if (!command.IsEmpty()) { if (!command.IsEmpty()) {
// We do! Look it up in our document // We do! Look it up in our document
nsCOMPtr<nsIDOMElement> commandElt; nsCOMPtr<nsIDOMElement> commandElt;
@@ -633,33 +633,33 @@ bool nsMenuX::OnOpen()
if (commandContent) { if (commandContent) {
nsAutoString commandDisabled, menuDisabled; nsAutoString commandDisabled, menuDisabled;
commandContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, commandDisabled); commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled);
grandChild->GetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, menuDisabled); grandChild->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, menuDisabled);
if (!commandDisabled.Equals(menuDisabled)) { if (!commandDisabled.Equals(menuDisabled)) {
// The menu's disabled state needs to be updated to match the command. // The menu's disabled state needs to be updated to match the command.
if (commandDisabled.IsEmpty()) if (commandDisabled.IsEmpty())
grandChild->UnsetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, true); grandChild->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, true);
else else
grandChild->SetAttr(kNameSpaceID_None, nsWidgetAtoms::disabled, commandDisabled, true); grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandDisabled, true);
} }
// The menu's value and checked states need to be updated to match the command. // The menu's value and checked states need to be updated to match the command.
// Note that (unlike the disabled state) if the command has *no* value for either, we // Note that (unlike the disabled state) if the command has *no* value for either, we
// assume the menu is supplying its own. // assume the menu is supplying its own.
nsAutoString commandChecked, menuChecked; nsAutoString commandChecked, menuChecked;
commandContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::checked, commandChecked); commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::checked, commandChecked);
grandChild->GetAttr(kNameSpaceID_None, nsWidgetAtoms::checked, menuChecked); grandChild->GetAttr(kNameSpaceID_None, nsGkAtoms::checked, menuChecked);
if (!commandChecked.Equals(menuChecked)) { if (!commandChecked.Equals(menuChecked)) {
if (!commandChecked.IsEmpty()) if (!commandChecked.IsEmpty())
grandChild->SetAttr(kNameSpaceID_None, nsWidgetAtoms::checked, commandChecked, true); grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, commandChecked, true);
} }
nsAutoString commandValue, menuValue; nsAutoString commandValue, menuValue;
commandContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, commandValue); commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, commandValue);
grandChild->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, menuValue); grandChild->GetAttr(kNameSpaceID_None, nsGkAtoms::label, menuValue);
if (!commandValue.Equals(menuValue)) { if (!commandValue.Equals(menuValue)) {
if (!commandValue.IsEmpty()) if (!commandValue.IsEmpty())
grandChild->SetAttr(kNameSpaceID_None, nsWidgetAtoms::label, commandValue, true); grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::label, commandValue, true);
} }
} }
} }
@@ -714,7 +714,7 @@ void nsMenuX::GetMenuPopupContent(nsIContent** aResult)
PRInt32 dummy; PRInt32 dummy;
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
xblService->ResolveTag(mContent, &dummy, getter_AddRefs(tag)); xblService->ResolveTag(mContent, &dummy, getter_AddRefs(tag));
if (tag == nsWidgetAtoms::menupopup) { if (tag == nsGkAtoms::menupopup) {
*aResult = mContent; *aResult = mContent;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return; return;
@@ -730,7 +730,7 @@ void nsMenuX::GetMenuPopupContent(nsIContent** aResult)
nsIContent *child = mContent->GetChildAt(i); nsIContent *child = mContent->GetChildAt(i);
nsCOMPtr<nsIAtom> tag; nsCOMPtr<nsIAtom> tag;
xblService->ResolveTag(child, &dummy, getter_AddRefs(tag)); xblService->ResolveTag(child, &dummy, getter_AddRefs(tag));
if (tag == nsWidgetAtoms::menupopup) { if (tag == nsGkAtoms::menupopup) {
*aResult = child; *aResult = child;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return; return;
@@ -748,7 +748,7 @@ bool nsMenuX::IsXULHelpMenu(nsIContent* aMenuContent)
bool retval = false; bool retval = false;
if (aMenuContent) { if (aMenuContent) {
nsAutoString id; nsAutoString id;
aMenuContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::id, id); aMenuContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
if (id.Equals(NS_LITERAL_STRING("helpMenu"))) if (id.Equals(NS_LITERAL_STRING("helpMenu")))
retval = true; retval = true;
} }
@@ -765,17 +765,17 @@ void nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConte
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
// ignore the |open| attribute, which is by far the most common // ignore the |open| attribute, which is by far the most common
if (gConstructingMenu || (aAttribute == nsWidgetAtoms::open)) if (gConstructingMenu || (aAttribute == nsGkAtoms::open))
return; return;
nsMenuObjectTypeX parentType = mParent->MenuObjectType(); nsMenuObjectTypeX parentType = mParent->MenuObjectType();
if (aAttribute == nsWidgetAtoms::disabled) { if (aAttribute == nsGkAtoms::disabled) {
SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, SetEnabled(!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
nsWidgetAtoms::_true, eCaseMatters)); nsGkAtoms::_true, eCaseMatters));
} }
else if (aAttribute == nsWidgetAtoms::label) { else if (aAttribute == nsGkAtoms::label) {
mContent->GetAttr(kNameSpaceID_None, nsWidgetAtoms::label, mLabel); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, mLabel);
// invalidate my parent. If we're a submenu parent, we have to rebuild // invalidate my parent. If we're a submenu parent, we have to rebuild
// the parent menu in order for the changes to be picked up. If we're // the parent menu in order for the changes to be picked up. If we're
@@ -793,7 +793,7 @@ void nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConte
static_cast<nsStandaloneNativeMenu*>(mParent)->GetMenuXObject()->SetRebuild(true); static_cast<nsStandaloneNativeMenu*>(mParent)->GetMenuXObject()->SetRebuild(true);
} }
} }
else if (aAttribute == nsWidgetAtoms::hidden || aAttribute == nsWidgetAtoms::collapsed) { else if (aAttribute == nsGkAtoms::hidden || aAttribute == nsGkAtoms::collapsed) {
SetRebuild(true); SetRebuild(true);
bool contentIsHiddenOrCollapsed = nsMenuUtilsX::NodeIsHiddenOrCollapsed(mContent); bool contentIsHiddenOrCollapsed = nsMenuUtilsX::NodeIsHiddenOrCollapsed(mContent);
@@ -833,7 +833,7 @@ void nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConte
} }
} }
} }
else if (aAttribute == nsWidgetAtoms::image) { else if (aAttribute == nsGkAtoms::image) {
SetupIcon(); SetupIcon();
} }

View File

@@ -55,7 +55,7 @@
#include "nsEventStates.h" #include "nsEventStates.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsPresContext.h" #include "nsPresContext.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsToolkit.h" #include "nsToolkit.h"
#include "nsCocoaWindow.h" #include "nsCocoaWindow.h"
#include "nsNativeThemeColors.h" #include "nsNativeThemeColors.h"
@@ -244,9 +244,9 @@ static BOOL IsToolbarStyleContainer(nsIFrame* aFrame)
if (!content) if (!content)
return NO; return NO;
if (content->Tag() == nsWidgetAtoms::toolbar || if (content->Tag() == nsGkAtoms::toolbar ||
content->Tag() == nsWidgetAtoms::toolbox || content->Tag() == nsGkAtoms::toolbox ||
content->Tag() == nsWidgetAtoms::statusbar) content->Tag() == nsGkAtoms::statusbar)
return YES; return YES;
switch (aFrame->GetStyleDisplay()->mAppearance) { switch (aFrame->GetStyleDisplay()->mAppearance) {
@@ -1541,10 +1541,10 @@ void
nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, nsEventStates aButtonStates[]) nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, nsEventStates aButtonStates[])
{ {
static nsIContent::AttrValuesArray attributeValues[] = { static nsIContent::AttrValuesArray attributeValues[] = {
&nsWidgetAtoms::scrollbarUpTop, &nsGkAtoms::scrollbarUpTop,
&nsWidgetAtoms::scrollbarDownTop, &nsGkAtoms::scrollbarDownTop,
&nsWidgetAtoms::scrollbarUpBottom, &nsGkAtoms::scrollbarUpBottom,
&nsWidgetAtoms::scrollbarDownBottom, &nsGkAtoms::scrollbarDownBottom,
nsnull nsnull
}; };
@@ -1555,7 +1555,7 @@ nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, nsEventStates aBut
nsIContent *childContent = childFrame->GetContent(); nsIContent *childContent = childFrame->GetContent();
if (!childContent) continue; if (!childContent) continue;
PRInt32 attrIndex = childContent->FindAttrValueIn(kNameSpaceID_None, nsWidgetAtoms::sbattr, PRInt32 attrIndex = childContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::sbattr,
attributeValues, eCaseMatters); attributeValues, eCaseMatters);
if (attrIndex < 0) continue; if (attrIndex < 0) continue;
@@ -1579,13 +1579,13 @@ nsNativeThemeCocoa::GetScrollbarDrawInfo(HIThemeTrackDrawInfo& aTdi, nsIFrame *a
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
PRInt32 curpos = CheckIntAttr(aFrame, nsWidgetAtoms::curpos, 0); PRInt32 curpos = CheckIntAttr(aFrame, nsGkAtoms::curpos, 0);
PRInt32 minpos = CheckIntAttr(aFrame, nsWidgetAtoms::minpos, 0); PRInt32 minpos = CheckIntAttr(aFrame, nsGkAtoms::minpos, 0);
PRInt32 maxpos = CheckIntAttr(aFrame, nsWidgetAtoms::maxpos, 100); PRInt32 maxpos = CheckIntAttr(aFrame, nsGkAtoms::maxpos, 100);
PRInt32 thumbSize = CheckIntAttr(aFrame, nsWidgetAtoms::pageincrement, 10); PRInt32 thumbSize = CheckIntAttr(aFrame, nsGkAtoms::pageincrement, 10);
bool isHorizontal = aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::orient, bool isHorizontal = aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::orient,
nsWidgetAtoms::horizontal, eCaseMatters); nsGkAtoms::horizontal, eCaseMatters);
bool isSmall = aFrame->GetStyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL; bool isSmall = aFrame->GetStyleDisplay()->mAppearance == NS_THEME_SCROLLBAR_SMALL;
aTdi.version = 0; aTdi.version = 0;
@@ -1672,7 +1672,7 @@ nsNativeThemeCocoa::GetParentScrollbarFrame(nsIFrame *aFrame)
// Walk our parents to find a scrollbar frame // Walk our parents to find a scrollbar frame
nsIFrame *scrollbarFrame = aFrame; nsIFrame *scrollbarFrame = aFrame;
do { do {
if (scrollbarFrame->GetType() == nsWidgetAtoms::scrollbarFrame) break; if (scrollbarFrame->GetType() == nsGkAtoms::scrollbarFrame) break;
} while ((scrollbarFrame = scrollbarFrame->GetParent())); } while ((scrollbarFrame = scrollbarFrame->GetParent()));
// We return null if we can't find a parent scrollbar frame // We return null if we can't find a parent scrollbar frame
@@ -1887,7 +1887,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
version: 0, version: 0,
itemType: kThemeMenuItemPlain, itemType: kThemeMenuItemPlain,
state: (IsDisabled(aFrame, eventState) ? static_cast<ThemeMenuState>(kThemeMenuDisabled) : state: (IsDisabled(aFrame, eventState) ? static_cast<ThemeMenuState>(kThemeMenuDisabled) :
CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ?
static_cast<ThemeMenuState>(kThemeMenuSelected) : static_cast<ThemeMenuState>(kThemeMenuSelected) :
static_cast<ThemeMenuState>(kThemeMenuActive)) static_cast<ThemeMenuState>(kThemeMenuActive))
}; };
@@ -1904,7 +1904,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
menuState = kThemeMenuDisabled; menuState = kThemeMenuDisabled;
} }
else { else {
menuState = CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? menuState = CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ?
kThemeMenuSelected : kThemeMenuActive; kThemeMenuSelected : kThemeMenuActive;
} }
@@ -1949,11 +1949,11 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
case NS_THEME_SPINNER: { case NS_THEME_SPINNER: {
ThemeDrawState state = kThemeStateActive; ThemeDrawState state = kThemeStateActive;
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
if (content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::state, if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::state,
NS_LITERAL_STRING("up"), eCaseMatters)) { NS_LITERAL_STRING("up"), eCaseMatters)) {
state = kThemeStatePressedUp; state = kThemeStatePressedUp;
} }
else if (content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::state, else if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::state,
NS_LITERAL_STRING("down"), eCaseMatters)) { NS_LITERAL_STRING("down"), eCaseMatters)) {
state = kThemeStatePressedDown; state = kThemeStatePressedDown;
} }
@@ -2104,14 +2104,14 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
case NS_THEME_SCALE_HORIZONTAL: case NS_THEME_SCALE_HORIZONTAL:
case NS_THEME_SCALE_VERTICAL: { case NS_THEME_SCALE_VERTICAL: {
PRInt32 curpos = CheckIntAttr(aFrame, nsWidgetAtoms::curpos, 0); PRInt32 curpos = CheckIntAttr(aFrame, nsGkAtoms::curpos, 0);
PRInt32 minpos = CheckIntAttr(aFrame, nsWidgetAtoms::minpos, 0); PRInt32 minpos = CheckIntAttr(aFrame, nsGkAtoms::minpos, 0);
PRInt32 maxpos = CheckIntAttr(aFrame, nsWidgetAtoms::maxpos, 100); PRInt32 maxpos = CheckIntAttr(aFrame, nsGkAtoms::maxpos, 100);
if (!maxpos) if (!maxpos)
maxpos = 100; maxpos = 100;
bool reverse = aFrame->GetContent()-> bool reverse = aFrame->GetContent()->
AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::dir, AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
NS_LITERAL_STRING("reverse"), eCaseMatters); NS_LITERAL_STRING("reverse"), eCaseMatters);
DrawScale(cgContext, macRect, eventState, DrawScale(cgContext, macRect, eventState,
(aWidgetType == NS_THEME_SCALE_VERTICAL), reverse, (aWidgetType == NS_THEME_SCALE_VERTICAL), reverse,
@@ -2655,14 +2655,14 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
// Check the attribute to see if it's relevant. // Check the attribute to see if it's relevant.
// disabled, checked, dlgtype, default, etc. // disabled, checked, dlgtype, default, etc.
*aShouldRepaint = false; *aShouldRepaint = false;
if (aAttribute == nsWidgetAtoms::disabled || if (aAttribute == nsGkAtoms::disabled ||
aAttribute == nsWidgetAtoms::checked || aAttribute == nsGkAtoms::checked ||
aAttribute == nsWidgetAtoms::selected || aAttribute == nsGkAtoms::selected ||
aAttribute == nsWidgetAtoms::mozmenuactive || aAttribute == nsGkAtoms::menuactive ||
aAttribute == nsWidgetAtoms::sortdirection || aAttribute == nsGkAtoms::sortDirection ||
aAttribute == nsWidgetAtoms::focused || aAttribute == nsGkAtoms::focused ||
aAttribute == nsWidgetAtoms::_default || aAttribute == nsGkAtoms::_default ||
aAttribute == nsWidgetAtoms::open) aAttribute == nsGkAtoms::open)
*aShouldRepaint = true; *aShouldRepaint = true;
} }
@@ -2690,7 +2690,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
// if this is a dropdown button in a combobox the answer is always no // if this is a dropdown button in a combobox the answer is always no
if (aWidgetType == NS_THEME_DROPDOWN_BUTTON) { if (aWidgetType == NS_THEME_DROPDOWN_BUTTON) {
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
if (parentFrame && (parentFrame->GetType() == nsWidgetAtoms::comboboxControlFrame)) if (parentFrame && (parentFrame->GetType() == nsGkAtoms::comboboxControlFrame))
return false; return false;
} }
@@ -2765,7 +2765,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
case NS_THEME_RESIZER: case NS_THEME_RESIZER:
{ {
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
if (!parentFrame || parentFrame->GetType() != nsWidgetAtoms::scrollFrame) if (!parentFrame || parentFrame->GetType() != nsGkAtoms::scrollFrame)
return true; return true;
// Note that IsWidgetStyled is not called for resizers on Mac. This is // Note that IsWidgetStyled is not called for resizers on Mac. This is
@@ -2851,7 +2851,7 @@ nsNativeThemeCocoa::GetProgressValue(nsIFrame* aFrame)
} }
} }
return (double)CheckIntAttr(aFrame, nsWidgetAtoms::value, 0); return (double)CheckIntAttr(aFrame, nsGkAtoms::value, 0);
} }
double double
@@ -2869,5 +2869,5 @@ nsNativeThemeCocoa::GetProgressMaxValue(nsIFrame* aFrame)
} }
} }
return (double)NS_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1); return (double)NS_MAX(CheckIntAttr(aFrame, nsGkAtoms::max, 100), 1);
} }

View File

@@ -43,7 +43,7 @@
#include "nsIMutationObserver.h" #include "nsIMutationObserver.h"
#include "nsEvent.h" #include "nsEvent.h"
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
@@ -72,7 +72,7 @@ nsStandaloneNativeMenu::Init(nsIDOMElement * aDOMElement)
nsIAtom * tag = content->Tag(); nsIAtom * tag = content->Tag();
if (!content->IsXUL() || if (!content->IsXUL() ||
(tag != nsWidgetAtoms::menu && tag != nsWidgetAtoms::menupopup)) (tag != nsGkAtoms::menu && tag != nsGkAtoms::menupopup))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
rv = nsMenuGroupOwnerX::Create(content); rv = nsMenuGroupOwnerX::Create(content);

View File

@@ -63,7 +63,7 @@ extern "C" {
#include "nsCocoaUtils.h" #include "nsCocoaUtils.h"
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsIRollupListener.h" #include "nsIRollupListener.h"
#include "nsIWidget.h" #include "nsIWidget.h"
@@ -107,8 +107,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsToolkit, nsIToolkit);
NS_IMETHODIMP NS_IMETHODIMP
nsToolkit::Init(PRThread * aThread) nsToolkit::Init(PRThread * aThread)
{ {
nsWidgetAtoms::RegisterAtoms();
mInited = true; mInited = true;
RegisterForSleepWakeNotifcations(); RegisterForSleepWakeNotifcations();

View File

@@ -57,7 +57,7 @@
#include "prlink.h" #include "prlink.h"
#include "nsIDOMHTMLInputElement.h" #include "nsIDOMHTMLInputElement.h"
#include "nsRenderingContext.h" #include "nsRenderingContext.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include <gdk/gdkprivate.h> #include <gdk/gdkprivate.h>
@@ -224,8 +224,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
if (aWidgetFlags) { if (aWidgetFlags) {
if (!atom) { if (!atom) {
atom = (aWidgetType == NS_THEME_CHECKBOX || atom = (aWidgetType == NS_THEME_CHECKBOX ||
aWidgetType == NS_THEME_CHECKBOX_LABEL) ? nsWidgetAtoms::checked aWidgetType == NS_THEME_CHECKBOX_LABEL) ? nsGkAtoms::checked
: nsWidgetAtoms::selected; : nsGkAtoms::selected;
} }
*aWidgetFlags = CheckBooleanAttr(aFrame, atom); *aWidgetFlags = CheckBooleanAttr(aFrame, atom);
} }
@@ -287,8 +287,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
// the slider to the actual scrollbar object // the slider to the actual scrollbar object
nsIFrame *tmpFrame = aFrame->GetParent()->GetParent(); nsIFrame *tmpFrame = aFrame->GetParent()->GetParent();
aState->curpos = CheckIntAttr(tmpFrame, nsWidgetAtoms::curpos, 0); aState->curpos = CheckIntAttr(tmpFrame, nsGkAtoms::curpos, 0);
aState->maxpos = CheckIntAttr(tmpFrame, nsWidgetAtoms::maxpos, 100); aState->maxpos = CheckIntAttr(tmpFrame, nsGkAtoms::maxpos, 100);
} }
if (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP || if (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP ||
@@ -297,8 +297,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) { aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) {
// set the state to disabled when the scrollbar is scrolled to // set the state to disabled when the scrollbar is scrolled to
// the beginning or the end, depending on the button type. // the beginning or the end, depending on the button type.
PRInt32 curpos = CheckIntAttr(aFrame, nsWidgetAtoms::curpos, 0); PRInt32 curpos = CheckIntAttr(aFrame, nsGkAtoms::curpos, 0);
PRInt32 maxpos = CheckIntAttr(aFrame, nsWidgetAtoms::maxpos, 100); PRInt32 maxpos = CheckIntAttr(aFrame, nsGkAtoms::maxpos, 100);
if ((curpos == 0 && (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP || if ((curpos == 0 && (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP ||
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT)) || aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT)) ||
(curpos == maxpos && (curpos == maxpos &&
@@ -310,7 +310,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
// we set the active attribute on the element to true if it's // we set the active attribute on the element to true if it's
// pressed with any mouse button. // pressed with any mouse button.
// This allows us to show that it's active without setting :active // This allows us to show that it's active without setting :active
else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::active)) else if (CheckBooleanAttr(aFrame, nsGkAtoms::active))
aState->active = true; aState->active = true;
if (aWidgetFlags) { if (aWidgetFlags) {
@@ -340,7 +340,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
aState->inHover = menuFrame->IsOpen(); aState->inHover = menuFrame->IsOpen();
*aWidgetFlags |= MOZ_TOPLEVEL_MENU_ITEM; *aWidgetFlags |= MOZ_TOPLEVEL_MENU_ITEM;
} else { } else {
aState->inHover = CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive); aState->inHover = CheckBooleanAttr(aFrame, nsGkAtoms::menuactive);
*aWidgetFlags &= ~MOZ_TOPLEVEL_MENU_ITEM; *aWidgetFlags &= ~MOZ_TOPLEVEL_MENU_ITEM;
} }
@@ -351,8 +351,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
*aWidgetFlags = 0; *aWidgetFlags = 0;
if (aFrame && aFrame->GetContent()) { if (aFrame && aFrame->GetContent()) {
*aWidgetFlags = aFrame->GetContent()-> *aWidgetFlags = aFrame->GetContent()->
AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::checked, AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
nsWidgetAtoms::_true, eIgnoreCase); nsGkAtoms::_true, eIgnoreCase);
} }
} }
} }
@@ -374,7 +374,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
// When the input field of the drop down button has focus, some themes // When the input field of the drop down button has focus, some themes
// should draw focus for the drop down button as well. // should draw focus for the drop down button as well.
if (aWidgetType == NS_THEME_DROPDOWN_BUTTON && aWidgetFlags) { if (aWidgetType == NS_THEME_DROPDOWN_BUTTON && aWidgetFlags) {
*aWidgetFlags = CheckBooleanAttr(aFrame, nsWidgetAtoms::parentfocused); *aWidgetFlags = CheckBooleanAttr(aFrame, nsGkAtoms::parentfocused);
} }
} }
} }
@@ -1282,8 +1282,8 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN || aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT || aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT ||
aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) && aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) &&
(aAttribute == nsWidgetAtoms::curpos || (aAttribute == nsGkAtoms::curpos ||
aAttribute == nsWidgetAtoms::maxpos)) { aAttribute == nsGkAtoms::maxpos)) {
*aShouldRepaint = true; *aShouldRepaint = true;
return NS_OK; return NS_OK;
} }
@@ -1299,15 +1299,15 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
// Check the attribute to see if it's relevant. // Check the attribute to see if it's relevant.
// disabled, checked, dlgtype, default, etc. // disabled, checked, dlgtype, default, etc.
*aShouldRepaint = false; *aShouldRepaint = false;
if (aAttribute == nsWidgetAtoms::disabled || if (aAttribute == nsGkAtoms::disabled ||
aAttribute == nsWidgetAtoms::checked || aAttribute == nsGkAtoms::checked ||
aAttribute == nsWidgetAtoms::selected || aAttribute == nsGkAtoms::selected ||
aAttribute == nsWidgetAtoms::focused || aAttribute == nsGkAtoms::focused ||
aAttribute == nsWidgetAtoms::readonly || aAttribute == nsGkAtoms::readonly ||
aAttribute == nsWidgetAtoms::_default || aAttribute == nsGkAtoms::_default ||
aAttribute == nsWidgetAtoms::mozmenuactive || aAttribute == nsGkAtoms::menuactive ||
aAttribute == nsWidgetAtoms::open || aAttribute == nsGkAtoms::open ||
aAttribute == nsWidgetAtoms::parentfocused) aAttribute == nsGkAtoms::parentfocused)
*aShouldRepaint = true; *aShouldRepaint = true;
} }

View File

@@ -39,7 +39,6 @@
#include "nscore.h" // needed for 'nsnull' #include "nscore.h" // needed for 'nsnull'
#include "nsGTKToolkit.h" #include "nsGTKToolkit.h"
#include "nsWidgetAtoms.h"
// //
// Static thread local storage index of the Toolkit // Static thread local storage index of the Toolkit
@@ -105,9 +104,6 @@ GdkGC *nsGTKToolkit::GetSharedGC(void)
NS_IMETHODIMP nsGTKToolkit::Init(PRThread *aThread) NS_IMETHODIMP nsGTKToolkit::Init(PRThread *aThread)
{ {
CreateSharedGC(); CreateSharedGC();
nsWidgetAtoms::RegisterAtoms();
return NS_OK; return NS_OK;
} }

View File

@@ -89,7 +89,7 @@
#include "gtk2compat.h" #include "gtk2compat.h"
#endif #endif
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#ifdef MOZ_ENABLE_STARTUP_NOTIFICATION #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN #define SN_API_NOT_YET_FROZEN
@@ -2852,10 +2852,10 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
} }
// Map buttons 8-9 to back/forward // Map buttons 8-9 to back/forward
case 8: case 8:
DispatchCommandEvent(nsWidgetAtoms::Back); DispatchCommandEvent(nsGkAtoms::Back);
return; return;
case 9: case 9:
DispatchCommandEvent(nsWidgetAtoms::Forward); DispatchCommandEvent(nsGkAtoms::Forward);
return; return;
default: default:
return; return;
@@ -3001,7 +3001,7 @@ bool
nsWindow::DispatchCommandEvent(nsIAtom* aCommand) nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
{ {
nsEventStatus status; nsEventStatus status;
nsCommandEvent event(true, nsWidgetAtoms::onAppCommand, aCommand, this); nsCommandEvent event(true, nsGkAtoms::onAppCommand, aCommand, this);
DispatchEvent(&event, status); DispatchEvent(&event, status);
return TRUE; return TRUE;
} }
@@ -3152,19 +3152,19 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
// Look for specialized app-command keys // Look for specialized app-command keys
switch (aEvent->keyval) { switch (aEvent->keyval) {
case XF86XK_Back: case XF86XK_Back:
return DispatchCommandEvent(nsWidgetAtoms::Back); return DispatchCommandEvent(nsGkAtoms::Back);
case XF86XK_Forward: case XF86XK_Forward:
return DispatchCommandEvent(nsWidgetAtoms::Forward); return DispatchCommandEvent(nsGkAtoms::Forward);
case XF86XK_Refresh: case XF86XK_Refresh:
return DispatchCommandEvent(nsWidgetAtoms::Reload); return DispatchCommandEvent(nsGkAtoms::Reload);
case XF86XK_Stop: case XF86XK_Stop:
return DispatchCommandEvent(nsWidgetAtoms::Stop); return DispatchCommandEvent(nsGkAtoms::Stop);
case XF86XK_Search: case XF86XK_Search:
return DispatchCommandEvent(nsWidgetAtoms::Search); return DispatchCommandEvent(nsGkAtoms::Search);
case XF86XK_Favorites: case XF86XK_Favorites:
return DispatchCommandEvent(nsWidgetAtoms::Bookmarks); return DispatchCommandEvent(nsGkAtoms::Bookmarks);
case XF86XK_HomePage: case XF86XK_HomePage:
return DispatchCommandEvent(nsWidgetAtoms::Home); return DispatchCommandEvent(nsGkAtoms::Home);
case XF86XK_Copy: case XF86XK_Copy:
case GDK_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo case GDK_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY); return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY);

View File

@@ -49,7 +49,7 @@
#include "nsIDragService.h" #include "nsIDragService.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "gfxASurface.h" #include "gfxASurface.h"

View File

@@ -38,7 +38,6 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsToolkit.h" #include "nsToolkit.h"
#include "nsWidgetAtoms.h"
NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit) NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit)
@@ -78,9 +77,6 @@ nsToolkit::~nsToolkit()
NS_METHOD nsToolkit::Init(PRThread *aThread) NS_METHOD nsToolkit::Init(PRThread *aThread)
{ {
NS_ASSERTION(aThread, "Can only initialize toolkit on the current thread"); NS_ASSERTION(aThread, "Can only initialize toolkit on the current thread");
nsWidgetAtoms::RegisterAtoms();
return NS_OK; return NS_OK;
} }

View File

@@ -80,7 +80,7 @@
#include "nsOS2Uni.h" #include "nsOS2Uni.h"
#include "nsTHashtable.h" #include "nsTHashtable.h"
#include "nsToolkit.h" #include "nsToolkit.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "wdgtos2rc.h" #include "wdgtos2rc.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
@@ -2801,22 +2801,22 @@ bool nsWindow::DispatchCommandEvent(PRUint32 aEventCommand)
switch (aEventCommand) { switch (aEventCommand) {
case APPCOMMAND_BROWSER_BACKWARD: case APPCOMMAND_BROWSER_BACKWARD:
command = nsWidgetAtoms::Back; command = nsGkAtoms::Back;
break; break;
case APPCOMMAND_BROWSER_FORWARD: case APPCOMMAND_BROWSER_FORWARD:
command = nsWidgetAtoms::Forward; command = nsGkAtoms::Forward;
break; break;
case APPCOMMAND_BROWSER_REFRESH: case APPCOMMAND_BROWSER_REFRESH:
command = nsWidgetAtoms::Reload; command = nsGkAtoms::Reload;
break; break;
case APPCOMMAND_BROWSER_STOP: case APPCOMMAND_BROWSER_STOP:
command = nsWidgetAtoms::Stop; command = nsGkAtoms::Stop;
break; break;
default: default:
return PR_FALSE; return PR_FALSE;
} }
nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, command, this); nsCommandEvent event(PR_TRUE, nsGkAtoms::onAppCommand, command, this);
InitEvent(event); InitEvent(event);
return DispatchWindowEvent(&event); return DispatchWindowEvent(&event);
} }

View File

@@ -43,8 +43,6 @@
#include "nscore.h" // needed for 'nsnull' #include "nscore.h" // needed for 'nsnull'
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsWidgetAtoms.h"
//#include "plevent.h"
// Static thread local storage index of the Toolkit // Static thread local storage index of the Toolkit
// object associated with a given thread... // object associated with a given thread...
@@ -76,8 +74,6 @@ NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsToolkit::Init(PRThread *aThread) NS_IMETHODIMP nsToolkit::Init(PRThread *aThread)
{ {
nsWidgetAtoms::RegisterAtoms();
return NS_OK; return NS_OK;
} }

View File

@@ -1517,7 +1517,7 @@ is_latin_shortcut_key(quint32 aKeyval)
nsEventStatus nsEventStatus
nsWindow::DispatchCommandEvent(nsIAtom* aCommand) nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
{ {
nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, aCommand, this); nsCommandEvent event(PR_TRUE, nsGkAtoms::onAppCommand, aCommand, this);
nsEventStatus status; nsEventStatus status;
DispatchEvent(&event, status); DispatchEvent(&event, status);
@@ -1673,19 +1673,19 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
// Look for specialized app-command keys // Look for specialized app-command keys
switch (aEvent->key()) { switch (aEvent->key()) {
case Qt::Key_Back: case Qt::Key_Back:
return DispatchCommandEvent(nsWidgetAtoms::Back); return DispatchCommandEvent(nsGkAtoms::Back);
case Qt::Key_Forward: case Qt::Key_Forward:
return DispatchCommandEvent(nsWidgetAtoms::Forward); return DispatchCommandEvent(nsGkAtoms::Forward);
case Qt::Key_Refresh: case Qt::Key_Refresh:
return DispatchCommandEvent(nsWidgetAtoms::Reload); return DispatchCommandEvent(nsGkAtoms::Reload);
case Qt::Key_Stop: case Qt::Key_Stop:
return DispatchCommandEvent(nsWidgetAtoms::Stop); return DispatchCommandEvent(nsGkAtoms::Stop);
case Qt::Key_Search: case Qt::Key_Search:
return DispatchCommandEvent(nsWidgetAtoms::Search); return DispatchCommandEvent(nsGkAtoms::Search);
case Qt::Key_Favorites: case Qt::Key_Favorites:
return DispatchCommandEvent(nsWidgetAtoms::Bookmarks); return DispatchCommandEvent(nsGkAtoms::Bookmarks);
case Qt::Key_HomePage: case Qt::Key_HomePage:
return DispatchCommandEvent(nsWidgetAtoms::Home); return DispatchCommandEvent(nsGkAtoms::Home);
case Qt::Key_Copy: case Qt::Key_Copy:
case Qt::Key_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo case Qt::Key_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY); return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY);

View File

@@ -52,7 +52,7 @@
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#ifdef MOZ_LOGGING #ifdef MOZ_LOGGING

View File

@@ -55,7 +55,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIDOMHTMLInputElement.h" #include "nsIDOMHTMLInputElement.h"
#include "nsMenuFrame.h" #include "nsMenuFrame.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include <malloc.h> #include <malloc.h>
#include "nsWindow.h" #include "nsWindow.h"
#include "nsIComboboxControlFrame.h" #include "nsIComboboxControlFrame.h"
@@ -535,10 +535,10 @@ nsNativeThemeWin::IsMenuActive(nsIFrame *aFrame, PRUint8 aWidgetType)
{ {
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
if (content->IsXUL() && if (content->IsXUL() &&
content->NodeInfo()->Equals(nsWidgetAtoms::richlistitem)) content->NodeInfo()->Equals(nsGkAtoms::richlistitem))
return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); return CheckBooleanAttr(aFrame, nsGkAtoms::selected);
return CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive); return CheckBooleanAttr(aFrame, nsGkAtoms::menuactive);
} }
/** /**
@@ -983,7 +983,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
case NS_THEME_DROPDOWN_BUTTON: { case NS_THEME_DROPDOWN_BUTTON: {
bool isHTML = IsHTMLContent(aFrame); bool isHTML = IsHTMLContent(aFrame);
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
bool isMenulist = !isHTML && parentFrame->GetType() == nsWidgetAtoms::menuFrame; bool isMenulist = !isHTML && parentFrame->GetType() == nsGkAtoms::menuFrame;
bool isOpen = false; bool isOpen = false;
// HTML select and XUL menulist dropdown buttons get state from the parent. // HTML select and XUL menulist dropdown buttons get state from the parent.
@@ -1125,7 +1125,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
nsEventStates eventState = GetContentState(aFrame, aWidgetType); nsEventStates eventState = GetContentState(aFrame, aWidgetType);
// NOTE: we can probably use NS_EVENT_STATE_CHECKED // NOTE: we can probably use NS_EVENT_STATE_CHECKED
isChecked = CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); isChecked = CheckBooleanAttr(aFrame, nsGkAtoms::checked);
aPart = MENU_POPUPCHECK; aPart = MENU_POPUPCHECK;
aState = MC_CHECKMARKNORMAL; aState = MC_CHECKMARKNORMAL;
@@ -1371,7 +1371,7 @@ RENDER_AGAIN:
else if (aWidgetType == NS_THEME_MENUCHECKBOX || aWidgetType == NS_THEME_MENURADIO) else if (aWidgetType == NS_THEME_MENUCHECKBOX || aWidgetType == NS_THEME_MENURADIO)
{ {
bool isChecked = false; bool isChecked = false;
isChecked = CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); isChecked = CheckBooleanAttr(aFrame, nsGkAtoms::checked);
if (isChecked) if (isChecked)
{ {
@@ -2239,13 +2239,13 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
// Check the attribute to see if it's relevant. // Check the attribute to see if it's relevant.
// disabled, checked, dlgtype, default, etc. // disabled, checked, dlgtype, default, etc.
*aShouldRepaint = false; *aShouldRepaint = false;
if (aAttribute == nsWidgetAtoms::disabled || if (aAttribute == nsGkAtoms::disabled ||
aAttribute == nsWidgetAtoms::checked || aAttribute == nsGkAtoms::checked ||
aAttribute == nsWidgetAtoms::selected || aAttribute == nsGkAtoms::selected ||
aAttribute == nsWidgetAtoms::readonly || aAttribute == nsGkAtoms::readonly ||
aAttribute == nsWidgetAtoms::open || aAttribute == nsGkAtoms::open ||
aAttribute == nsWidgetAtoms::mozmenuactive || aAttribute == nsGkAtoms::menuactive ||
aAttribute == nsWidgetAtoms::focused) aAttribute == nsGkAtoms::focused)
*aShouldRepaint = true; *aShouldRepaint = true;
} }
@@ -2367,7 +2367,7 @@ nsNativeThemeWin::ClassicThemeSupportsWidget(nsPresContext* aPresContext,
// match the usually white background of the scrollable container, so // match the usually white background of the scrollable container, so
// only support the native resizer if not in a scrollframe. // only support the native resizer if not in a scrollframe.
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
return (!parentFrame || parentFrame->GetType() != nsWidgetAtoms::scrollFrame); return (!parentFrame || parentFrame->GetType() != nsGkAtoms::scrollFrame);
} }
case NS_THEME_MENUBAR: case NS_THEME_MENUBAR:
case NS_THEME_MENUPOPUP: case NS_THEME_MENUPOPUP:
@@ -2857,7 +2857,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
bool isHTML = IsHTMLContent(aFrame); bool isHTML = IsHTMLContent(aFrame);
bool isMenulist = !isHTML && parentFrame->GetType() == nsWidgetAtoms::menuFrame; bool isMenulist = !isHTML && parentFrame->GetType() == nsGkAtoms::menuFrame;
bool isOpen = false; bool isOpen = false;
// HTML select and XUL menulist dropdown buttons get state from the parent. // HTML select and XUL menulist dropdown buttons get state from the parent.

View File

@@ -45,7 +45,6 @@
#include "nsGUIEvent.h" #include "nsGUIEvent.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsWidgetAtoms.h"
#include <objbase.h> #include <objbase.h>
#include <initguid.h> #include <initguid.h>
@@ -286,8 +285,6 @@ NS_METHOD nsToolkit::Init(PRThread *aThread)
kD3DUsageDelay, kD3DUsageDelay,
nsITimer::TYPE_ONE_SHOT); nsITimer::TYPE_ONE_SHOT);
nsWidgetAtoms::RegisterAtoms();
return NS_OK; return NS_OK;
} }

View File

@@ -138,7 +138,7 @@
#include "nsRect.h" #include "nsRect.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsNativeCharsetUtils.h" #include "nsNativeCharsetUtils.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsAppDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h"
@@ -3701,30 +3701,30 @@ bool nsWindow::DispatchCommandEvent(PRUint32 aEventCommand)
nsCOMPtr<nsIAtom> command; nsCOMPtr<nsIAtom> command;
switch (aEventCommand) { switch (aEventCommand) {
case APPCOMMAND_BROWSER_BACKWARD: case APPCOMMAND_BROWSER_BACKWARD:
command = nsWidgetAtoms::Back; command = nsGkAtoms::Back;
break; break;
case APPCOMMAND_BROWSER_FORWARD: case APPCOMMAND_BROWSER_FORWARD:
command = nsWidgetAtoms::Forward; command = nsGkAtoms::Forward;
break; break;
case APPCOMMAND_BROWSER_REFRESH: case APPCOMMAND_BROWSER_REFRESH:
command = nsWidgetAtoms::Reload; command = nsGkAtoms::Reload;
break; break;
case APPCOMMAND_BROWSER_STOP: case APPCOMMAND_BROWSER_STOP:
command = nsWidgetAtoms::Stop; command = nsGkAtoms::Stop;
break; break;
case APPCOMMAND_BROWSER_SEARCH: case APPCOMMAND_BROWSER_SEARCH:
command = nsWidgetAtoms::Search; command = nsGkAtoms::Search;
break; break;
case APPCOMMAND_BROWSER_FAVORITES: case APPCOMMAND_BROWSER_FAVORITES:
command = nsWidgetAtoms::Bookmarks; command = nsGkAtoms::Bookmarks;
break; break;
case APPCOMMAND_BROWSER_HOME: case APPCOMMAND_BROWSER_HOME:
command = nsWidgetAtoms::Home; command = nsGkAtoms::Home;
break; break;
default: default:
return false; return false;
} }
nsCommandEvent event(true, nsWidgetAtoms::onAppCommand, command, this); nsCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
InitEvent(event); InitEvent(event);
DispatchWindowEvent(&event); DispatchWindowEvent(&event);

View File

@@ -65,7 +65,6 @@ CPPSRCS = \
nsPrintOptionsImpl.cpp \ nsPrintOptionsImpl.cpp \
nsPrintSettingsImpl.cpp \ nsPrintSettingsImpl.cpp \
nsPrintSession.cpp \ nsPrintSession.cpp \
nsWidgetAtoms.cpp \
nsIdleService.cpp \ nsIdleService.cpp \
nsClipboardPrivacyHandler.cpp \ nsClipboardPrivacyHandler.cpp \
GfxInfoWebGL.cpp \ GfxInfoWebGL.cpp \

View File

@@ -191,8 +191,8 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected)
} }
} }
return CheckBooleanAttr(aFrame, aCheckSelected ? nsWidgetAtoms::selected return CheckBooleanAttr(aFrame, aCheckSelected ? nsGkAtoms::selected
: nsWidgetAtoms::checked); : nsGkAtoms::checked);
} }
bool bool
@@ -202,7 +202,7 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame* aFrame)
return PR_FALSE; return PR_FALSE;
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
return content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::type, return content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("menu"), eCaseMatters); NS_LITERAL_STRING("menu"), eCaseMatters);
} }
@@ -229,7 +229,7 @@ nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
if (content->IsXUL()) { if (content->IsXUL()) {
// For a XUL checkbox or radio button, the state of the parent determines // For a XUL checkbox or radio button, the state of the parent determines
// the state // the state
return CheckBooleanAttr(aFrame->GetParent(), nsWidgetAtoms::indeterminate); return CheckBooleanAttr(aFrame->GetParent(), nsGkAtoms::indeterminate);
} }
// Check for an HTML input element // Check for an HTML input element
@@ -258,7 +258,7 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
// fall through and return false. // fall through and return false.
if (aWidgetType == NS_THEME_RESIZER) { if (aWidgetType == NS_THEME_RESIZER) {
nsIFrame* parentFrame = aFrame->GetParent(); nsIFrame* parentFrame = aFrame->GetParent();
if (parentFrame && parentFrame->GetType() == nsWidgetAtoms::scrollFrame) { if (parentFrame && parentFrame->GetType() == nsGkAtoms::scrollFrame) {
// if the parent is a scrollframe, the resizer should be native themed // if the parent is a scrollframe, the resizer should be native themed
// only if the scrollable area doesn't override the widget style. // only if the scrollable area doesn't override the widget style.
parentFrame = parentFrame->GetParent(); parentFrame = parentFrame->GetParent();
@@ -312,7 +312,7 @@ nsNativeTheme::IsDisabled(nsIFrame* aFrame, nsEventStates aEventStates)
// For XML/XUL elements, an attribute must be equal to the literal // For XML/XUL elements, an attribute must be equal to the literal
// string "true" to be counted as true. An empty string should _not_ // string "true" to be counted as true. An empty string should _not_
// be counted as true. // be counted as true.
return content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled, return content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
NS_LITERAL_STRING("true"), eCaseMatters); NS_LITERAL_STRING("true"), eCaseMatters);
} }
@@ -330,12 +330,12 @@ nsNativeTheme::GetScrollbarButtonType(nsIFrame* aFrame)
return 0; return 0;
static nsIContent::AttrValuesArray strings[] = static nsIContent::AttrValuesArray strings[] =
{&nsWidgetAtoms::scrollbarDownBottom, &nsWidgetAtoms::scrollbarDownTop, {&nsGkAtoms::scrollbarDownBottom, &nsGkAtoms::scrollbarDownTop,
&nsWidgetAtoms::scrollbarUpBottom, &nsWidgetAtoms::scrollbarUpTop, &nsGkAtoms::scrollbarUpBottom, &nsGkAtoms::scrollbarUpTop,
nsnull}; nsnull};
switch (aFrame->GetContent()->FindAttrValueIn(kNameSpaceID_None, switch (aFrame->GetContent()->FindAttrValueIn(kNameSpaceID_None,
nsWidgetAtoms::sbattr, nsGkAtoms::sbattr,
strings, eCaseMatters)) { strings, eCaseMatters)) {
case 0: return eScrollbarButton_Down | eScrollbarButton_Bottom; case 0: return eScrollbarButton_Down | eScrollbarButton_Bottom;
case 1: return eScrollbarButton_Down; case 1: return eScrollbarButton_Down;
@@ -354,9 +354,9 @@ nsNativeTheme::GetTreeSortDirection(nsIFrame* aFrame)
return eTreeSortDirection_Natural; return eTreeSortDirection_Natural;
static nsIContent::AttrValuesArray strings[] = static nsIContent::AttrValuesArray strings[] =
{&nsWidgetAtoms::descending, &nsWidgetAtoms::ascending, nsnull}; {&nsGkAtoms::descending, &nsGkAtoms::ascending, nsnull};
switch (aFrame->GetContent()->FindAttrValueIn(kNameSpaceID_None, switch (aFrame->GetContent()->FindAttrValueIn(kNameSpaceID_None,
nsWidgetAtoms::sortdirection, nsGkAtoms::sortDirection,
strings, eCaseMatters)) { strings, eCaseMatters)) {
case 0: return eTreeSortDirection_Descending; case 0: return eTreeSortDirection_Descending;
case 1: return eTreeSortDirection_Ascending; case 1: return eTreeSortDirection_Ascending;
@@ -372,17 +372,17 @@ nsNativeTheme::IsLastTreeHeaderCell(nsIFrame* aFrame)
return PR_FALSE; return PR_FALSE;
// A tree column picker is always the last header cell. // A tree column picker is always the last header cell.
if (aFrame->GetContent()->Tag() == nsWidgetAtoms::treecolpicker) if (aFrame->GetContent()->Tag() == nsGkAtoms::treecolpicker)
return PR_TRUE; return PR_TRUE;
// Find the parent tree. // Find the parent tree.
nsIContent* parent = aFrame->GetContent()->GetParent(); nsIContent* parent = aFrame->GetContent()->GetParent();
while (parent && parent->Tag() != nsWidgetAtoms::tree) { while (parent && parent->Tag() != nsGkAtoms::tree) {
parent = parent->GetParent(); parent = parent->GetParent();
} }
// If the column picker is visible, this can't be the last column. // If the column picker is visible, this can't be the last column.
if (parent && !parent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::hidecolumnpicker, if (parent && !parent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidecolumnpicker,
NS_LITERAL_STRING("true"), eCaseMatters)) NS_LITERAL_STRING("true"), eCaseMatters))
return PR_FALSE; return PR_FALSE;
@@ -401,7 +401,7 @@ nsNativeTheme::IsBottomTab(nsIFrame* aFrame)
return PR_FALSE; return PR_FALSE;
nsAutoString classStr; nsAutoString classStr;
aFrame->GetContent()->GetAttr(kNameSpaceID_None, nsWidgetAtoms::_class, classStr); aFrame->GetContent()->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, classStr);
return !classStr.IsEmpty() && classStr.Find("tab-bottom") != kNotFound; return !classStr.IsEmpty() && classStr.Find("tab-bottom") != kNotFound;
} }
@@ -413,7 +413,7 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame)
nsIFrame* first = aFrame->GetParent()->GetFirstPrincipalChild(); nsIFrame* first = aFrame->GetParent()->GetFirstPrincipalChild();
while (first) { while (first) {
if (first->GetRect().width > 0 && first->GetContent()->Tag() == nsWidgetAtoms::tab) if (first->GetRect().width > 0 && first->GetContent()->Tag() == nsGkAtoms::tab)
return (first == aFrame); return (first == aFrame);
first = first->GetNextSibling(); first = first->GetNextSibling();
} }
@@ -426,8 +426,8 @@ nsNativeTheme::IsHorizontal(nsIFrame* aFrame)
if (!aFrame) if (!aFrame)
return PR_FALSE; return PR_FALSE;
return !aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::orient, return !aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::orient,
nsWidgetAtoms::vertical, nsGkAtoms::vertical,
eCaseMatters); eCaseMatters);
} }
@@ -467,11 +467,11 @@ nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame,
if (!aFrame || !aFrame->GetContent()) if (!aFrame || !aFrame->GetContent())
return PR_FALSE; return PR_FALSE;
if (aFrame->GetContent()->IsHTML(nsWidgetAtoms::progress)) { if (aFrame->GetContent()->IsHTML(nsGkAtoms::progress)) {
return aEventStates.HasState(NS_EVENT_STATE_INDETERMINATE); return aEventStates.HasState(NS_EVENT_STATE_INDETERMINATE);
} }
return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::mode, return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mode,
NS_LITERAL_STRING("undetermined"), NS_LITERAL_STRING("undetermined"),
eCaseMatters); eCaseMatters);
} }
@@ -491,7 +491,7 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFrame, bool* aLeftOfParent)
return PR_FALSE; return PR_FALSE;
nsIContent* parentContent = aFrame->GetContent()->GetParent(); nsIContent* parentContent = aFrame->GetContent()->GetParent();
if (!parentContent || parentContent->Tag() != nsWidgetAtoms::menu) if (!parentContent || parentContent->Tag() != nsGkAtoms::menu)
return PR_FALSE; return PR_FALSE;
nsIFrame* parent = aFrame; nsIFrame* parent = aFrame;

View File

@@ -45,7 +45,7 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsString.h" #include "nsString.h"
#include "nsMargin.h" #include "nsMargin.h"
#include "nsWidgetAtoms.h" #include "nsGkAtoms.h"
#include "nsEventStates.h" #include "nsEventStates.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsITimer.h" #include "nsITimer.h"
@@ -94,7 +94,7 @@ class nsNativeTheme : public nsITimerCallback
// button: // button:
bool IsDefaultButton(nsIFrame* aFrame) { bool IsDefaultButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::_default); return CheckBooleanAttr(aFrame, nsGkAtoms::_default);
} }
bool IsButtonTypeMenu(nsIFrame* aFrame); bool IsButtonTypeMenu(nsIFrame* aFrame);
@@ -110,7 +110,7 @@ class nsNativeTheme : public nsITimerCallback
} }
bool IsFocused(nsIFrame* aFrame) { bool IsFocused(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::focused); return CheckBooleanAttr(aFrame, nsGkAtoms::focused);
} }
// scrollbar button: // scrollbar button:
@@ -118,7 +118,7 @@ class nsNativeTheme : public nsITimerCallback
// tab: // tab:
bool IsSelectedTab(nsIFrame* aFrame) { bool IsSelectedTab(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); return CheckBooleanAttr(aFrame, nsGkAtoms::selected);
} }
bool IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset); bool IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset);
@@ -141,16 +141,16 @@ class nsNativeTheme : public nsITimerCallback
// button / toolbarbutton: // button / toolbarbutton:
bool IsCheckedButton(nsIFrame* aFrame) { bool IsCheckedButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); return CheckBooleanAttr(aFrame, nsGkAtoms::checked);
} }
bool IsSelectedButton(nsIFrame* aFrame) { bool IsSelectedButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked) || return CheckBooleanAttr(aFrame, nsGkAtoms::checked) ||
CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); CheckBooleanAttr(aFrame, nsGkAtoms::selected);
} }
bool IsOpenButton(nsIFrame* aFrame) { bool IsOpenButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::open); return CheckBooleanAttr(aFrame, nsGkAtoms::open);
} }
bool IsPressedButton(nsIFrame* aFrame); bool IsPressedButton(nsIFrame* aFrame);
@@ -171,7 +171,7 @@ class nsNativeTheme : public nsITimerCallback
// textfield: // textfield:
bool IsReadOnly(nsIFrame* aFrame) { bool IsReadOnly(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::readonly); return CheckBooleanAttr(aFrame, nsGkAtoms::readonly);
} }
// menupopup: // menupopup:

View File

@@ -1,135 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Mike Pinkerton (pinkerton@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/******
This file contains the list of all Widget nsIAtoms and their values
It is designed to be used as inline input to nsWidgetAtoms.cpp *only*
through the magic of C preprocessing.
All entries must be enclosed in the macro WIDGET_ATOM which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to WIDGET_ATOM is the C++ identifier of the atom
The second argument is the string value of the atom
******/
WIDGET_ATOM(accesskey, "accesskey") // The shortcut key for a menu or menu item
WIDGET_ATOM(active, "active")
WIDGET_ATOM(ascending, "ascending")
WIDGET_ATOM(autocheck, "autocheck")
WIDGET_ATOM(Back, "Back")
WIDGET_ATOM(Bookmarks, "Bookmarks")
WIDGET_ATOM(checkbox, "checkbox")
WIDGET_ATOM(checked, "checked")
WIDGET_ATOM(_class, "class")
WIDGET_ATOM(collapsed, "collapsed")
WIDGET_ATOM(comboboxControlFrame, "ComboboxControlFrame")
WIDGET_ATOM(command, "command")
WIDGET_ATOM(curpos, "curpos")
WIDGET_ATOM(_default, "default")
WIDGET_ATOM(descending, "descending")
WIDGET_ATOM(dir, "dir")
WIDGET_ATOM(disabled, "disabled")
WIDGET_ATOM(Clear, "Clear") // AppCommand to return to a previous state
WIDGET_ATOM(_false, "false")
WIDGET_ATOM(focused, "focused")
WIDGET_ATOM(Forward, "Forward")
WIDGET_ATOM(Home, "Home")
WIDGET_ATOM(hidden, "hidden")
WIDGET_ATOM(hidecolumnpicker, "hidecolumnpicker")
WIDGET_ATOM(horizontal, "horizontal")
WIDGET_ATOM(vertical, "vertical")
WIDGET_ATOM(id, "id")
WIDGET_ATOM(image, "image")
WIDGET_ATOM(input, "input")
WIDGET_ATOM(indeterminate, "indeterminate")
WIDGET_ATOM(key, "key") // The key element / attribute
WIDGET_ATOM(label, "label")
WIDGET_ATOM(max, "max")
WIDGET_ATOM(maxpos, "maxpos")
WIDGET_ATOM(Menu, "Menu") // AppCommand to open a menu
WIDGET_ATOM(menu, "menu") // Represents an XP menu
WIDGET_ATOM(menuitem, "menuitem") // Represents an XP menu item
WIDGET_ATOM(menupopup, "menupopup") // The XP menu's children.
WIDGET_ATOM(menuseparator, "menuseparator") // Divider between menu items
WIDGET_ATOM(menuFrame, "MenuFrame")
WIDGET_ATOM(minpos, "minpos")
WIDGET_ATOM(mode, "mode")
WIDGET_ATOM(modifiers, "modifiers") // The modifiers attribute
WIDGET_ATOM(mozmenuactive, "_moz-menuactive")
WIDGET_ATOM(name, "name")
WIDGET_ATOM(onAppCommand, "onAppCommand")
WIDGET_ATOM(open, "open") // Whether or not a menu, tree, etc. is open
WIDGET_ATOM(orient, "orient")
WIDGET_ATOM(pageincrement, "pageincrement")
WIDGET_ATOM(parentfocused, "parentfocused")
WIDGET_ATOM(progress, "progress")
WIDGET_ATOM(radio, "radio")
WIDGET_ATOM(readonly, "readonly")
WIDGET_ATOM(Reload, "Reload")
WIDGET_ATOM(richlistitem, "richlistitem")
WIDGET_ATOM(sbattr, "sbattr")
WIDGET_ATOM(scrollFrame, "ScrollFrame")
WIDGET_ATOM(scrollbarFrame, "ScrollbarFrame")
WIDGET_ATOM(scrollbarDownBottom, "scrollbar-down-bottom")
WIDGET_ATOM(scrollbarDownTop, "scrollbar-down-top")
WIDGET_ATOM(scrollbarUpBottom, "scrollbar-up-bottom")
WIDGET_ATOM(scrollbarUpTop, "scrollbar-up-top")
WIDGET_ATOM(Search, "Search")
WIDGET_ATOM(selected, "selected")
WIDGET_ATOM(sortdirection, "sortDirection")
WIDGET_ATOM(state, "state")
WIDGET_ATOM(statusbar, "statusbar")
WIDGET_ATOM(Stop, "Stop")
WIDGET_ATOM(_true, "true")
WIDGET_ATOM(tab, "tab")
WIDGET_ATOM(toolbar, "toolbar")
WIDGET_ATOM(toolbox, "toolbox")
WIDGET_ATOM(tree, "tree")
WIDGET_ATOM(treecolpicker, "treecolpicker")
WIDGET_ATOM(type, "type")
WIDGET_ATOM(value, "value")
WIDGET_ATOM(VolumeUp, "VolumeUp")
WIDGET_ATOM(VolumeDown, "VolumeDown")

View File

@@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Mike Pinkerton (pinkerton@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsWidgetAtoms.h"
#include "nsStaticAtom.h"
#include "nsMemory.h"
#define WIDGET_ATOM(_name, _value) nsIAtom* nsWidgetAtoms::_name = 0;
#include "nsWidgetAtomList.h"
#undef WIDGET_ATOM
#define WIDGET_ATOM(_name, _value) NS_STATIC_ATOM_BUFFER(_name##_buffer, _value)
#include "nsWidgetAtomList.h"
#undef WIDGET_ATOM
static const nsStaticAtom widget_atoms[] = {
// define storage for all atoms
#define WIDGET_ATOM(_name, _value) NS_STATIC_ATOM(_name##_buffer, &nsWidgetAtoms::_name),
#include "nsWidgetAtomList.h"
#undef WIDGET_ATOM
};
void nsWidgetAtoms::RegisterAtoms() {
NS_RegisterStaticAtoms(widget_atoms, NS_ARRAY_LENGTH(widget_atoms));
}

View File

@@ -1,71 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Mike Pinkerton (pinkerton@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsWidgetAtoms_h___
#define nsWidgetAtoms_h___
#include "prtypes.h"
#include "nsIAtom.h"
/**
* This class wraps up the creation and destruction of the standard
* set of xul atoms used during normal xul handling. This object
* is created when the first xul content object is created, and
* destroyed when the last such content object is destroyed.
*
* It's here because we cannot use nsGkAtoms from
* the Widget shlb. They are components are we're not.
*/
class nsWidgetAtoms {
public:
static void RegisterAtoms();
/* Declare all atoms
The atom names and values are stored in nsWidgetAtomList.h and
are brought to you by the magic of C preprocessing
Add new atoms to nsWidgetAtomList and all support logic will be auto-generated
*/
#define WIDGET_ATOM(_name, _value) static nsIAtom* _name;
#include "nsWidgetAtomList.h"
#undef WIDGET_ATOM
};
#endif /* nsWidgetAtoms_h___ */