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