Bug 1319407 - Apply clip-path to each frame when box-decoration-break is clone. r=cjku,heycam

MozReview-Commit-ID: E7IR49MzkWm

--HG--
extra : rebase_source : 79f482236ad377948f94a69e2648d07a24a49e2b
This commit is contained in:
Louis Chang 2017-07-24 11:14:47 +08:00
Родитель b7cdac9039
Коммит 29abcbcdde
4 изменённых файлов: 39 добавлений и 6 удалений

Просмотреть файл

@ -3910,9 +3910,9 @@ nsLayoutUtils::BinarySearchForPosition(DrawTarget* aDrawTarget,
return false;
}
static void
AddBoxesForFrame(nsIFrame* aFrame,
nsLayoutUtils::BoxCallback* aCallback)
void
nsLayoutUtils::AddBoxesForFrame(nsIFrame* aFrame,
nsLayoutUtils::BoxCallback* aCallback)
{
nsIAtom* pseudoType = aFrame->StyleContext()->GetPseudo();

Просмотреть файл

@ -1154,6 +1154,11 @@ public:
*/
static void GetAllInFlowBoxes(nsIFrame* aFrame, BoxCallback* aCallback);
/**
* Like GetAllInFlowBoxes, but doesn't include continuations.
*/
static void AddBoxesForFrame(nsIFrame* aFrame, BoxCallback* aCallback);
/**
* Find the first frame descendant of aFrame (including aFrame) which is
* not an anonymous frame that getBoxQuads/getClientRects should ignore.

Просмотреть файл

@ -8581,6 +8581,12 @@ bool nsDisplayMask::TryMerge(nsDisplayItem* aItem)
if (aItem->GetType() != TYPE_MASK)
return false;
// Do not merge items for box-decoration-break:clone elements,
// since each box should have its own mask in that case.
if (mFrame->StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Clone) {
return false;
}
// items for the same content element should be merged into a single
// compositing group
// aItem->GetUnderlyingFrame() returns non-null because it's nsDisplaySVGEffects

Просмотреть файл

@ -137,6 +137,21 @@ GetPreEffectsVisualOverflowUnion(nsIFrame* aFirstContinuation,
return collector.GetResult() + aFirstContinuationToUserSpace;
}
static nsRect
GetPreEffectsVisualOverflow(nsIFrame* aFirstContinuation,
nsIFrame* aCurrentFrame,
const nsPoint& aFirstContinuationToUserSpace)
{
PreEffectsVisualOverflowCollector collector(aFirstContinuation,
nullptr,
nsRect(),
false);
// Compute overflow areas of current frame relative to aFirstContinuation:
nsLayoutUtils::AddBoxesForFrame(aCurrentFrame, &collector);
// Return the result in user space:
return collector.GetResult() + aFirstContinuationToUserSpace;
}
bool
nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
@ -211,9 +226,16 @@ nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame)
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
// 'r' is in "user space":
nsRect r = GetPreEffectsVisualOverflowUnion(firstFrame, nullptr, nsRect(),
GetOffsetToBoundingBox(firstFrame),
false);
nsRect r;
if (aNonSVGFrame->StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Clone) {
r = GetPreEffectsVisualOverflow(firstFrame, aNonSVGFrame,
GetOffsetToBoundingBox(firstFrame));
} else {
r = GetPreEffectsVisualOverflowUnion(firstFrame, nullptr, nsRect(),
GetOffsetToBoundingBox(firstFrame),
false);
}
return nsLayoutUtils::RectToGfxRect(r,
aNonSVGFrame->PresContext()->AppUnitsPerCSSPixel());
}