mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 846688 - Move IsLTR() from nsHTMLInputElement.cpp to dom::Element. r=bz
This commit is contained in:
parent
66239a7ec2
commit
924122577c
@ -338,6 +338,8 @@ public:
|
||||
(HasValidDir() || IsHTML(nsGkAtoms::bdi)));
|
||||
}
|
||||
|
||||
Directionality GetComputedDirectionality() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
|
@ -3419,6 +3419,18 @@ Element::SetBoolAttr(nsIAtom* aAttr, bool aValue)
|
||||
return UnsetAttr(kNameSpaceID_None, aAttr, true);
|
||||
}
|
||||
|
||||
Directionality
|
||||
Element::GetComputedDirectionality() const
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR
|
||||
? eDir_LTR : eDir_RTL;
|
||||
}
|
||||
|
||||
return GetDirectionality();
|
||||
}
|
||||
|
||||
float
|
||||
Element::FontSizeInflation()
|
||||
{
|
||||
|
@ -2839,17 +2839,6 @@ SelectTextFieldOnFocus()
|
||||
return gSelectTextFieldOnFocus == 1;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsLTR(Element* aElement)
|
||||
{
|
||||
nsIFrame* frame = aElement->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
|
||||
}
|
||||
// at least for HTML, directionality is exclusively LTR or RTL
|
||||
return aElement->GetDirectionality() == eDir_LTR;
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLInputElement::ShouldPreventDOMActivateDispatch(EventTarget* aOriginalTarget)
|
||||
{
|
||||
@ -3180,10 +3169,12 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
Decimal newValue;
|
||||
switch (keyEvent->keyCode) {
|
||||
case NS_VK_LEFT:
|
||||
newValue = value + (IsLTR(this) ? -step : step);
|
||||
newValue = value + (GetComputedDirectionality() == eDir_RTL
|
||||
? step : -step);
|
||||
break;
|
||||
case NS_VK_RIGHT:
|
||||
newValue = value + (IsLTR(this) ? step : -step);
|
||||
newValue = value + (GetComputedDirectionality() == eDir_RTL
|
||||
? -step : step);
|
||||
break;
|
||||
case NS_VK_UP:
|
||||
// Even for horizontal range, "up" means "increase"
|
||||
|
Loading…
Reference in New Issue
Block a user