https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.ccFile
third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
(left):
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#oldcode200third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:200:
remove from this patch.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.ccFile
third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
(right):
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc#newcode166third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc:166:
remove from this patch.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.ccFile third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
(right):
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode52third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:52: //
Collect child's out of flow descendants
.nit add period to end.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode54third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:54:
NGPhysicalFragmentBase::kFragmentBox) {
this can be fixed here or TODO+another patch, but i think we actually
want out_of_flow_descendants to live on fragment_base, i.e.
https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%0Aspan%20%7B%20border%3A%201px%20solid%20green%3B%20%7D%0A%23a%20%7B%20position%3A%20absolute%3B%20top%3A%2020px%3B%20%7D%0A%3C%2Fstyle%3E%0A%3Cspan%3Etext%20%D9%87%3Cspan%20id%3D%22a%22%3Ebar%3C%2Fspan%3E%D9%8A%20text%3C%2Fspan%3Ehttps://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode61third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:61:
out_of_flow_descendant_candidates_.add(block_node);
can we do:
s/block_/oof_/ here?
block is a little overloaded, oof_ prefix would be better.
(on block_offsets, block_index, block_node, block_corner).
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode81third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:81:
Vector<NGCorner>& descendant_corners) {
change ref to pointer as out param:
https://google.github.io/styleguide/cppguide.html#Function_Parameter_Orderinghttps://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode83third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:83:
descendant_corners.clear();
I would do a:
DCHECK(descendants->isEmpty());
DCHECK(descendant_corners->isEmpty());
instead.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode86third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:86:
DCHECK_GE(size_.block_size, LayoutUnit(0));
just LayoutUnit() for above lines I think.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode90third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:90: for
(auto& block_node : out_of_flow_descendant_candidates_) {
s/block_node/oof_node/
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc#newcode99third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc:99:
child_offset + oof_offset.descendant_corner.offset;
This is great, a lot simpler :)
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.hFile third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
(right):
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode31third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:31: //
Builder is not dumb when handling out of flow descendants.
Maybe:
The builder isn't "simple" when handling out of flow (OOF) descendants.
It will collect OOF descendants from:
- AddChild (will add all descendants from the appended fragment).
- AddOutOfFlowDescendantCandidate (directs adds a descendant).
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode34third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:34: //
if (child->position == (Absolute or Fixed)
missing closing ')'
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode37third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:37: //
child->Layout()
i'd write:
fragment = child->Layout()
instead. (make clear that not adding input node).
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode41third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:41: //
while (builder->GetOutOfFlowDescendantCandidates(oof_candidates)
while loop bad?
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode50third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:50: // }
There are two cases:
- The descendant came from a child fragment.
- The descendant is a direct child of the current fragment.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode51third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:51:
NGFragmentBuilder& AddOutOfFlowCandidateChild(NGBlockNode*,
NGLogicalOffset);
AddOutOfFlowDescendantCandidate for consistency.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode70third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:70: //
Descendant offset information
Maybe:
Descendant offset information. We need information from two places to
calculate the NGCorner of the descendant correctly.
- The inner physical offset (child_offset). This is set if the
descendant came from a child fragment. It is the offset within that
fragment.
- The outer logical offset (descendant_corner). This is set in both
cases (see above). It is the offset to the descendant, or the child
fragment as appropriate. We store the outer logical offset here
separately as it is impossible to convert to physical without the
fragment size.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h#newcode89third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h:89:
Vector<OutOfFlowOffset> oof_candidate_offsets_;
s/oof/out_of_flow/
to be consistent with rest of variable naming.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_units.hFile third_party/WebKit/Source/core/layout/ng/ng_units.h (right):
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_units.h#newcode100third_party/WebKit/Source/core/layout/ng/ng_units.h:100:
NGPhysicalOffset operator+(const NGPhysicalOffset& other) const {
also define:
NGPhysicalOffset& operator+=(const NGPhysicalOffset other) const;
also probably move to .cc file to be consistent with NGLogicalOffset.
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_units.h#newcode278third_party/WebKit/Source/core/layout/ng/ng_units.h:278: // Represents
rectangle's physical corner.
Maybe:
This struct is used to represent the static position of an out of flow
descendant.
(similar to NGMarginStruct, specifies which part of layout it's used
for).
https://codereview.chromium.org/2540653003/diff/40001/third_party/WebKit/Source/core/layout/ng/ng_units.h#newcode282third_party/WebKit/Source/core/layout/ng/ng_units.h:282: Type type; //
Logical corner that corresponds to physical top left.
remove this comment?
https://codereview.chromium.org/2540653003/