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

Unified Diff: Source/core/frame/LocalDOMWindow.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 side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index e347ad1045eab396af17f553cea46caed05003b3..ba71b696fec14db2950c40b93a66d70a598518d5 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -1380,6 +1380,9 @@ void LocalDOMWindow::scrollBy(double x, double y, ScrollBehavior scrollBehavior)
if (!view)
return;
+ if (std::isnan(x) || std::isnan(y))
+ return;
Rick Byers 2014/10/21 22:22:33 You said the previous behavior was to scroll to 0,
Yufeng Shen (Slow to review) 2014/10/21 22:49:31 Yeah, I changed my mind and felt that ignore the n
+
DoubleSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFactor());
view->scrollBy(scaledOffset, scrollBehavior);
}
@@ -1403,6 +1406,9 @@ void LocalDOMWindow::scrollTo(double x, double y, ScrollBehavior scrollBehavior)
if (!view)
return;
+ if (std::isnan(x) || std::isnan(y))
+ return;
+
DoublePoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFactor());
view->setScrollPosition(layoutPos, scrollBehavior);
}

Powered by Google App Engine
This is Rietveld 408576698