Reviewed by Geoff.
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2007 23:04:07 +0000 (23:04 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2007 23:04:07 +0000 (23:04 +0000)
        Patch for http://bugs.webkit.org/show_bug.cgi?id=14211
        Move the BarInfo object out of the JS bindings

        * 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::):
        * page/BarInfo.cpp: Added.
        (WebCore::BarInfo::BarInfo):
        (WebCore::BarInfo::disconnectFrame):
        (WebCore::BarInfo::visible):
        * page/BarInfo.h: Added.
        (WebCore::BarInfo::):
        * page/BarInfo.idl: Added.
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::~DOMWindow):
        (WebCore::DOMWindow::disconnectFrame):
        (WebCore::DOMWindow::locationbar):
        (WebCore::DOMWindow::menubar):
        (WebCore::DOMWindow::personalbar):
        (WebCore::DOMWindow::scrollbars):
        (WebCore::DOMWindow::statusbar):
        (WebCore::DOMWindow::toolbar):
        * page/DOMWindow.h:
        * page/DOMWindow.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23573 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h
WebCore/page/BarInfo.cpp [new file with mode: 0644]
WebCore/page/BarInfo.h [new file with mode: 0644]
WebCore/page/BarInfo.idl [new file with mode: 0644]
WebCore/page/DOMWindow.cpp
WebCore/page/DOMWindow.h
WebCore/page/DOMWindow.idl

index cad2cd7aa85e8f43cfd0d85b8fc3021b3ea95653..e6af1f82a46925264736a2f12378820057d6f813 100644 (file)
@@ -1,3 +1,41 @@
+2007-06-18  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Geoff.
+
+        Patch for http://bugs.webkit.org/show_bug.cgi?id=14211
+        Move the BarInfo object out of the JS bindings
+
+        * 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::):
+        * page/BarInfo.cpp: Added.
+        (WebCore::BarInfo::BarInfo):
+        (WebCore::BarInfo::disconnectFrame):
+        (WebCore::BarInfo::visible):
+        * page/BarInfo.h: Added.
+        (WebCore::BarInfo::):
+        * page/BarInfo.idl: Added.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::~DOMWindow):
+        (WebCore::DOMWindow::disconnectFrame):
+        (WebCore::DOMWindow::locationbar):
+        (WebCore::DOMWindow::menubar):
+        (WebCore::DOMWindow::personalbar):
+        (WebCore::DOMWindow::scrollbars):
+        (WebCore::DOMWindow::statusbar):
+        (WebCore::DOMWindow::toolbar):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+
 2007-06-18  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Darin.
index c4c4b9d602ed692709785519df09ededc36914f6..f636d0b3d32fc5de2b9589519ea8dcb1c226ce27 100644 (file)
@@ -299,6 +299,7 @@ all : \
     DocTypeStrings.cpp \
     HTMLEntityNames.c \
     JSAttr.h \
+    JSBarInfo.h \
     JSCDATASection.h \
     JSCSSCharsetRule.h \
     JSCSSFontFaceRule.h \
index 14849a91224a6318b14b3d1d17d17ebe6b071311..c99e0350cec5e6fb6bc5ede36cbf7fce0194183c 100644 (file)
@@ -256,6 +256,7 @@ IDL_BINDINGS += \
     html/HTMLTextAreaElement.idl \
     html/HTMLTitleElement.idl \
     html/HTMLUListElement.idl \
+    page/BarInfo.idl \
     page/DOMWindow.idl \
     xml/DOMParser.idl \
     xml/XMLSerializer.idl
@@ -557,6 +558,7 @@ SOURCES += \
     loader/SubresourceLoader.cpp \
     loader/TextDocument.cpp \
     loader/TextResourceDecoder.cpp \
+    page/BarInfo.cpp \
     page/Chrome.cpp \
     page/ContextMenuController.cpp \
     page/DOMWindow.cpp \
index f229d14f7a908eefae089e8fef91da9af0ef0f9a..48d1bc68383ec5cfb1a203955f438b4c356d42d3 100644 (file)
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSAttr.h"
                                >
                        </File>
+                       <File
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBarInfo.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSBarInfo.h"
+                               >
+                       </File>
                        <File
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCanvasGradient.cpp"
                                >
                <Filter
                        Name="page"
                        >
+                       <File
+                               RelativePath="..\page\BarInfo.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\page\BarInfo.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\page\Chrome.cpp"
                                >
index 5ee59d4900a35312f7c120ba380acf843023a6db..262c8f07a7bc59c7061be888c21e4297bd618711 100644 (file)
                BC06EDE40BFD6D0D00856E9D /* JSHTMLTableCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06EDE20BFD6D0D00856E9D /* JSHTMLTableCellElement.h */; };
                BC06EE040BFD71AA00856E9D /* JSHTMLTableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06EE020BFD71AA00856E9D /* JSHTMLTableElement.cpp */; };
                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 */; };
                BC18C5D00B2A886F0018461D /* TextBreakIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */; };
                BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */; };
                BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLStyleSheet.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLTProcessor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               BC124EE40C2641CD009E2349 /* BarInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BarInfo.cpp; sourceTree = "<group>"; };
+               BC124EE50C2641CD009E2349 /* BarInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BarInfo.h; sourceTree = "<group>"; };
+               BC124EE60C2641CD009E2349 /* BarInfo.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = BarInfo.idl; sourceTree = "<group>"; };
+               BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSBarInfo.cpp; sourceTree = "<group>"; };
+               BC124EFE0C26447A009E2349 /* JSBarInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSBarInfo.h; sourceTree = "<group>"; };
                BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElementCustom.cpp; sourceTree = "<group>"; };
                BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBreakIterator.h; sourceTree = "<group>"; };
                BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorICU.cpp; sourceTree = "<group>"; };
                14DFB33F0A7DF7630018F769 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
+                               BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */,
+                               BC124EFE0C26447A009E2349 /* JSBarInfo.h */,
                                65DF31D809D1C122000BE325 /* JSAttr.cpp */,
                                65DF31D909D1C123000BE325 /* JSAttr.h */,
                                65DF323309D1DE65000BE325 /* JSCanvasGradient.cpp */,
                        children = (
                                93C09A820B064F05005ABD4D /* mac */,
                                8538F0000AD71770006A81D1 /* AbstractView.idl */,
+                               BC124EE40C2641CD009E2349 /* BarInfo.cpp */,
+                               BC124EE50C2641CD009E2349 /* BarInfo.h */,
+                               BC124EE60C2641CD009E2349 /* BarInfo.idl */,
                                14D8238A0AF92DF60004F057 /* Chrome.cpp */,
                                14D823500AF92A790004F057 /* Chrome.h */,
+                               14D824060AF93AEB0004F057 /* ChromeClient.h */,
                                065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */,
                                065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */,
                                065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */,
-                               14D824060AF93AEB0004F057 /* ChromeClient.h */,
                                1403B99609EB13AF00797C7F /* DOMWindow.cpp */,
                                1403B99509EB13AF00797C7F /* DOMWindow.h */,
                                1403B90C09EB124500797C7F /* DOMWindow.idl */,
-                               93C09A520B064DB3005ABD4D /* EventHandler.h */,
+                               A718760D0B2A120100A16ECE /* DragActions.h */,
+                               A7CA59620B27C1F200FA021D /* DragClient.h */,
+                               A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
+                               A7CA595B0B27BD9E00FA021D /* DragController.h */,
                                93C09A800B064F00005ABD4D /* EventHandler.cpp */,
-                               14993BE40B2F2B1C0050497F /* FocusController.h */,
+                               93C09A520B064DB3005ABD4D /* EventHandler.h */,
                                14993BE30B2F2B1C0050497F /* FocusController.cpp */,
+                               14993BE40B2F2B1C0050497F /* FocusController.h */,
                                062287830B4DB322000C34DF /* FocusDirection.h */,
                                65BF02290974816300C43196 /* Frame.cpp */,
                                65BF022A0974816300C43196 /* Frame.h */,
                                65FEA86809833ADE00BED4AB /* Page.cpp */,
                                65A21467097A329100B9050A /* Page.h */,
                                65D1C1C909932B22000CB324 /* Plugin.h */,
-                               F587863A02DE3A1401EA4122 /* Settings.h */,
-                               A7CA595B0B27BD9E00FA021D /* DragController.h */,
-                               A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
-                               A7CA59620B27C1F200FA021D /* DragClient.h */,
-                               A718760D0B2A120100A16ECE /* DragActions.h */,
                                14C9A5E90B3D105F005A0232 /* Settings.cpp */,
+                               F587863A02DE3A1401EA4122 /* Settings.h */,
                        );
                        path = page;
                        sourceTree = "<group>";
                                BC6DC7A10C1A4BFA004E2017 /* JSHTMLAllCollection.h in Headers */,
                                BCFE2F120C1B58380020235F /* JSRect.h in Headers */,
                                BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
+                               BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */,
+                               BC124F000C26447A009E2349 /* JSBarInfo.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BC491B4F0C023E2D009D6316 /* HTMLMarqueeElement.idl in Resources */,
                                1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
                                1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
+                               BC124EE90C2641CD009E2349 /* BarInfo.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BCCBAD3B0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp in Sources */,
                                BCCBAD400C18C14200CE890F /* JSHTMLCollection.cpp in Sources */,
                                BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */,
+                               BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */,
+                               BC124EFF0C26447A009E2349 /* JSBarInfo.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 42495e97e4c2eb0edd4fb20a2a7397cc0ff8a649..046a7a3e07cecf9b231b3bfa1ffd65577f4f461d 100644 (file)
@@ -86,12 +86,6 @@ struct WindowPrivate {
         , history(0)
         , loc(0)
         , m_selection(0)
-        , m_locationbar(0)
-        , m_menubar(0)
-        , m_personalbar(0)
-        , m_scrollbars(0)
-        , m_statusbar(0)
-        , m_toolbar(0)
         , m_evt(0)
         , m_returnValueSlot(0)
     {
@@ -105,12 +99,6 @@ struct WindowPrivate {
     mutable History* history;
     mutable Location* loc;
     mutable Selection* m_selection;
-    mutable BarInfo* m_locationbar;
-    mutable BarInfo* m_menubar;
-    mutable BarInfo* m_personalbar;
-    mutable BarInfo* m_scrollbars;
-    mutable BarInfo* m_statusbar;
-    mutable BarInfo* m_toolbar;
     WebCore::Event *m_evt;
     JSValue **m_returnValueSlot;
     typedef HashMap<int, DOMWindowTimer*> TimeoutsMap;
@@ -255,11 +243,9 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   innerWidth    Window::InnerWidth      DontDelete|ReadOnly
   length        Window::Length          DontDelete|ReadOnly
   location      Window::Location_       DontDelete
-  locationbar   Window::Locationbar     DontDelete
   name          Window::Name            DontDelete
   navigator     Window::Navigator_      DontDelete|ReadOnly
   clientInformation     Window::ClientInformation       DontDelete|ReadOnly
-  menubar       Window::Menubar         DontDelete|ReadOnly
   offscreenBuffering    Window::OffscreenBuffering      DontDelete|ReadOnly
   opener        Window::Opener          DontDelete|ReadOnly
   outerHeight   Window::OuterHeight     DontDelete|ReadOnly
@@ -267,14 +253,10 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   pageXOffset   Window::PageXOffset     DontDelete|ReadOnly
   pageYOffset   Window::PageYOffset     DontDelete|ReadOnly
   parent        Window::Parent          DontDelete|ReadOnly
-  personalbar   Window::Personalbar     DontDelete|ReadOnly
   screenX       Window::ScreenX         DontDelete|ReadOnly
   screenY       Window::ScreenY         DontDelete|ReadOnly
   screenLeft    Window::ScreenLeft      DontDelete|ReadOnly
   screenTop     Window::ScreenTop       DontDelete|ReadOnly
-  scrollbars    Window::Scrollbars      DontDelete|ReadOnly
-  statusbar     Window::Statusbar       DontDelete|ReadOnly
-  toolbar       Window::Toolbar         DontDelete|ReadOnly
   scroll        Window::Scroll          DontDelete|Function 2
   scrollBy      Window::ScrollBy        DontDelete|Function 2
   scrollTo      Window::ScrollTo        DontDelete|Function 2
@@ -428,48 +410,6 @@ bool Window::find(const String& string, bool caseSensitive, bool backwards, bool
     return m_frame->findString(string, !backwards, caseSensitive, wrap, false);
 }
 
-BarInfo *Window::locationbar(ExecState *exec) const
-{
-  if (!d->m_locationbar)
-    d->m_locationbar = new BarInfo(exec, m_frame, BarInfo::Locationbar);
-  return d->m_locationbar;
-}
-
-BarInfo *Window::menubar(ExecState *exec) const
-{
-  if (!d->m_menubar)
-    d->m_menubar = new BarInfo(exec, m_frame, BarInfo::Menubar);
-  return d->m_menubar;
-}
-
-BarInfo *Window::personalbar(ExecState *exec) const
-{
-  if (!d->m_personalbar)
-    d->m_personalbar = new BarInfo(exec, m_frame, BarInfo::Personalbar);
-  return d->m_personalbar;
-}
-
-BarInfo *Window::statusbar(ExecState *exec) const
-{
-  if (!d->m_statusbar)
-    d->m_statusbar = new BarInfo(exec, m_frame, BarInfo::Statusbar);
-  return d->m_statusbar;
-}
-
-BarInfo *Window::toolbar(ExecState *exec) const
-{
-  if (!d->m_toolbar)
-    d->m_toolbar = new BarInfo(exec, m_frame, BarInfo::Toolbar);
-  return d->m_toolbar;
-}
-
-BarInfo *Window::scrollbars(ExecState *exec) const
-{
-  if (!d->m_scrollbars)
-    d->m_scrollbars = new BarInfo(exec, m_frame, BarInfo::Scrollbars);
-  return d->m_scrollbars;
-}
-
 // reference our special objects during garbage collection
 void Window::mark()
 {
@@ -482,18 +422,6 @@ void Window::mark()
     d->loc->mark();
   if (d->m_selection && !d->m_selection->marked())
     d->m_selection->mark();
-  if (d->m_locationbar && !d->m_locationbar->marked())
-    d->m_locationbar->mark();
-  if (d->m_menubar && !d->m_menubar->marked())
-    d->m_menubar->mark();
-  if (d->m_personalbar && !d->m_personalbar->marked())
-    d->m_personalbar->mark();
-  if (d->m_scrollbars && !d->m_scrollbars->marked())
-    d->m_scrollbars->mark();
-  if (d->m_statusbar && !d->m_statusbar->marked())
-    d->m_statusbar->mark();
-  if (d->m_toolbar && !d->m_toolbar->marked())
-    d->m_toolbar->mark();
 }
 
 static bool allowPopUp(ExecState *exec, Window *window)
@@ -751,10 +679,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       const_cast<Window *>(this)->putDirect("clientInformation", n, DontDelete|ReadOnly);
       return n;
     }
-    case Locationbar:
-      return locationbar(exec);
-    case Menubar:
-      return menubar(exec);
     case OffscreenBuffering:
       return jsBoolean(true);
     case Opener:
@@ -777,8 +701,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       return jsNumber(m_frame->view()->contentsY());
     case Parent:
       return retrieve(m_frame->tree()->parent() ? m_frame->tree()->parent() : m_frame);
-    case Personalbar:
-      return personalbar(exec);
     case ScreenLeft:
     case ScreenX:
       return jsNumber(m_frame->page()->chrome()->windowRect().x());
@@ -795,12 +717,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
         return jsUndefined();
       updateLayout();
       return jsNumber(m_frame->view()->contentsY());
-    case Scrollbars:
-      return scrollbars(exec);
-    case Statusbar:
-      return statusbar(exec);
-    case Toolbar:
-      return toolbar(exec);
     case Self:
     case Window_:
       return retrieve(m_frame);
@@ -1374,12 +1290,6 @@ void Window::clearHelperObjectProperties()
   d->history = 0;
   d->loc = 0;
   d->m_selection = 0;
-  d->m_locationbar = 0;
-  d->m_menubar = 0;
-  d->m_personalbar = 0;
-  d->m_scrollbars = 0;
-  d->m_statusbar = 0;
-  d->m_toolbar = 0;
   d->m_evt = 0;
 }
 
@@ -2014,18 +1924,6 @@ void Window::disconnectFrame()
         d->loc->m_frame = 0;
     if (d->m_selection)
         d->m_selection->m_frame = 0;
-    if (d->m_locationbar)
-        d->m_locationbar->m_frame = 0;
-    if (d->m_menubar)
-        d->m_menubar->m_frame = 0;
-    if (d->m_personalbar)
-        d->m_personalbar->m_frame = 0;
-    if (d->m_statusbar)
-        d->m_statusbar->m_frame = 0;
-    if (d->m_toolbar)
-        d->m_toolbar->m_frame = 0;
-    if (d->m_scrollbars)
-        d->m_scrollbars->m_frame = 0;
     if (d->history)
         d->history->disconnectFrame();
 }
@@ -2385,50 +2283,6 @@ JSValue *SelectionFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const
     return jsUndefined();
 }
 
-////////////////////// BarInfo Object ////////////////////////
-
-const ClassInfo BarInfo::info = { "BarInfo", 0, &BarInfoTable, 0 };
-/*
-@begin BarInfoTable 1
-  visible                BarInfo::Visible                        DontDelete|ReadOnly
-@end
-*/
-BarInfo::BarInfo(ExecState *exec, Frame *f, Type barType) 
-  : m_frame(f)
-  , m_type(barType)
-{
-  setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
-}
-
-JSValue *BarInfo::getValueProperty(ExecState *exec, int token) const
-{
-    ASSERT(token == Visible);
-    switch (m_type) {
-    case Locationbar:
-        return jsBoolean(m_frame->page()->chrome()->toolbarsVisible());
-    case Toolbar:
-        return jsBoolean(m_frame->page()->chrome()->toolbarsVisible());
-    case Personalbar:
-        return jsBoolean(m_frame->page()->chrome()->toolbarsVisible());
-    case Menubar: 
-        return jsBoolean(m_frame->page()->chrome()->menubarVisible());
-    case Scrollbars: 
-        return jsBoolean(m_frame->page()->chrome()->scrollbarsVisible());
-    case Statusbar:
-        return jsBoolean(m_frame->page()->chrome()->statusbarVisible());
-    default:
-        return jsBoolean(false);
-    }
-}
-
-bool BarInfo::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
-{
-  if (!m_frame)
-    return false;
-  
-  return getStaticValueSlot<BarInfo, JSObject>(exec, &BarInfoTable, this, propertyName, slot);
-}
-
 ////////////////////// History Object ////////////////////////
 
 const ClassInfo History::info = { "History", 0, &HistoryTable, 0 };
index e678de702a38217c39181596a99fe82ad1b26b51..3c45831f2d24be0c10131b2678ef0b6375e47f4f 100644 (file)
@@ -132,12 +132,6 @@ namespace KJS {
     Location *location() const;
     Selection *selection() const;
     bool find(const WebCore::String&, bool, bool, bool, bool, bool, bool) const;
-    BarInfo *locationbar(ExecState*) const;
-    BarInfo *menubar(ExecState*) const;
-    BarInfo *personalbar(ExecState*) const;
-    BarInfo *scrollbars(ExecState*) const;
-    BarInfo *statusbar(ExecState*) const;
-    BarInfo *toolbar(ExecState*) const;
 
     // Finds a wrapper of a JS EventListener, returns 0 if no existing one.
     JSEventListener* findJSEventListener(JSValue*, bool html = false);
@@ -170,9 +164,9 @@ 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,
-           InnerWidth, Length, Location_, Locationbar, Name, Navigator_, ClientInformation,
-           Menubar, OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
-           Parent, Personalbar, ScreenX, ScreenY, Scrollbars, Scroll, ScrollBy,
+           InnerWidth, Length, Location_, Name, Navigator_, ClientInformation,
+           OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
+           Parent, ScreenX, ScreenY, Scroll, ScrollBy,
            ScreenTop, ScreenLeft,
            ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, Window_, Top, Screen_,
            Image, Option, Alert, Confirm, Prompt, Open, Print, SetTimeout, ClearTimeout,
@@ -183,7 +177,7 @@ namespace KJS {
            Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove,
            Onmouseout, Onmouseover, Onmouseup, OnWindowMouseWheel, Onreset, Onresize, Onscroll, Onsearch,
            Onselect, Onsubmit, Onunload, Onbeforeunload,
-           Statusbar, Toolbar, FrameElement, ShowModalDialog, Find, Stop };
+           FrameElement, ShowModalDialog, Find, Stop };
 
   private:
     JSValue* getListener(ExecState*, const WebCore::AtomicString& eventType) const;
@@ -255,22 +249,6 @@ namespace KJS {
     WebCore::Frame* m_frame;
   };
 
-  class BarInfo : public DOMObject {
-  public:
-    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
-    JSValue *getValueProperty(ExecState *exec, int token) const;
-    enum { Visible };
-    enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
-    WebCore::Frame* frame() const { return m_frame; }
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-  private:
-    friend class Window;
-    BarInfo(ExecState*, WebCore::Frame*, Type);
-    WebCore::Frame* m_frame;
-    Type m_type;
-  };
-
 } // namespace
 
 namespace WebCore {
diff --git a/WebCore/page/BarInfo.cpp b/WebCore/page/BarInfo.cpp
new file mode 100644 (file)
index 0000000..9c8e95b
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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 "BarInfo.h"
+
+#include "Chrome.h"
+#include "Frame.h"
+#include "Page.h"
+
+namespace WebCore {
+
+BarInfo::BarInfo(Frame* frame, Type type)
+    : m_frame(frame)
+    , m_type(type)
+{
+}
+
+void BarInfo::disconnectFrame()
+{
+    m_frame = 0;
+}
+
+bool BarInfo::visible() const
+{
+    if (!m_frame)
+        return false;
+
+    switch (m_type) {
+        case Locationbar:
+            return m_frame->page()->chrome()->toolbarsVisible();
+        case Toolbar:
+            return m_frame->page()->chrome()->toolbarsVisible();
+        case Personalbar:
+            return m_frame->page()->chrome()->toolbarsVisible();
+        case Menubar: 
+            return m_frame->page()->chrome()->menubarVisible();
+        case Scrollbars: 
+            return m_frame->page()->chrome()->scrollbarsVisible();
+        case Statusbar:
+            return m_frame->page()->chrome()->statusbarVisible();
+        default:
+            return false;
+    }
+}
+
+} // namespace WebCore
diff --git a/WebCore/page/BarInfo.h b/WebCore/page/BarInfo.h
new file mode 100644 (file)
index 0000000..bc0d862
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#ifndef BarInfo_h
+#define BarInfo_h
+
+#include "Shared.h"
+
+namespace WebCore {
+
+    class Frame;
+
+    class BarInfo : public Shared<BarInfo> {
+    public:
+        enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
+    
+        BarInfo(Frame*, Type);
+        void disconnectFrame();
+
+        bool visible() const;
+
+    private:
+        Frame* m_frame;
+        Type m_type;
+    };
+
+} // namespace WebCore
+
+#endif // BarInfo_h
diff --git a/WebCore/page/BarInfo.idl b/WebCore/page/BarInfo.idl
new file mode 100644 (file)
index 0000000..fe6e390
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+module window {
+
+    interface BarInfo {
+        readonly attribute boolean visible;
+    };
+
+}
index 7f2f74d73c97126553ac369dfa5f43603c3c7b42..6e9e623ad21ff897d0673dc500ed2d63fec5342a 100644 (file)
 #include "config.h"
 #include "DOMWindow.h"
 
-#include "cssstyleselector.h"
-#include "Chrome.h"
+#include "BarInfo.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSRuleList.h"
+#include "Chrome.h"
 #include "Document.h"
 #include "Element.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "Page.h"
 #include "Screen.h"
+#include "cssstyleselector.h"
 
 namespace WebCore {
 
@@ -44,6 +45,10 @@ DOMWindow::DOMWindow(Frame* f)
 {
 }
 
+DOMWindow::~DOMWindow()
+{
+}
+
 Frame* DOMWindow::frame()
 {
     return m_frame;
@@ -52,6 +57,60 @@ Frame* DOMWindow::frame()
 void DOMWindow::disconnectFrame()
 {
     m_frame = 0;
+    if (m_locationbar)
+        m_locationbar->disconnectFrame();
+    if (m_menubar)
+        m_menubar->disconnectFrame();
+    if (m_personalbar)
+        m_personalbar->disconnectFrame();
+    if (m_scrollbars)
+        m_scrollbars->disconnectFrame();
+    if (m_statusbar)
+        m_statusbar->disconnectFrame();
+    if (m_toolbar)
+        m_toolbar->disconnectFrame();
+}
+
+BarInfo* DOMWindow::locationbar() const
+{
+    if (!m_locationbar)
+        m_locationbar = new BarInfo(m_frame, BarInfo::Locationbar);
+    return m_locationbar.get();
+}
+
+BarInfo* DOMWindow::menubar() const
+{
+    if (!m_menubar)
+        m_menubar = new BarInfo(m_frame, BarInfo::Menubar);
+    return m_menubar.get();
+}
+
+BarInfo* DOMWindow::personalbar() const
+{
+    if (!m_personalbar)
+        m_personalbar = new BarInfo(m_frame, BarInfo::Personalbar);
+    return m_personalbar.get();
+}
+
+BarInfo* DOMWindow::scrollbars() const
+{
+    if (!m_scrollbars)
+        m_scrollbars = new BarInfo(m_frame, BarInfo::Scrollbars);
+    return m_scrollbars.get();
+}
+
+BarInfo* DOMWindow::statusbar() const
+{
+    if (!m_statusbar)
+        m_statusbar = new BarInfo(m_frame, BarInfo::Statusbar);
+    return m_statusbar.get();
+}
+
+BarInfo* DOMWindow::toolbar() const
+{
+    if (!m_toolbar)
+        m_toolbar = new BarInfo(m_frame, BarInfo::Toolbar);
+    return m_toolbar.get();
 }
 
 Document* DOMWindow::document() const
index 788ddb8aec7083a09a31afedaabb26780ee193c8..52f0cc69aeaed6e432ea783cf2e7d5dc042fa86a 100644 (file)
 #define DOMWindow_h
 
 #include "Shared.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
+
+    class BarInfo;
     class CSSRuleList;
     class CSSStyleDeclaration;
     class Document;
@@ -40,9 +43,20 @@ namespace WebCore {
     class DOMWindow : public Shared<DOMWindow> {
     public:
         DOMWindow(Frame*);
+        virtual ~DOMWindow();
+
         Frame* frame();
         void disconnectFrame();
 
+        // DOM Level 0
+        BarInfo* locationbar() const;
+        BarInfo* menubar() const;
+        BarInfo* personalbar() const;
+        BarInfo* scrollbars() const;
+        BarInfo* statusbar() const;
+        BarInfo* toolbar() const;
+
+
         // DOM Level 2 AbstractView Interface
         Document* document() const;
         
@@ -55,6 +69,12 @@ namespace WebCore {
         
     private:
         Frame* m_frame;
+        mutable RefPtr<BarInfo> m_locationbar;
+        mutable RefPtr<BarInfo> m_menubar;
+        mutable RefPtr<BarInfo> m_personalbar;
+        mutable RefPtr<BarInfo> m_scrollbars;
+        mutable RefPtr<BarInfo> m_statusbar;
+        mutable RefPtr<BarInfo> m_toolbar;
     };
 
 } // namespace WebCore
index 78476f3fd080aee629d77c57bfd17a9388d24bb4..0376525976bcd52ab6d28af4828f9d85031cdd1c 100644 (file)
@@ -28,6 +28,14 @@ module window {
     // You can't cache the Window object in the global object because it *is* the global object.
     // For the same reason, there's no need to.
     interface [LegacyParent=KJS::Window, DoNotCache, GenerateNativeConverter, CustomGetOwnPropertySlot] DOMWindow {
+        // DOM Level 0
+        readonly attribute BarInfo locationbar;
+        readonly attribute BarInfo menubar;
+        readonly attribute BarInfo personalbar;
+        readonly attribute BarInfo scrollbars;
+        readonly attribute BarInfo statusbar;
+        readonly attribute BarInfo toolbar;
+
         // DOM Level 2 AbstractView Interface
         readonly attribute Document document;