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

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

Issue 2733133002: Combine 2 exclusions in Layout Opportunity Tree if they shadow each other (Closed)
Patch Set: delete unreachable return statement 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
34 String ToString() const; 35 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);
35 }; 53 };
36 54
37 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGExclusion&); 55 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGExclusion&);
38 56
39 struct CORE_EXPORT NGExclusions { 57 struct CORE_EXPORT NGExclusions {
40 NGExclusions(); 58 NGExclusions();
41 NGExclusions(const NGExclusions& other); 59 NGExclusions(const NGExclusions& other);
42 60
43 Vector<std::unique_ptr<const NGExclusion>> storage; 61 Vector<std::unique_ptr<const NGExclusion>> storage;
44 62
45 // Last left/right float exclusions are used to enforce the top edge alignment 63 // Last left/right float exclusions are used to enforce the top edge alignment
46 // rule for floats and for the support of CSS "clear" property. 64 // rule for floats and for the support of CSS "clear" property.
47 const NGExclusion* last_left_float; // Owned by storage. 65 const NGExclusion* last_left_float; // Owned by storage.
48 const NGExclusion* last_right_float; // Owned by storage. 66 const NGExclusion* last_right_float; // Owned by storage.
49 67
50 NGExclusions& operator=(const NGExclusions& other); 68 NGExclusions& operator=(const NGExclusions& other);
51 69
52 void Add(const NGExclusion& exclusion); 70 void Add(const NGExclusion& exclusion);
53 }; 71 };
54 72
55 } // namespace blink 73 } // namespace blink
56 74
57 #endif // NGExclusion_h 75 #endif // NGExclusion_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698