RESOLVED FIXED 218211
RenderStyle::resetPadding sets incorrect computed value (auto)
https://bugs.webkit.org/show_bug.cgi?id=218211
Summary RenderStyle::resetPadding sets incorrect computed value (auto)
zalan
Reported 2020-10-26 15:55:02 PDT
should be 0
Attachments
Patch (1.57 KB, patch)
2020-10-26 16:01 PDT, zalan
no flags
zalan
Comment 1 2020-10-26 16:01:33 PDT
zalan
Comment 2 2020-10-26 16:02:17 PDT
Alternatively we could just set it to LengthBox(Fixed). Not sure what the preferred way is in RenderStyle.
Simon Fraser (smfr)
Comment 3 2020-10-26 16:33:35 PDT
Comment on attachment 412361 [details] Patch Is this testable with CSS reset?
Darin Adler
Comment 4 2020-10-26 17:09:40 PDT
Comment on attachment 412361 [details] Patch Does this have any effect?
zalan
Comment 5 2020-10-26 18:49:18 PDT
(In reply to Darin Adler from comment #4) > Comment on attachment 412361 [details] > Patch > > Does this have any effect? Absolutely. This is how in IFC we normally resolve the computed padding value (e.g. padding left): valueForLength(style.paddingLeft(), containingBlockWidth); Now for the (incorrect)auto specified value, valueForLength returns the containingBlockWidth as opposed to the expected, initial value of 0. (I noticed this after enabling <select> element in IFC. RenderTheme calls style.resetPadding() on the select renderer and when IFC resolves the computed value, it sees a non-zero padding left/right/top/bottom).
zalan
Comment 6 2020-10-26 18:59:26 PDT
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 412361 [details] > Patch > > Is this testable with CSS reset? the unset? It does not seem to call resetPadding.
Antti Koivisto
Comment 7 2020-10-27 06:14:13 PDT
Comment on attachment 412361 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412361&action=review > Source/WebCore/rendering/style/RenderStyle.h:1027 > + void resetPadding() { SET_VAR(m_surroundData, padding, LengthBox(initialPadding().intValue())); } Just initialPadding()?
zalan
Comment 8 2020-10-27 06:19:07 PDT
(In reply to Antti Koivisto from comment #7) > Comment on attachment 412361 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=412361&action=review > > > Source/WebCore/rendering/style/RenderStyle.h:1027 > > + void resetPadding() { SET_VAR(m_surroundData, padding, LengthBox(initialPadding().intValue())); } > > Just initialPadding()? That was my initial attempt, but LengthBox does not take Length.
EWS
Comment 9 2020-10-27 06:28:45 PDT
Committed r269037: <https://trac.webkit.org/changeset/269037> All reviewed patches have been landed. Closing bug and clearing flags on attachment 412361 [details].
Radar WebKit Bug Importer
Comment 10 2020-10-27 06:29:21 PDT
Darin Adler
Comment 11 2020-10-27 09:21:54 PDT
If this has an effect why isn’t a test case going from fail to pass?
zalan
Comment 12 2020-10-27 09:55:21 PDT
(In reply to Darin Adler from comment #11) > If this has an effect why isn’t a test case going from fail to pass? I should have been more specific. There's no effect on trunk yet because the rendering code is written in a way that the incorrect 'auto' value gets resolved to 0. LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const { LayoutUnit w; if (padding.isPercentOrCalculated()) w = containingBlockLogicalWidthForContent(); return minimumValueForLength(padding, w); } minimumValueForLength() returns 0 for auto values. The "from fail to pass" progression is behind a flag which is currently turned off on trunk (where we start exercising some more LFC code for inline content, specifically where LFC calls valueForLength(style.paddingLeft(), containingBlockWidth) to resolve the computed value.) I could have waited with this fix until after we enabled the flag to show the progression but it looked like a valid correctness fix in itself (since 'auto' is an incorrect value for padding).
Darin Adler
Comment 13 2020-10-27 10:02:11 PDT
(In reply to zalan from comment #12) > There's no effect on trunk yet because the > rendering code is written in a way that the incorrect 'auto' value gets > resolved to 0. OK.
Note You need to log in before you can comment on or make changes to this bug.