Index: third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h b/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f9484e2528cf25169f3b863f4c64f322c1b01e97 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
@@ -0,0 +1,96 @@ |
+// 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. |
+ |
+#ifndef NGConstraintSpace_h |
+#define NGConstraintSpace_h |
+ |
+#include "platform/LayoutUnit.h" |
+#include "platform/PlatformExport.h" |
+ |
+namespace blink { |
+ |
+class NGDerivedConstraintSpace; |
+class NGExclusion; |
+ |
+class PLATFORM_EXPORT NGConstraintSpace { |
ikilpatrick
2016/07/27 21:14:12
CORE_EXPORT:)
ikilpatrick
2016/07/27 21:14:12
We'll also want to think about how this will work
eae
2016/07/27 21:24:16
I'd argue that we should have constraint spaces be
eae
2016/07/27 21:24:16
Done.
|
+public: |
+ NGConstraintSpace(); |
+ ~NGConstraintSpace(); |
+ |
+ enum NGClearExclusion { |
+ ClearNone = 0, |
+ ClearFloatLeft = 1, |
+ ClearFloatRight = 2, |
+ ClearFragment = 4 |
+ }; |
+ |
+ enum NGFragmentationType { |
+ FragmentNone, |
+ FragmentPage, |
+ FragmentColumn, |
+ FragmentRegion |
+ }; |
+ |
+ enum NGExclusionType { |
+ ExcludeNone, |
+ ExcludeInlineFlow, |
+ ExcludeInlineStart, |
+ ExcludeInlineEnd, |
+ ExcludeInlineBoth |
+ }; |
+ |
+ NGConstraintSpace(); |
+ ~NGConstraintSpace(); |
+ |
+ LayoutUnit inlineSize() const; |
+ LayoutUnit blockSize() const; |
+ |
+ // Some layout modes “stretch” their children to a fixed size (e.g. flex, |
+ // grid). These flags represented whether a layout needs to produce a |
+ // fragment that satisfies a fixed constraint in the inline and block |
+ // direction respectively. |
+ bool fixedInlineSize() const; |
+ bool fixedBlockSize() const; |
+ |
+ // The size threashold in the inline and block directions respesvitely that |
ikilpatrick
2016/07/27 21:14:12
respectively
|
+ // triggers the presence of a scrollbar. If exceeded the current layout |
+ // should be aborted and invoked again with a constraint space modified to |
+ // reserve space for a scrollbar. |
+ LayoutUnit inlineOverflowSize() const; |
+ LayoutUnit blockOverflowSize() const; |
ikilpatrick
2016/07/27 21:14:12
Same as below... any time when there would be diff
eae
2016/07/27 21:24:15
Yes. For a regular document the body would have an
|
+ |
+ // If specified a layout should produce a Fragment which fragments at the |
+ // blockFragmentationSize if possible. |
+ LayoutUnit blockFragmentationSize() const; |
ikilpatrick
2016/07/27 21:14:11
So when working on the spec I couldn't think of a
eae
2016/07/27 21:24:16
None comes to mind. I'll remove it.
|
+ NGFragmentationType blockFragmentationType() const; |
+ |
+ void addExclusion(NGExclusion, unsigned options = 0); |
+ List<NGExclusion> exclusions(unsigned options = 0) const; |
+ |
+ List<const DerivedNGConstraintSpace> layoutOpportunities( |
ikilpatrick
2016/07/27 21:14:11
TODO(layout-dev): move to generator eventually?
|
+ unsigned clear = ClearNone, |
+ NGClearExclusion = ExcludeNone) const; |
ikilpatrick
2016/07/27 21:14:12
Is NGClearExclusion meant to be "avoid"?
ikilpatrick
2016/07/27 21:14:12
Do we have any place today where the "step"/"jump-
eae
2016/07/27 21:24:16
Not today. I intentionally skipped the step-size a
eae
2016/07/27 21:24:16
Yeah
|
+}; |
+ |
+class PLATFORM_EXPORT NGDerivedConstraintSpace : NGConstraintSpace { |
+public: |
+ ~NGDerivedConstraintSpace(); |
+ LayoutUnit inlineOffset() const; |
+ LayoutUnit blockOffset() const; |
+ |
+ // When creating a derived NGConstraintSpace for the next inline level |
+ // layout opportunity, inlineSize and blockSize of the NGConstraintSpace |
+ // may be different from its parent. These properties hold the inline and |
+ // block size of the original NGConstraintSpaces, allowing percentage |
+ // resolution to work correctly. |
+ LayoutUnit inlineSizeForPercentageResolution() const; |
+ LayoutUnit blockSizeForPercentageResolution() const; |
+ |
+private: |
+ NGDerivedConstraintSpace(); |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // NGConstraintSpace_h |