Title: [144584] trunk/Source/WebCore
Revision
144584
Author
[email protected]
Date
2013-03-03 15:52:42 -0800 (Sun, 03 Mar 2013)

Log Message

[V8] Move HTMLDocument::getNamedProperty() to DOMWindowShell
https://bugs.webkit.org/show_bug.cgi?id=111223

Reviewed by Adam Barth.

HTMLDocument::getNamedProperty() is used by DOMWindowShell.
It can be a static method in DOMWindowShell.

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::getNamedProperty):
(WebCore):
(WebCore::getter):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144583 => 144584)


--- trunk/Source/WebCore/ChangeLog	2013-03-03 23:19:31 UTC (rev 144583)
+++ trunk/Source/WebCore/ChangeLog	2013-03-03 23:52:42 UTC (rev 144584)
@@ -1,3 +1,23 @@
+2013-03-01  Kentaro Hara  <[email protected]>
+
+        [V8] Move HTMLDocument::getNamedProperty() to DOMWindowShell
+        https://bugs.webkit.org/show_bug.cgi?id=111223
+
+        Reviewed by Adam Barth.
+
+        HTMLDocument::getNamedProperty() is used by DOMWindowShell.
+        It can be a static method in DOMWindowShell.
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateHeader):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::getNamedProperty):
+        (WebCore):
+        (WebCore::getter):
+        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+
 2013-03-03  Dan Bernstein  <[email protected]>
 
         Build fix after r144565. Reverted r144533.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (144583 => 144584)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-03-03 23:19:31 UTC (rev 144583)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-03-03 23:52:42 UTC (rev 144584)
@@ -392,7 +392,6 @@
     if ($interfaceName eq "HTMLDocument") {
       push(@headerContent, <<END);
     static v8::Local<v8::Object> wrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl, v8::Isolate*);
-    static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate*);
 END
     }
 

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (144583 => 144584)


--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2013-03-03 23:19:31 UTC (rev 144583)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2013-03-03 23:52:42 UTC (rev 144584)
@@ -37,6 +37,8 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
+#include "HTMLCollection.h"
+#include "HTMLIFrameElement.h"
 #include "InspectorInstrumentation.h"
 #include "Page.h"
 #include "RuntimeEnabledFeatures.h"
@@ -46,6 +48,7 @@
 #include "V8DOMWindow.h"
 #include "V8Document.h"
 #include "V8GCForContextDispose.h"
+#include "V8HTMLCollection.h"
 #include "V8HTMLDocument.h"
 #include "V8HiddenPropertyName.h"
 #include "V8Initializer.h"
@@ -427,13 +430,32 @@
     updateSecurityOrigin();
 }
 
+static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+    if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
+        return v8Undefined();
+
+    RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
+    if (items->isEmpty())
+        return v8Undefined();
+
+    if (items->hasExactlyOneItem()) {
+        Node* node = items->item(0);
+        Frame* frame = 0;
+        if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
+            return toV8(frame->document()->domWindow(), creationContext, isolate);
+        return toV8(node, creationContext, isolate);
+    }
+    return toV8(items.release(), creationContext, isolate);
+}
+
 static v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info)
 {
     // FIXME: Consider passing AtomicStringImpl directly.
     AtomicString name = toWebCoreAtomicString(property);
     HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
     ASSERT(htmlDocument);
-    v8::Handle<v8::Value> result = V8HTMLDocument::getNamedProperty(htmlDocument, name, info.Holder(), info.GetIsolate());
+    v8::Handle<v8::Value> result = getNamedProperty(htmlDocument, name, info.Holder(), info.GetIsolate());
     if (!result.IsEmpty())
         return result;
     v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype();

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp (144583 => 144584)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2013-03-03 23:19:31 UTC (rev 144583)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp	2013-03-03 23:52:42 UTC (rev 144584)
@@ -80,27 +80,6 @@
     return shadow;
 }
 
-v8::Handle<v8::Value> V8HTMLDocument::getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
-        return v8Undefined();
-
-    RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
-    if (items->isEmpty())
-        return v8Undefined();
-
-    if (items->hasExactlyOneItem()) {
-        Node* node = items->item(0);
-        Frame* frame = 0;
-        if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
-            return toV8(frame->document()->domWindow(), creationContext, isolate);
-
-        return toV8(node, creationContext, isolate);
-    }
-
-    return toV8(items.release(), creationContext, isolate);
-}
-
 // HTMLDocument ----------------------------------------------------------------
 
 // Concatenates "args" to a string. If args is empty, returns empty string.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to