Commit e28269b6 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

[LayoutNG/PE] Clear visual overflow for LayoutText before setting.

An earlier refactor (*) accidentally removed the clearing of
previous visual overflow before computing a new value.

This has the effect of the visual overflow being too large after
movement or animation, but also overflow of LayoutRect precision
for elements far off-screen.

(*) https://chromium-review.googlesource.com/c/chromium/src/+/1366767

Bug: 950963

Change-Id: Idb0609c814d0acf6058383202063ed34a8caf69e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572924
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652300}
parent 660fa9f0
......@@ -153,8 +153,8 @@ static inline bool LayoutObjectHasAspectRatio(
}
void LayoutReplaced::RecalcVisualOverflow() {
LayoutObject::RecalcVisualOverflow();
ClearVisualOverflow();
LayoutObject::RecalcVisualOverflow();
AddVisualEffectOverflow();
}
......
......@@ -302,6 +302,7 @@ void LayoutSVGText::UpdateLayout() {
}
void LayoutSVGText::RecalcVisualOverflow() {
ClearVisualOverflow();
LayoutObject::RecalcVisualOverflow();
AddSelfVisualOverflow(LayoutRect(ObjectBoundingBox()));
AddVisualEffectOverflow();
......
<!doctype HTML>
<title>Reftest Reference</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org">
<div style="position: relative; overflow: hidden; width: 300px; height: 400px;">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="300px" height="400px">
<text id="target" x="15" y="150">VISIBLE</text>
</svg>
</div>
<script>
let target = document.getElementById('target');
onload = function() {
requestAnimationFrame(() => target.setAttribute('y', 150));
};
</script>
<!doctype HTML>
<title>Test combination of overflow clipping and offscreen SVG text</title>
<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org">
<link rel=match href="text-clipped-offscreen-move-onscreen-ref.html">
<link rel="help" href="https://www.w3.org/TR/SVG11/text.html#TextElement">
<div style="position: relative; overflow: hidden; width: 300px; height: 400px;">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="300px" height="400px">
<text id="target" x="15" y="-50000000000">VISIBLE</text>
</svg>
</div>
<script>
let target = document.getElementById('target');
onload = function() {
requestAnimationFrame(() => target.setAttribute('y', 150));
};
</script>
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