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 5500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5511 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | 5511 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); |
5512 registerMockedHttpURLLoad("Ahem.ttf"); | 5512 registerMockedHttpURLLoad("Ahem.ttf"); |
5513 | 5513 |
5514 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, | 5514 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, |
5515 nullptr); | 5515 nullptr); |
5516 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); | 5516 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); |
5517 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 5517 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
5518 m_webViewHelper.resize(WebSize(640, 480)); | 5518 m_webViewHelper.resize(WebSize(640, 480)); |
5519 } | 5519 } |
5520 | 5520 |
5521 void runTest(const char* testFile) { | 5521 void runTestWithNoSelection(const char* testFile) { |
5522 registerMockedHttpURLLoad(testFile); | 5522 registerMockedHttpURLLoad(testFile); |
5523 m_webViewHelper.webView()->setFocus(true); | 5523 m_webViewHelper.webView()->setFocus(true); |
5524 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), | 5524 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
5525 m_baseURL + testFile); | 5525 m_baseURL + testFile); |
5526 m_webViewHelper.webView()->updateAllLifecyclePhases(); | 5526 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
5527 | 5527 |
5528 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); | 5528 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
5529 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); | 5529 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
5530 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); | 5530 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
5531 | 5531 |
| 5532 EXPECT_FALSE(selection); |
| 5533 EXPECT_FALSE(selectStart); |
| 5534 EXPECT_FALSE(selectEnd); |
| 5535 } |
| 5536 |
| 5537 void runTest(const char* testFile) { |
| 5538 registerMockedHttpURLLoad(testFile); |
| 5539 m_webViewHelper.webView()->setFocus(true); |
| 5540 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 5541 m_baseURL + testFile); |
| 5542 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 5543 |
5532 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 5544 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
5533 v8::Local<v8::Value> result = | 5545 v8::Local<v8::Value> result = |
5534 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( | 5546 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( |
5535 WebScriptSource("expectedResult")); | 5547 WebScriptSource("expectedResult")); |
5536 if (result.IsEmpty() || (*result)->IsUndefined()) { | 5548 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); |
5537 EXPECT_FALSE(selection); | 5549 |
5538 EXPECT_FALSE(selectStart); | 5550 ASSERT_TRUE((*result)->IsArray()); |
5539 EXPECT_FALSE(selectEnd); | 5551 v8::Array& expectedResult = *v8::Array::Cast(*result); |
5540 return; | 5552 ASSERT_GE(expectedResult.Length(), 10u); |
5541 } | 5553 |
| 5554 v8::Local<v8::Context> context = |
| 5555 v8::Isolate::GetCurrent()->GetCurrentContext(); |
| 5556 |
| 5557 const int startEdgeTopInLayerX = expectedResult.Get(context, 1) |
| 5558 .ToLocalChecked() |
| 5559 .As<v8::Int32>() |
| 5560 ->Value(); |
| 5561 const int startEdgeTopInLayerY = expectedResult.Get(context, 2) |
| 5562 .ToLocalChecked() |
| 5563 .As<v8::Int32>() |
| 5564 ->Value(); |
| 5565 const int startEdgeBottomInLayerX = expectedResult.Get(context, 3) |
| 5566 .ToLocalChecked() |
| 5567 .As<v8::Int32>() |
| 5568 ->Value(); |
| 5569 const int startEdgeBottomInLayerY = expectedResult.Get(context, 4) |
| 5570 .ToLocalChecked() |
| 5571 .As<v8::Int32>() |
| 5572 ->Value(); |
| 5573 |
| 5574 const int endEdgeTopInLayerX = expectedResult.Get(context, 6) |
| 5575 .ToLocalChecked() |
| 5576 .As<v8::Int32>() |
| 5577 ->Value(); |
| 5578 const int endEdgeTopInLayerY = expectedResult.Get(context, 7) |
| 5579 .ToLocalChecked() |
| 5580 .As<v8::Int32>() |
| 5581 ->Value(); |
| 5582 const int endEdgeBottomInLayerX = expectedResult.Get(context, 8) |
| 5583 .ToLocalChecked() |
| 5584 .As<v8::Int32>() |
| 5585 ->Value(); |
| 5586 const int endEdgeBottomInLayerY = expectedResult.Get(context, 9) |
| 5587 .ToLocalChecked() |
| 5588 .As<v8::Int32>() |
| 5589 ->Value(); |
| 5590 |
| 5591 const IntPoint hitPoint = |
| 5592 IntPoint((startEdgeTopInLayerX + startEdgeBottomInLayerX + |
| 5593 endEdgeTopInLayerX + endEdgeBottomInLayerX) / |
| 5594 4, |
| 5595 (startEdgeTopInLayerY + startEdgeBottomInLayerY + |
| 5596 endEdgeTopInLayerY + endEdgeBottomInLayerY) / |
| 5597 4 + |
| 5598 3); |
| 5599 |
| 5600 PlatformGestureEvent gestureEvent( |
| 5601 PlatformEvent::EventType::GestureTap, hitPoint, hitPoint, IntSize(0, 0), |
| 5602 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); |
| 5603 m_webViewHelper.webView() |
| 5604 ->mainFrameImpl() |
| 5605 ->frame() |
| 5606 ->eventHandler() |
| 5607 .handleGestureEvent(gestureEvent); |
| 5608 |
| 5609 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
| 5610 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
| 5611 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
5542 | 5612 |
5543 ASSERT_TRUE(selection); | 5613 ASSERT_TRUE(selection); |
5544 ASSERT_TRUE(selectStart); | 5614 ASSERT_TRUE(selectStart); |
5545 ASSERT_TRUE(selectEnd); | 5615 ASSERT_TRUE(selectEnd); |
5546 | 5616 |
5547 EXPECT_FALSE(selection->isNone()); | 5617 EXPECT_FALSE(selection->isNone()); |
5548 | 5618 |
5549 ASSERT_TRUE((*result)->IsArray()); | |
5550 v8::Array& expectedResult = *v8::Array::Cast(*result); | |
5551 ASSERT_GE(expectedResult.Length(), 10u); | |
5552 | |
5553 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( | 5619 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( |
5554 v8::Isolate::GetCurrent(), expectedResult.Get(0)); | 5620 v8::Isolate::GetCurrent(), expectedResult.Get(0)); |
5555 ASSERT_TRUE(layerOwnerNodeForStart); | 5621 ASSERT_TRUE(layerOwnerNodeForStart); |
5556 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() | 5622 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() |
5557 ->enclosingLayer() | 5623 ->enclosingLayer() |
5558 ->enclosingLayerForPaintInvalidation() | 5624 ->enclosingLayerForPaintInvalidation() |
5559 ->graphicsLayerBacking() | 5625 ->graphicsLayerBacking() |
5560 ->platformLayer() | 5626 ->platformLayer() |
5561 ->id(), | 5627 ->id(), |
5562 selectStart->layerId); | 5628 selectStart->layerId); |
5563 v8::Local<v8::Context> context = | 5629 |
5564 v8::Isolate::GetCurrent()->GetCurrentContext(); | 5630 EXPECT_EQ(startEdgeTopInLayerX, selectStart->edgeTopInLayer.x); |
5565 EXPECT_EQ(expectedResult.Get(context, 1) | 5631 EXPECT_EQ(startEdgeTopInLayerY, selectStart->edgeTopInLayer.y); |
5566 .ToLocalChecked() | 5632 EXPECT_EQ(startEdgeBottomInLayerX, selectStart->edgeBottomInLayer.x); |
5567 .As<v8::Int32>() | |
5568 ->Value(), | |
5569 selectStart->edgeTopInLayer.x); | |
5570 EXPECT_EQ(expectedResult.Get(context, 2) | |
5571 .ToLocalChecked() | |
5572 .As<v8::Int32>() | |
5573 ->Value(), | |
5574 selectStart->edgeTopInLayer.y); | |
5575 EXPECT_EQ(expectedResult.Get(context, 3) | |
5576 .ToLocalChecked() | |
5577 .As<v8::Int32>() | |
5578 ->Value(), | |
5579 selectStart->edgeBottomInLayer.x); | |
5580 | 5633 |
5581 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( | 5634 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( |
5582 v8::Isolate::GetCurrent(), | 5635 v8::Isolate::GetCurrent(), |
5583 expectedResult.Get(context, 5).ToLocalChecked()); | 5636 expectedResult.Get(context, 5).ToLocalChecked()); |
5584 | 5637 |
5585 ASSERT_TRUE(layerOwnerNodeForEnd); | 5638 ASSERT_TRUE(layerOwnerNodeForEnd); |
5586 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() | 5639 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() |
5587 ->enclosingLayer() | 5640 ->enclosingLayer() |
5588 ->enclosingLayerForPaintInvalidation() | 5641 ->enclosingLayerForPaintInvalidation() |
5589 ->graphicsLayerBacking() | 5642 ->graphicsLayerBacking() |
5590 ->platformLayer() | 5643 ->platformLayer() |
5591 ->id(), | 5644 ->id(), |
5592 selectEnd->layerId); | 5645 selectEnd->layerId); |
5593 EXPECT_EQ(expectedResult.Get(context, 6) | 5646 |
5594 .ToLocalChecked() | 5647 EXPECT_EQ(endEdgeTopInLayerX, selectEnd->edgeTopInLayer.x); |
5595 .As<v8::Int32>() | 5648 EXPECT_EQ(endEdgeTopInLayerY, selectEnd->edgeTopInLayer.y); |
5596 ->Value(), | 5649 EXPECT_EQ(endEdgeBottomInLayerX, selectEnd->edgeBottomInLayer.x); |
5597 selectEnd->edgeTopInLayer.x); | |
5598 EXPECT_EQ(expectedResult.Get(context, 7) | |
5599 .ToLocalChecked() | |
5600 .As<v8::Int32>() | |
5601 ->Value(), | |
5602 selectEnd->edgeTopInLayer.y); | |
5603 EXPECT_EQ(expectedResult.Get(context, 8) | |
5604 .ToLocalChecked() | |
5605 .As<v8::Int32>() | |
5606 ->Value(), | |
5607 selectEnd->edgeBottomInLayer.x); | |
5608 | 5650 |
5609 // Platform differences can introduce small stylistic deviations in | 5651 // Platform differences can introduce small stylistic deviations in |
5610 // y-axis positioning, the details of which aren't relevant to | 5652 // y-axis positioning, the details of which aren't relevant to |
5611 // selection behavior. However, such deviations from the expected value | 5653 // selection behavior. However, such deviations from the expected value |
5612 // should be consistent for the corresponding y coordinates. | 5654 // should be consistent for the corresponding y coordinates. |
5613 int yBottomEpsilon = 0; | 5655 int yBottomEpsilon = 0; |
5614 if (expectedResult.Length() == 13) | 5656 if (expectedResult.Length() == 13) |
5615 yBottomEpsilon = expectedResult.Get(context, 12) | 5657 yBottomEpsilon = expectedResult.Get(context, 12) |
5616 .ToLocalChecked() | 5658 .ToLocalChecked() |
5617 .As<v8::Int32>() | 5659 .As<v8::Int32>() |
5618 ->Value(); | 5660 ->Value(); |
5619 int yBottomDeviation = expectedResult.Get(context, 4) | 5661 int yBottomDeviation = |
5620 .ToLocalChecked() | 5662 startEdgeBottomInLayerY - selectStart->edgeBottomInLayer.y; |
5621 .As<v8::Int32>() | |
5622 ->Value() - | |
5623 selectStart->edgeBottomInLayer.y; | |
5624 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); | 5663 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); |
5625 EXPECT_EQ(yBottomDeviation, expectedResult.Get(context, 9) | 5664 EXPECT_EQ(yBottomDeviation, |
5626 .ToLocalChecked() | 5665 endEdgeBottomInLayerY - selectEnd->edgeBottomInLayer.y); |
5627 .As<v8::Int32>() | |
5628 ->Value() - | |
5629 selectEnd->edgeBottomInLayer.y); | |
5630 | 5666 |
5631 if (expectedResult.Length() >= 12) { | 5667 if (expectedResult.Length() >= 12) { |
5632 EXPECT_EQ(expectedResult.Get(context, 10) | 5668 EXPECT_EQ(expectedResult.Get(context, 10) |
5633 .ToLocalChecked() | 5669 .ToLocalChecked() |
5634 .As<v8::Boolean>() | 5670 .As<v8::Boolean>() |
5635 ->Value(), | 5671 ->Value(), |
5636 m_fakeSelectionLayerTreeView.selection()->isEditable()); | 5672 m_fakeSelectionLayerTreeView.selection()->isEditable()); |
5637 EXPECT_EQ( | 5673 EXPECT_EQ( |
5638 expectedResult.Get(context, 11) | 5674 expectedResult.Get(context, 11) |
5639 .ToLocalChecked() | 5675 .ToLocalChecked() |
(...skipping 12 matching lines...) Expand all Loading... |
5652 | 5688 |
5653 runTest(testFile); | 5689 runTest(testFile); |
5654 } | 5690 } |
5655 | 5691 |
5656 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; | 5692 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; |
5657 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; | 5693 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; |
5658 FrameTestHelpers::WebViewHelper m_webViewHelper; | 5694 FrameTestHelpers::WebViewHelper m_webViewHelper; |
5659 }; | 5695 }; |
5660 | 5696 |
5661 TEST_F(CompositedSelectionBoundsTest, None) { | 5697 TEST_F(CompositedSelectionBoundsTest, None) { |
5662 runTest("composited_selection_bounds_none.html"); | 5698 runTestWithNoSelection("composited_selection_bounds_none.html"); |
5663 } | 5699 } |
5664 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { | 5700 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { |
5665 runTest("composited_selection_bounds_none_readonly_caret.html"); | 5701 runTestWithNoSelection( |
| 5702 "composited_selection_bounds_none_readonly_caret.html"); |
5666 } | 5703 } |
| 5704 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { |
| 5705 runTestWithNoSelection("composited_selection_bounds_detached_frame.html"); |
| 5706 } |
| 5707 |
5667 TEST_F(CompositedSelectionBoundsTest, Basic) { | 5708 TEST_F(CompositedSelectionBoundsTest, Basic) { |
5668 runTest("composited_selection_bounds_basic.html"); | 5709 runTest("composited_selection_bounds_basic.html"); |
5669 } | 5710 } |
5670 TEST_F(CompositedSelectionBoundsTest, Transformed) { | 5711 TEST_F(CompositedSelectionBoundsTest, Transformed) { |
5671 runTest("composited_selection_bounds_transformed.html"); | 5712 runTest("composited_selection_bounds_transformed.html"); |
5672 } | 5713 } |
5673 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { | 5714 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { |
5674 runTest("composited_selection_bounds_vertical_rl.html"); | 5715 runTest("composited_selection_bounds_vertical_rl.html"); |
5675 } | 5716 } |
5676 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { | 5717 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { |
5677 runTest("composited_selection_bounds_vertical_lr.html"); | 5718 runTest("composited_selection_bounds_vertical_lr.html"); |
5678 } | 5719 } |
5679 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { | 5720 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { |
5680 runTest("composited_selection_bounds_split_layer.html"); | 5721 runTest("composited_selection_bounds_split_layer.html"); |
5681 } | 5722 } |
5682 TEST_F(CompositedSelectionBoundsTest, EmptyLayer) { | |
5683 runTest("composited_selection_bounds_empty_layer.html"); | |
5684 } | |
5685 TEST_F(CompositedSelectionBoundsTest, Iframe) { | 5723 TEST_F(CompositedSelectionBoundsTest, Iframe) { |
5686 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", | 5724 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", |
5687 "composited_selection_bounds_basic.html", nullptr); | 5725 "composited_selection_bounds_basic.html", nullptr); |
5688 } | 5726 } |
5689 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { | |
5690 runTest("composited_selection_bounds_detached_frame.html"); | |
5691 } | |
5692 TEST_F(CompositedSelectionBoundsTest, Editable) { | 5727 TEST_F(CompositedSelectionBoundsTest, Editable) { |
5693 runTest("composited_selection_bounds_editable.html"); | 5728 runTest("composited_selection_bounds_editable.html"); |
5694 } | 5729 } |
5695 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { | 5730 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { |
5696 runTest("composited_selection_bounds_editable_div.html"); | 5731 runTest("composited_selection_bounds_editable_div.html"); |
5697 } | 5732 } |
5698 TEST_F(CompositedSelectionBoundsTest, EmptyEditableInput) { | |
5699 runTest("composited_selection_bounds_empty_editable_input.html"); | |
5700 } | |
5701 TEST_F(CompositedSelectionBoundsTest, EmptyEditableArea) { | |
5702 runTest("composited_selection_bounds_empty_editable_area.html"); | |
5703 } | |
5704 | |
5705 // Fails on Mac ASan 64 bot. https://crbug.com/588769. | |
5706 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) | |
5707 TEST_P(ParameterizedWebFrameTest, DISABLED_CompositedSelectionBoundsCleared) | |
5708 #else | |
5709 TEST_P(ParameterizedWebFrameTest, CompositedSelectionBoundsCleared) | |
5710 #endif | |
5711 { | |
5712 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | |
5713 | |
5714 registerMockedHttpURLLoad("select_range_basic.html"); | |
5715 registerMockedHttpURLLoad("select_range_scroll.html"); | |
5716 | |
5717 int viewWidth = 500; | |
5718 int viewHeight = 500; | |
5719 | |
5720 CompositedSelectionBoundsTestWebViewClient fakeSelectionWebViewClient; | |
5721 CompositedSelectionBoundsTestLayerTreeView& fakeSelectionLayerTreeView = | |
5722 fakeSelectionWebViewClient.selectionLayerTreeView(); | |
5723 | |
5724 FrameTestHelpers::WebViewHelper webViewHelper; | |
5725 webViewHelper.initialize(true, nullptr, &fakeSelectionWebViewClient, nullptr); | |
5726 webViewHelper.webView()->settings()->setDefaultFontSize(12); | |
5727 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | |
5728 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | |
5729 webViewHelper.webView()->setFocus(true); | |
5730 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
5731 m_baseURL + "select_range_basic.html"); | |
5732 | |
5733 // The frame starts with no selection. | |
5734 WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); | |
5735 ASSERT_TRUE(frame->hasSelection()); | |
5736 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5737 | |
5738 // The selection cleared notification should be triggered upon layout. | |
5739 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
5740 ASSERT_FALSE(frame->hasSelection()); | |
5741 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5742 webViewHelper.webView()->updateAllLifecyclePhases(); | |
5743 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5744 | |
5745 frame->executeCommand(WebString::fromUTF8("SelectAll")); | |
5746 webViewHelper.webView()->updateAllLifecyclePhases(); | |
5747 ASSERT_TRUE(frame->hasSelection()); | |
5748 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5749 | |
5750 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
5751 m_baseURL + "select_range_scroll.html"); | |
5752 ASSERT_TRUE(frame->hasSelection()); | |
5753 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5754 | |
5755 // Transitions between non-empty selections should not trigger a clearing. | |
5756 WebRect startWebRect; | |
5757 WebRect endWebRect; | |
5758 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); | |
5759 WebPoint movedEnd(bottomRightMinusOne(endWebRect)); | |
5760 endWebRect.x -= 20; | |
5761 frame->selectRange(topLeft(startWebRect), movedEnd); | |
5762 webViewHelper.webView()->updateAllLifecyclePhases(); | |
5763 ASSERT_TRUE(frame->hasSelection()); | |
5764 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5765 | |
5766 frame = webViewHelper.webView()->mainFrameImpl(); | |
5767 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
5768 webViewHelper.webView()->updateAllLifecyclePhases(); | |
5769 ASSERT_FALSE(frame->hasSelection()); | |
5770 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
5771 } | |
5772 | 5733 |
5773 class DisambiguationPopupTestWebViewClient | 5734 class DisambiguationPopupTestWebViewClient |
5774 : public FrameTestHelpers::TestWebViewClient { | 5735 : public FrameTestHelpers::TestWebViewClient { |
5775 public: | 5736 public: |
5776 bool didTapMultipleTargets(const WebSize&, | 5737 bool didTapMultipleTargets(const WebSize&, |
5777 const WebRect&, | 5738 const WebRect&, |
5778 const WebVector<WebRect>& targetRects) override { | 5739 const WebVector<WebRect>& targetRects) override { |
5779 EXPECT_GE(targetRects.size(), 2u); | 5740 EXPECT_GE(targetRects.size(), 2u); |
5780 m_triggered = true; | 5741 m_triggered = true; |
5781 return true; | 5742 return true; |
(...skipping 4867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10649 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 10610 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
10650 HashSet<AtomicString> names; | 10611 HashSet<AtomicString> names; |
10651 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 10612 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
10652 frame = frame->tree().traverseNext()) { | 10613 frame = frame->tree().traverseNext()) { |
10653 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); | 10614 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); |
10654 } | 10615 } |
10655 EXPECT_EQ(10u, names.size()); | 10616 EXPECT_EQ(10u, names.size()); |
10656 } | 10617 } |
10657 | 10618 |
10658 } // namespace blink | 10619 } // namespace blink |
OLD | NEW |