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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_space_utils.cc

Issue 2770483002: CS of out-of-flow positioned objects should have is_new_fc == true (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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "core/layout/ng/ng_space_utils.h" 5 #include "core/layout/ng/ng_space_utils.h"
6 6
7 namespace blink { 7 namespace blink {
8 namespace { 8 namespace {
9 9
10 // Returns max of 2 {@code WTF::Optional} values. 10 // Returns max of 2 {@code WTF::Optional} values.
11 template <typename T> 11 template <typename T>
12 WTF::Optional<T> OptionalMax(const WTF::Optional<T>& value1, 12 WTF::Optional<T> OptionalMax(const WTF::Optional<T>& value1,
13 const WTF::Optional<T>& value2) { 13 const WTF::Optional<T>& value2) {
14 if (value1 && value2) { 14 if (value1 && value2) {
15 return std::max(value1.value(), value2.value()); 15 return std::max(value1.value(), value2.value());
16 } else if (value1) { 16 } else if (value1) {
17 return value1; 17 return value1;
18 } 18 }
19 return value2; 19 return value2;
20 } 20 }
21 21
22 bool isOutFlowPositioned(const EPosition& position) {
ikilpatrick 2017/03/23 16:39:59 IsOutOfFlowPositioned
Gleb Lanbin 2017/03/24 20:10:05 Done.
23 return position == EPosition::kAbsolute || position == EPosition::kFixed;
24 }
25
22 } // namespace 26 } // namespace
23 27
24 bool IsNewFormattingContextForInFlowBlockLevelChild( 28 bool IsNewFormattingContextForInFlowBlockLevelChild(
25 const NGConstraintSpace& space, 29 const NGConstraintSpace& space,
26 const ComputedStyle& style) { 30 const ComputedStyle& style) {
27 // TODO(layout-dev): This doesn't capture a few cases which can't be computed 31 // TODO(layout-dev): This doesn't capture a few cases which can't be computed
28 // directly from style yet: 32 // directly from style yet:
29 // - The child is a <fieldset>. 33 // - The child is a <fieldset>.
30 // - "column-span: all" is set on the child (requires knowledge that we are 34 // - "column-span: all" is set on the child (requires knowledge that we are
31 // in a multi-col formatting context). 35 // in a multi-col formatting context).
32 // (https://drafts.csswg.org/css-multicol-1/#valdef-column-span-all) 36 // (https://drafts.csswg.org/css-multicol-1/#valdef-column-span-all)
33 37
38 if (style.isFloating() || isOutFlowPositioned(style.position()))
39 return true;
40
34 if (style.specifiesColumns() || style.containsPaint() || 41 if (style.specifiesColumns() || style.containsPaint() ||
35 style.containsLayout()) 42 style.containsLayout())
36 return true; 43 return true;
37 44
38 if (!style.isOverflowVisible()) 45 if (!style.isOverflowVisible())
39 return true; 46 return true;
40 47
41 EDisplay display = style.display(); 48 EDisplay display = style.display();
42 if (display == EDisplay::kGrid || display == EDisplay::kFlex || 49 if (display == EDisplay::kGrid || display == EDisplay::kFlex ||
43 display == EDisplay::kWebkitBox) 50 display == EDisplay::kWebkitBox)
(...skipping 29 matching lines...) Expand all
73 return right_offset; 80 return right_offset;
74 case EClear::kBoth: 81 case EClear::kBoth:
75 return OptionalMax<LayoutUnit>(left_offset, right_offset); 82 return OptionalMax<LayoutUnit>(left_offset, right_offset);
76 default: 83 default:
77 ASSERT_NOT_REACHED(); 84 ASSERT_NOT_REACHED();
78 } 85 }
79 return WTF::nullopt; 86 return WTF::nullopt;
80 } 87 }
81 88
82 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698