summaryrefslogtreecommitdiffstats
path: root/webkit/port/bindings
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 22:04:12 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-31 22:04:12 +0000
commit6ea03c81c023985462cc85ac1f08015c7af41ff2 (patch)
tree327da1cb17e38a23d3f995e32b5033ae35fe70f7 /webkit/port/bindings
parent67747a95c47dfb44168e68db6d36286e2029571b (diff)
downloadchromium_src-6ea03c81c023985462cc85ac1f08015c7af41ff2.zip
chromium_src-6ea03c81c023985462cc85ac1f08015c7af41ff2.tar.gz
chromium_src-6ea03c81c023985462cc85ac1f08015c7af41ff2.tar.bz2
Updated project files and added V8 bindings for HTML5 media/audio/video/sourcetags. Required some changes to CodeGeneratorV8.pm in order to generate headerguards. I left video disabled, but for those interested in building with HTML5media tags add ENABLE_VIDEO=1 to webkit_common_defines.vsprops and addENABLE_VIDEO to the FEATURE_DEFINES string in the build-generated-files.shscript.
Review URL: http://codereview.chromium.org/8198 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings')
-rw-r--r--webkit/port/bindings/scripts/CodeGeneratorV8.pm23
-rw-r--r--webkit/port/bindings/v8/v8_index.cpp9
-rw-r--r--webkit/port/bindings/v8/v8_index.h19
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp11
4 files changed, 59 insertions, 3 deletions
diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm
index 87353ca..1da6318 100644
--- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm
+++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm
@@ -254,6 +254,8 @@ sub GenerateHeader
# - Add header protection
if ($className =~ /^V8SVG/) {
push(@headerContent, "\n#if ENABLE(SVG)\n");
+ } elsif (IsVideoClassName($className)) {
+ push(@headerContent, "\n#if ENABLE(VIDEO)\n");
}
push(@headerContent, "\n#ifndef $className" . "_H");
@@ -290,6 +292,8 @@ END
if ($className =~ /^V8SVG/) {
push(@headerContent, "\n#endif // ENABLE(SVG)\n");
+ } elsif (IsVideoClassName($className)) {
+ push(@headerContent, "\n#endif // ENABLE(VIDEO)\n");
}
}
@@ -849,6 +853,8 @@ sub GenerateImplementation
if ($className =~ /^V8SVG/) {
push(@implFixedHeader, "#if ENABLE(SVG)\n\n");
+ } elsif (IsVideoClassName($className)) {
+ push(@implFixedHeader, "#if ENABLE(VIDEO)\n\n");
}
if ($className =~ /^V8SVGAnimated/) {
@@ -1211,6 +1217,8 @@ END
if ($className =~ /^V8SVG/) {
push(@implContent, "\n#endif // ENABLE(SVG)\n");
+ } elsif (IsVideoClassName($className)) {
+ push(@implContent, "\n#endif // ENABLE(VIDEO)\n");
}
}
@@ -1431,6 +1439,7 @@ sub IsRefPtrType
return 1 if $type eq "HTMLElement";
return 1 if $type eq "HTMLOptionsCollection";
return 1 if $type eq "ImageData";
+ return 1 if $type eq "MediaError";
return 1 if $type eq "MimeType";
return 1 if $type eq "Node";
return 1 if $type eq "NodeList";
@@ -1442,6 +1451,7 @@ sub IsRefPtrType
return 1 if $type eq "Range";
return 1 if $type eq "Text";
return 1 if $type eq "TextMetrics";
+ return 1 if $type eq "TimeRanges";
return 1 if $type eq "TreeWalker";
return 1 if $type eq "XPathExpression";
return 1 if $type eq "XPathNSResolver";
@@ -1457,6 +1467,19 @@ sub IsRefPtrType
return 0;
}
+sub IsVideoClassName
+{
+ my $class = shift;
+ return 1 if $class eq "V8HTMLAudioElement";
+ return 1 if $class eq "V8HTMLMediaElement";
+ return 1 if $class eq "V8HTMLSourceElement";
+ return 1 if $class eq "V8HTMLVideoElement";
+ return 1 if $class eq "V8MediaError";
+ return 1 if $class eq "V8TimeRanges";
+
+ return 0;
+}
+
sub GetNativeType
{
my $type = shift;
diff --git a/webkit/port/bindings/v8/v8_index.cpp b/webkit/port/bindings/v8/v8_index.cpp
index d785d73..8909b76 100644
--- a/webkit/port/bindings/v8/v8_index.cpp
+++ b/webkit/port/bindings/v8/v8_index.cpp
@@ -343,6 +343,15 @@
#include "V8SVGZoomEvent.h"
#endif
+#if ENABLE(VIDEO)
+#include "V8HTMLAudioElement.h"
+#include "V8HTMLMediaElement.h"
+#include "V8HTMLSourceElement.h"
+#include "V8HTMLVideoElement.h"
+#include "V8MediaError.h"
+#include "V8TimeRanges.h"
+#endif
+
namespace WebCore {
FunctionTemplateFactory V8ClassIndex::GetFactory(V8WrapperType type) {
diff --git a/webkit/port/bindings/v8/v8_index.h b/webkit/port/bindings/v8/v8_index.h
index eb846fd..e192291 100644
--- a/webkit/port/bindings/v8/v8_index.h
+++ b/webkit/port/bindings/v8/v8_index.h
@@ -15,6 +15,19 @@ class XMLHttpRequest;
typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
+#if ENABLE(VIDEO)
+#define VIDEO_HTMLELEMENT_TYPES(V) \
+ V(HTMLAUDIOELEMENT, HTMLAudioElement) \
+ V(HTMLMEDIAELEMENT, HTMLMediaElement) \
+ V(HTMLSOURCEELEMENT, HTMLSourceElement) \
+ V(HTMLVIDEOELEMENT, HTMLVideoElement)
+#define VIDEO_NONNODE_WRAPPER_TYPES(V) \
+ V(MEDIAERROR, MediaError) \
+ V(TIMERANGES, TimeRanges)
+#else
+#define VIDEO_HTMLELEMENT_TYPES(V)
+#define VIDEO_NONNODE_WRAPPER_TYPES(V)
+#endif
#define NODE_WRAPPER_TYPES(V) \
V(ATTR, Attr) \
@@ -91,7 +104,8 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(HTMLTEXTAREAELEMENT, HTMLTextAreaElement) \
V(HTMLTITLEELEMENT, HTMLTitleElement) \
V(HTMLULISTELEMENT, HTMLUListElement) \
- V(HTMLELEMENT, HTMLElement)
+ V(HTMLELEMENT, HTMLElement) \
+ VIDEO_HTMLELEMENT_TYPES(V)
#if ENABLE(SVG_ANIMATION)
#define SVG_ANIMATION_ELEMENT_TYPES(V) \
@@ -297,7 +311,8 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(XPATHEXPRESSION, XPathExpression) \
V(XPATHNSRESOLVER, XPathNSResolver) \
V(XPATHRESULT, XPathResult) \
- V(XSLTPROCESSOR, XSLTProcessor)
+ V(XSLTPROCESSOR, XSLTProcessor) \
+ VIDEO_NONNODE_WRAPPER_TYPES(V)
#if ENABLE(SVG)
#define SVGNODE_WRAPPER_TYPES(V) \
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp
index 4e84ae1..fb92d44 100644
--- a/webkit/port/bindings/v8/v8_proxy.cpp
+++ b/webkit/port/bindings/v8/v8_proxy.cpp
@@ -2225,6 +2225,14 @@ bool V8Proxy::IsWrapperOfType(v8::Handle<v8::Value> value,
return V8ClassIndex::FromInt(type->Int32Value()) == classType;
}
+#if ENABLE(VIDEO)
+#define FOR_EACH_VIDEO_TAG(macro) \
+ macro(audio, AUDIO) \
+ macro(source, SOURCE) \
+ macro(video, VIDEO)
+#else
+#define FOR_EACH_VIDEO_TAG(macro)
+#endif
#define FOR_EACH_TAG(macro) \
macro(a, ANCHOR) \
@@ -2296,7 +2304,8 @@ bool V8Proxy::IsWrapperOfType(v8::Handle<v8::Value> value,
macro(textarea, TEXTAREA) \
macro(title, TITLE) \
macro(ul, ULIST) \
- macro(xmp, PRE)
+ macro(xmp, PRE) \
+ FOR_EACH_VIDEO_TAG(macro)
V8ClassIndex::V8WrapperType V8Proxy::GetHTMLElementType(HTMLElement* element)
{