Commit 410f7a06 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[RLS] Correct non-composited fixed background position

We prefer to paint background-attachment: fixed into the scrolling
contents layer if text quality is important (at the cost of repainting
on every scroll). This approach had a bug for the LayoutView if there
turned out to be no scrolling layer (e.g., in a non-composited iframe).
The counterscroll logic in FixedAttachmentPositioningArea should
only apply if actually painting into a scrolling layer. This patch
queries the background compositing state before applying the counter-
scroll. This is safe because it occurs during paint which is after the
compositing decisions have been made.

Bug: 835755
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ieebffb50579b28488ef802736dd1210b8b27b26d
Reviewed-on: https://chromium-review.googlesource.com/1036941Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555814}
parent 6c7df7f7
<!DOCTYPE html>
<div style='background: green; width: 100px; height: 100px;'></div>
<!DOCTYPE html>
<iframe frameborder='0' srcdoc="<!DOCTYPE html>
<style>
::-webkit-scrollbar { display: none; }
body {
background: url('data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'100\' height=\'100\'><rect width=\'100%\' height=\'100%\' fill=\'green\'></rect></svg>') no-repeat fixed;
min-height: 600px;
min-width: 600px;
}
</style>
<script>
onload = function(e) {
document.documentElement.scrollTop = 20;
}
</script>" style="width: 100px; height: 100px;"></iframe>
......@@ -455,8 +455,12 @@ LayoutRect FixedAttachmentPositioningArea(const LayoutBoxModelObject& obj,
if (RuntimeEnabledFeatures::RootLayerScrollingEnabled()) {
// The LayoutView is the only object that can paint a fixed background into
// its scrolling contents layer, so it gets a special adjustment here.
if (obj.IsLayoutView())
rect.SetLocation(IntPoint(ToLayoutView(obj).ScrolledContentOffset()));
if (obj.IsLayoutView()) {
CompositedLayerMapping* mapping =
obj.Layer()->GetCompositedLayerMapping();
if (mapping && mapping->BackgroundPaintsOntoScrollingContentsLayer())
rect.SetLocation(IntPoint(ToLayoutView(obj).ScrolledContentOffset()));
}
} else {
rect.SetLocation(IntPoint(frame_view->ScrollOffsetInt()));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment