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

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

Issue 2816933003: Use Layout Opportunity Iterator to position new FC blocks. (Closed)
Patch Set: fix block-formatting-contexts-{005|007} Created 3 years, 8 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"
11 #include "core/layout/ng/ng_constraint_space.h" 11 #include "core/layout/ng/ng_constraint_space.h"
12 #include "core/layout/ng/ng_exclusion.h" 12 #include "core/layout/ng/ng_exclusion.h"
13 #include "core/layout/ng/ng_physical_fragment.h" 13 #include "core/layout/ng/ng_physical_fragment.h"
14 #include "core/style/ComputedStyle.h" 14 #include "core/style/ComputedStyle.h"
15 #include "core/style/ComputedStyleConstants.h" 15 #include "core/style/ComputedStyleConstants.h"
16 #include "platform/wtf/Optional.h"
16 #include "platform/wtf/RefPtr.h" 17 #include "platform/wtf/RefPtr.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 // Struct that keeps all information needed to position floats in LayoutNG. 21 // Struct that keeps all information needed to position floats in LayoutNG.
21 struct CORE_EXPORT NGFloatingObject : public RefCounted<NGFloatingObject> { 22 struct CORE_EXPORT NGFloatingObject : public RefCounted<NGFloatingObject> {
22 public: 23 public:
23 static RefPtr<NGFloatingObject> Create(const ComputedStyle& style, 24 static RefPtr<NGFloatingObject> Create(const ComputedStyle& style,
24 NGWritingMode writing_mode, 25 NGWritingMode writing_mode,
25 NGLogicalSize available_size, 26 NGLogicalSize available_size,
(...skipping 17 matching lines...) Expand all
43 // - origin_offset which represents the layout point for this float. 44 // - origin_offset which represents the layout point for this float.
44 // - from_offset which represents the point from where we need to calculate 45 // - from_offset which represents the point from where we need to calculate
45 // the relative logical offset for this float. 46 // the relative logical offset for this float.
46 // Layout details: 47 // Layout details:
47 // At the time when this float is created only *inline* offsets are known. 48 // 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 49 // 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. 50 // we resolved MarginStrut, adjusted the offset to clearance line etc.
50 NGLogicalOffset origin_offset; 51 NGLogicalOffset origin_offset;
51 NGLogicalOffset from_offset; 52 NGLogicalOffset from_offset;
52 53
54 // Calculated logical offset. It's never {@code nullopt} for a positioned
55 // float.
56 WTF::Optional<NGLogicalOffset> logical_offset;
57
53 // Writing mode of the float's constraint space. 58 // Writing mode of the float's constraint space.
54 NGWritingMode writing_mode; 59 NGWritingMode writing_mode;
55 60
56 RefPtr<NGPhysicalFragment> fragment; 61 RefPtr<NGPhysicalFragment> fragment;
57 62
58 // In the case where a legacy FloatingObject is attached to not its own 63 // In the case where a legacy FloatingObject is attached to not its own
59 // parent, e.g. a float surrounded by a bunch of nested empty divs, 64 // parent, e.g. a float surrounded by a bunch of nested empty divs,
60 // NG float fragment's LeftOffset() cannot be used as legacy FloatingObject's 65 // NG float fragment's LeftOffset() cannot be used as legacy FloatingObject's
61 // left offset because that offset should be relative to the original float 66 // left offset because that offset should be relative to the original float
62 // parent. 67 // parent.
(...skipping 27 matching lines...) Expand all
90 exclusion_type = NGExclusion::kFloatLeft; 95 exclusion_type = NGExclusion::kFloatLeft;
91 if (style.Floating() == EFloat::kRight) 96 if (style.Floating() == EFloat::kRight)
92 exclusion_type = NGExclusion::kFloatRight; 97 exclusion_type = NGExclusion::kFloatRight;
93 clear_type = style.Clear(); 98 clear_type = style.Clear();
94 } 99 }
95 }; 100 };
96 101
97 } // namespace blink 102 } // namespace blink
98 103
99 #endif // NGFloatingObject_h 104 #endif // NGFloatingObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698