author | Phil Ringnalda <philringnalda@gmail.com> |
Sat, 28 Jun 2014 22:01:28 -0700 | |
changeset 213283 | c8ca361c8feaf6c2a0923c6205c707847ca0e34d |
parent 213282 | 613ac64b87fe14560a7ecd21f501c6f44356f974 |
child 213284 | dcbd6f52128c63d7aa65d8eec929ee123716f0a8 |
push id | unknown |
push user | unknown |
push date | unknown |
bugs | 1028460, 1031444 |
milestone | 33.0a1 |
backs out | 0b5918ec6521c0befa37862a34ff815323e4bb9c 663ff18cd4a1a829e76a14388347cbbdffe0c553 ae01b3919c8c239a36448f731221c6f5a4400fff 316c8dfeca9bc142de679fa383d6874c81028c3d e237b2c61ea2fabbe308b5724041282d1aa09a9c |
--- a/accessible/base/StyleInfo.h +++ b/accessible/base/StyleInfo.h @@ -17,31 +17,31 @@ class StyleInfo { public: StyleInfo(dom::Element* aElement, nsIPresShell* aPresShell); ~StyleInfo() { } void Display(nsAString& aValue); void TextAlign(nsAString& aValue); void TextIndent(nsAString& aValue); - void MarginLeft(nsAString& aValue) { Margin(eSideLeft, aValue); } - void MarginRight(nsAString& aValue) { Margin(eSideRight, aValue); } - void MarginTop(nsAString& aValue) { Margin(eSideTop, aValue); } - void MarginBottom(nsAString& aValue) { Margin(eSideBottom, aValue); } + void MarginLeft(nsAString& aValue) { Margin(css::eSideLeft, aValue); } + void MarginRight(nsAString& aValue) { Margin(css::eSideRight, aValue); } + void MarginTop(nsAString& aValue) { Margin(css::eSideTop, aValue); } + void MarginBottom(nsAString& aValue) { Margin(css::eSideBottom, aValue); } static void FormatColor(const nscolor& aValue, nsString& aFormattedValue); static void FormatFontStyle(const nscoord& aValue, nsAString& aFormattedValue); static void FormatTextDecorationStyle(uint8_t aValue, nsAString& aFormattedValue); private: StyleInfo() MOZ_DELETE; StyleInfo(const StyleInfo&) MOZ_DELETE; StyleInfo& operator = (const StyleInfo&) MOZ_DELETE; - void Margin(Side aSide, nsAString& aValue); + void Margin(css::Side aSide, nsAString& aValue); dom::Element* mElement; nsRefPtr<nsStyleContext> mStyleContext; }; } // namespace a11y } // namespace mozilla
--- a/gfx/2d/BaseMargin.h +++ b/gfx/2d/BaseMargin.h @@ -4,76 +4,25 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZILLA_GFX_BASEMARGIN_H_ #define MOZILLA_GFX_BASEMARGIN_H_ #include "Types.h" namespace mozilla { - -/** - * Sides represents a set of physical sides. - */ -struct Sides MOZ_FINAL { - Sides() : mBits(0) {} - explicit Sides(SideBits aSideBits) - { - MOZ_ASSERT((aSideBits & ~eSideBitsAll) == 0, "illegal side bits"); - mBits = aSideBits; - } - bool IsEmpty() const { return mBits == 0; } - bool Top() const { return mBits & eSideBitsTop; } - bool Right() const { return mBits & eSideBitsRight; } - bool Bottom() const { return mBits & eSideBitsBottom; } - bool Left() const { return mBits & eSideBitsLeft; } - bool Contains(SideBits aSideBits) const - { - MOZ_ASSERT((aSideBits & ~eSideBitsAll) == 0, "illegal side bits"); - return (mBits & aSideBits) == aSideBits; - } - Sides operator|(Sides aOther) const - { - return Sides(SideBits(mBits | aOther.mBits)); - } - Sides operator|(SideBits aSideBits) const - { - return *this | Sides(aSideBits); - } - Sides& operator|=(Sides aOther) - { - mBits |= aOther.mBits; - return *this; - } - Sides& operator|=(SideBits aSideBits) - { - return *this |= Sides(aSideBits); - } - bool operator==(Sides aOther) const - { - return mBits == aOther.mBits; - } - bool operator!=(Sides aOther) const - { - return !(*this == aOther); - } - -private: - uint8_t mBits; -}; - namespace gfx { /** * Do not use this class directly. Subclass it, pass that subclass as the * Sub parameter, and only use that subclass. */ template <class T, class Sub> struct BaseMargin { - typedef mozilla::Side SideT; // because we have a method named Side + typedef mozilla::css::Side SideT; // Do not change the layout of these members; the Side() methods below // depend on this order. T top, right, bottom, left; // Constructors BaseMargin() : top(0), right(0), bottom(0), left(0) {} BaseMargin(T aTop, T aRight, T aBottom, T aLeft) : @@ -91,28 +40,28 @@ struct BaseMargin { // This is ugly! return *(&top + T(aSide)); } T Side(SideT aSide) const { // This is ugly! return *(&top + T(aSide)); } - void ApplySkipSides(Sides aSkipSides) + void ApplySkipSides(int aSkipSides) { - if (aSkipSides.Top()) { + if (aSkipSides & (1 << mozilla::css::eSideTop)) { top = 0; } - if (aSkipSides.Right()) { + if (aSkipSides & (1 << mozilla::css::eSideRight)) { right = 0; } - if (aSkipSides.Bottom()) { + if (aSkipSides & (1 << mozilla::css::eSideBottom)) { bottom = 0; } - if (aSkipSides.Left()) { + if (aSkipSides & (1 << mozilla::css::eSideLeft)) { left = 0; } } // Overloaded operators. Note that '=' isn't defined so we'll get the // compiler generated default assignment operator bool operator==(const Sub& aMargin) const { return top == aMargin.top && right == aMargin.right &&
--- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -259,30 +259,22 @@ struct GradientStop #define GFX2D_API __declspec(dllexport) #else #define GFX2D_API __declspec(dllimport) #endif #else #define GFX2D_API #endif +// Side constants for use in various places namespace mozilla { -// Side constants for use in various places. -enum Side { eSideTop, eSideRight, eSideBottom, eSideLeft }; + namespace css { + enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft}; + } +} -enum SideBits { - eSideBitsNone = 0, - eSideBitsTop = 1 << eSideTop, - eSideBitsRight = 1 << eSideRight, - eSideBitsBottom = 1 << eSideBottom, - eSideBitsLeft = 1 << eSideLeft, - eSideBitsTopBottom = eSideBitsTop | eSideBitsBottom, - eSideBitsLeftRight = eSideBitsLeft | eSideBitsRight, - eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight -}; -} // namespace mozilla - -#define NS_SIDE_TOP mozilla::eSideTop -#define NS_SIDE_RIGHT mozilla::eSideRight -#define NS_SIDE_BOTTOM mozilla::eSideBottom -#define NS_SIDE_LEFT mozilla::eSideLeft +// XXX - These don't really belong here. But for now this is where they go. +#define NS_SIDE_TOP mozilla::css::eSideTop +#define NS_SIDE_RIGHT mozilla::css::eSideRight +#define NS_SIDE_BOTTOM mozilla::css::eSideBottom +#define NS_SIDE_LEFT mozilla::css::eSideLeft #endif /* MOZILLA_GFX_TYPES_H_ */
--- a/gfx/thebes/gfxRect.h +++ b/gfx/thebes/gfxRect.h @@ -82,27 +82,27 @@ struct gfxRect : case NS_CORNER_BOTTOM_LEFT: return BottomLeft(); default: NS_ERROR("Invalid corner!"); break; } return gfxPoint(0.0, 0.0); } - gfxPoint CCWCorner(mozilla::Side side) const { + gfxPoint CCWCorner(mozilla::css::Side side) const { switch (side) { case NS_SIDE_TOP: return TopLeft(); case NS_SIDE_RIGHT: return TopRight(); case NS_SIDE_BOTTOM: return BottomRight(); case NS_SIDE_LEFT: return BottomLeft(); } MOZ_CRASH("Incomplete switch"); } - gfxPoint CWCorner(mozilla::Side side) const { + gfxPoint CWCorner(mozilla::css::Side side) const { switch (side) { case NS_SIDE_TOP: return TopRight(); case NS_SIDE_RIGHT: return BottomRight(); case NS_SIDE_BOTTOM: return BottomLeft(); case NS_SIDE_LEFT: return TopLeft(); } MOZ_CRASH("Incomplete switch"); }
--- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -298,17 +298,17 @@ protected: NS_ASSERTION(mBlockFrame, "Cannot find containing block."); } // Start with the previous flow frame as our continuation point // is the total of the widths of the previous frames. nsIFrame* inlineFrame = GetPrevContinuation(aFrame); while (inlineFrame) { if (!mLeftBorderData.mFrame && - !inlineFrame->GetSkipSides().Left()) { + !(inlineFrame->GetSkipSides() & SIDE_BIT_LEFT)) { mLeftBorderData.mFrame = inlineFrame; } nsRect rect = inlineFrame->GetRect(); mContinuationPoint += rect.width; if (mBidiEnabled && !AreOnSameLine(aFrame, inlineFrame)) { mLineContinuationPoint += rect.width; } mUnbrokenWidth += rect.width; @@ -316,17 +316,17 @@ protected: inlineFrame = GetPrevContinuation(inlineFrame); } // Next add this frame and subsequent frames to the bounding box and // unbroken width. inlineFrame = aFrame; while (inlineFrame) { if (!mLeftBorderData.mFrame && - !inlineFrame->GetSkipSides().Left()) { + !(inlineFrame->GetSkipSides() & SIDE_BIT_LEFT)) { mLeftBorderData.mFrame = inlineFrame; } nsRect rect = inlineFrame->GetRect(); mUnbrokenWidth += rect.width; mBoundingBox.UnionRect(mBoundingBox, rect); inlineFrame = GetNextContinuation(inlineFrame); } @@ -357,17 +357,17 @@ struct ColorStop { /* Local functions */ static void DrawBorderImage(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aBorderArea, const nsStyleBorder& aStyleBorder, const nsRect& aDirtyRect, - Sides aSkipSides); + int aSkipSides); static nscolor MakeBevelColor(mozilla::css::Side whichSide, uint8_t style, nscolor aBackgroundColor, nscolor aBorderColor); static InlineBackgroundData* gInlineBGData = nullptr; // Initialize any static variables used by nsCSSRendering. @@ -434,20 +434,20 @@ GetRadii(nsIFrame* aForFrame, const nsSt gfxCornerSizes* aBgRadii) { nscoord radii[8]; bool haveRoundedCorners; nsSize sz = aBorderArea.Size(); nsSize frameSize = aForFrame->GetSize(); if (&aBorder == aForFrame->StyleBorder() && frameSize == aOrigBorderArea.Size()) { - haveRoundedCorners = aForFrame->GetBorderRadii(sz, sz, Sides(), radii); + haveRoundedCorners = aForFrame->GetBorderRadii(sz, sz, 0, radii); } else { haveRoundedCorners = - nsIFrame::ComputeBorderRadii(aBorder.mBorderRadius, frameSize, sz, Sides(), radii); + nsIFrame::ComputeBorderRadii(aBorder.mBorderRadius, frameSize, sz, 0, radii); } if (haveRoundedCorners) { auto d2a = aForFrame->PresContext()->AppUnitsPerDevPixel(); nsCSSRendering::ComputePixelRadii(radii, d2a, aBgRadii); } return haveRoundedCorners; } @@ -556,17 +556,17 @@ nsCSSRendering::ComputePixelRadii(const void nsCSSRendering::PaintBorder(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aDirtyRect, const nsRect& aBorderArea, nsStyleContext* aStyleContext, - Sides aSkipSides) + int aSkipSides) { PROFILER_LABEL("nsCSSRendering", "PaintBorder", js::ProfileEntry::Category::GRAPHICS); nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited(); const nsStyleBorder *styleBorder = aStyleContext->StyleBorder(); // Don't check RelevantLinkVisited here, since we want to take the // same amount of time whether or not it's true. @@ -601,17 +601,17 @@ nsCSSRendering::PaintBorder(nsPresContex void nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aDirtyRect, const nsRect& aBorderArea, const nsStyleBorder& aStyleBorder, nsStyleContext* aStyleContext, - Sides aSkipSides) + int aSkipSides) { SN("++ PaintBorder"); // Check to see if we have an appearance defined. If so, we let the theme // renderer draw the border. DO not get the data from aForFrame, since the passed in style context // may be different! Always use |aStyleContext|! const nsStyleDisplay* displayData = aStyleContext->StyleDisplay(); if (displayData->mAppearance) { @@ -655,32 +655,32 @@ nsCSSRendering::PaintBorderWithStyleBord SF(" joinedBorderArea: %d %d %d %d\n", joinedBorderArea.x, joinedBorderArea.y, joinedBorderArea.width, joinedBorderArea.height); // start drawing gfxContext* ctx = aRenderingContext.ThebesContext(); ctx->Save(); if (::IsBoxDecorationSlice(aStyleBorder)) { - if (aSkipSides.IsEmpty()) { + if (aSkipSides == 0) { // No continuations most likely, or ::first-letter that wants all border- // sides on the first continuation. joinedBorderArea = aBorderArea; } else if (joinedBorderArea.IsEqualEdges(aBorderArea)) { // No need for a clip, just skip the sides we don't want. border.ApplySkipSides(aSkipSides); } else { // We're drawing borders around the joined continuation boxes so we need // to clip that to the slice that we want for this frame. aRenderingContext.IntersectClip(aBorderArea); } } else { MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea), "Should use aBorderArea for box-decoration-break:clone"); - MOZ_ASSERT(aForFrame->GetSkipSides().IsEmpty(), + MOZ_ASSERT(aForFrame->GetSkipSides() == 0, "Should not skip sides for box-decoration-break:clone except " "::first-letter/line continuations or other frame types that " "don't have borders but those shouldn't reach this point."); } // Convert to dev pixels. nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1); gfxRect joinedBorderAreaPx = @@ -796,17 +796,17 @@ nsCSSRendering::PaintOutline(nsPresConte if (innerRect.Contains(aDirtyRect)) return; nsRect outerRect = innerRect; outerRect.Inflate(width, width); // get the radius for our outline nsIFrame::ComputeBorderRadii(ourOutline->mOutlineRadius, aBorderArea.Size(), - outerRect.Size(), Sides(), twipsRadii); + outerRect.Size(), 0, twipsRadii); // Get our conversion values nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1); // get the outer rectangles gfxRect oRect(nsLayoutUtils::RectToGfxRect(outerRect, twipsPerPixel)); // convert the radii @@ -1196,17 +1196,17 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr // the frame does. gfxCornerSizes borderRadii; const nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1); if (hasBorderRadius) { nscoord twipsRadii[8]; NS_ASSERTION(aFrameArea.Size() == aForFrame->VisualBorderRectRelativeToSelf().Size(), "unexpected size"); nsSize sz = frameRect.Size(); - hasBorderRadius = aForFrame->GetBorderRadii(sz, sz, Sides(), twipsRadii); + hasBorderRadius = aForFrame->GetBorderRadii(sz, sz, 0, twipsRadii); if (hasBorderRadius) { ComputePixelRadii(twipsRadii, twipsPerPixel, &borderRadii); } } gfxRect frameGfxRect(nsLayoutUtils::RectToGfxRect(frameRect, twipsPerPixel)); frameGfxRect.Round(); @@ -1225,17 +1225,17 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr aForFrame->GetPaddingRect() - aForFrame->GetPosition() + aFrameArea.TopLeft(); skipGfxRect = nsLayoutUtils::RectToGfxRect(paddingRect, twipsPerPixel); } else if (hasBorderRadius) { skipGfxRect.Deflate(gfxMargin( std::max(borderRadii[C_TL].height, borderRadii[C_TR].height), 0, std::max(borderRadii[C_BL].height, borderRadii[C_BR].height), 0)); } - Sides skipSides = aForFrame->GetSkipSides(); + int skipSides = aForFrame->GetSkipSides(); for (uint32_t i = shadows->Length(); i > 0; --i) { nsCSSShadowItem* shadowItem = shadows->ShadowAt(i - 1); if (shadowItem->mInset) continue; nsRect shadowRect = frameRect; shadowRect.MoveBy(shadowItem->mXOffset, shadowItem->mYOffset); if (!nativeTheme) { @@ -1320,35 +1320,35 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr renderContext->Rectangle(frameGfxRect); } renderContext->SetFillRule(gfxContext::FILL_RULE_EVEN_ODD); renderContext->Clip(); // Clip the shadow so that we only get the part that applies to aForFrame. nsRect fragmentClip = shadowRectPlusBlur; - if (!skipSides.IsEmpty()) { - if (skipSides.Left()) { + if (skipSides) { + if (skipSides & SIDE_BIT_LEFT) { nscoord xmost = fragmentClip.XMost(); fragmentClip.x = aFrameArea.x; fragmentClip.width = xmost - fragmentClip.x; } - if (skipSides.Right()) { + if (skipSides & SIDE_BIT_RIGHT) { nscoord xmost = fragmentClip.XMost(); nscoord overflow = xmost - aFrameArea.XMost(); if (overflow > 0) { fragmentClip.width -= overflow; } } - if (skipSides.Top()) { + if (skipSides & SIDE_BIT_TOP) { nscoord ymost = fragmentClip.YMost(); fragmentClip.y = aFrameArea.y; fragmentClip.height = ymost - fragmentClip.y; } - if (skipSides.Bottom()) { + if (skipSides & SIDE_BIT_BOTTOM) { nscoord ymost = fragmentClip.YMost(); nscoord overflow = ymost - aFrameArea.YMost(); if (overflow > 0) { fragmentClip.height -= overflow; } } } aRenderingContext.IntersectClip(fragmentClip); @@ -1409,17 +1409,17 @@ nsCSSRendering::PaintBoxShadowInner(nsPr nsRect paddingRect = frameRect; nsMargin border = aForFrame->GetUsedBorder(); paddingRect.Deflate(border); // Get any border radius, since box-shadow must also have rounded corners // if the frame does. nscoord twipsRadii[8]; nsSize sz = frameRect.Size(); - bool hasBorderRadius = aForFrame->GetBorderRadii(sz, sz, Sides(), twipsRadii); + bool hasBorderRadius = aForFrame->GetBorderRadii(sz, sz, 0, twipsRadii); const nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1); gfxCornerSizes innerRadii; if (hasBorderRadius) { gfxCornerSizes borderRadii; ComputePixelRadii(twipsRadii, twipsPerPixel, &borderRadii); gfxFloat borderSizes[4] = { @@ -3291,17 +3291,17 @@ nsCSSRendering::AreAllBackgroundImagesDe static void DrawBorderImage(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aBorderArea, const nsStyleBorder& aStyleBorder, const nsRect& aDirtyRect, - Sides aSkipSides) + int aSkipSides) { NS_PRECONDITION(aStyleBorder.IsBorderImageLoaded(), "drawing border image that isn't successfully loaded"); if (aDirtyRect.IsEmpty()) return; nsImageRenderer renderer(aForFrame, &aStyleBorder.mBorderImageSource, 0); @@ -3324,17 +3324,17 @@ DrawBorderImage(nsPresContext* aPr // Determine the border image area, which by default corresponds to the // border box but can be modified by 'border-image-outset'. // Note that 'border-radius' do not apply to 'border-image' borders per // <http://dev.w3.org/csswg/css-backgrounds/#corner-clipping>. nsRect borderImgArea; nsMargin borderWidths(aStyleBorder.GetComputedBorder()); nsMargin imageOutset(aStyleBorder.GetImageOutset()); - if (::IsBoxDecorationSlice(aStyleBorder) && !aSkipSides.IsEmpty()) { + if (::IsBoxDecorationSlice(aStyleBorder) && aSkipSides != 0) { borderImgArea = ::BoxDecorationRectForBorder(aForFrame, aBorderArea, &aStyleBorder); if (borderImgArea.IsEqualEdges(aBorderArea)) { // No need for a clip, just skip the sides we don't want. borderWidths.ApplySkipSides(aSkipSides); imageOutset.ApplySkipSides(aSkipSides); borderImgArea.Inflate(imageOutset); } else {
--- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -274,18 +274,16 @@ struct nsBackgroundLayerState { nsPoint mAnchor; /** * The compositing operation that the image should use */ gfxContext::GraphicsOperator mCompositingOp; }; struct nsCSSRendering { - typedef nsIFrame::Sides Sides; - /** * Initialize any static variables used by nsCSSRendering. */ static void Init(); /** * Clean up any static variables used by nsCSSRendering. */ @@ -305,45 +303,45 @@ struct nsCSSRendering { float aOpacity = 1.0); static void ComputePixelRadii(const nscoord *aAppUnitsRadii, nscoord aAppUnitsPerPixel, gfxCornerSizes *oBorderRadii); /** * Render the border for an element using css rendering rules - * for borders. aSkipSides says which sides to skip - * when rendering, the default is to skip none. + * for borders. aSkipSides is a bitmask of the sides to skip + * when rendering. If 0 then no sides are skipped. */ static void PaintBorder(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aDirtyRect, const nsRect& aBorderArea, nsStyleContext* aStyleContext, - Sides aSkipSides = Sides()); + int aSkipSides = 0); /** * Like PaintBorder, but taking an nsStyleBorder argument instead of - * getting it from aStyleContext. aSkipSides says which sides to skip - * when rendering, the default is to skip none. + * getting it from aStyleContext. */ static void PaintBorderWithStyleBorder(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aDirtyRect, const nsRect& aBorderArea, const nsStyleBorder& aBorderStyle, nsStyleContext* aStyleContext, - Sides aSkipSides = Sides()); + int aSkipSides = 0); /** * Render the outline for an element using css rendering rules - * for borders. + * for borders. aSkipSides is a bitmask of the sides to skip + * when rendering. If 0 then no sides are skipped. */ static void PaintOutline(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, nsIFrame* aForFrame, const nsRect& aDirtyRect, const nsRect& aBorderArea, nsStyleContext* aStyleContext);
--- a/layout/generic/StickyScrollContainer.cpp +++ b/layout/generic/StickyScrollContainer.cpp @@ -10,16 +10,18 @@ */ #include "StickyScrollContainer.h" #include "nsIFrame.h" #include "nsIScrollableFrame.h" #include "nsLayoutUtils.h" #include "RestyleTracker.h" +using namespace mozilla::css; + namespace mozilla { void DestroyStickyScrollContainer(void* aPropertyValue) { delete static_cast<StickyScrollContainer*>(aPropertyValue); } NS_DECLARE_FRAME_PROPERTY(StickyScrollContainerProperty,
--- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -31,94 +31,40 @@ // the writing modes match. // (In some cases, there are internal (private) methods that don't do this; // such methods should only be used by other methods that have already checked // the writing modes.) #define CHECK_WRITING_MODE(param) \ NS_ASSERTION(param == mWritingMode, "writing-mode mismatch") -namespace mozilla { -// Logical side constants for use in various places. -enum LogicalSide { eLogicalSideBStart, eLogicalSideBEnd, - eLogicalSideIStart, eLogicalSideIEnd }; - -enum LogicalSideBits { - eLogicalSideBitsNone = 0, - eLogicalSideBitsBStart = 1 << eLogicalSideBStart, - eLogicalSideBitsBEnd = 1 << eLogicalSideBEnd, - eLogicalSideBitsIEnd = 1 << eLogicalSideIEnd, - eLogicalSideBitsIStart = 1 << eLogicalSideIStart, - eLogicalSideBitsBBoth = eLogicalSideBitsBStart | eLogicalSideBitsBEnd, - eLogicalSideBitsIBoth = eLogicalSideBitsIStart | eLogicalSideBitsIEnd, - eLogicalSideBitsAll = eLogicalSideBitsBBoth | eLogicalSideBitsIBoth -}; - -/** - * LogicalSides represents a set of logical sides. - */ -struct LogicalSides MOZ_FINAL { - LogicalSides() : mBits(0) {} - explicit LogicalSides(LogicalSideBits aSideBits) - { - MOZ_ASSERT((aSideBits & ~eLogicalSideBitsAll) == 0, "illegal side bits"); - mBits = aSideBits; - } - bool IsEmpty() const { return mBits == 0; } - bool BStart() const { return mBits & eLogicalSideBitsBStart; } - bool BEnd() const { return mBits & eLogicalSideBitsBEnd; } - bool IStart() const { return mBits & eLogicalSideBitsIStart; } - bool IEnd() const { return mBits & eLogicalSideBitsIEnd; } - bool Contains(LogicalSideBits aSideBits) const - { - MOZ_ASSERT((aSideBits & ~eLogicalSideBitsAll) == 0, "illegal side bits"); - return (mBits & aSideBits) == aSideBits; - } - LogicalSides operator|(LogicalSides aOther) const - { - return LogicalSides(LogicalSideBits(mBits | aOther.mBits)); - } - LogicalSides operator|(LogicalSideBits aSideBits) const - { - return *this | LogicalSides(aSideBits); - } - LogicalSides& operator|=(LogicalSides aOther) - { - mBits |= aOther.mBits; - return *this; - } - LogicalSides& operator|=(LogicalSideBits aSideBits) - { - return *this |= LogicalSides(aSideBits); - } - bool operator==(LogicalSides aOther) const - { - return mBits == aOther.mBits; - } - bool operator!=(LogicalSides aOther) const - { - return !(*this == aOther); - } - -private: - uint8_t mBits; -}; +#define LOGICAL_SIDE_B_START 1 +#define LOGICAL_SIDE_I_START 2 +#define LOGICAL_SIDE_B_END 4 +#define LOGICAL_SIDE_I_END 8 +#define LOGICAL_SIDES_I_BOTH (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END) +#define LOGICAL_SIDES_B_BOTH (LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) +#define LOGICAL_SIDES_ALL (LOGICAL_SIDE_I_START | LOGICAL_SIDE_I_END | \ + LOGICAL_SIDE_B_START | LOGICAL_SIDE_B_END) /** * mozilla::WritingMode is an immutable class representing a * writing mode. * * It efficiently stores the writing mode and can rapidly compute * interesting things about it for use in layout. * * Writing modes are computed from the CSS 'direction', * 'writing-mode', and 'text-orientation' properties. * See CSS3 Writing Modes for more information * http://www.w3.org/TR/css3-writing-modes/ */ + +namespace mozilla { + class WritingMode { public: /** * Absolute inline flow direction */ enum InlineDir { eInlineLTR = 0x00, // text flows horizontally left to right eInlineRTL = 0x02, // text flows horizontally right to left @@ -891,28 +837,28 @@ public: */ LogicalMargin ConvertTo(WritingMode aToMode, WritingMode aFromMode) const { CHECK_WRITING_MODE(aFromMode); return aToMode == aFromMode ? *this : LogicalMargin(aToMode, GetPhysicalMargin(aFromMode)); } - void ApplySkipSides(LogicalSides aSkipSides) + void ApplySkipSides(int aSkipSides) { - if (aSkipSides.BStart()) { + if (aSkipSides & LOGICAL_SIDE_B_START) { BStart() = 0; } - if (aSkipSides.BEnd()) { + if (aSkipSides & LOGICAL_SIDE_B_END) { BEnd() = 0; } - if (aSkipSides.IStart()) { + if (aSkipSides & LOGICAL_SIDE_I_START) { IStart() = 0; } - if (aSkipSides.IEnd()) { + if (aSkipSides & LOGICAL_SIDE_I_END) { IEnd() = 0; } } bool IsEmpty() const { return (mMargin.left == 0 && mMargin.top == 0 && mMargin.right == 0 && mMargin.bottom == 0);
--- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1033,17 +1033,17 @@ nsBlockFrame::Reflow(nsPresContext* consumedBSize); Maybe<nsHTMLReflowState> mutableReflowState; // If we have non-auto block size, we're clipping our kids and we fit, // make sure our kids fit too. if (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE && aReflowState.ComputedBSize() != NS_AUTOHEIGHT && ShouldApplyOverflowClipping(this, aReflowState.mStyleDisplay)) { LogicalMargin blockDirExtras = aReflowState.ComputedLogicalBorderPadding(); - if (GetLogicalSkipSides().BStart()) { + if (GetLogicalSkipSides() & (LOGICAL_SIDE_B_START)) { blockDirExtras.BStart(wm) = 0; } else { // Bottom margin never causes us to create continuations, so we // don't need to worry about whether it fits in its entirety. blockDirExtras.BStart(wm) += aReflowState.ComputedLogicalMargin().BStart(wm); }
--- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -43,29 +43,28 @@ nsBlockReflowState::nsBlockReflowState(c mFlags(0), mFloatBreakType(NS_STYLE_CLEAR_NONE), mConsumedBSize(aConsumedBSize) { WritingMode wm = aReflowState.GetWritingMode(); SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nullptr); SetFlag(BRS_ISOVERFLOWCONTAINER, IS_TRUE_OVERFLOW_CONTAINER(aFrame)); - nsIFrame::LogicalSides logicalSkipSides = - aFrame->GetLogicalSkipSides(&aReflowState); + int logicalSkipSides = aFrame->GetLogicalSkipSides(&aReflowState); mBorderPadding.ApplySkipSides(logicalSkipSides); // Note that mContainerWidth is the physical width! mContainerWidth = aReflowState.ComputedWidth() + mBorderPadding.LeftRight(wm); - if ((aBStartMarginRoot && !logicalSkipSides.BStart()) || + if ((aBStartMarginRoot && !(logicalSkipSides & LOGICAL_SIDE_B_START)) || 0 != mBorderPadding.BStart(wm)) { SetFlag(BRS_ISBSTARTMARGINROOT, true); SetFlag(BRS_APPLYBSTARTMARGIN, true); } - if ((aBEndMarginRoot && !logicalSkipSides.BEnd()) || + if ((aBEndMarginRoot && !(logicalSkipSides & LOGICAL_SIDE_B_END)) || 0 != mBorderPadding.BEnd(wm)) { SetFlag(BRS_ISBENDMARGINROOT, true); } if (aBlockNeedsFloatManager) { SetFlag(BRS_FLOAT_MGR, true); } mFloatManager = aReflowState.mFloatManager;
--- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -105,22 +105,20 @@ nsColumnSetFrame::PaintColumnRule(nsRend // Each child frame's position coordinates is actually relative to this nsColumnSetFrame. // linePt will be at the top-left edge to paint the line. nsPoint edgeOfLeftSibling = leftSibling->GetRect().TopRight() + aPt; nsPoint edgeOfRightSibling = rightSibling->GetRect().TopLeft() + aPt; nsPoint linePt((edgeOfLeftSibling.x + edgeOfRightSibling.x - ruleWidth) / 2, contentRect.y); nsRect lineRect(linePt, ruleSize); - // Remember, we only have the "left" "border". Skip everything else. - Sides skipSides(mozilla::eSideBitsTopBottom); - skipSides |= mozilla::eSideBitsRight; nsCSSRendering::PaintBorderWithStyleBorder(presContext, *aCtx, this, aDirtyRect, lineRect, border, StyleContext(), - skipSides); + // Remember, we only have the "left" "border". Skip everything else + (1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM)); child = nextSibling; nextSibling = nextSibling->GetNextSibling(); } } static nscoord GetAvailableContentWidth(const nsHTMLReflowState& aReflowState)
--- a/layout/generic/nsFirstLetterFrame.cpp +++ b/layout/generic/nsFirstLetterFrame.cpp @@ -373,21 +373,21 @@ nsFirstLetterFrame::DrainOverflowFrames( } nscoord nsFirstLetterFrame::GetLogicalBaseline(WritingMode aWritingMode) const { return mBaseline; } -nsIFrame::LogicalSides +int nsFirstLetterFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (GetPrevContinuation()) { // We shouldn't get calls to GetSkipSides for later continuations since // they have separate style contexts with initial values for all the // properties that could trigger a call to GetSkipSides. Then again, // it's not really an error to call GetSkipSides on any frame, so // that's why we handle it properly. - return LogicalSides(eLogicalSideBitsAll); + return LOGICAL_SIDES_ALL; } - return LogicalSides(); // first continuation displays all sides + return 0; // first continuation displays all sides }
--- a/layout/generic/nsFirstLetterFrame.h +++ b/layout/generic/nsFirstLetterFrame.h @@ -55,17 +55,17 @@ public: uint32_t aFlags) MOZ_OVERRIDE; virtual void Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) MOZ_OVERRIDE; virtual bool CanContinueTextRun() const MOZ_OVERRIDE; virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const MOZ_OVERRIDE; - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; //override of nsFrame method virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset, bool inHint, int32_t* outFrameContentOffset, nsIFrame** outChildFrame) MOZ_OVERRIDE; nscoord GetFirstLetterBaseline() const { return mBaseline; }
--- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -16,16 +16,17 @@ #include "nsPlaceholderFrame.h" #include "nsPresContext.h" #include "nsStyleContext.h" #include "prlog.h" #include <algorithm> #include "mozilla/LinkedList.h" using namespace mozilla; +using namespace mozilla::css; using namespace mozilla::layout; // Convenience typedefs for helper classes that we forward-declare in .h file // (so that nsFlexContainerFrame methods can use them as parameters): typedef nsFlexContainerFrame::FlexItem FlexItem; typedef nsFlexContainerFrame::FlexLine FlexLine; typedef nsFlexContainerFrame::FlexboxAxisTracker FlexboxAxisTracker; typedef nsFlexContainerFrame::StrutInfo StrutInfo; @@ -68,18 +69,18 @@ enum AxisOrientationType { // the sub-arrays in 'kAxisOrientationToSidesMap', defined below. enum AxisEdgeType { eAxisEdge_Start, eAxisEdge_End, eNumAxisEdges // For sizing arrays that use these values as indices }; // This array maps each axis orientation to a pair of corresponding -// [start, end] physical mozilla::Side values. -static const mozilla::Side +// [start, end] physical mozilla::css::Side values. +static const Side kAxisOrientationToSidesMap[eNumAxisOrientationTypes][eNumAxisEdges] = { { eSideLeft, eSideRight }, // eAxis_LR { eSideRight, eSideLeft }, // eAxis_RL { eSideTop, eSideBottom }, // eAxis_TB { eSideBottom, eSideTop } // eAxis_BT }; // Helper structs / classes / methods @@ -149,17 +150,17 @@ PhysicalPosFromLogicalPos(nscoord aLogic AxisOrientationType aAxis) { if (AxisGrowsInPositiveDirection(aAxis)) { return aLogicalPosn; } return aLogicalContainerSize - aLogicalPosn; } static nscoord -MarginComponentForSide(const nsMargin& aMargin, mozilla::Side aSide) +MarginComponentForSide(const nsMargin& aMargin, Side aSide) { switch (aSide) { case eSideLeft: return aMargin.left; case eSideRight: return aMargin.right; case eSideTop: return aMargin.top; @@ -168,17 +169,17 @@ MarginComponentForSide(const nsMargin& a } NS_NOTREACHED("unexpected Side enum"); return aMargin.left; // have to return something // (but something's busted if we got here) } static nscoord& -MarginComponentForSide(nsMargin& aMargin, mozilla::Side aSide) +MarginComponentForSide(nsMargin& aMargin, Side aSide) { switch (aSide) { case eSideLeft: return aMargin.left; case eSideRight: return aMargin.right; case eSideTop: return aMargin.top; @@ -409,43 +410,43 @@ public: } return mFlexShrink * mFlexBaseSize; } // Getters for margin: // =================== const nsMargin& GetMargin() const { return mMargin; } - // Returns the margin component for a given mozilla::Side - nscoord GetMarginComponentForSide(mozilla::Side aSide) const + // Returns the margin component for a given mozilla::css::Side + nscoord GetMarginComponentForSide(Side aSide) const { return MarginComponentForSide(mMargin, aSide); } // Returns the total space occupied by this item's margins in the given axis nscoord GetMarginSizeInAxis(AxisOrientationType aAxis) const { - mozilla::Side startSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_Start]; - mozilla::Side endSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_End]; + Side startSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_Start]; + Side endSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_End]; return GetMarginComponentForSide(startSide) + GetMarginComponentForSide(endSide); } // Getters for border/padding // ========================== const nsMargin& GetBorderPadding() const { return mBorderPadding; } - // Returns the border+padding component for a given mozilla::Side - nscoord GetBorderPaddingComponentForSide(mozilla::Side aSide) const + // Returns the border+padding component for a given mozilla::css::Side + nscoord GetBorderPaddingComponentForSide(Side aSide) const { return MarginComponentForSide(mBorderPadding, aSide); } // Returns the total space occupied by this item's borders and padding in // the given axis nscoord GetBorderPaddingSizeInAxis(AxisOrientationType aAxis) const { - mozilla::Side startSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_Start]; - mozilla::Side endSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_End]; + Side startSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_Start]; + Side endSide = kAxisOrientationToSidesMap[aAxis][eAxisEdge_End]; return GetBorderPaddingComponentForSide(startSide) + GetBorderPaddingComponentForSide(endSide); } // Getter for combined margin/border/padding // ========================================= // Returns the total space occupied by this item's margins, borders and // padding in the given axis @@ -545,17 +546,17 @@ public: } void SetIsStretched() { MOZ_ASSERT(mIsFrozen, "main size should be resolved before this"); mIsStretched = true; } // Setter for margin components (for resolving "auto" margins) - void SetMarginComponentForSide(mozilla::Side aSide, nscoord aLength) + void SetMarginComponentForSide(Side aSide, nscoord aLength) { MOZ_ASSERT(mIsFrozen, "main size should be resolved before this"); MarginComponentForSide(mMargin, aSide) = aLength; } void ResolveStretchedCrossSize(nscoord aLineCrossSize, const FlexboxAxisTracker& aAxisTracker); @@ -1267,17 +1268,17 @@ FlexItem::GetBaselineOffsetFromOuterCros // measurement -- it's the distance from the border-top edge of this FlexItem // to its baseline. So, we can really only do baseline alignment when the // cross axis is vertical. (The FlexItem constructor enforces this when // resolving the item's "mAlignSelf" value). MOZ_ASSERT(!IsAxisHorizontal(aCrossAxis), "Only expecting to be doing baseline computations when the " "cross axis is vertical"); - mozilla::Side sideToMeasureFrom = kAxisOrientationToSidesMap[aCrossAxis][aEdge]; + Side sideToMeasureFrom = kAxisOrientationToSidesMap[aCrossAxis][aEdge]; nscoord marginTopToBaseline = mAscent + mMargin.top; if (sideToMeasureFrom == eSideTop) { // Measuring from top (normal case): the distance from the margin-box top // edge to the baseline is just ascent + margin-top. return marginTopToBaseline; } @@ -1293,17 +1294,17 @@ FlexItem::GetBaselineOffsetFromOuterCros } uint32_t FlexItem::GetNumAutoMarginsInAxis(AxisOrientationType aAxis) const { uint32_t numAutoMargins = 0; const nsStyleSides& styleMargin = mFrame->StyleMargin()->mMargin; for (uint32_t i = 0; i < eNumAxisEdges; i++) { - mozilla::Side side = kAxisOrientationToSidesMap[aAxis][i]; + Side side = kAxisOrientationToSidesMap[aAxis][i]; if (styleMargin.GetUnit(side) == eStyleUnit_Auto) { numAutoMargins++; } } // Mostly for clarity: MOZ_ASSERT(numAutoMargins <= 2, "We're just looking at one item along one dimension, so we " @@ -1321,25 +1322,25 @@ public: // Accessor for the current value of the position that we're tracking. inline nscoord GetPosition() const { return mPosition; } inline AxisOrientationType GetAxis() const { return mAxis; } // Advances our position across the start edge of the given margin, in the // axis we're tracking. void EnterMargin(const nsMargin& aMargin) { - mozilla::Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_Start]; + Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_Start]; mPosition += MarginComponentForSide(aMargin, side); } // Advances our position across the end edge of the given margin, in the axis // we're tracking. void ExitMargin(const nsMargin& aMargin) { - mozilla::Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_End]; + Side side = kAxisOrientationToSidesMap[mAxis][eAxisEdge_End]; mPosition += MarginComponentForSide(aMargin, side); } // Advances our current position from the start side of a child frame's // border-box to the frame's upper or left edge (depending on our axis). // (Note that this is a no-op if our axis grows in positive direction.) void EnterChildFrame(nscoord aChildFrameSize) { @@ -2087,17 +2088,17 @@ MainAxisPositionTracker:: } void MainAxisPositionTracker::ResolveAutoMarginsInMainAxis(FlexItem& aItem) { if (mNumAutoMarginsInMainAxis) { const nsStyleSides& styleMargin = aItem.Frame()->StyleMargin()->mMargin; for (uint32_t i = 0; i < eNumAxisEdges; i++) { - mozilla::Side side = kAxisOrientationToSidesMap[mAxis][i]; + Side side = kAxisOrientationToSidesMap[mAxis][i]; if (styleMargin.GetUnit(side) == eStyleUnit_Auto) { // NOTE: This integer math will skew the distribution of remainder // app-units towards the end, which is fine. nscoord curAutoMarginSize = mPackingSpaceRemaining / mNumAutoMarginsInMainAxis; MOZ_ASSERT(aItem.GetMarginComponentForSide(side) == 0, "Expecting auto margins to have value '0' before we " @@ -2423,17 +2424,17 @@ SingleLineCrossAxisPositionTracker:: if (numAutoMargins == 0) { return; // No auto margins --> nothing to do. } // OK, we have at least one auto margin and we have some available space. // Give each auto margin a share of the space. const nsStyleSides& styleMargin = aItem.Frame()->StyleMargin()->mMargin; for (uint32_t i = 0; i < eNumAxisEdges; i++) { - mozilla::Side side = kAxisOrientationToSidesMap[mAxis][i]; + Side side = kAxisOrientationToSidesMap[mAxis][i]; if (styleMargin.GetUnit(side) == eStyleUnit_Auto) { MOZ_ASSERT(aItem.GetMarginComponentForSide(side) == 0, "Expecting auto margins to have value '0' before we " "update them"); // NOTE: integer divison is fine here; numAutoMargins is either 1 or 2. // If it's 2 & spaceForAutoMargins is odd, 1st margin gets smaller half. nscoord curAutoMarginSize = spaceForAutoMargins / numAutoMargins; @@ -3107,17 +3108,17 @@ nsFlexContainerFrame::Reflow(nsPresConte const FlexboxAxisTracker axisTracker(this); // If we're being fragmented into a constrained height, subtract off // borderpadding-top from it, to get the available height for our // content box. (Don't subtract if we're skipping top border/padding, // though.) nscoord availableHeightForContent = aReflowState.AvailableHeight(); if (availableHeightForContent != NS_UNCONSTRAINEDSIZE && - !GetSkipSides().Top()) { + !(GetSkipSides() & (1 << NS_SIDE_TOP))) { availableHeightForContent -= aReflowState.ComputedPhysicalBorderPadding().top; // (Don't let that push availableHeightForContent below zero, though): availableHeightForContent = std::max(availableHeightForContent, 0); } nscoord contentBoxMainSize = GetMainSizeFromReflowState(aReflowState, axisTracker);
--- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -947,61 +947,62 @@ nsIFrame::GetUsedPadding() const padding = *p; } else { DebugOnly<bool> hasPadding = StylePadding()->GetPadding(padding); NS_ASSERTION(hasPadding, "We should have padding here! (out of memory?)"); } return padding; } -nsIFrame::Sides +int nsIFrame::GetSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return Sides(); + return 0; } // Convert the logical skip sides to physical sides using the frame's // writing mode WritingMode writingMode = GetWritingMode(); - LogicalSides logicalSkip = GetLogicalSkipSides(aReflowState); - Sides skip; - - if (logicalSkip.BStart()) { + int logicalSkip = GetLogicalSkipSides(aReflowState); + int skip = 0; + + if (logicalSkip & LOGICAL_SIDE_B_START) { if (writingMode.IsVertical()) { - skip |= writingMode.IsVerticalLR() ? eSideBitsLeft : eSideBitsRight; + skip |= 1 << (writingMode.IsVerticalLR() ? NS_SIDE_LEFT : NS_SIDE_RIGHT); } else { - skip |= eSideBitsTop; - } - } - - if (logicalSkip.BEnd()) { + skip |= 1 << NS_SIDE_TOP; + } + } + + if (logicalSkip & LOGICAL_SIDE_B_END) { if (writingMode.IsVertical()) { - skip |= writingMode.IsVerticalLR() ? eSideBitsRight : eSideBitsLeft; + skip |= 1 << (writingMode.IsVerticalLR() ? NS_SIDE_RIGHT : NS_SIDE_LEFT); } else { - skip |= eSideBitsBottom; - } - } - - if (logicalSkip.IStart()) { + skip |= 1 << NS_SIDE_BOTTOM; + } + } + + if (logicalSkip & LOGICAL_SIDE_I_START) { if (writingMode.IsVertical()) { - skip |= eSideBitsTop; + skip |= 1 << NS_SIDE_TOP; } else { - skip |= writingMode.IsBidiLTR() ? eSideBitsLeft : eSideBitsRight; - } - } - - if (logicalSkip.IEnd()) { + skip |= 1 << (writingMode.IsBidiLTR() ? NS_SIDE_LEFT : NS_SIDE_RIGHT); + } + } + + if (logicalSkip & LOGICAL_SIDE_I_END) { if (writingMode.IsVertical()) { - skip |= eSideBitsBottom; + skip |= 1 << NS_SIDE_BOTTOM; } else { - skip |= writingMode.IsBidiLTR() ? eSideBitsRight : eSideBitsLeft; - } - } + skip |= 1 << (writingMode.IsBidiLTR() ? NS_SIDE_RIGHT : NS_SIDE_LEFT); + } + } + return skip; } nsRect nsIFrame::GetPaddingRectRelativeToSelf() const { nsMargin border(GetUsedBorder()); border.ApplySkipSides(GetSkipSides()); @@ -1137,17 +1138,17 @@ nsIFrame::GetContentRect() const { return GetContentRectRelativeToSelf() + GetPosition(); } bool nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius, const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, + int aSkipSides, nscoord aRadii[8]) { // Percentages are relative to whichever side they're on. NS_FOR_CSS_HALF_CORNERS(i) { const nsStyleCoord c = aBorderRadius.Get(i); nscoord axis = NS_HALF_CORNER_IS_X(i) ? aFrameSize.width : aFrameSize.height; @@ -1158,38 +1159,38 @@ nsIFrame::ComputeBorderRadii(const nsSty aRadii[i] = 0; } } else { NS_NOTREACHED("ComputeBorderRadii: bad unit"); aRadii[i] = 0; } } - if (aSkipSides.Top()) { + if (aSkipSides & (1 << NS_SIDE_TOP)) { aRadii[NS_CORNER_TOP_LEFT_X] = 0; aRadii[NS_CORNER_TOP_LEFT_Y] = 0; aRadii[NS_CORNER_TOP_RIGHT_X] = 0; aRadii[NS_CORNER_TOP_RIGHT_Y] = 0; } - if (aSkipSides.Right()) { + if (aSkipSides & (1 << NS_SIDE_RIGHT)) { aRadii[NS_CORNER_TOP_RIGHT_X] = 0; aRadii[NS_CORNER_TOP_RIGHT_Y] = 0; aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0; aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0; } - if (aSkipSides.Bottom()) { + if (aSkipSides & (1 << NS_SIDE_BOTTOM)) { aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0; aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0; aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0; aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0; } - if (aSkipSides.Left()) { + if (aSkipSides & (1 << NS_SIDE_LEFT)) { aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0; aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0; aRadii[NS_CORNER_TOP_LEFT_X] = 0; aRadii[NS_CORNER_TOP_LEFT_Y] = 0; } // css3-background specifies this algorithm for reducing // corner radii when they are too big. @@ -1240,17 +1241,17 @@ nsIFrame::OutsetBorderRadii(nscoord aRad aRadii[hc1] += offset; if (aRadii[hc2] > 0) aRadii[hc2] += offset; } } /* virtual */ bool nsIFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, nscoord aRadii[8]) const + int aSkipSides, nscoord aRadii[8]) const { if (IsThemed()) { // When we're themed, the native theme code draws the border and // background, and therefore it doesn't make sense to tell other // code that's interested in border-radius that we have any radii. // // In an ideal world, we might have a way for the them to tell us an // border radius, but since we don't, we're better off assuming
--- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4333,17 +4333,17 @@ ReduceRadii(nscoord aXBorder, nscoord aY * * In other words, we require that the border radius be reduced until the * inner border radius at the inner edge of the border is 0 wherever we * have scrollbars. */ bool ScrollFrameHelper::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, + int aSkipSides, nscoord aRadii[8]) const { if (!mOuter->nsContainerFrame::GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii)) { return false; } // Since we can use GetActualScrollbarSizes (rather than
--- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -34,17 +34,16 @@ namespace layout { class ScrollbarActivity; } } namespace mozilla { class ScrollFrameHelper : public nsIReflowCallback { public: - typedef nsIFrame::Sides Sides; typedef mozilla::CSSIntPoint CSSIntPoint; typedef mozilla::layout::ScrollbarActivity ScrollbarActivity; class AsyncScroll; ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot); ~ScrollFrameHelper(); @@ -68,17 +67,17 @@ public: void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists, bool aCreateLayer, bool aPositioned); bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, nscoord aRadii[8]) const; + int aSkipSides, nscoord aRadii[8]) const; // nsIReflowCallback virtual bool ReflowFinished() MOZ_OVERRIDE; virtual void ReflowCallbackCanceled() MOZ_OVERRIDE; /** * @note This method might destroy the frame, pres shell and other objects. * Called when the 'curpos' attribute on one of the scrollbars changes. @@ -476,17 +475,17 @@ public: bool aFirstPass); void ReflowContents(ScrollReflowState* aState, const nsHTMLReflowMetrics& aDesiredSize); void PlaceScrollArea(const ScrollReflowState& aState, const nsPoint& aScrollPosition); nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext); virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE { + int aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE { return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii); } virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; virtual nsresult GetPadding(nsMargin& aPadding) MOZ_OVERRIDE; virtual bool IsCollapsed() MOZ_OVERRIDE; @@ -825,17 +824,17 @@ public: virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE; virtual nsresult GetPadding(nsMargin& aPadding) MOZ_OVERRIDE; virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE { + int aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE { return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii); } nsresult Layout(nsBoxLayoutState& aState); void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition); static bool AddRemoveScrollbar(bool& aHasScrollbar, nscoord& aXY,
--- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -403,18 +403,16 @@ public: typedef mozilla::FrameProperties FrameProperties; typedef mozilla::layers::Layer Layer; typedef mozilla::layout::FrameChildList ChildList; typedef mozilla::layout::FrameChildListID ChildListID; typedef mozilla::layout::FrameChildListIDs ChildListIDs; typedef mozilla::layout::FrameChildListIterator ChildListIterator; typedef mozilla::layout::FrameChildListArrayIterator ChildListArrayIterator; typedef mozilla::gfx::Matrix Matrix; - typedef mozilla::Sides Sides; - typedef mozilla::LogicalSides LogicalSides; NS_DECL_QUERYFRAME_TARGET(nsIFrame) nsPresContext* PresContext() const { return StyleContext()->RuleNode()->PresContext(); } /** @@ -914,20 +912,20 @@ public: * large. * FIXME: In the long run, we can probably get away with only one of * these, especially if we change the way we handle outline-radius (by * removing it and inflating the border radius) * * Return whether any radii are nonzero. */ static bool ComputeBorderRadii(const nsStyleCorners& aBorderRadius, - const nsSize& aFrameSize, - const nsSize& aBorderArea, - Sides aSkipSides, - nscoord aRadii[8]); + const nsSize& aFrameSize, + const nsSize& aBorderArea, + int aSkipSides, + nscoord aRadii[8]); /* * Given a set of border radii for one box (e.g., border box), convert * it to the equivalent set of radii for another box (e.g., in to * padding box, out to outline box) by reducing radii or increasing * nonzero radii as appropriate. * * Indices into aRadii are the NS_CORNER_* constants in nsStyleConsts.h @@ -943,17 +941,17 @@ public: /** * Fill in border radii for this frame. Return whether any are nonzero. * Indices into aRadii are the NS_CORNER_* constants in nsStyleConsts.h * aSkipSides is a union of SIDE_BIT_LEFT/RIGHT/TOP/BOTTOM bits that says * which side(s) to skip. */ virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, + int aSkipSides, nscoord aRadii[8]) const; bool GetBorderRadii(nscoord aRadii[8]) const; bool GetPaddingBoxBorderRadii(nscoord aRadii[8]) const; bool GetContentBoxBorderRadii(nscoord aRadii[8]) const; /** * Get the position of the frame's baseline, relative to the top of @@ -2300,33 +2298,31 @@ public: /** * Removes any stored overflow rects (visual and scrollable) from the frame. * Returns true if the overflow changed. */ bool ClearOverflowRects(); /** - * Determine whether borders, padding, margins etc should NOT be applied - * on certain sides of the frame. - * @see mozilla::Sides in gfx/2d/BaseMargin.h - * @see mozilla::LogicalSides in layout/generic/WritingModes.h + * Determine whether borders should not be painted on certain sides of the + * frame. * * @note (See also bug 743402, comment 11) GetSkipSides() checks to see * if this frame has a previous or next continuation to determine * if a side should be skipped. * Unfortunately, this only works after reflow has been completed. In * lieu of this, during reflow, an nsHTMLReflowState parameter can be * passed in, indicating that it should be used to determine if sides * should be skipped during reflow. */ - Sides GetSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const; - virtual LogicalSides + int GetSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const { - return LogicalSides(); + return 0; } /** * @returns true if this frame is selected. */ bool IsSelected() const; /**
--- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1831,29 +1831,29 @@ nsImageFrame::List(FILE* out, const char uri->GetAsciiSpec(uristr); str += nsPrintfCString(" [src=%s]", uristr.get()); } } fprintf_stderr(out, "%s\n", str.get()); } #endif -nsIFrame::LogicalSides +int nsImageFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } nsresult nsImageFrame::GetIntrinsicImageSize(nsSize& aSize) { if (mIntrinsicSize.width.GetUnit() == eStyleUnit_Coord &&
--- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -113,17 +113,17 @@ public: } #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE; #endif - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; nsresult GetIntrinsicImageSize(nsSize& aSize); static void ReleaseGlobals() { if (gIconLoad) { gIconLoad->Shutdown(); NS_RELEASE(gIconLoad); }
--- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -875,67 +875,67 @@ nsInlineFrame::PushFrames(nsPresContext* if (aState.mLineLayout) { aState.mLineLayout->SetDirtyNextLine(); } } ////////////////////////////////////////////////////////////////////// -nsIFrame::LogicalSides +int nsInlineFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (!IsFirst()) { nsInlineFrame* prev = (nsInlineFrame*) GetPrevContinuation(); if ((GetStateBits() & NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET) || (prev && (prev->mRect.height || prev->mRect.width))) { // Prev continuation is not empty therefore we don't render our start // border edge. - skip |= eLogicalSideBitsIStart; + skip |= LOGICAL_SIDE_I_START; } else { // If the prev continuation is empty, then go ahead and let our start // edge border render. } } if (!IsLast()) { nsInlineFrame* next = (nsInlineFrame*) GetNextContinuation(); if ((GetStateBits() & NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET) || (next && (next->mRect.height || next->mRect.width))) { // Next continuation is not empty therefore we don't render our end // border edge. - skip |= eLogicalSideBitsIEnd; + skip |= LOGICAL_SIDE_I_END; } else { // If the next continuation is empty, then go ahead and let our end // edge border render. } } if (GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) { // All but the last part of an {ib} split should skip the "end" side (as // determined by this frame's direction) and all but the first part of such // a split should skip the "start" side. But figuring out which part of // the split we are involves getting our first continuation, which might be // expensive. So don't bother if we already have the relevant bits set. - if (skip != LogicalSides(eLogicalSideBitsIBoth)) { + if (skip != LOGICAL_SIDES_I_BOTH) { // We're missing one of the skip bits, so check whether we need to set it. // Only get the first continuation once, as an optimization. nsIFrame* firstContinuation = FirstContinuation(); if (firstContinuation->FrameIsNonLastInIBSplit()) { - skip |= eLogicalSideBitsIEnd; + skip |= LOGICAL_SIDE_I_END; } if (firstContinuation->FrameIsNonFirstInIBSplit()) { - skip |= eLogicalSideBitsIStart; + skip |= LOGICAL_SIDE_I_START; } } } return skip; } nscoord
--- a/layout/generic/nsInlineFrame.h +++ b/layout/generic/nsInlineFrame.h @@ -122,17 +122,17 @@ protected: mLineContainer = nullptr; mLineLayout = nullptr; mSetParentPointer = false; } }; nsInlineFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {} - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; void ReflowFrames(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, InlineReflowState& rs, nsHTMLReflowMetrics& aMetrics, nsReflowStatus& aStatus); void ReflowInlineFrame(nsPresContext* aPresContext,
--- a/layout/generic/nsSplittableFrame.cpp +++ b/layout/generic/nsSplittableFrame.cpp @@ -7,18 +7,16 @@ * base class for rendering objects that can be split across lines, * columns, or pages */ #include "nsSplittableFrame.h" #include "nsContainerFrame.h" #include "nsIFrameInlines.h" -using namespace mozilla; - NS_IMPL_FRAMEARENA_HELPERS(nsSplittableFrame) void nsSplittableFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { nsFrame::Init(aContent, aParent, aPrevInFlow); @@ -232,52 +230,52 @@ nsSplittableFrame::GetEffectiveComputedB } bSize -= aConsumedBSize; // We may have stretched the frame beyond its computed height. Oh well. return std::max(0, bSize); } -nsIFrame::LogicalSides +int nsSplittableFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (IS_TRUE_OVERFLOW_CONTAINER(this)) { - return LogicalSides(eLogicalSideBitsBBoth); + return LOGICAL_SIDES_B_BOTH; } if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (aReflowState) { // We're in the midst of reflow right now, so it's possible that we haven't // created a nif yet. If our content height is going to exceed our available // height, though, then we're going to need a next-in-flow, it just hasn't // been created yet. if (NS_UNCONSTRAINEDSIZE != aReflowState->AvailableBSize()) { nscoord effectiveCH = this->GetEffectiveComputedBSize(*aReflowState); if (effectiveCH != NS_INTRINSICSIZE && effectiveCH > aReflowState->AvailableBSize()) { // Our content height is going to exceed our available height, so we're // going to need a next-in-flow. - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } } } else { nsIFrame* nif = GetNextInFlow(); if (nif && !IS_TRUE_OVERFLOW_CONTAINER(nif)) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } } return skip; } #ifdef DEBUG void
--- a/layout/generic/nsSplittableFrame.h +++ b/layout/generic/nsSplittableFrame.h @@ -90,17 +90,17 @@ protected: * computed block size, minus the block size consumed by any previous in-flows. */ nscoord GetEffectiveComputedBSize(const nsHTMLReflowState& aReflowState, nscoord aConsumed = NS_INTRINSICSIZE) const; /** * @see nsIFrame::GetLogicalSkipSides() */ - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; #ifdef DEBUG virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent) MOZ_OVERRIDE; #endif nsIFrame* mPrevContinuation; nsIFrame* mNextContinuation; };
--- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -1959,17 +1959,17 @@ public: private: nsRect mRect; }; void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) { // for visual debug - Sides skipSides; + int skipSides = 0; nsPresContext* presContext = mFrame->PresContext(); nsStyleContext* styleContext = mFrame->StyleContext(); nsRect rect = mRect + ToReferenceFrame(); nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame, mVisibleRect, rect, styleContext, skipSides); nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame, mVisibleRect, rect, styleContext); }
--- a/layout/style/nsComputedDOMStylePropertyList.h +++ b/layout/style/nsComputedDOMStylePropertyList.h @@ -90,17 +90,16 @@ COMPUTED_STYLE_PROP(border_spacing, //// COMPUTED_STYLE_PROP(border_top, BorderTop) COMPUTED_STYLE_PROP(border_top_color, BorderTopColor) COMPUTED_STYLE_PROP(border_top_left_radius, BorderTopLeftRadius) COMPUTED_STYLE_PROP(border_top_right_radius, BorderTopRightRadius) COMPUTED_STYLE_PROP(border_top_style, BorderTopStyle) COMPUTED_STYLE_PROP(border_top_width, BorderTopWidth) //// COMPUTED_STYLE_PROP(border_width, BorderWidth) COMPUTED_STYLE_PROP(bottom, Bottom) -COMPUTED_STYLE_PROP(box_decoration_break, BoxDecorationBreak) COMPUTED_STYLE_PROP(box_shadow, BoxShadow) COMPUTED_STYLE_PROP(box_sizing, BoxSizing) COMPUTED_STYLE_PROP(caption_side, CaptionSide) COMPUTED_STYLE_PROP(clear, Clear) COMPUTED_STYLE_PROP(clip, Clip) COMPUTED_STYLE_PROP(color, Color) COMPUTED_STYLE_PROP(content, Content) COMPUTED_STYLE_PROP(counter_increment, CounterIncrement)
--- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -9,21 +9,20 @@ #define nsStyleConsts_h___ #include "gfxRect.h" #include "nsFont.h" // XXX fold this into nsStyleContext and group by nsStyleXXX struct // Indices into border/padding/margin arrays -namespace mozilla { -namespace css { -typedef mozilla::Side Side; -} -} +#define NS_SIDE_TOP mozilla::css::eSideTop +#define NS_SIDE_RIGHT mozilla::css::eSideRight +#define NS_SIDE_BOTTOM mozilla::css::eSideBottom +#define NS_SIDE_LEFT mozilla::css::eSideLeft #define NS_FOR_CSS_SIDES(var_) for (mozilla::css::Side var_ = NS_SIDE_TOP; var_ <= NS_SIDE_LEFT; var_++) static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { NS_PRECONDITION(side >= NS_SIDE_TOP && side <= NS_SIDE_LEFT, "Out of range side"); side = mozilla::css::Side(side + 1); return side; }
--- a/layout/tables/celldata.h +++ b/layout/tables/celldata.h @@ -196,21 +196,21 @@ public: nscoord GetTopEdge(BCBorderOwner& aOwner, bool& aStart) const; void SetTopEdge(BCBorderOwner aOwner, nscoord aSize, bool aStart); - BCPixelSize GetCorner(mozilla::Side& aCornerOwner, + BCPixelSize GetCorner(mozilla::css::Side& aCornerOwner, bool& aBevel) const; void SetCorner(BCPixelSize aSubSize, - mozilla::Side aOwner, + mozilla::css::Side aOwner, bool aBevel); bool IsLeftStart() const; void SetLeftStart(bool aValue); bool IsTopStart() const; @@ -224,17 +224,17 @@ protected: // dominant plane (for example, if corner is // owned by the segment to its top or bottom, // then the size is the max of the border // sizes of the segments to its left or right. unsigned mLeftOwner: 4; // owner of left border unsigned mTopOwner: 4; // owner of top border unsigned mLeftStart: 1; // set if this is the start of a vertical border segment unsigned mTopStart: 1; // set if this is the start of a horizontal border segment - unsigned mCornerSide: 2; // mozilla::Side of the owner of the upper left corner relative to the corner + unsigned mCornerSide: 2; // mozilla::css::Side of the owner of the upper left corner relative to the corner unsigned mCornerBevel: 1; // is the corner beveled (only two segments, perpendicular, not dashed or dotted). }; // BCCellData entries replace CellData entries in the cell map if the border collapsing model is in // effect. BCData for a row and col entry contains the left and top borders of cell at that row and // col and the corner connecting the two. The right borders of the cells in the last col and the bottom // borders of the last row are stored in separate BCData entries in the cell map. class BCCellData : public CellData @@ -444,26 +444,26 @@ inline void BCData::SetTopEdge(BCBorderO nscoord aSize, bool aStart) { mTopOwner = aOwner; mTopSize = (aSize > MAX_BORDER_WIDTH) ? MAX_BORDER_WIDTH : aSize; mTopStart = aStart; } -inline BCPixelSize BCData::GetCorner(mozilla::Side& aOwnerSide, +inline BCPixelSize BCData::GetCorner(mozilla::css::Side& aOwnerSide, bool& aBevel) const { - aOwnerSide = mozilla::Side(mCornerSide); + aOwnerSide = mozilla::css::Side(mCornerSide); aBevel = (bool)mCornerBevel; return mCornerSubSize; } inline void BCData::SetCorner(BCPixelSize aSubSize, - mozilla::Side aOwnerSide, + mozilla::css::Side aOwnerSide, bool aBevel) { mCornerSubSize = aSubSize; mCornerSide = aOwnerSide; mCornerBevel = aBevel; } inline bool BCData::IsLeftStart() const
--- a/layout/tables/nsCellMap.cpp +++ b/layout/tables/nsCellMap.cpp @@ -723,17 +723,17 @@ nsTableCellMap::Dump(char* aString) cons while (cellMap) { cellMap->Dump(nullptr != mBCInfo); cellMap = cellMap->GetNextSibling(); } if (nullptr != mBCInfo) { printf("***** bottom borders *****\n"); nscoord size; BCBorderOwner owner; - mozilla::Side side; + mozilla::css::Side side; bool segStart; bool bevel; int32_t colIndex; int32_t numCols = mBCInfo->mBottomBorders.Length(); for (int32_t i = 0; i <= 2; i++) { printf("\n "); for (colIndex = 0; colIndex < numCols; colIndex++) { @@ -965,17 +965,17 @@ nsTableCellMap::ResetTopStart(uint8_t } } // store the aSide border segment at coord = (aRowIndex, aColIndex). For top/left, store // the info at coord. For bottom/left store it at the adjacent location so that it is // top/left at that location. If the new location is at the right or bottom edge of the // table, then store it one of the special arrays (right most borders, bottom most borders). void -nsTableCellMap::SetBCBorderEdge(mozilla::Side aSide, +nsTableCellMap::SetBCBorderEdge(mozilla::css::Side aSide, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aRowIndex, uint32_t aColIndex, uint32_t aLength, BCBorderOwner aOwner, nscoord aSize, bool aChanged) @@ -1065,17 +1065,17 @@ nsTableCellMap::SetBCBorderEdge(mozilla: // (aRowIndex, aColIndex). For eTopRight, store it in the entry to the right where // it would be top left. For eBottomRight, store it in the entry to the bottom. etc. void nsTableCellMap::SetBCBorderCorner(Corner aCorner, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aRowIndex, uint32_t aColIndex, - mozilla::Side aOwner, + mozilla::css::Side aOwner, nscoord aSubSize, bool aBevel, bool aIsBottomRight) { if (!mBCInfo) ABORT0(); if (aIsBottomRight) { mBCInfo->mLowerRightCorner.SetCorner(aSubSize, aOwner, aBevel); @@ -2579,17 +2579,17 @@ void nsCellMap::Dump(bool aIsBorderColla } } else { printf("---- "); } } if (aIsBorderCollapse) { nscoord size; BCBorderOwner owner; - mozilla::Side side; + mozilla::css::Side side; bool segStart; bool bevel; for (int32_t i = 0; i <= 2; i++) { printf("\n "); for (colIndex = 0; colIndex < colCount; colIndex++) { BCCellData* cd = (BCCellData *)row[colIndex]; if (cd) { if (0 == i) {
--- a/layout/tables/nsCellMap.h +++ b/layout/tables/nsCellMap.h @@ -199,32 +199,32 @@ public: void ExpandZeroColSpans(); void ResetTopStart(uint8_t aSide, nsCellMap& aCellMap, uint32_t aYPos, uint32_t aXPos, bool aIsLowerRight = false); - void SetBCBorderEdge(mozilla::Side aEdge, + void SetBCBorderEdge(mozilla::css::Side aEdge, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aYPos, uint32_t aXPos, uint32_t aLength, BCBorderOwner aOwner, nscoord aSize, bool aChanged); void SetBCBorderCorner(::Corner aCorner, nsCellMap& aCellMap, uint32_t aCellMapStart, uint32_t aYPos, uint32_t aXPos, - mozilla::Side aOwner, + mozilla::css::Side aOwner, nscoord aSubSize, bool aBevel, bool aIsBottomRight = false); /** dump a representation of the cell map to stdout for debugging */ #ifdef DEBUG void Dump(char* aString = nullptr) const; #endif
--- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -540,30 +540,30 @@ nsTableCellFrame::BuildDisplayList(nsDis // This isn't a problem since it won't have a real background except for // event handling. We do not call BuildDisplayListForNonBlockChildren // because that/ would put the child's background in the Content() list // which isn't right (e.g., would end up on top of our child floats for // event handling). BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); } -nsIFrame::LogicalSides +int nsTableCellFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } /* virtual */ nsMargin nsTableCellFrame::GetBorderOverflow() { return nsMargin(0, 0, 0, 0); @@ -1104,17 +1104,17 @@ nsBCTableCellFrame::GetUsedBorder() cons nsMargin result; GetBorderWidth(result); return result; } /* virtual */ bool nsBCTableCellFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, + int aSkipSides, nscoord aRadii[8]) const { NS_FOR_CSS_HALF_CORNERS(corner) { aRadii[corner] = 0; } return false; }
--- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -217,17 +217,17 @@ public: return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart)); } virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE; virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE; virtual void InvalidateFrameForRemoval() MOZ_OVERRIDE { InvalidateFrameSubtree(); } protected: - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState= nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState= nullptr) const MOZ_OVERRIDE; /** * GetBorderOverflow says how far the cell's own borders extend * outside its own bounds. In the separated borders model this should * just be zero (as it is for most frames), but in the collapsed * borders model (for which nsBCTableCellFrame overrides this virtual * method), it considers the extents of the collapsed border. */ @@ -296,17 +296,17 @@ public: ~nsBCTableCellFrame(); virtual nsIAtom* GetType() const MOZ_OVERRIDE; virtual nsMargin GetUsedBorder() const MOZ_OVERRIDE; virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, - Sides aSkipSides, + int aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE; // Get the *inner half of the border only*, in twips. virtual nsMargin* GetBorderWidth(nsMargin& aBorder) const MOZ_OVERRIDE; // Get the *inner half of the border only*, in pixels. BCPixelSize GetBorderWidth(mozilla::css::Side aSide) const;
--- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -9,18 +9,16 @@ #include "nsStyleConsts.h" #include "nsPresContext.h" #include "nsHTMLParts.h" #include "nsGkAtoms.h" #include "nsCOMPtr.h" #include "nsCSSRendering.h" #include "nsIPresShell.h" -using namespace mozilla; - #define COL_GROUP_TYPE_BITS (NS_FRAME_STATE_BIT(30) | \ NS_FRAME_STATE_BIT(31)) #define COL_GROUP_TYPE_OFFSET 30 nsTableColGroupType nsTableColGroupFrame::GetColType() const { return (nsTableColGroupType)((mState & COL_GROUP_TYPE_BITS) >> COL_GROUP_TYPE_OFFSET); @@ -325,30 +323,30 @@ nsTableColGroupFrame::RemoveFrame(ChildL eColAnonymousColGroup, true); } } else { mFrames.DestroyFrame(aOldFrame); } } -nsIFrame::LogicalSides +int nsTableColGroupFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } void nsTableColGroupFrame::Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState,
--- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -202,17 +202,17 @@ public: virtual void InvalidateFrameForRemoval() MOZ_OVERRIDE { InvalidateFrameSubtree(); } protected: nsTableColGroupFrame(nsStyleContext* aContext); void InsertColsReflow(int32_t aColIndex, const nsFrameList::Slice& aCols); - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; // data members int32_t mColCount; // the starting column index this col group represents. Must be >= 0. int32_t mStartColIndex; // border width in pixels BCPixelSize mTopContBorderWidth;
--- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1378,46 +1378,46 @@ nsTableFrame::PaintTableBorderBackground nsMargin deflate = GetDeflationForBackground(presContext); // If 'deflate' is (0,0,0,0) then we'll paint the table background // in a separate display item, so don't do it here. nsresult rv = painter.PaintTable(this, deflate, deflate != nsMargin(0, 0, 0, 0)); if (NS_FAILED(rv)) return; if (StyleVisibility()->IsVisible()) { if (!IsBorderCollapse()) { - Sides skipSides = GetSkipSides(); + int skipSides = GetSkipSides(); nsRect rect(aPt, mRect.Size()); nsCSSRendering::PaintBorder(presContext, aRenderingContext, this, aDirtyRect, rect, mStyleContext, skipSides); } else { // XXX we should probably get rid of this translation at some stage // But that would mean modifying PaintBCBorders, ugh nsRenderingContext::AutoPushTranslation translate(&aRenderingContext, aPt); PaintBCBorders(aRenderingContext, aDirtyRect - aPt); } } } -nsIFrame::LogicalSides +int nsTableFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); - } - - LogicalSides skip; + return 0; + } + + int skip = 0; // frame attribute was accounted for in nsHTMLTableElement::MapTableBorderInto // account for pagination if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } void nsTableFrame::SetColumnDimensions(nscoord aHeight, const nsMargin& aBorderPadding) {
--- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -575,17 +575,17 @@ protected: */ nsTableFrame(nsStyleContext* aContext); /** destructor, responsible for mColumnLayoutData */ virtual ~nsTableFrame(); void InitChildReflowState(nsHTMLReflowState& aReflowState); - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; public: bool IsRowInserted() const; void SetRowInserted(bool aValue); protected: // A helper function to reflow a header or footer with unconstrained height
--- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -584,30 +584,30 @@ nsTableRowFrame::BuildDisplayList(nsDisp // cases. item = new (aBuilder) nsDisplayTableRowBackground(aBuilder, this); aLists.BorderBackground()->AppendNewToTop(item); } } nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item); } -nsIFrame::LogicalSides +int nsTableRowFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } // Calculate the cell's actual height given its pass2 height. // Takes into account the specified height (in the style). // Modifies the desired height that is passed in. nsresult
--- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -239,17 +239,17 @@ protected: */ nsTableRowFrame(nsStyleContext *aContext); void InitChildReflowState(nsPresContext& aPresContext, const nsSize& aAvailSize, bool aBorderCollapse, nsTableCellReflowState& aReflowState); - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; // row-specific methods nscoord ComputeCellXOffset(const nsHTMLReflowState& aState, nsIFrame* aKidFrame, const nsMargin& aKidMargin) const; /** * Called for incremental/dirty and resize reflows. If aDirtyOnly is true then
--- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -248,30 +248,30 @@ nsTableRowGroupFrame::BuildDisplayList(n item = new (aBuilder) nsDisplayTableRowGroupBackground(aBuilder, this); aLists.BorderBackground()->AppendNewToTop(item); } } nsTableFrame::DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists, item, DisplayRows); } -nsIFrame::LogicalSides +int nsTableRowGroupFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const { if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE)) { - return LogicalSides(); + return 0; } - LogicalSides skip; + int skip = 0; if (nullptr != GetPrevInFlow()) { - skip |= eLogicalSideBitsBStart; + skip |= LOGICAL_SIDE_B_START; } if (nullptr != GetNextInFlow()) { - skip |= eLogicalSideBitsBEnd; + skip |= LOGICAL_SIDE_B_END; } return skip; } // Position and size aKidFrame and update our reflow state. The origin of // aKidRect is relative to the upper-left origin of our frame void nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
--- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -329,17 +329,17 @@ public: protected: nsTableRowGroupFrame(nsStyleContext* aContext); void InitChildReflowState(nsPresContext& aPresContext, bool aBorderCollapse, nsHTMLReflowState& aReflowState); - virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; + virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; void PlaceChild(nsPresContext* aPresContext, nsRowGroupReflowState& aReflowState, nsIFrame* aKidFrame, nsHTMLReflowMetrics& aDesiredSize, const nsRect& aOriginalKidRect, const nsRect& aOriginalKidVisualOverflow);
--- a/layout/xul/nsGroupBoxFrame.cpp +++ b/layout/xul/nsGroupBoxFrame.cpp @@ -118,17 +118,17 @@ nsGroupBoxFrame::BuildDisplayList(nsDisp } BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists); } void nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { - Sides skipSides; + int skipSides = 0; const nsStyleBorder* borderStyleData = StyleBorder(); const nsMargin& border = borderStyleData->GetComputedBorder(); nscoord yoff = 0; nsPresContext* presContext = PresContext(); nsRect groupRect; nsIFrame* groupBox = GetCaptionBox(presContext, groupRect);