-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix render tree construction when inlines are inserted in reverse aft…
…er a block in a continuation https://bugs.webkit.org/show_bug.cgi?id=274762 rdar://problem/128826228 Reviewed by Darin Adler. This patch aligns WebKit with Blink / Chromium and Gecko / Firefox. Merge: https://chromium.googlesource.com/chromium/blink/+/6ac676e5e68e3271321b9c8236192b6a530d055e When inserting inlines after a block inside of an inline continuation, if we insert inline content in reverse DOM order, we can (depending on when we attach) end up appending the renderers in the wrong location, leading to visual aberrations. The fix is in RenderTreeBuilder, where we should always attach behind our beforeChild if we're inserting an inline and beforeChild is an inline, regardless of other continuation state. * Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp: (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation): * LayoutTests/fast/inline/continuation-inlines-inserted-in-reverse-after-block.html: Add Test Case * LayoutTests/fast/inline/continuation-inlines-inserted-in-reverse-after-block-expected.txt: Add Test Case Expectation * LayoutTests/platform/mac/tables/mozilla/bugs/bug113235-3-expected.txt: Rebaselined * LayoutTests/platform/mac/tables/mozilla/bugs/bug113235-3-expected.png: Ditto * LayoutTests/platform/glib/tables/mozilla/bugs/bug113235-3-expected.txt: Ditto * LayoutTests/platform/ios/tables/mozilla/bugs/bug113235-3-expected.txt: Ditto Canonical link: https://commits.webkit.org/279422@main
- Loading branch information
Ahmad Saleem
committed
May 29, 2024
1 parent
8e02837
commit 4af8f05
Showing
7 changed files
with
186 additions
and
14 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
LayoutTests/fast/inline/continuation-inlines-inserted-in-reverse-after-block-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
You should see two lines, both with 1,2,3. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS document.getElementById('3').offsetLeft is >= document.getElementById('2').offsetLeft | ||
PASS document.getElementById('2').offsetLeft is >= document.getElementById('1').offsetLeft | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
1,2,3, | ||
1,2,3, | ||
|
33 changes: 33 additions & 0 deletions
33
LayoutTests/fast/inline/continuation-inlines-inserted-in-reverse-after-block.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/js-test.js"></script> | ||
<div id="console"></div> | ||
|
||
<span id="container"></span> | ||
<span id="reference"><div></div><span>1,</span><span>2,</span><span>3,</span><div></div></span> | ||
|
||
<script> | ||
description('You should see two lines, both with 1,2,3.'); | ||
var last; | ||
|
||
function insert(tagName, id) | ||
{ | ||
last = container.insertBefore(document.createElement(tagName), last); | ||
if (id) | ||
last.id = id; | ||
getComputedStyle(last).color; // attach. | ||
return last; | ||
} | ||
|
||
var container = document.getElementById('container'); | ||
var div = container.appendChild(document.createElement('div')); | ||
getComputedStyle(div).color; // attach. | ||
|
||
// This inserts the elements in the reverse order they appear in the DOM | ||
// calling layout() | ||
insert('div'); | ||
insert('span', 3).textContent = '3,'; | ||
insert('span', 2).textContent = '2,'; | ||
insert('span', 1).textContent = '1,'; | ||
shouldBeGreaterThanOrEqual("document.getElementById('3').offsetLeft", "document.getElementById('2').offsetLeft"); | ||
shouldBeGreaterThanOrEqual("document.getElementById('2').offsetLeft", "document.getElementById('1').offsetLeft"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.56 KB
(100%)
LayoutTests/platform/mac/tables/mozilla/bugs/bug113235-3-expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters