Index: third_party/WebKit/Source/core/layout/ng/ng_derived_constraint_space.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_derived_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_derived_constraint_space.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5849ef90ba72612ca9dbe10124d6cb994b9a69d8 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_derived_constraint_space.cc |
@@ -0,0 +1,51 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/layout/ng/ng_derived_constraint_space.h" |
+ |
+#include "core/layout/LayoutBox.h" |
+#include "core/style/ComputedStyle.h" |
+ |
+namespace blink { |
+ |
+NGDerivedConstraintSpace* NGDerivedConstraintSpace::CreateFromLayoutObject( |
+ const LayoutBox& box) { |
+ bool fixedInline = false, fixedBlock = false; |
cbiesinger
2016/08/25 22:22:16
fixed_inline, fixed_block
ikilpatrick
2016/08/25 23:14:29
Done.
|
+ // XXX for orthogonal writing mode this is not right |
+ LayoutUnit container_logical_width = |
+ std::max(LayoutUnit(), box.containingBlockLogicalWidthForContent()); |
+ // XXX Make sure this height is correct |
+ LayoutUnit container_logical_height = |
+ box.containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding); |
+ if (box.hasOverrideLogicalContentWidth()) { |
+ container_logical_width = box.overrideLogicalContentWidth(); |
+ fixedInline = true; |
+ } |
+ if (box.hasOverrideLogicalContentHeight()) { |
+ container_logical_width = box.overrideLogicalContentHeight(); |
+ fixedBlock = true; |
+ } |
+ |
+ return new NGDerivedConstraintSpace( |
+ fromPlatformWritingMode(box.styleRef().getWritingMode()), |
+ NGLogicalSize(container_logical_width, container_logical_height), |
+ box.styleRef().overflowInlineDirection() == OverflowAuto, |
+ box.styleRef().overflowBlockDirection() == OverflowAuto, fixedInline, |
+ fixedBlock, FragmentNone); |
+} |
+ |
+NGDerivedConstraintSpace::NGDerivedConstraintSpace(NGWritingMode writing_mode, |
+ NGLogicalSize container_size, |
+ bool inline_triggers, |
+ bool block_triggers, |
+ bool fixed_inline, |
+ bool fixed_block, |
+ NGFragmentationType type) |
+ : NGConstraintSpace(writing_mode, container_size), direction_(LeftToRight) { |
+ SetOverflowTriggersScrollbar(inline_triggers, block_triggers); |
+ SetFixedSize(fixed_inline, fixed_block); |
+ SetFragmentationType(type); |
+} |
+ |
+} // namespace blink |