Bug 1394309 - Part4. Take the border clip as an extra clip. r=kats

MozReview-Commit-ID: 8I5NTxk538c

--HG--
extra : rebase_source : 4c2f8d920612ab8420e17cd459ad7f7bb87c6dc6
This commit is contained in:
Ethan Lin 2017-10-11 17:33:35 +08:00
Родитель dfd3f86ae6
Коммит c060e4e17c
4 изменённых файлов: 17 добавлений и 17 удалений

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

@ -150,7 +150,7 @@ ScrollingLayersHelper::DefineAndPushChain(const DisplayItemClipChain* aChain,
// This item in the chain is a no-op, skip over it
return;
}
if (!clipId || aBuilder.HasMaskClip()) {
if (!clipId || aBuilder.HasExtraClip()) {
// If we don't have a clip id for this chain item yet, define the clip in WR
// and save the id
LayoutDeviceRect clip = LayoutDeviceRect::FromAppUnits(
@ -158,7 +158,7 @@ ScrollingLayersHelper::DefineAndPushChain(const DisplayItemClipChain* aChain,
nsTArray<wr::ComplexClipRegion> wrRoundedRects;
aChain->mClip.ToComplexClipRegions(aAppUnitsPerDevPixel, aStackingContext, wrRoundedRects);
clipId = Some(aBuilder.DefineClip(aStackingContext.ToRelativeLayoutRect(clip), &wrRoundedRects));
if (!aBuilder.HasMaskClip()) {
if (!aBuilder.HasExtraClip()) {
aCache[aChain] = clipId.value();
}
}

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

@ -625,7 +625,7 @@ WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent> aEvent)
DisplayListBuilder::DisplayListBuilder(PipelineId aId,
const wr::LayoutSize& aContentSize,
size_t aCapacity)
: mMaskClipCount(0)
: mExtraClipCount(0)
{
MOZ_COUNT_CTOR(DisplayListBuilder);
mWrState = wr_state_new(aId, aContentSize, aCapacity);
@ -699,25 +699,25 @@ DisplayListBuilder::DefineClip(const wr::LayoutRect& aClipRect,
}
void
DisplayListBuilder::PushClip(const wr::WrClipId& aClipId, bool aMask)
DisplayListBuilder::PushClip(const wr::WrClipId& aClipId, bool aExtra)
{
wr_dp_push_clip(mWrState, aClipId.id);
WRDL_LOG("PushClip id=%" PRIu64 "\n", mWrState, aClipId.id);
if (!aMask) {
if (!aExtra) {
mClipIdStack.push_back(aClipId);
} else {
mMaskClipCount++;
mExtraClipCount++;
}
}
void
DisplayListBuilder::PopClip(bool aMask)
DisplayListBuilder::PopClip(bool aExtra)
{
WRDL_LOG("PopClip id=%" PRIu64 "\n", mWrState, mClipIdStack.back().id);
if (!aMask) {
if (!aExtra) {
mClipIdStack.pop_back();
} else {
mMaskClipCount--;
mExtraClipCount--;
}
wr_dp_pop_clip(mWrState);
}

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

@ -225,8 +225,8 @@ public:
wr::WrClipId DefineClip(const wr::LayoutRect& aClipRect,
const nsTArray<wr::ComplexClipRegion>* aComplex = nullptr,
const wr::WrImageMask* aMask = nullptr);
void PushClip(const wr::WrClipId& aClipId, bool aMask = false);
void PopClip(bool aMask = false);
void PushClip(const wr::WrClipId& aClipId, bool aExtra = false);
void PopClip(bool aExtra = false);
wr::WrStickyId DefineStickyFrame(const wr::LayoutRect& aContentRect,
const wr::StickySideConstraint* aTop,
@ -399,8 +399,8 @@ public:
// Try to avoid using this when possible.
wr::WrState* Raw() { return mWrState; }
// Return true if the current clip stack has any mask type clip.
bool HasMaskClip() { return mMaskClipCount > 0; }
// Return true if the current clip stack has any extra clip.
bool HasExtraClip() { return mExtraClipCount > 0; }
protected:
wr::WrState* mWrState;
@ -417,8 +417,8 @@ protected:
// ensure that we don't define a particular scroll layer multiple times.
std::unordered_map<layers::FrameMetrics::ViewID, Maybe<layers::FrameMetrics::ViewID>> mScrollParents;
// The number of mask clips that are in the stack.
uint32_t mMaskClipCount;
// The number of extra clips that are in the stack.
uint32_t mExtraClipCount;
friend class WebRenderAPI;
};

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

@ -3622,7 +3622,7 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
LayoutDeviceRect clip = LayoutDeviceRect::FromUnknownRect(mLocalClip.value());
wr::LayoutRect clipRect = aSc.ToRelativeLayoutRect(clip);
wr::WrClipId clipId = aBuilder.DefineClip(clipRect);
aBuilder.PushClip(clipId);
aBuilder.PushClip(clipId, true);
}
Range<const wr::BorderSide> wrsides(side, 4);
@ -3634,7 +3634,7 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
borderRadius);
if (mLocalClip) {
aBuilder.PopClip();
aBuilder.PopClip(true);
}
}