| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // 1) Validates the pending changes are not changing any value to NaN; in that c
ase keep original value. | 312 // 1) Validates the pending changes are not changing any value to NaN; in that c
ase keep original value. |
| 313 // 2) Constrains the window rect to the minimum window size and no bigger than t
he float rect's dimensions. | 313 // 2) Constrains the window rect to the minimum window size and no bigger than t
he float rect's dimensions. |
| 314 // 3) Constrains the window rect to within the top and left boundaries of the av
ailable screen rect. | 314 // 3) Constrains the window rect to within the top and left boundaries of the av
ailable screen rect. |
| 315 // 4) Constrains the window rect to within the bottom and right boundaries of th
e available screen rect. | 315 // 4) Constrains the window rect to within the bottom and right boundaries of th
e available screen rect. |
| 316 // 5) Translate the window rect coordinates to be within the coordinate space of
the screen. | 316 // 5) Translate the window rect coordinates to be within the coordinate space of
the screen. |
| 317 FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
s) | 317 FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
s) |
| 318 { | 318 { |
| 319 ASSERT(page); | 319 ASSERT(page); |
| 320 | 320 |
| 321 FloatRect screen = screenAvailableRect(page->mainFrame()->view()); | 321 FloatRect screen = screenAvailableRect(page->mainFrame()->view()); |
| 322 FloatRect window = page->chrome()->windowRect(); | 322 FloatRect window = page->chrome().windowRect(); |
| 323 | 323 |
| 324 // Make sure we're in a valid state before adjusting dimensions. | 324 // Make sure we're in a valid state before adjusting dimensions. |
| 325 ASSERT(std::isfinite(screen.x())); | 325 ASSERT(std::isfinite(screen.x())); |
| 326 ASSERT(std::isfinite(screen.y())); | 326 ASSERT(std::isfinite(screen.y())); |
| 327 ASSERT(std::isfinite(screen.width())); | 327 ASSERT(std::isfinite(screen.width())); |
| 328 ASSERT(std::isfinite(screen.height())); | 328 ASSERT(std::isfinite(screen.height())); |
| 329 ASSERT(std::isfinite(window.x())); | 329 ASSERT(std::isfinite(window.x())); |
| 330 ASSERT(std::isfinite(window.y())); | 330 ASSERT(std::isfinite(window.y())); |
| 331 ASSERT(std::isfinite(window.width())); | 331 ASSERT(std::isfinite(window.width())); |
| 332 ASSERT(std::isfinite(window.height())); | 332 ASSERT(std::isfinite(window.height())); |
| 333 | 333 |
| 334 // Update window values if new requested values are not NaN. | 334 // Update window values if new requested values are not NaN. |
| 335 if (!std::isnan(pendingChanges.x())) | 335 if (!std::isnan(pendingChanges.x())) |
| 336 window.setX(pendingChanges.x()); | 336 window.setX(pendingChanges.x()); |
| 337 if (!std::isnan(pendingChanges.y())) | 337 if (!std::isnan(pendingChanges.y())) |
| 338 window.setY(pendingChanges.y()); | 338 window.setY(pendingChanges.y()); |
| 339 if (!std::isnan(pendingChanges.width())) | 339 if (!std::isnan(pendingChanges.width())) |
| 340 window.setWidth(pendingChanges.width()); | 340 window.setWidth(pendingChanges.width()); |
| 341 if (!std::isnan(pendingChanges.height())) | 341 if (!std::isnan(pendingChanges.height())) |
| 342 window.setHeight(pendingChanges.height()); | 342 window.setHeight(pendingChanges.height()); |
| 343 | 343 |
| 344 FloatSize minimumSize = page->chrome()->client()->minimumWindowSize(); | 344 FloatSize minimumSize = page->chrome().client()->minimumWindowSize(); |
| 345 // Let size 0 pass through, since that indicates default size, not minimum s
ize. | 345 // Let size 0 pass through, since that indicates default size, not minimum s
ize. |
| 346 if (window.width()) | 346 if (window.width()) |
| 347 window.setWidth(min(max(minimumSize.width(), window.width()), screen.wid
th())); | 347 window.setWidth(min(max(minimumSize.width(), window.width()), screen.wid
th())); |
| 348 if (window.height()) | 348 if (window.height()) |
| 349 window.setHeight(min(max(minimumSize.height(), window.height()), screen.
height())); | 349 window.setHeight(min(max(minimumSize.height(), window.height()), screen.
height())); |
| 350 | 350 |
| 351 // Constrain the window position within the valid screen area. | 351 // Constrain the window position within the valid screen area. |
| 352 window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width()))
); | 352 window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width()))
); |
| 353 window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())
)); | 353 window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())
)); |
| 354 | 354 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 371 return m_frame && allowPopUp(m_frame); | 371 return m_frame && allowPopUp(m_frame); |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool DOMWindow::canShowModalDialog(const Frame* frame) | 374 bool DOMWindow::canShowModalDialog(const Frame* frame) |
| 375 { | 375 { |
| 376 if (!frame) | 376 if (!frame) |
| 377 return false; | 377 return false; |
| 378 Page* page = frame->page(); | 378 Page* page = frame->page(); |
| 379 if (!page) | 379 if (!page) |
| 380 return false; | 380 return false; |
| 381 return page->chrome()->canRunModal(); | 381 return page->chrome().canRunModal(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 bool DOMWindow::canShowModalDialogNow(const Frame* frame) | 384 bool DOMWindow::canShowModalDialogNow(const Frame* frame) |
| 385 { | 385 { |
| 386 if (!frame) | 386 if (!frame) |
| 387 return false; | 387 return false; |
| 388 Page* page = frame->page(); | 388 Page* page = frame->page(); |
| 389 if (!page) | 389 if (!page) |
| 390 return false; | 390 return false; |
| 391 return page->chrome()->canRunModalNow(); | 391 return page->chrome().canRunModalNow(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 DOMWindow::DOMWindow(Document* document) | 394 DOMWindow::DOMWindow(Document* document) |
| 395 : ContextDestructionObserver(document) | 395 : ContextDestructionObserver(document) |
| 396 , FrameDestructionObserver(document->frame()) | 396 , FrameDestructionObserver(document->frame()) |
| 397 , m_shouldPrintWhenFinishedLoading(false) | 397 , m_shouldPrintWhenFinishedLoading(false) |
| 398 { | 398 { |
| 399 ASSERT(frame()); | 399 ASSERT(frame()); |
| 400 ASSERT(DOMWindow::document()); | 400 ASSERT(DOMWindow::document()); |
| 401 ScriptWrappable::init(this); | 401 ScriptWrappable::init(this); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed(); | 860 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed(); |
| 861 if (context) { | 861 if (context) { |
| 862 ASSERT(isMainThread()); | 862 ASSERT(isMainThread()); |
| 863 Document* activeDocument = toDocument(context); | 863 Document* activeDocument = toDocument(context); |
| 864 if (opener() && opener() != this && activeDocument->domWindow() == opene
r()) | 864 if (opener() && opener() != this && activeDocument->domWindow() == opene
r()) |
| 865 allowFocus = true; | 865 allowFocus = true; |
| 866 } | 866 } |
| 867 | 867 |
| 868 // If we're a top level window, bring the window to the front. | 868 // If we're a top level window, bring the window to the front. |
| 869 if (m_frame == page->mainFrame() && allowFocus) | 869 if (m_frame == page->mainFrame() && allowFocus) |
| 870 page->chrome()->focus(); | 870 page->chrome().focus(); |
| 871 | 871 |
| 872 if (!m_frame) | 872 if (!m_frame) |
| 873 return; | 873 return; |
| 874 | 874 |
| 875 // Clear the current frame's focused node if a new frame is about to be focu
sed. | 875 // Clear the current frame's focused node if a new frame is about to be focu
sed. |
| 876 Frame* focusedFrame = page->focusController()->focusedFrame(); | 876 Frame* focusedFrame = page->focusController()->focusedFrame(); |
| 877 if (focusedFrame && focusedFrame != m_frame) | 877 if (focusedFrame && focusedFrame != m_frame) |
| 878 focusedFrame->document()->setFocusedNode(0); | 878 focusedFrame->document()->setFocusedNode(0); |
| 879 | 879 |
| 880 m_frame->eventHandler()->focusDocumentView(); | 880 m_frame->eventHandler()->focusDocumentView(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 908 | 908 |
| 909 Settings* settings = m_frame->settings(); | 909 Settings* settings = m_frame->settings(); |
| 910 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); | 910 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); |
| 911 | 911 |
| 912 if (!(page->openedByDOM() || page->backForward()->count() <= 1 || allowScrip
tsToCloseWindows)) | 912 if (!(page->openedByDOM() || page->backForward()->count() <= 1 || allowScrip
tsToCloseWindows)) |
| 913 return; | 913 return; |
| 914 | 914 |
| 915 if (!m_frame->loader()->shouldClose()) | 915 if (!m_frame->loader()->shouldClose()) |
| 916 return; | 916 return; |
| 917 | 917 |
| 918 page->chrome()->closeWindowSoon(); | 918 page->chrome().closeWindowSoon(); |
| 919 } | 919 } |
| 920 | 920 |
| 921 void DOMWindow::print() | 921 void DOMWindow::print() |
| 922 { | 922 { |
| 923 if (!m_frame) | 923 if (!m_frame) |
| 924 return; | 924 return; |
| 925 | 925 |
| 926 Page* page = m_frame->page(); | 926 Page* page = m_frame->page(); |
| 927 if (!page) | 927 if (!page) |
| 928 return; | 928 return; |
| 929 | 929 |
| 930 if (m_frame->loader()->activeDocumentLoader()->isLoading()) { | 930 if (m_frame->loader()->activeDocumentLoader()->isLoading()) { |
| 931 m_shouldPrintWhenFinishedLoading = true; | 931 m_shouldPrintWhenFinishedLoading = true; |
| 932 return; | 932 return; |
| 933 } | 933 } |
| 934 m_shouldPrintWhenFinishedLoading = false; | 934 m_shouldPrintWhenFinishedLoading = false; |
| 935 page->chrome()->print(m_frame); | 935 page->chrome().print(m_frame); |
| 936 } | 936 } |
| 937 | 937 |
| 938 void DOMWindow::stop() | 938 void DOMWindow::stop() |
| 939 { | 939 { |
| 940 if (!m_frame) | 940 if (!m_frame) |
| 941 return; | 941 return; |
| 942 | 942 |
| 943 // We must check whether the load is complete asynchronously, because we mig
ht still be parsing | 943 // We must check whether the load is complete asynchronously, because we mig
ht still be parsing |
| 944 // the document until the callstack unwinds. | 944 // the document until the callstack unwinds. |
| 945 m_frame->loader()->stopForUserCancel(true); | 945 m_frame->loader()->stopForUserCancel(true); |
| 946 } | 946 } |
| 947 | 947 |
| 948 void DOMWindow::alert(const String& message) | 948 void DOMWindow::alert(const String& message) |
| 949 { | 949 { |
| 950 if (!m_frame) | 950 if (!m_frame) |
| 951 return; | 951 return; |
| 952 | 952 |
| 953 m_frame->document()->updateStyleIfNeeded(); | 953 m_frame->document()->updateStyleIfNeeded(); |
| 954 | 954 |
| 955 Page* page = m_frame->page(); | 955 Page* page = m_frame->page(); |
| 956 if (!page) | 956 if (!page) |
| 957 return; | 957 return; |
| 958 | 958 |
| 959 page->chrome()->runJavaScriptAlert(m_frame, message); | 959 page->chrome().runJavaScriptAlert(m_frame, message); |
| 960 } | 960 } |
| 961 | 961 |
| 962 bool DOMWindow::confirm(const String& message) | 962 bool DOMWindow::confirm(const String& message) |
| 963 { | 963 { |
| 964 if (!m_frame) | 964 if (!m_frame) |
| 965 return false; | 965 return false; |
| 966 | 966 |
| 967 m_frame->document()->updateStyleIfNeeded(); | 967 m_frame->document()->updateStyleIfNeeded(); |
| 968 | 968 |
| 969 Page* page = m_frame->page(); | 969 Page* page = m_frame->page(); |
| 970 if (!page) | 970 if (!page) |
| 971 return false; | 971 return false; |
| 972 | 972 |
| 973 return page->chrome()->runJavaScriptConfirm(m_frame, message); | 973 return page->chrome().runJavaScriptConfirm(m_frame, message); |
| 974 } | 974 } |
| 975 | 975 |
| 976 String DOMWindow::prompt(const String& message, const String& defaultValue) | 976 String DOMWindow::prompt(const String& message, const String& defaultValue) |
| 977 { | 977 { |
| 978 if (!m_frame) | 978 if (!m_frame) |
| 979 return String(); | 979 return String(); |
| 980 | 980 |
| 981 m_frame->document()->updateStyleIfNeeded(); | 981 m_frame->document()->updateStyleIfNeeded(); |
| 982 | 982 |
| 983 Page* page = m_frame->page(); | 983 Page* page = m_frame->page(); |
| 984 if (!page) | 984 if (!page) |
| 985 return String(); | 985 return String(); |
| 986 | 986 |
| 987 String returnValue; | 987 String returnValue; |
| 988 if (page->chrome()->runJavaScriptPrompt(m_frame, message, defaultValue, retu
rnValue)) | 988 if (page->chrome().runJavaScriptPrompt(m_frame, message, defaultValue, retur
nValue)) |
| 989 return returnValue; | 989 return returnValue; |
| 990 | 990 |
| 991 return String(); | 991 return String(); |
| 992 } | 992 } |
| 993 | 993 |
| 994 String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec) | 994 String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec) |
| 995 { | 995 { |
| 996 if (stringToEncode.isNull()) | 996 if (stringToEncode.isNull()) |
| 997 return String(); | 997 return String(); |
| 998 | 998 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 | 1039 |
| 1040 int DOMWindow::outerHeight() const | 1040 int DOMWindow::outerHeight() const |
| 1041 { | 1041 { |
| 1042 if (!m_frame) | 1042 if (!m_frame) |
| 1043 return 0; | 1043 return 0; |
| 1044 | 1044 |
| 1045 Page* page = m_frame->page(); | 1045 Page* page = m_frame->page(); |
| 1046 if (!page) | 1046 if (!page) |
| 1047 return 0; | 1047 return 0; |
| 1048 | 1048 |
| 1049 return static_cast<int>(page->chrome()->windowRect().height()); | 1049 return static_cast<int>(page->chrome().windowRect().height()); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 int DOMWindow::outerWidth() const | 1052 int DOMWindow::outerWidth() const |
| 1053 { | 1053 { |
| 1054 if (!m_frame) | 1054 if (!m_frame) |
| 1055 return 0; | 1055 return 0; |
| 1056 | 1056 |
| 1057 Page* page = m_frame->page(); | 1057 Page* page = m_frame->page(); |
| 1058 if (!page) | 1058 if (!page) |
| 1059 return 0; | 1059 return 0; |
| 1060 | 1060 |
| 1061 return static_cast<int>(page->chrome()->windowRect().width()); | 1061 return static_cast<int>(page->chrome().windowRect().width()); |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 int DOMWindow::innerHeight() const | 1064 int DOMWindow::innerHeight() const |
| 1065 { | 1065 { |
| 1066 if (!m_frame) | 1066 if (!m_frame) |
| 1067 return 0; | 1067 return 0; |
| 1068 | 1068 |
| 1069 FrameView* view = m_frame->view(); | 1069 FrameView* view = m_frame->view(); |
| 1070 if (!view) | 1070 if (!view) |
| 1071 return 0; | 1071 return 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1091 | 1091 |
| 1092 int DOMWindow::screenX() const | 1092 int DOMWindow::screenX() const |
| 1093 { | 1093 { |
| 1094 if (!m_frame) | 1094 if (!m_frame) |
| 1095 return 0; | 1095 return 0; |
| 1096 | 1096 |
| 1097 Page* page = m_frame->page(); | 1097 Page* page = m_frame->page(); |
| 1098 if (!page) | 1098 if (!page) |
| 1099 return 0; | 1099 return 0; |
| 1100 | 1100 |
| 1101 return static_cast<int>(page->chrome()->windowRect().x()); | 1101 return static_cast<int>(page->chrome().windowRect().x()); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 int DOMWindow::screenY() const | 1104 int DOMWindow::screenY() const |
| 1105 { | 1105 { |
| 1106 if (!m_frame) | 1106 if (!m_frame) |
| 1107 return 0; | 1107 return 0; |
| 1108 | 1108 |
| 1109 Page* page = m_frame->page(); | 1109 Page* page = m_frame->page(); |
| 1110 if (!page) | 1110 if (!page) |
| 1111 return 0; | 1111 return 0; |
| 1112 | 1112 |
| 1113 return static_cast<int>(page->chrome()->windowRect().y()); | 1113 return static_cast<int>(page->chrome().windowRect().y()); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 int DOMWindow::scrollX() const | 1116 int DOMWindow::scrollX() const |
| 1117 { | 1117 { |
| 1118 if (!m_frame) | 1118 if (!m_frame) |
| 1119 return 0; | 1119 return 0; |
| 1120 | 1120 |
| 1121 FrameView* view = m_frame->view(); | 1121 FrameView* view = m_frame->view(); |
| 1122 if (!view) | 1122 if (!view) |
| 1123 return 0; | 1123 return 0; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 m_status = string; | 1176 m_status = string; |
| 1177 | 1177 |
| 1178 if (!m_frame) | 1178 if (!m_frame) |
| 1179 return; | 1179 return; |
| 1180 | 1180 |
| 1181 Page* page = m_frame->page(); | 1181 Page* page = m_frame->page(); |
| 1182 if (!page) | 1182 if (!page) |
| 1183 return; | 1183 return; |
| 1184 | 1184 |
| 1185 ASSERT(m_frame->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. | 1185 ASSERT(m_frame->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. |
| 1186 page->chrome()->setStatusbarText(m_frame, m_status); | 1186 page->chrome().setStatusbarText(m_frame, m_status); |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 void DOMWindow::setDefaultStatus(const String& string) | 1189 void DOMWindow::setDefaultStatus(const String& string) |
| 1190 { | 1190 { |
| 1191 m_defaultStatus = string; | 1191 m_defaultStatus = string; |
| 1192 | 1192 |
| 1193 if (!m_frame) | 1193 if (!m_frame) |
| 1194 return; | 1194 return; |
| 1195 | 1195 |
| 1196 Page* page = m_frame->page(); | 1196 Page* page = m_frame->page(); |
| 1197 if (!page) | 1197 if (!page) |
| 1198 return; | 1198 return; |
| 1199 | 1199 |
| 1200 ASSERT(m_frame->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. | 1200 ASSERT(m_frame->document()); // Client calls shouldn't be made when the fram
e is in inconsistent state. |
| 1201 page->chrome()->setStatusbarText(m_frame, m_defaultStatus); | 1201 page->chrome().setStatusbarText(m_frame, m_defaultStatus); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 DOMWindow* DOMWindow::self() const | 1204 DOMWindow* DOMWindow::self() const |
| 1205 { | 1205 { |
| 1206 if (!m_frame) | 1206 if (!m_frame) |
| 1207 return 0; | 1207 return 0; |
| 1208 | 1208 |
| 1209 return m_frame->document()->domWindow(); | 1209 return m_frame->document()->domWindow(); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 if (!m_frame) | 1364 if (!m_frame) |
| 1365 return; | 1365 return; |
| 1366 | 1366 |
| 1367 Page* page = m_frame->page(); | 1367 Page* page = m_frame->page(); |
| 1368 if (!page) | 1368 if (!page) |
| 1369 return; | 1369 return; |
| 1370 | 1370 |
| 1371 if (m_frame != page->mainFrame()) | 1371 if (m_frame != page->mainFrame()) |
| 1372 return; | 1372 return; |
| 1373 | 1373 |
| 1374 FloatRect fr = page->chrome()->windowRect(); | 1374 FloatRect fr = page->chrome().windowRect(); |
| 1375 FloatRect update = fr; | 1375 FloatRect update = fr; |
| 1376 update.move(x, y); | 1376 update.move(x, y); |
| 1377 // Security check (the spec talks about UniversalBrowserWrite to disable thi
s check...) | 1377 // Security check (the spec talks about UniversalBrowserWrite to disable thi
s check...) |
| 1378 page->chrome()->setWindowRect(adjustWindowRect(page, update)); | 1378 page->chrome().setWindowRect(adjustWindowRect(page, update)); |
| 1379 } | 1379 } |
| 1380 | 1380 |
| 1381 void DOMWindow::moveTo(float x, float y) const | 1381 void DOMWindow::moveTo(float x, float y) const |
| 1382 { | 1382 { |
| 1383 if (!m_frame) | 1383 if (!m_frame) |
| 1384 return; | 1384 return; |
| 1385 | 1385 |
| 1386 Page* page = m_frame->page(); | 1386 Page* page = m_frame->page(); |
| 1387 if (!page) | 1387 if (!page) |
| 1388 return; | 1388 return; |
| 1389 | 1389 |
| 1390 if (m_frame != page->mainFrame()) | 1390 if (m_frame != page->mainFrame()) |
| 1391 return; | 1391 return; |
| 1392 | 1392 |
| 1393 FloatRect fr = page->chrome()->windowRect(); | 1393 FloatRect fr = page->chrome().windowRect(); |
| 1394 FloatRect sr = screenAvailableRect(page->mainFrame()->view()); | 1394 FloatRect sr = screenAvailableRect(page->mainFrame()->view()); |
| 1395 fr.setLocation(sr.location()); | 1395 fr.setLocation(sr.location()); |
| 1396 FloatRect update = fr; | 1396 FloatRect update = fr; |
| 1397 update.move(x, y); | 1397 update.move(x, y); |
| 1398 // Security check (the spec talks about UniversalBrowserWrite to disable thi
s check...) | 1398 // Security check (the spec talks about UniversalBrowserWrite to disable thi
s check...) |
| 1399 page->chrome()->setWindowRect(adjustWindowRect(page, update)); | 1399 page->chrome().setWindowRect(adjustWindowRect(page, update)); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 void DOMWindow::resizeBy(float x, float y) const | 1402 void DOMWindow::resizeBy(float x, float y) const |
| 1403 { | 1403 { |
| 1404 if (!m_frame) | 1404 if (!m_frame) |
| 1405 return; | 1405 return; |
| 1406 | 1406 |
| 1407 Page* page = m_frame->page(); | 1407 Page* page = m_frame->page(); |
| 1408 if (!page) | 1408 if (!page) |
| 1409 return; | 1409 return; |
| 1410 | 1410 |
| 1411 if (m_frame != page->mainFrame()) | 1411 if (m_frame != page->mainFrame()) |
| 1412 return; | 1412 return; |
| 1413 | 1413 |
| 1414 FloatRect fr = page->chrome()->windowRect(); | 1414 FloatRect fr = page->chrome().windowRect(); |
| 1415 FloatSize dest = fr.size() + FloatSize(x, y); | 1415 FloatSize dest = fr.size() + FloatSize(x, y); |
| 1416 FloatRect update(fr.location(), dest); | 1416 FloatRect update(fr.location(), dest); |
| 1417 page->chrome()->setWindowRect(adjustWindowRect(page, update)); | 1417 page->chrome().setWindowRect(adjustWindowRect(page, update)); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void DOMWindow::resizeTo(float width, float height) const | 1420 void DOMWindow::resizeTo(float width, float height) const |
| 1421 { | 1421 { |
| 1422 if (!m_frame) | 1422 if (!m_frame) |
| 1423 return; | 1423 return; |
| 1424 | 1424 |
| 1425 Page* page = m_frame->page(); | 1425 Page* page = m_frame->page(); |
| 1426 if (!page) | 1426 if (!page) |
| 1427 return; | 1427 return; |
| 1428 | 1428 |
| 1429 if (m_frame != page->mainFrame()) | 1429 if (m_frame != page->mainFrame()) |
| 1430 return; | 1430 return; |
| 1431 | 1431 |
| 1432 FloatRect fr = page->chrome()->windowRect(); | 1432 FloatRect fr = page->chrome().windowRect(); |
| 1433 FloatSize dest = FloatSize(width, height); | 1433 FloatSize dest = FloatSize(width, height); |
| 1434 FloatRect update(fr.location(), dest); | 1434 FloatRect update(fr.location(), dest); |
| 1435 page->chrome()->setWindowRect(adjustWindowRect(page, update)); | 1435 page->chrome().setWindowRect(adjustWindowRect(page, update)); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 int DOMWindow::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout, Excep
tionCode& ec) | 1438 int DOMWindow::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout, Excep
tionCode& ec) |
| 1439 { | 1439 { |
| 1440 ScriptExecutionContext* context = scriptExecutionContext(); | 1440 ScriptExecutionContext* context = scriptExecutionContext(); |
| 1441 if (!context) { | 1441 if (!context) { |
| 1442 ec = INVALID_ACCESS_ERR; | 1442 ec = INVALID_ACCESS_ERR; |
| 1443 return -1; | 1443 return -1; |
| 1444 } | 1444 } |
| 1445 return DOMTimer::install(context, action, timeout, true); | 1445 return DOMTimer::install(context, action, timeout, true); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 | 1859 |
| 1860 if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp()) | 1860 if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp()) |
| 1861 return; | 1861 return; |
| 1862 | 1862 |
| 1863 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr
ame->view())); | 1863 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr
ame->view())); |
| 1864 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, | 1864 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, |
| 1865 activeWindow, firstFrame, m_frame, function, functionContext); | 1865 activeWindow, firstFrame, m_frame, function, functionContext); |
| 1866 if (!dialogFrame) | 1866 if (!dialogFrame) |
| 1867 return; | 1867 return; |
| 1868 UserGestureIndicatorDisabler disabler; | 1868 UserGestureIndicatorDisabler disabler; |
| 1869 dialogFrame->page()->chrome()->runModal(); | 1869 dialogFrame->page()->chrome().runModal(); |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) | 1872 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) |
| 1873 { | 1873 { |
| 1874 Frame* frame = this->frame(); | 1874 Frame* frame = this->frame(); |
| 1875 if (!frame) | 1875 if (!frame) |
| 1876 return 0; | 1876 return 0; |
| 1877 | 1877 |
| 1878 Frame* child = frame->tree()->scopedChild(index); | 1878 Frame* child = frame->tree()->scopedChild(index); |
| 1879 if (child) | 1879 if (child) |
| 1880 return child->document()->domWindow(); | 1880 return child->document()->domWindow(); |
| 1881 | 1881 |
| 1882 return 0; | 1882 return 0; |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 | 1885 |
| 1886 } // namespace WebCore | 1886 } // namespace WebCore |
| OLD | NEW |