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

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

Issue 670833002: Early out if the scroll position passed in by js is NaN (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments 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/LocalDOMWindow.cpp ('k') | no next file » | 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (FrameView* view = document.view()) 240 if (FrameView* view = document.view())
241 return adjustScrollForAbsoluteZoom(view->scrollX(), document.frame()->pa geZoomFactor()); 241 return adjustScrollForAbsoluteZoom(view->scrollX(), document.frame()->pa geZoomFactor());
242 return 0; 242 return 0;
243 } 243 }
244 244
245 void HTMLBodyElement::setScrollLeft(double scrollLeft) 245 void HTMLBodyElement::setScrollLeft(double scrollLeft)
246 { 246 {
247 Document& document = this->document(); 247 Document& document = this->document();
248 document.updateLayoutIgnorePendingStylesheets(); 248 document.updateLayoutIgnorePendingStylesheets();
249 249
250 if (std::isnan(scrollLeft))
251 return;
252
250 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 253 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
251 RenderBox* render = renderBox(); 254 RenderBox* render = renderBox();
252 if (!render) 255 if (!render)
253 return; 256 return;
254 if (render->hasOverflowClip()) { 257 if (render->hasOverflowClip()) {
255 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...). 258 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...).
256 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()- >effectiveZoom())); 259 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()- >effectiveZoom()));
257 return; 260 return;
258 } 261 }
259 if (!document.inQuirksMode()) 262 if (!document.inQuirksMode())
(...skipping 27 matching lines...) Expand all
287 if (FrameView* view = document.view()) 290 if (FrameView* view = document.view())
288 return adjustScrollForAbsoluteZoom(view->scrollY(), document.frame()->pa geZoomFactor()); 291 return adjustScrollForAbsoluteZoom(view->scrollY(), document.frame()->pa geZoomFactor());
289 return 0; 292 return 0;
290 } 293 }
291 294
292 void HTMLBodyElement::setScrollTop(double scrollTop) 295 void HTMLBodyElement::setScrollTop(double scrollTop)
293 { 296 {
294 Document& document = this->document(); 297 Document& document = this->document();
295 document.updateLayoutIgnorePendingStylesheets(); 298 document.updateLayoutIgnorePendingStylesheets();
296 299
300 if (std::isnan(scrollTop))
301 return;
302
297 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 303 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
298 RenderBox* render = renderBox(); 304 RenderBox* render = renderBox();
299 if (!render) 305 if (!render)
300 return; 306 return;
301 if (render->hasOverflowClip()) { 307 if (render->hasOverflowClip()) {
302 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...). 308 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...).
303 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e ffectiveZoom())); 309 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e ffectiveZoom()));
304 return; 310 return;
305 } 311 }
306 if (!document.inQuirksMode()) 312 if (!document.inQuirksMode())
(...skipping 21 matching lines...) Expand all
328 int HTMLBodyElement::scrollWidth() 334 int HTMLBodyElement::scrollWidth()
329 { 335 {
330 // Update the document's layout. 336 // Update the document's layout.
331 Document& document = this->document(); 337 Document& document = this->document();
332 document.updateLayoutIgnorePendingStylesheets(); 338 document.updateLayoutIgnorePendingStylesheets();
333 FrameView* view = document.view(); 339 FrameView* view = document.view();
334 return view ? adjustForZoom(view->contentsWidth(), &document) : 0; 340 return view ? adjustForZoom(view->contentsWidth(), &document) : 0;
335 } 341 }
336 342
337 } // namespace blink 343 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698