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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 1415513002: Remove plumbing for inert-visual-viewport flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keeping "inertVisualViewport" setting + fixed broken test Created 5 years, 2 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 if (!view) 1129 if (!view)
1130 return; 1130 return;
1131 1131
1132 FrameHost* host = frame()->host(); 1132 FrameHost* host = frame()->host();
1133 if (!host) 1133 if (!host)
1134 return; 1134 return;
1135 1135
1136 x = ScrollableArea::normalizeNonFiniteScroll(x); 1136 x = ScrollableArea::normalizeNonFiniteScroll(x);
1137 y = ScrollableArea::normalizeNonFiniteScroll(y); 1137 y = ScrollableArea::normalizeNonFiniteScroll(y);
1138 1138
1139 DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); 1139 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->scrollableArea();
1140 DoublePoint currentOffset = viewport->scrollPositionDouble();
1140 DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomF actor()); 1141 DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomF actor());
1141 1142
1142 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->scrollableArea();
1143 viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll, scrollBehavior); 1143 viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll, scrollBehavior);
1144 } 1144 }
1145 1145
1146 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const 1146 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const
1147 { 1147 {
1148 double x = 0.0; 1148 double x = 0.0;
1149 double y = 0.0; 1149 double y = 0.0;
1150 if (scrollToOptions.hasLeft()) 1150 if (scrollToOptions.hasLeft())
1151 x = scrollToOptions.left(); 1151 x = scrollToOptions.left();
1152 if (scrollToOptions.hasTop()) 1152 if (scrollToOptions.hasTop())
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 if (!scrollToOptions.hasLeft() 1200 if (!scrollToOptions.hasLeft()
1201 || !scrollToOptions.hasTop() 1201 || !scrollToOptions.hasTop()
1202 || scrollToOptions.left() 1202 || scrollToOptions.left()
1203 || scrollToOptions.top()) { 1203 || scrollToOptions.top()) {
1204 document()->updateLayoutIgnorePendingStylesheets(); 1204 document()->updateLayoutIgnorePendingStylesheets();
1205 } 1205 }
1206 1206
1207 double scaledX = 0.0; 1207 double scaledX = 0.0;
1208 double scaledY = 0.0; 1208 double scaledY = 0.0;
1209 1209
1210 DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); 1210 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->scrollableArea();
1211 DoublePoint currentOffset = viewport->scrollPositionDouble();
1211 scaledX = currentOffset.x(); 1212 scaledX = currentOffset.x();
1212 scaledY = currentOffset.y(); 1213 scaledY = currentOffset.y();
1213 1214
1214 if (scrollToOptions.hasLeft()) 1215 if (scrollToOptions.hasLeft())
1215 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left( )) * frame()->pageZoomFactor(); 1216 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left( )) * frame()->pageZoomFactor();
1216 1217
1217 if (scrollToOptions.hasTop()) 1218 if (scrollToOptions.hasTop())
1218 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top() ) * frame()->pageZoomFactor(); 1219 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top() ) * frame()->pageZoomFactor();
1219 1220
1220 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1221 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1221 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior); 1222 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB ehavior);
1222 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la youtViewportScrollableArea() : view->scrollableArea();
1223 viewport->setScrollPosition(DoublePoint(scaledX, scaledY), ProgrammaticScrol l, scrollBehavior); 1223 viewport->setScrollPosition(DoublePoint(scaledX, scaledY), ProgrammaticScrol l, scrollBehavior);
1224 } 1224 }
1225 1225
1226 void LocalDOMWindow::moveBy(int x, int y) const 1226 void LocalDOMWindow::moveBy(int x, int y) const
1227 { 1227 {
1228 if (!frame() || !frame()->isMainFrame()) 1228 if (!frame() || !frame()->isMainFrame())
1229 return; 1229 return;
1230 1230
1231 FrameHost* host = frame()->host(); 1231 FrameHost* host = frame()->host();
1232 if (!host) 1232 if (!host)
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 { 1528 {
1529 // If the LocalDOMWindow still has a frame reference, that frame must point 1529 // If the LocalDOMWindow still has a frame reference, that frame must point
1530 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1530 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1531 // where script execution leaks between different LocalDOMWindows. 1531 // where script execution leaks between different LocalDOMWindows.
1532 if (m_frameObserver->frame()) 1532 if (m_frameObserver->frame())
1533 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWi ndow() == this); 1533 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWi ndow() == this);
1534 return m_frameObserver->frame(); 1534 return m_frameObserver->frame();
1535 } 1535 }
1536 1536
1537 } // namespace blink 1537 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698