summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-16 09:59:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-20 10:28:53 +0000
commit6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch)
treec8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h
parent3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff)
downloadqtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h
index 398293d8127..aa4aa8ba2a7 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h
+++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h
@@ -17,11 +17,31 @@ class ComputedStyle;
class NGLayoutResult;
struct MinMaxSizeInput;
+// Operations provided by a layout algorithm.
+class NGLayoutAlgorithmOperations {
+ public:
+ // Actual layout function. Lays out the children and descendants within the
+ // constraints given by the NGConstraintSpace. Returns a layout result with
+ // the resulting layout information.
+ // TODO(layout-dev): attempt to make this function const.
+ virtual scoped_refptr<const NGLayoutResult> Layout() = 0;
+
+ // Computes the min-content and max-content intrinsic sizes for the given box.
+ // The result will not take any min-width, max-width or width properties into
+ // account. If the return value is empty, the caller is expected to synthesize
+ // this value from the overflow rect returned from Layout called with an
+ // available width of 0 and LayoutUnit::max(), respectively.
+ virtual base::Optional<MinMaxSize> ComputeMinMaxSize(
+ const MinMaxSizeInput&) const {
+ return base::nullopt;
+ }
+};
+
// Base class for all LayoutNG algorithms.
template <typename NGInputNodeType,
typename NGBoxFragmentBuilderType,
typename NGBreakTokenType>
-class CORE_EXPORT NGLayoutAlgorithm {
+class CORE_EXPORT NGLayoutAlgorithm : public NGLayoutAlgorithmOperations {
STACK_ALLOCATED();
public:
NGLayoutAlgorithm(NGInputNodeType node,
@@ -30,9 +50,12 @@ class CORE_EXPORT NGLayoutAlgorithm {
TextDirection direction,
const NGBreakTokenType* break_token)
: node_(node),
- constraint_space_(space),
break_token_(break_token),
- container_builder_(node, style, space.GetWritingMode(), direction) {}
+ container_builder_(node,
+ style,
+ &space,
+ space.GetWritingMode(),
+ direction) {}
NGLayoutAlgorithm(NGInputNodeType node,
const NGConstraintSpace& space,
@@ -45,31 +68,18 @@ class CORE_EXPORT NGLayoutAlgorithm {
virtual ~NGLayoutAlgorithm() = default;
- // Actual layout function. Lays out the children and descendants within the
- // constraints given by the NGConstraintSpace. Returns a layout result with
- // the resulting layout information.
- // TODO(layout-dev): attempt to make this function const.
- virtual scoped_refptr<NGLayoutResult> Layout() = 0;
-
- // Computes the min-content and max-content intrinsic sizes for the given box.
- // The result will not take any min-width, max-width or width properties into
- // account. If the return value is empty, the caller is expected to synthesize
- // this value from the overflow rect returned from Layout called with an
- // available width of 0 and LayoutUnit::max(), respectively.
- virtual base::Optional<MinMaxSize> ComputeMinMaxSize(
- const MinMaxSizeInput&) const {
- return base::nullopt;
- }
-
protected:
- const NGConstraintSpace& ConstraintSpace() const { return constraint_space_; }
+ const NGConstraintSpace& ConstraintSpace() const {
+ DCHECK(container_builder_.ConstraintSpace());
+ return *container_builder_.ConstraintSpace();
+ }
const ComputedStyle& Style() const { return node_.Style(); }
NGBfcOffset ContainerBfcOffset() const {
DCHECK(container_builder_.BfcBlockOffset());
return {container_builder_.BfcLineOffset(),
- container_builder_.BfcBlockOffset().value()};
+ *container_builder_.BfcBlockOffset()};
}
NGInputNodeType Node() const { return node_; }
@@ -77,7 +87,6 @@ class CORE_EXPORT NGLayoutAlgorithm {
const NGBreakTokenType* BreakToken() const { return break_token_.get(); }
NGInputNodeType node_;
- const NGConstraintSpace& constraint_space_;
// The break token from which we are currently resuming layout.
scoped_refptr<const NGBreakTokenType> break_token_;