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

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

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 years 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/VisualViewport.h" 5 #include "core/frame/VisualViewport.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/BrowserControls.h" 8 #include "core/frame/BrowserControls.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 navigateTo(m_baseURL + "200-by-300-viewport.html"); 1742 navigateTo(m_baseURL + "200-by-300-viewport.html");
1743 1743
1744 VisualViewport& visualViewport = 1744 VisualViewport& visualViewport =
1745 frame()->page()->frameHost().visualViewport(); 1745 frame()->page()->frameHost().visualViewport();
1746 visualViewport.setScale(2); 1746 visualViewport.setScale(2);
1747 1747
1748 // Chrome's quirky behavior regarding viewport scrolling means we treat the 1748 // Chrome's quirky behavior regarding viewport scrolling means we treat the
1749 // body element as the viewport and don't apply scrolling to the HTML element. 1749 // body element as the viewport and don't apply scrolling to the HTML element.
1750 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); 1750 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false);
1751 1751
1752 LocalDOMWindow* window = 1752 LocalDOMWindow* window = webViewImpl()->mainFrameImpl()->frame()->domWindow();
1753 webViewImpl()->mainFrameImpl()->frame()->localDOMWindow();
1754 window->scrollTo(100, 150); 1753 window->scrollTo(100, 150);
1755 EXPECT_EQ(100, window->scrollX()); 1754 EXPECT_EQ(100, window->scrollX());
1756 EXPECT_EQ(150, window->scrollY()); 1755 EXPECT_EQ(150, window->scrollY());
1757 EXPECT_FLOAT_SIZE_EQ(FloatSize(100, 150), visualViewport.getScrollOffset()); 1756 EXPECT_FLOAT_SIZE_EQ(FloatSize(100, 150), visualViewport.getScrollOffset());
1758 1757
1759 HTMLElement* body = toHTMLBodyElement(window->document()->body()); 1758 HTMLElement* body = toHTMLBodyElement(window->document()->body());
1760 body->setScrollLeft(50); 1759 body->setScrollLeft(50);
1761 body->setScrollTop(130); 1760 body->setScrollTop(130);
1762 EXPECT_EQ(50, body->scrollLeft()); 1761 EXPECT_EQ(50, body->scrollLeft());
1763 EXPECT_EQ(130, body->scrollTop()); 1762 EXPECT_EQ(130, body->scrollTop());
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 if (rootLayerScrolling) 2392 if (rootLayerScrolling)
2394 EXPECT_TRUE(invalidationTracking); 2393 EXPECT_TRUE(invalidationTracking);
2395 else 2394 else
2396 EXPECT_FALSE(invalidationTracking); 2395 EXPECT_FALSE(invalidationTracking);
2397 2396
2398 document->view()->setTracksPaintInvalidations(false); 2397 document->view()->setTracksPaintInvalidations(false);
2399 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); 2398 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls);
2400 } 2399 }
2401 2400
2402 } // namespace 2401 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698