Allow use of display-port in non-e10s situations (WIP)

This patch adds some checks in nsGfxScrollFrame and nsSubDocumentFrame that
extend the clipping rectangle so that the display-port property is useful in
non-e10s circumstances.

WIP.
This commit is contained in:
Doug Turner 2011-11-07 14:15:22 -08:00
parent 0b8f8d6dec
commit ae6a3a7449
2 changed files with 28 additions and 2 deletions

View File

@ -1986,7 +1986,7 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
NS_ENSURE_SUCCESS(rv, rv);
// Since making new layers is expensive, only use nsDisplayScrollLayer
// if the area is scrollable.
// if the area is scrollable or a display port has been set.
nsRect scrollRange = GetScrollRange();
ScrollbarStyles styles = GetScrollbarStylesFromFrame();
mShouldBuildLayer =
@ -1997,7 +1997,7 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
scrollRange.height > 0) &&
(!mIsRoot || !mOuter->PresContext()->IsRootContentDocument()));
if (ShouldBuildLayer()) {
if (usingDisplayport || ShouldBuildLayer()) {
// ScrollLayerWrapper must always be created because it initializes the
// scroll layer count. The display lists depend on this.
ScrollLayerWrapper wrapper(mOuter, mScrolledFrame);
@ -2020,6 +2020,14 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect clip;
clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
// Make sure to expand the clipping rectangle if we're using a displayport
if (usingDisplayport) {
if (dirtyRect.width > clip.width)
clip.width = dirtyRect.width;
if (dirtyRect.height > clip.height)
clip.height = dirtyRect.height;
}
nscoord radii[8];
// Our override of GetBorderRadii ensures we never have a radius at
// the corners where we have a scrollbar.

View File

@ -417,6 +417,24 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsDisplayList list;
// Clip children to the child root frame's rectangle
// Expand the clip rectangle if this element has a display port set
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
if (rootScrollFrame) {
nsIContent* content = rootScrollFrame->GetContent();
if (content) {
nsRect displayPort;
bool usingDisplayport =
nsLayoutUtils::GetDisplayPort(content, &displayPort);
if (usingDisplayport) {
if (displayPort.width > subdocBoundsInParentUnits.width)
subdocBoundsInParentUnits.width = displayPort.width;
if (displayPort.height > subdocBoundsInParentUnits.height)
subdocBoundsInParentUnits.height = displayPort.height;
}
}
}
rv = list.AppendNewToTop(
new (aBuilder) nsDisplayClip(aBuilder, this, &childItems,
subdocBoundsInParentUnits));