| OLD | NEW |
| 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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 FrameView* view = frame()->view(); | 1158 FrameView* view = frame()->view(); |
| 1159 if (!view) | 1159 if (!view) |
| 1160 return 0; | 1160 return 0; |
| 1161 | 1161 |
| 1162 FrameHost* host = frame()->host(); | 1162 FrameHost* host = frame()->host(); |
| 1163 if (!host) | 1163 if (!host) |
| 1164 return 0; | 1164 return 0; |
| 1165 | 1165 |
| 1166 frame()->document()->updateLayoutIgnorePendingStylesheets(); | 1166 frame()->document()->updateLayoutIgnorePendingStylesheets(); |
| 1167 | 1167 |
| 1168 double viewportX = view->scrollPositionDouble().x(); | 1168 double viewportX = view->scrollableArea()->scrollPositionDouble().x(); |
| 1169 | 1169 |
| 1170 if (host->settings().pinchVirtualViewportEnabled() && frame()->isMainFrame()
) | 1170 if (host->settings().pinchVirtualViewportEnabled() && frame()->isMainFrame()
) |
| 1171 viewportX += host->pinchViewport().location().x(); | 1171 viewportX += host->pinchViewport().location().x(); |
| 1172 | 1172 |
| 1173 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); | 1173 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 double LocalDOMWindow::scrollY() const | 1176 double LocalDOMWindow::scrollY() const |
| 1177 { | 1177 { |
| 1178 if (!frame()) | 1178 if (!frame()) |
| 1179 return 0; | 1179 return 0; |
| 1180 | 1180 |
| 1181 FrameView* view = frame()->view(); | 1181 FrameView* view = frame()->view(); |
| 1182 if (!view) | 1182 if (!view) |
| 1183 return 0; | 1183 return 0; |
| 1184 | 1184 |
| 1185 FrameHost* host = frame()->host(); | 1185 FrameHost* host = frame()->host(); |
| 1186 if (!host) | 1186 if (!host) |
| 1187 return 0; | 1187 return 0; |
| 1188 | 1188 |
| 1189 frame()->document()->updateLayoutIgnorePendingStylesheets(); | 1189 frame()->document()->updateLayoutIgnorePendingStylesheets(); |
| 1190 | 1190 |
| 1191 double viewportY = view->scrollPositionDouble().y(); | 1191 double viewportY = view->scrollableArea()->scrollPositionDouble().y(); |
| 1192 | 1192 |
| 1193 if (host->settings().pinchVirtualViewportEnabled() && frame()->isMainFrame()
) | 1193 if (host->settings().pinchVirtualViewportEnabled() && frame()->isMainFrame()
) |
| 1194 viewportY += host->pinchViewport().location().y(); | 1194 viewportY += host->pinchViewport().location().y(); |
| 1195 | 1195 |
| 1196 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); | 1196 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 const AtomicString& LocalDOMWindow::name() const | 1199 const AtomicString& LocalDOMWindow::name() const |
| 1200 { | 1200 { |
| 1201 if (!isCurrentlyDisplayedInFrame()) | 1201 if (!isCurrentlyDisplayedInFrame()) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 static void scrollViewportTo(LocalFrame* frame, DoublePoint offset, ScrollBehavi
or scrollBehavior) | 1293 static void scrollViewportTo(LocalFrame* frame, DoublePoint offset, ScrollBehavi
or scrollBehavior) |
| 1294 { | 1294 { |
| 1295 FrameView* view = frame->view(); | 1295 FrameView* view = frame->view(); |
| 1296 if (!view) | 1296 if (!view) |
| 1297 return; | 1297 return; |
| 1298 | 1298 |
| 1299 FrameHost* host = frame->host(); | 1299 FrameHost* host = frame->host(); |
| 1300 if (!host) | 1300 if (!host) |
| 1301 return; | 1301 return; |
| 1302 | 1302 |
| 1303 view->setScrollPosition(offset, scrollBehavior); | 1303 view->scrollableArea()->setScrollPosition(offset, scrollBehavior); |
| 1304 | 1304 |
| 1305 if (host->settings().pinchVirtualViewportEnabled() && frame->isMainFrame())
{ | 1305 if (host->settings().pinchVirtualViewportEnabled() && frame->isMainFrame())
{ |
| 1306 PinchViewport& pinchViewport = frame->host()->pinchViewport(); | 1306 PinchViewport& pinchViewport = frame->host()->pinchViewport(); |
| 1307 DoubleSize excessDelta = offset - DoublePoint(pinchViewport.visibleRectI
nDocument().location()); | 1307 DoubleSize excessDelta = offset - DoublePoint(pinchViewport.visibleRectI
nDocument().location()); |
| 1308 pinchViewport.move(FloatPoint(excessDelta.width(), excessDelta.height())
); | 1308 pinchViewport.move(FloatPoint(excessDelta.width(), excessDelta.height())
); |
| 1309 } | 1309 } |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 void LocalDOMWindow::scrollBy(double x, double y, ScrollBehavior scrollBehavior)
const | 1312 void LocalDOMWindow::scrollBy(double x, double y, ScrollBehavior scrollBehavior)
const |
| 1313 { | 1313 { |
| 1314 if (!isCurrentlyDisplayedInFrame()) | 1314 if (!isCurrentlyDisplayedInFrame()) |
| 1315 return; | 1315 return; |
| 1316 | 1316 |
| 1317 document()->updateLayoutIgnorePendingStylesheets(); | 1317 document()->updateLayoutIgnorePendingStylesheets(); |
| 1318 | 1318 |
| 1319 FrameView* view = frame()->view(); | 1319 FrameView* view = frame()->view(); |
| 1320 if (!view) | 1320 if (!view) |
| 1321 return; | 1321 return; |
| 1322 | 1322 |
| 1323 FrameHost* host = frame()->host(); | 1323 FrameHost* host = frame()->host(); |
| 1324 if (!host) | 1324 if (!host) |
| 1325 return; | 1325 return; |
| 1326 | 1326 |
| 1327 if (std::isnan(x) || std::isnan(y)) | 1327 if (std::isnan(x) || std::isnan(y)) |
| 1328 return; | 1328 return; |
| 1329 | 1329 |
| 1330 DoublePoint currentOffset = host->settings().pinchVirtualViewportEnabled() &
& frame()->isMainFrame() | 1330 DoublePoint currentOffset = host->settings().pinchVirtualViewportEnabled() &
& frame()->isMainFrame() |
| 1331 ? DoublePoint(host->pinchViewport().visibleRectInDocument().location()) | 1331 ? DoublePoint(host->pinchViewport().visibleRectInDocument().location()) |
| 1332 : view->scrollPositionDouble(); | 1332 : view->scrollableArea()->scrollPositionDouble(); |
| 1333 | 1333 |
| 1334 DoubleSize scaledOffset(x * frame()->pageZoomFactor(), y * frame()->pageZoom
Factor()); | 1334 DoubleSize scaledOffset(x * frame()->pageZoomFactor(), y * frame()->pageZoom
Factor()); |
| 1335 scrollViewportTo(frame(), currentOffset + scaledOffset, scrollBehavior); | 1335 scrollViewportTo(frame(), currentOffset + scaledOffset, scrollBehavior); |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const | 1338 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const |
| 1339 { | 1339 { |
| 1340 double x = 0.0; | 1340 double x = 0.0; |
| 1341 double y = 0.0; | 1341 double y = 0.0; |
| 1342 if (scrollToOptions.hasLeft()) | 1342 if (scrollToOptions.hasLeft()) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 | 1375 |
| 1376 FrameHost* host = frame()->host(); | 1376 FrameHost* host = frame()->host(); |
| 1377 if (!host) | 1377 if (!host) |
| 1378 return; | 1378 return; |
| 1379 | 1379 |
| 1380 double scaledX = 0.0; | 1380 double scaledX = 0.0; |
| 1381 double scaledY = 0.0; | 1381 double scaledY = 0.0; |
| 1382 | 1382 |
| 1383 DoublePoint currentOffset = host->settings().pinchVirtualViewportEnabled() &
& frame()->isMainFrame() | 1383 DoublePoint currentOffset = host->settings().pinchVirtualViewportEnabled() &
& frame()->isMainFrame() |
| 1384 ? DoublePoint(host->pinchViewport().visibleRectInDocument().location()) | 1384 ? DoublePoint(host->pinchViewport().visibleRectInDocument().location()) |
| 1385 : view->scrollPositionDouble(); | 1385 : view->scrollableArea()->scrollPositionDouble(); |
| 1386 scaledX = currentOffset.x(); | 1386 scaledX = currentOffset.x(); |
| 1387 scaledY = currentOffset.y(); | 1387 scaledY = currentOffset.y(); |
| 1388 | 1388 |
| 1389 if (scrollToOptions.hasLeft()) { | 1389 if (scrollToOptions.hasLeft()) { |
| 1390 if (std::isnan(scrollToOptions.left())) | 1390 if (std::isnan(scrollToOptions.left())) |
| 1391 return; | 1391 return; |
| 1392 scaledX = scrollToOptions.left() * frame()->pageZoomFactor(); | 1392 scaledX = scrollToOptions.left() * frame()->pageZoomFactor(); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 if (scrollToOptions.hasTop()) { | 1395 if (scrollToOptions.hasTop()) { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 return m_frameObserver->frame(); | 1835 return m_frameObserver->frame(); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1838 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
| 1839 { | 1839 { |
| 1840 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1840 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
| 1841 return v8::Handle<v8::Object>(); | 1841 return v8::Handle<v8::Object>(); |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 } // namespace blink | 1844 } // namespace blink |
| OLD | NEW |