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