Closed Bug 1811353 Opened 2 years ago Closed 2 years ago

two width: 50% inline-block elements wrap instead of staying on the same line inside a table (Blink and WebKit ignore whitespace text nodes inside table-internal parts)

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: jrmuizel, Assigned: emilio)

References

Details

Attachments

(3 files)

Attached file diff.html

The attached file displays properly in Safari and Chrome.

Attached file Reduced test-case

So this is kind of expected because there's whitespace between the two inline-blocks. I'm not sure why Blink / WebKit behave differently with tables...

It seems blink avoids creating whitespace text nodes in tables unconditionally (here)

Something like this fixes the test-case above:

diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 5305b628bd521..9b2226949b261 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2314,7 +2314,8 @@ static inline bool NeedFrameFor(const nsFrameConstructorState& aState,
   // white-space, where we know we'll be dropping them all anyway, and involve
   // an extra walk down the frame construction item list.
   auto excludesIgnorableWhitespace = [](nsIFrame* aParentFrame) {
-    return aParentFrame->IsFrameOfType(nsIFrame::eXULBox) ||
+    return aParentFrame->IsTableFrame() ||
+           aParentFrame->IsFrameOfType(nsIFrame::eXULBox) ||
            aParentFrame->IsFrameOfType(nsIFrame::eMathML);
   };
   if (!aParentFrame || !excludesIgnorableWhitespace(aParentFrame) ||

But it's unclear to me what in the spec justifies it.

Severity: -- → S3
Priority: -- → P3
Summary: two width: 50% inline-block elements wrap instead of staying on the same line → two width: 50% inline-block elements wrap instead of staying on the same line inside a table (Blink and WebKit ignore whitespace text nodes inside table-internal parts)
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9ea945ffd5ee Add a test for this WebKit / Blink bug. r=jrmuizel
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/38192 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: