From 10c95f37fb77e7580c8fed4e652d81afe8069023 Mon Sep 17 00:00:00 2001 From: "jianli@chromium.org" Date: Tue, 25 Aug 2009 22:38:31 +0000 Subject: [PATCH] [V8] Fix Canvas layout test failures in Chromium build. https://bugs.webkit.org/show_bug.cgi?id=28720 Reviewed by David Levin. The previous fix r47757 does not handle the V8 object conversion correctly. * bindings/v8/custom/V8DocumentCustom.cpp: (WebCore::CALLBACK_FUNC_DECL): * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: (WebCore::CALLBACK_FUNC_DECL): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47758 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 14 ++++++++++++++ WebCore/bindings/v8/custom/V8DocumentCustom.cpp | 9 ++++++++- WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp | 9 ++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 645dd1f..ae6f9c8 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -2,6 +2,20 @@ Reviewed by David Levin. + [V8] Fix Canvas layout test failures in Chromium build. + https://bugs.webkit.org/show_bug.cgi?id=28720 + + The previous fix r47757 does not handle the V8 object conversion correctly. + + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + +2009-08-25 Jian Li + + Reviewed by David Levin. + [V8] Fix compiling errors in Chromium build caused by Canvas3D changes from r47752. https://bugs.webkit.org/show_bug.cgi?id=28717 diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp index c67d87e..ef199a9 100644 --- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "Document.h" +#include "CanvasRenderingContext.h" #include "ExceptionCode.h" #include "Node.h" #include "XPathNSResolver.h" @@ -93,7 +94,13 @@ CALLBACK_FUNC_DECL(DocumentGetCSSCanvasContext) int width = toInt32(args[2]); int height = toInt32(args[3]); CanvasRenderingContext* result = imp->getCSSCanvasContext(contextId, name, width, height); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT, result); + if (result->is2d()) + return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result); + else { + // FIXME: Add the conversion to CanvasRenderingContext3D when it is hooked up. + ASSERT_NOT_REACHED(); + return v8::Handle(); + } } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index ba381a5..2ed90b9 100644 --- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "HTMLCanvasElement.h" +#include "CanvasRenderingContext.h" #include "V8Binding.h" #include "V8CustomBinding.h" #include "V8Node.h" @@ -45,7 +46,13 @@ CALLBACK_FUNC_DECL(HTMLCanvasElementGetContext) HTMLCanvasElement* imp = V8DOMWrapper::convertDOMWrapperToNode(holder); String contextId = toWebCoreString(args[0]); CanvasRenderingContext* result = imp->getContext(contextId); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT, result); + if (result->is2d()) + return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result); + else { + // FIXME: Add the conversion to CanvasRenderingContext3D when it is hooked up. + ASSERT_NOT_REACHED(); + return v8::Handle(); + } } } // namespace WebCore -- 1.8.3.1