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

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

Issue 2860673002: Change all test cases to use WebViewBase instead of WebViewImpl. (Closed)
Patch Set: Address code review comments. Created 3 years, 7 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
80 80
81 static Element* GetElement(WebView* web_view, 81 static Element* GetElement(WebView* web_view,
82 const WTF::AtomicString& element_id) { 82 const WTF::AtomicString& element_id) {
83 WebViewImpl* web_view_impl = ToWebViewImpl(web_view); 83 WebViewBase* web_view_impl = static_cast<WebViewBase*>(web_view);
84 if (!web_view_impl) 84 if (!web_view_impl)
85 return nullptr; 85 return nullptr;
86 LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame(); 86 LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame();
87 Document* doc = frame->GetDocument(); 87 Document* doc = frame->GetDocument();
88 return doc->getElementById(element_id); 88 return doc->getElementById(element_id);
89 } 89 }
90 90
91 static LayoutBox* GetLayoutBox(WebView* web_view, 91 static LayoutBox* GetLayoutBox(WebView* web_view,
92 const WTF::AtomicString& element_id) { 92 const WTF::AtomicString& element_id) {
93 Element* element = GetElement(web_view, element_id); 93 Element* element = GetElement(web_view, element_id);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 // Adjust rect by the scroll offset of the LayoutView. This only has an 146 // Adjust rect by the scroll offset of the LayoutView. This only has an
147 // effect if root layer scrolling is enabled. The only reason for doing 147 // effect if root layer scrolling is enabled. The only reason for doing
148 // this here is so the test expected values can be the same whether or not 148 // this here is so the test expected values can be the same whether or not
149 // root layer scrolling is enabled. For more context, see: 149 // root layer scrolling is enabled. For more context, see:
150 // https://codereview.chromium.org/2417103002/#msg11 150 // https://codereview.chromium.org/2417103002/#msg11
151 static FloatRect AdjustForFrameScroll(WebView* web_view, 151 static FloatRect AdjustForFrameScroll(WebView* web_view,
152 const FloatRect& rect) { 152 const FloatRect& rect) {
153 FloatRect result(rect); 153 FloatRect result(rect);
154 LocalFrame* frame = ToWebViewImpl(web_view)->MainFrameImpl()->GetFrame(); 154 LocalFrame* frame =
155 static_cast<WebViewBase*>(web_view)->MainFrameImpl()->GetFrame();
155 LayoutView* layout_view = frame->GetDocument()->GetLayoutView(); 156 LayoutView* layout_view = frame->GetDocument()->GetLayoutView();
156 if (layout_view->HasOverflowClip()) 157 if (layout_view->HasOverflowClip())
157 result.Move(layout_view->ScrolledContentOffset()); 158 result.Move(layout_view->ScrolledContentOffset());
158 return result; 159 return result;
159 } 160 }
160 161
161 void RegisterMockedHttpURLLoad(const std::string& file_name) { 162 void RegisterMockedHttpURLLoad(const std::string& file_name) {
162 URLTestHelpers::RegisterMockedURLLoadFromBase( 163 URLTestHelpers::RegisterMockedURLLoadFromBase(
163 WebString::FromUTF8(base_url_), testing::WebTestDataPath(), 164 WebString::FromUTF8(base_url_), testing::WebTestDataPath(),
164 WebString::FromUTF8(file_name)); 165 WebString::FromUTF8(file_name));
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), 529 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f),
529 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); 530 RectFromQuad(rgm.MapToAncestor(rect, nullptr)));
530 531
531 rgm.PushMappingsToAncestor(floating, span); 532 rgm.PushMappingsToAncestor(floating, span);
532 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container))); 533 EXPECT_EQ(rect, RectFromQuad(rgm.MapToAncestor(rect, container)));
533 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), 534 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f),
534 RectFromQuad(rgm.MapToAncestor(rect, nullptr))); 535 RectFromQuad(rgm.MapToAncestor(rect, nullptr)));
535 } 536 }
536 537
537 } // namespace blink 538 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698