21 #ifndef _KJS_WINDOW_H_ 22 #define _KJS_WINDOW_H_ 30 #include "khtmlpart_p.h" 31 #include "kjs_binding.h" 32 #include "kjs_views.h" 61 class ScheduledAction;
62 class JSEventListener;
63 class JSLazyEventListener;
65 class Screen :
public JSObject
68 Screen(ExecState *exec);
70 Height,
Width, ColorDepth, PixelDepth, AvailLeft, AvailTop, AvailHeight,
73 using KJS::JSObject::getOwnPropertySlot;
74 bool getOwnPropertySlot(ExecState *exec,
const Identifier &propertyName, PropertySlot &slot)
override;
75 JSValue *getValueProperty(ExecState *exec,
int token)
const;
78 const ClassInfo *classInfo()
const override 82 static const ClassInfo info;
85 class Console :
public JSObject
88 Console(ExecState *exec);
100 using KJS::JSObject::getOwnPropertySlot;
101 bool getOwnPropertySlot(ExecState *exec,
const Identifier &propertyName, PropertySlot &slot)
override;
103 const ClassInfo *classInfo()
const override 107 static const ClassInfo info;
110 class Window :
public JSGlobalObject
113 friend class KJS::Location;
114 friend class KJS::WindowFunc;
115 friend class KJS::WindowQObject;
118 Window(khtml::ChildFrame *p);
135 static Window *retrieveActive(ExecState *exec);
138 return m_frame.isNull() ?
nullptr : m_frame->m_part.data();
141 void mark()
override;
142 JSValue *getValueProperty(ExecState *exec,
int token);
143 using KJS::JSObject::getOwnPropertySlot;
144 bool getOwnPropertySlot(ExecState *exec,
const Identifier &propertyName, PropertySlot &slot)
override;
145 using KJS::JSObject::put;
146 void put(ExecState *exec,
const Identifier &propertyName, JSValue *value,
int attr = None)
override;
147 bool toBoolean(ExecState *exec)
const override;
148 virtual DOM::AbstractViewImpl *toAbstractView()
const;
149 void scheduleClose();
151 void delayedGoHistory(
int steps);
152 void goHistory(
int steps);
153 void goURL(ExecState *exec,
const QString &url,
bool lockHistory =
false);
155 static bool targetIsExistingWindow(
KHTMLPart *part,
const QString &frameName);
156 JSValue *openWindow(ExecState *exec,
const List &args);
157 JSValue *executeOpenWindow(ExecState *exec,
const QUrl &url,
const QString &frameName,
const QString &features);
158 void resizeTo(
QWidget *tl,
int width,
int height);
159 void afterScriptExecution();
160 bool isSafeScript(ExecState *exec)
const 163 if (activePart == part()) {
166 return checkIsSafeScript(activePart);
169 JSEventListener *getJSEventListener(JSValue *val,
bool html =
false);
170 JSLazyEventListener *getJSLazyEventListener(
const QString &code,
const QString &sourceUrl,
int lineNo,
171 const QString &name, DOM::NodeImpl *node,
bool svg =
false);
172 void clear(ExecState *exec);
173 UString
toString(ExecState *exec)
const override;
176 void setCurrentEvent(DOM::EventImpl *evt);
179 const ClassInfo *classInfo()
const override 183 static const ClassInfo info;
184 enum { Closed, Crypto, DefaultStatus,
Status, Document, Node, EventCtor, Range,
185 NodeFilter, NodeList, DOMException, RangeException, CSSRule, Frames, _History, _External, Event, InnerHeight,
186 InnerWidth, Length, _Location, Navigate, Name, _Navigator, _Konqueror, ClientInformation,
187 OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
188 Parent, Personalbar, ScreenX, ScreenY, Scrollbars, Scroll, ScrollBy,
189 ScreenTop, ScreenLeft, AToB, BToA, FrameElement, GetComputedStyle,
190 ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, PostMessage, ResizeBy, ResizeTo, Self, _Window,
Top, _Screen,
191 _Console, Audio, Image,
Option, Alert, Confirm, Prompt,
Open, SetTimeout, ClearTimeout,
192 XMLHttpRequest, XMLSerializer, DOMParser, ArrayBuffer, Int8Array, Uint8Array,
193 Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array,
194 Focus, Blur,
Close, SetInterval, ClearInterval, CaptureEvents, ReleaseEvents,
195 Print, AddEventListener, RemoveEventListener, SideBar, GetSelection,
198 Onchange, Onclick, Ondblclick, Ondragdrop, Onerror, Onfocus,
199 Onkeydown, Onkeypress, Onkeyup, Onload, Onmessage, Onmousedown, Onmousemove,
200 Onmouseout, Onmouseover, Onmouseup, Onmove, Onreset, Onresize,
201 Onscroll, Onselect, Onsubmit, Onunload, Onhashchange,
202 MutationEventCtor, MessageEventCtor, KeyboardEventCtor, EventExceptionCtor, HashChangeEventCtor,
203 ElementCtor, DocumentCtor, DocumentFragmentCtor, HTMLDocumentCtor,
204 HTMLElementCtor, HTMLHtmlElementCtor, HTMLHeadElementCtor, HTMLLinkElementCtor,
205 HTMLTitleElementCtor, HTMLMetaElementCtor, HTMLBaseElementCtor, HTMLIsIndexElementCtor,
206 HTMLStyleElementCtor, HTMLBodyElementCtor, HTMLFormElementCtor, HTMLSelectElementCtor,
207 HTMLOptGroupElementCtor, HTMLOptionElementCtor, HTMLInputElementCtor, HTMLTextAreaElementCtor,
208 HTMLButtonElementCtor, HTMLLabelElementCtor, HTMLFieldSetElementCtor, HTMLLegendElementCtor,
209 HTMLUListElementCtor, HTMLOListElementCtor, HTMLDListElementCtor, HTMLDirectoryElementCtor,
210 HTMLMenuElementCtor, HTMLLIElementCtor, HTMLDivElementCtor, HTMLParagraphElementCtor,
211 HTMLHeadingElementCtor, HTMLBlockQuoteElementCtor, HTMLQuoteElementCtor, HTMLPreElementCtor,
212 HTMLBRElementCtor, HTMLBaseFontElementCtor, HTMLFontElementCtor, HTMLHRElementCtor, HTMLModElementCtor,
213 HTMLAnchorElementCtor, HTMLImageElementCtor, HTMLObjectElementCtor, HTMLParamElementCtor,
214 HTMLAppletElementCtor, HTMLMapElementCtor, HTMLAreaElementCtor, HTMLScriptElementCtor,
215 HTMLTableElementCtor, HTMLTableCaptionElementCtor, HTMLTableColElementCtor,
216 HTMLTableSectionElementCtor, HTMLTableRowElementCtor, HTMLTableCellElementCtor,
217 HTMLFrameSetElementCtor, HTMLLayerElementCtor, HTMLFrameElementCtor, HTMLIFrameElementCtor,
218 HTMLCollectionCtor, StyleSheetCtor,
219 CSSStyleDeclarationCtor, HTMLCanvasElementCtor, Context2DCtor, SVGAngleCtor,
220 XPathResultCtor, XPathExpressionCtor, XPathNSResolverCtor
224 void forgetSuppressedWindows();
225 void showSuppressedWindows();
227 JSValue *indexGetter(ExecState *exec,
unsigned index);
230 JSValue *getListener(ExecState *exec,
int eventId)
const;
231 void setListener(ExecState *exec,
int eventId, JSValue *func);
233 struct DelayedAction {
234 virtual void mark() {};
235 virtual bool execute(Window *) = 0;
236 virtual ~DelayedAction() {};
242 bool isCrossFrameAccessible(
int token)
const;
245 static JSValue *framePartGetter(ExecState *exec, JSObject *,
const Identifier &,
const PropertySlot &slot);
246 static JSValue *namedItemGetter(ExecState *exec, JSObject *,
const Identifier &,
const PropertySlot &slot);
256 DOM::EventImpl *m_evt;
260 struct SuppressedWindowInfo {
261 SuppressedWindowInfo() {}
262 SuppressedWindowInfo(
QUrl u,
QString fr,
QString fe) : url(u), frameName(fr), features(fe) {}
279 bool operator >(
const DateTimeMS &other)
const;
280 bool operator >=(
const DateTimeMS &other)
const;
298 bool execute(Window *window);
313 class WindowQObject :
public QObject 317 WindowQObject(Window *w);
319 int installTimeout(
const Identifier &handler,
int t,
bool singleShot);
320 int installTimeout(
JSValue *func,
List args,
int t,
bool singleShot);
321 void clearTimeout(
int timerId);
323 bool hasTimers()
const;
330 void parentDestroyed();
348 bool currentlyDispatching;
359 win = Window::retrieveActive(exec);
360 win->winq->pauseTimers();
365 win->winq->resumeTimers();
371 class Location :
public JSObject
377 using KJS::JSObject::getOwnPropertySlot;
378 bool getOwnPropertySlot(
ExecState *exec,
const Identifier &propertyName, PropertySlot &slot)
override;
379 using KJS::JSObject::put;
383 enum { Hash, Href, Hostname, Host, Pathname, Port, Protocol, Search, EqualEqual,
384 Assign, Replace, Reload, ToString
387 const ClassInfo *classInfo()
const override 394 Location(khtml::ChildFrame *f);
This file is part of the HTML rendering engine for KDE.
This class is khtml's main class.
QVariant location(const QVariant &res)
Renders and displays HTML in a QScrollArea.
We inherit from Interpreter, to save a pointer to the HTML part that the interpreter runs for...
An action (either function or string) to be executed after a specified time interval, either once or repeatedly.
KIOCORE_EXPORT TransferJob * put(const QUrl &url, int permissions, JobFlags flags=DefaultFlags)
This library provides a full-featured HTML parser and widget.
char * toString(const T &value)
Helper for pausing/resuming timers.
like QDateTime, but properly handles milliseconds