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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp

Issue 2925063002: ALL-IN-ONE: Refactor ComputeInlineBoxPosition() (Closed)
Patch Set: 2017-06-08T19:15:47 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/VisibleUnits.h" 5 #include "core/editing/VisibleUnits.h"
6 6
7 #include <ostream> // NOLINT 7 #include <ostream> // NOLINT
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/dom/Text.h" 9 #include "core/dom/Text.h"
10 #include "core/editing/EditingTestBase.h" 10 #include "core/editing/EditingTestBase.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // http://crbug.com/716093 296 // http://crbug.com/716093
297 TEST_F(VisibleUnitsTest, ComputeInlineBoxPositionMixedEditable) { 297 TEST_F(VisibleUnitsTest, ComputeInlineBoxPositionMixedEditable) {
298 SetBodyContent( 298 SetBodyContent(
299 "<div contenteditable id=sample>abc<input contenteditable=false></div>"); 299 "<div contenteditable id=sample>abc<input contenteditable=false></div>");
300 Element* const sample = GetDocument().getElementById("sample"); 300 Element* const sample = GetDocument().getElementById("sample");
301 301
302 const InlineBoxPosition& actual = ComputeInlineBoxPosition( 302 const InlineBoxPosition& actual = ComputeInlineBoxPosition(
303 Position::LastPositionInNode(sample), TextAffinity::kDownstream); 303 Position::LastPositionInNode(sample), TextAffinity::kDownstream);
304 // Should not be in infinite-loop 304 // Should not be in infinite-loop
305 EXPECT_EQ(nullptr, actual.inline_box); 305 EXPECT_EQ(nullptr, actual.inline_box);
306 // TODO(editing-dev): We should return 0 for |InlineBoxPosition| when 306 EXPECT_EQ(0, actual.offset_in_box);
307 // |inline_box| is null.
308 EXPECT_EQ(2, actual.offset_in_box);
Xiaocheng 2017/06/08 21:34:12 This is behavioral change.
yosin_UTC9 2017/06/09 01:55:55 This comes from here: ORIGINAL: inline_box
309 } 307 }
310 308
311 TEST_F(VisibleUnitsTest, endOfDocument) { 309 TEST_F(VisibleUnitsTest, endOfDocument) {
312 const char* body_content = "<a id=host><b id=one>1</b><b id=two>22</b></a>"; 310 const char* body_content = "<a id=host><b id=one>1</b><b id=two>22</b></a>";
313 const char* shadow_content = 311 const char* shadow_content =
314 "<p><content select=#two></content></p><p><content " 312 "<p><content select=#two></content></p><p><content "
315 "select=#one></content></p>"; 313 "select=#one></content></p>";
316 SetBodyContent(body_content); 314 SetBodyContent(body_content);
317 SetShadowContent(shadow_content, "host"); 315 SetShadowContent(shadow_content, "host");
318 316
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 canonicalizationWithCollapsedSpaceAndIsolatedCombiningCharacter) { 1987 canonicalizationWithCollapsedSpaceAndIsolatedCombiningCharacter) {
1990 SetBodyContent("<p> &#x20E3;</p>"); // Leading space is necessary 1988 SetBodyContent("<p> &#x20E3;</p>"); // Leading space is necessary
1991 1989
1992 Node* paragraph = GetDocument().QuerySelector("p"); 1990 Node* paragraph = GetDocument().QuerySelector("p");
1993 Node* text = paragraph->firstChild(); 1991 Node* text = paragraph->firstChild();
1994 Position start = CanonicalPositionOf(Position::BeforeNode(paragraph)); 1992 Position start = CanonicalPositionOf(Position::BeforeNode(paragraph));
1995 EXPECT_EQ(Position(text, 2), start); 1993 EXPECT_EQ(Position(text, 2), start);
1996 } 1994 }
1997 1995
1998 } // namespace blink 1996 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698