| 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 return 0; | 972 return 0; |
| 973 | 973 |
| 974 ChromeClient& chromeClient = host->chromeClient(); | 974 ChromeClient& chromeClient = host->chromeClient(); |
| 975 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 975 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
| 976 return lroundf(chromeClient.windowRect().y() * chromeClient.screenInfo()
.deviceScaleFactor); | 976 return lroundf(chromeClient.windowRect().y() * chromeClient.screenInfo()
.deviceScaleFactor); |
| 977 return chromeClient.windowRect().y(); | 977 return chromeClient.windowRect().y(); |
| 978 } | 978 } |
| 979 | 979 |
| 980 double LocalDOMWindow::scrollX() const | 980 double LocalDOMWindow::scrollX() const |
| 981 { | 981 { |
| 982 if (!frame()) | 982 if (!frame() || !frame()->host()) |
| 983 return 0; | 983 return 0; |
| 984 | 984 |
| 985 if (!frame()->host()->settings().inertVisualViewport()) |
| 986 return m_visualViewport->pageX(); |
| 987 |
| 985 FrameView* view = frame()->view(); | 988 FrameView* view = frame()->view(); |
| 986 if (!view) | 989 if (!view) |
| 987 return 0; | 990 return 0; |
| 988 | 991 |
| 989 FrameHost* host = frame()->host(); | |
| 990 if (!host) | |
| 991 return 0; | |
| 992 | |
| 993 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 992 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 994 | 993 |
| 995 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->getScrollableArea(); | 994 double viewportX = view->layoutViewportScrollableArea()->scrollPositionDoubl
e().x(); |
| 996 double viewportX = viewport->scrollPositionDouble().x(); | |
| 997 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); | 995 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); |
| 998 } | 996 } |
| 999 | 997 |
| 1000 double LocalDOMWindow::scrollY() const | 998 double LocalDOMWindow::scrollY() const |
| 1001 { | 999 { |
| 1002 if (!frame()) | 1000 if (!frame() || !frame()->host()) |
| 1003 return 0; | 1001 return 0; |
| 1004 | 1002 |
| 1003 if (!frame()->host()->settings().inertVisualViewport()) |
| 1004 return m_visualViewport->pageY(); |
| 1005 |
| 1005 FrameView* view = frame()->view(); | 1006 FrameView* view = frame()->view(); |
| 1006 if (!view) | 1007 if (!view) |
| 1007 return 0; | 1008 return 0; |
| 1008 | 1009 |
| 1009 FrameHost* host = frame()->host(); | |
| 1010 if (!host) | |
| 1011 return 0; | |
| 1012 | |
| 1013 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 1010 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1014 | 1011 |
| 1015 ScrollableArea* viewport = host->settings().inertVisualViewport() ? view->la
youtViewportScrollableArea() : view->getScrollableArea(); | 1012 double viewportY = view->layoutViewportScrollableArea()->scrollPositionDoubl
e().y(); |
| 1016 double viewportY = viewport->scrollPositionDouble().y(); | |
| 1017 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); | 1013 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); |
| 1018 } | 1014 } |
| 1019 | 1015 |
| 1020 DOMVisualViewport* LocalDOMWindow::visualViewport() | 1016 DOMVisualViewport* LocalDOMWindow::visualViewport() |
| 1021 { | 1017 { |
| 1022 if (!frame()) | 1018 if (!frame()) |
| 1023 return nullptr; | 1019 return nullptr; |
| 1024 | 1020 |
| 1025 return m_visualViewport; | 1021 return m_visualViewport; |
| 1026 } | 1022 } |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 { | 1539 { |
| 1544 // If the LocalDOMWindow still has a frame reference, that frame must point | 1540 // If the LocalDOMWindow still has a frame reference, that frame must point |
| 1545 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1541 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
| 1546 // where script execution leaks between different LocalDOMWindows. | 1542 // where script execution leaks between different LocalDOMWindows. |
| 1547 if (m_frameObserver->frame()) | 1543 if (m_frameObserver->frame()) |
| 1548 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1544 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
| 1549 return m_frameObserver->frame(); | 1545 return m_frameObserver->frame(); |
| 1550 } | 1546 } |
| 1551 | 1547 |
| 1552 } // namespace blink | 1548 } // namespace blink |
| OLD | NEW |