Bug 1439751 - Remove all members from nsIDOMHTMLInputElement. r=qdot

MozReview-Commit-ID: JVagEzvSONN

--HG--
extra : rebase_source : a7e1cf2e5ccc1925f3a11c7d935438ef6307c70c
This commit is contained in:
Adrian Wielgosik 2018-02-20 23:10:44 +01:00
parent ed00cb8c4e
commit 2d4df58ad8
20 changed files with 53 additions and 108 deletions

View File

@ -35,7 +35,6 @@
#include "nsIDOMFileList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIImageLoadingContent.h"
#include "nsIWebNavigation.h"
#include "nsIPresShell.h"

View File

@ -135,7 +135,6 @@
#include "nsIDOMDocumentType.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMWindowUtils.h"
@ -1060,7 +1059,7 @@ nsContentUtils::Atob(const nsAString& aAsciiBase64String,
}
bool
nsContentUtils::IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput)
nsContentUtils::IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput)
{
NS_PRECONDITION(aInput, "aInput should not be null!");
@ -1068,8 +1067,7 @@ nsContentUtils::IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput)
aInput->GetAutocomplete(autocomplete);
if (autocomplete.IsEmpty()) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
aInput->GetForm(getter_AddRefs(form));
auto* form = aInput->GetForm();
if (!form) {
return true;
}

View File

