Bug 1514430 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Minor optimization opportunity:

Right now, the InitDynamicReflowRoot() code from bug 1159042 forbids any element with e.g. "min-height:min-content" from being a dynamic reflow root, per this check:
  if (canBeDynamicReflowRoot &&
       (...
       IsIntrinsicKeyword(mStylePosition->mMinWidth) ||
       IsIntrinsicKeyword(mStylePosition->mMaxWidth) ||
       IsIntrinsicKeyword(mStylePosition->mMinHeight) ||
       IsIntrinsicKeyword(mStylePosition->mMaxHeight) ||
       ((mStylePosition->mMinWidth.GetUnit() == eStyleUnit_Auto ||
         mStylePosition->mMinHeight.GetUnit() == eStyleUnit_Auto) &&
        mFrame->IsFlexOrGridItem()))) {
       ...) {
    canBeDynamicReflowRoot = false;
  }
https://searchfox.org/mozilla-central/rev/49e78df13e7a505827a3a86daae9efdf827133c6/layout/generic/ReflowInput.cpp#847

But in fact, this is overzealous -- in a horizontal writing mode, "min-height:min-content" is equivalent to "min-height: initial", which for block layout means "min-height:0", which is perfectly fine for a dynamic reflow root.

Really, we only have to test the min/max size properties **that correspond to the frame's inline axis**.  Those are the ones where intrinsic sizing properties depend on the content.  For the block axis, the intrinsic sizing keywords "behave as the property's default value" (i.e. they don't actually do any intrinsic sizing, for min/max-size properties in block layout). Spec quote:
  # min-content
  #   If specified for the inline axis, use the min-content inline size;
  #   otherwise behaves as the property’s initial value.
  #
  # max-content
  #   If specified for the inline axis, use the max-content inline size;
  #   otherwise behaves as the property’s initial value. 
https://drafts.csswg.org/css-sizing/#sizing-values

So I think we can remove the IsIntrinsicKeyword calls for the block-axis min/max size properties here.  (Though for the min-size one, we'd actually need to *move it* (not get rid of it entirely) into the grid/flex-item-specific chunk, because the initial value of the min-size property *does* sometimes act as an intrinsic sizing keyword for grid/flex items.)
Minor optimization opportunity:

Right now, the InitDynamicReflowRoot() code from bug 1159042 forbids any element with e.g. "min-height:min-content" from being a dynamic reflow root, per this check:
  if (canBeDynamicReflowRoot &&
       (...
       IsIntrinsicKeyword(mStylePosition->mMinWidth) ||
       IsIntrinsicKeyword(mStylePosition->mMaxWidth) ||
       IsIntrinsicKeyword(mStylePosition->mMinHeight) ||
       IsIntrinsicKeyword(mStylePosition->mMaxHeight) ||
       ((mStylePosition->mMinWidth.GetUnit() == eStyleUnit_Auto ||
         mStylePosition->mMinHeight.GetUnit() == eStyleUnit_Auto) &&
        mFrame->IsFlexOrGridItem()))) {
       ...) {
    canBeDynamicReflowRoot = false;
  }
https://searchfox.org/mozilla-central/rev/49e78df13e7a505827a3a86daae9efdf827133c6/layout/generic/ReflowInput.cpp#847

But in fact, this is overzealous -- in a horizontal writing mode, "min-height:min-content" is equivalent to "min-height: initial", which for block layout means "min-height:0", which is perfectly fine for a dynamic reflow root.

Really, we only have to test the min/max size properties **that correspond to the frame's inline axis**.  Those are the ones where intrinsic sizing keywords actually depend on the content.  For the block axis, the intrinsic sizing keywords "behave as the property's default value" (i.e. they don't actually do any intrinsic sizing, for min/max-size properties in block layout). Spec quote:
  # min-content
  #   If specified for the inline axis, use the min-content inline size;
  #   otherwise behaves as the property’s initial value.
  #
  # max-content
  #   If specified for the inline axis, use the max-content inline size;
  #   otherwise behaves as the property’s initial value. 
https://drafts.csswg.org/css-sizing/#sizing-values

So I think we can remove the IsIntrinsicKeyword calls for the block-axis min/max size properties here.  (Though for the min-size one, we'd actually need to *move it* (not get rid of it entirely) into the grid/flex-item-specific chunk, because the initial value of the min-size property *does* sometimes act as an intrinsic sizing keyword for grid/flex items.)

Back to Bug 1514430 Comment 0