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

Side by Side Diff: Source/core/frame/LocalDOMWindow.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/FrameView.cpp ('k') | Source/core/frame/LocalFrame.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) 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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 { 1353 {
1354 if (!isCurrentlyDisplayedInFrame()) 1354 if (!isCurrentlyDisplayedInFrame())
1355 return; 1355 return;
1356 1356
1357 document()->updateLayoutIgnorePendingStylesheets(); 1357 document()->updateLayoutIgnorePendingStylesheets();
1358 1358
1359 FrameView* view = m_frame->view(); 1359 FrameView* view = m_frame->view();
1360 if (!view) 1360 if (!view)
1361 return; 1361 return;
1362 1362
1363 IntSize scaledOffset(static_cast<int>(x * m_frame->pageZoomFactor()), static _cast<int>(y * m_frame->pageZoomFactor())); 1363 DoubleSize scaledOffset(x * m_frame->pageZoomFactor(), y * m_frame->pageZoom Factor());
1364 view->scrollBy(scaledOffset, scrollBehavior); 1364 view->scrollBy(scaledOffset, scrollBehavior);
1365 } 1365 }
1366 1366
1367 void LocalDOMWindow::scrollBy(double x, double y, const ScrollOptions& scrollOpt ions, ExceptionState &exceptionState) const 1367 void LocalDOMWindow::scrollBy(double x, double y, const ScrollOptions& scrollOpt ions, ExceptionState &exceptionState) const
1368 { 1368 {
1369 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1369 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1370 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState)) 1370 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1371 return; 1371 return;
1372 scrollBy(x, y, scrollBehavior); 1372 scrollBy(x, y, scrollBehavior);
1373 } 1373 }
1374 1374
1375 void LocalDOMWindow::scrollTo(double x, double y, ScrollBehavior scrollBehavior) const 1375 void LocalDOMWindow::scrollTo(double x, double y, ScrollBehavior scrollBehavior) const
1376 { 1376 {
1377 if (!isCurrentlyDisplayedInFrame()) 1377 if (!isCurrentlyDisplayedInFrame())
1378 return; 1378 return;
1379 1379
1380 document()->updateLayoutIgnorePendingStylesheets(); 1380 document()->updateLayoutIgnorePendingStylesheets();
1381 1381
1382 RefPtr<FrameView> view = m_frame->view(); 1382 RefPtr<FrameView> view = m_frame->view();
1383 if (!view) 1383 if (!view)
1384 return; 1384 return;
1385 1385
1386 IntPoint layoutPos(static_cast<int>(x * m_frame->pageZoomFactor()), static_c ast<int>(y * m_frame->pageZoomFactor())); 1386 DoublePoint layoutPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFa ctor());
1387 view->setScrollPosition(layoutPos, scrollBehavior); 1387 view->setScrollPosition(layoutPos, scrollBehavior);
1388 } 1388 }
1389 1389
1390 void LocalDOMWindow::scrollTo(double x, double y, const ScrollOptions& scrollOpt ions, ExceptionState& exceptionState) const 1390 void LocalDOMWindow::scrollTo(double x, double y, const ScrollOptions& scrollOpt ions, ExceptionState& exceptionState) const
1391 { 1391 {
1392 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 1392 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
1393 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState)) 1393 if (!scrollBehaviorFromScrollOptions(scrollOptions, scrollBehavior, exceptio nState))
1394 return; 1394 return;
1395 scrollTo(x, y, scrollBehavior); 1395 scrollTo(x, y, scrollBehavior);
1396 } 1396 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 FrameDestructionObserver::trace(visitor); 1899 FrameDestructionObserver::trace(visitor);
1900 } 1900 }
1901 1901
1902 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1902 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1903 { 1903 {
1904 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1904 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1905 return v8::Handle<v8::Object>(); 1905 return v8::Handle<v8::Object>();
1906 } 1906 }
1907 1907
1908 } // namespace blink 1908 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698