@ -73,7 +73,6 @@ class nsIDocumentLoaderFactory;
class nsIDOMDocument;
class nsIDOMDocumentFragment;
class nsIDOMEvent;
class nsIDOMHTMLInputElement;
class nsIDOMNode;
class nsIDragSession;
class nsIEventTarget;
@ -135,6 +134,7 @@ struct CustomElementDefinition;
class DocumentFragment;
class Element;
class EventTarget;
class HTMLInputElement;
class IPCDataTransfer;
class IPCDataTransferItem;
struct LifecycleCallbackArgs;
@ -2634,7 +2634,7 @@ public:
* @param aInput the input element to check. NOTE: aInput can't be null.
* @return whether the input element has autocomplete enabled.
*/
static bool IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput);
static bool IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput);
enum AutocompleteAttrState : uint8_t
{

View File

@ -115,7 +115,6 @@
#include "nsFocusManager.h"
// for radio group stuff
#include "nsIDOMHTMLInputElement.h"
#include "nsIRadioVisitor.h"
#include "nsIFormControl.h"

View File

@ -18,13 +18,13 @@
#include "nsGlobalWindow.h"
#include "nsFocusManager.h"
#include "nsIContent.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIControllers.h"
#include "nsIController.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#ifdef MOZ_XUL
#include "nsXULElement.h"
@ -238,8 +238,8 @@ nsWindowRoot::GetControllers(bool aForVisibleWindow,
if (htmlTextArea)
return htmlTextArea->GetControllers(aResult);
nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement =
do_QueryInterface(focusedContent);
HTMLInputElement* htmlInputElement =
HTMLInputElement::FromContent(focusedContent);
if (htmlInputElement)
return htmlInputElement->GetControllers(aResult);

View File

@ -1637,7 +1637,7 @@ HTMLFormElement::GetActionURL(nsIURI** aActionURL,
"The originating element must be a submit form control!");
#endif // DEBUG
nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(aOriginatingElement);
HTMLInputElement* inputElement = HTMLInputElement::FromContent(aOriginatingElement);
if (inputElement) {
inputElement->GetFormAction(action);
} else {

View File

@ -1548,23 +1548,11 @@ HTMLInputElement::AfterClearForm(bool aUnbindOrDelete)
}
}
// nsIDOMHTMLInputElement
NS_IMETHODIMP
HTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
return nsGenericHTMLFormElementWithState::GetForm(aForm);
}
NS_IMPL_ACTION_ATTR(HTMLInputElement, FormAction, formaction)
NS_IMPL_STRING_ATTR(HTMLInputElement, Name, name)
NS_IMPL_BOOL_ATTR(HTMLInputElement, ReadOnly, readonly)
NS_IMETHODIMP
void
HTMLInputElement::GetAutocomplete(nsAString& aValue)
{
if (!DoesAutocompleteApply()) {
return NS_OK;
return;
}
aValue.Truncate();
@ -1573,7 +1561,6 @@ HTMLInputElement::GetAutocomplete(nsAString& aValue)
mAutocompleteAttrState =
nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue,
mAutocompleteAttrState);
return NS_OK;
}
void
@ -1630,13 +1617,6 @@ HTMLInputElement::Height()
return GetWidthHeightForImage(mCurrentRequest).height;
}
NS_IMETHODIMP
HTMLInputElement::GetIndeterminate(bool* aValue)
{
*aValue = Indeterminate();
return NS_OK;
}
void
HTMLInputElement::SetIndeterminateInternal(bool aValue,
bool aShouldInvalidate)
@ -1653,11 +1633,10 @@ HTMLInputElement::SetIndeterminateInternal(bool aValue,
UpdateState(true);
}
NS_IMETHODIMP
void
HTMLInputElement::SetIndeterminate(bool aValue)
{
SetIndeterminateInternal(aValue, true);
return NS_OK;
}
uint32_t
@ -3110,13 +3089,6 @@ HTMLInputElement::SetValueChanged(bool aValueChanged)
return NS_OK;
}
NS_IMETHODIMP
HTMLInputElement::GetChecked(bool* aChecked)
{
*aChecked = Checked();
return NS_OK;
}
void
HTMLInputElement::SetCheckedChanged(bool aCheckedChanged)
{
@ -3152,11 +3124,10 @@ HTMLInputElement::SetCheckedChangedInternal(bool aCheckedChanged)
}
}
NS_IMETHODIMP
void
HTMLInputElement::SetChecked(bool aChecked)
{
DoSetChecked(aChecked, true, true);
return NS_OK;
}
void
@ -3628,7 +3599,7 @@ HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
aVisitor.mItemFlags |= NS_ORIGINAL_INDETERMINATE_VALUE;
}
GetChecked(&originalCheckedValue);
originalCheckedValue = Checked();
DoSetChecked(!originalCheckedValue, true, true);
mCheckedIsToggled = true;
}
@ -4271,8 +4242,9 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
// selected btn to TRUE. if it is a checkbox then set it to its
// original value
if (oldType == NS_FORM_INPUT_RADIO) {
nsCOMPtr<nsIDOMHTMLInputElement> selectedRadioButton =
do_QueryInterface(aVisitor.mItemData);
nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
HTMLInputElement* selectedRadioButton =
HTMLInputElement::FromContentOrNull(content);
if (selectedRadioButton) {
selectedRadioButton->SetChecked(true);
}
@ -4306,8 +4278,9 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
FireEventForAccessibility(this, aVisitor.mPresContext,
eFormRadioStateChange);
// Fire event for the previous selected radio.
nsCOMPtr<nsIDOMHTMLInputElement> previous =
do_QueryInterface(aVisitor.mItemData);
nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
HTMLInputElement* previous =
HTMLInputElement::FromContentOrNull(content);
if (previous) {
FireEventForAccessibility(previous, aVisitor.mPresContext,
eFormRadioStateChange);
@ -6022,7 +5995,7 @@ HTMLInputElement::GetControllers(ErrorResult& aRv)
return mControllers;
}
NS_IMETHODIMP
nsresult
HTMLInputElement::GetControllers(nsIControllers** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);

View File

@ -482,7 +482,7 @@ public:
SetHTMLAttr(nsGkAtoms::alt, aValue, aRv);
}
// XPCOM GetAutocomplete() is OK
void GetAutocomplete(nsAString& aValue);
void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
@ -514,7 +514,7 @@ public:
{
return mChecked;
}
// XPCOM SetChecked() is OK
void SetChecked(bool aChecked);
bool Disabled() const
{
@ -526,12 +526,9 @@ public:
SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv);
}
// XPCOM GetForm() is OK
FileList* GetFiles();
void SetFiles(FileList* aFiles);
// XPCOM GetFormAction() is OK
void SetFormAction(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::formaction, aValue, aRv);
@ -584,8 +581,7 @@ public:
{
return mIsDraggingRange;
}
// XPCOM SetIndeterminate() is OK
void SetIndeterminate(bool aValue);
void GetInputMode(nsAString& aValue);
void SetInputMode(const nsAString& aValue, ErrorResult& aRv)
@ -655,7 +651,10 @@ public:
SetHTMLBoolAttr(nsGkAtoms::multiple, aValue, aRv);
}
// XPCOM GetName() is OK
void GetName(nsAString& aValue)
{
GetHTMLAttr(nsGkAtoms::name, aValue);
}
void SetName(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
@ -860,6 +859,8 @@ public:
}
nsIControllers* GetControllers(ErrorResult& aRv);
// XPCOM adapter function widely used throughout code, leaving it as is.
nsresult GetControllers(nsIControllers** aResult);
int32_t InputTextLength(CallerType aCallerType);

