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

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

Issue 2101393002: Make visualViewport.scrollTop/Left readonly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 double VisualViewport::scrollTop() 233 double VisualViewport::scrollTop()
234 { 234 {
235 if (!mainFrame()) 235 if (!mainFrame())
236 return 0; 236 return 0;
237 237
238 updateStyleAndLayoutIgnorePendingStylesheets(); 238 updateStyleAndLayoutIgnorePendingStylesheets();
239 239
240 return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomF actor()); 240 return adjustScrollForAbsoluteZoom(visibleRect().y(), mainFrame()->pageZoomF actor());
241 } 241 }
242 242
243 void VisualViewport::setScrollLeft(double x)
244 {
245 if (!mainFrame())
246 return;
247
248 updateStyleAndLayoutIgnorePendingStylesheets();
249
250 setLocation(FloatPoint(x * mainFrame()->pageZoomFactor(), location().y()));
251 }
252
253 void VisualViewport::setScrollTop(double y)
254 {
255 if (!mainFrame())
256 return;
257
258 updateStyleAndLayoutIgnorePendingStylesheets();
259
260 setLocation(FloatPoint(location().x(), y * mainFrame()->pageZoomFactor()));
261 }
262
263 double VisualViewport::clientWidth() 243 double VisualViewport::clientWidth()
264 { 244 {
265 if (!mainFrame()) 245 if (!mainFrame())
266 return 0; 246 return 0;
267 247
268 updateStyleAndLayoutIgnorePendingStylesheets(); 248 updateStyleAndLayoutIgnorePendingStylesheets();
269 249
270 double width = adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame( )->pageZoomFactor()); 250 double width = adjustScrollForAbsoluteZoom(visibleSize().width(), mainFrame( )->pageZoomFactor());
271 return width - mainFrame()->view()->verticalScrollbarWidth(); 251 return width - mainFrame()->view()->verticalScrollbarWidth();
272 } 252 }
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } else if (graphicsLayer == m_rootTransformLayer.get()) { 826 } else if (graphicsLayer == m_rootTransformLayer.get()) {
847 name = "Root Transform Layer"; 827 name = "Root Transform Layer";
848 } else { 828 } else {
849 ASSERT_NOT_REACHED(); 829 ASSERT_NOT_REACHED();
850 } 830 }
851 831
852 return name; 832 return name;
853 } 833 }
854 834
855 } // namespace blink 835 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | third_party/WebKit/Source/core/frame/VisualViewport.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698