| 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 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4451 } | 4451 } |
| 4452 | 4452 |
| 4453 // positionForPoint returns the wrong values for contenteditable spans. See | 4453 // positionForPoint returns the wrong values for contenteditable spans. See |
| 4454 // http://crbug.com/238334. | 4454 // http://crbug.com/238334. |
| 4455 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) | 4455 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) |
| 4456 { | 4456 { |
| 4457 registerMockedHttpURLLoad("select_range_span_editable.html"); | 4457 registerMockedHttpURLLoad("select_range_span_editable.html"); |
| 4458 FrameTestHelpers::WebViewHelper webViewHelper; | 4458 FrameTestHelpers::WebViewHelper webViewHelper; |
| 4459 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html"
, &webViewHelper); | 4459 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html"
, &webViewHelper); |
| 4460 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); | 4460 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->
mainFrame()); |
| 4461 LayoutObject* renderer = mainFrame->frame()->selection().rootEditableElement
()->renderer(); | 4461 LayoutObject* renderer = mainFrame->frame()->selection().rootEditableElement
()->layoutObject(); |
| 4462 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); | 4462 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); |
| 4463 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); | 4463 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); |
| 4464 | 4464 |
| 4465 registerMockedHttpURLLoad("select_range_div_editable.html"); | 4465 registerMockedHttpURLLoad("select_range_div_editable.html"); |
| 4466 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html",
&webViewHelper); | 4466 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html",
&webViewHelper); |
| 4467 mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); | 4467 mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); |
| 4468 renderer = mainFrame->frame()->selection().rootEditableElement()->renderer()
; | 4468 renderer = mainFrame->frame()->selection().rootEditableElement()->layoutObje
ct(); |
| 4469 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); | 4469 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); |
| 4470 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); | 4470 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); |
| 4471 } | 4471 } |
| 4472 | 4472 |
| 4473 #if !OS(MACOSX) && !OS(LINUX) | 4473 #if !OS(MACOSX) && !OS(LINUX) |
| 4474 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) | 4474 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) |
| 4475 { | 4475 { |
| 4476 registerMockedHttpURLLoad("move_caret.html"); | 4476 registerMockedHttpURLLoad("move_caret.html"); |
| 4477 | 4477 |
| 4478 FrameTestHelpers::WebViewHelper webViewHelper; | 4478 FrameTestHelpers::WebViewHelper webViewHelper; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4638 | 4638 |
| 4639 ASSERT_TRUE(selectStart); | 4639 ASSERT_TRUE(selectStart); |
| 4640 ASSERT_TRUE(selectEnd); | 4640 ASSERT_TRUE(selectEnd); |
| 4641 | 4641 |
| 4642 ASSERT_TRUE((*result)->IsArray()); | 4642 ASSERT_TRUE((*result)->IsArray()); |
| 4643 v8::Array& expectedResult = *v8::Array::Cast(*result); | 4643 v8::Array& expectedResult = *v8::Array::Cast(*result); |
| 4644 ASSERT_EQ(10u, expectedResult.Length()); | 4644 ASSERT_EQ(10u, expectedResult.Length()); |
| 4645 | 4645 |
| 4646 blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck
(v8::Isolate::GetCurrent(), expectedResult.Get(0)); | 4646 blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck
(v8::Isolate::GetCurrent(), expectedResult.Get(0)); |
| 4647 ASSERT_TRUE(layerOwnerNodeForStart); | 4647 ASSERT_TRUE(layerOwnerNodeForStart); |
| 4648 EXPECT_EQ(layerOwnerNodeForStart->renderer()->enclosingLayer()->enclosin
gLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), sel
ectStart->layerId); | 4648 EXPECT_EQ(layerOwnerNodeForStart->layoutObject()->enclosingLayer()->encl
osingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(),
selectStart->layerId); |
| 4649 EXPECT_EQ(expectedResult.Get(1)->Int32Value(), selectStart->edgeTopInLay
er.x); | 4649 EXPECT_EQ(expectedResult.Get(1)->Int32Value(), selectStart->edgeTopInLay
er.x); |
| 4650 EXPECT_EQ(expectedResult.Get(2)->Int32Value(), selectStart->edgeTopInLay
er.y); | 4650 EXPECT_EQ(expectedResult.Get(2)->Int32Value(), selectStart->edgeTopInLay
er.y); |
| 4651 EXPECT_EQ(expectedResult.Get(3)->Int32Value(), selectStart->edgeBottomIn
Layer.x); | 4651 EXPECT_EQ(expectedResult.Get(3)->Int32Value(), selectStart->edgeBottomIn
Layer.x); |
| 4652 EXPECT_EQ(expectedResult.Get(4)->Int32Value(), selectStart->edgeBottomIn
Layer.y); | 4652 EXPECT_EQ(expectedResult.Get(4)->Int32Value(), selectStart->edgeBottomIn
Layer.y); |
| 4653 | 4653 |
| 4654 blink::Node* layerOwnerNodeForEnd = blink::V8Node::toImplWithTypeCheck(v
8::Isolate::GetCurrent(), expectedResult.Get(5)); | 4654 blink::Node* layerOwnerNodeForEnd = blink::V8Node::toImplWithTypeCheck(v
8::Isolate::GetCurrent(), expectedResult.Get(5)); |
| 4655 ASSERT_TRUE(layerOwnerNodeForEnd); | 4655 ASSERT_TRUE(layerOwnerNodeForEnd); |
| 4656 EXPECT_EQ(layerOwnerNodeForEnd->renderer()->enclosingLayer()->enclosingL
ayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), selec
tEnd->layerId); | 4656 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject()->enclosingLayer()->enclos
ingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), s
electEnd->layerId); |
| 4657 EXPECT_EQ(expectedResult.Get(6)->Int32Value(), selectEnd->edgeTopInLayer
.x); | 4657 EXPECT_EQ(expectedResult.Get(6)->Int32Value(), selectEnd->edgeTopInLayer
.x); |
| 4658 EXPECT_EQ(expectedResult.Get(7)->Int32Value(), selectEnd->edgeTopInLayer
.y); | 4658 EXPECT_EQ(expectedResult.Get(7)->Int32Value(), selectEnd->edgeTopInLayer
.y); |
| 4659 EXPECT_EQ(expectedResult.Get(8)->Int32Value(), selectEnd->edgeBottomInLa
yer.x); | 4659 EXPECT_EQ(expectedResult.Get(8)->Int32Value(), selectEnd->edgeBottomInLa
yer.x); |
| 4660 EXPECT_EQ(expectedResult.Get(9)->Int32Value(), selectEnd->edgeBottomInLa
yer.y); | 4660 EXPECT_EQ(expectedResult.Get(9)->Int32Value(), selectEnd->edgeBottomInLa
yer.y); |
| 4661 } | 4661 } |
| 4662 | 4662 |
| 4663 void runTestWithMultipleFiles(const char* testFile, ...) | 4663 void runTestWithMultipleFiles(const char* testFile, ...) |
| 4664 { | 4664 { |
| 4665 va_list auxFiles; | 4665 va_list auxFiles; |
| 4666 va_start(auxFiles, testFile); | 4666 va_start(auxFiles, testFile); |
| (...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6600 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); | 6600 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu
llExecutionContext()); |
| 6601 MediaStreamRegistry::registry().registerURL(0, toKURL(m_baseURL + "test.webm
"), MediaStream::create(context.get())); | 6601 MediaStreamRegistry::registry().registerURL(0, toKURL(m_baseURL + "test.webm
"), MediaStream::create(context.get())); |
| 6602 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); | 6602 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()-
>document(); |
| 6603 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 6603 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
| 6604 Element* videoFullscreen = document->getElementById("video"); | 6604 Element* videoFullscreen = document->getElementById("video"); |
| 6605 Fullscreen::from(*document).requestFullscreen(*videoFullscreen, Fullscreen::
PrefixedRequest); | 6605 Fullscreen::from(*document).requestFullscreen(*videoFullscreen, Fullscreen::
PrefixedRequest); |
| 6606 webViewImpl->didEnterFullScreen(); | 6606 webViewImpl->didEnterFullScreen(); |
| 6607 webViewImpl->layout(); | 6607 webViewImpl->layout(); |
| 6608 | 6608 |
| 6609 // Verify that the video layer is visible in fullscreen. | 6609 // Verify that the video layer is visible in fullscreen. |
| 6610 Layer* renderLayer = videoFullscreen->renderer()->enclosingLayer(); | 6610 Layer* renderLayer = videoFullscreen->layoutObject()->enclosingLayer(); |
| 6611 GraphicsLayer* graphicsLayer = renderLayer->graphicsLayerBacking(); | 6611 GraphicsLayer* graphicsLayer = renderLayer->graphicsLayerBacking(); |
| 6612 EXPECT_TRUE(graphicsLayer->contentsAreVisible()); | 6612 EXPECT_TRUE(graphicsLayer->contentsAreVisible()); |
| 6613 context->notifyContextDestroyed(); | 6613 context->notifyContextDestroyed(); |
| 6614 } | 6614 } |
| 6615 | 6615 |
| 6616 TEST_F(WebFrameTest, FullscreenWithTinyViewport) | 6616 TEST_F(WebFrameTest, FullscreenWithTinyViewport) |
| 6617 { | 6617 { |
| 6618 FakeCompositingWebViewClient client; | 6618 FakeCompositingWebViewClient client; |
| 6619 registerMockedHttpURLLoad("viewport-tiny.html"); | 6619 registerMockedHttpURLLoad("viewport-tiny.html"); |
| 6620 FrameTestHelpers::WebViewHelper webViewHelper; | 6620 FrameTestHelpers::WebViewHelper webViewHelper; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6657 { | 6657 { |
| 6658 registerMockedHttpURLLoad("percent-height-descendants.html"); | 6658 registerMockedHttpURLLoad("percent-height-descendants.html"); |
| 6659 FrameTestHelpers::WebViewHelper webViewHelper; | 6659 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6660 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html
"); | 6660 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html
"); |
| 6661 | 6661 |
| 6662 WebView* webView = webViewHelper.webView(); | 6662 WebView* webView = webViewHelper.webView(); |
| 6663 webView->resize(WebSize(800, 800)); | 6663 webView->resize(WebSize(800, 800)); |
| 6664 webView->layout(); | 6664 webView->layout(); |
| 6665 | 6665 |
| 6666 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); | 6666 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc
ument(); |
| 6667 LayoutBlock* container = toLayoutBlock(document->getElementById("container")
->renderer()); | 6667 LayoutBlock* container = toLayoutBlock(document->getElementById("container")
->layoutObject()); |
| 6668 LayoutBox* percentHeightInAnonymous = toLayoutBox(document->getElementById("
percent-height-in-anonymous")->renderer()); | 6668 LayoutBox* percentHeightInAnonymous = toLayoutBox(document->getElementById("
percent-height-in-anonymous")->layoutObject()); |
| 6669 LayoutBox* percentHeightDirectChild = toLayoutBox(document->getElementById("
percent-height-direct-child")->renderer()); | 6669 LayoutBox* percentHeightDirectChild = toLayoutBox(document->getElementById("
percent-height-direct-child")->layoutObject()); |
| 6670 | 6670 |
| 6671 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightInAnonymous
)); | 6671 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightInAnonymous
)); |
| 6672 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightDirectChild
)); | 6672 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightDirectChild
)); |
| 6673 | 6673 |
| 6674 ASSERT_TRUE(container->percentHeightDescendants()); | 6674 ASSERT_TRUE(container->percentHeightDescendants()); |
| 6675 ASSERT_TRUE(container->hasPercentHeightDescendants()); | 6675 ASSERT_TRUE(container->hasPercentHeightDescendants()); |
| 6676 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); | 6676 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); |
| 6677 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA
nonymous)); | 6677 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA
nonymous)); |
| 6678 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir
ectChild)); | 6678 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir
ectChild)); |
| 6679 | 6679 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7417 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 7417 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 7418 | 7418 |
| 7419 // Neither should a page reload. | 7419 // Neither should a page reload. |
| 7420 localFrame->reload(); | 7420 localFrame->reload(); |
| 7421 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 7421 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
| 7422 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 7422 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
| 7423 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 7423 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 7424 } | 7424 } |
| 7425 | 7425 |
| 7426 } // namespace blink | 7426 } // namespace blink |
| OLD | NEW |