Commit b0c299a9 authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Geoff.

        Update tests for http://bugs.webkit.org/show_bug.cgi?id=14319
        Move the Selection object out of the JS bindings

        * fast/dom/Window/window-properties-expected.txt:
        * fast/js/toString-and-valueOf-override-expected.txt:
        * http/tests/security/cross-frame-access-expected.txt:

WebCore:

        Reviewed by Geoff.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=14319
        Move the Selection object out of the JS bindings

        - Renames JS Object Selection to DOMSelection to avoid a name
          conflict.

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_window.cpp:
        (KJS::WindowPrivate::WindowPrivate):
        (KJS::Window::mark):
        (KJS::Window::clearHelperObjectProperties):
        (KJS::WindowFunc::callAsFunction):
        (KJS::Window::disconnectFrame):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * page/DOMSelection.cpp: ...
parent 8db24bf4
2007-06-27 Sam Weinig <sam@webkit.org>
Reviewed by Geoff.
Update tests for http://bugs.webkit.org/show_bug.cgi?id=14319
Move the Selection object out of the JS bindings
* fast/dom/Window/window-properties-expected.txt:
* fast/js/toString-and-valueOf-override-expected.txt:
* http/tests/security/cross-frame-access-expected.txt:
2007-06-27 Sam Weinig <sam@webkit.org>
 
Reviewed by Adam Roben.
......@@ -1036,7 +1036,7 @@ window.tryEval [function]
window.typeOfNullAware [function]
window.typeStringNullAware [function]
window.window [printed above as window]
window.getSelection() [object Selection]
window.getSelection() [object DOMSelection]
window.getSelection().addRange [function]
window.getSelection().anchorNode [null]
window.getSelection().anchorOffset [number]
......
......@@ -329,7 +329,7 @@ String(Selection) :
String([Selection]) :
Selection.toString() :
[Selection].toString() :
TypeError: Value undefined (result of expression object.valueOf) is not object.
Selection.valueOf() :
[Selection].valueOf() :
Selection with modified toString and valueOf
......
......@@ -1220,6 +1220,10 @@ CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http
CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access.html. Domains must match.
CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access.html. Domains must match.
CONSOLE MESSAGE: line 1: Unsafe JavaScript attempt to access frame with URL http://localhost:8000/security/resources/cross-frame-iframe.html from frame with URL http://127.0.0.1:8000/security/cross-frame-access.html. Domains must match.
This test checks cross-frame access security (rdar://problem/5251309).
......
2007-06-27 Sam Weinig <sam@webkit.org>
Reviewed by Geoff.
Patch for http://bugs.webkit.org/show_bug.cgi?id=14319
Move the Selection object out of the JS bindings
- Renames JS Object Selection to DOMSelection to avoid a name
conflict.
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/kjs_window.cpp:
(KJS::WindowPrivate::WindowPrivate):
(KJS::Window::mark):
(KJS::Window::clearHelperObjectProperties):
(KJS::WindowFunc::callAsFunction):
(KJS::Window::disconnectFrame):
* bindings/js/kjs_window.h:
(KJS::Window::):
* page/DOMSelection.cpp: Added.
(WebCore::DOMSelection::DOMSelection):
(WebCore::DOMSelection::frame):
(WebCore::DOMSelection::disconnectFrame):
(WebCore::DOMSelection::anchorNode):
(WebCore::DOMSelection::baseNode):
(WebCore::DOMSelection::anchorOffset):
(WebCore::DOMSelection::baseOffset):
(WebCore::DOMSelection::focusNode):
(WebCore::DOMSelection::extentNode):
(WebCore::DOMSelection::focusOffset):
(WebCore::DOMSelection::extentOffset):
(WebCore::DOMSelection::isCollapsed):
(WebCore::DOMSelection::type):
(WebCore::DOMSelection::rangeCount):
(WebCore::DOMSelection::collapse):
(WebCore::DOMSelection::collapseToEnd):
(WebCore::DOMSelection::collapseToStart):
(WebCore::DOMSelection::empty):
(WebCore::DOMSelection::setBaseAndExtent):
(WebCore::DOMSelection::setPosition):
(WebCore::DOMSelection::modify):
(WebCore::DOMSelection::getRangeAt):
(WebCore::DOMSelection::removeAllRanges):
(WebCore::DOMSelection::addRange):
(WebCore::DOMSelection::toString):
* page/DOMSelection.h: Added.
* page/DOMSelection.idl: Added.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::disconnectFrame):
(WebCore::DOMWindow::getSelection):
* page/DOMWindow.h:
* page/DOMWindow.idl:
2007-06-27 Sam Weinig <sam@webkit.org>
 
Reviewed by Maciej.
......@@ -323,6 +323,7 @@ all : \
JSDOMExceptionConstructor.lut.h \
JSDOMImplementation.h \
JSDOMParser.h \
JSDOMSelection.h \
JSDOMWindow.h \
JSDocument.h \
JSDocumentFragment.h \
......
......@@ -1456,7 +1456,6 @@
93309EA4099EB78C0056E581 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309EA1099EB78C0056E581 /* Timer.cpp */; };
93354A3C0B24F8C9003F6DEA /* UIEventWithKeyState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */; };
933A142E0B7D188600A53FFD /* TextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933A142B0B7D188600A53FFD /* TextEvent.cpp */; };
933A142F0B7D188600A53FFD /* TextEvent.idl in Resources */ = {isa = PBXBuildFile; fileRef = 933A142C0B7D188600A53FFD /* TextEvent.idl */; };
933A14300B7D188600A53FFD /* TextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A142D0B7D188600A53FFD /* TextEvent.h */; };
933A14760B7D1BAF00A53FFD /* DOMTextEvent.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 933A14750B7D1BAF00A53FFD /* DOMTextEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
933A14AA0B7D1D0900A53FFD /* DOMTextEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 933A14A90B7D1D0900A53FFD /* DOMTextEvent.mm */; };
......@@ -2393,8 +2392,6 @@
B2D87C8A0B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C860B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp */; };
B2DDF0650B4829FA0064A4B1 /* PatternAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = B2DDF0640B4829FA0064A4B1 /* PatternAttributes.h */; };
B2DDF0670B482A030064A4B1 /* GradientAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = B2DDF0660B482A030064A4B1 /* GradientAttributes.h */; };
B2DE281D0B5BFA5400CC289A /* SVGElementInstance.idl in Resources */ = {isa = PBXBuildFile; fileRef = B2DE281B0B5BFA5400CC289A /* SVGElementInstance.idl */; };
B2DE281E0B5BFA5400CC289A /* SVGElementInstanceList.idl in Resources */ = {isa = PBXBuildFile; fileRef = B2DE281C0B5BFA5400CC289A /* SVGElementInstanceList.idl */; };
B2E27BD50B0F2A9500F17C7B /* SVGResourceFilterCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2E27BD30B0F2A9500F17C7B /* SVGResourceFilterCg.mm */; };
B2E27BDA0B0F2AC800F17C7B /* SVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2E27BD70B0F2AC800F17C7B /* SVGResourceFilter.cpp */; };
B2E27BDB0B0F2AC800F17C7B /* SVGResourceFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E27BD80B0F2AC800F17C7B /* SVGResourceFilter.h */; };
......@@ -2737,7 +2734,6 @@
BC06EE050BFD71AA00856E9D /* JSHTMLTableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06EE030BFD71AA00856E9D /* JSHTMLTableElement.h */; };
BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC124EE40C2641CD009E2349 /* BarInfo.cpp */; };
BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC124EE50C2641CD009E2349 /* BarInfo.h */; };
BC124EE90C2641CD009E2349 /* BarInfo.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC124EE60C2641CD009E2349 /* BarInfo.idl */; };
BC124EFF0C26447A009E2349 /* JSBarInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */; };
BC124F000C26447A009E2349 /* JSBarInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC124EFE0C26447A009E2349 /* JSBarInfo.h */; };
BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */; };
......@@ -2785,7 +2781,6 @@
BC4918C70BFEA050009D6316 /* JSHTMLFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4918C10BFEA050009D6316 /* JSHTMLFrameElement.h */; };
BC4918C80BFEA050009D6316 /* JSHTMLIFrameElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4918C20BFEA050009D6316 /* JSHTMLIFrameElement.cpp */; };
BC4918C90BFEA050009D6316 /* JSHTMLIFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4918C30BFEA050009D6316 /* JSHTMLIFrameElement.h */; };
BC491B4F0C023E2D009D6316 /* HTMLMarqueeElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC491B4E0C023E2D009D6316 /* HTMLMarqueeElement.idl */; };
BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */; };
BC491B790C023EFD009D6316 /* JSHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */; };
BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */; };
......@@ -2800,6 +2795,10 @@
BC5825F30C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */; };
BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */; };
BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */; };
BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5A86810C33676000EEA649 /* DOMSelection.cpp */; };
BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5A86820C33676000EEA649 /* DOMSelection.h */; };
BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */; };
BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */; };
BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */; };
BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */; };
BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */; };
......@@ -2823,7 +2822,6 @@
BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D14D0C275C68006BC617 /* JSHistory.h */; };
BC94D1530C275C8B006BC617 /* History.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1500C275C8B006BC617 /* History.cpp */; };
BC94D1540C275C8B006BC617 /* History.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1510C275C8B006BC617 /* History.h */; };
BC94D1550C275C8B006BC617 /* History.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC94D1520C275C8B006BC617 /* History.idl */; };
BC94D1570C275CAB006BC617 /* GlobalHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1560C275CAB006BC617 /* GlobalHistory.h */; };
BC94D1590C275CB6006BC617 /* GlobalHistoryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1580C275CB6006BC617 /* GlobalHistoryMac.mm */; };
BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */; };
......@@ -2951,7 +2949,6 @@
BCEB377609B7BB0D00CB38B1 /* FontFallbackList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEB377509B7BB0D00CB38B1 /* FontFallbackList.h */; };
BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */; };
BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEC01BB0C274DAC009F4EC9 /* Screen.h */; };
BCEC01BF0C274DAC009F4EC9 /* Screen.idl in Resources */ = {isa = PBXBuildFile; fileRef = BCEC01BC0C274DAC009F4EC9 /* Screen.idl */; };
BCEC01C20C274DDD009F4EC9 /* JSScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */; };
BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEC01C10C274DDD009F4EC9 /* JSScreen.h */; };
BCEC01D70C274EB4009F4EC9 /* PlatformScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEC01D60C274EB4009F4EC9 /* PlatformScreen.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -6114,6 +6111,11 @@
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclarationCustom.cpp; sourceTree = "<group>"; };
BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParserErrorCodes.h; sourceTree = "<group>"; };
BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserErrorCodes.cpp; sourceTree = "<group>"; };
BC5A86810C33676000EEA649 /* DOMSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMSelection.cpp; sourceTree = "<group>"; };
BC5A86820C33676000EEA649 /* DOMSelection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSelection.h; sourceTree = "<group>"; };
BC5A86830C33676000EEA649 /* DOMSelection.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = DOMSelection.idl; sourceTree = "<group>"; };
BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMSelection.cpp; sourceTree = "<group>"; };
BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMSelection.h; sourceTree = "<group>"; };
BC5EC1760A507E3E006007F5 /* view-source.css */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "view-source.css"; sourceTree = "<group>"; };
BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElementCustom.cpp; sourceTree = "<group>"; };
BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElement.cpp; sourceTree = "<group>"; };
......@@ -6567,6 +6569,8 @@
65DF31E409D1CC60000BE325 /* JSDOMImplementation.h */,
1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */,
1ACE53DE0A8D18810022947D /* JSDOMParser.h */,
BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */,
BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */,
1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */,
1403BA0E09EB18F800797C7F /* JSDOMWindow.h */,
65DF31E509D1CC60000BE325 /* JSElement.cpp */,
......@@ -7258,6 +7262,9 @@
065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */,
065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */,
065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */,
BC5A86810C33676000EEA649 /* DOMSelection.cpp */,
BC5A86820C33676000EEA649 /* DOMSelection.h */,
BC5A86830C33676000EEA649 /* DOMSelection.idl */,
1403B99609EB13AF00797C7F /* DOMWindow.cpp */,
1403B99509EB13AF00797C7F /* DOMWindow.h */,
1403B90C09EB124500797C7F /* DOMWindow.idl */,
......@@ -7278,12 +7285,12 @@
65A21483097A3F5300B9050A /* FrameTree.h */,
65CBFEF70974F607001DAC25 /* FrameView.cpp */,
65CBFEF80974F607001DAC25 /* FrameView.h */,
06693DB70BFBA2F400216072 /* InspectorClient.h */,
06693DB80BFBA2F400216072 /* InspectorController.cpp */,
06693DB90BFBA2F400216072 /* InspectorController.h */,
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
BC94D1520C275C8B006BC617 /* History.idl */,
06693DB70BFBA2F400216072 /* InspectorClient.h */,
06693DB80BFBA2F400216072 /* InspectorController.cpp */,
06693DB90BFBA2F400216072 /* InspectorController.h */,
93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */,
935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
65FEA86809833ADE00BED4AB /* Page.cpp */,
......@@ -11631,6 +11638,8 @@
BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */,
BC94D1540C275C8B006BC617 /* History.h in Headers */,
BC94D1570C275CAB006BC617 /* GlobalHistory.h in Headers */,
BC5A86850C33676000EEA649 /* DOMSelection.h in Headers */,
BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -11735,18 +11744,11 @@
B2E27C740B0F2AE600F17C7B /* WKTableTransferFilter.cikernel in Resources */,
4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */,
46BD16E30B279473001F0839 /* noneCursor.png in Resources */,
B2DE281D0B5BFA5400CC289A /* SVGElementInstance.idl in Resources */,
B2DE281E0B5BFA5400CC289A /* SVGElementInstanceList.idl in Resources */,
933A142F0B7D188600A53FFD /* TextEvent.idl in Resources */,
464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */,
464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */,
06693F7B0BFBC91700216072 /* inspector in Resources */,
BC491B4F0C023E2D009D6316 /* HTMLMarqueeElement.idl in Resources */,
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
BC124EE90C2641CD009E2349 /* BarInfo.idl in Resources */,
BCEC01BF0C274DAC009F4EC9 /* Screen.idl in Resources */,
BC94D1550C275C8B006BC617 /* History.idl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -13066,6 +13068,8 @@
BC94D1530C275C8B006BC617 /* History.cpp in Sources */,
BC94D1590C275CB6006BC617 /* GlobalHistoryMac.mm in Sources */,
BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,
BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */,
BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -55,7 +55,6 @@
#include "PlatformScreen.h"
#include "PlugInInfoStore.h"
#include "RenderView.h"
#include "SelectionController.h"
#include "Settings.h"
#include "WindowFeatures.h"
#include "htmlediting.h"
......@@ -83,7 +82,6 @@ const double cMinimumTimerInterval = 0.010;
struct WindowPrivate {
WindowPrivate()
: loc(0)
, m_selection(0)
, m_evt(0)
, m_returnValueSlot(0)
{
......@@ -94,7 +92,6 @@ struct WindowPrivate {
Window::UnprotectedListenersMap jsUnprotectedEventListeners;
Window::UnprotectedListenersMap jsUnprotectedHTMLEventListeners;
mutable Location* loc;
mutable Selection* m_selection;
WebCore::Event *m_evt;
JSValue **m_returnValueSlot;
typedef HashMap<int, DOMWindowTimer*> TimeoutsMap;
......@@ -201,7 +198,6 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
setTimeout Window::SetTimeout DontDelete|Function 2
clearTimeout Window::ClearTimeout DontDelete|Function 1
focus Window::Focus DontDelete|Function 0
getSelection Window::GetSelection DontDelete|Function 0
blur Window::Blur DontDelete|Function 0
close Window::Close DontDelete|Function 0
setInterval Window::SetInterval DontDelete|Function 2
......@@ -316,13 +312,6 @@ Location *Window::location() const
return d->loc;
}
Selection *Window::selection() const
{
if (!d->m_selection)
d->m_selection = new Selection(m_frame);
return d->m_selection;
}
bool Window::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const
{
// FIXME (13016): Support wholeWord, searchInFrames and showDialog
......@@ -335,8 +324,6 @@ void Window::mark()
JSObject::mark();
if (d->loc && !d->loc->marked())
d->loc->mark();
if (d->m_selection && !d->m_selection->marked())
d->m_selection->mark();
}
static bool allowPopUp(ExecState *exec, Window *window)
......@@ -1240,7 +1227,6 @@ JSUnprotectedEventListener *Window::findOrCreateJSUnprotectedEventListener(JSVal
void Window::clearHelperObjectProperties()
{
d->loc = 0;
d->m_selection = 0;
d->m_evt = 0;
}
......@@ -1637,10 +1623,6 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
case Window::Focus:
frame->focusWindow();
return jsUndefined();
case Window::GetSelection:
if (!window->isSafeScript(exec))
return jsUndefined();
return window->selection();
case Window::Blur:
frame->unfocusWindow();
return jsUndefined();
......@@ -1873,8 +1855,6 @@ void Window::disconnectFrame()
m_frame = 0;
if (d->loc)
d->loc->m_frame = 0;
if (d->m_selection)
d->m_selection->m_frame = 0;
}
Window::ListenersMap& Window::jsEventListeners()
......@@ -2103,135 +2083,6 @@ JSValue *LocationFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
return jsUndefined();
}
////////////////////// Selection Object ////////////////////////
const ClassInfo Selection::info = { "Selection", 0, &SelectionTable, 0 };
/*
@begin SelectionTable 19
anchorNode Selection::AnchorNode DontDelete|ReadOnly
anchorOffset Selection::AnchorOffset DontDelete|ReadOnly
focusNode Selection::FocusNode DontDelete|ReadOnly
focusOffset Selection::FocusOffset DontDelete|ReadOnly
baseNode Selection::BaseNode DontDelete|ReadOnly
baseOffset Selection::BaseOffset DontDelete|ReadOnly
extentNode Selection::ExtentNode DontDelete|ReadOnly
extentOffset Selection::ExtentOffset DontDelete|ReadOnly
isCollapsed Selection::IsCollapsed DontDelete|ReadOnly
type Selection::_Type DontDelete|ReadOnly
rangeCount Selection::RangeCount DontDelete|ReadOnly
toString Selection::ToString DontEnum|DontDelete|Function 0
collapse Selection::Collapse DontDelete|Function 2
collapseToEnd Selection::CollapseToEnd DontDelete|Function 0
collapseToStart Selection::CollapseToStart DontDelete|Function 0
empty Selection::Empty DontDelete|Function 0
setBaseAndExtent Selection::SetBaseAndExtent DontDelete|Function 4
setPosition Selection::SetPosition DontDelete|Function 2
modify Selection::Modify DontDelete|Function 3
getRangeAt Selection::GetRangeAt DontDelete|Function 1
removeAllRanges Selection::RemoveAllRanges DontDelete|Function 0
addRange Selection::AddRange DontDelete|Function 1
@end
*/
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(SelectionFunc)
Selection::Selection(Frame *p) : m_frame(p)
{
}
JSValue *Selection::getValueProperty(ExecState *exec, int token) const
{
SelectionController* s = m_frame->selectionController();
const Window* window = Window::retrieveWindow(m_frame);
if (!window)
return jsUndefined();
switch (token) {
case AnchorNode:
return toJS(exec, s->anchorNode());
case BaseNode:
return toJS(exec, s->baseNode());
case AnchorOffset:
return jsNumber(s->anchorOffset());
case BaseOffset:
return jsNumber(s->baseOffset());
case FocusNode:
return toJS(exec, s->focusNode());
case ExtentNode:
return toJS(exec, s->extentNode());
case FocusOffset:
return jsNumber(s->focusOffset());
case ExtentOffset:
return jsNumber(s->extentOffset());
case IsCollapsed:
return jsBoolean(s->isCollapsed());
case _Type:
return jsString(s->type());
case RangeCount:
return jsNumber(s->rangeCount());
default:
ASSERT(0);
return jsUndefined();
}
}
bool Selection::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
if (!m_frame)
return false;
return getStaticPropertySlot<SelectionFunc, Selection, JSObject>(exec, &SelectionTable, this, propertyName, slot);
}
JSValue *SelectionFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
{
if (!thisObj->inherits(&Selection::info))
return throwError(exec, TypeError);
Selection *selection = static_cast<Selection *>(thisObj);
Frame *frame = selection->frame();
if (frame) {
SelectionController* s = frame->selectionController();
ExceptionCode ec = 0;
switch (id) {
case Selection::Collapse:
s->collapse(toNode(args[0]), args[1]->toInt32(exec), ec);
break;
case Selection::CollapseToEnd:
s->collapseToEnd();
break;
case Selection::CollapseToStart:
s->collapseToStart();
break;
case Selection::Empty:
s->empty();
break;
case Selection::SetBaseAndExtent:
s->setBaseAndExtent(toNode(args[0]), args[1]->toInt32(exec), toNode(args[2]), args[3]->toInt32(exec), ec);
break;
case Selection::SetPosition:
s->setPosition(toNode(args[0]), args[1]->toInt32(exec), ec);
break;
case Selection::Modify:
s->modify(args[0]->toString(exec), args[1]->toString(exec), args[2]->toString(exec));
break;
case Selection::GetRangeAt: {
JSValue* val = toJS(exec, s->getRangeAt(args[0]->toInt32(exec), ec).get());
setDOMException(exec, ec);
return val;
}
case Selection::RemoveAllRanges:
s->removeAllRanges();
break;
case Selection::AddRange:
s->addRange(toRange(args[0]));
break;
case Selection::ToString:
return jsString(frame->selectionController()->toString());
}
setDOMException(exec, ec);
}
return jsUndefined();
}
/////////////////////////////////////////////////////////////////////////////
PausedTimeouts::~PausedTimeouts()
......
......@@ -41,7 +41,6 @@ namespace KJS {
class Location;
class PausedTimeout;
class ScheduledAction;
class Selection;
class Window;
class WindowFunc;
......@@ -114,7 +113,6 @@ namespace KJS {
bool isSafeScript(ExecState*) const;
static bool isSafeScript(const ScriptInterpreter *origin, const ScriptInterpreter *target);
Location *location() const;
Selection *selection() const;
bool find(const WebCore::String&, bool, bool, bool, bool, bool, bool) const;
// Finds a wrapper of a JS EventListener, returns 0 if no existing one.
......@@ -154,7 +152,7 @@ namespace KJS {
ScreenTop, ScreenLeft,
ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, Window_, Top,
Image, Option, Alert, Confirm, Prompt, Open, Print, SetTimeout, ClearTimeout,
Focus, GetSelection, Blur, Close, SetInterval, ClearInterval, CaptureEvents,
Focus, Blur, Close, SetInterval, ClearInterval, CaptureEvents,
ReleaseEvents, AddEventListener, RemoveEventListener,
XMLHttpRequest, XSLTProcessor_,
Onabort, Onblur, Onchange, Onclick, Ondblclick, Onerror,
......@@ -217,22 +215,6 @@ namespace KJS {
WebCore::Frame* m_frame;
};
class Selection : public DOMObject {
public:
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
JSValue *getValueProperty(ExecState *exec, int token) const;
enum { AnchorNode, AnchorOffset, FocusNode, FocusOffset, BaseNode, BaseOffset, ExtentNode, ExtentOffset,
IsCollapsed, _Type, RangeCount, Collapse, CollapseToEnd, CollapseToStart, Empty, ToString,
SetBaseAndExtent, SetPosition, Modify, GetRangeAt, RemoveAllRanges, AddRange };
WebCore::Frame* frame() const { return m_frame; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
private:
friend class Window;
Selection(WebCore::Frame*);
WebCore::Frame* m_frame;
};
} // namespace
namespace WebCore {
......
/*
* Copyright (C) 2007 Apple 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
*/
#include "config.h"
#include "DOMSelection.h"
#include "Frame.h"
#include "SelectionController.h"
#include "Range.h"
#include "String.h"
#include "Node.h"
namespace WebCore {
DOMSelection::DOMSelection(Frame* frame)
: m_frame(frame)
{
}
Frame* DOMSelection::frame() const
{
return m_frame;
}
void DOMSelection::disconnectFrame()
{
m_frame = 0;
}
Node* DOMSelection::anchorNode() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->anchorNode();
}
Node* DOMSelection::baseNode() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->baseNode();
}
int DOMSelection::anchorOffset() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->anchorOffset();
}
int DOMSelection::baseOffset() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->baseOffset();
}
Node* DOMSelection::focusNode() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->focusNode();
}
Node* DOMSelection::extentNode() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->extentNode();
}
int DOMSelection::focusOffset() const
{
if (!m_frame)
return 0;
return m_frame->selectionController()->focusOffset();