Skip to content

Instantly share code, notes, and snippets.

@Gankra
Created April 11, 2019 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gankra/41eed3144c01fb3c1a15117f4723aac8 to your computer and use it in GitHub Desktop.
Save Gankra/41eed3144c01fb3c1a15117f4723aac8 to your computer and use it in GitHub Desktop.
void DisplayListBuilder::PushShadow(const wr::LayoutRect& aRect,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
const wr::Shadow& aShadow) {
// Local clip_rects are translated inside of shadows, as they are assumed to
// be part of the element drawing itself, and not a parent frame clipping it.
// As such, it is not sound to apply the MergeClipLeaf optimization inside of
// shadows. So we disable the optimization when we encounter a shadow.
// Shadows don't span frames, so we don't have to worry about MergeClipLeaf
// being re-enabled mid-shadow. The optimization is restored in PopAllShadows.
SuspendClipLeafMerging();
wr_dp_push_shadow(mWrState, aRect, aClip, aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aShadow);
}
void DisplayListBuilder::PopAllShadows() {
wr_dp_pop_all_shadows(mWrState);
ResumeClipLeafMerging();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment