Bug 699351. Add nsIFrameLoader::clipSubdocument API to allow XUL <iframe> and <browser> to not clip the subdocument. r=tnikkel,sr=bzbarsky

This commit is contained in:
Robert O'Callahan
2011-12-06 01:38:46 +13:00
parent c4289292a7
commit 3b84648234
15 changed files with 376 additions and 70 deletions

View File

@@ -6439,13 +6439,17 @@ nsFrame::CreateAccessible()
NS_DECLARE_FRAME_PROPERTY(OverflowAreasProperty,
nsIFrame::DestroyOverflowAreas)
void
bool
nsIFrame::ClearOverflowRects()
{
if (mOverflow.mType == NS_FRAME_OVERFLOW_NONE) {
return false;
}
if (mOverflow.mType == NS_FRAME_OVERFLOW_LARGE) {
Properties().Delete(OverflowAreasProperty());
}
mOverflow.mType = NS_FRAME_OVERFLOW_NONE;
return true;
}
/** Create or retrieve the previously stored overflow area, if the frame does
@@ -6473,17 +6477,18 @@ nsIFrame::GetOverflowAreasProperty()
/** Set the overflowArea rect, storing it as deltas or a separate rect
* depending on its size in relation to the primary frame rect.
*/
void
bool
nsIFrame::SetOverflowAreas(const nsOverflowAreas& aOverflowAreas)
{
if (mOverflow.mType == NS_FRAME_OVERFLOW_LARGE) {
nsOverflowAreas *overflow =
static_cast<nsOverflowAreas*>(Properties().Get(OverflowAreasProperty()));
bool changed = *overflow != aOverflowAreas;
*overflow = aOverflowAreas;
// Don't bother with converting to the deltas form if we already
// have a property.
return;
return changed;
}
const nsRect& vis = aOverflowAreas.VisualOverflow();
@@ -6505,6 +6510,7 @@ nsIFrame::SetOverflowAreas(const nsOverflowAreas& aOverflowAreas)
// so that our eventual SetRect/SetSize will know that it has to
// reset our overflow areas.
(l | t | r | b) != 0) {
VisualDeltas oldDeltas = mOverflow.mVisualDeltas;
// It's a "small" overflow area so we store the deltas for each edge
// directly in the frame, rather than allocating a separate rect.
// If they're all zero, that's fine; we're setting things to
@@ -6513,12 +6519,18 @@ nsIFrame::SetOverflowAreas(const nsOverflowAreas& aOverflowAreas)
mOverflow.mVisualDeltas.mTop = t;
mOverflow.mVisualDeltas.mRight = r;
mOverflow.mVisualDeltas.mBottom = b;
// There was no scrollable overflow before, and there isn't now.
return oldDeltas != mOverflow.mVisualDeltas;
} else {
bool changed = !aOverflowAreas.ScrollableOverflow().IsEqualEdges(nsRect(nsPoint(0, 0), GetSize())) ||
!aOverflowAreas.VisualOverflow().IsEqualEdges(GetVisualOverflowFromDeltas());
// it's a large overflow area that we need to store as a property
mOverflow.mType = NS_FRAME_OVERFLOW_LARGE;
nsOverflowAreas* overflow = GetOverflowAreasProperty();
NS_ASSERTION(overflow, "should have created areas");
*overflow = aOverflowAreas;
return changed;
}
}
@@ -6529,7 +6541,7 @@ IsInlineFrame(nsIFrame *aFrame)
return type == nsGkAtoms::inlineFrame;
}
void
bool
nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsSize aNewSize)
{
@@ -6638,11 +6650,11 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
bool visualOverflowChanged =
!GetVisualOverflowRect().IsEqualInterior(aOverflowAreas.VisualOverflow());
bool anyOverflowChanged;
if (aOverflowAreas != nsOverflowAreas(bounds, bounds)) {
SetOverflowAreas(aOverflowAreas);
anyOverflowChanged = SetOverflowAreas(aOverflowAreas);
} else {
ClearOverflowRects();
anyOverflowChanged = ClearOverflowRects();
}
if (visualOverflowChanged) {
@@ -6687,6 +6699,8 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsDisplayItem::TYPE_TRANSFORM);
}
}
return anyOverflowChanged;
}
/* The overflow rects for leaf nodes in a preserve-3d hierarchy depends on