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

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

Issue 2446243003: [LayoutNG] Add NGConstraintSpaceBuilder class. (Closed)
Patch Set: it's -> its \o/ 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/layout/ng/ng_constraint_space_builder.h"
6
7 namespace blink {
8
9 NGConstraintSpaceBuilder::NGConstraintSpaceBuilder(NGWritingMode writing_mode)
10 : writing_mode_(writing_mode) {}
11
12 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetContainerSize(
13 NGLogicalSize container_size) {
14 container_size_ = container_size;
15 return *this;
16 }
17
18 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetFixedSize(
19 bool fixed_inline,
20 bool fixed_block) {
21 fixed_inline_ = fixed_inline;
22 fixed_block_ = fixed_block;
23 return *this;
24 }
25
26 NGConstraintSpaceBuilder&
27 NGConstraintSpaceBuilder::SetOverflowTriggersScrollbar(
28 bool inline_direction_triggers_scrollbar,
29 bool block_direction_triggers_scrollbar) {
30 inline_direction_triggers_scrollbar_ = inline_direction_triggers_scrollbar;
31 block_direction_triggers_scrollbar_ = block_direction_triggers_scrollbar;
32 return *this;
33 }
34
35 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetFragmentationType(
36 NGFragmentationType fragmentation_type) {
37 fragmentation_type_ = fragmentation_type;
38 return *this;
39 }
40
41 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsNewFormattingContext(
42 bool is_new_fc) {
43 is_new_fc_ = is_new_fc;
44 return *this;
45 }
46
47 NGPhysicalConstraintSpace* NGConstraintSpaceBuilder::ToConstraintSpace() {
48 NGPhysicalSize container_size = container_size_.ConvertToPhysical(
49 static_cast<NGWritingMode>(writing_mode_));
50 if (writing_mode_ == HorizontalTopBottom) {
51 return new NGPhysicalConstraintSpace(
52 container_size, fixed_inline_, fixed_block_,
53 inline_direction_triggers_scrollbar_,
54 block_direction_triggers_scrollbar_, FragmentNone,
55 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_);
56 } else {
57 return new NGPhysicalConstraintSpace(
58 container_size, fixed_block_, fixed_inline_,
59 block_direction_triggers_scrollbar_,
60 inline_direction_triggers_scrollbar_,
61 static_cast<NGFragmentationType>(fragmentation_type_), FragmentNone,
62 is_new_fc_);
63 }
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698