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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 if (!view) | 1128 if (!view) |
1129 return; | 1129 return; |
1130 | 1130 |
1131 FrameHost* host = frame()->host(); | 1131 FrameHost* host = frame()->host(); |
1132 if (!host) | 1132 if (!host) |
1133 return; | 1133 return; |
1134 | 1134 |
1135 x = ScrollableArea::normalizeNonFiniteScroll(x); | 1135 x = ScrollableArea::normalizeNonFiniteScroll(x); |
1136 y = ScrollableArea::normalizeNonFiniteScroll(y); | 1136 y = ScrollableArea::normalizeNonFiniteScroll(y); |
1137 | 1137 |
1138 DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); | 1138 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->scrollableArea(); |
| 1139 |
| 1140 DoublePoint currentOffset = viewport->scrollPositionDouble(); |
1139 DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomF
actor()); | 1141 DoubleSize scaledDelta(x * frame()->pageZoomFactor(), y * frame()->pageZoomF
actor()); |
1140 | 1142 |
1141 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->scrollableArea(); | |
1142 viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll,
scrollBehavior); | 1143 viewport->setScrollPosition(currentOffset + scaledDelta, ProgrammaticScroll,
scrollBehavior); |
1143 } | 1144 } |
1144 | 1145 |
1145 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const | 1146 void LocalDOMWindow::scrollBy(const ScrollToOptions& scrollToOptions) const |
1146 { | 1147 { |
1147 double x = 0.0; | 1148 double x = 0.0; |
1148 double y = 0.0; | 1149 double y = 0.0; |
1149 if (scrollToOptions.hasLeft()) | 1150 if (scrollToOptions.hasLeft()) |
1150 x = scrollToOptions.left(); | 1151 x = scrollToOptions.left(); |
1151 if (scrollToOptions.hasTop()) | 1152 if (scrollToOptions.hasTop()) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 if (!scrollToOptions.hasLeft() | 1200 if (!scrollToOptions.hasLeft() |
1200 || !scrollToOptions.hasTop() | 1201 || !scrollToOptions.hasTop() |
1201 || scrollToOptions.left() | 1202 || scrollToOptions.left() |
1202 || scrollToOptions.top()) { | 1203 || scrollToOptions.top()) { |
1203 document()->updateLayoutIgnorePendingStylesheets(); | 1204 document()->updateLayoutIgnorePendingStylesheets(); |
1204 } | 1205 } |
1205 | 1206 |
1206 double scaledX = 0.0; | 1207 double scaledX = 0.0; |
1207 double scaledY = 0.0; | 1208 double scaledY = 0.0; |
1208 | 1209 |
1209 DoublePoint currentOffset = view->scrollableArea()->scrollPositionDouble(); | 1210 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->scrollableArea(); |
| 1211 |
| 1212 DoublePoint currentOffset = viewport->scrollPositionDouble(); |
1210 scaledX = currentOffset.x(); | 1213 scaledX = currentOffset.x(); |
1211 scaledY = currentOffset.y(); | 1214 scaledY = currentOffset.y(); |
1212 | 1215 |
1213 if (scrollToOptions.hasLeft()) | 1216 if (scrollToOptions.hasLeft()) |
1214 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left(
)) * frame()->pageZoomFactor(); | 1217 scaledX = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.left(
)) * frame()->pageZoomFactor(); |
1215 | 1218 |
1216 if (scrollToOptions.hasTop()) | 1219 if (scrollToOptions.hasTop()) |
1217 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()
) * frame()->pageZoomFactor(); | 1220 scaledY = ScrollableArea::normalizeNonFiniteScroll(scrollToOptions.top()
) * frame()->pageZoomFactor(); |
1218 | 1221 |
1219 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; | 1222 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; |
1220 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); | 1223 ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollB
ehavior); |
1221 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->scrollableArea(); | 1224 |
1222 viewport->setScrollPosition(DoublePoint(scaledX, scaledY), ProgrammaticScrol
l, scrollBehavior); | 1225 viewport->setScrollPosition(DoublePoint(scaledX, scaledY), ProgrammaticScrol
l, scrollBehavior); |
1223 } | 1226 } |
1224 | 1227 |
1225 void LocalDOMWindow::moveBy(int x, int y) const | 1228 void LocalDOMWindow::moveBy(int x, int y) const |
1226 { | 1229 { |
1227 if (!frame() || !frame()->isMainFrame()) | 1230 if (!frame() || !frame()->isMainFrame()) |
1228 return; | 1231 return; |
1229 | 1232 |
1230 FrameHost* host = frame()->host(); | 1233 FrameHost* host = frame()->host(); |
1231 if (!host) | 1234 if (!host) |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 { | 1530 { |
1528 // If the LocalDOMWindow still has a frame reference, that frame must point | 1531 // If the LocalDOMWindow still has a frame reference, that frame must point |
1529 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1532 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
1530 // where script execution leaks between different LocalDOMWindows. | 1533 // where script execution leaks between different LocalDOMWindows. |
1531 if (m_frameObserver->frame()) | 1534 if (m_frameObserver->frame()) |
1532 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1535 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
1533 return m_frameObserver->frame(); | 1536 return m_frameObserver->frame(); |
1534 } | 1537 } |
1535 | 1538 |
1536 } // namespace blink | 1539 } // namespace blink |
OLD | NEW |