Commit 95b6f35b authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Inline more functions

R=eae@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I8fa58c33fc9fab68edac7c8159254bfd8389560f
Reviewed-on: https://chromium-review.googlesource.com/c/1285313
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600404}
parent 692baf0a
...@@ -466,7 +466,6 @@ blink_core_sources("layout") { ...@@ -466,7 +466,6 @@ blink_core_sources("layout") {
"ng/ng_space_utils.h", "ng/ng_space_utils.h",
"ng/ng_text_decoration_offset.cc", "ng/ng_text_decoration_offset.cc",
"ng/ng_text_decoration_offset.h", "ng/ng_text_decoration_offset.h",
"ng/ng_unpositioned_float.cc",
"ng/ng_unpositioned_float.h", "ng/ng_unpositioned_float.h",
"ng/ng_unpositioned_float_vector.h", "ng/ng_unpositioned_float_vector.h",
"order_iterator.cc", "order_iterator.cc",
......
...@@ -4,25 +4,10 @@ ...@@ -4,25 +4,10 @@
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_physical_size.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_physical_size.h"
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_logical_size.h"
#include "third_party/blink/renderer/platform/geometry/layout_size.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink { namespace blink {
bool NGPhysicalSize::operator==(const NGPhysicalSize& other) const {
return std::tie(other.width, other.height) == std::tie(width, height);
}
NGLogicalSize NGPhysicalSize::ConvertToLogical(WritingMode mode) const {
return mode == WritingMode::kHorizontalTb ? NGLogicalSize(width, height)
: NGLogicalSize(height, width);
}
LayoutSize NGPhysicalSize::ToLayoutSize() const {
return {width, height};
}
String NGPhysicalSize::ToString() const { String NGPhysicalSize::ToString() const {
return String::Format("%dx%d", width.ToInt(), height.ToInt()); return String::Format("%dx%d", width.ToInt(), height.ToInt());
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#define NGPhysicalSize_h #define NGPhysicalSize_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_logical_size.h"
#include "third_party/blink/renderer/platform/geometry/layout_size.h"
#include "third_party/blink/renderer/platform/layout_unit.h" #include "third_party/blink/renderer/platform/layout_unit.h"
#include "third_party/blink/renderer/platform/text/writing_mode.h" #include "third_party/blink/renderer/platform/text/writing_mode.h"
...@@ -24,9 +26,14 @@ struct CORE_EXPORT NGPhysicalSize { ...@@ -24,9 +26,14 @@ struct CORE_EXPORT NGPhysicalSize {
LayoutUnit width; LayoutUnit width;
LayoutUnit height; LayoutUnit height;
NGLogicalSize ConvertToLogical(WritingMode mode) const; NGLogicalSize ConvertToLogical(WritingMode mode) const {
return mode == WritingMode::kHorizontalTb ? NGLogicalSize(width, height)
: NGLogicalSize(height, width);
}
bool operator==(const NGPhysicalSize& other) const; bool operator==(const NGPhysicalSize& other) const {
return std::tie(other.width, other.height) == std::tie(width, height);
}
bool IsEmpty() const { bool IsEmpty() const {
return width == LayoutUnit() || height == LayoutUnit(); return width == LayoutUnit() || height == LayoutUnit();
...@@ -37,7 +44,7 @@ struct CORE_EXPORT NGPhysicalSize { ...@@ -37,7 +44,7 @@ struct CORE_EXPORT NGPhysicalSize {
// Conversions from/to existing code. New code prefers type safety for // Conversions from/to existing code. New code prefers type safety for
// logical/physical distinctions. // logical/physical distinctions.
LayoutSize ToLayoutSize() const; LayoutSize ToLayoutSize() const { return {width, height}; }
String ToString() const; String ToString() const;
}; };
......
// 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_unpositioned_float.h"
#include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h"
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
namespace blink {
// Define the constructor and destructor here, so that we can forward-declare
// more in the header file.
NGUnpositionedFloat::NGUnpositionedFloat(NGBlockNode node,
const NGBlockBreakToken* token)
: node(node), token(token) {}
NGUnpositionedFloat::~NGUnpositionedFloat() = default;
} // namespace blink
...@@ -20,8 +20,8 @@ struct CORE_EXPORT NGUnpositionedFloat final { ...@@ -20,8 +20,8 @@ struct CORE_EXPORT NGUnpositionedFloat final {
DISALLOW_NEW(); DISALLOW_NEW();
public: public:
NGUnpositionedFloat(NGBlockNode node, const NGBlockBreakToken* token); NGUnpositionedFloat(NGBlockNode node, const NGBlockBreakToken* token)
~NGUnpositionedFloat(); : node(node), token(token) {}
NGUnpositionedFloat(NGUnpositionedFloat&&) noexcept = default; NGUnpositionedFloat(NGUnpositionedFloat&&) noexcept = default;
NGUnpositionedFloat(const NGUnpositionedFloat&) noexcept = default; NGUnpositionedFloat(const NGUnpositionedFloat&) noexcept = 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