| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |