Commit 4484b814 authored by weinig's avatar weinig

Reviewed by Geoff.

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

        - Autogenerate JSHistory.

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_window.cpp:
        (KJS::WindowPrivate::WindowPrivate):
        (KJS::Window::mark):
        (KJS::Window::getValueProperty):
        (KJS::Window::clearHelperObjectProperties):
        (KJS::Window::disconnectFrame):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * bridge/GlobalHistory.h: Copied from WebCore/bridge/History.h.
        * bridge/History.h: Removed.
        * bridge/mac/GlobalHistoryMac.mm: Copied from WebCore/bridge/mac/HistoryMac.mm.
        * bridge/mac/HistoryMac.mm: Removed.
        * bridge/win/GlobalHistoryWin.cpp: Copied from WebCore/bridge/win/HistoryWin.cpp.
        * bridge/win/HistoryWin.cpp: Removed.
        * css/cssstyleselector.cpp:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::disconnectFrame):
        (WebCore::DOMWindow::history):
        * page/DOMWindow.h:
        * page/DOMWindow.idl:
        * page/History.cpp: Added.
        (WebCore::History::History):
        (WebCore::History::frame):
        (WebCore::History::disconnectFrame):
        (WebCore::History::length):
        (WebCore::History::back):
        (WebCore::History::forward):
        (WebCore::History::go):
        * page/History.h: Added.
        * page/History.idl: Added.
        * platform/gdk/TemporaryLinkStubs.cpp:
        * platform/qt/TemporaryLinkStubs.cpp:
        * platform/wx/TemporaryLinkStubs.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4bd12d78
