| 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 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5377 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | 5377 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); |
| 5378 registerMockedHttpURLLoad("Ahem.ttf"); | 5378 registerMockedHttpURLLoad("Ahem.ttf"); |
| 5379 | 5379 |
| 5380 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, | 5380 m_webViewHelper.initialize(true, nullptr, &m_fakeSelectionWebViewClient, |
| 5381 nullptr); | 5381 nullptr); |
| 5382 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); | 5382 m_webViewHelper.webView()->settings()->setDefaultFontSize(12); |
| 5383 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | 5383 m_webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); |
| 5384 m_webViewHelper.resize(WebSize(640, 480)); | 5384 m_webViewHelper.resize(WebSize(640, 480)); |
| 5385 } | 5385 } |
| 5386 | 5386 |
| 5387 void runTest(const char* testFile) { | 5387 void runTestWithNoSelection(const char* testFile) { |
| 5388 registerMockedHttpURLLoad(testFile); | 5388 registerMockedHttpURLLoad(testFile); |
| 5389 m_webViewHelper.webView()->setFocus(true); | 5389 m_webViewHelper.webView()->setFocus(true); |
| 5390 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), | 5390 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 5391 m_baseURL + testFile); | 5391 m_baseURL + testFile); |
| 5392 m_webViewHelper.webView()->updateAllLifecyclePhases(); | 5392 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 5393 | 5393 |
| 5394 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); | 5394 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
| 5395 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); | 5395 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
| 5396 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); | 5396 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
| 5397 | 5397 |
| 5398 EXPECT_FALSE(selection); |
| 5399 EXPECT_FALSE(selectStart); |
| 5400 EXPECT_FALSE(selectEnd); |
| 5401 } |
| 5402 |
| 5403 void runTest(const char* testFile) { |
| 5404 registerMockedHttpURLLoad(testFile); |
| 5405 m_webViewHelper.webView()->setFocus(true); |
| 5406 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 5407 m_baseURL + testFile); |
| 5408 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 5409 |
| 5398 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 5410 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); |
| 5399 v8::Local<v8::Value> result = | 5411 v8::Local<v8::Value> result = |
| 5400 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( | 5412 m_webViewHelper.webView()->mainFrameImpl()->executeScriptAndReturnValue( |
| 5401 WebScriptSource("expectedResult")); | 5413 WebScriptSource("expectedResult")); |
| 5402 if (result.IsEmpty() || (*result)->IsUndefined()) { | 5414 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); |
| 5403 EXPECT_FALSE(selection); | 5415 |
| 5404 EXPECT_FALSE(selectStart); | 5416 ASSERT_TRUE((*result)->IsArray()); |
| 5405 EXPECT_FALSE(selectEnd); | 5417 v8::Array& expectedResult = *v8::Array::Cast(*result); |
| 5406 return; | 5418 ASSERT_GE(expectedResult.Length(), 10u); |
| 5407 } | 5419 |
| 5420 v8::Local<v8::Context> context = |
| 5421 v8::Isolate::GetCurrent()->GetCurrentContext(); |
| 5422 |
| 5423 const int startEdgeTopInLayerX = expectedResult.Get(context, 1) |
| 5424 .ToLocalChecked() |
| 5425 .As<v8::Int32>() |
| 5426 ->Value(); |
| 5427 const int startEdgeTopInLayerY = expectedResult.Get(context, 2) |
| 5428 .ToLocalChecked() |
| 5429 .As<v8::Int32>() |
| 5430 ->Value(); |
| 5431 const int startEdgeBottomInLayerX = expectedResult.Get(context, 3) |
| 5432 .ToLocalChecked() |
| 5433 .As<v8::Int32>() |
| 5434 ->Value(); |
| 5435 const int startEdgeBottomInLayerY = expectedResult.Get(context, 4) |
| 5436 .ToLocalChecked() |
| 5437 .As<v8::Int32>() |
| 5438 ->Value(); |
| 5439 |
| 5440 const int endEdgeTopInLayerX = expectedResult.Get(context, 6) |
| 5441 .ToLocalChecked() |
| 5442 .As<v8::Int32>() |
| 5443 ->Value(); |
| 5444 const int endEdgeTopInLayerY = expectedResult.Get(context, 7) |
| 5445 .ToLocalChecked() |
| 5446 .As<v8::Int32>() |
| 5447 ->Value(); |
| 5448 const int endEdgeBottomInLayerX = expectedResult.Get(context, 8) |
| 5449 .ToLocalChecked() |
| 5450 .As<v8::Int32>() |
| 5451 ->Value(); |
| 5452 const int endEdgeBottomInLayerY = expectedResult.Get(context, 9) |
| 5453 .ToLocalChecked() |
| 5454 .As<v8::Int32>() |
| 5455 ->Value(); |
| 5456 |
| 5457 const IntPoint hitPoint = |
| 5458 IntPoint((startEdgeTopInLayerX + startEdgeBottomInLayerX + |
| 5459 endEdgeTopInLayerX + endEdgeBottomInLayerX) / |
| 5460 4, |
| 5461 (startEdgeTopInLayerY + startEdgeBottomInLayerY + |
| 5462 endEdgeTopInLayerY + endEdgeBottomInLayerY) / |
| 5463 4 + |
| 5464 3); |
| 5465 |
| 5466 PlatformGestureEvent gestureEvent( |
| 5467 PlatformEvent::EventType::GestureTap, hitPoint, hitPoint, IntSize(0, 0), |
| 5468 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); |
| 5469 m_webViewHelper.webView() |
| 5470 ->mainFrameImpl() |
| 5471 ->frame() |
| 5472 ->eventHandler() |
| 5473 .handleGestureEvent(gestureEvent); |
| 5474 |
| 5475 const WebSelection* selection = m_fakeSelectionLayerTreeView.selection(); |
| 5476 const WebSelectionBound* selectStart = m_fakeSelectionLayerTreeView.start(); |
| 5477 const WebSelectionBound* selectEnd = m_fakeSelectionLayerTreeView.end(); |
| 5408 | 5478 |
| 5409 ASSERT_TRUE(selection); | 5479 ASSERT_TRUE(selection); |
| 5410 ASSERT_TRUE(selectStart); | 5480 ASSERT_TRUE(selectStart); |
| 5411 ASSERT_TRUE(selectEnd); | 5481 ASSERT_TRUE(selectEnd); |
| 5412 | 5482 |
| 5413 EXPECT_FALSE(selection->isNone()); | 5483 EXPECT_FALSE(selection->isNone()); |
| 5414 | 5484 |
| 5415 ASSERT_TRUE((*result)->IsArray()); | |
| 5416 v8::Array& expectedResult = *v8::Array::Cast(*result); | |
| 5417 ASSERT_GE(expectedResult.Length(), 10u); | |
| 5418 | |
| 5419 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( | 5485 blink::Node* layerOwnerNodeForStart = V8Node::toImplWithTypeCheck( |
| 5420 v8::Isolate::GetCurrent(), expectedResult.Get(0)); | 5486 v8::Isolate::GetCurrent(), expectedResult.Get(0)); |
| 5421 ASSERT_TRUE(layerOwnerNodeForStart); | 5487 ASSERT_TRUE(layerOwnerNodeForStart); |
| 5422 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() | 5488 EXPECT_EQ(layerOwnerNodeForStart->layoutObject() |
| 5423 ->enclosingLayer() | 5489 ->enclosingLayer() |
| 5424 ->enclosingLayerForPaintInvalidation() | 5490 ->enclosingLayerForPaintInvalidation() |
| 5425 ->graphicsLayerBacking() | 5491 ->graphicsLayerBacking() |
| 5426 ->platformLayer() | 5492 ->platformLayer() |
| 5427 ->id(), | 5493 ->id(), |
| 5428 selectStart->layerId); | 5494 selectStart->layerId); |
| 5429 v8::Local<v8::Context> context = | 5495 |
| 5430 v8::Isolate::GetCurrent()->GetCurrentContext(); | 5496 EXPECT_EQ(startEdgeTopInLayerX, selectStart->edgeTopInLayer.x); |
| 5431 EXPECT_EQ(expectedResult.Get(context, 1) | 5497 EXPECT_EQ(startEdgeTopInLayerY, selectStart->edgeTopInLayer.y); |
| 5432 .ToLocalChecked() | 5498 EXPECT_EQ(startEdgeBottomInLayerX, selectStart->edgeBottomInLayer.x); |
| 5433 .As<v8::Int32>() | |
| 5434 ->Value(), | |
| 5435 selectStart->edgeTopInLayer.x); | |
| 5436 EXPECT_EQ(expectedResult.Get(context, 2) | |
| 5437 .ToLocalChecked() | |
| 5438 .As<v8::Int32>() | |
| 5439 ->Value(), | |
| 5440 selectStart->edgeTopInLayer.y); | |
| 5441 EXPECT_EQ(expectedResult.Get(context, 3) | |
| 5442 .ToLocalChecked() | |
| 5443 .As<v8::Int32>() | |
| 5444 ->Value(), | |
| 5445 selectStart->edgeBottomInLayer.x); | |
| 5446 | 5499 |
| 5447 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( | 5500 blink::Node* layerOwnerNodeForEnd = V8Node::toImplWithTypeCheck( |
| 5448 v8::Isolate::GetCurrent(), | 5501 v8::Isolate::GetCurrent(), |
| 5449 expectedResult.Get(context, 5).ToLocalChecked()); | 5502 expectedResult.Get(context, 5).ToLocalChecked()); |
| 5450 | 5503 |
| 5451 ASSERT_TRUE(layerOwnerNodeForEnd); | 5504 ASSERT_TRUE(layerOwnerNodeForEnd); |
| 5452 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() | 5505 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject() |
| 5453 ->enclosingLayer() | 5506 ->enclosingLayer() |
| 5454 ->enclosingLayerForPaintInvalidation() | 5507 ->enclosingLayerForPaintInvalidation() |
| 5455 ->graphicsLayerBacking() | 5508 ->graphicsLayerBacking() |
| 5456 ->platformLayer() | 5509 ->platformLayer() |
| 5457 ->id(), | 5510 ->id(), |
| 5458 selectEnd->layerId); | 5511 selectEnd->layerId); |
| 5459 EXPECT_EQ(expectedResult.Get(context, 6) | 5512 |
| 5460 .ToLocalChecked() | 5513 EXPECT_EQ(endEdgeTopInLayerX, selectEnd->edgeTopInLayer.x); |
| 5461 .As<v8::Int32>() | 5514 EXPECT_EQ(endEdgeTopInLayerY, selectEnd->edgeTopInLayer.y); |
| 5462 ->Value(), | 5515 EXPECT_EQ(endEdgeBottomInLayerX, selectEnd->edgeBottomInLayer.x); |
| 5463 selectEnd->edgeTopInLayer.x); | |
| 5464 EXPECT_EQ(expectedResult.Get(context, 7) | |
| 5465 .ToLocalChecked() | |
| 5466 .As<v8::Int32>() | |
| 5467 ->Value(), | |
| 5468 selectEnd->edgeTopInLayer.y); | |
| 5469 EXPECT_EQ(expectedResult.Get(context, 8) | |
| 5470 .ToLocalChecked() | |
| 5471 .As<v8::Int32>() | |
| 5472 ->Value(), | |
| 5473 selectEnd->edgeBottomInLayer.x); | |
| 5474 | 5516 |
| 5475 // Platform differences can introduce small stylistic deviations in | 5517 // Platform differences can introduce small stylistic deviations in |
| 5476 // y-axis positioning, the details of which aren't relevant to | 5518 // y-axis positioning, the details of which aren't relevant to |
| 5477 // selection behavior. However, such deviations from the expected value | 5519 // selection behavior. However, such deviations from the expected value |
| 5478 // should be consistent for the corresponding y coordinates. | 5520 // should be consistent for the corresponding y coordinates. |
| 5479 int yBottomEpsilon = 0; | 5521 int yBottomEpsilon = 0; |
| 5480 if (expectedResult.Length() == 13) | 5522 if (expectedResult.Length() == 13) |
| 5481 yBottomEpsilon = expectedResult.Get(context, 12) | 5523 yBottomEpsilon = expectedResult.Get(context, 12) |
| 5482 .ToLocalChecked() | 5524 .ToLocalChecked() |
| 5483 .As<v8::Int32>() | 5525 .As<v8::Int32>() |
| 5484 ->Value(); | 5526 ->Value(); |
| 5485 int yBottomDeviation = expectedResult.Get(context, 4) | 5527 int yBottomDeviation = |
| 5486 .ToLocalChecked() | 5528 startEdgeBottomInLayerY - selectStart->edgeBottomInLayer.y; |
| 5487 .As<v8::Int32>() | |
| 5488 ->Value() - | |
| 5489 selectStart->edgeBottomInLayer.y; | |
| 5490 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); | 5529 EXPECT_GE(yBottomEpsilon, std::abs(yBottomDeviation)); |
| 5491 EXPECT_EQ(yBottomDeviation, expectedResult.Get(context, 9) | 5530 EXPECT_EQ(yBottomDeviation, |
| 5492 .ToLocalChecked() | 5531 endEdgeBottomInLayerY - selectEnd->edgeBottomInLayer.y); |
| 5493 .As<v8::Int32>() | |
| 5494 ->Value() - | |
| 5495 selectEnd->edgeBottomInLayer.y); | |
| 5496 | 5532 |
| 5497 if (expectedResult.Length() >= 12) { | 5533 if (expectedResult.Length() >= 12) { |
| 5498 EXPECT_EQ(expectedResult.Get(context, 10) | 5534 EXPECT_EQ(expectedResult.Get(context, 10) |
| 5499 .ToLocalChecked() | 5535 .ToLocalChecked() |
| 5500 .As<v8::Boolean>() | 5536 .As<v8::Boolean>() |
| 5501 ->Value(), | 5537 ->Value(), |
| 5502 m_fakeSelectionLayerTreeView.selection()->isEditable()); | 5538 m_fakeSelectionLayerTreeView.selection()->isEditable()); |
| 5503 EXPECT_EQ( | 5539 EXPECT_EQ( |
| 5504 expectedResult.Get(context, 11) | 5540 expectedResult.Get(context, 11) |
| 5505 .ToLocalChecked() | 5541 .ToLocalChecked() |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5518 | 5554 |
| 5519 runTest(testFile); | 5555 runTest(testFile); |
| 5520 } | 5556 } |
| 5521 | 5557 |
| 5522 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; | 5558 CompositedSelectionBoundsTestWebViewClient m_fakeSelectionWebViewClient; |
| 5523 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; | 5559 CompositedSelectionBoundsTestLayerTreeView& m_fakeSelectionLayerTreeView; |
| 5524 FrameTestHelpers::WebViewHelper m_webViewHelper; | 5560 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 5525 }; | 5561 }; |
| 5526 | 5562 |
| 5527 TEST_F(CompositedSelectionBoundsTest, None) { | 5563 TEST_F(CompositedSelectionBoundsTest, None) { |
| 5528 runTest("composited_selection_bounds_none.html"); | 5564 runTestWithNoSelection("composited_selection_bounds_none.html"); |
| 5529 } | 5565 } |
| 5530 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { | 5566 TEST_F(CompositedSelectionBoundsTest, NoneReadonlyCaret) { |
| 5531 runTest("composited_selection_bounds_none_readonly_caret.html"); | 5567 runTestWithNoSelection( |
| 5568 "composited_selection_bounds_none_readonly_caret.html"); |
| 5532 } | 5569 } |
| 5570 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { |
| 5571 runTestWithNoSelection("composited_selection_bounds_detached_frame.html"); |
| 5572 } |
| 5573 |
| 5533 TEST_F(CompositedSelectionBoundsTest, Basic) { | 5574 TEST_F(CompositedSelectionBoundsTest, Basic) { |
| 5534 runTest("composited_selection_bounds_basic.html"); | 5575 runTest("composited_selection_bounds_basic.html"); |
| 5535 } | 5576 } |
| 5536 TEST_F(CompositedSelectionBoundsTest, Transformed) { | 5577 TEST_F(CompositedSelectionBoundsTest, Transformed) { |
| 5537 runTest("composited_selection_bounds_transformed.html"); | 5578 runTest("composited_selection_bounds_transformed.html"); |
| 5538 } | 5579 } |
| 5539 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { | 5580 TEST_F(CompositedSelectionBoundsTest, VerticalRightToLeft) { |
| 5540 runTest("composited_selection_bounds_vertical_rl.html"); | 5581 runTest("composited_selection_bounds_vertical_rl.html"); |
| 5541 } | 5582 } |
| 5542 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { | 5583 TEST_F(CompositedSelectionBoundsTest, VerticalLeftToRight) { |
| 5543 runTest("composited_selection_bounds_vertical_lr.html"); | 5584 runTest("composited_selection_bounds_vertical_lr.html"); |
| 5544 } | 5585 } |
| 5545 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { | 5586 TEST_F(CompositedSelectionBoundsTest, SplitLayer) { |
| 5546 runTest("composited_selection_bounds_split_layer.html"); | 5587 runTest("composited_selection_bounds_split_layer.html"); |
| 5547 } | 5588 } |
| 5548 TEST_F(CompositedSelectionBoundsTest, EmptyLayer) { | |
| 5549 runTest("composited_selection_bounds_empty_layer.html"); | |
| 5550 } | |
| 5551 TEST_F(CompositedSelectionBoundsTest, Iframe) { | 5589 TEST_F(CompositedSelectionBoundsTest, Iframe) { |
| 5552 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", | 5590 runTestWithMultipleFiles("composited_selection_bounds_iframe.html", |
| 5553 "composited_selection_bounds_basic.html", nullptr); | 5591 "composited_selection_bounds_basic.html", nullptr); |
| 5554 } | 5592 } |
| 5555 TEST_F(CompositedSelectionBoundsTest, DetachedFrame) { | |
| 5556 runTest("composited_selection_bounds_detached_frame.html"); | |
| 5557 } | |
| 5558 TEST_F(CompositedSelectionBoundsTest, Editable) { | 5593 TEST_F(CompositedSelectionBoundsTest, Editable) { |
| 5559 runTest("composited_selection_bounds_editable.html"); | 5594 runTest("composited_selection_bounds_editable.html"); |
| 5560 } | 5595 } |
| 5561 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { | 5596 TEST_F(CompositedSelectionBoundsTest, EditableDiv) { |
| 5562 runTest("composited_selection_bounds_editable_div.html"); | 5597 runTest("composited_selection_bounds_editable_div.html"); |
| 5563 } | 5598 } |
| 5564 TEST_F(CompositedSelectionBoundsTest, EmptyEditableInput) { | |
| 5565 runTest("composited_selection_bounds_empty_editable_input.html"); | |
| 5566 } | |
| 5567 TEST_F(CompositedSelectionBoundsTest, EmptyEditableArea) { | |
| 5568 runTest("composited_selection_bounds_empty_editable_area.html"); | |
| 5569 } | |
| 5570 | |
| 5571 // Fails on Mac ASan 64 bot. https://crbug.com/588769. | |
| 5572 #if OS(MACOSX) && defined(ADDRESS_SANITIZER) | |
| 5573 TEST_P(ParameterizedWebFrameTest, DISABLED_CompositedSelectionBoundsCleared) | |
| 5574 #else | |
| 5575 TEST_P(ParameterizedWebFrameTest, CompositedSelectionBoundsCleared) | |
| 5576 #endif | |
| 5577 { | |
| 5578 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); | |
| 5579 | |
| 5580 registerMockedHttpURLLoad("select_range_basic.html"); | |
| 5581 registerMockedHttpURLLoad("select_range_scroll.html"); | |
| 5582 | |
| 5583 int viewWidth = 500; | |
| 5584 int viewHeight = 500; | |
| 5585 | |
| 5586 CompositedSelectionBoundsTestWebViewClient fakeSelectionWebViewClient; | |
| 5587 CompositedSelectionBoundsTestLayerTreeView& fakeSelectionLayerTreeView = | |
| 5588 fakeSelectionWebViewClient.selectionLayerTreeView(); | |
| 5589 | |
| 5590 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 5591 webViewHelper.initialize(true, nullptr, &fakeSelectionWebViewClient, nullptr); | |
| 5592 webViewHelper.webView()->settings()->setDefaultFontSize(12); | |
| 5593 webViewHelper.webView()->setDefaultPageScaleLimits(1, 1); | |
| 5594 webViewHelper.resize(WebSize(viewWidth, viewHeight)); | |
| 5595 webViewHelper.webView()->setFocus(true); | |
| 5596 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
| 5597 m_baseURL + "select_range_basic.html"); | |
| 5598 | |
| 5599 // The frame starts with no selection. | |
| 5600 WebLocalFrame* frame = webViewHelper.webView()->mainFrameImpl(); | |
| 5601 ASSERT_TRUE(frame->hasSelection()); | |
| 5602 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5603 | |
| 5604 // The selection cleared notification should be triggered upon layout. | |
| 5605 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
| 5606 ASSERT_FALSE(frame->hasSelection()); | |
| 5607 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5608 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5609 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5610 | |
| 5611 frame->executeCommand(WebString::fromUTF8("SelectAll")); | |
| 5612 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5613 ASSERT_TRUE(frame->hasSelection()); | |
| 5614 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5615 | |
| 5616 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), | |
| 5617 m_baseURL + "select_range_scroll.html"); | |
| 5618 ASSERT_TRUE(frame->hasSelection()); | |
| 5619 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5620 | |
| 5621 // Transitions between non-empty selections should not trigger a clearing. | |
| 5622 WebRect startWebRect; | |
| 5623 WebRect endWebRect; | |
| 5624 webViewHelper.webView()->selectionBounds(startWebRect, endWebRect); | |
| 5625 WebPoint movedEnd(bottomRightMinusOne(endWebRect)); | |
| 5626 endWebRect.x -= 20; | |
| 5627 frame->selectRange(topLeft(startWebRect), movedEnd); | |
| 5628 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5629 ASSERT_TRUE(frame->hasSelection()); | |
| 5630 EXPECT_FALSE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5631 | |
| 5632 frame = webViewHelper.webView()->mainFrameImpl(); | |
| 5633 frame->executeCommand(WebString::fromUTF8("Unselect")); | |
| 5634 webViewHelper.webView()->updateAllLifecyclePhases(); | |
| 5635 ASSERT_FALSE(frame->hasSelection()); | |
| 5636 EXPECT_TRUE(fakeSelectionLayerTreeView.getAndResetSelectionCleared()); | |
| 5637 } | |
| 5638 | 5599 |
| 5639 class DisambiguationPopupTestWebViewClient | 5600 class DisambiguationPopupTestWebViewClient |
| 5640 : public FrameTestHelpers::TestWebViewClient { | 5601 : public FrameTestHelpers::TestWebViewClient { |
| 5641 public: | 5602 public: |
| 5642 bool didTapMultipleTargets(const WebSize&, | 5603 bool didTapMultipleTargets(const WebSize&, |
| 5643 const WebRect&, | 5604 const WebRect&, |
| 5644 const WebVector<WebRect>& targetRects) override { | 5605 const WebVector<WebRect>& targetRects) override { |
| 5645 EXPECT_GE(targetRects.size(), 2u); | 5606 EXPECT_GE(targetRects.size(), 2u); |
| 5646 m_triggered = true; | 5607 m_triggered = true; |
| 5647 return true; | 5608 return true; |
| (...skipping 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10260 webViewHelper.webView()->handleInputEvent(endEvent); | 10221 webViewHelper.webView()->handleInputEvent(endEvent); |
| 10261 webViewHelper.webView()->handleInputEvent(updateEvent); | 10222 webViewHelper.webView()->handleInputEvent(updateEvent); |
| 10262 | 10223 |
| 10263 // Try a full Begin/Update/End cycle. | 10224 // Try a full Begin/Update/End cycle. |
| 10264 webViewHelper.webView()->handleInputEvent(beginEvent); | 10225 webViewHelper.webView()->handleInputEvent(beginEvent); |
| 10265 webViewHelper.webView()->handleInputEvent(updateEvent); | 10226 webViewHelper.webView()->handleInputEvent(updateEvent); |
| 10266 webViewHelper.webView()->handleInputEvent(endEvent); | 10227 webViewHelper.webView()->handleInputEvent(endEvent); |
| 10267 } | 10228 } |
| 10268 | 10229 |
| 10269 } // namespace blink | 10230 } // namespace blink |
| OLD | NEW |