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

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

Issue 2641053005: Brush up localSelectionRectOfPositionTemplate (Closed)
Patch Set: 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
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 05:59:53 No need to have |bodyContent|. s"<img />"<img>"
yoichio 2017/01/20 08:30:41 Done.
2003 setBodyContent(bodyContent);
2004
2005 Node* node = document().querySelector("img");
2006 IntRect r = absoluteSelectionBoundsOf(VisiblePosition::create(
yosin_UTC9 2017/01/20 05:59:53 nit: Please avoid to use one letter variable name.
yoichio 2017/01/20 08:30:41 Done.
2007 PositionWithAffinity(Position(node, PositionAnchorType::AfterChildren))));
2008 }
yosin_UTC9 2017/01/20 05:59:53 EXPECT_EQ(IntRect(), r) ?
2009
2000 } // namespace blink 2010 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698