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

Side by Side Diff: Source/core/html/HTMLBodyElement.cpp

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (!document.inQuirksMode()) 259 if (!document.inQuirksMode())
260 return; 260 return;
261 } 261 }
262 262
263 LocalFrame* frame = document.frame(); 263 LocalFrame* frame = document.frame();
264 if (!frame) 264 if (!frame)
265 return; 265 return;
266 FrameView* view = frame->view(); 266 FrameView* view = frame->view();
267 if (!view) 267 if (!view)
268 return; 268 return;
269 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); 269 view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), vi ew->scrollY()));
270 } 270 }
271 271
272 double HTMLBodyElement::scrollTop() 272 double HTMLBodyElement::scrollTop()
273 { 273 {
274 Document& document = this->document(); 274 Document& document = this->document();
275 document.updateLayoutIgnorePendingStylesheets(); 275 document.updateLayoutIgnorePendingStylesheets();
276 276
277 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 277 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
278 RenderBox* render = renderBox(); 278 RenderBox* render = renderBox();
279 if (!render) 279 if (!render)
(...skipping 26 matching lines...) Expand all
306 if (!document.inQuirksMode()) 306 if (!document.inQuirksMode())
307 return; 307 return;
308 } 308 }
309 309
310 LocalFrame* frame = document.frame(); 310 LocalFrame* frame = document.frame();
311 if (!frame) 311 if (!frame)
312 return; 312 return;
313 FrameView* view = frame->view(); 313 FrameView* view = frame->view();
314 if (!view) 314 if (!view)
315 return; 315 return;
316 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); 316 view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->page ZoomFactor()));
317 } 317 }
318 318
319 int HTMLBodyElement::scrollHeight() 319 int HTMLBodyElement::scrollHeight()
320 { 320 {
321 // Update the document's layout. 321 // Update the document's layout.
322 Document& document = this->document(); 322 Document& document = this->document();
323 document.updateLayoutIgnorePendingStylesheets(); 323 document.updateLayoutIgnorePendingStylesheets();
324 FrameView* view = document.view(); 324 FrameView* view = document.view();
325 return view ? adjustForZoom(view->contentsHeight(), &document) : 0; 325 return view ? adjustForZoom(view->contentsHeight(), &document) : 0;
326 } 326 }
327 327
328 int HTMLBodyElement::scrollWidth() 328 int HTMLBodyElement::scrollWidth()
329 { 329 {
330 // Update the document's layout. 330 // Update the document's layout.
331 Document& document = this->document(); 331 Document& document = this->document();
332 document.updateLayoutIgnorePendingStylesheets(); 332 document.updateLayoutIgnorePendingStylesheets();
333 FrameView* view = document.view(); 333 FrameView* view = document.view();
334 return view ? adjustForZoom(view->contentsWidth(), &document) : 0; 334 return view ? adjustForZoom(view->contentsWidth(), &document) : 0;
335 } 335 }
336 336
337 } // namespace blink 337 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/PinchViewport.cpp ('k') | Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698