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

Unified Diff: Source/core/editing/VisibleUnitsTest.cpp

Issue 1330743002: Introduce composed tree version of absoluteCaretBoundsOf() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-07T16:44:33 Created 5 years, 3 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
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleUnitsTest.cpp
diff --git a/Source/core/editing/VisibleUnitsTest.cpp b/Source/core/editing/VisibleUnitsTest.cpp
index 58f4b284079f9c26926828f8ab1bbf53cc9c4e85..26707c80be65c0a0600c737eaeeb8b878ab9a1f4 100644
--- a/Source/core/editing/VisibleUnitsTest.cpp
+++ b/Source/core/editing/VisibleUnitsTest.cpp
@@ -27,6 +27,24 @@ PositionInComposedTreeWithAffinity positionWithAffinityInComposedTree(Node& anch
class VisibleUnitsTest : public EditingTestBase {
};
+TEST_F(VisibleUnitsTest, absoluteCaretBoundsOf)
+{
+ const char* bodyContent = "<p id='host'><b id='one'>11</b><b id='two'>22</b></p>";
+ const char* shadowContent = "<div><content select=#two></content><content select=#one></content></div>";
+ setBodyContent(bodyContent);
+ RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
+ updateLayoutAndStyleForPainting();
+
+ RefPtrWillBeRawPtr<Element> body = document().body();
+ RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
+
+ IntRect boundsInDOMTree = absoluteCaretBoundsOf(createVisiblePosition(Position(one.get(), 0)));
+ IntRect boundsInComposedTree = absoluteCaretBoundsOf(createVisiblePosition(PositionInComposedTree(one.get(), 0)));
+
+ EXPECT_FALSE(boundsInDOMTree.isEmpty());
+ EXPECT_EQ(boundsInDOMTree, boundsInComposedTree);
+}
+
TEST_F(VisibleUnitsTest, inSameLine)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698