Backed out 2 changesets (bug 981248) for causing multiple failures.

CLOSED TREE

Backed out changeset 7a96708cc8b7 (bug 981248)
Backed out changeset 1eace7bd28d9 (bug 981248)
This commit is contained in:
Mihai Alexandru Michis
2020-01-14 19:28:17 +02:00
parent c7d67b115e
commit b51ee7e327
43 changed files with 1166 additions and 366 deletions

View File

@@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "nsContainerFrame.h"
#include "nsTextControlFrame.h"
#include "nsIFormControlFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsCOMPtr.h"
@@ -29,10 +28,10 @@ class HTMLInputElement;
/**
* This frame type is used for <input type=number>.
*
* TODO(emilio): Maybe merge with nsTextControlFrame?
*/
class nsNumberControlFrame final : public nsTextControlFrame {
class nsNumberControlFrame final : public nsContainerFrame,
public nsIAnonymousContentCreator,
public nsIFormControlFrame {
friend nsIFrame* NS_NewNumberControlFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
@@ -49,23 +48,80 @@ class nsNumberControlFrame final : public nsTextControlFrame {
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsNumberControlFrame)
void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData&) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override;
virtual void ContentStatesChanged(mozilla::EventStates aStates) override;
#ifdef ACCESSIBILITY
mozilla::a11y::AccType AccessibleType() override;
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;
bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
BaselineSharingGroup aGroup,
nscoord* aBaseline) const override;
// nsIAnonymousContentCreator
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
virtual nsresult CreateAnonymousContent(
nsTArray<ContentInfo>& aElements) override;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("NumberControl"), aResult);
}
#endif
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// nsIFormControlFrame
virtual void SetFocus(bool aOn, bool aRepaint) override;
virtual nsresult SetFormProperty(nsAtom* aName,
const nsAString& aValue) override;
/**
* This method attempts to localizes aValue and then sets the result as the
* value of our anonymous text control. It's called when our
* HTMLInputElement's value changes, when we need to sync up the value
* displayed in our anonymous text control.
*/
void SetValueOfAnonTextControl(const nsAString& aValue);
/**
* This method gets the string value of our anonymous text control,
* attempts to normalizes (de-localizes) it, then sets the outparam aValue to
* the result. It's called when user input changes the text value of our
* anonymous text control so that we can sync up the internal value of our
* HTMLInputElement.
*/
void GetValueOfAnonTextControl(nsAString& aValue);
bool AnonTextControlIsEmpty();
/**
* Called to notify this frame that its HTMLInputElement is currently
* processing a DOM 'input' event.
*/
void HandlingInputEvent(bool aHandlingEvent) {
mHandlingInputEvent = aHandlingEvent;
}
HTMLInputElement* GetAnonTextControl() const;
/**
* If the frame is the frame for an nsNumberControlFrame's anonymous text
* field, returns the nsNumberControlFrame. Else returns nullptr.
@@ -94,6 +150,10 @@ class nsNumberControlFrame final : public nsTextControlFrame {
bool SpinnerUpButtonIsDepressed() const;
bool SpinnerDownButtonIsDepressed() const;
bool IsFocused() const;
void HandleFocusEvent(WidgetEvent* aEvent);
/**
* Our element had HTMLInputElement::Select() called on it.
*/
@@ -102,16 +162,47 @@ class nsNumberControlFrame final : public nsTextControlFrame {
bool ShouldUseNativeStyleForSpinner() const;
private:
nsITextControlFrame* GetTextFieldFrame();
already_AddRefed<Element> MakeAnonymousElement(Element* aParent,
nsAtom* aTagName,
PseudoStyleType aPseudoType);
// See nsNumberControlFrame::CreateAnonymousContent for a description of
// these.
class SyncDisabledStateEvent;
friend class SyncDisabledStateEvent;
class SyncDisabledStateEvent : public mozilla::Runnable {
public:
explicit SyncDisabledStateEvent(nsNumberControlFrame* aFrame)
: mozilla::Runnable("nsNumberControlFrame::SyncDisabledStateEvent"),
mFrame(aFrame) {}
NS_IMETHOD Run() override {
nsNumberControlFrame* frame =
static_cast<nsNumberControlFrame*>(mFrame.GetFrame());
NS_ENSURE_STATE(frame);
frame->SyncDisabledState();
return NS_OK;
}
private:
WeakFrame mFrame;
};
/**
* Sync the disabled state of the anonymous children up with our content's.
*/
void SyncDisabledState();
/**
* The text field used to edit and show the number.
* @see nsNumberControlFrame::CreateAnonymousContent.
*/
nsCOMPtr<Element> mOuterWrapper;
nsCOMPtr<Element> mTextField;
nsCOMPtr<Element> mSpinBox;
nsCOMPtr<Element> mSpinUp;
nsCOMPtr<Element> mSpinDown;
bool mHandlingInputEvent;
};
#endif // nsNumberControlFrame_h__