static GridTrackSize EmptyValue() {
// Use kDeviceHeight length type as a sentinel as it is not valid for grid
// track sizes.
return GridTrackSize(Length(Length::Type::kDeviceHeight));
}
static GridTrackSize DeletedValue() {
// Use kDeviceWidth length type as another sentinel as it is not valid for
// grid track sizes.
return GridTrackSize(Length(Length::Type::kDeviceWidth));
}Unfortunately, `kSafeToCompareToEmptyOrDeleted = false;` didn't allow me to avoid adding these two methods. Curious if you think these are "ok" sententials in this case, or if I should add something more explicit to GridTrackSize to distinguish empty/deleted from other instances?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
contribution_sizes = VirtualItemContributions();So you want to clear or reset?
(e.g. should this be: contribution_size = std::nullopt ?).
static GridTrackSize EmptyValue() {
// Use kDeviceHeight length type as a sentinel as it is not valid for grid
// track sizes.
return GridTrackSize(Length(Length::Type::kDeviceHeight));
}
static GridTrackSize DeletedValue() {
// Use kDeviceWidth length type as another sentinel as it is not valid for
// grid track sizes.
return GridTrackSize(Length(Length::Type::kDeviceWidth));
}Unfortunately, `kSafeToCompareToEmptyOrDeleted = false;` didn't allow me to avoid adding these two methods. Curious if you think these are "ok" sententials in this case, or if I should add something more explicit to GridTrackSize to distinguish empty/deleted from other instances?
I would moderately prefer adding something explicit to GridTrackSize instead of this if that's ok.
E.g. a is_deleted_ member.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
So you want to clear or reset?
(e.g. should this be: contribution_size = std::nullopt ?).
We rely on there always being a contribution_size on a virtual item later on. We could remove that expectation, and just return O as the contribution size where needed, but that could make it easier to miss bugs with that in the future.
Updated the comment to say "clear" instead of "reset" so it's hopefully less confusing
static GridTrackSize EmptyValue() {
// Use kDeviceHeight length type as a sentinel as it is not valid for grid
// track sizes.
return GridTrackSize(Length(Length::Type::kDeviceHeight));
}
static GridTrackSize DeletedValue() {
// Use kDeviceWidth length type as another sentinel as it is not valid for
// grid track sizes.
return GridTrackSize(Length(Length::Type::kDeviceWidth));
}Ian KilpatrickUnfortunately, `kSafeToCompareToEmptyOrDeleted = false;` didn't allow me to avoid adding these two methods. Curious if you think these are "ok" sententials in this case, or if I should add something more explicit to GridTrackSize to distinguish empty/deleted from other instances?
I would moderately prefer adding something explicit to GridTrackSize instead of this if that's ok.
E.g. a is_deleted_ member.
That sounds good to me - definitely feels a bit less hacky that way. Updated to add is_deleted_ and is_empty_ members.
Lmk if this isn't quite what you had in mind, though.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/57624.
When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.
WPT Export docs:
https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: third_party/blink/renderer/core/style/grid_track_size.h
Insertions: 21, Deletions: 10.
@@ -108,6 +108,21 @@
CacheMinMaxTrackBreadthTypes();
}
+ static GridTrackSize DeletedTrackSize() {
+ GridTrackSize size(Length::Auto());
+ size.is_deleted_ = true;
+ return size;
+ }
+
+ static GridTrackSize EmptyTrackSize() {
+ GridTrackSize size(Length::Auto());
+ size.is_empty_ = true;
+ return size;
+ }
+
+ bool IsDeletedValue() const { return is_deleted_; }
+ bool IsEmptyValue() const { return is_empty_; }
+
const Length& FitContentTrackBreadth() const {
DCHECK(type_ == kFitContentTrackSizing);
return fit_content_track_breadth_;
@@ -151,7 +166,8 @@
return type_ == other.type_ &&
min_track_breadth_ == other.min_track_breadth_ &&
max_track_breadth_ == other.max_track_breadth_ &&
- fit_content_track_breadth_ == other.fit_content_track_breadth_;
+ fit_content_track_breadth_ == other.fit_content_track_breadth_ &&
+ is_deleted_ == other.is_deleted_ && is_empty_ == other.is_empty_;
}
void CacheMinMaxTrackBreadthTypes() {
@@ -249,6 +265,8 @@
bool min_track_breadth_is_min_content_ : 1;
bool max_track_breadth_is_min_content_ : 1;
bool track_size_definition_is_intrinsic_ : 1;
+ bool is_deleted_ : 1 = false;
+ bool is_empty_ : 1 = false;
};
template <>
@@ -270,18 +288,11 @@
}
static constexpr bool kEmptyValueIsZero = false;
- static constexpr bool kSafeToCompareToEmptyOrDeleted = false;
- static GridTrackSize EmptyValue() {
- // Use kDeviceHeight length type as a sentinel as it is not valid for grid
- // track sizes.
- return GridTrackSize(Length(Length::Type::kDeviceHeight));
- }
+ static GridTrackSize EmptyValue() { return GridTrackSize::EmptyTrackSize(); }
static GridTrackSize DeletedValue() {
- // Use kDeviceWidth length type as another sentinel as it is not valid for
- // grid track sizes.
- return GridTrackSize(Length(Length::Type::kDeviceWidth));
+ return GridTrackSize::DeletedTrackSize();
}
};
```
```
The name of the file: third_party/blink/renderer/core/layout/grid/grid_item.h
Insertions: 2, Deletions: 1.
@@ -278,7 +278,8 @@
std::max(contribution_sizes->min_clamp_size, min_clamp_size);
}
- // Reset all contribution sizes stored on a virtual item.
+ // Clear all contribution sizes stored on a virtual item so that they are set
+ // back to their default values.
void ClearContributionSizes() {
contribution_sizes = VirtualItemContributions();
}
```
[Masonry] Update intrinsic auto repeat heurisitic
Per recent CSSWG resolution [1], to avoid overflow when mixing fixed
and intrinsic track sizes in an auto repeat, the heuristic was updated
to avoid dividing by item spans, and expand the auto repeat as much
as needed to get every combination of item contributions based on the
largest item span size.
If an item span size is dependent on the total number of auto
repetitions, the calcululation in this CL may be inaccurate, because
that would be cyclic. Instead, create a grid line resolver with one
auto repeat, and use that to determine the largest span size.
Given the new heuristic, you can also end up with the same track
definition in the auto repeat evaluating to a different size. Update
to use a map so that we can keep track of the largest size per track
definition to determine the final number of intrinsic auto repeats.
[1] https://github.com/w3c/csswg-drafts/issues/12899#issuecomment-3525524685
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/57624
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |