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

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

Issue 2732223007: Revert of Combine 2 exclusions in Layout Opportunity Tree if they shadow each other (Closed)
Patch Set: Created 3 years, 9 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 NGExclusion_h 5 #ifndef NGExclusion_h
6 #define NGExclusion_h 6 #define NGExclusion_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/geometry/ng_logical_rect.h" 9 #include "core/layout/ng/geometry/ng_logical_rect.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
(...skipping 13 matching lines...) Expand all
24 kFloatRight = 2 24 kFloatRight = 2
25 }; 25 };
26 26
27 // Rectangle in logical coordinates the represents this exclusion. 27 // Rectangle in logical coordinates the represents this exclusion.
28 NGLogicalRect rect; 28 NGLogicalRect rect;
29 29
30 // Type of this exclusion. 30 // Type of this exclusion.
31 Type type; 31 Type type;
32 32
33 bool operator==(const NGExclusion& other) const; 33 bool operator==(const NGExclusion& other) const;
34
35 String ToString() const; 34 String ToString() const;
36
37 // Tries to combine the current exclusion with {@code other} exclusion and
38 // returns true if successful.
39 // We can combine 2 exclusions if they
40 // - adjoining to each other and have the same exclusion type
41 // - {@code other} exclusion shadows the current one.
42 // That's because it's not allowed to position anything in the shadowed
43 // area.
44 //
45 // Example:
46 // <div id="SS" style="float: left; height: 10px; width: 10px"></div>
47 // <div id="BB" style="float: left; height: 20px; width: 20px"></div>
48 // +----------------+
49 // |SSBB
50 // |**BB
51 // We combine SS and BB exclusions including the shadowed area (**).
52 bool MaybeCombineWith(const NGExclusion& other);
53 }; 35 };
54 36
55 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGExclusion&); 37 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGExclusion&);
56 38
57 struct CORE_EXPORT NGExclusions { 39 struct CORE_EXPORT NGExclusions {
58 NGExclusions(); 40 NGExclusions();
59 NGExclusions(const NGExclusions& other); 41 NGExclusions(const NGExclusions& other);
60 42
61 Vector<std::unique_ptr<const NGExclusion>> storage; 43 Vector<std::unique_ptr<const NGExclusion>> storage;
62 44
63 // Last left/right float exclusions are used to enforce the top edge alignment 45 // Last left/right float exclusions are used to enforce the top edge alignment
64 // rule for floats and for the support of CSS "clear" property. 46 // rule for floats and for the support of CSS "clear" property.
65 const NGExclusion* last_left_float; // Owned by storage. 47 const NGExclusion* last_left_float; // Owned by storage.
66 const NGExclusion* last_right_float; // Owned by storage. 48 const NGExclusion* last_right_float; // Owned by storage.
67 49
68 NGExclusions& operator=(const NGExclusions& other); 50 NGExclusions& operator=(const NGExclusions& other);
69 51
70 void Add(const NGExclusion& exclusion); 52 void Add(const NGExclusion& exclusion);
71 }; 53 };
72 54
73 } // namespace blink 55 } // namespace blink
74 56
75 #endif // NGExclusion_h 57 #endif // NGExclusion_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698