Nothing Special   »   [go: up one dir, main page]

Page MenuHomePhabricator

Bug 1312588 - Part 3: Implement the layout part of fit-content() without the intrinsic contribution.
ClosedPublic

Authored by boris on Apr 9 2021, 10:31 PM.
Referenced Files
Unknown Object (File)
Jul 10 2024, 11:45 AM
Unknown Object (File)
Nov 26 2022, 1:06 PM
Subscribers

Details

Summary

This implements fit-content() for basic layout support. For intrinsic
contribution, we will do that in the following patches.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Lint Not Applicable
Unit
Tests Not Applicable
Build Status
Buildable 327174
Build 421171: arc lint + arc unit

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
boris retitled this revision from Bug 1312588 - Implement the layout part of fit-content(). to Bug 1312588 - Part 3: Implement the layout part of fit-content() without the intrinsic contribution..Apr 21 2021, 10:08 PM
boris edited the summary of this revision. (Show Details)

Code analysis found 1 defect in the diff 430608:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

Code analysis found 1 defect in the diff 432562:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

Code analysis found 1 defect in the diff 433170:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

emilio added a project: testing-approved.
emilio added inline comments.
layout/generic/nsIFrame.cpp
6588
nscoord arg = aFitContentArg.valueOrFrom([&] {
    return aContainingBlockSize.ISize() - ...;
});
layout/generic/nsIFrame.h
4856

I'd probably factor this into a separate variable, just for readability:

Maybe<nscoord> fitContentArg;
if (aSize.IsFitContentFunc()) {
  fitContentArg.emplace(ComputeISizeValue(aWM, aContainingBlockSize, aContentEdgeToBoxSizing, aSize.AsFitContentFunc());
}
return ComputeISizeValue(...);
This revision is now accepted and ready to land.Apr 30 2021, 11:33 AM
boris marked 2 inline comments as done.

Rename enum arm name, FitContentFunction and address comments

Code analysis found 1 defect in the diff 434418:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.

layout/generic/nsIFrame.cpp
6585

aContainingBlockSize.ISize(aWM) can be replaced by something like

aAvailableISizeOverride ? *aAvailableISizeOverride : aContainingBlockSize.ISize(aWM)
layout/generic/nsIFrame.h
4817

suggestion: I don't feel aFitContentArg is a good name because the <length-percentage> provided by fit-content() function is to override the available size from the containing block, i.e. aContainingBlockSize.ISize(). https://drafts.csswg.org/css-sizing-3/#available

Even so, it's still unclear whether this available size override has already considered box-sizing or not. I'll prefer this doesn't consider box-sizing at all because we all do it in this function anyway.

How about we call this aAvailableISizeOverride, and add a document like the following ?

@param aAvailableISizeOverride If this has a value, it is used as the available inline-size instead of aContainingBlockSize.ISize(aWM) when resolving fit-content.

(Please double check if the suggestion wording is correct.)

4845–4852

If you agree the box-sizing should be handle in ComputeISizeValue in my other inline comment, this can be

Maybe<nscoord> availbleISizeOverride;
if (aSize.IsFitContentFunction()) {
  availbleISizeOverride.emplace(aSize.AsFitContentFunction().Resolve(
      aContainingBlockSize.ISize(aWM)));
}
boris marked 3 inline comments as done.

Addressed comments and rebased.

layout/generic/nsIFrame.h
4817

This makes more sense. Yes, let's move the handle of box-sizing into this function to avoid the potential incorrect calculation.

Code analysis found 1 defect in the diff 448216:

  • 1 defect found by clang-tidy

You can run this analysis locally with:

  • ./mach static-analysis check --outgoing (C/C++)

If you see a problem in this automated review, please report it here.

You can view these defects on the code-review frontend and on Treeherder.