Backed out changesets 1b268ec6b81e, b68f5c69dce2 (bug 935508) and changesets 29db440280c8, 64f359e4e054 (bug 945784) for mochitest failures.
CLOSED TREE
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
@@ -319,49 +318,6 @@ nsNumberControlFrame::GetAnonTextControl()
|
||||
return mTextField ? HTMLInputElement::FromContent(mTextField) : nullptr;
|
||||
}
|
||||
|
||||
/* static */ nsNumberControlFrame*
|
||||
nsNumberControlFrame::GetNumberControlFrameForTextField(nsIFrame* aFrame)
|
||||
{
|
||||
// If aFrame is the anon text field for an <input type=number> then we expect
|
||||
// the frame of its mContent's grandparent to be that input's frame. We
|
||||
// have to check for this via the content tree because we don't know whether
|
||||
// extra frames will be wrapped around any of the elements between aFrame and
|
||||
// the nsNumberControlFrame that we're looking for (e.g. flex wrappers).
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (content->IsInNativeAnonymousSubtree() &&
|
||||
content->GetParent() && content->GetParent()->GetParent()) {
|
||||
nsIContent* grandparent = content->GetParent()->GetParent();
|
||||
if (grandparent->IsHTML(nsGkAtoms::input) &&
|
||||
grandparent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::number, eCaseMatters)) {
|
||||
return do_QueryFrame(grandparent->GetPrimaryFrame());
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* static */ nsNumberControlFrame*
|
||||
nsNumberControlFrame::GetNumberControlFrameForSpinButton(nsIFrame* aFrame)
|
||||
{
|
||||
// If aFrame is a spin button for an <input type=number> then we expect the
|
||||
// frame of its mContent's great-grandparent to be that input's frame. We
|
||||
// have to check for this via the content tree because we don't know whether
|
||||
// extra frames will be wrapped around any of the elements between aFrame and
|
||||
// the nsNumberControlFrame that we're looking for (e.g. flex wrappers).
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (content->IsInNativeAnonymousSubtree() &&
|
||||
content->GetParent() && content->GetParent()->GetParent() &&
|
||||
content->GetParent()->GetParent()->GetParent()) {
|
||||
nsIContent* greatgrandparent = content->GetParent()->GetParent()->GetParent();
|
||||
if (greatgrandparent->IsHTML(nsGkAtoms::input) &&
|
||||
greatgrandparent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::number, eCaseMatters)) {
|
||||
return do_QueryFrame(greatgrandparent->GetPrimaryFrame());
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
|
||||
{
|
||||
@@ -374,64 +330,9 @@ nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
|
||||
if (aEvent->originalTarget == mSpinDown) {
|
||||
return eSpinButtonDown;
|
||||
}
|
||||
if (aEvent->originalTarget == mSpinBox) {
|
||||
// In the case that the up/down buttons are hidden (display:none) we use
|
||||
// just the spin box element, spinning up if the pointer is over the top
|
||||
// half of the element, or down if it's over the bottom half. This is
|
||||
// important to handle since this is the state things are in for the
|
||||
// default UA style sheet. See the comment in forms.css for why.
|
||||
LayoutDeviceIntPoint absPoint = aEvent->refPoint;
|
||||
nsPoint point =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
LayoutDeviceIntPoint::ToUntyped(absPoint),
|
||||
mSpinBox->GetPrimaryFrame());
|
||||
if (point != nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)) {
|
||||
if (point.y < mSpinBox->GetPrimaryFrame()->GetSize().height / 2) {
|
||||
return eSpinButtonUp;
|
||||
}
|
||||
return eSpinButtonDown;
|
||||
}
|
||||
}
|
||||
return eSpinButtonNone;
|
||||
}
|
||||
|
||||
void
|
||||
nsNumberControlFrame::SpinnerStateChanged() const
|
||||
{
|
||||
nsIFrame* spinUpFrame = mSpinUp->GetPrimaryFrame();
|
||||
if (spinUpFrame && spinUpFrame->IsThemed()) {
|
||||
spinUpFrame->InvalidateFrame();
|
||||
}
|
||||
nsIFrame* spinDownFrame = mSpinDown->GetPrimaryFrame();
|
||||
if (spinDownFrame && spinDownFrame->IsThemed()) {
|
||||
spinDownFrame->InvalidateFrame();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsNumberControlFrame::SpinnerUpButtonIsDepressed() const
|
||||
{
|
||||
return HTMLInputElement::FromContent(mContent)->
|
||||
NumberSpinnerUpButtonIsDepressed();
|
||||
}
|
||||
|
||||
bool
|
||||
nsNumberControlFrame::SpinnerDownButtonIsDepressed() const
|
||||
{
|
||||
return HTMLInputElement::FromContent(mContent)->
|
||||
NumberSpinnerDownButtonIsDepressed();
|
||||
}
|
||||
|
||||
bool
|
||||
nsNumberControlFrame::IsFocused() const
|
||||
{
|
||||
// Normally this depends on the state of our anonymous text control (which
|
||||
// takes focus for us), but in the case that it does not have a frame we will
|
||||
// have focus ourself.
|
||||
return mTextField->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS) ||
|
||||
mContent->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS);
|
||||
}
|
||||
|
||||
void
|
||||
nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
|
||||
{
|
||||
@@ -441,27 +342,6 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
|
||||
}
|
||||
}
|
||||
|
||||
#define STYLES_DISABLING_NATIVE_THEMING \
|
||||
NS_AUTHOR_SPECIFIED_BACKGROUND | \
|
||||
NS_AUTHOR_SPECIFIED_PADDING | \
|
||||
NS_AUTHOR_SPECIFIED_BORDER
|
||||
|
||||
bool
|
||||
nsNumberControlFrame::ShouldUseNativeStyleForSpinner() const
|
||||
{
|
||||
nsIFrame* spinUpFrame = mSpinUp->GetPrimaryFrame();
|
||||
nsIFrame* spinDownFrame = mSpinDown->GetPrimaryFrame();
|
||||
|
||||
return spinUpFrame &&
|
||||
spinUpFrame->StyleDisplay()->mAppearance == NS_THEME_SPINNER_UP_BUTTON &&
|
||||
!PresContext()->HasAuthorSpecifiedRules(spinUpFrame,
|
||||
STYLES_DISABLING_NATIVE_THEMING) &&
|
||||
spinDownFrame &&
|
||||
spinDownFrame->StyleDisplay()->mAppearance == NS_THEME_SPINNER_DOWN_BUTTON &&
|
||||
!PresContext()->HasAuthorSpecifiedRules(spinDownFrame,
|
||||
STYLES_DISABLING_NATIVE_THEMING);
|
||||
}
|
||||
|
||||
void
|
||||
nsNumberControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
|
||||
uint32_t aFilter)
|
||||
|
||||
Reference in New Issue
Block a user