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

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

Issue 2641053005: Brush up localSelectionRectOfPositionTemplate (Closed)
Patch Set: update Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/dom/Text.h" 7 #include "core/dom/Text.h"
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 #include "core/editing/VisiblePosition.h" 9 #include "core/editing/VisiblePosition.h"
10 #include "core/html/TextControlElement.h" 10 #include "core/html/TextControlElement.h"
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 endsOfNodeAreVisuallyDistinctPositionsWithEmptyLayoutChild) { 1990 endsOfNodeAreVisuallyDistinctPositionsWithEmptyLayoutChild) {
1991 // Repro case of crbug.com/584030 1991 // Repro case of crbug.com/584030
1992 const char* bodyContent = 1992 const char* bodyContent =
1993 "<button><rt><script>document.designMode = 'on'</script></rt></button>"; 1993 "<button><rt><script>document.designMode = 'on'</script></rt></button>";
1994 setBodyContent(bodyContent); 1994 setBodyContent(bodyContent);
1995 1995
1996 Node* button = document().querySelector("button"); 1996 Node* button = document().querySelector("button");
1997 EXPECT_TRUE(endsOfNodeAreVisuallyDistinctPositions(button)); 1997 EXPECT_TRUE(endsOfNodeAreVisuallyDistinctPositions(button));
1998 } 1998 }
1999 1999
2000 TEST_F(VisibleUnitsTest, localSelectionRectOfPositionTemplateNotCrash) {
2001 // Repro case of crbug.com/584030
2002 const char* bodyContent = "<div>foo<img></div>";
yosin_UTC9 2017/01/20 08:00:02 nit: no need to use |bodyContent|.
yoichio 2017/01/20 08:30:41 Done.
2003 setBodyContent(bodyContent);
2004
2005 Node* node = document().querySelector("img");
2006 IntRect rect = absoluteSelectionBoundsOf(VisiblePosition::create(
2007 PositionWithAffinity(Position(node, PositionAnchorType::AfterChildren))));
2008 EXPECT_EQ(IntRect(9, 9, 1, 1), rect);
yosin_UTC9 2017/01/20 08:00:03 I recommend to use EXPECT_FALSE(rect.isEmpty()) be
yoichio 2017/01/20 08:30:41 Done.
2009 }
2010
2000 } // namespace blink 2011 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698