OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/layout/LayoutGeometryMap.h" | 31 #include "core/layout/LayoutGeometryMap.h" |
32 | 32 |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/frame/WebLocalFrameBase.h" |
34 #include "core/layout/LayoutBox.h" | 35 #include "core/layout/LayoutBox.h" |
35 #include "core/layout/LayoutView.h" | 36 #include "core/layout/LayoutView.h" |
36 #include "core/paint/PaintLayer.h" | 37 #include "core/paint/PaintLayer.h" |
37 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 38 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
38 #include "platform/testing/URLTestHelpers.h" | 39 #include "platform/testing/URLTestHelpers.h" |
39 #include "platform/testing/UnitTestHelpers.h" | 40 #include "platform/testing/UnitTestHelpers.h" |
40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
41 #include "public/platform/WebURLLoaderMockFactory.h" | 42 #include "public/platform/WebURLLoaderMockFactory.h" |
42 #include "public/web/WebFrameClient.h" | 43 #include "public/web/WebFrameClient.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "web/WebLocalFrameImpl.h" | |
45 #include "web/tests/FrameTestHelpers.h" | 45 #include "web/tests/FrameTestHelpers.h" |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 typedef bool TestParamRootLayerScrolling; | 49 typedef bool TestParamRootLayerScrolling; |
50 class LayoutGeometryMapTest | 50 class LayoutGeometryMapTest |
51 : public ::testing::Test, | 51 : public ::testing::Test, |
52 public ::testing::WithParamInterface<TestParamRootLayerScrolling>, | 52 public ::testing::WithParamInterface<TestParamRootLayerScrolling>, |
53 private ScopedRootLayerScrollingForTest { | 53 private ScopedRootLayerScrollingForTest { |
54 public: | 54 public: |
55 LayoutGeometryMapTest() | 55 LayoutGeometryMapTest() |
56 : ScopedRootLayerScrollingForTest(GetParam()), | 56 : ScopedRootLayerScrollingForTest(GetParam()), |
57 base_url_("http://www.test.com/") {} | 57 base_url_("http://www.test.com/") {} |
58 | 58 |
59 void TearDown() override { | 59 void TearDown() override { |
60 Platform::Current() | 60 Platform::Current() |
61 ->GetURLLoaderMockFactory() | 61 ->GetURLLoaderMockFactory() |
62 ->UnregisterAllURLsAndClearMemoryCache(); | 62 ->UnregisterAllURLsAndClearMemoryCache(); |
63 } | 63 } |
64 | 64 |
65 protected: | 65 protected: |
66 static LayoutBox* GetFrameElement(const char* iframe_name, | 66 static LayoutBox* GetFrameElement(const char* iframe_name, |
67 WebView* web_view, | 67 WebView* web_view, |
68 const WTF::AtomicString& element_id) { | 68 const WTF::AtomicString& element_id) { |
69 WebLocalFrameImpl* iframe = ToWebLocalFrameImpl( | 69 WebLocalFrameBase* iframe = ToWebLocalFrameBase( |
70 web_view->FindFrameByName(WebString::FromUTF8(iframe_name))); | 70 web_view->FindFrameByName(WebString::FromUTF8(iframe_name))); |
71 if (!iframe) | 71 if (!iframe) |
72 return nullptr; | 72 return nullptr; |
73 LocalFrame* frame = iframe->GetFrame(); | 73 LocalFrame* frame = iframe->GetFrame(); |
74 Document* doc = frame->GetDocument(); | 74 Document* doc = frame->GetDocument(); |
75 Element* element = doc->getElementById(element_id); | 75 Element* element = doc->getElementById(element_id); |
76 if (!element) | 76 if (!element) |
77 return nullptr; | 77 return nullptr; |
78 return element->GetLayoutBox(); | 78 return element->GetLayoutBox(); |
79 } | 79 } |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), | 529 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), |
530 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); | 530 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); |
531 | 531 |
532 rgm.PushMappingsToAncestor(floating, span); | 532 rgm.PushMappingsToAncestor(floating, span); |
533 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container))); | 533 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container))); |
534 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), | 534 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), |
535 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); | 535 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); |
536 } | 536 } |
537 | 537 |
538 } // namespace blink | 538 } // namespace blink |
OLD | NEW |