author | Bas Schouten <bschouten@mozilla.com> |
Fri, 26 May 2017 16:56:55 +0000 | |
changeset 360947 | bfa432683e279c14b37912a5c45638005f2b0b07 |
parent 360877 | 8b19b5019913ad412b7826a2b7c296b0bc6a230a |
child 360948 | 4787ff70ae13e6ae43b89a09dd620df5a5ad3824 |
push id | 31905 |
push user | archaeopteryx@coole-files.de |
push date | Sat, 27 May 2017 08:01:29 +0000 |
treeherder | mozilla-central@ebad93e11770 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dbaron, mattwoodrow |
bugs | 1367906 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
layout/generic/nsFrame.cpp | file | annotate | diff | comparison | revisions | |
layout/generic/nsIFrame.h | file | annotate | diff | comparison | revisions |
--- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1008,16 +1008,18 @@ nsFrame::DidSetStyleContext(nsStyleConte // bidi algorithm, we need to call |SetBidiEnabled| on the pres // context before reflow starts. See bug 115921. if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) { PresContext()->SetBidiEnabled(); } RemoveStateBits(NS_FRAME_SIMPLE_EVENT_REGIONS | NS_FRAME_SIMPLE_DISPLAYLIST); + + mMayHaveRoundedCorners = true; } void nsIFrame::ReparentFrameViewTo(nsViewManager* aViewManager, nsView* aNewParentView, nsView* aOldParentView) { if (HasView()) { @@ -1582,32 +1584,40 @@ nsIFrame::OutsetBorderRadii(nscoord aRad } } } /* virtual */ bool nsIFrame::GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea, Sides aSkipSides, nscoord aRadii[8]) const { + if (!mMayHaveRoundedCorners) { + memset(aRadii, 0, sizeof(nscoord) * 8); + return false; + } + 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 // zero. NS_FOR_CSS_HALF_CORNERS(corner) { aRadii[corner] = 0; } return false; } - return ComputeBorderRadii(StyleBorder()->mBorderRadius, - aFrameSize, aBorderArea, - aSkipSides, aRadii); + + const_cast<nsIFrame*>(this)->mMayHaveRoundedCorners = + ComputeBorderRadii(StyleBorder()->mBorderRadius, + aFrameSize, aBorderArea, + aSkipSides, aRadii); + return mMayHaveRoundedCorners; } bool nsIFrame::GetBorderRadii(nscoord aRadii[8]) const { nsSize sz = GetSize(); return GetBorderRadii(sz, sz, GetSkipSides(), aRadii); }
--- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -611,16 +611,17 @@ public: : mRect() , mContent(nullptr) , mStyleContext(nullptr) , mParent(nullptr) , mNextSibling(nullptr) , mPrevSibling(nullptr) , mState(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY) , mClass(aID) + , mMayHaveRoundedCorners(false) { mozilla::PodZero(&mOverflow); } nsPresContext* PresContext() const { return StyleContext()->PresContext(); } @@ -3916,16 +3917,19 @@ protected: } mOverflow; /** @see GetWritingMode() */ mozilla::WritingMode mWritingMode; /** The ClassID of the concrete class of this instance. */ ClassID mClass; // 1 byte + bool mMayHaveRoundedCorners : 1; + // There should be a 15-bit gap left here. + // Helpers /** * Can we stop inside this frame when we're skipping non-rendered whitespace? * @param aForward [in] Are we moving forward (or backward) in content order. * @param aOffset [in/out] At what offset into the frame to start looking. * on output - what offset was reached (whether or not we found a place to stop). * @return STOP: An appropriate offset was found within this frame, * and is given by aOffset.