Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool has_user_specified_position = false;
This variable is not used in this method. I think for encapsulation purposes, this makes more sense to be a private member variable in `MasonryRunningPositions`.
if (has_user_specified_position && item_span != initial_span) {
++item_span;
continue;
}
if (CalculateUsedTrackSize(item_span) != used_track_size) {
++item_span;
continue;
}
These two can be combined into one condition:
```
if ((CalculateUsedTrackSize(item_span) != used_track_size) || (has_user_specified_position && (item_span != initial_span))) {
++item_span;
continue;
}
```
That'll read more literally like your comment too.
<!DOCTYPE html>
<html>
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<link rel="match" href="column-dense-packing-006-ref.html">
<link rel="author" title="Celeste Pan" href="mailto:celes...@microsoft.com">
<style>
.masonry {
display: masonry;
item-tolerance: 0;
grid-template-columns: repeat(4, 50px);
grid-auto-flow: dense;
}
</style>
Do you need row tests?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// `has_user_specified_position` is an output parameter which will be set to
This should be has_author_specified_position, although a simpler name could be is_auto_placed and then you'd just need to reverse the logic
if (has_user_specified_position && item_span != initial_span) {
++item_span;
continue;
}
I'm wondering if another way to do this is by changing the max_iterations in this case before the while loop. Shouldn't the number of iterations in the auto placement case just be 1, in which case, then we'd only check starting in the current track
bool has_user_specified_position = false;
This variable is not used in this method. I think for encapsulation purposes, this makes more sense to be a private member variable in `MasonryRunningPositions`.
Hm, it wouldn't really make sense as a private member variable since this is specific to each individual masonry item. This could also be a return value, but it seems a bit weird to have it as a return value because it's not really the whole purpose of the method.
Personally I thought this was the best way, but if there are suggestions outside of using a private member variable I would love to hear them!
// `has_user_specified_position` is an output parameter which will be set to
This should be has_author_specified_position, although a simpler name could be is_auto_placed and then you'd just need to reverse the logic
I like the `is_auto_placed` suggestion a lot, will use that!
if (has_user_specified_position && item_span != initial_span) {
++item_span;
continue;
}
I'm wondering if another way to do this is by changing the max_iterations in this case before the while loop. Shouldn't the number of iterations in the auto placement case just be 1, in which case, then we'd only check starting in the current track
I actually don't think we need to do the whole `max_iterations` business once we stop iterating from after the auto-placement cursor; we can just ensure the endline of `item_span` is within range.
I think it makes sense to address this in the change where we always start our search for openings from the start of the track; even though the code changes there would be small, there would be a decent amount of test changes, so I think that should be separate from this.
I'll make a TODO for that!
if (has_user_specified_position && item_span != initial_span) {
++item_span;
continue;
}
if (CalculateUsedTrackSize(item_span) != used_track_size) {
++item_span;
continue;
}
These two can be combined into one condition:
```
if ((CalculateUsedTrackSize(item_span) != used_track_size) || (has_user_specified_position && (item_span != initial_span))) {
++item_span;
continue;
}
```That'll read more literally like your comment too.
Done
<!DOCTYPE html>
<html>
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<link rel="match" href="column-dense-packing-006-ref.html">
<link rel="author" title="Celeste Pan" href="mailto:celes...@microsoft.com">
<style>
.masonry {
display: masonry;
item-tolerance: 0;
grid-template-columns: repeat(4, 50px);
grid-auto-flow: dense;
}
</style>
Do you need row tests?
Yup, translated these tests into row tests!
missing extra line at the end
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool has_user_specified_position = false;
Celeste PanThis variable is not used in this method. I think for encapsulation purposes, this makes more sense to be a private member variable in `MasonryRunningPositions`.
Hm, it wouldn't really make sense as a private member variable since this is specific to each individual masonry item. This could also be a return value, but it seems a bit weird to have it as a return value because it's not really the whole purpose of the method.
Personally I thought this was the best way, but if there are suggestions outside of using a private member variable I would love to hear them!
Since this is a property of an individual masonry item, it belongs in `GridItemData`. That way you won't need these out bools that hold state on a specific masonry item.
It looks like you can't just look at the `resolved_position`, so you'll need to add another bool to `GridItemData`. There are already a bunch of these for similar purposes (e.g. `has_subgridded_columns`), so that seems like the best place to put it.
// true if the item it auto-placed.
Typo: "...is auto placed"
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool has_user_specified_position = false;
Celeste PanThis variable is not used in this method. I think for encapsulation purposes, this makes more sense to be a private member variable in `MasonryRunningPositions`.
Kurt Catti-SchmidtHm, it wouldn't really make sense as a private member variable since this is specific to each individual masonry item. This could also be a return value, but it seems a bit weird to have it as a return value because it's not really the whole purpose of the method.
Personally I thought this was the best way, but if there are suggestions outside of using a private member variable I would love to hear them!
Since this is a property of an individual masonry item, it belongs in `GridItemData`. That way you won't need these out bools that hold state on a specific masonry item.
It looks like you can't just look at the `resolved_position`, so you'll need to add another bool to `GridItemData`. There are already a bunch of these for similar purposes (e.g. `has_subgridded_columns`), so that seems like the best place to put it.
That's a good idea! I'll also just set the `is_auto_placed` value in the method where we actually resolve the lines for the masonry item.
// true if the item it auto-placed.
Celeste PanTypo: "...is auto placed"
Done
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
LGTM but don't land until Alison gives a +1
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
if ((CalculateUsedTrackSize(item_span) != used_track_size) ||
nit: I don't think this paren is needed
(!masonry_item.is_auto_placed && (item_span != initial_span))) {
nit: I don't think this paren is needed
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if ((CalculateUsedTrackSize(item_span) != used_track_size) ||
nit: I don't think this paren is needed
Done
(!masonry_item.is_auto_placed && (item_span != initial_span))) {
nit: I don't think this paren is needed
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/layout/masonry/masonry_running_positions.cc
Insertions: 2, Deletions: 2.
@@ -188,8 +188,8 @@
// If the used track size of the item doesn't match the total track size of
// the span OR if the item we are attempting to place has a user-specified
// position that doesn't match the current span, move onto the next span.
- if ((CalculateUsedTrackSize(item_span) != used_track_size) ||
- (!masonry_item.is_auto_placed && (item_span != initial_span))) {
+ if (CalculateUsedTrackSize(item_span) != used_track_size ||
+ (!masonry_item.is_auto_placed && item_span != initial_span)) {
++item_span;
continue;
}
```
[Masonry] Account for specified-tracks when in dense-packing
If an item has a specified track and dense-packing is enabled, only
place the item in openings in the specified track.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |