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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 // also send the event to, to mitigate side effects from event handlers | 637 // also send the event to, to mitigate side effects from event handlers |
638 // potentially interfering with others. | 638 // potentially interfering with others. |
639 WillBeHeapVector<RefPtrWillBeMember<Frame> > childFrames; | 639 WillBeHeapVector<RefPtrWillBeMember<Frame> > childFrames; |
640 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 640 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
641 childFrames.append(child); | 641 childFrames.append(child); |
642 } | 642 } |
643 | 643 |
644 dispatchEvent(Event::create(EventTypeNames::orientationchange)); | 644 dispatchEvent(Event::create(EventTypeNames::orientationchange)); |
645 | 645 |
646 for (size_t i = 0; i < childFrames.size(); ++i) { | 646 for (size_t i = 0; i < childFrames.size(); ++i) { |
647 if (childFrames[i]->domWindow()) | 647 if (!childFrames[i]->isLocalFrame()) |
648 childFrames[i]->domWindow()->sendOrientationChangeEvent(); | 648 continue; |
| 649 toLocalFrame(childFrames[i].get())->localDOMWindow()->sendOrientationCha
ngeEvent(); |
649 } | 650 } |
650 } | 651 } |
651 | 652 |
652 int LocalDOMWindow::orientation() const | 653 int LocalDOMWindow::orientation() const |
653 { | 654 { |
654 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); | 655 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); |
655 | 656 |
656 if (!frame()) | 657 if (!frame()) |
657 return 0; | 658 return 0; |
658 | 659 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 return; | 1289 return; |
1289 | 1290 |
1290 FrameHost* host = frame()->host(); | 1291 FrameHost* host = frame()->host(); |
1291 if (!host) | 1292 if (!host) |
1292 return; | 1293 return; |
1293 | 1294 |
1294 ASSERT(frame()->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. | 1295 ASSERT(frame()->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. |
1295 host->chrome().setStatusbarText(frame(), m_defaultStatus); | 1296 host->chrome().setStatusbarText(frame(), m_defaultStatus); |
1296 } | 1297 } |
1297 | 1298 |
1298 LocalDOMWindow* LocalDOMWindow::self() const | 1299 DOMWindow* LocalDOMWindow::self() const |
1299 { | 1300 { |
1300 if (!frame()) | 1301 if (!frame()) |
1301 return 0; | 1302 return 0; |
1302 | 1303 |
1303 return frame()->domWindow(); | 1304 return frame()->domWindow(); |
1304 } | 1305 } |
1305 | 1306 |
1306 LocalDOMWindow* LocalDOMWindow::opener() const | 1307 DOMWindow* LocalDOMWindow::opener() const |
1307 { | 1308 { |
1308 if (!frame()) | 1309 if (!frame()) |
1309 return 0; | 1310 return 0; |
1310 | 1311 |
1311 Frame* opener = frame()->loader().opener(); | 1312 Frame* opener = frame()->loader().opener(); |
1312 if (!opener) | 1313 if (!opener) |
1313 return 0; | 1314 return 0; |
1314 | 1315 |
1315 return opener->domWindow(); | 1316 return opener->domWindow(); |
1316 } | 1317 } |
1317 | 1318 |
1318 LocalDOMWindow* LocalDOMWindow::parent() const | 1319 DOMWindow* LocalDOMWindow::parent() const |
1319 { | 1320 { |
1320 if (!frame()) | 1321 if (!frame()) |
1321 return 0; | 1322 return 0; |
1322 | 1323 |
1323 Frame* parent = frame()->tree().parent(); | 1324 Frame* parent = frame()->tree().parent(); |
1324 if (parent) | 1325 if (parent) |
1325 return parent->domWindow(); | 1326 return parent->domWindow(); |
1326 | 1327 |
1327 return frame()->domWindow(); | 1328 return frame()->domWindow(); |
1328 } | 1329 } |
1329 | 1330 |
1330 LocalDOMWindow* LocalDOMWindow::top() const | 1331 DOMWindow* LocalDOMWindow::top() const |
1331 { | 1332 { |
1332 if (!frame()) | 1333 if (!frame()) |
1333 return 0; | 1334 return 0; |
1334 | 1335 |
1335 return frame()->tree().top()->domWindow(); | 1336 return frame()->tree().top()->domWindow(); |
1336 } | 1337 } |
1337 | 1338 |
1338 Document* LocalDOMWindow::document() const | 1339 Document* LocalDOMWindow::document() const |
1339 { | 1340 { |
1340 return m_document.get(); | 1341 return m_document.get(); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 if (frameName == "_top") | 1848 if (frameName == "_top") |
1848 targetFrame = frame()->tree().top(); | 1849 targetFrame = frame()->tree().top(); |
1849 else if (frameName == "_parent") { | 1850 else if (frameName == "_parent") { |
1850 if (Frame* parent = frame()->tree().parent()) | 1851 if (Frame* parent = frame()->tree().parent()) |
1851 targetFrame = parent; | 1852 targetFrame = parent; |
1852 else | 1853 else |
1853 targetFrame = frame(); | 1854 targetFrame = frame(); |
1854 } | 1855 } |
1855 // FIXME: Navigating RemoteFrames is not yet supported. | 1856 // FIXME: Navigating RemoteFrames is not yet supported. |
1856 if (targetFrame && targetFrame->isLocalFrame()) { | 1857 if (targetFrame && targetFrame->isLocalFrame()) { |
1857 if (!activeDocument->canNavigate(*targetFrame)) | 1858 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); |
| 1859 if (!activeDocument->canNavigate(*localTargetFrame)) |
1858 return nullptr; | 1860 return nullptr; |
1859 | 1861 |
1860 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1862 KURL completedURL = firstFrame->document()->completeURL(urlString); |
1861 | 1863 |
1862 if (targetFrame->domWindow()->isInsecureScriptAccess(*callingWindow, com
pletedURL)) | 1864 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW
indow, completedURL)) |
1863 return targetFrame->domWindow(); | 1865 return localTargetFrame->localDOMWindow(); |
1864 | 1866 |
1865 if (urlString.isEmpty()) | 1867 if (urlString.isEmpty()) |
1866 return targetFrame->domWindow(); | 1868 return localTargetFrame->localDOMWindow(); |
1867 | 1869 |
1868 toLocalFrame(targetFrame)->navigationScheduler().scheduleLocationChange(
activeDocument, completedURL, false); | 1870 localTargetFrame->navigationScheduler().scheduleLocationChange(activeDoc
ument, completedURL, false); |
1869 return targetFrame->domWindow(); | 1871 return localTargetFrame->localDOMWindow(); |
1870 } | 1872 } |
1871 | 1873 |
1872 WindowFeatures windowFeatures(windowFeaturesString); | 1874 WindowFeatures windowFeatures(windowFeaturesString); |
1873 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal
lingWindow, *firstFrame, *frame()); | 1875 LocalFrame* result = createWindow(urlString, frameName, windowFeatures, *cal
lingWindow, *firstFrame, *frame()); |
1874 return result ? result->domWindow() : 0; | 1876 return result ? result->localDOMWindow() : 0; |
1875 } | 1877 } |
1876 | 1878 |
1877 void LocalDOMWindow::showModalDialog(const String& urlString, const String& dial
ogFeaturesString, | 1879 void LocalDOMWindow::showModalDialog(const String& urlString, const String& dial
ogFeaturesString, |
1878 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, PrepareDialogF
unction function, void* functionContext) | 1880 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, PrepareDialogF
unction function, void* functionContext) |
1879 { | 1881 { |
1880 if (!isCurrentlyDisplayedInFrame()) | 1882 if (!isCurrentlyDisplayedInFrame()) |
1881 return; | 1883 return; |
1882 LocalFrame* activeFrame = callingWindow->frame(); | 1884 LocalFrame* activeFrame = callingWindow->frame(); |
1883 if (!activeFrame) | 1885 if (!activeFrame) |
1884 return; | 1886 return; |
1885 LocalFrame* firstFrame = enteredWindow->frame(); | 1887 LocalFrame* firstFrame = enteredWindow->frame(); |
1886 if (!firstFrame) | 1888 if (!firstFrame) |
1887 return; | 1889 return; |
1888 | 1890 |
1889 if (!canShowModalDialogNow(frame()) || !enteredWindow->allowPopUp()) | 1891 if (!canShowModalDialogNow(frame()) || !enteredWindow->allowPopUp()) |
1890 return; | 1892 return; |
1891 | 1893 |
1892 UseCounter::countDeprecation(frame(), UseCounter::ShowModalDialog); | 1894 UseCounter::countDeprecation(frame(), UseCounter::ShowModalDialog); |
1893 | 1895 |
1894 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(fram
e()->view())); | 1896 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(fram
e()->view())); |
1895 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, | 1897 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, |
1896 *callingWindow, *firstFrame, *frame(), function, functionContext); | 1898 *callingWindow, *firstFrame, *frame(), function, functionContext); |
1897 if (!dialogFrame) | 1899 if (!dialogFrame) |
1898 return; | 1900 return; |
1899 UserGestureIndicatorDisabler disabler; | 1901 UserGestureIndicatorDisabler disabler; |
1900 dialogFrame->host()->chrome().runModal(); | 1902 dialogFrame->host()->chrome().runModal(); |
1901 } | 1903 } |
1902 | 1904 |
1903 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) | 1905 DOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) |
1904 { | 1906 { |
1905 if (!frame()) | 1907 if (!frame()) |
1906 return 0; | 1908 return 0; |
1907 | 1909 |
1908 Frame* child = frame()->tree().scopedChild(index); | 1910 Frame* child = frame()->tree().scopedChild(index); |
1909 if (child) | 1911 if (child) |
1910 return child->domWindow(); | 1912 return child->domWindow(); |
1911 | 1913 |
1912 return 0; | 1914 return 0; |
1913 } | 1915 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 return m_frameObserver->frame(); | 1959 return m_frameObserver->frame(); |
1958 } | 1960 } |
1959 | 1961 |
1960 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1962 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1961 { | 1963 { |
1962 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1964 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1963 return v8::Handle<v8::Object>(); | 1965 return v8::Handle<v8::Object>(); |
1964 } | 1966 } |
1965 | 1967 |
1966 } // namespace blink | 1968 } // namespace blink |
OLD | NEW |