View File

@ -19,7 +19,6 @@
#include "nsContentCreatorFunctions.h"
#include "nsTextControlFrame.h"
#include "nsIControllers.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsITransactionManager.h"
#include "nsIControllerContext.h"
#include "nsAttrValue.h"
@ -884,7 +883,7 @@ DoCommandCallback(Command aCommand, void* aData)
nsIContent *content = frame->GetContent();
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(content);
HTMLInputElement* input = HTMLInputElement::FromContent(content);
if (input) {
input->GetControllers(getter_AddRefs(controllers));
} else {
@ -1414,12 +1413,12 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
if (!SuppressEventHandlers(presContext)) {
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
do_QueryInterface(mTextCtrlElement);
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLInputElement* inputElement =
HTMLInputElement::FromContentOrNull(content);
if (inputElement) {
rv = inputElement->GetControllers(getter_AddRefs(controllers));
} else {
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLTextAreaElement* textAreaElement =
HTMLTextAreaElement::FromContentOrNull(content);
@ -2073,13 +2072,13 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
if (!SuppressEventHandlers(mBoundFrame->PresContext()))
{
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
do_QueryInterface(mTextCtrlElement);
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLInputElement* inputElement =
HTMLInputElement::FromContentOrNull(content);
if (inputElement)
inputElement->GetControllers(getter_AddRefs(controllers));
else
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
HTMLTextAreaElement* textAreaElement =
HTMLTextAreaElement::FromContentOrNull(content);
if (textAreaElement) {

View File

@ -23,16 +23,4 @@ interface nsIDOMHTMLFormElement;
[uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)]
interface nsIDOMHTMLInputElement : nsISupports
{
readonly attribute DOMString autocomplete;
attribute boolean checked;
readonly attribute nsIDOMHTMLFormElement form;
attribute DOMString formAction;
attribute boolean indeterminate;
attribute DOMString name;
attribute boolean readOnly;
readonly attribute nsIControllers controllers;
};

View File

@ -30,7 +30,6 @@
#include "nsIContent.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMProcessingInstruction.h"
@ -564,7 +563,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
return OnWalkSubframe(aNode);
}
nsCOMPtr<nsIDOMHTMLInputElement> nodeAsInput = do_QueryInterface(aNode);
auto nodeAsInput = dom::HTMLInputElement::FromContent(content);
if (nodeAsInput) {
return OnWalkAttribute(aNode, "src");
}

View File

@ -22,7 +22,6 @@
#include "nsIControllers.h"
#include "nsXULElement.h"
#include "nsIURI.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsFocusManager.h"
#include "nsIFormControl.h"
#include "nsIDOMEventListener.h"
@ -48,6 +47,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EventHandlerBinding.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
@ -682,7 +682,7 @@ nsXBLPrototypeHandler::GetController(EventTarget* aTarget)
}
if (!controllers) {
nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
HTMLInputElement* htmlInputElement = HTMLInputElement::FromContent(targetContent);
if (htmlInputElement)
htmlInputElement->GetControllers(getter_AddRefs(controllers));
}

View File

@ -42,7 +42,6 @@
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNode.h"
#include "nsIDocument.h"
#include "nsIFile.h"

View File

@ -8,7 +8,7 @@
#include "nsGkAtoms.h"
#include "nsLayoutUtils.h"
#include "nsIDOMHTMLInputElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/LookAndFeel.h"
#include "nsDeviceContext.h"
@ -16,6 +16,7 @@
#include "nsThemeConstants.h"
using namespace mozilla;
using mozilla::dom::HTMLInputElement;
//#define FCF_NOISY
@ -195,9 +196,9 @@ nsCheckboxRadioFrame::HandleEvent(nsPresContext* aPresContext,
void
nsCheckboxRadioFrame::GetCurrentCheckState(bool* aState)
{
nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(mContent);
HTMLInputElement* inputElement = HTMLInputElement::FromContent(mContent);
if (inputElement) {
inputElement->GetChecked(aState);
*aState = inputElement->Checked();
}
}

View File

@ -21,7 +21,6 @@
#include "nsNodeInfoManager.h"
#include "nsIDateTimeInputArea.h"
#include "nsIObserverService.h"
#include "nsIDOMHTMLInputElement.h"
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsThreadUtils.h"

View File

@ -11,7 +11,6 @@
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "nsContentUtils.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsTextNode.h"
using namespace mozilla;

View File

@ -4,7 +4,6 @@
#include "nsNativeThemeAndroid.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIFrame.h"
#include "nsThemeConstants.h"
#include "AndroidColors.h"

View File

@ -20,10 +20,10 @@
#include "nsTransform2D.h"
#include "nsMenuFrame.h"
#include "prlink.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsGkAtoms.h"
#include "nsAttrValueInlines.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/EventStates.h"
#include "mozilla/Services.h"
@ -54,6 +54,7 @@
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::widget;
using mozilla::dom::HTMLInputElement;
NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme,
nsIObserver)
@ -246,14 +247,10 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
}
} else {
if (aWidgetFlags) {
nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(aFrame->GetContent()));
*aWidgetFlags = 0;
if (inputElt) {
bool isHTMLChecked;
inputElt->GetChecked(&isHTMLChecked);
if (isHTMLChecked)
*aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;
}
HTMLInputElement* inputElt = HTMLInputElement::FromContent(aFrame->GetContent());
if (inputElt && inputElt->Checked())
*aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;
if (GetIndeterminate(aFrame))
*aWidgetFlags |= MOZ_GTK_WIDGET_INCONSISTENT;

View File

@ -13,7 +13,6 @@
#include "nsPresContext.h"
#include "nsString.h"
#include "nsNameSpaceManager.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsThemeConstants.h"
#include "nsIComponentManager.h"
@ -26,6 +25,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLProgressElement.h"
#include "nsIDocumentInlines.h"
#include <algorithm>
@ -210,11 +210,9 @@ nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected)
aFrame = aFrame->GetParent();
} else {
// Check for an HTML input element
nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
if (inputElt) {
bool checked;
inputElt->GetChecked(&checked);
return checked;
return inputElt->Checked();
}
}
@ -262,11 +260,9 @@ nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
}
// Check for an HTML input element
nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
if (inputElt) {
bool indeterminate;
inputElt->GetIndeterminate(&indeterminate);
return indeterminate;
return inputElt->Indeterminate();
}
return false;

View File

@ -18,7 +18,6 @@
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsNameSpaceManager.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsLookAndFeel.h"
#include "nsMenuFrame.h"
#include "nsGkAtoms.h"