mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1611181 - Make direction use an enum class. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D60857 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3480a92965
commit
a25126cd0d
@ -3611,9 +3611,8 @@ void Element::SetOrRemoveNullableStringAttr(nsAtom* aName,
|
||||
}
|
||||
|
||||
Directionality Element::GetComputedDirectionality() const {
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR
|
||||
if (nsIFrame* frame = GetPrimaryFrame()) {
|
||||
return frame->StyleVisibility()->mDirection == StyleDirection::Ltr
|
||||
? eDir_LTR
|
||||
: eDir_RTL;
|
||||
}
|
||||
|
@ -3764,8 +3764,7 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
isRTL =
|
||||
canvasStyle->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
isRTL = canvasStyle->StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
} else {
|
||||
isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) ==
|
||||
IBMBIDI_TEXTDIRECTION_RTL;
|
||||
|
@ -797,8 +797,8 @@ void MathMLElement::MapMathMLAttributesInto(
|
||||
!aDecls.PropertyIsSet(eCSSProperty_direction)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
static const char dirs[][4] = {"ltr", "rtl"};
|
||||
static const int32_t dirValues[MOZ_ARRAY_LENGTH(dirs)] = {
|
||||
NS_STYLE_DIRECTION_LTR, NS_STYLE_DIRECTION_RTL};
|
||||
static const StyleDirection dirValues[MOZ_ARRAY_LENGTH(dirs)] = {
|
||||
StyleDirection::Ltr, StyleDirection::Rtl};
|
||||
for (uint32_t i = 0; i < ArrayLength(dirs); ++i) {
|
||||
if (str.LowerCaseEqualsASCII(dirs[i])) {
|
||||
aDecls.SetKeywordValue(eCSSProperty_direction, dirValues[i]);
|
||||
|
@ -102,7 +102,7 @@
|
||||
#include "nsReadableUtils.h" // for EmptyString, ToNewCString
|
||||
#include "nsString.h" // for nsAutoString, nsString, etc.
|
||||
#include "nsStringFwd.h" // for nsString
|
||||
#include "nsStyleConsts.h" // for NS_STYLE_DIRECTION_RTL, etc.
|
||||
#include "nsStyleConsts.h" // for StyleDirection::Rtl, etc.
|
||||
#include "nsStyleStruct.h" // for nsStyleDisplay, nsStyleText, etc.
|
||||
#include "nsStyleStructFwd.h" // for nsIFrame::StyleUIReset, etc.
|
||||
#include "nsStyleUtil.h" // for nsStyleUtil
|
||||
@ -4909,7 +4909,7 @@ nsresult EditorBase::DetermineCurrentDirection() {
|
||||
|
||||
// Set the flag here, to enable us to use the same code path below.
|
||||
// It will be flipped before returning from the function.
|
||||
if (frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (frame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
mFlags |= nsIEditor::eEditorRightToLeft;
|
||||
} else {
|
||||
mFlags |= nsIEditor::eEditorLeftToRight;
|
||||
|
@ -83,7 +83,7 @@ static char16_t GetBidiOverride(ComputedStyle* aComputedStyle) {
|
||||
}
|
||||
const nsStyleTextReset* text = aComputedStyle->StyleTextReset();
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_BIDI_OVERRIDE) {
|
||||
return NS_STYLE_DIRECTION_RTL == vis->mDirection ? kRLO : kLRO;
|
||||
return StyleDirection::Rtl == vis->mDirection ? kRLO : kLRO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -102,7 +102,7 @@ static char16_t GetBidiControl(ComputedStyle* aComputedStyle) {
|
||||
const nsStyleVisibility* vis = aComputedStyle->StyleVisibility();
|
||||
const nsStyleTextReset* text = aComputedStyle->StyleTextReset();
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_EMBED) {
|
||||
return NS_STYLE_DIRECTION_RTL == vis->mDirection ? kRLE : kLRE;
|
||||
return StyleDirection::Rtl == vis->mDirection ? kRLE : kLRE;
|
||||
}
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_ISOLATE) {
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_BIDI_OVERRIDE) {
|
||||
@ -111,7 +111,7 @@ static char16_t GetBidiControl(ComputedStyle* aComputedStyle) {
|
||||
}
|
||||
// <bdi> element already has its directionality set from content so
|
||||
// we never need to return kFSI.
|
||||
return NS_STYLE_DIRECTION_RTL == vis->mDirection ? kRLI : kLRI;
|
||||
return StyleDirection::Rtl == vis->mDirection ? kRLI : kLRI;
|
||||
}
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
return kFSI;
|
||||
@ -2420,7 +2420,7 @@ nsBidiLevel nsBidiPresUtils::BidiLevelFromStyle(ComputedStyle* aComputedStyle) {
|
||||
return NSBIDI_DEFAULT_LTR;
|
||||
}
|
||||
|
||||
if (aComputedStyle->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (aComputedStyle->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
return NSBIDI_RTL;
|
||||
}
|
||||
|
||||
|
@ -645,8 +645,6 @@ nsresult nsCaret::GetCaretFrameForNodeOffset(
|
||||
//
|
||||
// Direction Style from visibility->mDirection
|
||||
// ------------------
|
||||
// NS_STYLE_DIRECTION_LTR : LTR or Default
|
||||
// NS_STYLE_DIRECTION_RTL
|
||||
if (theFrame->PresContext()->BidiEnabled()) {
|
||||
// If there has been a reflow, take the caret Bidi level to be the level of
|
||||
// the current frame
|
||||
@ -853,7 +851,7 @@ void nsCaret::ComputeCaretRects(nsIFrame* aFrame, int32_t aFrameOffset,
|
||||
|
||||
// on RTL frames the right edge of mCaretRect must be equal to framePos
|
||||
const nsStyleVisibility* vis = aFrame->StyleVisibility();
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
if (StyleDirection::Rtl == vis->mDirection) {
|
||||
if (isVertical) {
|
||||
aCaretRect->y -= aCaretRect->height;
|
||||
} else {
|
||||
|
@ -2088,11 +2088,11 @@ nsIScrollableFrame* nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame,
|
||||
nsRect nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
|
||||
const nsRect& aScrolledFrameOverflowArea,
|
||||
const nsSize& aScrollPortSize,
|
||||
uint8_t aDirection) {
|
||||
StyleDirection aDirection) {
|
||||
WritingMode wm = aScrolledFrame->GetWritingMode();
|
||||
// Potentially override the frame's direction to use the direction found
|
||||
// by ScrollFrameHelper::GetScrolledFrameDir()
|
||||
wm.SetDirectionFromBidiLevel(aDirection == NS_STYLE_DIRECTION_RTL ? 1 : 0);
|
||||
wm.SetDirectionFromBidiLevel(aDirection == StyleDirection::Rtl ? 1 : 0);
|
||||
|
||||
nscoord x1 = aScrolledFrameOverflowArea.x,
|
||||
x2 = aScrolledFrameOverflowArea.XMost(),
|
||||
|
@ -712,12 +712,11 @@ class nsLayoutUtils {
|
||||
* GetScrolledRect returns the range of allowable scroll offsets
|
||||
* for aScrolledFrame, assuming the scrollable overflow area is
|
||||
* aScrolledFrameOverflowArea and the scrollport size is aScrollPortSize.
|
||||
* aDirection is either NS_STYLE_DIRECTION_LTR or NS_STYLE_DIRECTION_RTL.
|
||||
*/
|
||||
static nsRect GetScrolledRect(nsIFrame* aScrolledFrame,
|
||||
const nsRect& aScrolledFrameOverflowArea,
|
||||
const nsSize& aScrollPortSize,
|
||||
uint8_t aDirection);
|
||||
mozilla::StyleDirection);
|
||||
|
||||
/**
|
||||
* HasPseudoStyle returns true if aContent (whose primary style
|
||||
|
@ -227,12 +227,12 @@ void StickyScrollContainer::ComputeStickyLimits(nsIFrame* aFrame,
|
||||
computedOffsets->bottom - rect.height - sfOffset.y);
|
||||
}
|
||||
|
||||
uint8_t direction = cbFrame->StyleVisibility()->mDirection;
|
||||
StyleDirection direction = cbFrame->StyleVisibility()->mDirection;
|
||||
|
||||
// Left
|
||||
if (computedOffsets->left != NS_AUTOOFFSET &&
|
||||
(computedOffsets->right == NS_AUTOOFFSET ||
|
||||
direction == NS_STYLE_DIRECTION_LTR ||
|
||||
direction == StyleDirection::Ltr ||
|
||||
rect.width <= sfSize.width - computedOffsets->LeftRight())) {
|
||||
aStick->SetLeftEdge(mScrollPosition.x + sfPadding.left +
|
||||
computedOffsets->left - sfOffset.x);
|
||||
@ -241,7 +241,7 @@ void StickyScrollContainer::ComputeStickyLimits(nsIFrame* aFrame,
|
||||
// Right
|
||||
if (computedOffsets->right != NS_AUTOOFFSET &&
|
||||
(computedOffsets->left == NS_AUTOOFFSET ||
|
||||
direction == NS_STYLE_DIRECTION_RTL ||
|
||||
direction == StyleDirection::Rtl ||
|
||||
rect.width <= sfSize.width - computedOffsets->LeftRight())) {
|
||||
aStick->SetRightEdge(mScrollPosition.x + sfPadding.left + sfSize.width -
|
||||
computedOffsets->right - rect.width - sfOffset.x);
|
||||
|
@ -329,12 +329,12 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
|
||||
mBlockWM, LogicalPoint(mBlockWM, mScrollableFrame->GetScrollPosition(),
|
||||
nullContainerSize));
|
||||
}
|
||||
uint8_t direction = aBlockFrame->StyleVisibility()->mDirection;
|
||||
StyleDirection direction = aBlockFrame->StyleVisibility()->mDirection;
|
||||
const nsStyleTextReset* style = aBlockFrame->StyleTextReset();
|
||||
|
||||
const auto& textOverflow = style->mTextOverflow;
|
||||
bool shouldToggleDirection =
|
||||
textOverflow.sides_are_logical && (direction == NS_STYLE_DIRECTION_RTL);
|
||||
textOverflow.sides_are_logical && (direction == StyleDirection::Rtl);
|
||||
const auto& leftSide =
|
||||
shouldToggleDirection ? textOverflow.second : textOverflow.first;
|
||||
const auto& rightSide =
|
||||
|
@ -473,8 +473,7 @@ nsILineIterator* nsBlockFrame::GetLineIterator() {
|
||||
if (!it) return nullptr;
|
||||
|
||||
const nsStyleVisibility* visibility = StyleVisibility();
|
||||
nsresult rv =
|
||||
it->Init(mLines, visibility->mDirection == NS_STYLE_DIRECTION_RTL);
|
||||
nsresult rv = it->Init(mLines, visibility->mDirection == StyleDirection::Rtl);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
return nullptr;
|
||||
@ -2235,14 +2234,14 @@ void nsBlockFrame::MarkLineDirty(LineIterator aLine,
|
||||
* Test whether lines are certain to be aligned left so that we can make
|
||||
* resizing optimizations
|
||||
*/
|
||||
static inline bool IsAlignedLeft(uint8_t aAlignment, uint8_t aDirection,
|
||||
static inline bool IsAlignedLeft(uint8_t aAlignment, StyleDirection aDirection,
|
||||
uint8_t aUnicodeBidi, nsIFrame* aFrame) {
|
||||
return nsSVGUtils::IsInSVGTextSubtree(aFrame) ||
|
||||
NS_STYLE_TEXT_ALIGN_LEFT == aAlignment ||
|
||||
(((NS_STYLE_TEXT_ALIGN_START == aAlignment &&
|
||||
NS_STYLE_DIRECTION_LTR == aDirection) ||
|
||||
StyleDirection::Ltr == aDirection) ||
|
||||
(NS_STYLE_TEXT_ALIGN_END == aAlignment &&
|
||||
NS_STYLE_DIRECTION_RTL == aDirection)) &&
|
||||
StyleDirection::Rtl == aDirection)) &&
|
||||
!(NS_STYLE_UNICODE_BIDI_PLAINTEXT & aUnicodeBidi));
|
||||
}
|
||||
|
||||
|
@ -1332,7 +1332,7 @@ void nsFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
|
||||
// does not contain any characters that would activate the Unicode
|
||||
// bidi algorithm, we need to call |SetBidiEnabled| on the pres
|
||||
// context before reflow starts. See bug 115921.
|
||||
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
PresContext()->SetBidiEnabled();
|
||||
}
|
||||
|
||||
@ -5371,8 +5371,7 @@ static nsIFrame::ContentOffsets OffsetsForSingleFrame(nsIFrame* aFrame,
|
||||
nsRect rect(nsPoint(0, 0), aFrame->GetSize());
|
||||
|
||||
bool isBlock = !aFrame->StyleDisplay()->IsInlineFlow();
|
||||
bool isRtl =
|
||||
(aFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL);
|
||||
bool isRtl = (aFrame->StyleVisibility()->mDirection == StyleDirection::Rtl);
|
||||
if ((isBlock && rect.y < aPoint.y) ||
|
||||
(!isBlock && ((isRtl && rect.x + rect.width / 2 > aPoint.x) ||
|
||||
(!isRtl && rect.x + rect.width / 2 < aPoint.x)))) {
|
||||
@ -8067,9 +8066,9 @@ nsresult nsFrame::GetPointFromOffset(int32_t inOffset, nsPoint* outPoint) {
|
||||
// property.
|
||||
bool hasBidiData;
|
||||
FrameBidiData bidiData = GetProperty(BidiDataProperty(), &hasBidiData);
|
||||
bool isRTL =
|
||||
hasBidiData ? IS_LEVEL_RTL(bidiData.embeddingLevel)
|
||||
: StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = hasBidiData
|
||||
? IS_LEVEL_RTL(bidiData.embeddingLevel)
|
||||
: StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
if ((!isRTL && inOffset > newOffset) ||
|
||||
(isRTL && inOffset <= newOffset)) {
|
||||
pt = contentRect.TopRight();
|
||||
|
@ -6439,7 +6439,7 @@ nsRect ScrollFrameHelper::GetScrolledRect() const {
|
||||
snappedScrolledAreaBottom - snappedScrollPortBottom;
|
||||
result.SetBottomEdge(scrollPort.height + maximumScrollOffsetY);
|
||||
|
||||
if (GetScrolledFrameDir() == NS_STYLE_DIRECTION_LTR) {
|
||||
if (GetScrolledFrameDir() == StyleDirection::Ltr) {
|
||||
nscoord snappedScrolledAreaRight =
|
||||
SnapCoord(scrolledRect.XMost(), scale.width, appUnitsPerDevPixel);
|
||||
nscoord snappedScrollPortRight =
|
||||
@ -6464,20 +6464,18 @@ nsRect ScrollFrameHelper::GetScrolledRect() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
uint8_t ScrollFrameHelper::GetScrolledFrameDir() const {
|
||||
StyleDirection ScrollFrameHelper::GetScrolledFrameDir() const {
|
||||
// If the scrolled frame has unicode-bidi: plaintext, the paragraph
|
||||
// direction set by the text content overrides the direction of the frame
|
||||
if (mScrolledFrame->StyleTextReset()->mUnicodeBidi &
|
||||
NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
nsIFrame* childFrame = mScrolledFrame->PrincipalChildList().FirstChild();
|
||||
if (childFrame) {
|
||||
return (nsBidiPresUtils::ParagraphDirection(childFrame) == NSBIDI_LTR)
|
||||
? NS_STYLE_DIRECTION_LTR
|
||||
: NS_STYLE_DIRECTION_RTL;
|
||||
if (nsIFrame* child = mScrolledFrame->PrincipalChildList().FirstChild()) {
|
||||
return nsBidiPresUtils::ParagraphDirection(child) == NSBIDI_LTR
|
||||
? StyleDirection::Ltr
|
||||
: StyleDirection::Rtl;
|
||||
}
|
||||
}
|
||||
|
||||
return IsBidiLTR() ? NS_STYLE_DIRECTION_LTR : NS_STYLE_DIRECTION_RTL;
|
||||
return IsBidiLTR() ? StyleDirection::Ltr : StyleDirection::Rtl;
|
||||
}
|
||||
|
||||
nsRect ScrollFrameHelper::GetUnsnappedScrolledRectInternal(
|
||||
|
@ -725,7 +725,7 @@ class ScrollFrameHelper : public nsIReflowCallback {
|
||||
bool HasPluginFrames();
|
||||
bool HasPerspective() const { return mOuter->ChildrenHavePerspective(); }
|
||||
bool HasBgAttachmentLocal() const;
|
||||
uint8_t GetScrolledFrameDir() const;
|
||||
mozilla::StyleDirection GetScrolledFrameDir() const;
|
||||
|
||||
bool IsForTextControlWithNoScrollbars() const;
|
||||
|
||||
|
@ -398,8 +398,9 @@ nsMathMLContainerFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
aDesiredStretchSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
|
||||
|
||||
nscoord dx = (StyleVisibility()->mDirection ? coreData.trailingSpace
|
||||
: coreData.leadingSpace);
|
||||
nscoord dx = StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? coreData.trailingSpace
|
||||
: coreData.leadingSpace;
|
||||
if (dx != 0) {
|
||||
mBoundingMetrics.leftBearing += dx;
|
||||
mBoundingMetrics.rightBearing += dx;
|
||||
@ -1114,7 +1115,8 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
mChildFrameType(eMathMLFrameType_UNKNOWN),
|
||||
mCarrySpace(0),
|
||||
mFromFrameType(eMathMLFrameType_UNKNOWN),
|
||||
mRTL(aParentFrame->StyleVisibility()->mDirection) {
|
||||
mRTL(aParentFrame->StyleVisibility()->mDirection ==
|
||||
StyleDirection::Rtl) {
|
||||
if (!mRTL) {
|
||||
mChildFrame = aParentFrame->mFrames.FirstChild();
|
||||
} else {
|
||||
|
@ -139,9 +139,9 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
// helper function to apply mirroring to a horizontal coordinate, if needed.
|
||||
nscoord MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth,
|
||||
nscoord aChildLeading) {
|
||||
return (StyleVisibility()->mDirection
|
||||
? aParentWidth - aChildWidth - aChildLeading
|
||||
: aChildLeading);
|
||||
return StyleVisibility()->mDirection == mozilla::StyleDirection::Rtl
|
||||
? aParentWidth - aChildWidth - aChildLeading
|
||||
: aChildLeading;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -222,7 +222,10 @@ void nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
nsRect rect;
|
||||
mMathMLChar[mRadicalCharIndex].GetRect(rect);
|
||||
rect.MoveBy(StyleVisibility()->mDirection ? -mContentWidth : rect.width, 0);
|
||||
rect.MoveBy(StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? -mContentWidth
|
||||
: rect.width,
|
||||
0);
|
||||
rect.SizeTo(mContentWidth, mRadicalRuleThickness);
|
||||
DisplayBar(aBuilder, this, rect, aLists, NOTATION_RADICAL);
|
||||
}
|
||||
@ -505,7 +508,9 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
///////////////
|
||||
// radical notation:
|
||||
if (IsToDraw(NOTATION_RADICAL)) {
|
||||
nscoord* dx_leading = StyleVisibility()->mDirection ? &dx_right : &dx_left;
|
||||
nscoord* dx_leading = StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? &dx_right
|
||||
: &dx_left;
|
||||
|
||||
if (aWidthOnly) {
|
||||
nscoord radical_width = mMathMLChar[mRadicalCharIndex].GetMaxWidth(
|
||||
@ -524,7 +529,7 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
mMathMLChar[mRadicalCharIndex].Stretch(
|
||||
this, aDrawTarget, fontSizeInflation, NS_STRETCH_DIRECTION_VERTICAL,
|
||||
contSize, bmRadicalChar, NS_STRETCH_LARGER,
|
||||
StyleVisibility()->mDirection);
|
||||
StyleVisibility()->mDirection == StyleDirection::Rtl);
|
||||
mMathMLChar[mRadicalCharIndex].GetBoundingMetrics(bmRadicalChar);
|
||||
|
||||
// Update horizontal parameters
|
||||
@ -641,9 +646,9 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
bmLongdivChar.ascent + bmLongdivChar.descent));
|
||||
|
||||
if (IsToDraw(NOTATION_RADICAL)) {
|
||||
nscoord dx =
|
||||
(StyleVisibility()->mDirection ? dx_left + bmBase.width
|
||||
: dx_left - bmRadicalChar.width);
|
||||
nscoord dx = (StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? dx_left + bmBase.width
|
||||
: dx_left - bmRadicalChar.width);
|
||||
|
||||
mMathMLChar[mRadicalCharIndex].SetRect(nsRect(
|
||||
dx, aDesiredSize.BlockStartAscent() - radicalAscent,
|
||||
|
@ -308,7 +308,7 @@ void nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
GetPreferredStretchSize(drawTarget, STRETCH_CONSIDER_EMBELLISHMENTS,
|
||||
stretchDir, containerSize);
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
|
||||
// To achieve a minimum size of "1", the container should be enlarged by the
|
||||
// unstretched metrics of the fences and separators.
|
||||
|
@ -161,7 +161,7 @@ void nsMathMLmfracFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
/////////////
|
||||
// paint the fraction line
|
||||
if (mIsBevelled) {
|
||||
DisplaySlash(aBuilder, this, mLineRect, mLineThickness, aLists);
|
||||
DisplaySlash(aBuilder, mLineRect, mLineThickness, aLists);
|
||||
} else {
|
||||
DisplayBar(aBuilder, this, mLineRect, aLists);
|
||||
}
|
||||
@ -276,12 +276,11 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
nscoord leftSpace = onePixel;
|
||||
nscoord rightSpace = onePixel;
|
||||
if (outermostEmbellished) {
|
||||
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nsEmbellishData coreData;
|
||||
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
|
||||
leftSpace += StyleVisibility()->mDirection ? coreData.trailingSpace
|
||||
: coreData.leadingSpace;
|
||||
rightSpace += StyleVisibility()->mDirection ? coreData.leadingSpace
|
||||
: coreData.trailingSpace;
|
||||
leftSpace += isRTL ? coreData.trailingSpace : coreData.leadingSpace;
|
||||
rightSpace += isRTL ? coreData.leadingSpace : coreData.trailingSpace;
|
||||
}
|
||||
|
||||
nscoord actualRuleThickness = mLineThickness;
|
||||
@ -550,7 +549,7 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
}
|
||||
|
||||
// Set horizontal bounding metrics
|
||||
if (StyleVisibility()->mDirection) {
|
||||
if (StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
mBoundingMetrics.leftBearing = trailingSpace + bmDen.leftBearing;
|
||||
mBoundingMetrics.rightBearing =
|
||||
trailingSpace + bmDen.width + mLineRect.width + bmNum.rightBearing;
|
||||
@ -605,11 +604,10 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
class nsDisplayMathMLSlash : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aRect, nscoord aThickness, bool aRTL)
|
||||
const nsRect& aRect, nscoord aThickness)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame),
|
||||
mRect(aRect),
|
||||
mThickness(aThickness),
|
||||
mRTL(aRTL) {
|
||||
mThickness(aThickness) {
|
||||
MOZ_COUNT_CTOR(nsDisplayMathMLSlash);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
@ -622,7 +620,6 @@ class nsDisplayMathMLSlash : public nsPaintedDisplayItem {
|
||||
private:
|
||||
nsRect mRect;
|
||||
nscoord mThickness;
|
||||
bool mRTL;
|
||||
};
|
||||
|
||||
void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
||||
@ -640,7 +637,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
||||
// draw the slash as a parallelogram
|
||||
Point delta = Point(presContext->AppUnitsToGfxUnits(mThickness), 0);
|
||||
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder();
|
||||
if (mRTL) {
|
||||
if (mFrame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
builder->MoveTo(rect.TopLeft());
|
||||
builder->LineTo(rect.TopLeft() + delta);
|
||||
builder->LineTo(rect.BottomRight());
|
||||
@ -656,11 +653,12 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
void nsMathMLmfracFrame::DisplaySlash(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, const nsRect& aRect,
|
||||
nscoord aThickness,
|
||||
const nsRect& aRect, nscoord aThickness,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!aFrame->StyleVisibility()->IsVisible() || aRect.IsEmpty()) return;
|
||||
if (!StyleVisibility()->IsVisible() || aRect.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
aLists.Content()->AppendNewToTop<nsDisplayMathMLSlash>(
|
||||
aBuilder, aFrame, aRect, aThickness, StyleVisibility()->mDirection);
|
||||
aLists.Content()->AppendNewToTop<nsDisplayMathMLSlash>(aBuilder, this, aRect,
|
||||
aThickness);
|
||||
}
|
||||
|
@ -104,9 +104,8 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
|
||||
ReflowOutput& aDesiredSize, bool aWidthOnly);
|
||||
|
||||
// Display a slash
|
||||
void DisplaySlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aRect, nscoord aThickness,
|
||||
const nsDisplayListSet& aLists);
|
||||
void DisplaySlash(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
nscoord aThickness, const nsDisplayListSet& aLists);
|
||||
|
||||
nsRect mLineRect;
|
||||
nsMathMLChar* mSlashChar;
|
||||
|
@ -719,7 +719,8 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
// let the MathMLChar stretch itself...
|
||||
nsresult res = mMathMLChar.Stretch(
|
||||
this, aDrawTarget, fontSizeInflation, aStretchDirection, container,
|
||||
charSize, stretchHint, StyleVisibility()->mDirection);
|
||||
charSize, stretchHint,
|
||||
StyleVisibility()->mDirection == StyleDirection::Rtl);
|
||||
if (NS_FAILED(res)) {
|
||||
// gracefully handle cases where stretching the char failed (i.e.,
|
||||
// GetBoundingMetrics failed) clear our 'form' to behave as if the
|
||||
@ -844,7 +845,9 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
aDesiredStretchSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
|
||||
|
||||
nscoord dx = (StyleVisibility()->mDirection ? trailingSpace : leadingSpace);
|
||||
nscoord dx = StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? trailingSpace
|
||||
: leadingSpace;
|
||||
if (dx) {
|
||||
// adjust the offsets
|
||||
mBoundingMetrics.leftBearing += dx;
|
||||
@ -946,7 +949,8 @@ nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
rv = mMathMLChar.Stretch(
|
||||
this, aDrawTarget, nsLayoutUtils::FontSizeInflationFor(this),
|
||||
NS_STRETCH_DIRECTION_VERTICAL, aDesiredSize.mBoundingMetrics,
|
||||
newMetrics, NS_STRETCH_LARGEOP, StyleVisibility()->mDirection);
|
||||
newMetrics, NS_STRETCH_LARGEOP,
|
||||
StyleVisibility()->mDirection == StyleDirection::Rtl);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Just use the initial size
|
||||
@ -1011,7 +1015,7 @@ void nsMathMLmoFrame::GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
|
||||
// leadingSpace and trailingSpace are actually applied to the outermost
|
||||
// embellished container but for determining total intrinsic width it should
|
||||
// be safe to include it for the core here instead.
|
||||
bool isRTL = StyleVisibility()->mDirection;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
aDesiredSize.Width() +=
|
||||
mEmbellishData.leadingSpace + mEmbellishData.trailingSpace;
|
||||
aDesiredSize.mBoundingMetrics.width = aDesiredSize.Width();
|
||||
|
@ -397,23 +397,21 @@ nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
// there are attributes, tweak our metrics and move children to achieve the
|
||||
// desired visual effects.
|
||||
|
||||
if ((StyleVisibility()->mDirection ? mWidthSign : mLeadingSpaceSign) !=
|
||||
NS_MATHML_SIGN_INVALID) {
|
||||
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
if ((isRTL ? mWidthSign : mLeadingSpaceSign) != NS_MATHML_SIGN_INVALID) {
|
||||
// there was padding on the left. dismiss the left italic correction now
|
||||
// (so that our parent won't correct us)
|
||||
mBoundingMetrics.leftBearing = 0;
|
||||
}
|
||||
|
||||
if ((StyleVisibility()->mDirection ? mLeadingSpaceSign : mWidthSign) !=
|
||||
NS_MATHML_SIGN_INVALID) {
|
||||
if ((isRTL ? mLeadingSpaceSign : mWidthSign) != NS_MATHML_SIGN_INVALID) {
|
||||
// there was padding on the right. dismiss the right italic correction now
|
||||
// (so that our parent won't correct us)
|
||||
mBoundingMetrics.width = width;
|
||||
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
|
||||
}
|
||||
|
||||
nscoord dx =
|
||||
(StyleVisibility()->mDirection ? width - initialWidth - lspace : lspace);
|
||||
nscoord dx = (isRTL ? width - initialWidth - lspace : lspace);
|
||||
|
||||
aDesiredSize.SetBlockStartAscent(height);
|
||||
aDesiredSize.Width() = mBoundingMetrics.width;
|
||||
|
@ -243,7 +243,8 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsBoundingMetrics radicalSize;
|
||||
mSqrChar.Stretch(this, drawTarget, fontSizeInflation,
|
||||
NS_STRETCH_DIRECTION_VERTICAL, contSize, radicalSize,
|
||||
NS_STRETCH_LARGER, StyleVisibility()->mDirection);
|
||||
NS_STRETCH_LARGER,
|
||||
StyleVisibility()->mDirection == StyleDirection::Rtl);
|
||||
// radicalSize have changed at this point, and should match with
|
||||
// the bounding metrics of the char
|
||||
mSqrChar.GetBoundingMetrics(bmSqr);
|
||||
|
@ -117,7 +117,7 @@ struct InlineBackgroundData {
|
||||
// of frames that are to the left (if this is an LTR block) or right
|
||||
// (if it's RTL) of the current one.
|
||||
bool isRtlBlock = (mLineContainer->StyleVisibility()->mDirection ==
|
||||
NS_STYLE_DIRECTION_RTL);
|
||||
StyleDirection::Rtl);
|
||||
nscoord curOffset = mVertical ? aFrame->GetOffsetTo(mLineContainer).y
|
||||
: aFrame->GetOffsetTo(mLineContainer).x;
|
||||
|
||||
|
@ -96,6 +96,7 @@ rusty-enums = [
|
||||
"mozilla::StyleClear",
|
||||
"mozilla::StyleColumnFill",
|
||||
"mozilla::StyleColumnSpan",
|
||||
"mozilla::StyleDirection",
|
||||
"mozilla::StyleFloat",
|
||||
"mozilla::StyleImageOrientation",
|
||||
"mozilla::StyleUserModify",
|
||||
|
@ -334,8 +334,7 @@ enum class StyleBorderCollapse : uint8_t { Collapse, Separate };
|
||||
enum class StyleBorderImageRepeat : uint8_t { Stretch, Repeat, Round, Space };
|
||||
|
||||
// See nsStyleVisibility
|
||||
#define NS_STYLE_DIRECTION_LTR 0
|
||||
#define NS_STYLE_DIRECTION_RTL 1
|
||||
enum class StyleDirection : uint8_t { Ltr, Rtl };
|
||||
|
||||
// See nsStyleVisibility
|
||||
// NOTE: WritingModes.h depends on the particular values used here.
|
||||
|
@ -3127,8 +3127,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(
|
||||
|
||||
nsStyleVisibility::nsStyleVisibility(const Document& aDocument)
|
||||
: mDirection(aDocument.GetBidiOptions() == IBMBIDI_TEXTDIRECTION_RTL
|
||||
? NS_STYLE_DIRECTION_RTL
|
||||
: NS_STYLE_DIRECTION_LTR),
|
||||
? StyleDirection::Rtl
|
||||
: StyleDirection::Ltr),
|
||||
mVisible(StyleVisibility::Visible),
|
||||
mImageRendering(NS_STYLE_IMAGE_RENDERING_AUTO),
|
||||
mWritingMode(NS_STYLE_WRITING_MODE_HORIZONTAL_TB),
|
||||
|
@ -1259,7 +1259,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
|
||||
nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
|
||||
|
||||
mozilla::StyleImageOrientation mImageOrientation;
|
||||
uint8_t mDirection; // NS_STYLE_DIRECTION_*
|
||||
mozilla::StyleDirection mDirection;
|
||||
mozilla::StyleVisibility mVisible;
|
||||
uint8_t mImageRendering; // NS_STYLE_IMAGE_RENDERING_*
|
||||
uint8_t mWritingMode; // NS_STYLE_WRITING_MODE_*
|
||||
|
@ -4778,7 +4778,7 @@ void SVGTextFrame::DoAnchoring() {
|
||||
|
||||
if (left != std::numeric_limits<gfxFloat>::infinity()) {
|
||||
bool isRTL =
|
||||
chunkFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
chunkFrame->StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
TextAnchorSide anchor = ConvertLogicalTextAnchorToPhysical(
|
||||
chunkFrame->StyleSVG()->mTextAnchor, isRTL);
|
||||
|
||||
|
@ -1699,7 +1699,7 @@ void nsTableRowGroupFrame::SetContinuousBCBorderWidth(LogicalSide aForSide,
|
||||
int32_t nsTableRowGroupFrame::GetNumLines() { return GetRowCount(); }
|
||||
|
||||
bool nsTableRowGroupFrame::GetDirection() {
|
||||
return (NS_STYLE_DIRECTION_RTL ==
|
||||
return (StyleDirection::Rtl ==
|
||||
GetTableFrame()->StyleVisibility()->mDirection);
|
||||
}
|
||||
|
||||
@ -1793,7 +1793,7 @@ nsTableRowGroupFrame::FindFrameAt(int32_t aLineNumber, nsPoint aPos,
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(frame, "cellmap is lying");
|
||||
bool isRTL = (NS_STYLE_DIRECTION_RTL == table->StyleVisibility()->mDirection);
|
||||
bool isRTL = (StyleDirection::Rtl == table->StyleVisibility()->mDirection);
|
||||
|
||||
nsIFrame* closestFromStart = nullptr;
|
||||
nsIFrame* closestFromEnd = nullptr;
|
||||
|
@ -307,8 +307,9 @@ void nsBoxFrame::GetInitialDirection(bool& aIsNormal) {
|
||||
// For horizontal boxes only, we initialize our value based off the CSS
|
||||
// 'direction' property. This means that BiDI users will end up with
|
||||
// horizontally inverted chrome.
|
||||
aIsNormal = (StyleVisibility()->mDirection ==
|
||||
NS_STYLE_DIRECTION_LTR); // If text runs RTL then so do we.
|
||||
//
|
||||
// If text runs RTL then so do we.
|
||||
aIsNormal = StyleVisibility()->mDirection == StyleDirection::Ltr;
|
||||
if (GetContent()->IsElement()) {
|
||||
Element* element = GetContent()->AsElement();
|
||||
|
||||
|
@ -521,8 +521,8 @@ class nsMenuPopupFrame final : public nsBoxFrame,
|
||||
return mAnchorContent && mAnchorContent->GetPrimaryFrame()
|
||||
? mAnchorContent->GetPrimaryFrame()
|
||||
->StyleVisibility()
|
||||
->mDirection == NS_STYLE_DIRECTION_RTL
|
||||
: StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
->mDirection == mozilla::StyleDirection::Rtl
|
||||
: StyleVisibility()->mDirection == mozilla::StyleDirection::Rtl;
|
||||
}
|
||||
|
||||
// Create a popup view for this frame. The view is added a child of the root
|
||||
|
@ -423,7 +423,7 @@ void nsSplitterFrameInner::MouseDrag(nsPresContext* aPresContext,
|
||||
bool supportsAfter = SupportsCollapseDirection(After);
|
||||
|
||||
const bool isRTL =
|
||||
mOuter->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
mOuter->StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
bool pastEnd = oldPos > 0 && oldPos > pos;
|
||||
bool pastBegin = oldPos < 0 && oldPos < pos;
|
||||
if (isRTL) {
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "mozilla/Likely.h"
|
||||
#include <algorithm>
|
||||
|
||||
using mozilla::StyleDirection;
|
||||
|
||||
nsBoxLayout* nsSprocketLayout::gInstance = nullptr;
|
||||
|
||||
nsresult NS_NewSprocketLayout(nsCOMPtr<nsBoxLayout>& aNewLayout) {
|
||||
@ -47,7 +49,7 @@ void nsSprocketLayout::GetFrameState(nsIFrame* aBox, nsFrameState& aState) {
|
||||
aState = aBox->GetStateBits();
|
||||
}
|
||||
|
||||
static uint8_t GetFrameDirection(nsIFrame* aBox) {
|
||||
static StyleDirection GetFrameDirection(nsIFrame* aBox) {
|
||||
return aBox->StyleVisibility()->mDirection;
|
||||
}
|
||||
|
||||
@ -58,7 +60,7 @@ static void HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState,
|
||||
// (e.g., |x| will get bigger for a horizontal box, and |y| will get bigger
|
||||
// for a vertical box). In the reverse direction, the opposite is true. We'll
|
||||
// be laying out each child at a smaller |x| or |y|.
|
||||
uint8_t frameDirection = GetFrameDirection(aBox);
|
||||
StyleDirection frameDirection = GetFrameDirection(aBox);
|
||||
|
||||
if (aFrameState & NS_STATE_IS_HORIZONTAL) {
|
||||
if (aFrameState & NS_STATE_IS_DIRECTION_NORMAL) {
|
||||
@ -72,7 +74,7 @@ static void HandleBoxPack(nsIFrame* aBox, const nsFrameState& aFrameState,
|
||||
aY = aClientRect.y;
|
||||
} else {
|
||||
// take direction property into account for |x| in vertical boxes
|
||||
if (frameDirection == NS_STYLE_DIRECTION_LTR) {
|
||||
if (frameDirection == StyleDirection::Ltr) {
|
||||
// The normal direction. |x| increases as we move through our children.
|
||||
aX = aClientRect.x;
|
||||
} else {
|
||||
@ -371,7 +373,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState) {
|
||||
nextY += (childBoxSize->right);
|
||||
else
|
||||
nextY -= (childBoxSize->left);
|
||||
if (GetFrameDirection(aBox) == NS_STYLE_DIRECTION_LTR) {
|
||||
if (GetFrameDirection(aBox) == StyleDirection::Ltr) {
|
||||
childRect.x = originalClientRect.x;
|
||||
} else {
|
||||
// keep the right edge of the box the same
|
||||
@ -497,7 +499,7 @@ nsSprocketLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState) {
|
||||
}
|
||||
|
||||
if (!(frameState & NS_STATE_IS_HORIZONTAL)) {
|
||||
if (GetFrameDirection(aBox) != NS_STYLE_DIRECTION_LTR) {
|
||||
if (GetFrameDirection(aBox) != StyleDirection::Ltr) {
|
||||
// keep the right edge the same
|
||||
newChildRect.x = childRect.XMost() - newChildRect.width;
|
||||
}
|
||||
@ -876,7 +878,7 @@ void nsSprocketLayout::AlignChildren(nsIFrame* aBox, nsBoxLayoutState& aState) {
|
||||
maxAscent = aBox->GetXULBoxAscent(aState);
|
||||
}
|
||||
} else {
|
||||
isLTR = GetFrameDirection(aBox) == NS_STYLE_DIRECTION_LTR;
|
||||
isLTR = GetFrameDirection(aBox) == StyleDirection::Ltr;
|
||||
halign = aBox->GetXULHAlign();
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ uint8_t nsStackLayout::GetOffset(nsIFrame* aChild, nsMargin& aOffset) {
|
||||
uint8_t offsetSpecified = 0;
|
||||
nsIContent* content = aChild->GetContent();
|
||||
if (content && content->IsElement()) {
|
||||
bool ltr = aChild->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
|
||||
bool ltr = aChild->StyleVisibility()->mDirection == StyleDirection::Ltr;
|
||||
nsAutoString value;
|
||||
nsresult error;
|
||||
|
||||
|
@ -592,7 +592,7 @@ nscoord nsTextBoxFrame::CalculateTitleForWidth(gfxContext& aRenderingContext,
|
||||
if (titleWidth <= aWidth) {
|
||||
mCroppedTitle = mTitle;
|
||||
if (HasRTLChars(mTitle) ||
|
||||
StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
AddStateBits(NS_FRAME_IS_BIDI);
|
||||
}
|
||||
return titleWidth; // fits, done.
|
||||
|
@ -121,7 +121,8 @@ enum nsIgnoreKeys {
|
||||
#define NS_DIRECTION_IS_BLOCK_TO_EDGE(dir) \
|
||||
(dir == eNavigationDirection_First || dir == eNavigationDirection_Last)
|
||||
|
||||
static_assert(NS_STYLE_DIRECTION_LTR == 0 && NS_STYLE_DIRECTION_RTL == 1,
|
||||
static_assert(static_cast<uint8_t>(mozilla::StyleDirection::Ltr) == 0 &&
|
||||
static_cast<uint8_t>(mozilla::StyleDirection::Rtl) == 1,
|
||||
"Left to Right should be 0 and Right to Left should be 1");
|
||||
|
||||
/**
|
||||
@ -131,10 +132,10 @@ static_assert(NS_STYLE_DIRECTION_LTR == 0 && NS_STYLE_DIRECTION_RTL == 1,
|
||||
*/
|
||||
extern const nsNavigationDirection DirectionFromKeyCodeTable[2][6];
|
||||
|
||||
#define NS_DIRECTION_FROM_KEY_CODE(frame, keycode) \
|
||||
(DirectionFromKeyCodeTable[frame->StyleVisibility()->mDirection] \
|
||||
[keycode - \
|
||||
mozilla::dom::KeyboardEvent_Binding::DOM_VK_END])
|
||||
#define NS_DIRECTION_FROM_KEY_CODE(frame, keycode) \
|
||||
(DirectionFromKeyCodeTable[static_cast<uint8_t>( \
|
||||
(frame)->StyleVisibility()->mDirection)][( \
|
||||
keycode)-mozilla::dom::KeyboardEvent_Binding::DOM_VK_END])
|
||||
|
||||
// nsMenuChainItem holds info about an open popup. Items are stored in a
|
||||
// doubly linked list. Note that the linked list is stored beginning from
|
||||
|
@ -914,7 +914,7 @@ nsresult nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nscoord currX = mInnerBox.x - mHorzPosition;
|
||||
|
||||
// The Rect for the requested item.
|
||||
@ -1309,7 +1309,7 @@ nsCSSAnonBoxPseudoStaticAtom* nsTreeBodyFrame::GetItemWithinCellAt(
|
||||
nscoord remainingWidth = cellRect.width;
|
||||
|
||||
// Handle right alignment hit testing.
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
RefPtr<gfxContext> rc =
|
||||
@ -2949,7 +2949,7 @@ ImgDrawResult nsTreeBodyFrame::PaintCell(
|
||||
ComputedStyle* cellContext =
|
||||
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
|
||||
// Obtain the margins for the cell and then deflate our rect by that
|
||||
// amount. The cell is assumed to be contained within the deflated rect.
|
||||
@ -2970,8 +2970,8 @@ ImgDrawResult nsTreeBodyFrame::PaintCell(
|
||||
|
||||
// Now we paint the contents of the cells.
|
||||
// Directionality of the tree determines the order in which we paint.
|
||||
// NS_STYLE_DIRECTION_LTR means paint from left to right.
|
||||
// NS_STYLE_DIRECTION_RTL means paint from right to left.
|
||||
// StyleDirection::Ltr means paint from left to right.
|
||||
// StyleDirection::Rtl means paint from right to left.
|
||||
|
||||
if (aColumn->IsPrimary()) {
|
||||
// If we're the primary column, we need to indent and paint the twisty and
|
||||
@ -3117,7 +3117,7 @@ ImgDrawResult nsTreeBodyFrame::PaintTwisty(
|
||||
const nsRect& aDirtyRect, nscoord& aRemainingWidth, nscoord& aCurrX) {
|
||||
MOZ_ASSERT(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nscoord rightEdge = aCurrX + aRemainingWidth;
|
||||
// Paint the twisty, but only if we are a non-empty container.
|
||||
bool shouldPaint = false;
|
||||
@ -3214,7 +3214,7 @@ ImgDrawResult nsTreeBodyFrame::PaintImage(
|
||||
nsDisplayListBuilder* aBuilder) {
|
||||
MOZ_ASSERT(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nscoord rightEdge = aCurrX + aRemainingWidth;
|
||||
// Resolve style for the image.
|
||||
ComputedStyle* imageContext =
|
||||
@ -3384,7 +3384,7 @@ ImgDrawResult nsTreeBodyFrame::PaintText(
|
||||
const nsRect& aDirtyRect, nscoord& aCurrX) {
|
||||
MOZ_ASSERT(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
|
||||
// Now obtain the text for our cell.
|
||||
nsAutoString text;
|
||||
@ -3526,13 +3526,16 @@ ImgDrawResult nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
|
||||
|
||||
nsRect imageSize = GetImageSize(aRowIndex, aColumn, true, checkboxContext);
|
||||
|
||||
if (imageSize.height > checkboxRect.height)
|
||||
if (imageSize.height > checkboxRect.height) {
|
||||
imageSize.height = checkboxRect.height;
|
||||
if (imageSize.width > checkboxRect.width)
|
||||
}
|
||||
if (imageSize.width > checkboxRect.width) {
|
||||
imageSize.width = checkboxRect.width;
|
||||
}
|
||||
|
||||
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
|
||||
if (StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
checkboxRect.x = rightEdge - checkboxRect.width;
|
||||
}
|
||||
|
||||
// Paint our borders and background for our image rect.
|
||||
ImgDrawResult result =
|
||||
|
@ -145,7 +145,7 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame,
|
||||
virtual void ScrollbarActivityStarted() const override;
|
||||
virtual void ScrollbarActivityStopped() const override;
|
||||
virtual bool IsScrollbarOnRight() const override {
|
||||
return (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR);
|
||||
return StyleVisibility()->mDirection == mozilla::StyleDirection::Ltr;
|
||||
}
|
||||
virtual bool ShouldSuppressScrollbarRepaints() const override {
|
||||
return false;
|
||||
|
@ -84,7 +84,7 @@ void nsDisplayXULTreeColSplitterTarget::HitTest(
|
||||
}
|
||||
|
||||
// Swap left and right for RTL trees in order to find the correct splitter
|
||||
if (mFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (mFrame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
bool tmp = left;
|
||||
left = right;
|
||||
right = tmp;
|
||||
|
@ -87,8 +87,7 @@ nsresult nsTreeColumn::GetRect(nsTreeBodyFrame* aBodyFrame, nscoord aY,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool isRTL =
|
||||
aBodyFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
bool isRTL = aBodyFrame->StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
*aResult = frame->GetRect();
|
||||
aResult->y = aY;
|
||||
aResult->height = aHeight;
|
||||
@ -150,9 +149,9 @@ void nsTreeColumn::Invalidate(ErrorResult& aRv) {
|
||||
mTextAlignment = textStyle->mTextAlign;
|
||||
// START or END alignment sometimes means RIGHT
|
||||
if ((mTextAlignment == NS_STYLE_TEXT_ALIGN_START &&
|
||||
vis->mDirection == NS_STYLE_DIRECTION_RTL) ||
|
||||
vis->mDirection == StyleDirection::Rtl) ||
|
||||
(mTextAlignment == NS_STYLE_TEXT_ALIGN_END &&
|
||||
vis->mDirection == NS_STYLE_DIRECTION_LTR)) {
|
||||
vis->mDirection == StyleDirection::Ltr)) {
|
||||
mTextAlignment = NS_STYLE_TEXT_ALIGN_RIGHT;
|
||||
} else if (mTextAlignment == NS_STYLE_TEXT_ALIGN_START ||
|
||||
mTextAlignment == NS_STYLE_TEXT_ALIGN_END) {
|
||||
|
@ -563,6 +563,7 @@
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
FromPrimitive,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
@ -762,7 +763,7 @@
|
||||
% endif
|
||||
pub mod computed_value {
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
#[derive(Clone, Copy, Debug, Eq, FromPrimitive, MallocSizeOf, PartialEq, ToCss, ToResolvedValue)]
|
||||
% if not extra_specified:
|
||||
#[derive(Parse, SpecifiedValueInfo, ToComputedValue, ToShmem)]
|
||||
% endif
|
||||
|
@ -43,7 +43,7 @@ ${helpers.single_keyword(
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
animation_value_type="none",
|
||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction",
|
||||
needs_conversion=True,
|
||||
gecko_enum_prefix="StyleDirection",
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
)}
|
||||
|
||||
|
@ -4803,7 +4803,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
||||
|
||||
let prop = match_wrap_declared! { long,
|
||||
MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
|
||||
Direction => longhands::direction::SpecifiedValue::from_gecko_keyword(value),
|
||||
Direction => get_from_computed::<longhands::direction::SpecifiedValue>(value),
|
||||
Display => get_from_computed::<Display>(value),
|
||||
Float => get_from_computed::<Float>(value),
|
||||
Clear => get_from_computed::<Clear>(value),
|
||||
|
Loading…
Reference in New Issue
Block a user