| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 5594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5605 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | 5605 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); |
| 5606 registerMockedHttpURLLoad("Ahem.ttf"); | 5606 registerMockedHttpURLLoad("Ahem.ttf"); |
| 5607 | 5607 |
| 5608 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, | 5608 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, |
| 5609 nullptr); | 5609 nullptr); |
| 5610 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); | 5610 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); |
| 5611 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 5611 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
| 5612 m_webViewHelper.resize(WebSize(640, 480)); | 5612 m_webViewHelper.resize(WebSize(640, 480)); |
| 5613 } | 5613 } |
| 5614 | 5614 |
| 5615 void runTest(const char* testFile) { | 5615 void runTestWithNoSelection(const char* testFile) { |
| 5616 registerMockedHttpURLLoad(testFile); | 5616 registerMockedHttpURLLoad(testFile); |
| 5617 m_webViewHelper.webView()->setFocus(true); | 5617 m_webViewHelper.webView()->setFocus(true); |
| 5618 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), | 5618 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 5619 m_baseURL + testFile); | 5619 m_baseURL + testFile); |
| 5620 m_webViewHelper.webView()->updateAllLifecyclePhases(); | 5620 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 5621 | 5621 |
| 5622 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); | 5622 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
| 5623 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); | 5623 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
| 5624 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); | 5624 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
| 5625 | 5625 |
| 5626 EXPECT_FALSE(selection); |
| 5627 EXPECT_FALSE(selectStart); |
| 5628 EXPECT_FALSE(selectEnd); |
| 5629 } |
| 5630 |
| 5631 void runTest(const char* testFile) { |
| 5632 registerMockedHttpURLLoad(testFile); |
| 5633 m_webViewHelper.webView()->setFocus(true); |
| 5634 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 5635 m_baseURL + testFile); |
| 5636 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 5637 |
| 5626 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 5638 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 5627 v8::Local<v8::Value> result = | 5639 v8::Local<v8::Value> result = |
| 5628 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( | 5640 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( |
| 5629 WebScriptSource("expectedResult")); | 5641 WebScriptSource("expectedResult")); |
| 5630 if (result.IsEmpty() || (*result)->IsUndefined()) { | 5642 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); |
| 5631 EXPECT_FALSE(selection); | 5643 |
| 5632 EXPECT_FALSE(selectStart); | 5644 ASSERT_TRUE((*result)->IsArray()); |
| 5633 EXPECT_FALSE(selectEnd); | 5645 v8::Array& expectedResult = *v8::Array::Cast(*result); |
| 5634 return; | 5646 ASSERT_GE(expectedResult.Length(), 10u); |
| 5635 } | 5647 |
| 5648 v8::Local<v8::Context> context = |
| 5649 v8::Isolate::GetCurrent()->GetCurrentContext(); |
| 5650 |
| 5651 const int startEdgeTopInLayerX = expectedResult.Get(context, 1) |
| 5652 .ToLocalChecked() |
| 5653 .As<v8::Int32>() |
| 5654 ->Value(); |
| 5655 const int startEdgeTopInLayerY = expectedResult.Get(context, 2) |
| 5656 .ToLocalChecked() |
| 5657 .As<v8::Int32>() |
| 5658 ->Value(); |
| 5659 const int startEdgeBottomInLayerX = expectedResult.Get(context, 3) |
| 5660 .ToLocalChecked() |
| 5661 .As<v8::Int32>() |
| 5662 ->Value(); |
| 5663 const int startEdgeBottomInLayerY = expectedResult.Get(context, 4) |
| 5664 .ToLocalChecked() |
| 5665 .As<v8::Int32>() |
| 5666 ->Value(); |
| 5667 |
| 5668 const int endEdgeTopInLayerX = expectedResult.Get(context, 6) |
| 5669 .ToLocalChecked() |
| 5670 .As<v8::Int32>() |
| 5671 ->Value(); |
| 5672 const int endEdgeTopInLayerY = expectedResult.Get(context, 7) |
| 5673 .ToLocalChecked() |
| 5674 .As<v8::Int32>() |
| 5675 ->Value(); |
| 5676 const int endEdgeBottomInLayerX = expectedResult.Get(context, 8) |
| 5677 .ToLocalChecked() |
| 5678 .As<v8::Int32>() |
| 5679 ->Value(); |
| 5680 const int endEdgeBottomInLayerY = expectedResult.Get(context, 9) |
| 5681 .ToLocalChecked() |
| 5682 .As<v8::Int32>() |
| 5683 ->Value(); |
| 5684 |
| 5685 const IntPoint hitPoint = |
| 5686 IntPoint((startEdgeTopInLayerX + startEdgeBottomInLayerX + |
| 5687 endEdgeTopInLayerX + endEdgeBottomInLayerX) / |
| 5688 4, |
| 5689 (startEdgeTopInLayerY + startEdgeBottomInLayerY + |
| 5690 endEdgeTopInLayerY + endEdgeBottomInLayerY) / |
| 5691 4 + |
| 5692 3); |
| 5693 |
| 5694 WebGestureEvent gestureEvent(WebInputEvent::GestureTap, |
| 5695 WebInputEvent::NoModifiers, |
| 5696 WebInputEvent::TimeStampForTesting); |
| 5697 gestureEvent.setFrameScale(1); |
| 5698 gestureEvent.x = gestureEvent.globalX = hitPoint.x(); |
| 5699 gestureEvent.y = gestureEvent.globalY = hitPoint.y(); |
| 5700 gestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 5701 |
| 5702 m_webViewHelper.webView() |
| 5703 ->mainFrameImpl() |
| 5704 ->frame() |
| 5705 ->eventHandler() |
| 5706 .handleGestureEvent(gestureEvent); |
| 5707 |
| 5708 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
| 5709 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
| 5710 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
| 5636 | 5711 |
| 5637 ASSERT_TRUE(selection); | 5712 ASSERT_TRUE(selection); |
| 5638 ASSERT_TRUE(selectStart); | 5713 ASSERT_TRUE(selectStart); |
| 5639 ASSERT_TRUE(selectEnd); | 5714 ASSERT_TRUE(selectEnd); |
| 5640 | 5715 |
| 5641 EXPECT_FALSE(selection->isNone()); | 5716 EXPECT_FALSE(selection->isNone()); |
| 5642 | 5717 |
| 5643 ASSERT_TRUE((*result)->IsArray()); | |
| 5644 v8::Array& expectedResult = *v8::Array::Cast(*result); | |
| 5645 ASSERT_GE(expectedResult.Length(), 10u); | |
| 5646 | |
| 5647 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( | 5718 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( |
| 5648 v8::Isolate::GetCurrent(), expectedResult.Get(0)); | 5719 v8::Isolate::GetCurrent(), expectedResult.Get(0)); |
| 5649 ASSERT_TRUE(layerOwnerNodeForStart); | 5720 ASSERT_TRUE(layerOwnerNodeForStart); |
| 5650 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() | 5721 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() |
| 5651 ->enclosingLayer() | 5722 ->enclosingLayer() |
| 5652 ->enclosingLayerForPaintInvalidation() | 5723 ->enclosingLayerForPaintInvalidation() |
| 5653 ->graphicsLayerBacking() | 5724 ->graphicsLayerBacking() |
| 5654 ->platformLayer() | 5725 ->platformLayer() |
| 5655 ->id(), | 5726 ->id(), |
| 5656 selectStart->layerId); | 5727 selectStart->layerId); |
| 5657 v8::Local<v8::Context> context = | 5728 |
| 5658 v8::Isolate::GetCurrent()->GetCurrentContext(); | 5729 EXPECT_EQ(startEdgeTopInLayerX, selectStart->edgeTopInLayer.x); |
| 5659 EXPECT_EQ(expectedResult.Get(context, 1) | 5730 EXPECT_EQ(startEdgeTopInLayerY, selectStart->edgeTopInLayer.y); |
| 5660 .ToLocalChecked() | 5731 EXPECT_EQ(startEdgeBottomInLayerX, selectStart->edgeBottomInLayer.x); |
| 5661 .As<v8::Int32>() | |
| 5662 ->Value(), | |
| 5663 selectStart->edgeTopInLayer.x); | |
| 5664 EXPECT_EQ(expectedResult.Get(context, 2) | |
| 5665 .ToLocalChecked() | |
| 5666 .As<v8::Int32>() | |
| 5667 ->Value(), | |
| 5668 selectStart->edgeTopInLayer.y); | |
| 5669 EXPECT_EQ(expectedResult.Get(context, 3) | |
| 5670 .ToLocalChecked() | |
| 5671 .As<v8::Int32>() | |
| 5672 ->Value(), | |
| 5673 selectStart->edgeBottomInLayer.x); | |
| 5674 | 5732 |
| 5675 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( | 5733 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( |
| 5676 v8::Isolate::GetCurrent(), | 5734 v8::Isolate::GetCurrent(), |
| 5677 expectedResult.Get(context, 5).ToLocalChecked()); | 5735 expectedResult.Get(context, 5).ToLocalChecked()); |
| 5678 | 5736 |
| 5679 ASSERT_TRUE(layerOwnerNodeForEnd); | 5737 ASSERT_TRUE(layerOwnerNodeForEnd); |
| 5680 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() | 5738 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() |
| 5681 ->enclosingLayer() | 5739 ->enclosingLayer() |
| 5682 ->enclosingLayerForPaintInvalidation() | 5740 ->enclosingLayerForPaintInvalidation() |
| 5683 ->graphicsLayerBacking() | 5741 ->graphicsLayerBacking() |
| 5684 ->platformLayer() | 5742 ->platformLayer() |
| 5685 ->id(), | 5743 ->id(), |
| 5686 selectEnd->layerId); | 5744 selectEnd->layerId); |
| 5687 EXPECT_EQ(expectedResult.Get(context, 6) | 5745 |
| 5688 .ToLocalChecked() | 5746 EXPECT_EQ(endEdgeTopInLayerX, selectEnd->edgeTopInLayer.x); |
| 5689 .As<v8::Int32>() | 5747 EXPECT_EQ(endEdgeTopInLayerY, selectEnd->edgeTopInLayer.y); |
| 5690 ->Value(), | 5748 EXPECT_EQ(endEdgeBottomInLayerX, selectEnd->edgeBottomInLayer.x); |
| 5691 selectEnd->edgeTopInLayer.x); | |
| 5692 EXPECT_EQ(expectedResult.Get(context, 7) | |
| 5693 .ToLocalChecked() | |
| 5694 .As<v8::Int32>() | |
| 5695 ->Value(), | |
| 5696 selectEnd->edgeTopInLayer.y); | |
| 5697 EXPECT_EQ(expectedResult.Get(context, 8) | |
| 5698 .ToLocalChecked() | |
| 5699 .As<v8::Int32>() | |
| 5700 ->Value(), | |
| 5701 selectEnd->edgeBottomInLayer.x); | |
| 5702 | 5749 |
| 5703 // Platform differences can introduce small stylistic deviations in | 5750 // Platform differences can introduce small stylistic deviations in |
| 5704 // y-axis positioning, the details of which aren't relevant to | 5751 // y-axis positioning, the details of which aren't relevant to |
| 5705 // selection behavior. However, such deviations from the expected value | 5752 // selection behavior. However, such deviations from the expected value |
| 5706 // should be consistent for the corresponding y coordinates. | 5753 // should be consistent for the corresponding y coordinates. |
| 5707 int yBottomEpsilon = 0; | 5754 int yBottomEpsilon = 0; |
| 5708 if (expectedResult.Length() == 13) | 5755 if (expectedResult.Length() == 13) |
| 5709 yBottomEpsilon = expectedResult.Get(context, 12) | 5756 yBottomEpsilon = expectedResult.Get(context, 12) |
| 5710 .ToLocalChecked() | 5757 .ToLocalChecked() |
| 5711 .As<v8::Int32>() | 5758 .As<v8::Int32>() |
| 5712 ->Value(); | 5759 ->Value(); |
| 5713 int yBottomDeviation = expectedResult.Get(context, 4) | 5760 int yBottomDeviation = |
| 5714 .ToLocalChecked() | 5761 startEdgeBottomInLayerY - selectStart->edgeBottomInLayer.y; |
| 5715 .As<v8::Int32>() | |
| 5716 ->Value() - | |
| 5717 selectStart->edgeBottomInLayer.y; | |
| 5718 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); | 5762 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); |
| 5719 EXPECT_EQ(yBottomDeviation, expectedResult.Get(context, 9) | 5763 EXPECT_EQ(yBottomDeviation, |
| 5720 .ToLocalChecked() | 5764 endEdgeBottomInLayerY - selectEnd->edgeBottomInLayer.y); |
| 5721 .As<v8::Int32>() | |
| 5722 ->Value() - | |
| 5723 selectEnd->edgeBottomInLayer.y); | |
| 5724 | 5765 |
| 5725 if (expectedResult.Length() >= 12) { | 5766 if (expectedResult.Length() >= 12) { |
| 5726 EXPECT_EQ(expectedResult.Get(context, 10) | 5767 EXPECT_EQ(expectedResult.Get(context, 10) |
| 5727 .ToLocalChecked() | 5768 .ToLocalChecked() |
| 5728 .As<v8::Boolean>() | 5769 .As<v8::Boolean>() |
| 5729 ->Value(), | 5770 ->Value(), |
| 5730 m_fakeSelectionLayerTreeView.selection()->isEditable()); | 5771 m_fakeSelectionLayerTreeView.selection()->isEditable()); |
| 5731 EXPECT_EQ( | 5772 EXPECT_EQ( |
| 5732 expectedResult.Get(context, 11) | 5773 expectedResult.Get(context, 11) |
| 5733 .ToLocalChecked() | 5774 .ToLocalChecked() |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5746 | 5787 |
| 5747 runTest(testFile); | 5788 runTest(testFile); |
| 5748 } | 5789 } |
| 5749 | 5790 |
| 5750 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; | 5791 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; |
| 5751 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; | 5792 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; |
| 5752 FrameTestHelpers::WebViewHelper m_webViewHelper; | 5793 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 5753 }; | 5794 }; |
| 5754 | 5795 |
| 5755 TEST_F(CompositedSelectionBoundsTest, None) { | 5796 TEST_F(CompositedSelectionBoundsTest, None) { |
| 5756 runTest("composited_selection_bounds_none.html"); | 5797 runTestWithNoSelection("composited_selection_bounds_none.html"); |
| 5757 } | 5798 } |
| 5758 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { | 5799 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { |
| 5759 runTest("composited_selection_bounds_none_readonly_caret.html"); | 5800 runTestWithNoSelection( |
| 5801 "composited_selection_bounds_none_readonly_caret.html"); |
| 5760 } | 5802 } |
| 5803 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { |
| 5804 runTestWithNoSelection("composited_selection_bounds_detached_frame.html"); |
| 5805 } |
| 5806 |
| 5761 TEST_F(CompositedSelectionBoundsTest, Basic) { | 5807 TEST_F(CompositedSelectionBoundsTest, Basic) { |
| 5762 runTest("composited_selection_bounds_basic.html"); | 5808 runTest("composited_selection_bounds_basic.html"); |
| 5763 } | 5809 } |
| 5764 TEST_F(CompositedSelectionBoundsTest, Transformed) { | 5810 TEST_F(CompositedSelectionBoundsTest, Transformed) { |
| 5765 runTest("composited_selection_bounds_transformed.html"); | 5811 runTest("composited_selection_bounds_transformed.html"); |
| 5766 } | 5812 } |
| 5767 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { | 5813 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { |
| 5768 runTest("composited_selection_bounds_vertical_rl.html"); | 5814 runTest("composited_selection_bounds_vertical_rl.html"); |
| 5769 } | 5815 } |
| 5770 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { | 5816 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { |
| 5771 runTest("composited_selection_bounds_vertical_lr.html"); | 5817 runTest("composited_selection_bounds_vertical_lr.html"); |
| 5772 } | 5818 } |
| 5773 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { | 5819 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { |
| 5774 runTest("composited_selection_bounds_split_layer.html"); | 5820 runTest("composited_selection_bounds_split_layer.html"); |
| 5775 } | 5821 } |
| 5776 TEST_F(CompositedSelectionBoundsTest, EmptyLayer) { | |
| 5777 runTest("composited_selection_bounds_empty_layer.html"); | |
| 5778 } | |
| 5779 TEST_F(CompositedSelectionBoundsTest, Iframe) { | 5822 TEST_F(CompositedSelectionBoundsTest, Iframe) { |
| 5780 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", | 5823 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", |
| 5781 "composited_selection_bounds_basic.html", nullptr); | 5824 "composited_selection_bounds_basic.html", nullptr); |
| 5782 } | 5825 } |
| 5783 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { | |
| 5784 runTest("composited_selection_bounds_detached_frame.html"); | |
| 5785 } | |
| 5786 TEST_F(CompositedSelectionBoundsTest, Editable) { | 5826 TEST_F(CompositedSelectionBoundsTest, Editable) { |
| 5787 runTest("composited_selection_bounds_editable.html"); | 5827 runTest("composited_selection_bounds_editable.html"); |
| 5788 } | 5828 } |
| 5789 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { | 5829 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { |
| 5790 runTest("composited_selection_bounds_editable_div.html"); | 5830 runTest("composited_selection_bounds_editable_div.html"); |
| 5791 } | 5831 } |
| 5792 TEST_F(CompositedSelectionBoundsTest, EmptyEditableInput) { | |
| 5793 runTest("composited_selection_bounds_empty_editable_input.html"); | |
| 5794 } | |
| 5795 TEST_F(CompositedSelectionBoundsTest, EmptyEditableArea) { | |
| 5796 runTest("composited_selection_bounds_empty_editable_area.html"); | |
| 5797 } | |
| 5798 | |
| 5799 // Fails on Mac ASan 64 bot. https://crbug.com/588769. | |
| 5800 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) | |
| 5801 TEST_P(ParameterizedWebFrameTest, DISABLED_CompositedSelectionBoundsCleared) | |
| 5802 #else | |
| 5803 TEST_P(ParameterizedWebFrameTest, CompositedSelectionBoundsCleared) | |
| 5804 #endif | |
| 5805 { | |
| 5806 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | |
| 5807 | |
| 5808 registerMockedHttpURLLoad("select_range_basic.html"); | |
| 5809 registerMockedHttpURLLoad("select_range_scroll.html"); | |
| 5810 | |
| 5811 int viewWidth = 500; | |
| 5812 int viewHeight = 500; | |
| 5813 | |
| 5814 CompositedSelectionBoundsTestWebViewClient fakeSelectionWebViewClient; | |
| 5815 CompositedSelectionBoundsTestLayerTreeView& fakeSelectionLayerTreeView = | |
| 5816 fakeSelectionWebViewClient.selectionLayerTreeView(); | |
| 5817 | |
| 5818 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 5819 webViewHelper.initialize(true, nullptr, &fakeSelectionWebViewClient, nullptr); | |
| 5820 webViewHelper.webView()->settings()->setDefaultFontSize(12); | |
| 5821 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | |
| 5822 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | |
| 5823 webViewHelper.webView()->setFocus(true); | |
| 5824 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
| 5825 m_baseURL + "select_range_basic.html"); | |
| 5826 | |
| 5827 // The frame starts with no selection. | |
| 5828 WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); | |
| 5829 ASSERT_TRUE(frame->hasSelection()); | |
| 5830 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5831 | |
| 5832 // The selection cleared notification should be triggered upon layout. | |
| 5833 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
| 5834 ASSERT_FALSE(frame->hasSelection()); | |
| 5835 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5836 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5837 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5838 | |
| 5839 frame->executeCommand(WebString::fromUTF8("SelectAll")); | |
| 5840 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5841 ASSERT_TRUE(frame->hasSelection()); | |
| 5842 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5843 | |
| 5844 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
| 5845 m_baseURL + "select_range_scroll.html"); | |
| 5846 ASSERT_TRUE(frame->hasSelection()); | |
| 5847 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5848 | |
| 5849 // Transitions between non-empty selections should not trigger a clearing. | |
| 5850 WebRect startWebRect; | |
| 5851 WebRect endWebRect; | |
| 5852 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); | |
| 5853 WebPoint movedEnd(bottomRightMinusOne(endWebRect)); | |
| 5854 endWebRect.x -= 20; | |
| 5855 frame->selectRange(topLeft(startWebRect), movedEnd); | |
| 5856 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5857 ASSERT_TRUE(frame->hasSelection()); | |
| 5858 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5859 | |
| 5860 frame = webViewHelper.webView()->mainFrameImpl(); | |
| 5861 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
| 5862 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5863 ASSERT_FALSE(frame->hasSelection()); | |
| 5864 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5865 } | |
| 5866 | 5832 |
| 5867 class DisambiguationPopupTestWebViewClient | 5833 class DisambiguationPopupTestWebViewClient |
| 5868 : public FrameTestHelpers::TestWebViewClient { | 5834 : public FrameTestHelpers::TestWebViewClient { |
| 5869 public: | 5835 public: |
| 5870 bool didTapMultipleTargets(const WebSize&, | 5836 bool didTapMultipleTargets(const WebSize&, |
| 5871 const WebRect&, | 5837 const WebRect&, |
| 5872 const WebVector<WebRect>& targetRects) override { | 5838 const WebVector<WebRect>& targetRects) override { |
| 5873 EXPECT_GE(targetRects.size(), 2u); | 5839 EXPECT_GE(targetRects.size(), 2u); |
| 5874 m_triggered = true; | 5840 m_triggered = true; |
| 5875 return true; | 5841 return true; |
| (...skipping 5357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11233 | 11199 |
| 11234 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11200 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11235 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11201 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11236 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11202 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11237 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11203 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11238 | 11204 |
| 11239 webViewHelper.reset(); | 11205 webViewHelper.reset(); |
| 11240 } | 11206 } |
| 11241 | 11207 |
| 11242 } // namespace blink | 11208 } // namespace blink |
| OLD | NEW |