Bug 1509044 - FrameLoader.clipSubdocument is unused. r=jwatt,smaug

Plus it generally doesn't work for e10s, etc. etc.

Differential Revision: https://phabricator.services.mozilla.com/D12547

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-11-21 20:06:15 +00:00
parent f398585595
commit cf56163d41
14 changed files with 10 additions and 239 deletions

View File

@ -179,7 +179,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, nsPIDOMWindowOuter* aOpener,
, mLoadingOriginalSrc(false)
, mRemoteBrowserShown(false)
, mRemoteFrame(false)
, mClipSubdocument(true)
, mClampScrollPosition(true)
, mObservingOwnerContent(false)
{
@ -2422,30 +2421,6 @@ nsFrameLoader::LazyHeight() const
return lazyHeight;
}
void
nsFrameLoader::SetClipSubdocument(bool aClip)
{
mClipSubdocument = aClip;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
frame->InvalidateFrame();
frame->PresShell()->
FrameNeedsReflow(frame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
nsSubDocumentFrame* subdocFrame = do_QueryFrame(frame);
if (subdocFrame) {
nsIFrame* subdocRootFrame = subdocFrame->GetSubdocumentRootFrame();
if (subdocRootFrame) {
nsIFrame* subdocRootScrollFrame = subdocRootFrame->PresShell()->
GetRootScrollFrame();
if (subdocRootScrollFrame) {
frame->PresShell()->
FrameNeedsReflow(frame, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
}
}
}
}
}
void
nsFrameLoader::SetClampScrollPosition(bool aClamp)
{

View File

@ -199,9 +199,6 @@ public:
bool ClampScrollPosition() const { return mClampScrollPosition; }
void SetClampScrollPosition(bool aClamp);
bool ClipSubdocument() const { return mClipSubdocument; }
void SetClipSubdocument(bool aClip);
bool DepthTooGreat() const { return mDepthTooGreat; }
bool IsDead() const { return mDestroyCalled; }
@ -301,7 +298,6 @@ public:
mozilla::dom::ChromeMessageSender* GetFrameMessageManager() { return mMessageManager; }
mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
bool ShouldClipSubdocument() { return mClipSubdocument; }
bool ShouldClampScrollPosition() { return mClampScrollPosition; }
@ -497,7 +493,6 @@ private:
bool mRemoteBrowserShown : 1;
bool mRemoteFrame : 1;
bool mClipSubdocument : 1;
bool mClampScrollPosition : 1;
bool mObservingOwnerContent : 1;
};

View File

@ -132,13 +132,6 @@ interface FrameLoader {
double scale,
DOMString backgroundColor);
/**
* If false, then the subdocument is not clipped to its CSS viewport, and the
* subdocument's viewport scrollbar(s) are not rendered.
* Defaults to true.
*/
attribute boolean clipSubdocument;
/**
* The element which owns this frame loader.
*

View File

@ -8,8 +8,6 @@ support-files =
default_background_window.xul
dialog_with_positioning_window.xul
file_bug458898.html
no_clip_iframe_subdoc.html
no_clip_iframe_window.xul
printpreview_bug396024_helper.xul
printpreview_bug482976_helper.xul
printpreview_helper.xul
@ -46,7 +44,6 @@ tags = openwindow
[test_fixed_bg_scrolling_repaints.html]
[test_leaf_layers_partition_browser_window.xul]
skip-if = true # Bug 992311
[test_no_clip_iframe.xul]
[test_prerendered_transforms.html]
[test_printpreview.xul]
skip-if = (os == "linux" && bits == 32) || (verify && (os == 'win')) # Disabled on Linux32 for bug 1278957

View File

@ -1,7 +0,0 @@
<!DOCTYPE HTML>
<html>
<body style="margin:0; background:lime;">
<div id="d" style="position:relative; top:-50px; width:150px; height:250px; background:yellow;"></div>
<div id="p" style="margin-top:-50px; width:150px; height:50px;"></div>
</body>
</html>

View File

@ -1,95 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTests()">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<div id="container" xmlns="http://www.w3.org/1999/xhtml" style="height:400px; overflow:auto; background:gray">
<div style="height:0">
<iframe type="content" id="f" src="no_clip_iframe_subdoc.html"
style="margin-top:50px; border:1px solid black; width:100px; height:100px;"/>
</div>
<div id="ref" style="background:gray;">
<div style="border:1px solid black; margin-top:50px; width:100px; height:100px;">
<div id="ref-d" style="background:lime; height:250px; width:150px;">
<div style="position:relative; top:-50px; width:150px; height:100%; background:yellow;"/>
</div>
</div>
</div>
</div>
<vbox flex="1"/>
<script type="application/javascript">
<![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
for (var name of imports) {
window[name] = window.opener.wrappedJSObject[name];
}
SimpleTest.waitForExplicitFinish();
var frame = document.getElementById("f");
var fl = frame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
is(fl.clipSubdocument, true, "clipSubdocument should default to true");
fl.clipSubdocument = false;
is(fl.clipSubdocument, false, "clipSubdocument should have been set to false");
function runTests() {
var ref = document.getElementById("ref");
frame.contentWindow.scrollTo(0,0);
ref.style.visibility = "hidden";
var testCanvas = snapshotWindow(window);
ref.style.visibility = "";
var refCanvas = snapshotWindow(window);
var comparison = compareSnapshots(testCanvas, refCanvas, true);
ok(comparison[0], "Basic overflow drawing; got " + comparison[1] + ", expected " + comparison[2]);
document.getElementById("container").style.height = "200px";
ref.style.visibility = "hidden";
testCanvas = snapshotWindow(window);
ref.style.visibility = "";
refCanvas = snapshotWindow(window);
comparison = compareSnapshots(testCanvas, refCanvas, true);
ok(comparison[0], "Drawing with vertical scrollbar to show overflow area computation; got " +
comparison[1] + ", expected " + comparison[2]);
frame.contentDocument.getElementById("d").style.height = "350px";
document.getElementById("ref-d").style.height = "350px";
ref.style.visibility = "hidden";
testCanvas = snapshotWindow(window);
ref.style.visibility = "";
refCanvas = snapshotWindow(window);
comparison = compareSnapshots(testCanvas, refCanvas, true);
ok(comparison[0], "testing dynamic overflow area change affecting scrollbar; got " +
comparison[1] + ", expected " + comparison[2]);
// Now do invalidation tests
ref.style.visibility = "hidden";
document.getElementById("container").style.height = "400px";
waitForAllPaintsFlushed(function() {
frame.contentWindow.scrollTo(0,80);
waitForAllPaintsFlushed(function(x1, y1, x2, y2) {
ok(x1 <= 1 && x2 >= 151 && y1 <= 0 && y2 >= 400,
"Entire scrolled region is painted: " + x1 + "," + y1 + "," + x2 + "," + y2);
frame.contentDocument.getElementById("p").style.background = "cyan";
waitForAllPaintsFlushed(function(x1, y1, x2, y2) {
ok(x1 <= 1 && x2 >= 151 && y1 <= 271 && y2 >= 320,
"Entire updated region is painted: " + x1 + "," + y1 + "," + x2 + "," + y2);
var tester = window.SimpleTest;
window.close();
tester.finish();
}, frame.contentDocument);
});
});
}
]]>
</script>
</window>

View File

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
// Run the test in a separate window so that the test runs as a chrome
// window
window.open("no_clip_iframe_window.xul", "no_clip_iframe",
"chrome,width=200,height=400");
]]>
</script>
</window>

View File

@ -374,16 +374,11 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
}
nsRect rect = AdjustReflowInputAsContainingBlock(&reflowInput);
nsOverflowAreas* overflowAreas = &aDesiredSize.mOverflowAreas;
nsIScrollableFrame* rootScrollFrame =
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
overflowAreas = nullptr;
}
AbsPosReflowFlags flags =
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowInput, aStatus,
rect, flags, overflowAreas);
GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowInput,
aStatus, rect, flags,
/* aOverflowAreas = */ nullptr);
}
if (mFrames.NotEmpty()) {
@ -397,34 +392,12 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
// Clipping is handled by the document container (e.g., nsSubDocumentFrame),
// so we don't need to change our overflow areas.
bool overflowChanged = FinishAndStoreOverflow(&aDesiredSize);
if (overflowChanged) {
// We may need to alert our container to get it to pick up the
// overflow change.
nsSubDocumentFrame* container = static_cast<nsSubDocumentFrame*>
(nsLayoutUtils::GetCrossDocParentFrame(this));
if (container && !container->ShouldClipSubdocument()) {
container->PresShell()->
FrameNeedsReflow(container, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
}
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
bool
ViewportFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
{
nsIScrollableFrame* rootScrollFrame =
PresShell()->GetRootScrollFrameAsScrollable();
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
return false;
}
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
}
void
ViewportFrame::UpdateStyle(ServoRestyleState& aRestyleState)
{

View File

@ -65,7 +65,10 @@ public:
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
bool ComputeCustomOverflow(nsOverflowAreas&) override
{
return false;
}
/**
* Adjust aReflowInput to account for scrollbars and pres shell

View File

@ -1163,10 +1163,6 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
}
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (mHelper.IsIgnoringViewportClipping()) {
aDesiredSize.mOverflowAreas.UnionWith(
state.mContentsOverflowAreas + mHelper.mScrolledFrame->GetPosition());
}
mHelper.UpdateSticky();
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
@ -2529,15 +2525,6 @@ static void AdjustViews(nsIFrame* aFrame)
}
}
bool ScrollFrameHelper::IsIgnoringViewportClipping() const
{
if (!mIsRoot)
return false;
nsSubDocumentFrame* subdocFrame = static_cast<nsSubDocumentFrame*>
(nsLayoutUtils::GetCrossDocParentFrame(mOuter->PresShell()->GetRootFrame()));
return subdocFrame && !subdocFrame->ShouldClipSubdocument();
}
void ScrollFrameHelper::MarkScrollbarsDirtyForReflow() const
{
nsIPresShell* presShell = mOuter->PresShell();
@ -3442,7 +3429,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// because that call cannot create a displayport for root scroll frames,
// and hence it cannot create an ignore scroll frame.
bool ignoringThisScrollFrame =
aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping();
aBuilder->GetIgnoreScrollFrame() == mOuter;
// Overflow clipping can never clip frames outside our subtree, so there
// is no need to worry about whether we are a moving frame that might clip

View File

@ -409,8 +409,6 @@ public:
const nsRect& aContentArea,
const nsRect& aOldScrollArea);
bool IsIgnoringViewportClipping() const;
void MarkScrollbarsDirtyForReflow() const;
bool ShouldClampScrollPosition() const;
@ -1016,9 +1014,6 @@ public:
{
mHelper.ClipLayerToDisplayPort(aLayer, aClip, aParameters);
}
virtual bool IsIgnoringViewportClipping() const override {
return mHelper.IsIgnoringViewportClipping();
}
virtual void MarkScrollbarsDirtyForReflow() const override {
mHelper.MarkScrollbarsDirtyForReflow();
}
@ -1475,9 +1470,6 @@ public:
const ContainerLayerParameters& aParameters) const override {
mHelper.ClipLayerToDisplayPort(aLayer, aClip, aParameters);
}
virtual bool IsIgnoringViewportClipping() const override {
return mHelper.IsIgnoringViewportClipping();
}
virtual void MarkScrollbarsDirtyForReflow() const override {
mHelper.MarkScrollbarsDirtyForReflow();
}

View File

@ -437,11 +437,6 @@ public:
const mozilla::DisplayItemClip* aClip,
const ContainerLayerParameters& aParameters) const = 0;
/**
* If this scroll frame is ignoring viewporting clipping
*/
virtual bool IsIgnoringViewportClipping() const = 0;
/**
* Mark the scrollbar frames for reflow.
*/

View File

@ -448,9 +448,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (ShouldClipSubdocument()) {
clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
}
clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
nsIScrollableFrame *sf = presShell->GetRootScrollFrameAsScrollable();
bool constructResolutionItem = subdocRootFrame &&
@ -852,12 +850,6 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
}
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (!ShouldClipSubdocument()) {
nsIFrame* subdocRootFrame = GetSubdocumentRootFrame();
if (subdocRootFrame) {
aDesiredSize.mOverflowAreas.UnionWith(subdocRootFrame->GetOverflowAreas() + offset);
}
}
FinishAndStoreOverflow(&aDesiredSize);

View File

@ -115,12 +115,6 @@ public:
bool ReflowFinished() override;
void ReflowCallbackCanceled() override;
bool ShouldClipSubdocument()
{
nsFrameLoader* frameLoader = FrameLoader();
return !frameLoader || frameLoader->ShouldClipSubdocument();
}
bool ShouldClampScrollPosition()
{
nsFrameLoader* frameLoader = FrameLoader();