Commit eecb91af authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Inline NGFragmentBuilder

The functions are all trivial

R=mstensho@chromium.org

Change-Id: Ica0db0344ff13d03a363d7f58e19389fa1ea08d5
Reviewed-on: https://chromium-review.googlesource.com/c/1292888
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601547}
parent 0319f74a
......@@ -430,7 +430,6 @@ blink_core_sources("layout") {
"ng/ng_floats_utils.cc",
"ng/ng_floats_utils.h",
"ng/ng_fragment.h",
"ng/ng_fragment_builder.cc",
"ng/ng_fragment_builder.h",
"ng/ng_fragmentation_utils.cc",
"ng/ng_fragmentation_utils.h",
......
// Copyright 2017 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 "third_party/blink/renderer/core/layout/ng/ng_fragment_builder.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
namespace blink {
NGFragmentBuilder::NGFragmentBuilder(scoped_refptr<const ComputedStyle> style,
WritingMode writing_mode,
TextDirection direction)
: style_(std::move(style)),
writing_mode_(writing_mode),
direction_(direction),
style_variant_(NGStyleVariant::kStandard) {
DCHECK(style_);
}
NGFragmentBuilder::NGFragmentBuilder(WritingMode writing_mode,
TextDirection direction)
: writing_mode_(writing_mode), direction_(direction) {}
NGFragmentBuilder::~NGFragmentBuilder() = default;
NGFragmentBuilder& NGFragmentBuilder::SetStyle(
scoped_refptr<const ComputedStyle> style,
NGStyleVariant style_variant) {
DCHECK(style);
style_ = std::move(style);
style_variant_ = style_variant;
return *this;
}
} // namespace blink
......@@ -10,21 +10,20 @@
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_logical_size.h"
#include "third_party/blink/renderer/core/layout/ng/ng_break_token.h"
#include "third_party/blink/renderer/core/layout/ng/ng_style_variant.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/text/writing_mode.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class ComputedStyle;
class LayoutObject;
class NGBreakToken;
class CORE_EXPORT NGFragmentBuilder {
STACK_ALLOCATED();
public:
virtual ~NGFragmentBuilder();
virtual ~NGFragmentBuilder() {}
const ComputedStyle& Style() const {
DCHECK(style_);
......@@ -34,8 +33,13 @@ class CORE_EXPORT NGFragmentBuilder {
style_variant_ = style_variant;
return *this;
}
NGFragmentBuilder& SetStyle(scoped_refptr<const ComputedStyle>,
NGStyleVariant);
NGFragmentBuilder& SetStyle(scoped_refptr<const ComputedStyle> style,
NGStyleVariant style_variant) {
DCHECK(style);
style_ = std::move(style);
style_variant_ = style_variant;
return *this;
}
WritingMode GetWritingMode() const { return writing_mode_; }
TextDirection Direction() const { return direction_; }
......@@ -53,10 +57,17 @@ class CORE_EXPORT NGFragmentBuilder {
LayoutObject* GetLayoutObject() { return layout_object_; }
protected:
NGFragmentBuilder(scoped_refptr<const ComputedStyle>,
WritingMode,
TextDirection);
NGFragmentBuilder(WritingMode, TextDirection);
NGFragmentBuilder(scoped_refptr<const ComputedStyle> style,
WritingMode writing_mode,
TextDirection direction)
: style_(std::move(style)),
writing_mode_(writing_mode),
direction_(direction),
style_variant_(NGStyleVariant::kStandard) {
DCHECK(style_);
}
NGFragmentBuilder(WritingMode writing_mode, TextDirection direction)
: writing_mode_(writing_mode), direction_(direction) {}
private:
scoped_refptr<const ComputedStyle> style_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment