Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc

Issue 2921463004: [LayoutNG] PODify NGLayoutInputNode and sub-classes. (Closed)
Patch Set: new ng-bot expectations Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc
index e3d8a982f847947108d80cf29b6ceb81364755b5..9b117e1e7e6d3280170d0967249b694ae7d1c663 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker_test.cc
@@ -15,22 +15,21 @@ namespace blink {
class NGLineBreakerTest : public NGBaseLayoutAlgorithmTest {
protected:
- NGInlineNode* CreateInlineNode(const String& html_content) {
+ NGInlineNode CreateInlineNode(const String& html_content) {
SetBodyInnerHTML(html_content);
LayoutNGBlockFlow* block_flow =
ToLayoutNGBlockFlow(GetLayoutObjectByElementId("container"));
- NGInlineNode* inline_node =
- new NGInlineNode(block_flow->FirstChild(), block_flow);
-
- return inline_node;
+ return NGInlineNode(block_flow, block_flow->FirstChild());
}
// Break lines using the specified available width.
- Vector<NGInlineItemResults> BreakLines(NGInlineNode* node,
+ Vector<NGInlineItemResults> BreakLines(NGInlineNode node,
LayoutUnit available_width) {
- if (!node->IsPrepareLayoutFinished())
- node->PrepareLayout();
+ DCHECK(node);
+
+ if (!node.IsPrepareLayoutFinished())
+ node.PrepareLayout();
RefPtr<NGConstraintSpace> space =
NGConstraintSpaceBuilder(NGWritingMode::kHorizontalTopBottom)
@@ -52,18 +51,17 @@ class NGLineBreakerTest : public NGBaseLayoutAlgorithmTest {
namespace {
-String ToString(NGInlineItemResults line, NGInlineNode* node) {
+String ToString(NGInlineItemResults line, NGInlineNode node) {
StringBuilder builder;
for (const auto& item_result : line) {
- builder.Append(
- node->Text(item_result.start_offset, item_result.end_offset));
+ builder.Append(node.Text(item_result.start_offset, item_result.end_offset));
}
return builder.ToString();
}
TEST_F(NGLineBreakerTest, SingleNode) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {
@@ -88,7 +86,7 @@ TEST_F(NGLineBreakerTest, SingleNode) {
TEST_F(NGLineBreakerTest, OverflowWord) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {
@@ -114,7 +112,7 @@ TEST_F(NGLineBreakerTest, OverflowWord) {
TEST_F(NGLineBreakerTest, OverflowAtomicInline) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {
@@ -155,7 +153,7 @@ TEST_F(NGLineBreakerTest, OverflowAtomicInline) {
TEST_F(NGLineBreakerTest, OverflowMargin) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {
@@ -167,7 +165,7 @@ TEST_F(NGLineBreakerTest, OverflowMargin) {
</style>
<div id=container><span>123 456</span> 789</div>
)HTML");
- const Vector<NGInlineItem>& items = node->Items();
+ const Vector<NGInlineItem>& items = node.Items();
// While "123 456" can fit in a line, "456" has a right margin that cannot
// fit. Since "456" and its right margin is not breakable, "456" should be on
@@ -191,7 +189,7 @@ TEST_F(NGLineBreakerTest, OverflowMargin) {
TEST_F(NGLineBreakerTest, BoundaryInWord) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {
@@ -221,7 +219,7 @@ TEST_F(NGLineBreakerTest, BoundaryInWord) {
TEST_F(NGLineBreakerTest, BoundaryInFirstWord) {
LoadAhem();
- NGInlineNode* node = CreateInlineNode(R"HTML(
+ NGInlineNode node = CreateInlineNode(R"HTML(
<!DOCTYPE html>
<style>
#container {

Powered by Google App Engine
This is Rietveld 408576698