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

Side by Side Diff: third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp

Issue 2907663004: FrameTree::Find only searches relative to local frames. (Closed)
Patch Set: Rebasing... Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 24 matching lines...) Expand all
35 #include "core/layout/LayoutBox.h" 35 #include "core/layout/LayoutBox.h"
36 #include "core/layout/LayoutView.h" 36 #include "core/layout/LayoutView.h"
37 #include "core/paint/PaintLayer.h" 37 #include "core/paint/PaintLayer.h"
38 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 38 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
39 #include "platform/testing/URLTestHelpers.h" 39 #include "platform/testing/URLTestHelpers.h"
40 #include "platform/testing/UnitTestHelpers.h" 40 #include "platform/testing/UnitTestHelpers.h"
41 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
42 #include "public/platform/WebURLLoaderMockFactory.h" 42 #include "public/platform/WebURLLoaderMockFactory.h"
43 #include "public/web/WebFrameClient.h" 43 #include "public/web/WebFrameClient.h"
44 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
45 #include "web/WebLocalFrameImpl.h"
46 #include "web/WebViewImpl.h"
45 #include "web/tests/FrameTestHelpers.h" 47 #include "web/tests/FrameTestHelpers.h"
46 48
47 namespace blink { 49 namespace blink {
48 50
49 typedef bool TestParamRootLayerScrolling; 51 typedef bool TestParamRootLayerScrolling;
50 class LayoutGeometryMapTest 52 class LayoutGeometryMapTest
51 : public ::testing::Test, 53 : public ::testing::Test,
52 public ::testing::WithParamInterface<TestParamRootLayerScrolling>, 54 public ::testing::WithParamInterface<TestParamRootLayerScrolling>,
53 private ScopedRootLayerScrollingForTest { 55 private ScopedRootLayerScrollingForTest {
54 public: 56 public:
55 LayoutGeometryMapTest() 57 LayoutGeometryMapTest()
56 : ScopedRootLayerScrollingForTest(GetParam()), 58 : ScopedRootLayerScrollingForTest(GetParam()),
57 base_url_("http://www.test.com/") {} 59 base_url_("http://www.test.com/") {}
58 60
59 void TearDown() override { 61 void TearDown() override {
60 Platform::Current() 62 Platform::Current()
61 ->GetURLLoaderMockFactory() 63 ->GetURLLoaderMockFactory()
62 ->UnregisterAllURLsAndClearMemoryCache(); 64 ->UnregisterAllURLsAndClearMemoryCache();
63 } 65 }
64 66
65 protected: 67 protected:
66 static LayoutBox* GetFrameElement(const char* iframe_name, 68 static LayoutBox* GetFrameElement(const char* iframe_name,
67 WebView* web_view, 69 WebView* web_view,
68 const WTF::AtomicString& element_id) { 70 const WTF::AtomicString& element_id) {
69 WebLocalFrameBase* iframe = ToWebLocalFrameBase( 71 WebFrame* iframe =
70 web_view->FindFrameByName(WebString::FromUTF8(iframe_name))); 72 static_cast<WebViewImpl*>(web_view)->MainFrameImpl()->FindFrameByName(
71 if (!iframe) 73 WebString::FromUTF8(iframe_name));
74 if (!iframe || !iframe->IsWebLocalFrame())
72 return nullptr; 75 return nullptr;
73 LocalFrame* frame = iframe->GetFrame(); 76 LocalFrame* frame = ToWebLocalFrameImpl(iframe)->GetFrame();
74 Document* doc = frame->GetDocument(); 77 Document* doc = frame->GetDocument();
75 Element* element = doc->getElementById(element_id); 78 Element* element = doc->getElementById(element_id);
76 if (!element) 79 if (!element)
77 return nullptr; 80 return nullptr;
78 return element->GetLayoutBox(); 81 return element->GetLayoutBox();
79 } 82 }
80 83
81 static Element* GetElement(WebView* web_view, 84 static Element* GetElement(WebView* web_view,
82 const WTF::AtomicString& element_id) { 85 const WTF::AtomicString& element_id) {
83 WebViewBase* web_view_impl = static_cast<WebViewBase*>(web_view); 86 WebViewBase* web_view_impl = static_cast<WebViewBase*>(web_view);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), 532 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f),
530 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); 533 RectFromQuad(rgm.MapToAncestor(rect, nullptr)));
531 534
532 rgm.PushMappingsToAncestor(floating, span); 535 rgm.PushMappingsToAncestor(floating, span);
533 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container))); 536 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container)));
534 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), 537 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f),
535 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); 538 RectFromQuad(rgm.MapToAncestor(rect, nullptr)));
536 } 539 }
537 540
538 } // namespace blink 541 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698