RESOLVED FIXED 235175
[css-contain] Fix contain-size-replaced-002.html
https://bugs.webkit.org/show_bug.cgi?id=235175
Summary [css-contain] Fix contain-size-replaced-002.html
Rob Buis
Reported 2022-01-13 01:20:43 PST
Fix contain-size-replaced-002.html.
Attachments
Patch (3.32 KB, patch)
2022-01-13 01:22 PST, Rob Buis
no flags
Patch (3.52 KB, patch)
2022-01-13 07:31 PST, Rob Buis
no flags
Patch (3.41 KB, patch)
2022-01-14 02:23 PST, Rob Buis
no flags
Patch (4.04 KB, patch)
2022-01-14 03:19 PST, Rob Buis
no flags
Patch (3.61 KB, patch)
2022-01-14 06:44 PST, Rob Buis
no flags
Patch (3.60 KB, patch)
2022-01-14 10:46 PST, Rob Buis
no flags
Patch (3.61 KB, patch)
2022-01-15 08:10 PST, Rob Buis
no flags
Rob Buis
Comment 1 2022-01-13 01:22:15 PST
Rob Buis
Comment 2 2022-01-13 07:31:18 PST
Nikolas Zimmermann
Comment 3 2022-01-14 01:41:07 PST
Comment on attachment 449057 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449057&action=review Unofficial review :-) > Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:268 > + if (clipViewport && (contentWidth() == LayoutUnit() || contentHeight() == LayoutUnit())) While a decent compiler won't create LayoutUnit temporaries over and over, this is still hard to read. One could either make use of LayoutUnits operator bool() -- however since it's marked explicit, this is also awkward: if (clipViewport && (!bool(contentWidth()) || !bool(contentHeight()))) Therefore I'd avoid using contentWidth()/contentHeight() and instead query 'LayoutSize contentSize()', which encapsulates the logic you're looking for in the "isEmpty" function: if (clipViewport && contentSize().isEmpty())
Rob Buis
Comment 4 2022-01-14 02:23:03 PST
Rob Buis
Comment 5 2022-01-14 02:24:25 PST
Comment on attachment 449057 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449057&action=review >> Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:268 >> + if (clipViewport && (contentWidth() == LayoutUnit() || contentHeight() == LayoutUnit())) > > While a decent compiler won't create LayoutUnit temporaries over and over, this is still hard to read. > > One could either make use of LayoutUnits operator bool() -- however since it's marked explicit, this is also awkward: > if (clipViewport && (!bool(contentWidth()) || !bool(contentHeight()))) > > Therefore I'd avoid using contentWidth()/contentHeight() and instead query 'LayoutSize contentSize()', which encapsulates the logic you're looking for in the "isEmpty" function: > if (clipViewport && contentSize().isEmpty()) That is much better, thanks! I updated the patch.
Nikolas Zimmermann
Comment 6 2022-01-14 02:57:15 PST
Looks great, unofficial r=me.
Manuel Rego Casasnovas
Comment 7 2022-01-14 03:11:56 PST
Comment on attachment 449151 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449151&action=review r=me > Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:269 > + if (clipViewport && contentSize().isEmpty()) > + return; One question, should we move this up on the method, to avoid doing other checks that might not be needed?
Rob Buis
Comment 8 2022-01-14 03:19:30 PST
Rob Buis
Comment 9 2022-01-14 03:20:36 PST
Comment on attachment 449151 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449151&action=review >> Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:269 >> + return; > > One question, should we move this up on the method, to avoid doing other checks that might not be needed? Good comment, I think the position is okay, but I made a change regarding addRelevantRepaintedObject that I will run by Niko. Thanks for the review.
Nikolas Zimmermann
Comment 10 2022-01-14 06:16:45 PST
Comment on attachment 449156 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449156&action=review > Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:-259 > - page().addRelevantUnpaintedObject(this, visualOverflowRect()); You're no longer keeping track of relevant _unpainted_ objects? Apparently we lack test coverage for this, nothing turned red :-)
Rob Buis
Comment 11 2022-01-14 06:18:56 PST
Comment on attachment 449156 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449156&action=review >> Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:-259 >> - page().addRelevantUnpaintedObject(this, visualOverflowRect()); > > You're no longer keeping track of relevant _unpainted_ objects? > Apparently we lack test coverage for this, nothing turned red :-) Yeah, misread the code!
Nikolas Zimmermann
Comment 12 2022-01-14 06:26:27 PST
(In reply to Rob Buis from comment #9) > Comment on attachment 449151 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=449151&action=review > > >> Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:269 > >> + return; > > > > One question, should we move this up on the method, to avoid doing other checks that might not be needed? > > Good comment, I think the position is okay, but I made a change regarding > addRelevantRepaintedObject that I will run by Niko. Thanks for the review. Hmm, it depends. Apparently addRelevantRepaintedObject/UnpaintedObject is not covered by tests that the bots run at least. Robs new condition (when viewport is clipped and either width or height are empty, bail out) is preceded by: if (paintInfo.phase == PaintPhase::Foreground) page().addRelevantRepaintedObject(this, visualOverflowRect()); In LBSE I can immediately answer what the visualOverflowRect() looks like for a SVG renderer in general. However for LegacyRenderSVGRoot and the whole legacy SVG engine we always used to have the problem that we are not exactly sure of the different coordinate systems: visualOverflowRect() is different to SVG objectBoundingBox for instance, defined related to the 'border box rect' in CSS terms. So what does that mean for SVG? Hard to answer for the legacy SVG engine, needs to be checked case-by-case. Therefore I'm not sure: if there is an empty contentSize, why bother claiming that the LegacyRenderSVGRoot is a 'relevant repainted object' -- it's not. The visualOverflowRect() should have either empty width or height, just like the contentSize, no? At least one should printf() the visualOverflowRect / contentSize for a few cases, to understand this better. Rego is probably right, that we should move the contentSize().isEmpty() check at least above the addRelevantRepaintedObject() section. Who knows more about addRelevantRepaintedObject()?
Rob Buis
Comment 13 2022-01-14 06:44:48 PST
Rob Buis
Comment 14 2022-01-14 10:46:18 PST
EWS
Comment 15 2022-01-15 06:47:45 PST
ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.
Rob Buis
Comment 16 2022-01-15 08:10:41 PST
EWS
Comment 17 2022-01-15 09:22:48 PST
Committed r288057 (246077@main): <https://commits.webkit.org/246077@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449253 [details].
Radar WebKit Bug Importer
Comment 18 2022-01-15 09:23:18 PST
Note You need to log in before you can comment on or make changes to this bug.