14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E8378D09F85D4F00B85AE4 /* JSEvent.h */; };
14EC267F09CA07E000E1EEEC /* EventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
14EC268009CA07E000E1EEEC /* EventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */; };
+ 14FD6DFD0AE5EA1B00AD67AD /* WindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */; };
14FFE31D0AE1963300136BF5 /* HTMLFrameElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FFE31B0AE1963300136BF5 /* HTMLFrameElementBase.h */; };
14FFE31E0AE1963300136BF5 /* HTMLFrameElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */; };
1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */; };
14E8378D09F85D4F00B85AE4 /* JSEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEvent.h; sourceTree = "<group>"; };
14EC267D09CA07E000E1EEEC /* EventTargetNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTargetNode.h; sourceTree = "<group>"; };
14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTargetNode.cpp; sourceTree = "<group>"; };
+ 14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WindowFeatures.h; sourceTree = "<group>"; };
14FFE31B0AE1963300136BF5 /* HTMLFrameElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLFrameElementBase.h; sourceTree = "<group>"; };
14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameElementBase.cpp; sourceTree = "<group>"; };
1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OverflowEvent.cpp; sourceTree = "<group>"; };
55998A5C052B59CC0017A6C1 /* AXObjectCache.h */,
BCEA4943097F0F5C0094C9E4 /* BrowserExtension.h */,
935C475C09AC4CA000A6AAB4 /* History.h */,
+ 14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */,
);
path = bridge;
sourceTree = "<group>";
6563A9A70ADF4094000ED2CD /* LoaderNSURLRequestExtras.h in Headers */,
14FFE31D0AE1963300136BF5 /* HTMLFrameElementBase.h in Headers */,
658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */,
+ 14FD6DFD0AE5EA1B00AD67AD /* WindowFeatures.h in Headers */,
8542A7930AE5C93F00DF58DF /* JSSVGRect.h in Headers */,
8542A7950AE5C94100DF58DF /* JSSVGPoint.h in Headers */,
8542A7970AE5C94300DF58DF /* JSSVGNumber.h in Headers */,
#include "JSNodeFilter.h"
#include "JSRange.h"
#include "JSXMLHttpRequest.h"
-#include "Settings.h"
#include "Logging.h"
#include "Page.h"
#include "PlugInInfoStore.h"
#include "RenderView.h"
#include "Screen.h"
#include "SelectionController.h"
+#include "Settings.h"
+#include "WindowFeatures.h"
#include "htmlediting.h"
#include "kjs_css.h"
#include "kjs_events.h"
}
static Frame *createNewWindow(ExecState *exec, Window *openerWindow, const DeprecatedString &URL,
- const DeprecatedString &frameName, const WindowArgs &windowArgs, JSValue *dialogArgs)
+ const DeprecatedString &frameName, const WindowFeatures &windowFeatures, JSValue *dialogArgs)
{
Frame* openerPart = openerWindow->frame();
Frame* activePart = Window::retrieveActive(exec)->frame();
// We'd have to resolve all those issues to pass the URL instead of "".
Frame* newFrame = 0;
- openerPart->browserExtension()->createNewWindow(frameRequest, windowArgs, newFrame);
+ openerPart->browserExtension()->createNewWindow(frameRequest, windowFeatures, newFrame);
if (!newFrame)
return 0;
bool trusted = false;
- WindowArgs wargs;
+ WindowFeatures wargs;
// The following features from Microsoft's documentation are not implemented:
// - default font settings
m_evt = evt;
}
-static void setWindowFeature(const String& keyString, const String& valueString, WindowArgs& windowArgs)
+static void setWindowFeature(const String& keyString, const String& valueString, WindowFeatures& windowFeatures)
{
int value;
value = valueString.toInt();
if (keyString == "left" || keyString == "screenx") {
- windowArgs.xSet = true;
- windowArgs.x = value;
+ windowFeatures.xSet = true;
+ windowFeatures.x = value;
} else if (keyString == "top" || keyString == "screeny") {
- windowArgs.ySet = true;
- windowArgs.y = value;
+ windowFeatures.ySet = true;
+ windowFeatures.y = value;
} else if (keyString == "width" || keyString == "innerwidth") {
- windowArgs.widthSet = true;
- windowArgs.width = value;
+ windowFeatures.widthSet = true;
+ windowFeatures.width = value;
} else if (keyString == "height" || keyString == "innerheight") {
- windowArgs.heightSet = true;
- windowArgs.height = value;
+ windowFeatures.heightSet = true;
+ windowFeatures.height = value;
} else if (keyString == "menubar")
- windowArgs.menuBarVisible = value;
+ windowFeatures.menuBarVisible = value;
else if (keyString == "toolbar")
- windowArgs.toolBarVisible = value;
+ windowFeatures.toolBarVisible = value;
else if (keyString == "location")
- windowArgs.locationBarVisible = value;
+ windowFeatures.locationBarVisible = value;
else if (keyString == "status")
- windowArgs.statusBarVisible = value;
+ windowFeatures.statusBarVisible = value;
else if (keyString == "resizable")
- windowArgs.resizable = value;
+ windowFeatures.resizable = value;
else if (keyString == "fullscreen")
- windowArgs.fullscreen = value;
+ windowFeatures.fullscreen = value;
else if (keyString == "scrollbars")
- windowArgs.scrollbarsVisible = value;
+ windowFeatures.scrollbarsVisible = value;
}
// Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0';
}
-static void parseWindowFeatures(const String& features, WindowArgs& windowArgs)
+static void parseWindowFeatures(const String& features, WindowFeatures& windowFeatures)
{
/*
The IE rule is: all features except for channelmode and fullscreen default to YES, but
<http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>
*/
- windowArgs.dialog = false;
- windowArgs.fullscreen = false;
+ windowFeatures.dialog = false;
+ windowFeatures.fullscreen = false;
- windowArgs.xSet = false;
- windowArgs.ySet = false;
- windowArgs.widthSet = false;
- windowArgs.heightSet = false;
+ windowFeatures.xSet = false;
+ windowFeatures.ySet = false;
+ windowFeatures.widthSet = false;
+ windowFeatures.heightSet = false;
if (features.length() == 0) {
- windowArgs.menuBarVisible = true;
- windowArgs.statusBarVisible = true;
- windowArgs.toolBarVisible = true;
- windowArgs.locationBarVisible = true;
- windowArgs.scrollbarsVisible = true;
- windowArgs.resizable = true;
+ windowFeatures.menuBarVisible = true;
+ windowFeatures.statusBarVisible = true;
+ windowFeatures.toolBarVisible = true;
+ windowFeatures.locationBarVisible = true;
+ windowFeatures.scrollbarsVisible = true;
+ windowFeatures.resizable = true;
return;
}
- windowArgs.menuBarVisible = false;
- windowArgs.statusBarVisible = false;
- windowArgs.toolBarVisible = false;
- windowArgs.locationBarVisible = false;
- windowArgs.scrollbarsVisible = false;
- windowArgs.resizable = false;
+ windowFeatures.menuBarVisible = false;
+ windowFeatures.statusBarVisible = false;
+ windowFeatures.toolBarVisible = false;
+ windowFeatures.locationBarVisible = false;
+ windowFeatures.scrollbarsVisible = false;
+ windowFeatures.resizable = false;
// Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
int keyBegin, keyEnd;
String keyString(buffer.substring(keyBegin, keyEnd - keyBegin));
String valueString(buffer.substring(valueBegin, valueEnd - valueBegin));
- setWindowFeature(keyString, valueString, windowArgs);
+ setWindowFeature(keyString, valueString, windowFeatures);
}
}
-static void constrainToVisible(const FloatRect& screen, WindowArgs& windowArgs)
+static void constrainToVisible(const FloatRect& screen, WindowFeatures& windowFeatures)
{
- windowArgs.x += screen.x();
- if (windowArgs.x < screen.x() || windowArgs.x >= screen.right())
- windowArgs.x = screen.x(); // only safe choice until size is determined
+ windowFeatures.x += screen.x();
+ if (windowFeatures.x < screen.x() || windowFeatures.x >= screen.right())
+ windowFeatures.x = screen.x(); // only safe choice until size is determined
- windowArgs.y += screen.y();
- if (windowArgs.y < screen.y() || windowArgs.y >= screen.bottom())
- windowArgs.y = screen.y(); // only safe choice until size is determined
+ windowFeatures.y += screen.y();
+ if (windowFeatures.y < screen.y() || windowFeatures.y >= screen.bottom())
+ windowFeatures.y = screen.y(); // only safe choice until size is determined
- if (windowArgs.height > screen.height()) // should actually check workspace
- windowArgs.height = screen.height();
- if (windowArgs.height < 100)
- windowArgs.height = 100;
+ if (windowFeatures.height > screen.height()) // should actually check workspace
+ windowFeatures.height = screen.height();
+ if (windowFeatures.height < 100)
+ windowFeatures.height = 100;
- if (windowArgs.width > screen.width()) // should actually check workspace
- windowArgs.width = screen.width();
- if (windowArgs.width < 100)
- windowArgs.width = 100;
+ if (windowFeatures.width > screen.width()) // should actually check workspace
+ windowFeatures.width = screen.width();
+ if (windowFeatures.width < 100)
+ windowFeatures.width = 100;
}
JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
if (!allowPopUp(exec, window) && (frameName.isEmpty() || !frame->tree()->find(frameName)))
return jsUndefined();
- WindowArgs windowArgs;
+ WindowFeatures windowFeatures;
String features = args[2]->isUndefinedOrNull() ? UString() : args[2]->toString(exec);
- parseWindowFeatures(features, windowArgs);
- constrainToVisible(screenRect(page), windowArgs);
+ parseWindowFeatures(features, windowFeatures);
+ constrainToVisible(screenRect(page), windowFeatures);
// prepare arguments
KURL url;
// request window (new or existing if framename is set)
Frame* newFrame = 0;
frameRequest.m_request.setReferrer(activePart->referrer());
- frame->browserExtension()->createNewWindow(frameRequest, windowArgs, newFrame);
+ frame->browserExtension()->createNewWindow(frameRequest, windowFeatures, newFrame);
if (!newFrame)
return jsUndefined();
newFrame->setOpener(frame);
--- /dev/null
+/*
+ * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WindowFeatures_h
+#define WindowFeatures_h
+
+namespace WebCore {
+
+struct WindowFeatures {
+ float x;
+ bool xSet;
+ float y;
+ bool ySet;
+ float width;
+ bool widthSet;
+ float height;
+ bool heightSet;
+
+ bool menuBarVisible;
+ bool statusBarVisible;
+ bool toolBarVisible;
+ bool locationBarVisible;
+ bool scrollbarsVisible;
+ bool resizable;
+
+ bool fullscreen;
+ bool dialog;
+};
+
+} // namespace WebCore
+
+#endif // WindowFeatures_h
#import "FrameMac.h"
#import "FrameLoadRequest.h"
#import "FrameTree.h"
+#import "KURL.h"
#import "Page.h"
#import "Screen.h"
#import "WebCoreFrameBridge.h"
#import "WebCorePageBridge.h"
+#import "WindowFeatures.h"
namespace WebCore {
}
void BrowserExtensionMac::createNewWindow(const FrameLoadRequest& request,
- const WindowArgs& winArgs,
+ const WindowFeatures& windowFeatures,
Frame*& newFrame)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- ASSERT(!winArgs.dialog || request.m_frameName.isEmpty());
+ ASSERT(!windowFeatures.dialog || request.m_frameName.isEmpty());
newFrame = NULL;
}
WebCorePageBridge *pageBridge;
- if (winArgs.dialog)
+ if (windowFeatures.dialog)
pageBridge = [m_frame->bridge() createModalDialogWithURL:url.getNSURL()];
else
pageBridge = [m_frame->bridge() createWindowWithURL:url.getNSURL()];
newFrame = [frameBridge impl];
- [frameBridge setToolbarsVisible:winArgs.toolBarVisible || winArgs.locationBarVisible];
- [frameBridge setStatusbarVisible:winArgs.statusBarVisible];
- [frameBridge setScrollbarsVisible:winArgs.scrollbarsVisible];
- [frameBridge setWindowIsResizable:winArgs.resizable];
+ [frameBridge setToolbarsVisible:windowFeatures.toolBarVisible || windowFeatures.locationBarVisible];
+ [frameBridge setStatusbarVisible:windowFeatures.statusBarVisible];
+ [frameBridge setScrollbarsVisible:windowFeatures.scrollbarsVisible];
+ [frameBridge setWindowIsResizable:windowFeatures.resizable];
NSRect windowRect = [pageBridge impl]->windowRect();
- if (winArgs.xSet)
- windowRect.origin.x = winArgs.x;
- if (winArgs.ySet)
- windowRect.origin.y = winArgs.y;
+ if (windowFeatures.xSet)
+ windowRect.origin.x = windowFeatures.x;
+ if (windowFeatures.ySet)
+ windowRect.origin.y = windowFeatures.y;
// 'width' and 'height' specify the dimensions of the WebView, but we can only resize the window,
// so we compute a WebView delta and apply it to the window.
NSRect webViewRect = [[pageBridge outerView] frame];
- if (winArgs.widthSet)
- windowRect.size.width += winArgs.width - webViewRect.size.width;
- if (winArgs.heightSet)
- windowRect.size.height += winArgs.height - webViewRect.size.height;
+ if (windowFeatures.widthSet)
+ windowRect.size.width += windowFeatures.width - webViewRect.size.width;
+ if (windowFeatures.heightSet)
+ windowRect.size.height += windowFeatures.height - webViewRect.size.height;
[pageBridge impl]->setWindowRect(windowRect);