Bug 251178
| Summary: | Whitespace incorrectly suppressed inside table. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Emilio Cobos Álvarez (:emilio) <emilio> |
| Component: | Layout and Rendering | Assignee: | Karl Dubost <karlcow> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ahmad.saleem792, bfulgham, karlcow, simon.fraser, webkit-bug-importer, zalan |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact |
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://wpt.live/css/css-tables/whitespace-001.html | ||
Emilio Cobos Álvarez (:emilio)
In https://bug1811353.bmoattachments.org/attachment.cgi?id=9314059, Blink and WebKit render tables inconsistently from Gecko and the spec.
See also https://github.com/w3c/csswg-drafts/issues/8358 and https://bugs.chromium.org/p/chromium/issues/detail?id=1410345 for context, spec references, and equivalent Chromium bug.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Karl Dubost
would it be https://searchfox.org/wubkat/rev/1c8b29ff201022e3a20578244e85d25d1b7706c4/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp#429-431
Emilio Cobos Álvarez (:emilio)
Yep that looks exactly like it.
Radar WebKit Bug Importer
<rdar://problem/104934417>
Ahmad Saleem
(In reply to Karl Dubost from comment #1)
> would it be
> https://searchfox.org/wubkat/rev/1c8b29ff201022e3a20578244e85d25d1b7706c4/
> Source/WebCore/rendering/updating/RenderTreeUpdater.cpp#429-431
I tested locally by removing just "parentRenderer.isTable()" make us pass "WPT" test, if we remove other bits, it makes tables go haywire.
If you want to do PR, you can do so or if you want me to do, I am happy to do it as well. Thanks!
Karl Dubost
Ahmad, feel free to give it a go.
Karl Dubost
Pull request: https://github.com/WebKit/WebKit/pull/47169
Ahmad Saleem
auto* previousRenderer = renderingParent.previousChildRenderer;
if (parentRenderer.isRenderTableRow() || parentRenderer.isRenderTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isRenderFrameSet() || parentRenderer.isRenderGrid() || (parentRenderer.isRenderFlexibleBox() && !parentRenderer.isRenderButton()))
return false;
if (parentRenderer.isRenderTable()) {
if (!previousRenderer)
return false;
// Suppress whitespace after table-internal or block-level elements
if (previousRenderer->isRenderTableRow() || previousRenderer->isRenderTableSection() || previousRenderer->isRenderTableCol() || previousRenderer->isRenderTableCaption())
return false;
// Preserve whitespace only if previous is inline-block or inline-table
// (not regular table-cells or blocks)
if (previousRenderer->isNonReplacedAtomicInlineLevelBox())
return true; // Keep the whitespace
// Otherwise suppress (covers table-cells, blocks, etc.)
return false;
}
This takes us to closet to our progress but still fails: https://jsfiddle.net/6Lbjd3qu/