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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInlineTest.cpp

Issue 2616483002: Reduce rectangle merges when doing region-based hit test on text boxes (Closed)
Patch Set: Improve test to be platform agnostic. 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/layout/LayoutInline.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layout/LayoutInline.h" 5 #include "core/layout/LayoutInline.h"
6 6
7 #include "core/layout/LayoutBlockFlow.h" 7 #include "core/layout/LayoutBlockFlow.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 LayoutInline* splitInlinePart2 = toLayoutInline(block->continuation()); 34 LayoutInline* splitInlinePart2 = toLayoutInline(block->continuation());
35 ASSERT_TRUE(splitInlinePart2); 35 ASSERT_TRUE(splitInlinePart2);
36 ASSERT_TRUE(splitInlinePart2->firstChild()); 36 ASSERT_TRUE(splitInlinePart2->firstChild());
37 EXPECT_EQ(splitInlinePart2->firstChild(), 37 EXPECT_EQ(splitInlinePart2->firstChild(),
38 getLayoutObjectByElementId("after")); 38 getLayoutObjectByElementId("after"));
39 EXPECT_FALSE(splitInlinePart2->firstChild()->nextSibling()); 39 EXPECT_FALSE(splitInlinePart2->firstChild()->nextSibling());
40 EXPECT_FALSE(splitInlinePart2->continuation()); 40 EXPECT_FALSE(splitInlinePart2->continuation());
41 } 41 }
42 42
43 TEST_F(LayoutInlineTest, RegionHitTest) {
44 setBodyInnerHTML(
45 "<div><span id='lotsOfBoxes'>"
46 "This is a test line<br>This is a test line<br>This is a test line<br>"
47 "This is a test line<br>This is a test line<br>This is a test line<br>"
48 "This is a test line<br>This is a test line<br>This is a test line<br>"
49 "This is a test line<br>This is a test line<br>This is a test line<br>"
50 "This is a test line<br>This is a test line<br>This is a test line<br>"
51 "This is a test line<br>This is a test line<br>This is a test line<br>"
52 "</span></div>");
53
54 document().view()->updateAllLifecyclePhases();
55
56 LayoutInline* lotsOfBoxes =
57 toLayoutInline(getLayoutObjectByElementId("lotsOfBoxes"));
58 ASSERT_TRUE(lotsOfBoxes);
59
60 HitTestRequest hitRequest(HitTestRequest::TouchEvent |
61 HitTestRequest::ListBased);
62 LayoutPoint hitLocation(2, 5);
63 HitTestResult hitResult(hitRequest, hitLocation, 2, 1, 2, 1);
64 LayoutPoint hitOffset;
65
66 bool hitOutcome = lotsOfBoxes->hitTestCulledInline(
67 hitResult, hitResult.hitTestLocation(), hitOffset);
68 // Assert checks that we both hit something and that the area covered
69 // by "something" totally contains the hit region.
70 EXPECT_TRUE(hitOutcome);
71 }
72
43 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698