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