author | Andrea Marchesini <amarchesini@mozilla.com> |
Mon, 18 Feb 2013 06:59:08 -0500 | |
changeset 122237 | cab8ac207ba48376653a02d4b67742eecce59578 |
parent 122236 | 653bcba12dc600c31546ddeb278b7346e0847795 |
child 122238 | a09e3d0f005d2e67faa6dcce33ba0275a2ba6a2c |
push id | 24327 |
push user | gszorc@mozilla.com |
push date | Tue, 19 Feb 2013 05:22:32 +0000 |
treeherder | mozilla-central@e8f8a3f6f1f6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Ms2ger |
bugs | 838559 |
milestone | 21.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
rename from content/html/content/src/nsHTMLMenuElement.cpp rename to content/html/content/src/HTMLMenuElement.cpp --- a/content/html/content/src/nsHTMLMenuElement.cpp +++ b/content/html/content/src/HTMLMenuElement.cpp @@ -1,24 +1,24 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsHTMLMenuElement.h" -#include "nsAttrValueInlines.h" -#include "nsIDOMHTMLMenuItemElement.h" +#include "HTMLMenuElement.h" #include "nsXULContextMenuBuilder.h" -#include "nsGUIEvent.h" #include "nsEventDispatcher.h" #include "HTMLMenuItemElement.h" -#include "nsContentUtils.h" -#include "nsError.h" +#include "nsAttrValueInlines.h" -using namespace mozilla::dom; +NS_IMPL_NS_NEW_HTML_ELEMENT(Menu) +DOMCI_NODE_DATA(HTMLMenuElement, mozilla::dom::HTMLMenuElement) + +namespace mozilla { +namespace dom { enum MenuType { MENU_TYPE_CONTEXT = 1, MENU_TYPE_TOOLBAR, MENU_TYPE_LIST }; @@ -34,54 +34,51 @@ static const nsAttrValue::EnumTable* kMe enum SeparatorType { ST_TRUE_INIT = -1, ST_FALSE = 0, ST_TRUE = 1 }; -NS_IMPL_NS_NEW_HTML_ELEMENT(Menu) -nsHTMLMenuElement::nsHTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo) +HTMLMenuElement::HTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo) : nsGenericHTMLElement(aNodeInfo), mType(MENU_TYPE_LIST) { } -nsHTMLMenuElement::~nsHTMLMenuElement() +HTMLMenuElement::~HTMLMenuElement() { } -NS_IMPL_ADDREF_INHERITED(nsHTMLMenuElement, Element) -NS_IMPL_RELEASE_INHERITED(nsHTMLMenuElement, Element) +NS_IMPL_ADDREF_INHERITED(HTMLMenuElement, Element) +NS_IMPL_RELEASE_INHERITED(HTMLMenuElement, Element) -DOMCI_NODE_DATA(HTMLMenuElement, nsHTMLMenuElement) - -// QueryInterface implementation for nsHTMLMenuElement -NS_INTERFACE_TABLE_HEAD(nsHTMLMenuElement) - NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLMenuElement, +// QueryInterface implementation for HTMLMenuElement +NS_INTERFACE_TABLE_HEAD(HTMLMenuElement) + NS_HTML_CONTENT_INTERFACE_TABLE2(HTMLMenuElement, nsIDOMHTMLMenuElement, nsIHTMLMenu) - NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLMenuElement, + NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLMenuElement, nsGenericHTMLElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLMenuElement) -NS_IMPL_ELEMENT_CLONE(nsHTMLMenuElement) +NS_IMPL_ELEMENT_CLONE(HTMLMenuElement) -NS_IMPL_BOOL_ATTR(nsHTMLMenuElement, Compact, compact) -NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMenuElement, Type, type, +NS_IMPL_BOOL_ATTR(HTMLMenuElement, Compact, compact) +NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMenuElement, Type, type, kMenuDefaultType->tag) -NS_IMPL_STRING_ATTR(nsHTMLMenuElement, Label, label) +NS_IMPL_STRING_ATTR(HTMLMenuElement, Label, label) NS_IMETHODIMP -nsHTMLMenuElement::SendShowEvent() +HTMLMenuElement::SendShowEvent() { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR); nsCOMPtr<nsIDocument> document = GetCurrentDoc(); if (!document) { return NS_ERROR_FAILURE; } @@ -98,50 +95,50 @@ nsHTMLMenuElement::SendShowEvent() nsEventStatus status = nsEventStatus_eIgnore; nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext, &event, nullptr, &status); return NS_OK; } NS_IMETHODIMP -nsHTMLMenuElement::CreateBuilder(nsIMenuBuilder** _retval) +HTMLMenuElement::CreateBuilder(nsIMenuBuilder** _retval) { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR); *_retval = nullptr; if (mType == MENU_TYPE_CONTEXT) { NS_ADDREF(*_retval = new nsXULContextMenuBuilder()); } return NS_OK; } NS_IMETHODIMP -nsHTMLMenuElement::Build(nsIMenuBuilder* aBuilder) +HTMLMenuElement::Build(nsIMenuBuilder* aBuilder) { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR); if (!aBuilder) { return NS_OK; } BuildSubmenu(EmptyString(), this, aBuilder); return NS_OK; } bool -nsHTMLMenuElement::ParseAttribute(int32_t aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +HTMLMenuElement::ParseAttribute(int32_t aNamespaceID, + nsIAtom* aAttribute, + const nsAString& aValue, + nsAttrValue& aResult) { if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) { bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable, false); if (success) { mType = aResult.GetEnumValue(); } else { mType = kMenuDefaultType->value; @@ -150,35 +147,35 @@ nsHTMLMenuElement::ParseAttribute(int32_ return success; } return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue, aResult); } void -nsHTMLMenuElement::BuildSubmenu(const nsAString& aLabel, - nsIContent* aContent, - nsIMenuBuilder* aBuilder) +HTMLMenuElement::BuildSubmenu(const nsAString& aLabel, + nsIContent* aContent, + nsIMenuBuilder* aBuilder) { aBuilder->OpenContainer(aLabel); int8_t separator = ST_TRUE_INIT; TraverseContent(aContent, aBuilder, separator); if (separator == ST_TRUE) { aBuilder->UndoAddSeparator(); } aBuilder->CloseContainer(); } // static bool -nsHTMLMenuElement::CanLoadIcon(nsIContent* aContent, const nsAString& aIcon) +HTMLMenuElement::CanLoadIcon(nsIContent* aContent, const nsAString& aIcon) { if (aIcon.IsEmpty()) { return false; } nsIDocument* doc = aContent->OwnerDoc(); nsCOMPtr<nsIURI> baseURI = aContent->GetBaseURI(); @@ -190,19 +187,19 @@ nsHTMLMenuElement::CanLoadIcon(nsIConten return false; } return nsContentUtils::CanLoadImage(uri, aContent, doc, aContent->NodePrincipal()); } void -nsHTMLMenuElement::TraverseContent(nsIContent* aContent, - nsIMenuBuilder* aBuilder, - int8_t& aSeparator) +HTMLMenuElement::TraverseContent(nsIContent* aContent, + nsIMenuBuilder* aBuilder, + int8_t& aSeparator) { nsCOMPtr<nsIContent> child; for (child = aContent->GetFirstChild(); child; child = child->GetNextSibling()) { nsGenericHTMLElement* element = nsGenericHTMLElement::FromContent(child); if (!element) { continue; } @@ -243,17 +240,20 @@ nsHTMLMenuElement::TraverseContent(nsICo AddSeparator(aBuilder, aSeparator); } } } } inline void -nsHTMLMenuElement::AddSeparator(nsIMenuBuilder* aBuilder, int8_t& aSeparator) +HTMLMenuElement::AddSeparator(nsIMenuBuilder* aBuilder, int8_t& aSeparator) { if (aSeparator) { return; } aBuilder->AddSeparator(); aSeparator = ST_TRUE; } + +} // namespace dom +} // namespace mozilla
rename from content/html/content/src/nsHTMLMenuElement.h rename to content/html/content/src/HTMLMenuElement.h --- a/content/html/content/src/nsHTMLMenuElement.h +++ b/content/html/content/src/HTMLMenuElement.h @@ -1,26 +1,32 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef mozilla_dom_HTMLMenuElement_h +#define mozilla_dom_HTMLMenuElement_h + #include "nsIDOMHTMLMenuElement.h" #include "nsIHTMLMenu.h" #include "nsGenericHTMLElement.h" -class nsHTMLMenuElement : public nsGenericHTMLElement, - public nsIDOMHTMLMenuElement, - public nsIHTMLMenu +namespace mozilla { +namespace dom { + +class HTMLMenuElement : public nsGenericHTMLElement, + public nsIDOMHTMLMenuElement, + public nsIHTMLMenu { public: - nsHTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo); - virtual ~nsHTMLMenuElement(); + HTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo); + virtual ~HTMLMenuElement(); - NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLMenuElement, menu) + NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLMenuElement, menu) // nsISupports NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode NS_FORWARD_NSIDOMNODE_TO_NSINODE // nsIDOMElement @@ -58,8 +64,13 @@ protected: void TraverseContent(nsIContent* aContent, nsIMenuBuilder* aBuilder, int8_t& aSeparator); void AddSeparator(nsIMenuBuilder* aBuilder, int8_t& aSeparator); uint8_t mType; }; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_HTMLMenuElement_h
--- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -44,16 +44,17 @@ EXPORTS_mozilla/dom = \ HTMLHeadingElement.h \ HTMLHRElement.h \ HTMLImageElement.h \ HTMLLabelElement.h \ HTMLLegendElement.h \ HTMLLIElement.h \ HTMLLinkElement.h \ HTMLMapElement.h \ + HTMLMenuElement.h \ HTMLMenuItemElement.h \ HTMLMetaElement.h \ HTMLMeterElement.h \ HTMLModElement.h \ HTMLOptGroupElement.h \ HTMLOutputElement.h \ HTMLParagraphElement.h \ HTMLPreElement.h \ @@ -102,17 +103,17 @@ CPPSRCS = \ nsHTMLIFrameElement.cpp \ HTMLImageElement.cpp \ nsHTMLInputElement.cpp \ HTMLLIElement.cpp \ HTMLLabelElement.cpp \ HTMLLegendElement.cpp \ HTMLLinkElement.cpp \ HTMLMapElement.cpp \ - nsHTMLMenuElement.cpp \ + HTMLMenuElement.cpp \ HTMLMenuItemElement.cpp \ HTMLMetaElement.cpp \ HTMLMeterElement.cpp \ HTMLModElement.cpp \ HTMLObjectElement.cpp \ nsHTMLSharedObjectElement.cpp \ nsHTMLOptionElement.cpp \ HTMLOptGroupElement.cpp \
--- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -75,17 +75,17 @@ #include "nsIEditorIMESupport.h" #include "nsEventDispatcher.h" #include "nsLayoutUtils.h" #include "mozAutoDocUpdate.h" #include "nsHtml5Module.h" #include "nsITextControlElement.h" #include "mozilla/dom/Element.h" #include "HTMLFieldSetElement.h" -#include "nsHTMLMenuElement.h" +#include "HTMLMenuElement.h" #include "nsAsyncDOMEvent.h" #include "nsDOMMutationObserver.h" #include "mozilla/Preferences.h" #include "mozilla/dom/FromParser.h" #include "mozilla/dom/UndoManager.h" #include "mozilla/BloomFilter.h" #include "HTMLPropertiesCollection.h" @@ -2050,25 +2050,25 @@ nsGenericHTMLElement::GetEnumAttr(nsIAto if (attrVal->Type() == nsAttrValue::eEnum) { attrVal->GetEnumString(aResult, true); } else if (aDefaultInvalid) { AppendASCIItoUTF16(nsDependentCString(aDefaultInvalid), aResult); } } } -nsHTMLMenuElement* +HTMLMenuElement* nsGenericHTMLElement::GetContextMenu() const { nsAutoString value; GetHTMLAttr(nsGkAtoms::contextmenu, value); if (!value.IsEmpty()) { nsIDocument* doc = GetCurrentDoc(); if (doc) { - return nsHTMLMenuElement::FromContentOrNull(doc->GetElementById(value)); + return HTMLMenuElement::FromContentOrNull(doc->GetElementById(value)); } } return nullptr; } void nsGenericHTMLElement::GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) const {
--- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -18,17 +18,16 @@ class nsIDOMAttr; class nsIDOMEventListener; class nsIDOMNodeList; class nsIFrame; class nsIStyleRule; class nsChildContentList; class nsDOMCSSDeclaration; -class nsHTMLMenuElement; class nsIDOMCSSStyleDeclaration; class nsIURI; class nsIFormControlFrame; class nsIForm; class nsPresState; class nsILayoutHistoryState; class nsIEditor; struct nsRect; @@ -36,16 +35,17 @@ struct nsSize; class nsHTMLFormElement; class nsIDOMHTMLMenuElement; class nsIDOMHTMLCollection; class nsDOMSettableTokenList; namespace mozilla { namespace dom{ class HTMLPropertiesCollection; +class HTMLMenuElement; } } typedef nsMappedAttributeElement nsGenericHTMLElementBase; /** * A common superclass for HTML elements */ @@ -215,17 +215,17 @@ public: ContentEditableTristate value = element->GetContentEditableValue(); if (value != eInherit) { return value == eTrue; } } } return false; } - nsHTMLMenuElement* GetContextMenu() const; + mozilla::dom::HTMLMenuElement* GetContextMenu() const; bool Spellcheck(); void SetSpellcheck(bool aSpellcheck, mozilla::ErrorResult& aError) { SetHTMLAttr(nsGkAtoms::spellcheck, aSpellcheck ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"), aError); }
--- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -1172,17 +1172,17 @@ def addExternalIface(iface, nativeType=N # If you add one of these, you need to make sure nsDOMQS.h has the relevant # macros added for it def addExternalHTMLElement(element): nativeElement = 'ns' + element addExternalIface(element, nativeType=nativeElement, headerFile=nativeElement + '.h') addExternalHTMLElement('HTMLFormElement') -addExternalHTMLElement('HTMLMenuElement') +addExternalIface('HTMLMenuElement', nativeType='mozilla::dom::HTMLMenuElement', headerFile='HTMLMenuElement.h') addExternalHTMLElement('HTMLOptionElement') addExternalHTMLElement('HTMLVideoElement') addExternalIface('Attr') addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h') addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h') addExternalIface('ClientRect') addExternalIface("Counter") addExternalIface('CSSRule')
--- a/js/xpconnect/src/dom_quickstubs.qsconf +++ b/js/xpconnect/src/dom_quickstubs.qsconf @@ -292,17 +292,17 @@ irregularFilenames = { 'nsITelephoneCallback': 'nsITelephone', 'nsIDOMWindowPerformance': 'nsIDOMWindow', } customIncludes = [ 'nsDOMQS.h', - 'nsHTMLMenuElement.h', + 'HTMLMenuElement.h', 'mozilla/dom/NodeBinding.h', 'mozilla/dom/ElementBinding.h', 'mozilla/dom/HTMLElementBinding.h', 'mozilla/dom/DocumentBinding.h', 'mozilla/dom/SVGElementBinding.h', 'nsPerformance.h', 'mozilla/dom/HTMLDocumentBinding.h', 'mozilla/dom/EventTargetBinding.h',