Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h

Issue 2346473003: Do not collapse margins with padding/border b/w parent and first/last child (Closed)
Patch Set: synced to the head Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NGBlockLayoutAlgorithm_h 5 #ifndef NGBlockLayoutAlgorithm_h
6 #define NGBlockLayoutAlgorithm_h 6 #define NGBlockLayoutAlgorithm_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_box.h" 9 #include "core/layout/ng/ng_box.h"
10 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 visitor->trace(builder_); 43 visitor->trace(builder_);
44 visitor->trace(constraint_space_for_children_); 44 visitor->trace(constraint_space_for_children_);
45 visitor->trace(current_child_); 45 visitor->trace(current_child_);
46 } 46 }
47 47
48 private: 48 private:
49 // Computes collapsed margins for 2 adjoining blocks and updates the resultant 49 // Computes collapsed margins for 2 adjoining blocks and updates the resultant
50 // fragment's MarginStrut if needed. 50 // fragment's MarginStrut if needed.
51 // See https://www.w3.org/TR/CSS2/box.html#collapsing-margins 51 // See https://www.w3.org/TR/CSS2/box.html#collapsing-margins
52 // 52 //
53 // @param space Constraint space for the block.
53 // @param child_margins Margins information for the current child. 54 // @param child_margins Margins information for the current child.
54 // @param children_margin_strut MarginStrut for children of the current child. 55 // @param children_margin_strut MarginStrut for children of the current child.
55 // @return Margin block start based on collapsed margins result. 56 // @return Margin block start based on collapsed margins result.
56 LayoutUnit CollapseMargins(const NGBoxStrut& child_margins, 57 LayoutUnit CollapseMargins(const NGConstraintSpace& space,
58 const NGBoxStrut& child_margins,
57 const NGMarginStrut& children_margin_strut); 59 const NGMarginStrut& children_margin_strut);
58 60
59 RefPtr<const ComputedStyle> style_; 61 RefPtr<const ComputedStyle> style_;
60 Member<NGBox> first_child_; 62 Member<NGBox> first_child_;
61 63
62 enum State { kStateInit, kStateChildLayout, kStateFinalize }; 64 enum State { kStateInit, kStateChildLayout, kStateFinalize };
63 State state_; 65 State state_;
64 Member<NGFragmentBuilder> builder_; 66 Member<NGFragmentBuilder> builder_;
65 Member<NGConstraintSpace> constraint_space_for_children_; 67 Member<NGConstraintSpace> constraint_space_for_children_;
66 Member<NGBox> current_child_; 68 Member<NGBox> current_child_;
67 NGBoxStrut border_and_padding_; 69 NGBoxStrut border_and_padding_;
68 LayoutUnit content_size_; 70 LayoutUnit content_size_;
69 LayoutUnit max_inline_size_; 71 LayoutUnit max_inline_size_;
70 // MarginStrut for the previous child. 72 // MarginStrut for the previous child.
71 NGMarginStrut prev_child_margin_strut_; 73 NGMarginStrut prev_child_margin_strut_;
72 }; 74 };
73 75
74 } // namespace blink 76 } // namespace blink
75 77
76 #endif // NGBlockLayoutAlgorithm_h 78 #endif // NGBlockLayoutAlgorithm_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698