Bug 1147673 - Use ancestor clip for root scrollable framemetrics clips. r=tn

--HG--
extra : commitid : 8i9bmvj9S6Y
extra : rebase_source : 6316afb1c7967fd944281f0686b2c6ba7379606f
extra : histedit_source : 1289a445613a59b213b79396a60076ebc4e83beb
This commit is contained in:
Markus Stange 2015-11-05 17:54:44 +01:00
Родитель 2d178ca987
Коммит 9079fbe047
1 изменённых файлов: 23 добавлений и 31 удалений

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

@ -3045,19 +3045,27 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// clipStatePtr will always point to the innermost used one.
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
DisplayListClipState::AutoSaveRestore* clipStatePtr = &clipState;
if (!mIsRoot || !usingDisplayPort) {
nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
nscoord radii[8];
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
// Our override of GetBorderRadii ensures we never have a radius at
// the corners where we have a scrollbar.
if (mClipAllDescendants) {
clipState.ClipContentDescendants(clip, haveRadii ? radii : nullptr);
} else {
clipState.ClipContainingBlockDescendants(clip, haveRadii ? radii : nullptr);
nsRect clipRect = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
// Our override of GetBorderRadii ensures we never have a radius at
// the corners where we have a scrollbar.
nscoord radii[8];
bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
if (mIsRoot) {
clipRect.SizeTo(nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
if (mOuter->PresContext()->IsRootContentDocument()) {
double res = mOuter->PresContext()->PresShell()->GetResolution();
clipRect.width = NSToCoordRound(clipRect.width / res);
clipRect.height = NSToCoordRound(clipRect.height / res);
}
}
if (mClipAllDescendants) {
clipState.ClipContentDescendants(clipRect, haveRadii ? radii : nullptr);
} else {
clipState.ClipContainingBlockDescendants(clipRect, haveRadii ? radii : nullptr);
}
Maybe<DisplayListClipState::AutoSaveRestore> clipStateCaret;
if (contentBoxClipForCaret) {
clipStateCaret.emplace(aBuilder);
@ -3263,34 +3271,18 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer,
return Nothing();
}
bool needsParentLayerClip = true;
if (gfxPrefs::LayoutUseContainersForRootFrames() && !mAddClipRectToLayer) {
// For containerful frames, the clip is on the container frame.
needsParentLayerClip = false;
}
const Maybe<DisplayItemClip>& ancestorClip = aIsForCaret ? mAncestorClipForCaret : mAncestorClip;
nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(aContainerReferenceFrame);
bool isRootContent = mIsRoot && mOuter->PresContext()->IsRootContentDocument();
Maybe<nsRect> parentLayerClip;
if (needsParentLayerClip) {
nsRect clip = nsRect(mScrollPort.TopLeft() + toReferenceFrame,
nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
if (isRootContent) {
double res = mOuter->PresContext()->PresShell()->GetResolution();
clip.width = NSToCoordRound(clip.width / res);
clip.height = NSToCoordRound(clip.height / res);
}
if (ancestorClip && ancestorClip->HasClip()) {
clip = ancestorClip->GetClipRect().Intersect(clip);
}
parentLayerClip = Some(clip);
// For containerful frames, the clip is on the container layer.
if (ancestorClip &&
(!gfxPrefs::LayoutUseContainersForRootFrames() || mAddClipRectToLayer)) {
parentLayerClip = Some(ancestorClip->GetClipRect());
}
bool isRootContent = mIsRoot && mOuter->PresContext()->IsRootContentDocument();
bool thisScrollFrameUsesAsyncScrolling = nsLayoutUtils::UsesAsyncScrolling(mOuter);
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ)
// Android without apzc (aka the java pan zoom code) only uses async scrolling