Commit 99ed8822 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Inline some more trivial functions

R=mstensho@chromium.org,eae@chromium.org

Change-Id: Ie77e1b604828e853f8432759d1fa726ce180b00b
Reviewed-on: https://chromium-review.googlesource.com/c/1303886Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603515}
parent 8824cfe1
...@@ -457,7 +457,6 @@ blink_core_sources("layout") { ...@@ -457,7 +457,6 @@ blink_core_sources("layout") {
"ng/ng_physical_container_fragment.h", "ng/ng_physical_container_fragment.h",
"ng/ng_physical_fragment.cc", "ng/ng_physical_fragment.cc",
"ng/ng_physical_fragment.h", "ng/ng_physical_fragment.h",
"ng/ng_positioned_float.cc",
"ng/ng_positioned_float.h", "ng/ng_positioned_float.h",
"ng/ng_relative_utils.cc", "ng/ng_relative_utils.cc",
"ng/ng_relative_utils.h", "ng/ng_relative_utils.h",
......
...@@ -78,7 +78,7 @@ bool ApplyClearance(const NGConstraintSpace& constraint_space, ...@@ -78,7 +78,7 @@ bool ApplyClearance(const NGConstraintSpace& constraint_space,
// Returns if the resulting fragment should be considered an "empty block". // Returns if the resulting fragment should be considered an "empty block".
// There is special casing for fragments like this, e.g. margins "collapse // There is special casing for fragments like this, e.g. margins "collapse
// through", etc. // through", etc.
bool IsEmptyBlock(bool is_new_fc, const NGLayoutResult& layout_result) { inline bool IsEmptyBlock(bool is_new_fc, const NGLayoutResult& layout_result) {
// TODO(ikilpatrick): This should be a DCHECK. // TODO(ikilpatrick): This should be a DCHECK.
if (is_new_fc) if (is_new_fc)
return false; return false;
...@@ -101,8 +101,8 @@ bool IsEmptyBlock(bool is_new_fc, const NGLayoutResult& layout_result) { ...@@ -101,8 +101,8 @@ bool IsEmptyBlock(bool is_new_fc, const NGLayoutResult& layout_result) {
} }
// As above; for convenience if you have a child_space. // As above; for convenience if you have a child_space.
bool IsEmptyBlock(const NGConstraintSpace& child_space, inline bool IsEmptyBlock(const NGConstraintSpace& child_space,
const NGLayoutResult& layout_result) { const NGLayoutResult& layout_result) {
return IsEmptyBlock(child_space.IsNewFormattingContext(), layout_result); return IsEmptyBlock(child_space.IsNewFormattingContext(), layout_result);
} }
......
...@@ -26,24 +26,6 @@ LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace& constraint_space, ...@@ -26,24 +26,6 @@ LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace& constraint_space,
return break_token->UsedBlockSize() - logical_fragment.BlockSize(); return break_token->UsedBlockSize() - logical_fragment.BlockSize();
} }
// Return true if the specified fragment is the first generated fragment of
// some node.
bool IsFirstFragment(const NGConstraintSpace& constraint_space,
const NGPhysicalFragment& fragment) {
// TODO(mstensho): Figure out how to behave for non-box fragments here. How
// can we tell whether it's the first one? Looking for previously used block
// space certainly isn't the answer.
if (!fragment.IsBox())
return true;
return PreviouslyUsedBlockSpace(constraint_space, fragment) <= LayoutUnit();
}
// Return true if the specified fragment is the final fragment of some node.
bool IsLastFragment(const NGPhysicalFragment& fragment) {
const auto* break_token = fragment.BreakToken();
return !break_token || break_token->IsFinished();
}
// At a class A break point [1], the break value with the highest precedence // At a class A break point [1], the break value with the highest precedence
// wins. If the two values have the same precedence (e.g. "left" and "right"), // wins. If the two values have the same precedence (e.g. "left" and "right"),
// the value specified on a latter object wins. // the value specified on a latter object wins.
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
#ifndef NGFragmentationUtils_h #ifndef NGFragmentationUtils_h
#define NGFragmentationUtils_h #define NGFragmentationUtils_h
#include "third_party/blink/renderer/core/layout/ng/ng_break_token.h"
#include "third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_input_node.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h"
#include "third_party/blink/renderer/core/style/computed_style_constants.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h"
#include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h"
namespace blink { namespace blink {
class NGConstraintSpace; class NGConstraintSpace;
class NGPhysicalFragment;
// Return the total amount of block space spent on a node by fragments // Return the total amount of block space spent on a node by fragments
// preceding this one (but not including this one). // preceding this one (but not including this one).
...@@ -21,10 +22,21 @@ LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace&, ...@@ -21,10 +22,21 @@ LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace&,
// Return true if the specified fragment is the first generated fragment of // Return true if the specified fragment is the first generated fragment of
// some node. // some node.
bool IsFirstFragment(const NGConstraintSpace&, const NGPhysicalFragment&); inline bool IsFirstFragment(const NGConstraintSpace& constraint_space,
const NGPhysicalFragment& fragment) {
// TODO(mstensho): Figure out how to behave for non-box fragments here. How
// can we tell whether it's the first one? Looking for previously used block
// space certainly isn't the answer.
if (!fragment.IsBox())
return true;
return PreviouslyUsedBlockSpace(constraint_space, fragment) <= LayoutUnit();
}
// Return true if the specified fragment is the final fragment of some node. // Return true if the specified fragment is the final fragment of some node.
bool IsLastFragment(const NGPhysicalFragment&); inline bool IsLastFragment(const NGPhysicalFragment& fragment) {
const auto* break_token = fragment.BreakToken();
return !break_token || break_token->IsFinished();
}
// Join two adjacent break values specified on break-before and/or break- // Join two adjacent break values specified on break-before and/or break-
// after. avoid* values win over auto values, and forced break values win over // after. avoid* values win over auto values, and forced break values win over
......
// 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_positioned_float.h"
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
namespace blink {
NGPositionedFloat::NGPositionedFloat(
scoped_refptr<NGLayoutResult> layout_result,
const NGBfcOffset& bfc_offset)
: layout_result(layout_result), bfc_offset(bfc_offset) {}
// Define the destructor here, so that we can forward-declare more in the header
// file.
NGPositionedFloat::~NGPositionedFloat() = default;
} // namespace blink
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_bfc_offset.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_bfc_offset.h"
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
namespace blink { namespace blink {
...@@ -16,8 +17,8 @@ class NGLayoutResult; ...@@ -16,8 +17,8 @@ class NGLayoutResult;
// Contains the information necessary for copying back data to a FloatingObject. // Contains the information necessary for copying back data to a FloatingObject.
struct CORE_EXPORT NGPositionedFloat { struct CORE_EXPORT NGPositionedFloat {
NGPositionedFloat(scoped_refptr<NGLayoutResult> layout_result, NGPositionedFloat(scoped_refptr<NGLayoutResult> layout_result,
const NGBfcOffset& bfc_offset); const NGBfcOffset& bfc_offset)
~NGPositionedFloat(); : layout_result(layout_result), bfc_offset(bfc_offset) {}
NGPositionedFloat(NGPositionedFloat&&) noexcept = default; NGPositionedFloat(NGPositionedFloat&&) noexcept = default;
NGPositionedFloat(const NGPositionedFloat&) = default; NGPositionedFloat(const NGPositionedFloat&) = default;
NGPositionedFloat& operator=(NGPositionedFloat&&) = default; NGPositionedFloat& operator=(NGPositionedFloat&&) = default;
......
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