Commit f2decb09 authored by jianli@chromium.org's avatar jianli@chromium.org

[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: http://svn.webkit.org/repository/webkit/trunk@47758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 02c6f6a5
2009-08-25 Jian Li <jianli@chromium.org>
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 <jianli@chromium.org>
Reviewed by David Levin.
......@@ -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<v8::Value>();
}
}
} // namespace WebCore
......@@ -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<HTMLCanvasElement>(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<v8::Value>();
}
}
} // namespace WebCore
......
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