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

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

Issue 2457013004: Use NGLogicalRect instead of NGExclusion for exclusions. (Closed)
Patch Set: Created 4 years, 1 month 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 #include "core/layout/ng/ng_constraint_space.h" 5 #include "core/layout/ng/ng_constraint_space.h"
6 6
7 #include "core/layout/LayoutBlock.h" 7 #include "core/layout/LayoutBlock.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/layout/ng/ng_constraint_space.h" 9 #include "core/layout/ng/ng_constraint_space.h"
10 #include "core/layout/ng/ng_constraint_space_builder.h" 10 #include "core/layout/ng/ng_constraint_space_builder.h"
(...skipping 11 matching lines...) Expand all
22 direction_(direction) {} 22 direction_(direction) {}
23 23
24 NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode, 24 NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
25 NGDirection direction, 25 NGDirection direction,
26 const NGConstraintSpace& other, 26 const NGConstraintSpace& other,
27 NGLogicalSize size) 27 NGLogicalSize size)
28 : size_(size), writing_mode_(writing_mode), direction_(direction) { 28 : size_(size), writing_mode_(writing_mode), direction_(direction) {
29 physical_space_ = 29 physical_space_ =
30 new NGPhysicalConstraintSpace(size.ConvertToPhysical(writing_mode)); 30 new NGPhysicalConstraintSpace(size.ConvertToPhysical(writing_mode));
31 for (const auto& exclusion : other.PhysicalSpace()->Exclusions()) { 31 for (const auto& exclusion : other.PhysicalSpace()->Exclusions()) {
32 physical_space_->AddExclusion(exclusion); 32 physical_space_->AddExclusion(*exclusion.get());
33 } 33 }
34 } 34 }
35 35
36 NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject( 36 NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject(
37 const LayoutBox& box) { 37 const LayoutBox& box) {
38 bool fixed_inline = false, fixed_block = false, is_new_fc = false; 38 bool fixed_inline = false, fixed_block = false, is_new_fc = false;
39 // XXX for orthogonal writing mode this is not right 39 // XXX for orthogonal writing mode this is not right
40 LayoutUnit container_logical_width = 40 LayoutUnit container_logical_width =
41 std::max(LayoutUnit(), box.containingBlockLogicalWidthForContent()); 41 std::max(LayoutUnit(), box.containingBlockLogicalWidthForContent());
42 LayoutUnit container_logical_height; 42 LayoutUnit container_logical_height;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 .SetIsFixedSizeInline(fixed_inline) 75 .SetIsFixedSizeInline(fixed_inline)
76 .SetIsFixedSizeBlock(fixed_block) 76 .SetIsFixedSizeBlock(fixed_block)
77 .SetIsNewFormattingContext(is_new_fc); 77 .SetIsNewFormattingContext(is_new_fc);
78 78
79 return new NGConstraintSpace( 79 return new NGConstraintSpace(
80 FromPlatformWritingMode(box.styleRef().getWritingMode()), 80 FromPlatformWritingMode(box.styleRef().getWritingMode()),
81 FromPlatformDirection(box.styleRef().direction()), 81 FromPlatformDirection(box.styleRef().direction()),
82 builder.ToConstraintSpace()); 82 builder.ToConstraintSpace());
83 } 83 }
84 84
85 void NGConstraintSpace::AddExclusion(const NGExclusion* exclusion) const { 85 void NGConstraintSpace::AddExclusion(const NGLogicalRect& exclusion) const {
86 WRITING_MODE_IGNORED(
87 "Exclusions are stored directly in physical constraint"
88 "space.");
ikilpatrick 2016/10/28 23:18:24 previous line?
Gleb Lanbin 2016/10/28 23:54:09 Done.
86 MutablePhysicalSpace()->AddExclusion(exclusion); 89 MutablePhysicalSpace()->AddExclusion(exclusion);
87 } 90 }
88 91
89 NGLogicalSize NGConstraintSpace::ContainerSize() const { 92 NGLogicalSize NGConstraintSpace::ContainerSize() const {
90 return physical_space_->container_size_.ConvertToLogical( 93 return physical_space_->container_size_.ConvertToLogical(
91 static_cast<NGWritingMode>(writing_mode_)); 94 static_cast<NGWritingMode>(writing_mode_));
92 } 95 }
93 96
94 bool NGConstraintSpace::IsNewFormattingContext() const { 97 bool NGConstraintSpace::IsNewFormattingContext() const {
95 return physical_space_->is_new_fc_; 98 return physical_space_->is_new_fc_;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 179
177 String NGConstraintSpace::ToString() const { 180 String NGConstraintSpace::ToString() const {
178 return String::format("%s,%s %sx%s", 181 return String::format("%s,%s %sx%s",
179 offset_.inline_offset.toString().ascii().data(), 182 offset_.inline_offset.toString().ascii().data(),
180 offset_.block_offset.toString().ascii().data(), 183 offset_.block_offset.toString().ascii().data(),
181 size_.inline_size.toString().ascii().data(), 184 size_.inline_size.toString().ascii().data(),
182 size_.block_size.toString().ascii().data()); 185 size_.block_size.toString().ascii().data());
183 } 186 }
184 187
185 } // namespace blink 188 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698