Commit f4315cf2 authored by weinig's avatar weinig

Reviewed by Adam and Maciej.

        Move the frameElement attribute from kjs_window to DOMWindow and
        auto-generate the bindings for it. 

        * bindings/js/kjs_window.cpp:
        (KJS::Window::getValueProperty):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * bindings/scripts/CodeGeneratorJS.pm:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::frameElement):
        (WebCore::DOMWindow::devicePixelRatio):
        * page/DOMWindow.h:
        * page/DOMWindow.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c7521237
2007-07-16 Sam Weinig <sam@webkit.org>
Reviewed by Adam and Maciej.
Move the frameElement attribute from kjs_window to DOMWindow and
auto-generate the bindings for it.
* bindings/js/kjs_window.cpp:
(KJS::Window::getValueProperty):
* bindings/js/kjs_window.h:
(KJS::Window::):
* bindings/scripts/CodeGeneratorJS.pm:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::frameElement):
(WebCore::DOMWindow::devicePixelRatio):
* page/DOMWindow.h:
* page/DOMWindow.idl:
2007-07-16 Sam Weinig <sam@webkit.org>
Reviewed by Adam.
......@@ -179,7 +179,6 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
self Window::Self DontDelete|ReadOnly
window Window::Window_ DontDelete|ReadOnly
top Window::Top DontDelete|ReadOnly
frameElement Window::FrameElement DontDelete|ReadOnly
# -- Event Listeners --
onabort Window::Onabort DontDelete
onblur Window::Onblur DontDelete
......@@ -578,14 +577,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
case XSLTProcessor_:
return jsUndefined();
#endif
case FrameElement:
if (!isSafeScript(exec))
return jsUndefined();
if (Document* doc = impl()->frame()->document())
if (Element* fe = doc->ownerElement())
if (checkNodeSecurity(exec, fe))
return toJS(exec, fe);
return jsUndefined();
}
if (!isSafeScript(exec))
......
......@@ -153,7 +153,6 @@ namespace KJS {
Crypto, Frames, Event_, Location_,
Navigator_, ClientInformation, Opener,
Parent, Self, Window_, Top,
FrameElement,
// Event Listeners
Onabort, Onblur, Onchange, Onclick,
......
......@@ -891,6 +891,9 @@ sub GenerateImplementation
if ($attribute->signature->extendedAttributes->{"Custom"}) {
push(@implContent, " return $name(exec);\n");
} elsif ($attribute->signature->extendedAttributes->{"CheckNodeSecurity"}) {
$implIncludes{"kjs_dom.h"} = 1;
push(@implContent, " return checkNodeSecurity(exec, imp->$name()) ? " . NativeToJSValue($attribute->signature, $implClassNameForValueConversion, "imp->$name()") . " : jsUndefined();\n");
} elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) {
$implIncludes{"Document.h"} = 1;
$implIncludes{"kjs_dom.h"} = 1;
......
......@@ -146,6 +146,20 @@ DOMSelection* DOMWindow::getSelection()
return m_selection.get();
}
Element* DOMWindow::frameElement() const
{
if (!m_frame)
return 0;
Document* doc = m_frame->document();
ASSERT(doc);
if (!doc)
return 0;
// FIXME: could this use m_frame->ownerElement() instead of going through the Document.
return doc->ownerElement();
}
void DOMWindow::focus()
{
if (!m_frame)
......@@ -467,7 +481,7 @@ double DOMWindow::devicePixelRatio() const
Page* page = m_frame->page();
if (!page)
return 0;
return 0.0;
return page->chrome()->scaleFactor();
}
......
......@@ -63,6 +63,8 @@ namespace WebCore {
DOMSelection* getSelection();
Element* frameElement() const;
void focus();
void blur();
void close();
......
......@@ -38,6 +38,8 @@ module window {
DOMSelection getSelection();
readonly attribute [CheckNodeSecurity] Element frameElement;
[DoNotCheckDomainSecurity] void focus();
[DoNotCheckDomainSecurity] void blur();
[DoNotCheckDomainSecurity] void close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment