Commit e64aef31 authored by Ting-Yu Lin's avatar Ting-Yu Lin
Browse files

Bug 1687795 - Rename the flag tracking whether block-size is set by...

Bug 1687795 - Rename the flag tracking whether block-size is set by aspect-ratio and inline-size, and improve comments. r=boris

* Follow other flags' naming by putting "Is" at the beginning.
* Delete the accessor because we just access other flags directly.

Differential Revision: https://phabricator.services.mozilla.com/D102480
parent 4686dd38
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1464,10 +1464,10 @@ LogicalSize ReflowInput::CalculateAbsoluteSizeWithResolvedAutoBlockSize(
          LogicalAxis::eLogicalAxisInline, wm, aAutoBSize, boxSizingAdjust);
  resultSize.ISize(wm) = ApplyMinMaxISize(transferredISize);

  MOZ_ASSERT(mFlags.mBSizeIsSetByAspectRatio,
  MOZ_ASSERT(mFlags.mIsBSizeSetByAspectRatio,
             "This flag should have been set because nsIFrame::ComputeSize() "
             "returns AspectRatioUsage::ToComputeBSize unintentionally");
  mFlags.mBSizeIsSetByAspectRatio = false;
  mFlags.mIsBSizeSetByAspectRatio = false;

  return resultSize;
}
@@ -1642,7 +1642,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
  LogicalSize& computedSize = sizeResult.mLogicalSize;
  computedSize = computedSize.ConvertTo(cbwm, wm);

  mFlags.mBSizeIsSetByAspectRatio = sizeResult.mAspectRatioUsage ==
  mFlags.mIsBSizeSetByAspectRatio = sizeResult.mAspectRatioUsage ==
                                    nsIFrame::AspectRatioUsage::ToComputeBSize;

  // XXX Now that we have ComputeSize, can we condense many of the
@@ -2368,7 +2368,7 @@ void ReflowInput::InitConstraints(
          ComputedBSize() == NS_UNCONSTRAINEDSIZE || ComputedBSize() >= 0,
          "Bogus block-size");

      mFlags.mBSizeIsSetByAspectRatio =
      mFlags.mIsBSizeSetByAspectRatio =
          size.mAspectRatioUsage == nsIFrame::AspectRatioUsage::ToComputeBSize;

      // Exclude inline tables, side captions, outside ::markers, flex and grid
+5 −9
Original line number Diff line number Diff line
@@ -350,10 +350,6 @@ struct ReflowInput : public SizeComputationInput {
                      : ht + ComputedPhysicalBorderPadding().TopBottom());
  }

  bool ComputedBSizeIsSetByAspectRatio() const {
    return mFlags.mBSizeIsSetByAspectRatio;
  }

  // Our saved containing block dimensions.
  LogicalSize mContainingBlockSize{mWritingMode};

@@ -508,12 +504,12 @@ struct ReflowInput : public SizeComputationInput {
    // context.
    bool mMovedBlockFragments : 1;

    // If the block-size is replacd by aspect-ratio and inline size (i.e.
    // block axis is the ratio-dependent axis). We set this flag, so we could
    // apply Automatic content-based minimum sizes after we know the content
    // size of child fraems.
    // Is the block-size computed by aspect-ratio and inline size (i.e. block
    // axis is the ratio-dependent axis)? We set this flag so that we can check
    // whether to apply automatic content-based minimum sizes once we know the
    // children's block-size (after reflowing them).
    // https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
    bool mBSizeIsSetByAspectRatio : 1;
    bool mIsBSizeSetByAspectRatio : 1;
  };
  Flags mFlags;
  mozilla::ComputeSizeFlags mComputeSizeFlags;
+3 −3
Original line number Diff line number Diff line
@@ -1891,10 +1891,10 @@ void nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
        ComputeFinalBSize(aReflowInput, aState.mReflowStatus, contentBSize,
                          borderPadding, aState.mConsumedBSize);

    // If content size is larger than the effective computed block size,
    // we extend the block size to contain all the content.
    // If the content block-size is larger than the effective computed
    // block-size, we extend the block-size to contain all the content.
    // https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
    if (aReflowInput.ComputedBSizeIsSetByAspectRatio() &&
    if (aReflowInput.mFlags.mIsBSizeSetByAspectRatio &&
        ShouldApplyAutomaticMinimumOnBlockAxis(wm, aReflowInput.mStyleDisplay,
                                               aReflowInput.mStylePosition)) {
      // Note: finalSize.BSize(wm) includes border + padding, so we have to
+3 −3
Original line number Diff line number Diff line
@@ -4999,7 +4999,7 @@ void nsFlexContainerFrame::DoFlexLayout(
            childReflowInput.SetComputedISize(item.MainSize());
          } else {
            childReflowInput.SetComputedBSize(item.MainSize());
            childReflowInput.mFlags.mBSizeIsSetByAspectRatio = false;
            childReflowInput.mFlags.mIsBSizeSetByAspectRatio = false;
            if (item.TreatBSizeAsIndefinite()) {
              childReflowInput.mFlags.mTreatBSizeAsIndefinite = true;
            }
@@ -5438,7 +5438,7 @@ nsReflowStatus nsFlexContainerFrame::ReflowFlexItem(
    didOverrideComputedISize = true;
  } else {
    childReflowInput.SetComputedBSize(aItem.MainSize());
    childReflowInput.mFlags.mBSizeIsSetByAspectRatio = false;
    childReflowInput.mFlags.mIsBSizeSetByAspectRatio = false;
    didOverrideComputedBSize = true;
    if (aItem.TreatBSizeAsIndefinite()) {
      childReflowInput.mFlags.mTreatBSizeAsIndefinite = true;
@@ -5464,7 +5464,7 @@ nsReflowStatus nsFlexContainerFrame::ReflowFlexItem(
      // the block size would always be considered definite (or where its
      // definiteness would be irrelevant).
      childReflowInput.SetComputedBSize(aItem.CrossSize());
      childReflowInput.mFlags.mBSizeIsSetByAspectRatio = false;
      childReflowInput.mFlags.mIsBSizeSetByAspectRatio = false;
      didOverrideComputedBSize = true;
    }
  }