| 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 return FloatSize(); | 951 return FloatSize(); |
| 952 | 952 |
| 953 FrameView* view = frame()->view(); | 953 FrameView* view = frame()->view(); |
| 954 if (!view) | 954 if (!view) |
| 955 return FloatSize(); | 955 return FloatSize(); |
| 956 | 956 |
| 957 Page* page = frame()->page(); | 957 Page* page = frame()->page(); |
| 958 if (!page) | 958 if (!page) |
| 959 return FloatSize(); | 959 return FloatSize(); |
| 960 | 960 |
| 961 // If we have a Page, we must have a FrameHost. | |
| 962 FrameHost* host = frame()->host(); | |
| 963 DCHECK(host); | |
| 964 | |
| 965 // The main frame's viewport size depends on the page scale. Since the | 961 // The main frame's viewport size depends on the page scale. Since the |
| 966 // initial page scale depends on the content width and is set after a | 962 // initial page scale depends on the content width and is set after a |
| 967 // layout, perform one now so queries during page load will use the up to | 963 // layout, perform one now so queries during page load will use the up to |
| 968 // date viewport. | 964 // date viewport. |
| 969 if (page->settings().getViewportEnabled() && frame()->isMainFrame()) | 965 if (page->settings().getViewportEnabled() && frame()->isMainFrame()) |
| 970 document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 966 document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 971 | 967 |
| 972 // FIXME: This is potentially too much work. We really only need to know the | 968 // FIXME: This is potentially too much work. We really only need to know the |
| 973 // dimensions of the parent frame's layoutObject. | 969 // dimensions of the parent frame's layoutObject. |
| 974 if (Frame* parent = frame()->tree().parent()) { | 970 if (Frame* parent = frame()->tree().parent()) { |
| 975 if (parent && parent->isLocalFrame()) | 971 if (parent && parent->isLocalFrame()) |
| 976 toLocalFrame(parent) | 972 toLocalFrame(parent) |
| 977 ->document() | 973 ->document() |
| 978 ->updateStyleAndLayoutIgnorePendingStylesheets(); | 974 ->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 979 } | 975 } |
| 980 | 976 |
| 981 return frame()->isMainFrame() && !page->settings().getInertVisualViewport() | 977 return frame()->isMainFrame() && !page->settings().getInertVisualViewport() |
| 982 ? FloatSize(host->visualViewport().visibleRect().size()) | 978 ? FloatSize(page->visualViewport().visibleRect().size()) |
| 983 : FloatSize(view->visibleContentRect(scrollbarInclusion).size()); | 979 : FloatSize(view->visibleContentRect(scrollbarInclusion).size()); |
| 984 } | 980 } |
| 985 | 981 |
| 986 int LocalDOMWindow::innerHeight() const { | 982 int LocalDOMWindow::innerHeight() const { |
| 987 if (!frame()) | 983 if (!frame()) |
| 988 return 0; | 984 return 0; |
| 989 | 985 |
| 990 FloatSize viewportSize = getViewportSize(IncludeScrollbars); | 986 FloatSize viewportSize = getViewportSize(IncludeScrollbars); |
| 991 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), | 987 return adjustForAbsoluteZoom(expandedIntSize(viewportSize).height(), |
| 992 frame()->pageZoomFactor()); | 988 frame()->pageZoomFactor()); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 DOMWindow::trace(visitor); | 1652 DOMWindow::trace(visitor); |
| 1657 Supplementable<LocalDOMWindow>::trace(visitor); | 1653 Supplementable<LocalDOMWindow>::trace(visitor); |
| 1658 } | 1654 } |
| 1659 | 1655 |
| 1660 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { | 1656 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { |
| 1661 visitor->traceWrappers(m_customElements); | 1657 visitor->traceWrappers(m_customElements); |
| 1662 DOMWindow::traceWrappers(visitor); | 1658 DOMWindow::traceWrappers(visitor); |
| 1663 } | 1659 } |
| 1664 | 1660 |
| 1665 } // namespace blink | 1661 } // namespace blink |
| OLD | NEW |