Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/ScrollingCoordinatorTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 } 4472 }
4473 4473
4474 // positionForPoint returns the wrong values for contenteditable spans. See 4474 // positionForPoint returns the wrong values for contenteditable spans. See
4475 // http://crbug.com/238334. 4475 // http://crbug.com/238334.
4476 TEST_F(WebFrameTest, DISABLED_PositionForPointTest) 4476 TEST_F(WebFrameTest, DISABLED_PositionForPointTest)
4477 { 4477 {
4478 registerMockedHttpURLLoad("select_range_span_editable.html"); 4478 registerMockedHttpURLLoad("select_range_span_editable.html");
4479 FrameTestHelpers::WebViewHelper webViewHelper; 4479 FrameTestHelpers::WebViewHelper webViewHelper;
4480 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html" , &webViewHelper); 4480 initializeTextSelectionWebView(m_baseURL + "select_range_span_editable.html" , &webViewHelper);
4481 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()-> mainFrame()); 4481 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()-> mainFrame());
4482 LayoutObject* renderer = mainFrame->frame()->selection().rootEditableElement ()->renderer(); 4482 LayoutObject* renderer = mainFrame->frame()->selection().rootEditableElement ()->layoutObject();
4483 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); 4483 EXPECT_EQ(0, computeOffset(renderer, -1, -1));
4484 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); 4484 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000));
4485 4485
4486 registerMockedHttpURLLoad("select_range_div_editable.html"); 4486 registerMockedHttpURLLoad("select_range_div_editable.html");
4487 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper); 4487 initializeTextSelectionWebView(m_baseURL + "select_range_div_editable.html", &webViewHelper);
4488 mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); 4488 mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame());
4489 renderer = mainFrame->frame()->selection().rootEditableElement()->renderer() ; 4489 renderer = mainFrame->frame()->selection().rootEditableElement()->layoutObje ct();
4490 EXPECT_EQ(0, computeOffset(renderer, -1, -1)); 4490 EXPECT_EQ(0, computeOffset(renderer, -1, -1));
4491 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000)); 4491 EXPECT_EQ(64, computeOffset(renderer, 1000, 1000));
4492 } 4492 }
4493 4493
4494 #if !OS(MACOSX) && !OS(LINUX) 4494 #if !OS(MACOSX) && !OS(LINUX)
4495 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved) 4495 TEST_F(WebFrameTest, SelectRangeStaysHorizontallyAlignedWhenMoved)
4496 { 4496 {
4497 registerMockedHttpURLLoad("move_caret.html"); 4497 registerMockedHttpURLLoad("move_caret.html");
4498 4498
4499 FrameTestHelpers::WebViewHelper webViewHelper; 4499 FrameTestHelpers::WebViewHelper webViewHelper;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4659 4659
4660 ASSERT_TRUE(selectStart); 4660 ASSERT_TRUE(selectStart);
4661 ASSERT_TRUE(selectEnd); 4661 ASSERT_TRUE(selectEnd);
4662 4662
4663 ASSERT_TRUE((*result)->IsArray()); 4663 ASSERT_TRUE((*result)->IsArray());
4664 v8::Array& expectedResult = *v8::Array::Cast(*result); 4664 v8::Array& expectedResult = *v8::Array::Cast(*result);
4665 ASSERT_EQ(10u, expectedResult.Length()); 4665 ASSERT_EQ(10u, expectedResult.Length());
4666 4666
4667 blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck (v8::Isolate::GetCurrent(), expectedResult.Get(0)); 4667 blink::Node* layerOwnerNodeForStart = blink::V8Node::toImplWithTypeCheck (v8::Isolate::GetCurrent(), expectedResult.Get(0));
4668 ASSERT_TRUE(layerOwnerNodeForStart); 4668 ASSERT_TRUE(layerOwnerNodeForStart);
4669 EXPECT_EQ(layerOwnerNodeForStart->renderer()->enclosingLayer()->enclosin gLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), sel ectStart->layerId); 4669 EXPECT_EQ(layerOwnerNodeForStart->layoutObject()->enclosingLayer()->encl osingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), selectStart->layerId);
4670 EXPECT_EQ(expectedResult.Get(1)->Int32Value(), selectStart->edgeTopInLay er.x); 4670 EXPECT_EQ(expectedResult.Get(1)->Int32Value(), selectStart->edgeTopInLay er.x);
4671 EXPECT_EQ(expectedResult.Get(2)->Int32Value(), selectStart->edgeTopInLay er.y); 4671 EXPECT_EQ(expectedResult.Get(2)->Int32Value(), selectStart->edgeTopInLay er.y);
4672 EXPECT_EQ(expectedResult.Get(3)->Int32Value(), selectStart->edgeBottomIn Layer.x); 4672 EXPECT_EQ(expectedResult.Get(3)->Int32Value(), selectStart->edgeBottomIn Layer.x);
4673 EXPECT_EQ(expectedResult.Get(4)->Int32Value(), selectStart->edgeBottomIn Layer.y); 4673 EXPECT_EQ(expectedResult.Get(4)->Int32Value(), selectStart->edgeBottomIn Layer.y);
4674 4674
4675 blink::Node* layerOwnerNodeForEnd = blink::V8Node::toImplWithTypeCheck(v 8::Isolate::GetCurrent(), expectedResult.Get(5)); 4675 blink::Node* layerOwnerNodeForEnd = blink::V8Node::toImplWithTypeCheck(v 8::Isolate::GetCurrent(), expectedResult.Get(5));
4676 ASSERT_TRUE(layerOwnerNodeForEnd); 4676 ASSERT_TRUE(layerOwnerNodeForEnd);
4677 EXPECT_EQ(layerOwnerNodeForEnd->renderer()->enclosingLayer()->enclosingL ayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), selec tEnd->layerId); 4677 EXPECT_EQ(layerOwnerNodeForEnd->layoutObject()->enclosingLayer()->enclos ingLayerForPaintInvalidation()->graphicsLayerBacking()->platformLayer()->id(), s electEnd->layerId);
4678 EXPECT_EQ(expectedResult.Get(6)->Int32Value(), selectEnd->edgeTopInLayer .x); 4678 EXPECT_EQ(expectedResult.Get(6)->Int32Value(), selectEnd->edgeTopInLayer .x);
4679 EXPECT_EQ(expectedResult.Get(7)->Int32Value(), selectEnd->edgeTopInLayer .y); 4679 EXPECT_EQ(expectedResult.Get(7)->Int32Value(), selectEnd->edgeTopInLayer .y);
4680 EXPECT_EQ(expectedResult.Get(8)->Int32Value(), selectEnd->edgeBottomInLa yer.x); 4680 EXPECT_EQ(expectedResult.Get(8)->Int32Value(), selectEnd->edgeBottomInLa yer.x);
4681 EXPECT_EQ(expectedResult.Get(9)->Int32Value(), selectEnd->edgeBottomInLa yer.y); 4681 EXPECT_EQ(expectedResult.Get(9)->Int32Value(), selectEnd->edgeBottomInLa yer.y);
4682 } 4682 }
4683 4683
4684 void runTestWithMultipleFiles(const char* testFile, ...) 4684 void runTestWithMultipleFiles(const char* testFile, ...)
4685 { 4685 {
4686 va_list auxFiles; 4686 va_list auxFiles;
4687 va_start(auxFiles, testFile); 4687 va_start(auxFiles, testFile);
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu llExecutionContext()); 6621 RefPtrWillBeRawPtr<NullExecutionContext> context = adoptRefWillBeNoop(new Nu llExecutionContext());
6622 MediaStreamRegistry::registry().registerURL(0, toKURL(m_baseURL + "test.webm "), MediaStream::create(context.get())); 6622 MediaStreamRegistry::registry().registerURL(0, toKURL(m_baseURL + "test.webm "), MediaStream::create(context.get()));
6623 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6623 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6624 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6624 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6625 Element* videoFullscreen = document->getElementById("video"); 6625 Element* videoFullscreen = document->getElementById("video");
6626 Fullscreen::from(*document).requestFullscreen(*videoFullscreen, Fullscreen:: PrefixedRequest); 6626 Fullscreen::from(*document).requestFullscreen(*videoFullscreen, Fullscreen:: PrefixedRequest);
6627 webViewImpl->didEnterFullScreen(); 6627 webViewImpl->didEnterFullScreen();
6628 webViewImpl->layout(); 6628 webViewImpl->layout();
6629 6629
6630 // Verify that the video layer is visible in fullscreen. 6630 // Verify that the video layer is visible in fullscreen.
6631 Layer* renderLayer = videoFullscreen->renderer()->enclosingLayer(); 6631 Layer* renderLayer = videoFullscreen->layoutObject()->enclosingLayer();
6632 GraphicsLayer* graphicsLayer = renderLayer->graphicsLayerBacking(); 6632 GraphicsLayer* graphicsLayer = renderLayer->graphicsLayerBacking();
6633 EXPECT_TRUE(graphicsLayer->contentsAreVisible()); 6633 EXPECT_TRUE(graphicsLayer->contentsAreVisible());
6634 context->notifyContextDestroyed(); 6634 context->notifyContextDestroyed();
6635 } 6635 }
6636 6636
6637 TEST_F(WebFrameTest, LayoutBlockPercentHeightDescendants) 6637 TEST_F(WebFrameTest, LayoutBlockPercentHeightDescendants)
6638 { 6638 {
6639 registerMockedHttpURLLoad("percent-height-descendants.html"); 6639 registerMockedHttpURLLoad("percent-height-descendants.html");
6640 FrameTestHelpers::WebViewHelper webViewHelper; 6640 FrameTestHelpers::WebViewHelper webViewHelper;
6641 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html "); 6641 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html ");
6642 6642
6643 WebView* webView = webViewHelper.webView(); 6643 WebView* webView = webViewHelper.webView();
6644 webView->resize(WebSize(800, 800)); 6644 webView->resize(WebSize(800, 800));
6645 webView->layout(); 6645 webView->layout();
6646 6646
6647 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc ument(); 6647 Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->doc ument();
6648 LayoutBlock* container = toLayoutBlock(document->getElementById("container") ->renderer()); 6648 LayoutBlock* container = toLayoutBlock(document->getElementById("container") ->layoutObject());
6649 LayoutBox* percentHeightInAnonymous = toLayoutBox(document->getElementById(" percent-height-in-anonymous")->renderer()); 6649 LayoutBox* percentHeightInAnonymous = toLayoutBox(document->getElementById(" percent-height-in-anonymous")->layoutObject());
6650 LayoutBox* percentHeightDirectChild = toLayoutBox(document->getElementById(" percent-height-direct-child")->renderer()); 6650 LayoutBox* percentHeightDirectChild = toLayoutBox(document->getElementById(" percent-height-direct-child")->layoutObject());
6651 6651
6652 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightInAnonymous )); 6652 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightInAnonymous ));
6653 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightDirectChild )); 6653 EXPECT_TRUE(LayoutBlock::hasPercentHeightDescendant(percentHeightDirectChild ));
6654 6654
6655 ASSERT_TRUE(container->percentHeightDescendants()); 6655 ASSERT_TRUE(container->percentHeightDescendants());
6656 ASSERT_TRUE(container->hasPercentHeightDescendants()); 6656 ASSERT_TRUE(container->hasPercentHeightDescendants());
6657 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); 6657 EXPECT_EQ(2U, container->percentHeightDescendants()->size());
6658 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous)); 6658 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous));
6659 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild)); 6659 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild));
6660 6660
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
7410 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7410 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7411 WebView* view = WebView::create(&viewClient); 7411 WebView* view = WebView::create(&viewClient);
7412 view->setMainFrame(WebRemoteFrame::create(&remoteClient)); 7412 view->setMainFrame(WebRemoteFrame::create(&remoteClient));
7413 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; 7413 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient;
7414 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe moteChild("", &childFrameClient); 7414 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe moteChild("", &childFrameClient);
7415 childFrame->detach(); 7415 childFrame->detach();
7416 view->close(); 7416 view->close();
7417 } 7417 }
7418 7418
7419 } // namespace blink 7419 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/ScrollingCoordinatorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698