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