2007-06-19 Sam Weinig <sam@webkit.org>
Reviewed by Geoff.
Patch for http://bugs.webkit.org/show_bug.cgi?id=14226
Move the History object out of the JS bindings
- Autogenerate JSHistory.
* DerivedSources.make:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/kjs_window.cpp:
(KJS::WindowPrivate::WindowPrivate):
(KJS::Window::mark):
(KJS::Window::getValueProperty):
(KJS::Window::clearHelperObjectProperties):
(KJS::Window::disconnectFrame):
* bindings/js/kjs_window.h:
(KJS::Window::):
* bridge/GlobalHistory.h: Copied from WebCore/bridge/History.h.
* bridge/History.h: Removed.
* bridge/mac/GlobalHistoryMac.mm: Copied from WebCore/bridge/mac/HistoryMac.mm.
* bridge/mac/HistoryMac.mm: Removed.
* bridge/win/GlobalHistoryWin.cpp: Copied from WebCore/bridge/win/HistoryWin.cpp.
* bridge/win/HistoryWin.cpp: Removed.
* css/cssstyleselector.cpp:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::disconnectFrame):
(WebCore::DOMWindow::history):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* page/History.cpp: Added.
(WebCore::History::History):
(WebCore::History::frame):
(WebCore::History::disconnectFrame):
(WebCore::History::length):
(WebCore::History::back):
(WebCore::History::forward):
(WebCore::History::go):
* page/History.h: Added.
* page/History.idl: Added.
* platform/gdk/TemporaryLinkStubs.cpp:
* platform/qt/TemporaryLinkStubs.cpp:
* platform/wx/TemporaryLinkStubs.cpp:
2007-06-18 Sam Weinig <sam@webkit.org>
Qt build fix.
......@@ -393,6 +393,7 @@ all : \
JSHTMLTextAreaElement.h \
JSHTMLTitleElement.h \
JSHTMLUListElement.h \
JSHistory.h \
JSKeyboardEvent.h \
JSMediaList.h \
JSMouseEvent.h \
......
......@@ -258,6 +258,7 @@ IDL_BINDINGS += \
html/HTMLUListElement.idl \
page/BarInfo.idl \
page/DOMWindow.idl \
page/History.idl \
page/Screen.idl \
xml/DOMParser.idl \
xml/XMLSerializer.idl
......@@ -569,6 +570,7 @@ SOURCES += \
page/Frame.cpp \
page/FrameTree.cpp \
page/FrameView.cpp \
page/History.cpp \
page/MouseEventWithHitTestResults.cpp \
page/Page.cpp \
page/Screen.cpp \
......
......@@ -602,6 +602,14 @@
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventTargetNode.lut.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHistory.cpp"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHistory.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLAnchorElement.cpp"
>
......@@ -2469,6 +2477,14 @@
RelativePath="..\page\FrameView.h"
>
</File>
<File
RelativePath="..\page\History.cpp"
>
</File>
<File
RelativePath="..\page\History.h"
>
</File>
<File
RelativePath="..\page\MouseEventWithHitTestResults.cpp"
>
......@@ -5848,7 +5864,7 @@
>
</File>
<File
RelativePath="..\bridge\History.h"
RelativePath="..\bridge\GlobalHistory.h"
>
</File>
<File
......@@ -5875,7 +5891,7 @@
>
</File>
<File
RelativePath="..\bridge\win\HistoryWin.cpp"
RelativePath="..\bridge\win\GlobalHistoryWin.cpp"
>
</File>
<File
......
......@@ -1474,8 +1474,6 @@
9352088209BD45E900F2038D /* CookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = 9352088109BD45E900F2038D /* CookieJar.h */; };
9353676B09AED88B00D35CD6 /* ScrollViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */; };
9353686B09AF78F600D35CD6 /* TextDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9353686A09AF78F600D35CD6 /* TextDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
935C475D09AC4CA000A6AAB4 /* History.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C475C09AC4CA000A6AAB4 /* History.h */; };
935C475F09AC4CAE00A6AAB4 /* HistoryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C475E09AC4CAE00A6AAB4 /* HistoryMac.mm */; };
935C476109AC4CD100A6AAB4 /* Length.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476009AC4CD100A6AAB4 /* Length.h */; settings = {ATTRIBUTES = (Private, ); }; };
935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */; };
935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -2816,6 +2814,13 @@
BC926F800C0552470082776B /* JSHTMLFrameSetElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC926F7E0C0552470082776B /* JSHTMLFrameSetElement.cpp */; };
BC926F810C0552470082776B /* JSHTMLFrameSetElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC926F7F0C0552470082776B /* JSHTMLFrameSetElement.h */; };
BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */; };
BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC94D14C0C275C68006BC617 /* JSHistory.cpp */; };
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 */; };
BCA169A20BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */; };
BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
......@@ -4667,8 +4672,6 @@
9352088109BD45E900F2038D /* CookieJar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookieJar.h; sourceTree = "<group>"; };
9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollViewMac.mm; sourceTree = "<group>"; };
9353686A09AF78F600D35CD6 /* TextDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextDirection.h; sourceTree = "<group>"; };
935C475C09AC4CA000A6AAB4 /* History.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = History.h; sourceTree = "<group>"; };
935C475E09AC4CAE00A6AAB4 /* HistoryMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HistoryMac.mm; sourceTree = "<group>"; };
935C476009AC4CD100A6AAB4 /* Length.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Length.h; sourceTree = "<group>"; };
935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseEventWithHitTestResults.h; sourceTree = "<group>"; };
935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformKeyboardEvent.h; sourceTree = "<group>"; };
......@@ -6120,6 +6123,13 @@
BC926F7E0C0552470082776B /* JSHTMLFrameSetElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameSetElement.cpp; sourceTree = "<group>"; };
BC926F7F0C0552470082776B /* JSHTMLFrameSetElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLFrameSetElement.h; sourceTree = "<group>"; };
BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformScreenMac.mm; sourceTree = "<group>"; };
BC94D14C0C275C68006BC617 /* JSHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistory.cpp; sourceTree = "<group>"; };
BC94D14D0C275C68006BC617 /* JSHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHistory.h; sourceTree = "<group>"; };
BC94D1500C275C8B006BC617 /* History.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = History.cpp; sourceTree = "<group>"; };
BC94D1510C275C8B006BC617 /* History.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = History.h; sourceTree = "<group>"; };
BC94D1520C275C8B006BC617 /* History.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = History.idl; sourceTree = "<group>"; };
BC94D1560C275CAB006BC617 /* GlobalHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlobalHistory.h; sourceTree = "<group>"; };
BC94D1580C275CB6006BC617 /* GlobalHistoryMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = GlobalHistoryMac.mm; sourceTree = "<group>"; };
BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheetCustom.cpp; sourceTree = "<group>"; };
BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableCaptionElement.cpp; sourceTree = "<group>"; };
BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableCaptionElement.h; sourceTree = "<group>"; };
......@@ -6554,6 +6564,8 @@
93F9B7730BA5FDDC00854064 /* JSEntityReference.h */,
14E8378309F85D1C00B85AE4 /* JSEvent.cpp */,
14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
BC94D14C0C275C68006BC617 /* JSHistory.cpp */,
BC94D14D0C275C68006BC617 /* JSHistory.h */,
1A4A2DEB0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp */,
1A4A2DEC0A1B852A00C807F8 /* JSHTMLAnchorElement.h */,
1A4A2DED0A1B852A00C807F8 /* JSHTMLAppletElement.cpp */,
......@@ -7251,6 +7263,9 @@
65A21483097A3F5300B9050A /* FrameTree.h */,
65CBFEF70974F607001DAC25 /* FrameView.cpp */,
65CBFEF80974F607001DAC25 /* FrameView.h */,
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
BC94D1520C275C8B006BC617 /* History.idl */,
93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */,
935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
65FEA86809833ADE00BED4AB /* Page.cpp */,
......@@ -7273,7 +7288,7 @@
65BF02350974819000C43196 /* mac */,
55998A5C052B59CC0017A6C1 /* AXObjectCache.h */,
4B3043B50AE0363200A82647 /* EditorClient.h */,
935C475C09AC4CA000A6AAB4 /* History.h */,
BC94D1560C275CAB006BC617 /* GlobalHistory.h */,
06FC442B0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp */,
06FC442C0BAE5A9E0090EDE1 /* JavaScriptStatistics.h */,
14FD6DFC0AE5EA1B00AD67AD /* WindowFeatures.h */,
......@@ -7287,7 +7302,7 @@
isa = PBXGroup;
children = (
55998A5D052B59CC0017A6C1 /* AXObjectCacheMac.mm */,
935C475E09AC4CAE00A6AAB4 /* HistoryMac.mm */,
BC94D1580C275CB6006BC617 /* GlobalHistoryMac.mm */,
55998A5A052B59CC0017A6C1 /* WebCoreAXObject.h */,
55998A5B052B59CC0017A6C1 /* WebCoreAXObject.mm */,
7E6FEED60898582300C44C3F /* WebCoreScriptDebugger.h */,
......@@ -10392,7 +10407,6 @@
ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */,
BCC47E2709A3D6F100ADB771 /* FontFamily.h in Headers */,
BCC47E6B09A3FE4700ADB771 /* FontDescription.h in Headers */,
935C475D09AC4CA000A6AAB4 /* History.h in Headers */,
935C476109AC4CD100A6AAB4 /* Length.h in Headers */,
935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */,
935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
......@@ -11593,6 +11607,9 @@
BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */,
BCEC01D70C274EB4009F4EC9 /* PlatformScreen.h in Headers */,
BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */,
BC94D1540C275C8B006BC617 /* History.h in Headers */,
BC94D1570C275CAB006BC617 /* GlobalHistory.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -11708,6 +11725,7 @@
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
BC124EE90C2641CD009E2349 /* BarInfo.idl in Resources */,
BCEC01BF0C274DAC009F4EC9 /* Screen.idl in Resources */,
BC94D1550C275C8B006BC617 /* History.idl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -12050,7 +12068,6 @@
9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */,
936B424E09A436CD00BAA820 /* SVGCSSParser.cpp in Sources */,
BCC47E2609A3D6F100ADB771 /* FontFamily.cpp in Sources */,
935C475F09AC4CAE00A6AAB4 /* HistoryMac.mm in Sources */,
935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */,
935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */,
935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */,
......@@ -13023,6 +13040,9 @@
BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
BCEC01C20C274DDD009F4EC9 /* JSScreen.cpp in Sources */,
BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */,
BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */,
BC94D1530C275C8B006BC617 /* History.cpp in Sources */,
BC94D1590C275CB6006BC617 /* GlobalHistoryMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -82,8 +82,7 @@ const double cMinimumTimerInterval = 0.010;
struct WindowPrivate {
WindowPrivate()
: history(0)
, loc(0)
: loc(0)
, m_selection(0)
, m_evt(0)
, m_returnValueSlot(0)
......@@ -94,7 +93,6 @@ struct WindowPrivate {
Window::ListenersMap jsHTMLEventListeners;
Window::UnprotectedListenersMap jsUnprotectedEventListeners;
Window::UnprotectedListenersMap jsUnprotectedHTMLEventListeners;
mutable History* history;
mutable Location* loc;
mutable Selection* m_selection;
WebCore::Event *m_evt;
......@@ -139,27 +137,7 @@ public:
ScheduledAction *action;
};
////////////////////// History Object ////////////////////////
class History : public DOMObject {
friend class HistoryFunc;
public:
History(ExecState *exec, Frame *f)
: m_frame(f)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
}
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
JSValue *getValueProperty(ExecState *exec, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Back, Forward, Go, Length };
void disconnectFrame() { m_frame = 0; }
private:
Frame* m_frame;
};
}
} // namespace KJS
#include "kjs_window.lut.h"
......@@ -180,7 +158,6 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
status Window::Status DontDelete
DOMException Window::DOMException DontDelete
frames Window::Frames DontDelete|ReadOnly
history Window::History_ DontDelete|ReadOnly
event Window::Event_ DontDelete
innerHeight Window::InnerHeight DontDelete|ReadOnly
innerWidth Window::InnerWidth DontDelete|ReadOnly
......@@ -356,8 +333,6 @@ bool Window::find(const String& string, bool caseSensitive, bool backwards, bool
void Window::mark()
{
JSObject::mark();
if (d->history && !d->history->marked())
d->history->mark();
if (d->loc && !d->loc->marked())
d->loc->mark();
if (d->m_selection && !d->m_selection->marked())
......@@ -587,10 +562,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
return jsString(UString(m_frame->jsStatusBarText()));
case Frames:
return retrieve(m_frame);
case History_:
if (!d->history)
d->history = new History(exec, m_frame);
return d->history;
case Event_:
if (!d->m_evt)
return jsUndefined();
......@@ -1222,7 +1193,6 @@ JSUnprotectedEventListener *Window::findOrCreateJSUnprotectedEventListener(JSVal
void Window::clearHelperObjectProperties()
{
d->history = 0;
d->loc = 0;
d->m_selection = 0;
d->m_evt = 0;
......@@ -1859,8 +1829,6 @@ void Window::disconnectFrame()
d->loc->m_frame = 0;
if (d->m_selection)
d->m_selection->m_frame = 0;
if (d->history)
d->history->disconnectFrame();
}
Window::ListenersMap& Window::jsEventListeners()
......@@ -2218,56 +2186,6 @@ JSValue *SelectionFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
return jsUndefined();
}
////////////////////// History Object ////////////////////////
const ClassInfo History::info = { "History", 0, &HistoryTable, 0 };
/*
@begin HistoryTable 4
length History::Length DontDelete|ReadOnly
back History::Back DontDelete|Function 0
forward History::Forward DontDelete|Function 0
go History::Go DontDelete|Function 1
@end
*/
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(HistoryFunc)
bool History::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticPropertySlot<HistoryFunc, History, JSObject>(exec, &HistoryTable, this, propertyName, slot);
}
JSValue *History::getValueProperty(ExecState *, int token) const
{
ASSERT(token == Length);
return m_frame ? jsNumber(m_frame->loader()->getHistoryLength()) : jsNumber(0);
}
JSValue *HistoryFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
{
if (!thisObj->inherits(&History::info))
return throwError(exec, TypeError);
History *history = static_cast<History *>(thisObj);
int steps;
switch (id) {
case History::Back:
steps = -1;
break;
case History::Forward:
steps = 1;
break;
case History::Go:
steps = args[0]->toInt32(exec);
break;
default:
return jsUndefined();
}
if (Frame* frame = history->m_frame)
frame->loader()->scheduleHistoryNavigation(steps);
return jsUndefined();
}
/////////////////////////////////////////////////////////////////////////////
PausedTimeouts::~PausedTimeouts()
......
......@@ -36,8 +36,6 @@ namespace WebCore {
namespace KJS {
class BarInfo;
class History;
class JSEventListener;
class JSLazyEventListener;
class JSUnprotectedEventListener;
......@@ -150,7 +148,7 @@ namespace KJS {
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { AToB, BToA, Closed, Crypto, DefaultStatus, Status, DOMException, Frames, History_, Event_, InnerHeight,
enum { AToB, BToA, Closed, Crypto, DefaultStatus, Status, DOMException, Frames, Event_, InnerHeight,
InnerWidth, Length, Location_, Name, Navigator_, ClientInformation,
OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
Parent, ScreenX, ScreenY, Scroll, ScrollBy,
......
......@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef History_h
#define History_h
#ifndef GlobalHistory_h
#define GlobalHistory_h
namespace WebCore {
......@@ -32,6 +32,6 @@ namespace WebCore {
bool historyContains(const DeprecatedString&);
}
} // namespace WebCore
#endif
#endif // GlobalHistory_h
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006, 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
......@@ -24,7 +24,7 @@
*/
#import "config.h"
#import "History.h"
#import "GlobalHistory.h"
#import "DeprecatedString.h"
#import "WebCoreHistory.h"
......@@ -39,4 +39,4 @@ bool historyContains(const DeprecatedString& s)
return [[WebCoreHistory historyProvider] containsItemForURLUnicode:(UniChar *)s.unicode() length:s.length()];
}
}
} // namespace WebCore
......@@ -24,7 +24,7 @@
*/
#include "config.h"
#include "History.h"
#include "GlobalHistory.h"
#include "DeprecatedString.h"
#include "WebCoreHistory.h"
......@@ -42,4 +42,4 @@ bool historyContains(const DeprecatedString& s)
return WebCoreHistory::historyProvider()->containsItemForURLUnicode((UChar*)s.unicode(), s.length());
}
}
\ No newline at end of file
} // namespace WebCore
......@@ -38,28 +38,28 @@
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
#include "CSSValueList.h"
#include "Counter.h"
#include "CachedImage.h"
#include "Counter.h"
#include "DashboardRegion.h"
#include "FontFamilyValue.h"
#include "FontValue.h"
#include "Frame.h"
#include "FrameView.h"
#include "GlobalHistory.h"
#include "HTMLDocument.h"
#include "HTMLElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "History.h"
#include "Settings.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "Pair.h"
#include "Rect.h"
#include "RenderTheme.h"
#include "Settings.h"
#include "ShadowValue.h"
#include "StyleSheetList.h"
#include "UserAgentStyleSheets.h"
#include "loader.h"
#include "ShadowValue.h"
#if ENABLE(SVG)
#include "XLinkNames.h"
......
......@@ -34,6 +34,7 @@
#include "Element.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "History.h"
#include "Page.h"
#include "PlatformScreen.h"
#include "Screen.h"
......@@ -60,6 +61,8 @@ void DOMWindow::disconnectFrame()
m_frame = 0;
if (m_screen)
m_screen->disconnectFrame();
if (m_history)
m_history->disconnectFrame();
if (m_locationbar)
m_locationbar->disconnectFrame();
if (m_menubar)
......@@ -81,6 +84,13 @@ Screen* DOMWindow::screen() const
return m_screen.get();
}
History* DOMWindow::history() const
{
if (!m_history)
m_history = new History(m_frame);
return m_history.get();
}
BarInfo* DOMWindow::locationbar() const
{
if (!m_locationbar)
......
......@@ -38,6 +38,7 @@ namespace WebCore {
class Document;
class Element;
class Frame;
class History;
class Screen;
class String;
......@@ -51,6 +52,7 @@ namespace WebCore {
// DOM Level 0
Screen* screen() const;
History* history() const;
BarInfo* locationbar() const;
BarInfo* menubar() const;
BarInfo* personalbar() const;
......@@ -71,6 +73,7 @@ namespace WebCore {
private:
Frame* m_frame;
mutable RefPtr<Screen> m_screen;
mutable RefPtr<History> m_history;
mutable RefPtr<BarInfo> m_locationbar;
mutable RefPtr<BarInfo> m_menubar;
mutable RefPtr<BarInfo> m_personalbar;
......
......@@ -30,6 +30,7 @@ module window {
interface [LegacyParent=KJS::Window, DoNotCache, GenerateNativeConverter, CustomGetOwnPropertySlot] DOMWindow {
// DOM Level 0
readonly attribute Screen screen;
readonly attribute History history;
readonly attribute BarInfo locationbar;
readonly attribute BarInfo menubar;
readonly attribute BarInfo personalbar;
......
/*
* 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.
*
* 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.
*/
#include "config.h"
#include "History.h"
#include "Frame.h"
#include "FrameLoader.h"
namespace WebCore {
History::History(Frame* frame)
: m_frame(frame)
{
}
Frame* History::frame() const
{
return m_frame;
}
void History::disconnectFrame()
{
m_frame = 0;
}
unsigned History::length() const
{
if (!m_frame)
return 0;
return m_frame->loader()->getHistoryLength();
}
void History::back()
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(-1);
}
void History::forward()
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(1);
}
void History::go(int distance)
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(distance);
}
} // 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.