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

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

Issue 2850893003: Add container_block_offset,top_offset to NGFloatingObject. (Closed)
Patch Set: add-inline-to-block-flow-with-block-children-that-do-not-need-anonymous-boxes.html is still broken Created 3 years, 7 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
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 NGFloatingObject_h 5 #ifndef NGFloatingObject_h
6 #define NGFloatingObject_h 6 #define NGFloatingObject_h
7 7
8 #include "core/layout/ng/geometry/ng_box_strut.h" 8 #include "core/layout/ng/geometry/ng_box_strut.h"
9 #include "core/layout/ng/geometry/ng_logical_size.h" 9 #include "core/layout/ng/geometry/ng_logical_size.h"
10 #include "core/layout/ng/ng_block_node.h" 10 #include "core/layout/ng/ng_block_node.h"
(...skipping 21 matching lines...) Expand all
32 writing_mode, fragment)); 32 writing_mode, fragment));
33 } 33 }
34 34
35 NGExclusion::Type exclusion_type; 35 NGExclusion::Type exclusion_type;
36 EClear clear_type; 36 EClear clear_type;
37 NGBoxStrut margins; 37 NGBoxStrut margins;
38 // Available size of the constraint space that will be used by 38 // Available size of the constraint space that will be used by
39 // NGLayoutOpportunityIterator to position this floating object. 39 // NGLayoutOpportunityIterator to position this floating object.
40 NGLogicalSize available_size; 40 NGLogicalSize available_size;
41 41
42 // To correctly position a float we need 2 offsets: 42 // To correctly **position** a float we need 2 offsets:
43 // - origin_offset which represents the layout point for this float. 43 // - origin_offset which represents the layout point for this float.
44 // - from_offset which represents the point from where we need to calculate 44 // - from_offset which represents the point from where we need to calculate
45 // the relative logical offset for this float. 45 // the relative logical offset for this float.
46 // Layout details: 46 // Layout details:
47 // At the time when this float is created only *inline* offsets are known. 47 // At the time when this float is created only *inline* offsets are known.
48 // Block offset will be set when we are about to place this float, i.e. when 48 // Block offset will be set when we are about to place this float, i.e. when
49 // we resolved MarginStrut, adjusted the offset to clearance line etc. 49 // we resolved MarginStrut, adjusted the offset to clearance line etc.
50 NGLogicalOffset origin_offset; 50 NGLogicalOffset origin_offset;
51 NGLogicalOffset from_offset; 51 NGLogicalOffset from_offset;
52 52
53 // To correctly **paint** a float we need to know the BFC offset of the
54 // container to which we are attaching this float. It's used to calculate
55 // {@code paint_offset}.
56 // In most situations {@code paint_offset} equals to float's logical
57 // offset except the cases where a float needs to be re-attached to a non-zero
58 // height parent.
59 //
60 // Example:
61 // <body>
62 // <p style="height: 60px">Example</p>
63 // <div id="zero-height-div"><float></div>
64 //
65 // Here the float's logical offset is 0 relative to its #zero-height-div
66 // parent. Because of the "zero height" div this float is re-attached to the
67 // 1st non-empty parent => body. To paint this float correctly we provide the
68 // modified {@code paint_offset} which is relative to the float's new
69 // parent.
70 // I.e. for our example {@code paint_offset.top} ==
71 // #zero-height-div's BFC offset
72 // - body's BFC offset + float's logical offset
73 //
74 // For code safety reasons {@code parent_bfc_block_offset} is Optional here
75 // because the block's offset can be only determined before the actual float's
76 // placement event.
77 WTF::Optional<LayoutUnit> parent_bfc_block_offset;
78
53 // Writing mode of the float's constraint space. 79 // Writing mode of the float's constraint space.
54 NGWritingMode writing_mode; 80 NGWritingMode writing_mode;
55 81
56 RefPtr<NGPhysicalFragment> fragment; 82 RefPtr<NGPhysicalFragment> fragment;
57 83
58 bool IsLeft() const { return exclusion_type == NGExclusion::kFloatLeft; } 84 bool IsLeft() const { return exclusion_type == NGExclusion::kFloatLeft; }
59 85
60 bool IsRight() const { return exclusion_type == NGExclusion::kFloatRight; } 86 bool IsRight() const { return exclusion_type == NGExclusion::kFloatRight; }
61 87
62 String ToString() const { 88 String ToString() const {
(...skipping 17 matching lines...) Expand all
80 exclusion_type = NGExclusion::kFloatLeft; 106 exclusion_type = NGExclusion::kFloatLeft;
81 if (style.Floating() == EFloat::kRight) 107 if (style.Floating() == EFloat::kRight)
82 exclusion_type = NGExclusion::kFloatRight; 108 exclusion_type = NGExclusion::kFloatRight;
83 clear_type = style.Clear(); 109 clear_type = style.Clear();
84 } 110 }
85 }; 111 };
86 112
87 } // namespace blink 113 } // namespace blink
88 114
89 #endif // NGFloatingObject_h 115 #endif // NGFloatingObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_block_node.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_floats_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698