Diff
Modified: trunk/LayoutTests/ChangeLog (128373 => 128374)
--- trunk/LayoutTests/ChangeLog 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/LayoutTests/ChangeLog 2012-09-12 22:43:54 UTC (rev 128374)
@@ -1,3 +1,15 @@
+2012-09-12 Adam Barth <aba...@webkit.org>
+
+ [v8] document.getCSSCanvasContext doesn't need to be custom
+ https://bugs.webkit.org/show_bug.cgi?id=96560
+
+ Reviewed by Eric Seidel.
+
+ Test that document.getCSSCanvasContext returns null for a bogus canvas type.
+
+ * fast/canvas/canvas-css-crazy-expected.txt: Added.
+ * fast/canvas/canvas-css-crazy.html: Added.
+
2012-09-12 Joshua Bell <jsb...@chromium.org>
IndexedDB: The |source| property of IDBFactory.open() request should be null
Added: trunk/LayoutTests/fast/canvas/canvas-css-crazy-expected.txt (0 => 128374)
--- trunk/LayoutTests/fast/canvas/canvas-css-crazy-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-css-crazy-expected.txt 2012-09-12 22:43:54 UTC (rev 128374)
@@ -0,0 +1,2 @@
+ALERT: PASS
+
Added: trunk/LayoutTests/fast/canvas/canvas-css-crazy.html (0 => 128374)
--- trunk/LayoutTests/fast/canvas/canvas-css-crazy.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-css-crazy.html 2012-09-12 22:43:54 UTC (rev 128374)
@@ -0,0 +1,21 @@
+<html>
+ <head>
+ <style>
+ div { background: -webkit-canvas(squares); width:600px; height:600px; border:2px solid black }
+ </style>
+ <script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+function draw(w, h) {
+ var ctx = document.getCSSCanvasContext("4d", "squares", w, h);
+ if (ctx !== null)
+ alert("FAIL! ctx wasn't null: " + ctx);
+ alert("PASS");
+}
+ </script>
+ </head>
+ <body _onload_="draw(300, 300)">
+ <div></div>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (128373 => 128374)
--- trunk/Source/WebCore/ChangeLog 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/ChangeLog 2012-09-12 22:43:54 UTC (rev 128374)
@@ -1,3 +1,22 @@
+2012-09-12 Adam Barth <aba...@webkit.org>
+
+ [v8] document.getCSSCanvasContext doesn't need to be custom
+ https://bugs.webkit.org/show_bug.cgi?id=96560
+
+ Reviewed by Eric Seidel.
+
+ Instead of having a special case for toV8(CanvasRenderingContext*)
+ inlined into this custom function, we should just make the toV8
+ function itself custom.
+
+ Test: fast/canvas/canvas-css-crazy.html
+
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ * dom/Document.idl:
+ * html/canvas/CanvasRenderingContext.idl:
+
2012-09-12 Eric Seidel <e...@webkit.org>
HTML parser fails to propertly close 4 identical nested formatting elements
Modified: trunk/Source/WebCore/UseV8.cmake (128373 => 128374)
--- trunk/Source/WebCore/UseV8.cmake 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/UseV8.cmake 2012-09-12 22:43:54 UTC (rev 128374)
@@ -82,6 +82,7 @@
bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
bindings/v8/custom/V8CSSValueCustom.cpp
bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+ bindings/v8/custom/V8CanvasRenderingContextCustom.cpp
bindings/v8/custom/V8ClipboardCustom.cpp
bindings/v8/custom/V8ConsoleCustom.cpp
bindings/v8/custom/V8CoordinatesCustom.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (128373 => 128374)
--- trunk/Source/WebCore/WebCore.gypi 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/WebCore.gypi 2012-09-12 22:43:54 UTC (rev 128374)
@@ -2351,6 +2351,7 @@
'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp',
'bindings/v8/custom/V8CSSValueCustom.cpp',
'bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp',
+ 'bindings/v8/custom/V8CanvasRenderingContextCustom.cpp',
'bindings/v8/custom/V8ClipboardCustom.cpp',
'bindings/v8/custom/V8ConsoleCustom.cpp',
'bindings/v8/custom/V8CoordinatesCustom.cpp',
Added: trunk/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp (0 => 128374)
--- trunk/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp 2012-09-12 22:43:54 UTC (rev 128374)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007-2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8CanvasRenderingContext.h"
+
+#include "CanvasRenderingContext.h"
+#include "V8CanvasRenderingContext2D.h"
+#if ENABLE(WEBGL)
+#include "V8WebGLRenderingContext.h"
+#endif
+
+namespace WebCore {
+
+v8::Handle<v8::Value> toV8(CanvasRenderingContext* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (!impl)
+ return v8NullWithCheck(isolate);
+ if (impl->is2d())
+ return toV8(static_cast<CanvasRenderingContext2D*>(impl), creationContext, isolate);
+#if ENABLE(WEBGL)
+ if (impl->is3d())
+ return toV8(static_cast<WebGLRenderingContext*>(impl), creationContext, isolate);
+#endif
+ ASSERT_NOT_REACHED();
+ return v8NullWithCheck(isolate);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp (128373 => 128374)
--- trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp 2012-09-12 22:43:54 UTC (rev 128374)
@@ -95,28 +95,6 @@
return toV8(result.release(), args.Holder(), args.GetIsolate());
}
-v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.Document.getCSSCanvasContext");
- v8::Handle<v8::Object> holder = args.Holder();
- Document* imp = V8Document::toNative(holder);
- String contextId = toWebCoreString(args[0]);
- String name = toWebCoreString(args[1]);
- int width = toInt32(args[2]);
- int height = toInt32(args[3]);
- CanvasRenderingContext* result = imp->getCSSCanvasContext(contextId, name, width, height);
- if (!result)
- return v8::Undefined();
- if (result->is2d())
- return toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
-#if ENABLE(WEBGL)
- else if (result->is3d())
- return toV8(static_cast<WebGLRenderingContext*>(result), args.Holder(), args.GetIsolate());
-#endif // ENABLE(WEBGL)
- ASSERT_NOT_REACHED();
- return v8::Undefined();
-}
-
v8::Handle<v8::Value> toV8(Document* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate, bool forceNewObject)
{
if (!impl)
Modified: trunk/Source/WebCore/dom/Document.idl (128373 => 128374)
--- trunk/Source/WebCore/dom/Document.idl 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/dom/Document.idl 2012-09-12 22:43:54 UTC (rev 128374)
@@ -237,7 +237,7 @@
#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
- [V8Custom] DOMObject getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height);
+ CanvasRenderingContext getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height);
#endif
#endif
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.idl (128373 => 128374)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.idl 2012-09-12 22:40:15 UTC (rev 128373)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.idl 2012-09-12 22:43:54 UTC (rev 128374)
@@ -28,11 +28,9 @@
interface [
JSCustomMarkFunction,
JSGenerateIsReachable,
- JSCustomToJSObject
+ CustomToJSObject
] CanvasRenderingContext {
-
readonly attribute HTMLCanvasElement canvas;
};
}
-