| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/input/EventHandler.h" | 6 #include "core/input/EventHandler.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
| 10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 void EventHandlerTest::SetUp() | 36 void EventHandlerTest::SetUp() |
| 37 { | 37 { |
| 38 m_dummyPageHolder = DummyPageHolder::create(IntSize(300, 400)); | 38 m_dummyPageHolder = DummyPageHolder::create(IntSize(300, 400)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void EventHandlerTest::setHtmlInnerHTML(const char* htmlContent) | 41 void EventHandlerTest::setHtmlInnerHTML(const char* htmlContent) |
| 42 { | 42 { |
| 43 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); | 43 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); |
| 44 document().view()->updateLayoutAndStyleForPainting(); | 44 document().view()->updateAllLifecyclePhases(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST_F(EventHandlerTest, dragSelectionAfterScroll) | 47 TEST_F(EventHandlerTest, dragSelectionAfterScroll) |
| 48 { | 48 { |
| 49 setHtmlInnerHTML("<style> body { margin: 0px; } .upper { width: 300px; heigh
t: 400px; }" | 49 setHtmlInnerHTML("<style> body { margin: 0px; } .upper { width: 300px; heigh
t: 400px; }" |
| 50 ".lower { margin: 0px; width: 300px; height: 400px; } .line { display: b
lock; width: 300px; height: 30px; } </style>" | 50 ".lower { margin: 0px; width: 300px; height: 400px; } .line { display: b
lock; width: 300px; height: 30px; } </style>" |
| 51 "<div class=\"upper\"></div>" | 51 "<div class=\"upper\"></div>" |
| 52 "<div class=\"lower\">" | 52 "<div class=\"lower\">" |
| 53 "<span class=\"line\">Line 1</span><span class=\"line\">Line 2</span><sp
an class=\"line\">Line 3</span><span class=\"line\">Line 4</span><span class=\"l
ine\">Line 5</span>" | 53 "<span class=\"line\">Line 1</span><span class=\"line\">Line 2</span><sp
an class=\"line\">Line 3</span><span class=\"line\">Line 4</span><span class=\"l
ine\">Line 5</span>" |
| 54 "<span class=\"line\">Line 6</span><span class=\"line\">Line 7</span><sp
an class=\"line\">Line 8</span><span class=\"line\">Line 9</span><span class=\"l
ine\">Line 10</span>" | 54 "<span class=\"line\">Line 6</span><span class=\"line\">Line 7</span><sp
an class=\"line\">Line 8</span><span class=\"line\">Line 9</span><span class=\"l
ine\">Line 10</span>" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); | 91 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); |
| 92 | 92 |
| 93 FrameSelection& selection = document().frame()->selection(); | 93 FrameSelection& selection = document().frame()->selection(); |
| 94 ASSERT_TRUE(selection.isRange()); | 94 ASSERT_TRUE(selection.isRange()); |
| 95 RefPtrWillBeRawPtr<Range> range = selection.toNormalizedRange(); | 95 RefPtrWillBeRawPtr<Range> range = selection.toNormalizedRange(); |
| 96 ASSERT_TRUE(range.get()); | 96 ASSERT_TRUE(range.get()); |
| 97 EXPECT_EQ("Line 1\nLine 2", range->text()); | 97 EXPECT_EQ("Line 1\nLine 2", range->text()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |