зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273250
- Factor out a helper function to calculate the viewport rect. r=mstange
MozReview-Commit-ID: ACJayEWplCY --HG-- extra : rebase_source : 22ef189053bd80e3f8faaa10fb239031f8010587 extra : histedit_source : 510dbd0887b2cecc5366d0be1cb380ec7efb3d0d
This commit is contained in:
Родитель
56733050cb
Коммит
4b2d2e68d3
|
@ -2352,6 +2352,20 @@ RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|||
}
|
||||
}
|
||||
|
||||
// Return the bounds of the viewport relative to |aFrame|'s reference frame.
|
||||
// Returns Nothing() if transforming into |aFrame|'s coordinate space fails.
|
||||
static Maybe<nsRect>
|
||||
GetViewportRectRelativeToReferenceFrame(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* rootFrame = aFrame->PresContext()->PresShell()->GetRootFrame();
|
||||
nsRect rootRect = rootFrame->GetRectRelativeToSelf();
|
||||
if (nsLayoutUtils::TransformRect(rootFrame, aFrame, rootRect) == nsLayoutUtils::TRANSFORM_SUCCEEDED) {
|
||||
return Some(rootRect + aBuilder->ToReferenceFrame(aFrame));
|
||||
}
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
uint32_t aLayer,
|
||||
|
@ -3049,10 +3063,8 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
|||
// If this is a background-attachment:fixed image, and APZ is enabled,
|
||||
// async scrolling could reveal additional areas of the image, so don't
|
||||
// clip it beyond clipping to the document's viewport.
|
||||
nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
|
||||
nsRect rootRect = rootFrame->GetRectRelativeToSelf();
|
||||
if (nsLayoutUtils::TransformRect(rootFrame, mFrame, rootRect) == nsLayoutUtils::TRANSFORM_SUCCEEDED) {
|
||||
clipRect = clipRect.Union(rootRect + aBuilder->ToReferenceFrame(mFrame));
|
||||
if (Maybe<nsRect> viewportRect = GetViewportRectRelativeToReferenceFrame(aBuilder, mFrame)) {
|
||||
clipRect = clipRect.Union(*viewportRect);
|
||||
}
|
||||
}
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
|
|
Загрузка…
Ссылка в новой задаче