--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -44,29 +44,20 @@ HTMLOptionElement::HTMLOptionElement(alr
// We start off enabled
AddStatesSilently(NS_EVENT_STATE_ENABLED);
}
HTMLOptionElement::~HTMLOptionElement()
{
}
-NS_IMPL_ISUPPORTS_INHERITED(HTMLOptionElement, nsGenericHTMLElement,
- nsIDOMHTMLOptionElement)
+NS_IMPL_ISUPPORTS_INHERITED0(HTMLOptionElement, nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLOptionElement)
-
-NS_IMETHODIMP
-HTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm)
-{
- NS_IF_ADDREF(*aForm = GetForm());
- return NS_OK;
-}
-
mozilla::dom::HTMLFormElement*
HTMLOptionElement::GetForm()
{
HTMLSelectElement* selectControl = GetSelect();
return selectControl ? selectControl->GetForm() : nullptr;
}
void
@@ -110,25 +101,17 @@ HTMLOptionElement::UpdateDisabledState(b
EventStates oldDisabledStates = State() & DISABLED_STATES;
EventStates changedStates = disabledStates ^ oldDisabledStates;
if (!changedStates.IsEmpty()) {
ToggleStates(changedStates, aNotify);
}
}
-NS_IMETHODIMP
-HTMLOptionElement::GetSelected(bool* aValue)
-{
- NS_ENSURE_ARG_POINTER(aValue);
- *aValue = Selected();
- return NS_OK;
-}
-
-NS_IMETHODIMP
+void
HTMLOptionElement::SetSelected(bool aValue)
{
// Note: The select content obj maintains all the PresState
// so defer to it to get the answer
HTMLSelectElement* selectInt = GetSelect();
if (selectInt) {
int32_t index = Index();
uint32_t mask = HTMLSelectElement::SET_DISABLED | HTMLSelectElement::NOTIFY;
@@ -136,31 +119,16 @@ HTMLOptionElement::SetSelected(bool aVal
mask |= HTMLSelectElement::IS_SELECTED;
}
// This should end up calling SetSelectedInternal
selectInt->SetOptionsSelectedByIndex(index, index, mask);
} else {
SetSelectedInternal(aValue, true);
}
-
- return NS_OK;
-}
-
-NS_IMPL_BOOL_ATTR(HTMLOptionElement, DefaultSelected, selected)
-// GetText returns a whitespace compressed .textContent value.
-NS_IMPL_STRING_ATTR_WITH_FALLBACK(HTMLOptionElement, Label, label, GetText)
-NS_IMPL_STRING_ATTR_WITH_FALLBACK(HTMLOptionElement, Value, value, GetText)
-NS_IMPL_BOOL_ATTR(HTMLOptionElement, Disabled, disabled)
-
-NS_IMETHODIMP
-HTMLOptionElement::GetIndex(int32_t* aIndex)
-{
- *aIndex = Index();
- return NS_OK;
}
int32_t
HTMLOptionElement::Index()
{
static int32_t defaultIndex = 0;
// Only select elements can contain a list of options.
@@ -174,28 +142,16 @@ HTMLOptionElement::Index()
return defaultIndex;
}
int32_t index = defaultIndex;
MOZ_ALWAYS_SUCCEEDS(options->GetOptionIndex(this, 0, true, &index));
return index;
}
-bool
-HTMLOptionElement::Selected() const
-{
- return mIsSelected;
-}
-
-bool
-HTMLOptionElement::DefaultSelected() const
-{
- return HasAttr(kNameSpaceID_None, nsGkAtoms::selected);
-}
-
nsChangeHint
HTMLOptionElement::GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::label ||
@@ -283,17 +239,17 @@ HTMLOptionElement::AfterSetAttr(int32_t
}
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aSubjectPrincipal, aNotify);
}
-NS_IMETHODIMP
+void
HTMLOptionElement::GetText(nsAString& aText)
{
nsAutoString text;
nsIContent* child = nsINode::GetFirstChild();
while (child) {
if (child->NodeType() == nsIDOMNode::TEXT_NODE ||
child->NodeType() == nsIDOMNode::CDATA_SECTION_NODE) {
@@ -305,24 +261,22 @@ HTMLOptionElement::GetText(nsAString& aT
} else {
child = child->GetNextNode(this);
}
}
// XXX No CompressWhitespace for nsAString. Sad.
text.CompressWhitespace(true, true);
aText = text;
-
- return NS_OK;
}
-NS_IMETHODIMP
-HTMLOptionElement::SetText(const nsAString& aText)
+void
+HTMLOptionElement::SetText(const nsAString& aText, ErrorResult& aRv)
{
- return nsContentUtils::SetNodeTextContent(this, aText, true);
+ aRv = nsContentUtils::SetNodeTextContent(this, aText, true);
}
nsresult
HTMLOptionElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
@@ -430,21 +384,17 @@ HTMLOptionElement::Option(const GlobalOb
// aNotify == false.
aError = option->SetAttr(kNameSpaceID_None, nsGkAtoms::selected,
EmptyString(), false);
if (aError.Failed()) {
return nullptr;
}
}
- option->SetSelected(aSelected, aError);
- if (aError.Failed()) {
- return nullptr;
- }
-
+ option->SetSelected(aSelected);
option->SetSelectedChanged(false);
return option.forget();
}
nsresult
HTMLOptionElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
{
--- a/dom/html/HTMLOptionElement.h
+++ b/dom/html/HTMLOptionElement.h
@@ -4,26 +4,24 @@
* 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_HTMLOptionElement_h__
#define mozilla_dom_HTMLOptionElement_h__
#include "mozilla/Attributes.h"
#include "nsGenericHTMLElement.h"
-#include "nsIDOMHTMLOptionElement.h"
#include "mozilla/dom/HTMLFormElement.h"
namespace mozilla {
namespace dom {
class HTMLSelectElement;
-class HTMLOptionElement final : public nsGenericHTMLElement,
- public nsIDOMHTMLOptionElement
+class HTMLOptionElement final : public nsGenericHTMLElement
{
public:
explicit HTMLOptionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
static already_AddRefed<HTMLOptionElement>
Option(const GlobalObject& aGlobal,
const nsAString& aText,
const Optional<nsAString>& aValue,
@@ -31,23 +29,25 @@ public:
bool aSelected,
ErrorResult& aError);
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLOptionElement, option)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
- // nsIDOMHTMLOptionElement
using mozilla::dom::Element::SetText;
using mozilla::dom::Element::GetText;
- NS_DECL_NSIDOMHTMLOPTIONELEMENT
- bool Selected() const;
- bool DefaultSelected() const;
+ bool Selected() const
+ {
+ return mIsSelected;
+ }
+ void SetSelected(bool aValue);
+
void SetSelectedChanged(bool aValue)
{
mSelectedChanged = aValue;
}
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;
@@ -101,45 +101,49 @@ public:
void SetDisabled(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv);
}
HTMLFormElement* GetForm();
- // The XPCOM GetLabel is OK for us
+ void GetLabel(DOMString& aLabel)
+ {
+ if (!GetAttr(kNameSpaceID_None, nsGkAtoms::label, aLabel)) {
+ GetText(aLabel);
+ }
+ }
void SetLabel(const nsAString& aLabel, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::label, aLabel, aError);
}
- // The XPCOM DefaultSelected is OK for us
+ bool DefaultSelected() const
+ {
+ return HasAttr(kNameSpaceID_None, nsGkAtoms::selected);
+ }
void SetDefaultSelected(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::selected, aValue, aRv);
}
- // The XPCOM Selected is OK for us
- void SetSelected(bool aValue, ErrorResult& aRv)
+ void GetValue(nsAString& aValue)
{
- aRv = SetSelected(aValue);
+ if (!GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue)) {
+ GetText(aValue);
+ }
}
-
- // The XPCOM GetValue is OK for us
void SetValue(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::value, aValue, aRv);
}
- // The XPCOM GetText is OK for us
- void SetText(const nsAString& aValue, ErrorResult& aRv)
- {
- aRv = SetText(aValue);
- }
+ void GetText(nsAString& aText);
+ void SetText(const nsAString& aText, ErrorResult& aRv);
int32_t Index();
protected:
virtual ~HTMLOptionElement();
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/dom/html/HTMLOptionsCollection.h
+++ b/dom/html/HTMLOptionsCollection.h
@@ -12,18 +12,16 @@
#include "mozilla/dom/HTMLOptionElement.h"
#include "mozilla/ErrorResult.h"
#include "nsCOMPtr.h"
#include "nsError.h"
#include "nsGenericHTMLElement.h"
#include "nsTArray.h"
-class nsIDOMHTMLOptionElement;
-
namespace mozilla {
namespace dom {
class HTMLElementOrLong;
class HTMLOptionElementOrHTMLOptGroupElement;
class HTMLSelectElement;
/**
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -508,17 +508,17 @@ HTMLSelectElement::GetOptionIndexAfter(n
}
int32_t
HTMLSelectElement::GetFirstOptionIndex(nsIContent* aOptions)
{
int32_t listIndex = -1;
HTMLOptionElement* optElement = HTMLOptionElement::FromContent(aOptions);
if (optElement) {
- GetOptionIndex(optElement, 0, true, &listIndex);
+ mOptions->GetOptionIndex(optElement->AsElement(), 0, true, &listIndex);
return listIndex;
}
listIndex = GetFirstChildOptionIndex(aOptions, 0, aOptions->GetChildCount());
return listIndex;
}
@@ -706,25 +706,16 @@ HTMLSelectElement::SetSelectedIndexInter
rv = selectFrame->OnSetSelectedIndex(oldSelectedIndex, mSelectedIndex);
}
SetSelectionChanged(true, aNotify);
return rv;
}
-NS_IMETHODIMP
-HTMLSelectElement::GetOptionIndex(nsIDOMHTMLOptionElement* aOption,
- int32_t aStartIndex, bool aForward,
- int32_t* aIndex)
-{
- nsCOMPtr<nsINode> option = do_QueryInterface(aOption);
- return mOptions->GetOptionIndex(option->AsElement(), aStartIndex, aForward, aIndex);
-}
-
bool
HTMLSelectElement::IsOptionSelectedByIndex(int32_t aIndex)
{
HTMLOptionElement* option = Item(static_cast<uint32_t>(aIndex));
return option && option->Selected();
}
void
@@ -1027,18 +1018,17 @@ HTMLSelectElement::GetValue(DOMString& a
RefPtr<HTMLOptionElement> option =
Item(static_cast<uint32_t>(selectedIndex));
if (!option) {
return;
}
- DebugOnly<nsresult> rv = option->GetValue(aValue);
- MOZ_ASSERT(NS_SUCCEEDED(rv));
+ option->GetValue(aValue);
}
void
HTMLSelectElement::SetValue(const nsAString& aValue)
{
uint32_t length = Length();
for (uint32_t i = 0; i < length; i++) {
@@ -1474,18 +1464,18 @@ HTMLSelectElement::RestoreStateTo(Select
// First clear all
SetOptionsSelectedByIndex(-1, -1, mask);
// Next set the proper ones
for (uint32_t i = 0; i < len; i++) {
HTMLOptionElement* option = Item(i);
if (option) {
nsAutoString value;
- nsresult rv = option->GetValue(value);
- if (NS_SUCCEEDED(rv) && aNewSelected->ContainsOption(i, value)) {
+ option->GetValue(value);
+ if (aNewSelected->ContainsOption(i, value)) {
SetOptionsSelectedByIndex(i, i, IS_SELECTED | SET_DISABLED | NOTIFY);
}
}
}
}
NS_IMETHODIMP
HTMLSelectElement::Reset()
@@ -1574,17 +1564,17 @@ HTMLSelectElement::SubmitNamesValues(HTM
continue;
}
if (!option->Selected()) {
continue;
}
nsString value;
- MOZ_ALWAYS_SUCCEEDS(option->GetValue(value));
+ option->GetValue(value);
if (keyGenProcessor) {
nsString tmp(value);
if (NS_SUCCEEDED(keyGenProcessor->ProcessValue(this, name, tmp))) {
value = tmp;
}
}
@@ -1654,17 +1644,17 @@ HTMLSelectElement::IsValueMissing() cons
uint32_t length = Length();
for (uint32_t i = 0; i < length; ++i) {
RefPtr<HTMLOptionElement> option = Item(i);
// Check for a placeholder label option, don't count it as a valid value.
if (i == 0 && !Multiple() && Size() <= 1 && option->GetParent() == this) {
nsAutoString value;
- MOZ_ALWAYS_SUCCEEDS(option->GetValue(value));
+ option->GetValue(value);
if (value.IsEmpty()) {
continue;
}
}
if (!option->Selected()) {
continue;
}
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -356,29 +356,16 @@ public:
* options and whether frames are to be notified of such.
* @return whether any options were actually changed
*/
bool SetOptionsSelectedByIndex(int32_t aStartIndex,
int32_t aEndIndex,
uint32_t aOptionsMask);
/**
- * Finds the index of a given option element
- *
- * @param aOption the option to get the index of
- * @param aStartIndex the index to start looking at
- * @param aForward TRUE to look forward, FALSE to look backward
- * @return the option index
- */
- NS_IMETHOD GetOptionIndex(nsIDOMHTMLOptionElement* aOption,
- int32_t aStartIndex,
- bool aForward,
- int32_t* aIndex);
-
- /**
* Called when an attribute is about to be changed
*/
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValueOrString* aValue,
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -11,17 +11,16 @@ XPIDL_SOURCES += [
'nsIDOMHTMLBaseElement.idl',
'nsIDOMHTMLCollection.idl',
'nsIDOMHTMLDocument.idl',
'nsIDOMHTMLElement.idl',
'nsIDOMHTMLFormElement.idl',
'nsIDOMHTMLHtmlElement.idl',
'nsIDOMHTMLInputElement.idl',
'nsIDOMHTMLMediaElement.idl',
- 'nsIDOMHTMLOptionElement.idl',
'nsIDOMHTMLScriptElement.idl',
'nsIDOMMozBrowserFrame.idl',
'nsIDOMTimeRanges.idl',
'nsIDOMValidityState.idl',
'nsIMozBrowserFrame.idl',
]
XPIDL_MODULE = 'dom_html'
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLOptionElement.idl
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: IDL; 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 "nsIDOMHTMLElement.idl"
-
-/**
- * The nsIDOMHTMLOptionElement interface is the interface to a [X]HTML
- * option element.
- *
- * This interface is trying to follow the DOM Level 2 HTML specification:
- * http://www.w3.org/TR/DOM-Level-2-HTML/
- *
- * with changes from the work-in-progress WHATWG HTML specification:
- * http://www.whatwg.org/specs/web-apps/current-work/
- */
-
-[uuid(c2b3e9ff-6b36-4158-ace3-05a9c5b8e1c1)]
-interface nsIDOMHTMLOptionElement : nsISupports
-{
- attribute boolean disabled;
- readonly attribute nsIDOMHTMLFormElement form;
- attribute DOMString label;
- attribute boolean defaultSelected;
- attribute boolean selected;
- attribute DOMString value;
-
- attribute DOMString text;
- readonly attribute long index;
-};
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -6,16 +6,17 @@
#include "WebBrowserPersistLocalDocument.h"
#include "WebBrowserPersistDocumentParent.h"
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/HTMLAreaElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLObjectElement.h"
+#include "mozilla/dom/HTMLOptionElement.h"
#include "mozilla/dom/HTMLSharedElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/TabParent.h"
#include "nsComponentManagerUtils.h"
#include "nsContentUtils.h"
#include "nsContentCID.h"
#include "nsCycleCollectionParticipant.h"
#include "nsFrameLoader.h"
@@ -24,17 +25,16 @@
#include "nsIDOMAttr.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
-#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMWindowUtils.h"
@@ -1161,24 +1161,25 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
nsAutoString valueStr;
nodeAsTextArea->GetValue(valueStr);
(*aNodeOut)->SetTextContent(valueStr);
}
return rv;
}
- nsCOMPtr<nsIDOMHTMLOptionElement> nodeAsOption = do_QueryInterface(aNodeIn);
+ dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromContent(content);
if (nodeAsOption) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
- nsCOMPtr<nsIDOMHTMLOptionElement> outElt = do_QueryInterface(*aNodeOut);
- bool selected;
- nodeAsOption->GetSelected(&selected);
- outElt->SetDefaultSelected(selected);
+ nsCOMPtr<nsIContent> outContent = do_QueryInterface(*aNodeOut);
+ dom::HTMLOptionElement* outElt = dom::HTMLOptionElement::FromContent(outContent);
+ bool selected = nodeAsOption->Selected();
+ IgnoredErrorResult ignored;
+ outElt->SetDefaultSelected(selected, ignored);
}
return rv;
}
return NS_OK;
}
} // unnamed namespace
--- a/dom/webidl/HTMLOptionElement.webidl
+++ b/dom/webidl/HTMLOptionElement.webidl
@@ -8,24 +8,23 @@
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
[HTMLConstructor, NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
interface HTMLOptionElement : HTMLElement {
- [CEReactions, SetterThrows]
- attribute boolean disabled;
+ [CEReactions, SetterThrows]
+ attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- [CEReactions, SetterThrows]
- attribute DOMString label;
- [CEReactions, SetterThrows]
- attribute boolean defaultSelected;
- [SetterThrows]
- attribute boolean selected;
- [CEReactions, SetterThrows]
- attribute DOMString value;
+ [CEReactions, SetterThrows]
+ attribute DOMString label;
+ [CEReactions, SetterThrows]
+ attribute boolean defaultSelected;
+ attribute boolean selected;
+ [CEReactions, SetterThrows]
+ attribute DOMString value;
- [CEReactions, SetterThrows]
- attribute DOMString text;
+ [CEReactions, SetterThrows]
+ attribute DOMString text;
readonly attribute long index;
};
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -5,17 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsUnicharUtils.h"
#include "nsListControlFrame.h"
#include "nsCheckboxRadioFrame.h" // for COMPARE macro
#include "nsGkAtoms.h"
-#include "nsIDOMHTMLOptionElement.h"
#include "nsComboboxControlFrame.h"
#include "nsIPresShell.h"
#include "nsIDOMMouseEvent.h"
#include "nsIXULRuntime.h"
#include "nsFontMetrics.h"
#include "nsIScrollableFrame.h"
#include "nsCSSRendering.h"
#include "nsIDOMEventListener.h"
@@ -226,22 +225,19 @@ void nsListControlFrame::PaintFocus(Draw
fRect.width = CalcFallbackRowBSize(inflation);
fRect.height = GetScrollPortRect().height;
}
fRect.MoveBy(containerFrame->GetOffsetTo(this));
}
fRect += aPt;
bool lastItemIsSelected = false;
- if (focusedContent) {
- nsCOMPtr<nsIDOMHTMLOptionElement> domOpt =
- do_QueryInterface(focusedContent);
- if (domOpt) {
- domOpt->GetSelected(&lastItemIsSelected);
- }
+ HTMLOptionElement* domOpt = HTMLOptionElement::FromContentOrNull(focusedContent);
+ if (domOpt) {
+ lastItemIsSelected = domOpt->Selected();
}
// set up back stop colors and then ask L&F service for the real colors
nscolor color =
LookAndFeel::GetColor(lastItemIsSelected ?
LookAndFeel::eColorID_WidgetSelectForeground :
LookAndFeel::eColorID_WidgetSelectBackground);
@@ -1852,17 +1848,18 @@ nsListControlFrame::MouseDown(nsIDOMEven
} else {
// NOTE: the combo box is responsible for dropping it down
if (mComboboxFrame) {
// Ignore the click that occurs on the option element when one is
// selected from the parent process popup.
if (mComboboxFrame->IsOpenInParentProcess()) {
nsCOMPtr<nsIDOMEventTarget> etarget;
aMouseEvent->GetTarget(getter_AddRefs(etarget));
- nsCOMPtr<nsIDOMHTMLOptionElement> option = do_QueryInterface(etarget);
+ nsCOMPtr<nsIContent> econtent = do_QueryInterface(etarget);
+ HTMLOptionElement* option = HTMLOptionElement::FromContentOrNull(econtent);
if (option) {
return NS_OK;
}
}
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
if (NS_FAILED(mouseEvent->GetMozInputSource(&inputSource))) {
return NS_ERROR_FAILURE;
@@ -2448,21 +2445,21 @@ nsListControlFrame::KeyPress(nsIDOMEvent
uint32_t index = (i + startIndex) % numOptions;
RefPtr<dom::HTMLOptionElement> optionElement =
options->ItemAsOption(index);
if (!optionElement || !optionElement->GetPrimaryFrame()) {
continue;
}
nsAutoString text;
- if (NS_FAILED(optionElement->GetText(text)) ||
- !StringBeginsWith(
- nsContentUtils::TrimWhitespace<
- nsContentUtils::IsHTMLWhitespaceOrNBSP>(text, false),
- incrementalString, nsCaseInsensitiveStringComparator())) {
+ optionElement->GetText(text);
+ if (!StringBeginsWith(
+ nsContentUtils::TrimWhitespace<
+ nsContentUtils::IsHTMLWhitespaceOrNBSP>(text, false),
+ incrementalString, nsCaseInsensitiveStringComparator())) {
continue;
}
bool wasChanged = PerformSelection(index, keyEvent->IsShift(), isControlOrMeta);
if (!weakFrame.IsAlive()) {
return NS_OK;
}
if (!wasChanged) {
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -48,17 +48,16 @@
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
-#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMMutationEvent.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
@@ -148,18 +147,16 @@
#include "mozilla/dom/HTMLCollectionBinding.h"
#include "mozilla/dom/HTMLDocumentBinding.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/HTMLFormElementBinding.h"
#include "mozilla/dom/HTMLFrameSetElementBinding.h"
#include "mozilla/dom/HTMLHtmlElementBinding.h"
#include "mozilla/dom/HTMLInputElementBinding.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
-#include "mozilla/dom/HTMLObjectElementBinding.h"
-#include "mozilla/dom/HTMLOptionElementBinding.h"
#include "mozilla/dom/HTMLScriptElementBinding.h"
#include "mozilla/dom/KeyEventBinding.h"
#include "mozilla/dom/ListBoxObjectBinding.h"
#include "mozilla/dom/MediaListBinding.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/MenuBoxObjectBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/MouseScrollEventBinding.h"
@@ -301,17 +298,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(HTMLBaseElement),
DEFINE_SHIM(HTMLCollection),
DEFINE_SHIM(HTMLDocument),
DEFINE_SHIM(HTMLElement),
DEFINE_SHIM(HTMLFormElement),
DEFINE_SHIM(HTMLHtmlElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLMediaElement),
- DEFINE_SHIM(HTMLOptionElement),
DEFINE_SHIM(HTMLScriptElement),
DEFINE_SHIM(KeyEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM(MediaList),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
DEFINE_SHIM(MouseEvent),
DEFINE_SHIM(MouseScrollEvent),
DEFINE_SHIM(MutationEvent),