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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 int DOMWindow::innerHeight() const | 1105 int DOMWindow::innerHeight() const |
1106 { | 1106 { |
1107 if (!m_frame) | 1107 if (!m_frame) |
1108 return 0; | 1108 return 0; |
1109 | 1109 |
1110 FrameView* view = m_frame->view(); | 1110 FrameView* view = m_frame->view(); |
1111 if (!view) | 1111 if (!view) |
1112 return 0; | 1112 return 0; |
1113 | 1113 |
1114 // FIXME: This is potentially too much work. We really only need to know the
dimensions of the parent frame's renderer. | 1114 // FIXME: This is potentially too much work. We really only need to know the
dimensions of the parent frame's renderer. |
1115 if (LocalFrame* parent = m_frame->tree().parent()) | 1115 if (Frame* parent = m_frame->tree().parent()) { |
1116 parent->document()->updateLayoutIgnorePendingStylesheets(); | 1116 if (parent && parent->isLocalFrame()) |
| 1117 toLocalFrame(parent)->document()->updateLayoutIgnorePendingStyleshee
ts(); |
| 1118 } |
1117 | 1119 |
1118 return adjustForAbsoluteZoom(view->visibleContentRect(IncludeScrollbars).hei
ght(), m_frame->pageZoomFactor()); | 1120 return adjustForAbsoluteZoom(view->visibleContentRect(IncludeScrollbars).hei
ght(), m_frame->pageZoomFactor()); |
1119 } | 1121 } |
1120 | 1122 |
1121 int DOMWindow::innerWidth() const | 1123 int DOMWindow::innerWidth() const |
1122 { | 1124 { |
1123 if (!m_frame) | 1125 if (!m_frame) |
1124 return 0; | 1126 return 0; |
1125 | 1127 |
1126 FrameView* view = m_frame->view(); | 1128 FrameView* view = m_frame->view(); |
1127 if (!view) | 1129 if (!view) |
1128 return 0; | 1130 return 0; |
1129 | 1131 |
1130 // FIXME: This is potentially too much work. We really only need to know the
dimensions of the parent frame's renderer. | 1132 // FIXME: This is potentially too much work. We really only need to know the
dimensions of the parent frame's renderer. |
1131 if (LocalFrame* parent = m_frame->tree().parent()) | 1133 if (Frame* parent = m_frame->tree().parent()) { |
1132 parent->document()->updateLayoutIgnorePendingStylesheets(); | 1134 if (parent && parent->isLocalFrame()) |
| 1135 toLocalFrame(parent)->document()->updateLayoutIgnorePendingStyleshee
ts(); |
| 1136 } |
1133 | 1137 |
1134 return adjustForAbsoluteZoom(view->visibleContentRect(IncludeScrollbars).wid
th(), m_frame->pageZoomFactor()); | 1138 return adjustForAbsoluteZoom(view->visibleContentRect(IncludeScrollbars).wid
th(), m_frame->pageZoomFactor()); |
1135 } | 1139 } |
1136 | 1140 |
1137 int DOMWindow::screenX() const | 1141 int DOMWindow::screenX() const |
1138 { | 1142 { |
1139 if (!m_frame) | 1143 if (!m_frame) |
1140 return 0; | 1144 return 0; |
1141 | 1145 |
1142 FrameHost* host = m_frame->host(); | 1146 FrameHost* host = m_frame->host(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 return 0; | 1273 return 0; |
1270 | 1274 |
1271 return opener->domWindow(); | 1275 return opener->domWindow(); |
1272 } | 1276 } |
1273 | 1277 |
1274 DOMWindow* DOMWindow::parent() const | 1278 DOMWindow* DOMWindow::parent() const |
1275 { | 1279 { |
1276 if (!m_frame) | 1280 if (!m_frame) |
1277 return 0; | 1281 return 0; |
1278 | 1282 |
1279 LocalFrame* parent = m_frame->tree().parent(); | 1283 Frame* parent = m_frame->tree().parent(); |
1280 if (parent) | 1284 if (parent) |
1281 return parent->domWindow(); | 1285 return parent->domWindow(); |
1282 | 1286 |
1283 return m_frame->domWindow(); | 1287 return m_frame->domWindow(); |
1284 } | 1288 } |
1285 | 1289 |
1286 DOMWindow* DOMWindow::top() const | 1290 DOMWindow* DOMWindow::top() const |
1287 { | 1291 { |
1288 if (!m_frame) | 1292 if (!m_frame) |
1289 return 0; | 1293 return 0; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 | 1810 |
1807 if (!enteredWindow->allowPopUp()) { | 1811 if (!enteredWindow->allowPopUp()) { |
1808 // Because FrameTree::find() returns true for empty strings, we must che
ck for empty frame names. | 1812 // Because FrameTree::find() returns true for empty strings, we must che
ck for empty frame names. |
1809 // Otherwise, illegitimate window.open() calls with no name will pass ri
ght through the popup blocker. | 1813 // Otherwise, illegitimate window.open() calls with no name will pass ri
ght through the popup blocker. |
1810 if (frameName.isEmpty() || !m_frame->tree().find(frameName)) | 1814 if (frameName.isEmpty() || !m_frame->tree().find(frameName)) |
1811 return nullptr; | 1815 return nullptr; |
1812 } | 1816 } |
1813 | 1817 |
1814 // Get the target frame for the special cases of _top and _parent. | 1818 // Get the target frame for the special cases of _top and _parent. |
1815 // In those cases, we schedule a location change right now and return early. | 1819 // In those cases, we schedule a location change right now and return early. |
1816 LocalFrame* targetFrame = 0; | 1820 Frame* targetFrame = 0; |
1817 if (frameName == "_top") | 1821 if (frameName == "_top") |
1818 targetFrame = m_frame->tree().top(); | 1822 targetFrame = m_frame->tree().top(); |
1819 else if (frameName == "_parent") { | 1823 else if (frameName == "_parent") { |
1820 if (LocalFrame* parent = m_frame->tree().parent()) | 1824 if (Frame* parent = m_frame->tree().parent()) |
1821 targetFrame = parent; | 1825 targetFrame = parent; |
1822 else | 1826 else |
1823 targetFrame = m_frame; | 1827 targetFrame = m_frame; |
1824 } | 1828 } |
1825 if (targetFrame) { | 1829 // FIXME: Navigating RemoteFrames is not yet supported. |
| 1830 if (targetFrame && targetFrame->isLocalFrame()) { |
1826 if (!activeDocument->canNavigate(*targetFrame)) | 1831 if (!activeDocument->canNavigate(*targetFrame)) |
1827 return nullptr; | 1832 return nullptr; |
1828 | 1833 |
1829 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1834 KURL completedURL = firstFrame->document()->completeURL(urlString); |
1830 | 1835 |
1831 if (targetFrame->domWindow()->isInsecureScriptAccess(*callingWindow, com
pletedURL)) | 1836 if (targetFrame->domWindow()->isInsecureScriptAccess(*callingWindow, com
pletedURL)) |
1832 return targetFrame->domWindow(); | 1837 return targetFrame->domWindow(); |
1833 | 1838 |
1834 if (urlString.isEmpty()) | 1839 if (urlString.isEmpty()) |
1835 return targetFrame->domWindow(); | 1840 return targetFrame->domWindow(); |
1836 | 1841 |
1837 // For whatever reason, Firefox uses the first window rather than the ac
tive window to | 1842 // For whatever reason, Firefox uses the first window rather than the ac
tive window to |
1838 // determine the outgoing referrer. We replicate that behavior here. | 1843 // determine the outgoing referrer. We replicate that behavior here. |
1839 targetFrame->navigationScheduler().scheduleLocationChange( | 1844 toLocalFrame(targetFrame)->navigationScheduler().scheduleLocationChange( |
1840 activeDocument, | 1845 activeDocument, |
1841 completedURL, | 1846 completedURL, |
1842 Referrer(firstFrame->document()->outgoingReferrer(), firstFrame->doc
ument()->referrerPolicy()), | 1847 Referrer(firstFrame->document()->outgoingReferrer(), firstFrame->doc
ument()->referrerPolicy()), |
1843 false); | 1848 false); |
1844 return targetFrame->domWindow(); | 1849 return targetFrame->domWindow(); |
1845 } | 1850 } |
1846 | 1851 |
1847 WindowFeatures windowFeatures(windowFeaturesString); | 1852 WindowFeatures windowFeatures(windowFeaturesString); |
1848 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal
lingWindow, *firstFrame, *m_frame); | 1853 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal
lingWindow, *firstFrame, *m_frame); |
1849 return result ? result->domWindow() : 0; | 1854 return result ? result->domWindow() : 0; |
(...skipping 24 matching lines...) Expand all Loading... |
1874 UserGestureIndicatorDisabler disabler; | 1879 UserGestureIndicatorDisabler disabler; |
1875 dialogFrame->host()->chrome().runModal(); | 1880 dialogFrame->host()->chrome().runModal(); |
1876 } | 1881 } |
1877 | 1882 |
1878 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) | 1883 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) |
1879 { | 1884 { |
1880 LocalFrame* frame = this->frame(); | 1885 LocalFrame* frame = this->frame(); |
1881 if (!frame) | 1886 if (!frame) |
1882 return 0; | 1887 return 0; |
1883 | 1888 |
1884 LocalFrame* child = frame->tree().scopedChild(index); | 1889 Frame* child = frame->tree().scopedChild(index); |
1885 if (child) | 1890 if (child) |
1886 return child->domWindow(); | 1891 return child->domWindow(); |
1887 | 1892 |
1888 return 0; | 1893 return 0; |
1889 } | 1894 } |
1890 | 1895 |
1891 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier() | 1896 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier() |
1892 { | 1897 { |
1893 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); | 1898 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); |
1894 } | 1899 } |
(...skipping 21 matching lines...) Expand all Loading... |
1916 visitor->trace(m_sessionStorage); | 1921 visitor->trace(m_sessionStorage); |
1917 visitor->trace(m_localStorage); | 1922 visitor->trace(m_localStorage); |
1918 visitor->trace(m_applicationCache); | 1923 visitor->trace(m_applicationCache); |
1919 visitor->trace(m_performance); | 1924 visitor->trace(m_performance); |
1920 visitor->trace(m_css); | 1925 visitor->trace(m_css); |
1921 WillBeHeapSupplementable<DOMWindow>::trace(visitor); | 1926 WillBeHeapSupplementable<DOMWindow>::trace(visitor); |
1922 EventTargetWithInlineData::trace(visitor); | 1927 EventTargetWithInlineData::trace(visitor); |
1923 } | 1928 } |
1924 | 1929 |
1925 } // namespace WebCore | 1930 } // namespace WebCore |
OLD | NEW |