WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238867
Implement css property contain-intrinsic-size
https://bugs.webkit.org/show_bug.cgi?id=238867
Summary
Implement css property contain-intrinsic-size
cathiechen
Reported
2022-04-06 07:39:05 PDT
Implement css property contain-intrinsic-size
Attachments
WIP-patch
(19.87 KB, patch)
2022-04-06 07:41 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-ews
(28.95 KB, patch)
2022-04-15 04:17 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-review
(28.95 KB, patch)
2022-04-15 04:17 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-ews
(198.47 KB, patch)
2022-04-15 05:08 PDT
,
cathiechen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
WIP-patch-for-review
(29.28 KB, patch)
2022-04-15 05:08 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-ews
(200.32 KB, patch)
2022-04-15 08:52 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-review
(31.13 KB, patch)
2022-04-15 08:53 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
WIP-patch-for-ews
(200.44 KB, patch)
2022-04-15 09:06 PDT
,
cathiechen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
WIP-patch-for-review
(31.23 KB, patch)
2022-04-15 09:07 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch-for-review
(37.80 KB, patch)
2022-04-17 23:56 PDT
,
cathiechen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
patch-for-ews-with-parsing-code
(206.08 KB, patch)
2022-04-17 23:58 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch-for-review
(37.80 KB, patch)
2022-04-18 00:37 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
patch-for-ews-with-parsing-code
(206.08 KB, patch)
2022-04-18 00:54 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch-for-review
(37.80 KB, patch)
2022-04-18 00:55 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.85 KB, patch)
2022-04-21 23:53 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.91 KB, patch)
2022-04-23 05:58 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.86 KB, patch)
2022-04-25 01:53 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.91 KB, patch)
2022-04-25 04:00 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.50 KB, patch)
2022-04-27 04:53 PDT
,
cathiechen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(39.50 KB, patch)
2022-04-27 04:59 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.27 KB, patch)
2022-04-27 05:56 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.25 KB, patch)
2022-04-27 08:35 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.28 KB, patch)
2022-04-27 09:18 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(39.10 KB, patch)
2022-05-11 07:00 PDT
,
cathiechen
no flags
Details
Formatted Diff
Diff
Patch
(37.48 KB, patch)
2022-05-25 03:29 PDT
,
Rob Buis
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(24)
View All
Add attachment
proposed patch, testcase, etc.
cathiechen
Comment 1
2022-04-06 07:41:11 PDT
Created
attachment 456818
[details]
WIP-patch
Radar WebKit Bug Importer
Comment 2
2022-04-13 07:40:15 PDT
<
rdar://problem/91688651
>
cathiechen
Comment 3
2022-04-15 04:17:05 PDT
Created
attachment 457691
[details]
WIP-patch-for-ews
cathiechen
Comment 4
2022-04-15 04:17:50 PDT
Created
attachment 457692
[details]
WIP-patch-for-review
cathiechen
Comment 5
2022-04-15 05:08:26 PDT
Created
attachment 457693
[details]
WIP-patch-for-ews
cathiechen
Comment 6
2022-04-15 05:08:45 PDT
Created
attachment 457694
[details]
WIP-patch-for-review
cathiechen
Comment 7
2022-04-15 08:52:44 PDT
Created
attachment 457699
[details]
WIP-patch-for-ews
cathiechen
Comment 8
2022-04-15 08:53:21 PDT
Created
attachment 457700
[details]
WIP-patch-for-review
cathiechen
Comment 9
2022-04-15 09:06:54 PDT
Created
attachment 457701
[details]
WIP-patch-for-ews
cathiechen
Comment 10
2022-04-15 09:07:19 PDT
Created
attachment 457702
[details]
WIP-patch-for-review
cathiechen
Comment 11
2022-04-15 10:19:22 PDT
Comment on
attachment 457702
[details]
WIP-patch-for-review View in context:
https://bugs.webkit.org/attachment.cgi?id=457702&action=review
> Source/WebCore/rendering/style/RenderStyle.cpp:783 > + if (first.containIntrinsicWidth != second.containIntrinsicWidth
Maybe we should move this change to the parsing patch?
cathiechen
Comment 12
2022-04-17 23:56:46 PDT
Created
attachment 457794
[details]
Patch-for-review
cathiechen
Comment 13
2022-04-17 23:58:15 PDT
Created
attachment 457795
[details]
patch-for-ews-with-parsing-code
cathiechen
Comment 14
2022-04-18 00:04:40 PDT
Comment on
attachment 457794
[details]
Patch-for-review Hi, I think this patch is ready for review. Thanks! * The patch-for-review only contains the implementation part, not the parsing and runtime flags code. * The patch-for-ews contains the parsing and runtime flags code, see
bug 238181
.
cathiechen
Comment 15
2022-04-18 00:37:52 PDT
Created
attachment 457797
[details]
Patch-for-review
cathiechen
Comment 16
2022-04-18 00:54:59 PDT
Created
attachment 457799
[details]
patch-for-ews-with-parsing-code
cathiechen
Comment 17
2022-04-18 00:55:19 PDT
Created
attachment 457800
[details]
Patch-for-review
Rob Buis
Comment 18
2022-04-20 08:28:00 PDT
Comment on
attachment 457800
[details]
Patch-for-review View in context:
https://bugs.webkit.org/attachment.cgi?id=457800&action=review
> Source/WebCore/rendering/RenderBox.cpp:5520 > + return false;
I think it would be nice to minimise shouldApplySizeContainment calls and also maybe turning this into ASSERT.
> Source/WebCore/rendering/RenderReplaced.cpp:526 > + // Don't let size containment effect aspect ratio. Maybe we should split this out?
Affect.
> Source/WebCore/rendering/style/RenderStyle.cpp:779 > + // This change should be slipt out, maybe only size containment needs relayout
Split.
> Source/WebCore/rendering/style/RenderStyle.cpp:784 > + || first.containIntrinsicHeight != second.containIntrinsicHeight)
Can probably go on one line.
cathiechen
Comment 19
2022-04-21 23:26:10 PDT
Comment on
attachment 457800
[details]
Patch-for-review View in context:
https://bugs.webkit.org/attachment.cgi?id=457800&action=review
Hi Rob, thanks for the reivew!
>> Source/WebCore/rendering/RenderBox.cpp:5520 >> + return false; > > I think it would be nice to minimise shouldApplySizeContainment calls and also maybe turning this into ASSERT.
Hmm, there are some scenarios we need to check shouldApplySizeContainment first. How about we add an new interface sizeContainmentHasExplicitIntrinsicInnerLogicalWidth()?
>> Source/WebCore/rendering/RenderReplaced.cpp:526 >> + // Don't let size containment effect aspect ratio. Maybe we should split this out? > > Affect.
Done
>> Source/WebCore/rendering/style/RenderStyle.cpp:779 >> + // This change should be slipt out, maybe only size containment needs relayout > > Split.
Done
>> Source/WebCore/rendering/style/RenderStyle.cpp:784 >> + || first.containIntrinsicHeight != second.containIntrinsicHeight) > > Can probably go on one line.
Done
cathiechen
Comment 20
2022-04-21 23:53:52 PDT
Created
attachment 458117
[details]
Patch
cathiechen
Comment 21
2022-04-23 05:58:23 PDT
Created
attachment 458208
[details]
Patch
cathiechen
Comment 22
2022-04-25 01:53:32 PDT
Created
attachment 458252
[details]
Patch
cathiechen
Comment 23
2022-04-25 02:00:08 PDT
Comment on
attachment 458252
[details]
Patch Hi, I think this patch is ready for review:) Please take a look, thanks!
Rob Buis
Comment 24
2022-04-25 02:11:38 PDT
Comment on
attachment 458252
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458252&action=review
> Source/WebCore/rendering/RenderBox.cpp:3095 > + LayoutUnit explicitIntrinsicHeight = sizeContainmentHasExplicitIntrinsicInnerLogicalHeight() ? explicitIntrinsicInnerLogicalHeight() : LayoutUnit(0);
LayoutUnit(0) -> LayoutUnit().
> Source/WebCore/rendering/RenderBox.cpp:3234 > + estimatedHeight += explicitIntrinsicInnerLogicalHeight() + scrollbarLogicalHeight();
So is the explicit intrinsic height always excluding any scrollbar heights?
> Source/WebCore/rendering/RenderListBox.cpp:209 > + maxLogicalWidth = 2 * optionsSpacingHorizontal;
In case sizeContainmentHasExplicitIntrinsicInnerLogicalWidth holds true, we do this statement for no good reason, since we know it will be overwritten.
> Source/WebCore/rendering/RenderListBox.cpp:214 > + minLogicalWidth = maxLogicalWidth;
Is minLogicalWidth undefined in case style().width().isPercentOrCalculated() is true?
> Source/WebCore/rendering/RenderSlider.cpp:74 > + minLogicalWidth = maxLogicalWidth = explicitIntrinsicInnerLogicalWidth();
I see some places min = max = .... and some max = min = ... . Better to pick one style.
cathiechen
Comment 25
2022-04-25 03:53:38 PDT
Comment on
attachment 458252
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458252&action=review
Hi Rob, thanks for the review!
>> Source/WebCore/rendering/RenderBox.cpp:3095 >> + LayoutUnit explicitIntrinsicHeight = sizeContainmentHasExplicitIntrinsicInnerLogicalHeight() ? explicitIntrinsicInnerLogicalHeight() : LayoutUnit(0); > > LayoutUnit(0) -> LayoutUnit().
Done
>> Source/WebCore/rendering/RenderBox.cpp:3234 >> + estimatedHeight += explicitIntrinsicInnerLogicalHeight() + scrollbarLogicalHeight(); > > So is the explicit intrinsic height always excluding any scrollbar heights?
Nope, scrollbar is not included in the explicit intrinsic size.
>> Source/WebCore/rendering/RenderListBox.cpp:209 >> + maxLogicalWidth = 2 * optionsSpacingHorizontal; > > In case sizeContainmentHasExplicitIntrinsicInnerLogicalWidth holds true, we do this statement for no good reason, since we know it will be overwritten.
Yes, this is outside because it can be reused by `!shouldApplySizeContainment(*this)` and `shouldApplySizeContainment(*this) && !sizeContainmentHasExplicitIntrinsicInnerLogicalWidth()`
>> Source/WebCore/rendering/RenderListBox.cpp:214 >> + minLogicalWidth = maxLogicalWidth; > > Is minLogicalWidth undefined in case style().width().isPercentOrCalculated() is true?
I guess so. This is copied from the following code, we don't want to change the behavior. Hmm, looks like we can reuse the following code, I didn't because contain-intrinsic-size-009.html fails. It looks like the failure is related to `overflow:visible` doesn't make select's scroll bar disappeared. The value of contain-intrinsic-width shouldn't include scrollbar. I'll try to explain this in TestExpectations.
>> Source/WebCore/rendering/RenderSlider.cpp:74 >> + minLogicalWidth = maxLogicalWidth = explicitIntrinsicInnerLogicalWidth(); > > I see some places min = max = .... and some max = min = ... . Better to pick one style.
Done
cathiechen
Comment 26
2022-04-25 03:58:52 PDT
Comment on
attachment 458252
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458252&action=review
>>> Source/WebCore/rendering/RenderListBox.cpp:209 >>> + maxLogicalWidth = 2 * optionsSpacingHorizontal; >> >> In case sizeContainmentHasExplicitIntrinsicInnerLogicalWidth holds true, we do this statement for no good reason, since we know it will be overwritten. > > Yes, this is outside because it can be reused by `!shouldApplySizeContainment(*this)` and `shouldApplySizeContainment(*this) && !sizeContainmentHasExplicitIntrinsicInnerLogicalWidth()`
This seems hard to read, I'll rewrite it.
cathiechen
Comment 27
2022-04-25 04:00:33 PDT
Created
attachment 458257
[details]
Patch
Rob Buis
Comment 28
2022-04-25 13:31:22 PDT
Comment on
attachment 458257
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458257&action=review
> Source/WebCore/rendering/RenderBox.h:673 > + LayoutUnit explicitIntrinsicInnerWidth() const;
This could return optional, then maybe some hasFoo methods are not needed.
> Source/WebCore/rendering/RenderListBox.cpp:213 > + maxLogicalWidth = 2* optionsSpacingHorizontal;
2* -> 2 *
Darin Adler
Comment 29
2022-04-26 17:49:55 PDT
Comment on
attachment 458257
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458257&action=review
> Source/WebCore/rendering/RenderReplaced.h:46 > + LayoutSize size = LayoutSize();
The "= LayoutSize()" here doesn’t do anything and can be omitted. LayoutUnit values are initialized to 0, unlike scalars which can be left uninitialized.
> Source/WebCore/rendering/RenderVideo.cpp:117 > + LayoutSize size = LayoutSize();
The "= LayoutSize()" here doesn’t do anything and can be omitted.
cathiechen
Comment 30
2022-04-27 03:55:23 PDT
Comment on
attachment 458257
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458257&action=review
>> Source/WebCore/rendering/RenderBox.h:673 >> + LayoutUnit explicitIntrinsicInnerWidth() const; > > This could return optional, then maybe some hasFoo methods are not needed.
Looks like optional could make the interface much more clear. Done!
>> Source/WebCore/rendering/RenderListBox.cpp:213 >> + maxLogicalWidth = 2* optionsSpacingHorizontal; > > 2* -> 2 *
Done, thanks!
>> Source/WebCore/rendering/RenderReplaced.h:46 >> + LayoutSize size = LayoutSize(); > > The "= LayoutSize()" here doesn’t do anything and can be omitted. LayoutUnit values are initialized to 0, unlike scalars which can be left uninitialized.
Done, thanks!
>> Source/WebCore/rendering/RenderVideo.cpp:117 >> + LayoutSize size = LayoutSize(); > > The "= LayoutSize()" here doesn’t do anything and can be omitted.
Done, thanks!
cathiechen
Comment 31
2022-04-27 04:53:18 PDT
Created
attachment 458438
[details]
Patch
cathiechen
Comment 32
2022-04-27 04:59:08 PDT
Created
attachment 458439
[details]
Patch
cathiechen
Comment 33
2022-04-27 05:56:47 PDT
Created
attachment 458440
[details]
Patch
Rob Buis
Comment 34
2022-04-27 06:07:13 PDT
Comment on
attachment 458440
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458440&action=review
> Source/WebCore/ChangeLog:8 > + This patch add support for contain-intrinsic-size value "none | <length>". The value "auto && <length>"
add -> adds.
> Source/WebCore/rendering/RenderBox.cpp:5535 > + return std::optional<LayoutUnit>(width.value().value());
This probably does not need the explicit cast.
> Source/WebCore/rendering/RenderBox.cpp:5551 > + return std::optional<LayoutUnit>(height.value().value());
Ditto.
> Source/WebCore/rendering/RenderGrid.cpp:544 > + return std::optional<LayoutUnit>();
Ditto.
cathiechen
Comment 35
2022-04-27 08:23:01 PDT
Comment on
attachment 458440
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458440&action=review
>> Source/WebCore/ChangeLog:8 >> + This patch add support for contain-intrinsic-size value "none | <length>". The value "auto && <length>" > > add -> adds.
Done
>> Source/WebCore/rendering/RenderBox.cpp:5535 >> + return std::optional<LayoutUnit>(width.value().value()); > > This probably does not need the explicit cast.
Tried locally, it seems needed, for width.value().value() is a float, not LayoutUnit.
>> Source/WebCore/rendering/RenderGrid.cpp:544 >> + return std::optional<LayoutUnit>(); > > Ditto.
Done.
cathiechen
Comment 36
2022-04-27 08:35:15 PDT
Created
attachment 458448
[details]
Patch
Rob Buis
Comment 37
2022-04-27 09:13:31 PDT
Comment on
attachment 458448
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458448&action=review
Patch is now good enough for me, maybe nice to use the has_value() though.
> Source/WebCore/rendering/RenderGrid.cpp:509 > + LayoutUnit totalGuttersSize = explicitIntrinsicInnerLogicalSize(ForColumns) ? 0_lu : guttersSize(m_grid, ForColumns, 0, numTracks(ForColumns), std::nullopt);
Maybe has_value() is clearer here.
> Source/WebCore/rendering/RenderGrid.cpp:531 > + LayoutUnit totalGuttersSize = direction == ForColumns && explicitIntrinsicInnerLogicalSize(direction) ? 0_lu : guttersSize(grid, direction, 0, numberOfTracks, std::nullopt);
Ditto.
cathiechen
Comment 38
2022-04-27 09:16:55 PDT
Comment on
attachment 458448
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458448&action=review
>> Source/WebCore/rendering/RenderGrid.cpp:509 >> + LayoutUnit totalGuttersSize = explicitIntrinsicInnerLogicalSize(ForColumns) ? 0_lu : guttersSize(m_grid, ForColumns, 0, numTracks(ForColumns), std::nullopt); > > Maybe has_value() is clearer here.
Done, thanks:)
>> Source/WebCore/rendering/RenderGrid.cpp:531 >> + LayoutUnit totalGuttersSize = direction == ForColumns && explicitIntrinsicInnerLogicalSize(direction) ? 0_lu : guttersSize(grid, direction, 0, numberOfTracks, std::nullopt); > > Ditto.
Done
cathiechen
Comment 39
2022-04-27 09:18:26 PDT
Created
attachment 458452
[details]
Patch
Rob Buis
Comment 40
2022-04-27 09:22:33 PDT
I am happy with the patch now, thanks Cathie!
cathiechen
Comment 41
2022-05-11 07:00:35 PDT
Created
attachment 459164
[details]
Patch
cathiechen
Comment 42
2022-05-11 07:01:49 PDT
Rebase the code.
Rob Buis
Comment 43
2022-05-25 03:29:15 PDT
Created
attachment 459749
[details]
Patch
Rob Buis
Comment 44
2022-06-08 03:34:42 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/1373
Brent Fulgham
Comment 45
2022-06-23 11:55:47 PDT
***
Bug 240888
has been marked as a duplicate of this bug. ***
cathiechen
Comment 46
2022-06-25 06:42:18 PDT
Rebase the code:
https://github.com/WebKit/WebKit/pull/1799
EWS
Comment 47
2022-10-25 11:40:30 PDT
Committed
255971@main
(7ed83ab2929f): <
https://commits.webkit.org/255971@main
> Reviewed commits have been landed. Closing PR #1799 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug