From a58329c3133bd0dcec8fcf63590a8592de722d64 Mon Sep 17 00:00:00 2001 From: mjs Date: Wed, 28 Jul 2004 22:46:21 +0000 Subject: [PATCH] Reviewed by Trey. controls on page at http://help.sap.com don't work properly To fix this I implemented the various JavaScript BarInfo properties in JavaScript. * khtml/ecma/kjs_window.cpp: (Window::Window): (Window::locationbar): (Window::menubar): (Window::personalbar): (Window::statusbar): (Window::toolbar): (Window::scrollbars): (Window::mark): (Window::get): (SelectionFunc::tryCall): (BarInfo::BarInfo): (BarInfo::~BarInfo): (BarInfo::get): (BarInfo::put): * khtml/ecma/kjs_window.h: (KJS::Window::): (KJS::BarInfo::): (KJS::BarInfo::part): (KJS::BarInfo::classInfo): * khtml/ecma/kjs_window.lut.h: (KJS::): * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::locationbarVisible): (KWQKHTMLPart::menubarVisible): (KWQKHTMLPart::personalbarVisible): (KWQKHTMLPart::scrollbarsVisible): (KWQKHTMLPart::statusbarVisible): (KWQKHTMLPart::toolbarVisible): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7149 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog-2005-08-23 | 39 ++++++++ WebCore/khtml/ecma/kjs_window.cpp | 148 +++++++++++++++++++++++++++- WebCore/khtml/ecma/kjs_window.h | 37 ++++++- WebCore/khtml/ecma/kjs_window.lut.h | 74 ++++++++------ WebCore/kwq/KWQKHTMLPart.h | 7 ++ WebCore/kwq/KWQKHTMLPart.mm | 37 +++++++ 6 files changed, 306 insertions(+), 36 deletions(-) diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index 1587f919d0ae..d1adc5e081f0 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,42 @@ +2004-07-28 Maciej Stachowiak + + Reviewed by Trey. + + controls on page at http://help.sap.com don't work properly + + To fix this I implemented the various JavaScript BarInfo properties in JavaScript. + + * khtml/ecma/kjs_window.cpp: + (Window::Window): + (Window::locationbar): + (Window::menubar): + (Window::personalbar): + (Window::statusbar): + (Window::toolbar): + (Window::scrollbars): + (Window::mark): + (Window::get): + (SelectionFunc::tryCall): + (BarInfo::BarInfo): + (BarInfo::~BarInfo): + (BarInfo::get): + (BarInfo::put): + * khtml/ecma/kjs_window.h: + (KJS::Window::): + (KJS::BarInfo::): + (KJS::BarInfo::part): + (KJS::BarInfo::classInfo): + * khtml/ecma/kjs_window.lut.h: + (KJS::): + * kwq/KWQKHTMLPart.h: + * kwq/KWQKHTMLPart.mm: + (KWQKHTMLPart::locationbarVisible): + (KWQKHTMLPart::menubarVisible): + (KWQKHTMLPart::personalbarVisible): + (KWQKHTMLPart::scrollbarsVisible): + (KWQKHTMLPart::statusbarVisible): + (KWQKHTMLPart::toolbarVisible): + 2004-07-28 Ken Kocienda Reviewed by me diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp index a0b5ccd4c39b..d54d244365b9 100644 --- a/WebCore/khtml/ecma/kjs_window.cpp +++ b/WebCore/khtml/ecma/kjs_window.cpp @@ -208,10 +208,12 @@ 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 konqueror Window::_Konqueror DontDelete|ReadOnly + menubar Window::Menubar DontDelete|ReadOnly offscreenBuffering Window::OffscreenBuffering DontDelete|ReadOnly opener Window::Opener DontDelete|ReadOnly outerHeight Window::OuterHeight DontDelete|ReadOnly @@ -225,6 +227,8 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 }; 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 @@ -290,7 +294,20 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 }; IMPLEMENT_PROTOFUNC(WindowFunc) Window::Window(KHTMLPart *p) - : ObjectImp(/*no proto*/), m_part(p), screen(0), history(0), frames(0), loc(0), m_selection(0), m_evt(0) + : ObjectImp(/*no proto*/) + , m_part(p) + , screen(0) + , history(0) + , frames(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) { winq = new WindowQObject(this); //kdDebug(6070) << "Window::Window this=" << this << " part=" << m_part << " " << m_part->name() << endl; @@ -357,6 +374,48 @@ Selection *Window::selection() const return m_selection; } +BarInfo *Window::locationbar(ExecState *exec) const +{ + if (!m_locationbar) + const_cast(this)->m_locationbar = new BarInfo(exec, m_part, BarInfo::Locationbar); + return m_locationbar; +} + +BarInfo *Window::menubar(ExecState *exec) const +{ + if (!m_menubar) + const_cast(this)->m_menubar = new BarInfo(exec, m_part, BarInfo::Menubar); + return m_menubar; +} + +BarInfo *Window::personalbar(ExecState *exec) const +{ + if (!m_personalbar) + const_cast(this)->m_personalbar = new BarInfo(exec, m_part, BarInfo::Personalbar); + return m_personalbar; +} + +BarInfo *Window::statusbar(ExecState *exec) const +{ + if (!m_statusbar) + const_cast(this)->m_statusbar = new BarInfo(exec, m_part, BarInfo::Statusbar); + return m_statusbar; +} + +BarInfo *Window::toolbar(ExecState *exec) const +{ + if (!m_toolbar) + const_cast(this)->m_toolbar = new BarInfo(exec, m_part, BarInfo::Toolbar); + return m_toolbar; +} + +BarInfo *Window::scrollbars(ExecState *exec) const +{ + if (!m_scrollbars) + const_cast(this)->m_scrollbars = new BarInfo(exec, m_part, BarInfo::Scrollbars); + return m_scrollbars; +} + // reference our special objects during garbage collection void Window::mark() { @@ -372,6 +431,18 @@ void Window::mark() loc->mark(); if (m_selection && !m_selection->marked()) m_selection->mark(); + if (m_locationbar && !m_locationbar->marked()) + m_locationbar->mark(); + if (m_menubar && !m_menubar->marked()) + m_menubar->mark(); + if (m_personalbar && !m_personalbar->marked()) + m_personalbar->mark(); + if (m_scrollbars && !m_scrollbars->marked()) + m_scrollbars->mark(); + if (m_statusbar && !m_statusbar->marked()) + m_statusbar->mark(); + if (m_toolbar && !m_toolbar->marked()) + m_toolbar->mark(); } bool Window::hasProperty(ExecState * /*exec*/, const Identifier &/*p*/) const @@ -493,6 +564,10 @@ Value Window::get(ExecState *exec, const Identifier &p) const case _Konqueror: return Value(new Konqueror(m_part)); #endif + case Locationbar: + return Value(locationbar(exec)); + case Menubar: + return Value(menubar(exec)); case OffscreenBuffering: return Boolean(true); case Opener: @@ -522,7 +597,7 @@ Value Window::get(ExecState *exec, const Identifier &p) const case Parent: return Value(retrieve(m_part->parentPart() ? m_part->parentPart() : (KHTMLPart*)m_part)); case Personalbar: - return Undefined(); // ### + return Value(personalbar(exec)); case ScreenLeft: case ScreenX: { if (!m_part->view()) @@ -550,7 +625,11 @@ Value Window::get(ExecState *exec, const Identifier &p) const return Number(m_part->view()->contentsY()); } case Scrollbars: - return Undefined(); // ### + return Value(scrollbars(exec)); + case Statusbar: + return Value(statusbar(exec)); + case Toolbar: + return Value(toolbar(exec)); case Self: case _Window: return Value(retrieve(m_part)); @@ -2282,6 +2361,69 @@ Value SelectionFunc::tryCall(ExecState *exec, Object &thisObj, const List &args) return Undefined(); } +////////////////////// BarInfo Object //////////////////////// + +const ClassInfo BarInfo::info = { "BarInfo", 0, 0, 0 }; +/* +@begin BarInfoTable 1 + visible BarInfo::Visible DontDelete|ReadOnly +@end +*/ +BarInfo::BarInfo(ExecState *exec, KHTMLPart *p, Type barType) + : ObjectImp(exec->lexicalInterpreter()->builtinObjectPrototype()) + , m_part(p) + , m_type(barType) +{ +} + +BarInfo::~BarInfo() +{ +} + +Value BarInfo::get(ExecState *exec, const Identifier &p) const +{ + if (m_part.isNull()) + return Undefined(); + + const HashEntry *entry = Lookup::findEntry(&BarInfoTable, p); + if (entry && entry->value == Visible) { + switch (m_type) { + case Locationbar: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->locationbarVisible()); +#endif + case Menubar: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->locationbarVisible()); +#endif + case Personalbar: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->personalbarVisible()); +#endif + case Scrollbars: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->scrollbarsVisible()); +#endif + case Statusbar: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->statusbarVisible()); +#endif + case Toolbar: +#if APPLE_CHANGES + return Boolean(KWQ(m_part)->toolbarVisible()); +#endif + default: + return Boolean(false); + } + } + + return Undefined(); +} + +void BarInfo::put(ExecState *exec, const Identifier &p, const Value &v, int attr) +{ +} + ////////////////////// History Object //////////////////////// const ClassInfo History::info = { "History", 0, 0, 0 }; diff --git a/WebCore/khtml/ecma/kjs_window.h b/WebCore/khtml/ecma/kjs_window.h index 10c7bdd60637..a29118d641a2 100644 --- a/WebCore/khtml/ecma/kjs_window.h +++ b/WebCore/khtml/ecma/kjs_window.h @@ -39,6 +39,7 @@ namespace KJS { class WindowQObject; class Location; class Selection; + class BarInfo; class History; class FrameArray; class JSEventListener; @@ -102,6 +103,12 @@ namespace KJS { bool isSafeScript(ExecState *exec) const; Location *location() const; Selection *selection() const; + BarInfo *locationbar(ExecState *exec) const; + BarInfo *menubar(ExecState *exec) const; + BarInfo *personalbar(ExecState *exec) const; + BarInfo *scrollbars(ExecState *exec) const; + BarInfo *statusbar(ExecState *exec) const; + BarInfo *toolbar(ExecState *exec) const; JSEventListener *getJSEventListener(const Value &val, bool html = false); JSLazyEventListener *getJSLazyEventListener(const QString &code, bool html = false, int lineno = 0); void clear( ExecState *exec ); @@ -115,8 +122,8 @@ namespace KJS { static const ClassInfo info; enum { Closed, Crypto, DefaultStatus, Status, Document, Node, EventCtor, Range, NodeFilter, DOMException, CSSRule, Frames, _History, Event, InnerHeight, - InnerWidth, Length, _Location, Name, _Navigator, _Konqueror, ClientInformation, - OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset, + InnerWidth, Length, _Location, Locationbar, Name, _Navigator, _Konqueror, ClientInformation, + Menubar, OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset, Parent, Personalbar, ScreenX, ScreenY, Scrollbars, Scroll, ScrollBy, ScreenTop, ScreenLeft, ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, _Window, Top, _Screen, @@ -126,7 +133,8 @@ namespace KJS { Onabort, Onblur, Onchange, Onclick, Ondblclick, Ondragdrop, Onerror, Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove, Onmouseout, Onmouseover, Onmouseup, Onmove, Onreset, Onresize, Onscroll, Onsearch, - Onselect, Onsubmit, Onunload }; + Onselect, Onsubmit, Onunload, + Statusbar, Toolbar }; protected: Value getListener(ExecState *exec, int eventId) const; void setListener(ExecState *exec, int eventId, Value func); @@ -139,6 +147,12 @@ namespace KJS { FrameArray *frames; Location *loc; Selection *m_selection; + BarInfo *m_locationbar; + BarInfo *m_menubar; + BarInfo *m_personalbar; + BarInfo *m_scrollbars; + BarInfo *m_statusbar; + BarInfo *m_toolbar; WindowQObject *winq; DOM::Event *m_evt; }; @@ -225,6 +239,23 @@ namespace KJS { QGuardedPtr m_part; }; + class BarInfo : public ObjectImp { + public: + ~BarInfo(); + virtual Value get(ExecState *exec, const Identifier &propertyName) const; + virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None); + enum { Visible }; + enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar }; + KHTMLPart *part() const { return m_part; } + virtual const ClassInfo* classInfo() const { return &info; } + static const ClassInfo info; + private: + friend class Window; + BarInfo(ExecState *exec, KHTMLPart *p, Type barType); + QGuardedPtr m_part; + Type m_type; + }; + #ifdef Q_WS_QWS class Konqueror : public ObjectImp { friend class KonquerorFunc; diff --git a/WebCore/khtml/ecma/kjs_window.lut.h b/WebCore/khtml/ecma/kjs_window.lut.h index a3efca1e2c32..053bf7c10045 100644 --- a/WebCore/khtml/ecma/kjs_window.lut.h +++ b/WebCore/khtml/ecma/kjs_window.lut.h @@ -25,55 +25,55 @@ const struct HashEntry WindowTableEntries[] = { { "event", Window::Event, DontDelete, 0, &WindowTableEntries[94] }, { "frames", Window::Frames, DontDelete|ReadOnly, 0, &WindowTableEntries[95] }, { "onmouseup", Window::Onmouseup, DontDelete, 0, 0 }, - { "NodeFilter", Window::NodeFilter, DontDelete, 0, &WindowTableEntries[99] }, - { "CSSRule", Window::CSSRule, DontDelete, 0, &WindowTableEntries[107] }, + { "NodeFilter", Window::NodeFilter, DontDelete, 0, &WindowTableEntries[102] }, + { "CSSRule", Window::CSSRule, DontDelete, 0, &WindowTableEntries[111] }, { "length", Window::Length, DontDelete|ReadOnly, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, - { "print", Window::Print, DontDelete|Function, 2, &WindowTableEntries[106] }, + { "print", Window::Print, DontDelete|Function, 2, &WindowTableEntries[110] }, { "opener", Window::Opener, DontDelete|ReadOnly, 0, 0 }, { "parent", Window::Parent, DontDelete|ReadOnly, 0, 0 }, { 0, 0, 0, 0, 0 }, - { "scrollX", Window::ScrollX, DontDelete|ReadOnly, 0, &WindowTableEntries[114] }, - { "scrollY", Window::ScrollY, DontDelete|ReadOnly, 0, &WindowTableEntries[108] }, + { "scrollX", Window::ScrollX, DontDelete|ReadOnly, 0, &WindowTableEntries[118] }, + { "scrollY", Window::ScrollY, DontDelete|ReadOnly, 0, &WindowTableEntries[112] }, { "XMLSerializer", Window::XMLSerializer, DontDelete|ReadOnly, 0, 0 }, - { "scroll", Window::Scroll, DontDelete|Function, 2, 0 }, + { "menubar", Window::Menubar, DontDelete|ReadOnly, 0, &WindowTableEntries[97] }, { 0, 0, 0, 0, 0 }, - { "defaultStatus", Window::DefaultStatus, DontDelete, 0, &WindowTableEntries[104] }, + { "defaultStatus", Window::DefaultStatus, DontDelete, 0, &WindowTableEntries[108] }, { "onblur", Window::Onblur, DontDelete, 0, 0 }, { "confirm", Window::Confirm, DontDelete|Function, 1, 0 }, - { "scrollBy", Window::ScrollBy, DontDelete|Function, 2, &WindowTableEntries[119] }, + { "scrollBy", Window::ScrollBy, DontDelete|Function, 2, &WindowTableEntries[123] }, { "pageXOffset", Window::PageXOffset, DontDelete|ReadOnly, 0, 0 }, { "pageYOffset", Window::PageYOffset, DontDelete|ReadOnly, 0, 0 }, - { "Node", Window::Node, DontDelete, 0, &WindowTableEntries[97] }, - { "window", Window::_Window, DontDelete|ReadOnly, 0, 0 }, + { "Node", Window::Node, DontDelete, 0, &WindowTableEntries[99] }, + { "toolbar", Window::Toolbar, DontDelete|ReadOnly, 0, &WindowTableEntries[101] }, { "Image", Window::Image, DontDelete|ReadOnly, 0, 0 }, { "onabort", Window::Onabort, DontDelete, 0, 0 }, { "onmousemove", Window::Onmousemove, DontDelete, 0, 0 }, - { "scrollTo", Window::ScrollTo, DontDelete|Function, 2, &WindowTableEntries[117] }, + { "scrollTo", Window::ScrollTo, DontDelete|Function, 2, &WindowTableEntries[121] }, { "onsearch", Window::Onsearch, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, - { "screenLeft", Window::ScreenLeft, DontDelete|ReadOnly, 0, &WindowTableEntries[98] }, + { "screenLeft", Window::ScreenLeft, DontDelete|ReadOnly, 0, &WindowTableEntries[100] }, { "onmouseover", Window::Onmouseover, DontDelete, 0, 0 }, { "crypto", Window::Crypto, DontDelete|ReadOnly, 0, 0 }, - { "screenTop", Window::ScreenTop, DontDelete|ReadOnly, 0, &WindowTableEntries[100] }, + { "screenTop", Window::ScreenTop, DontDelete|ReadOnly, 0, &WindowTableEntries[103] }, { "Range", Window::Range, DontDelete, 0, &WindowTableEntries[91] }, { "status", Window::Status, DontDelete, 0, 0 }, { "onreset", Window::Onreset, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, { "onselect", Window::Onselect, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, - { "document", Window::Document, DontDelete|ReadOnly, 0, &WindowTableEntries[110] }, + { "document", Window::Document, DontDelete|ReadOnly, 0, &WindowTableEntries[114] }, { "onunload", Window::Onunload, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, { "onerror", Window::Onerror, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, { "innerHeight", Window::InnerHeight, DontDelete|ReadOnly, 0, 0 }, { 0, 0, 0, 0, 0 }, - { "innerWidth", Window::InnerWidth, DontDelete|ReadOnly, 0, &WindowTableEntries[115] }, + { "innerWidth", Window::InnerWidth, DontDelete|ReadOnly, 0, &WindowTableEntries[119] }, { "defaultstatus", Window::DefaultStatus, DontDelete, 0, 0 }, { "name", Window::Name, DontDelete, 0, 0 }, { 0, 0, 0, 0, 0 }, @@ -84,7 +84,7 @@ const struct HashEntry WindowTableEntries[] = { { "Event", Window::EventCtor, DontDelete, 0, 0 }, { "onresize", Window::Onresize, DontDelete, 0, 0 }, { "navigator", Window::_Navigator, DontDelete|ReadOnly, 0, 0 }, - { "self", Window::Self, DontDelete|ReadOnly, 0, &WindowTableEntries[120] }, + { "self", Window::Self, DontDelete|ReadOnly, 0, &WindowTableEntries[124] }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, @@ -92,17 +92,17 @@ const struct HashEntry WindowTableEntries[] = { { 0, 0, 0, 0, 0 }, { "clientInformation", Window::ClientInformation, DontDelete|ReadOnly, 0, &WindowTableEntries[93] }, { 0, 0, 0, 0, 0 }, - { "outerWidth", Window::OuterWidth, DontDelete|ReadOnly, 0, &WindowTableEntries[102] }, - { "getSelection", Window::GetSelection, DontDelete|Function, 0, &WindowTableEntries[111] }, + { "outerWidth", Window::OuterWidth, DontDelete|ReadOnly, 0, &WindowTableEntries[105] }, + { "getSelection", Window::GetSelection, DontDelete|Function, 0, &WindowTableEntries[115] }, { 0, 0, 0, 0, 0 }, { "blur", Window::Blur, DontDelete|Function, 0, 0 }, - { "setTimeout", Window::SetTimeout, DontDelete|Function, 2, 0 }, - { "DOMException", Window::DOMException, DontDelete, 0, 0 }, + { "locationbar", Window::Locationbar, DontDelete, 0, &WindowTableEntries[106] }, + { "DOMException", Window::DOMException, DontDelete, 0, &WindowTableEntries[96] }, { 0, 0, 0, 0, 0 }, { "setInterval", Window::SetInterval, DontDelete|Function, 2, 0 }, { "scrollbars", Window::Scrollbars, DontDelete|ReadOnly, 0, 0 }, - { "clearTimeout", Window::ClearTimeout, DontDelete|Function, 1, &WindowTableEntries[103] }, - { "moveBy", Window::MoveBy, DontDelete|Function, 2, &WindowTableEntries[113] }, + { "clearTimeout", Window::ClearTimeout, DontDelete|Function, 1, &WindowTableEntries[107] }, + { "moveBy", Window::MoveBy, DontDelete|Function, 2, &WindowTableEntries[117] }, { "alert", Window::Alert, DontDelete|Function, 1, 0 }, { "clearInterval", Window::ClearInterval, DontDelete|Function, 1, 0 }, { 0, 0, 0, 0, 0 }, @@ -114,21 +114,25 @@ const struct HashEntry WindowTableEntries[] = { { "focus", Window::Focus, DontDelete|Function, 0, 0 }, { 0, 0, 0, 0, 0 }, { "location", Window::_Location, DontDelete, 0, 0 }, - { "konqueror", Window::_Konqueror, DontDelete|ReadOnly, 0, &WindowTableEntries[96] }, + { "konqueror", Window::_Konqueror, DontDelete|ReadOnly, 0, &WindowTableEntries[98] }, { "outerHeight", Window::OuterHeight, DontDelete|ReadOnly, 0, 0 }, - { "screenX", Window::ScreenX, DontDelete|ReadOnly, 0, &WindowTableEntries[116] }, - { "screenY", Window::ScreenY, DontDelete|ReadOnly, 0, &WindowTableEntries[105] }, + { "screenX", Window::ScreenX, DontDelete|ReadOnly, 0, &WindowTableEntries[120] }, + { "screenY", Window::ScreenY, DontDelete|ReadOnly, 0, &WindowTableEntries[109] }, + { "statusbar", Window::Statusbar, DontDelete|ReadOnly, 0, 0 }, + { "scroll", Window::Scroll, DontDelete|Function, 2, 0 }, { "moveTo", Window::MoveTo, DontDelete|Function, 2, 0 }, - { "resizeBy", Window::ResizeBy, DontDelete|Function, 2, &WindowTableEntries[118] }, + { "resizeBy", Window::ResizeBy, DontDelete|Function, 2, &WindowTableEntries[122] }, { "resizeTo", Window::ResizeTo, DontDelete|Function, 2, 0 }, + { "window", Window::_Window, DontDelete|ReadOnly, 0, 0 }, { "screen", Window::_Screen, DontDelete|ReadOnly, 0, 0 }, - { "XMLHttpRequest", Window::XMLHttpRequest, DontDelete|ReadOnly, 0, &WindowTableEntries[101] }, - { "prompt", Window::Prompt, DontDelete|Function, 2, &WindowTableEntries[112] }, + { "XMLHttpRequest", Window::XMLHttpRequest, DontDelete|ReadOnly, 0, &WindowTableEntries[104] }, + { "prompt", Window::Prompt, DontDelete|Function, 2, &WindowTableEntries[116] }, { "open", Window::Open, DontDelete|Function, 3, 0 }, + { "setTimeout", Window::SetTimeout, DontDelete|Function, 2, 0 }, { "close", Window::Close, DontDelete|Function, 0, 0 }, { "captureEvents", Window::CaptureEvents, DontDelete|Function, 0, 0 }, { "releaseEvents", Window::ReleaseEvents, DontDelete|Function, 0, 0 }, - { "addEventListener", Window::AddEventListener, DontDelete|Function, 3, &WindowTableEntries[109] }, + { "addEventListener", Window::AddEventListener, DontDelete|Function, 3, &WindowTableEntries[113] }, { "removeEventListener", Window::RemoveEventListener, DontDelete|Function, 3, 0 }, { "onchange", Window::Onchange, DontDelete, 0, 0 }, { "onclick", Window::Onclick, DontDelete, 0, 0 }, @@ -145,7 +149,7 @@ const struct HashEntry WindowTableEntries[] = { { "onsubmit", Window::Onsubmit, DontDelete, 0, 0 } }; -const struct HashTable WindowTable = { 2, 121, WindowTableEntries, 91 }; +const struct HashTable WindowTable = { 2, 125, WindowTableEntries, 91 }; } // namespace @@ -212,6 +216,16 @@ const struct HashTable SelectionTable = { 2, 27, SelectionTableEntries, 19 }; namespace KJS { +const struct HashEntry BarInfoTableEntries[] = { + { "visible", BarInfo::Visible, DontDelete|ReadOnly, 0, 0 } +}; + +const struct HashTable BarInfoTable = { 2, 1, BarInfoTableEntries, 1 }; + +} // namespace + +namespace KJS { + const struct HashEntry HistoryTableEntries[] = { { 0, 0, 0, 0, 0 }, { "back", History::Back, DontDelete|Function, 0, &HistoryTableEntries[4] }, diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h index 73af40ca482d..7455bc2c62de 100644 --- a/WebCore/kwq/KWQKHTMLPart.h +++ b/WebCore/kwq/KWQKHTMLPart.h @@ -186,6 +186,13 @@ public: void runJavaScriptAlert(const QString &message); bool runJavaScriptConfirm(const QString &message); bool runJavaScriptPrompt(const QString &message, const QString &defaultValue, QString &result); + bool locationbarVisible(); + bool menubarVisible(); + bool personalbarVisible(); + bool scrollbarsVisible(); + bool statusbarVisible(); + bool toolbarVisible(); + void KWQKHTMLPart::addMessageToConsole(const QString &message, unsigned int lineNumber, const QString &sourceID); using KHTMLPart::xmlDocImpl; khtml::RenderObject *renderer(); diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm index 471e5f28a550..ef8b94e5db4a 100644 --- a/WebCore/kwq/KWQKHTMLPart.mm +++ b/WebCore/kwq/KWQKHTMLPart.mm @@ -1723,6 +1723,43 @@ bool KWQKHTMLPart::runJavaScriptPrompt(const QString &prompt, const QString &def return false; } +bool KWQKHTMLPart::locationbarVisible() +{ + return [_bridge areToolbarsVisible]; +} + +bool KWQKHTMLPart::menubarVisible() +{ + // The menubar is always on in Mac OS X UI + return true; +} + +bool KWQKHTMLPart::personalbarVisible() +{ + return [_bridge areToolbarsVisible]; +} + +bool KWQKHTMLPart::scrollbarsVisible() +{ + if (!view()) + return false; + + if (view()->hScrollBarMode() == QScrollView::AlwaysOff || view()->vScrollBarMode() == QScrollView::AlwaysOff) + return false; + + return true; +} + +bool KWQKHTMLPart::statusbarVisible() +{ + return [_bridge isStatusBarVisible]; +} + +bool KWQKHTMLPart::toolbarVisible() +{ + return [_bridge areToolbarsVisible]; +} + void KWQKHTMLPart::addMessageToConsole(const QString &message, unsigned lineNumber, const QString &sourceURL) { NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys: -- 2.36.0