Changeset 60979 in webkit


Ignore:
Timestamp:
Jun 10, 2010 3:44:46 PM (14 years ago)
Author:
kbr@google.com
Message:

2010-06-10 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D
https://bugs.webkit.org/show_bug.cgi?id=40443

Deleted custom JSC bindings for bufferData, texImage2D and
texSubImage2D and fixed minor associated issues in code generator
and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt,
which now runs as intended. Ran all layout tests, including WebGL
tests, in Safari.

  • bindings/js/JSWebGLRenderingContextCustom.cpp:
    • Deleted custom bindings.
  • bindings/scripts/CodeGeneratorJS.pm:
    • Made overload helper functions static to fix compiler warnings.
    • Added needed isObject check for overloads between object and non-object arguments.
  • html/HTMLCanvasElement.idl:
  • html/HTMLImageElement.idl:
  • html/HTMLVideoElement.idl:
    • Added GenerateNativeConverter extended attribute.
  • html/canvas/WebGLRenderingContext.idl:
    • Deleted #ifdefs for custom JSC bindings.

2010-06-10 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D
https://bugs.webkit.org/show_bug.cgi?id=40443

Deleted custom JSC bindings for bufferData, texImage2D and
texSubImage2D and fixed minor associated issues in code generator
and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt,
which now runs as intended. Ran all layout tests, including WebGL
tests, in Safari.

  • fast/canvas/webgl/script-tests/texImageTest.js:
  • fast/canvas/webgl/texImageTest-expected.txt:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r60970 r60979  
     12010-06-10  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D
     6        https://bugs.webkit.org/show_bug.cgi?id=40443
     7
     8        Deleted custom JSC bindings for bufferData, texImage2D and
     9        texSubImage2D and fixed minor associated issues in code generator
     10        and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt,
     11        which now runs as intended. Ran all layout tests, including WebGL
     12        tests, in Safari.
     13
     14        * fast/canvas/webgl/script-tests/texImageTest.js:
     15        * fast/canvas/webgl/texImageTest-expected.txt:
     16
    1172010-06-10  Robert Hogan  <robert@webkit.org>
    218
  • trunk/LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js

    r58161 r60979  
    2020shouldThrow("context.texSubImage2D(context.TEXTURE_2D)");
    2121shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, null)");
    22 // FIXME: The following test fails on JSC: https://bugs.webkit.org/show_bug.cgi?id=38024
    2322shouldThrow("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
    2423shouldThrow("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0)");
  • trunk/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt

    r58161 r60979  
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    5 PASS context.texImage2D(context.TEXTURE_2D) threw exception SyntaxError: Syntax error.
     5PASS context.texImage2D(context.TEXTURE_2D) threw exception TypeError: Type error.
    66PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
    7 PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception SyntaxError: Syntax error.
     7PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
    88PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array) is undefined.
    99PASS context.texImage2D(context.TEXTURE_2D, 0, imageData, true) is undefined.
     
    1111PASS context.texImage2D(context.TEXTURE_2D, 0, canvas2d, false) is undefined.
    1212PASS context.texImage2D(context.TEXTURE_2D, 0, video, true, false) is undefined.
    13 PASS context.texSubImage2D(context.TEXTURE_2D) threw exception SyntaxError: Syntax error.
     13PASS context.texSubImage2D(context.TEXTURE_2D) threw exception TypeError: Type error.
    1414PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
    15 FAIL context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0) should throw an exception. Was undefined.
    16 PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0) threw exception SyntaxError: Syntax error.
     15PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
     16PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0) threw exception TypeError: Type error.
    1717PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, imageData, false) is undefined.
    1818PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, image) is undefined.
  • trunk/WebCore/ChangeLog

    r60974 r60979  
     12010-06-10  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Delete custom JSC bindings for bufferData, texImage2D and texSubImage2D
     6        https://bugs.webkit.org/show_bug.cgi?id=40443
     7
     8        Deleted custom JSC bindings for bufferData, texImage2D and
     9        texSubImage2D and fixed minor associated issues in code generator
     10        and IDL. Updated fast/canvas/webgl/texImageTest-expected.txt,
     11        which now runs as intended. Ran all layout tests, including WebGL
     12        tests, in Safari.
     13
     14        * bindings/js/JSWebGLRenderingContextCustom.cpp:
     15         - Deleted custom bindings.
     16        * bindings/scripts/CodeGeneratorJS.pm:
     17         - Made overload helper functions static to fix compiler warnings.
     18         - Added needed isObject check for overloads between object and non-object arguments.
     19        * html/HTMLCanvasElement.idl:
     20        * html/HTMLImageElement.idl:
     21        * html/HTMLVideoElement.idl:
     22         - Added GenerateNativeConverter extended attribute.
     23        * html/canvas/WebGLRenderingContext.idl:
     24         - Deleted #ifdefs for custom JSC bindings.
     25
    1262010-06-10  David Hyatt  <hyatt@apple.com>
    227
  • trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp

    r60902 r60979  
    6767
    6868namespace WebCore {
    69 
    70 JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec)
    71 {
    72     if (exec->argumentCount() != 3)
    73         return throwSyntaxError(exec);
    74 
    75     unsigned target = exec->argument(0).toInt32(exec);
    76     unsigned usage = exec->argument(2).toInt32(exec);
    77     ExceptionCode ec = 0;
    78 
    79     // If argument 1 is a number, we are initializing this buffer to that size
    80     if (!exec->argument(1).isObject()) {
    81         unsigned int count = exec->argument(1).toInt32(exec);
    82         static_cast<WebGLRenderingContext*>(impl())->bufferData(target, count, usage, ec);
    83     } else {
    84         ArrayBufferView* array = toArrayBufferView(exec->argument(1));
    85         static_cast<WebGLRenderingContext*>(impl())->bufferData(target, array, usage, ec);
    86     }
    87 
    88     setDOMException(exec, ec);
    89     return jsUndefined();
    90 }
    91 
    92 JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec)
    93 {
    94     if (exec->argumentCount() != 3)
    95         return throwSyntaxError(exec);
    96 
    97     unsigned target = exec->argument(0).toInt32(exec);
    98     unsigned offset = exec->argument(1).toInt32(exec);
    99     ExceptionCode ec = 0;
    100    
    101     ArrayBufferView* array = toArrayBufferView(exec->argument(2));
    102    
    103     static_cast<WebGLRenderingContext*>(impl())->bufferSubData(target, offset, array, ec);
    104 
    105     setDOMException(exec, ec);
    106     return jsUndefined();
    107 }
    10869
    10970static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebGLGetInfo& info)
     
    312273}
    313274
    314 //   void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, in ArrayBufferView pixels);
    315 //   void texImage2D(in GLenum target, in GLint level, in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
    316 //   void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
    317 //   void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
    318 //   void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
    319 JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec)
    320 {
    321     if (exec->argumentCount() < 3 || exec->argumentCount() > 9)
    322         return throwSyntaxError(exec);
    323 
    324     ExceptionCode ec = 0;
    325    
    326     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());   
    327     unsigned target = exec->argument(0).toInt32(exec);
    328     if (exec->hadException())   
    329         return jsUndefined();
    330    
    331     unsigned level = exec->argument(1).toInt32(exec);
    332     if (exec->hadException())   
    333         return jsUndefined();
    334 
    335     JSObject* o = 0;
    336    
    337     if (exec->argumentCount() <= 5) {
    338         // This is one of the last 4 forms. Param 2 can be ImageData or <img>, <canvas> or <video> element.
    339         JSValue value = exec->argument(2);
    340    
    341         if (!value.isObject())
    342             return throwTypeError(exec);
    343        
    344         o = asObject(value);
    345        
    346         bool flipY = exec->argument(3).toBoolean(exec);
    347         bool premultiplyAlpha = exec->argument(4).toBoolean(exec);
    348        
    349         if (o->inherits(&JSImageData::s_info)) {
    350             ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl());
    351             context->texImage2D(target, level, data, flipY, premultiplyAlpha, ec);
    352         } else if (o->inherits(&JSHTMLImageElement::s_info)) {
    353             HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl());
    354             context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
    355         } else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
    356             HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl());
    357             context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
    358 #if ENABLE(VIDEO)
    359         } else if (o->inherits(&JSHTMLVideoElement::s_info)) {
    360             HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl());
    361             context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
    362 #endif
    363         } else
    364             ec = TYPE_MISMATCH_ERR;
    365     } else {
    366         if (exec->argumentCount() != 9)
    367             return throwSyntaxError(exec);
    368 
    369         // This must be the ArrayBufferView case
    370         unsigned internalformat = exec->argument(2).toInt32(exec);
    371         if (exec->hadException())   
    372             return jsUndefined();
    373 
    374         unsigned width = exec->argument(3).toInt32(exec);
    375         if (exec->hadException())   
    376             return jsUndefined();
    377 
    378         unsigned height = exec->argument(4).toInt32(exec);
    379         if (exec->hadException())   
    380             return jsUndefined();
    381 
    382         unsigned border = exec->argument(5).toInt32(exec);
    383         if (exec->hadException())   
    384             return jsUndefined();
    385 
    386         unsigned format = exec->argument(6).toInt32(exec);
    387         if (exec->hadException())   
    388             return jsUndefined();
    389 
    390         unsigned type = exec->argument(7).toInt32(exec);
    391         if (exec->hadException())   
    392             return jsUndefined();
    393 
    394         JSValue value = exec->argument(8);
    395            
    396         // For this case passing 0 (for a null array) is allowed
    397         if (value.isNull())
    398             context->texImage2D(target, level, internalformat, width, height, border, format, type, 0, ec);
    399         else if (value.isObject()) {
    400             o = asObject(value);
    401            
    402             if (o->inherits(&JSArrayBufferView::s_info)) {
    403                 // FIXME: Need to check to make sure ArrayBufferView is a Int8Array or Int16Array,
    404                 // depending on the passed type parameter.
    405                 ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl());
    406                 context->texImage2D(target, level, internalformat, width, height, border, format, type, obj, ec);
    407             } else
    408                 return throwTypeError(exec);
    409         } else
    410             return throwTypeError(exec);
    411     }
    412    
    413     setDOMException(exec, ec);
    414     return jsUndefined();   
    415 }
    416 
    417 //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in GLsizei width, in GLsizei height, in GLenum format, in GLenum type, in ArrayBufferView pixels);
    418 //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
    419 //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
    420 //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
    421 //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
    422 JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec)
    423 {
    424     if (exec->argumentCount() < 5 || exec->argumentCount() > 9)
    425         return throwSyntaxError(exec);
    426 
    427     ExceptionCode ec = 0;
    428 
    429     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());   
    430     unsigned target = exec->argument(0).toInt32(exec);
    431     if (exec->hadException())   
    432         return jsUndefined();
    433 
    434     unsigned level = exec->argument(1).toInt32(exec);
    435     if (exec->hadException())   
    436         return jsUndefined();
    437    
    438     unsigned xoff = exec->argument(2).toInt32(exec);
    439     if (exec->hadException())   
    440         return jsUndefined();
    441    
    442     unsigned yoff = exec->argument(3).toInt32(exec);
    443     if (exec->hadException())   
    444         return jsUndefined();
    445    
    446     JSObject* o = 0;
    447        
    448     if (exec->argumentCount() <= 7) {
    449         // This is one of the last 4 forms. Param 4 can be <img>, <canvas> or <video> element, of the format param.
    450         JSValue value = exec->argument(4);
    451 
    452         if (!value.isObject())
    453             return throwSyntaxError(exec);
    454 
    455         o = asObject(value);
    456 
    457         bool flipY = exec->argument(5).toBoolean(exec);
    458         bool premultiplyAlpha = exec->argument(6).toBoolean(exec);
    459        
    460         if (o->inherits(&JSImageData::s_info)) {
    461             ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl());
    462             context->texSubImage2D(target, level, xoff, yoff, data, flipY, premultiplyAlpha, ec);
    463         } else if (o->inherits(&JSHTMLImageElement::s_info)) {
    464             HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl());
    465             context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
    466         } else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
    467             HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl());
    468             context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
    469 #if ENABLE(VIDEO)
    470         } else if (o->inherits(&JSHTMLVideoElement::s_info)) {
    471             HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl());
    472             context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
    473 #endif
    474         } else
    475             ec = TYPE_MISMATCH_ERR;
    476     } else {
    477         // This must be the ArrayBufferView form
    478         if (exec->argumentCount() != 9)
    479             return throwSyntaxError(exec);
    480 
    481         unsigned width = exec->argument(4).toInt32(exec);
    482         if (exec->hadException())   
    483             return jsUndefined();
    484        
    485         unsigned height = exec->argument(5).toInt32(exec);
    486         if (exec->hadException())   
    487             return jsUndefined();
    488        
    489         unsigned format = exec->argument(6).toInt32(exec);
    490         if (exec->hadException())   
    491             return jsUndefined();
    492        
    493         unsigned type = exec->argument(7).toInt32(exec);
    494         if (exec->hadException())   
    495             return jsUndefined();
    496        
    497         JSValue value = exec->argument(8);
    498         if (!value.isObject())
    499             context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, 0, ec);
    500         else {
    501             o = asObject(value);
    502        
    503             if (o->inherits(&JSArrayBufferView::s_info)) {
    504                 ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl());
    505                 context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, obj, ec);
    506             } else
    507                 return throwTypeError(exec);
    508         }
    509     }
    510    
    511     setDOMException(exec, ec);
    512     return jsUndefined();
    513 }
    514 
    515275template<typename T, size_t inlineCapacity>
    516276bool toVector(JSC::ExecState* exec, JSC::JSValue value, Vector<T, inlineCapacity>& vector)
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r60952 r60979  
    11161116        # be converted to a string via .toString).
    11171117        push(@andExpression, "(${value}.isNull() || ${value}.isUndefined() || ${value}.isString() || ${value}.isObject())") if $codeGenerator->IsStringType($type);
    1118         push(@andExpression, "(${value}.isNull() || asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type);
     1118        push(@andExpression, "(${value}.isNull() || ${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type);
    11191119
    11201120        $parameterIndex++;
     
    17871787                # Append a number to an overloaded method's name to make it unique:
    17881788                $functionName = $functionName . $function->{overloadIndex};
     1789                # Make this function static to avoid compiler warnings, since we
     1790                # don't generate a prototype for it in the header.
     1791                push(@implContent, "static ");
    17891792            }
    17901793           
  • trunk/WebCore/html/HTMLCanvasElement.idl

    r60784 r60979  
    2828
    2929    interface [
    30         CustomMarkFunction
     30        CustomMarkFunction,
     31        GenerateNativeConverter
    3132    ] HTMLCanvasElement : HTMLElement {
    3233
  • trunk/WebCore/html/HTMLImageElement.idl

    r52921 r60979  
    2121module html {
    2222
    23     interface HTMLImageElement : HTMLElement {
     23    interface [
     24        GenerateNativeConverter
     25    ] HTMLImageElement : HTMLElement {
    2426                 attribute [ConvertNullToNullString, Reflect] DOMString name;
    2527                 attribute [ConvertNullToNullString, Reflect] DOMString align;
  • trunk/WebCore/html/HTMLVideoElement.idl

    r55946 r60979  
    2525
    2626module html {
    27     interface [Conditional=VIDEO] HTMLVideoElement : HTMLMediaElement {
     27    interface [
     28        Conditional=VIDEO,
     29        GenerateNativeConverter
     30    ] HTMLVideoElement : HTMLMediaElement {
    2831        attribute unsigned long width;
    2932        attribute unsigned long height;
  • trunk/WebCore/html/canvas/WebGLRenderingContext.idl

    r60914 r60979  
    475475        void         blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha);
    476476
    477 #if defined(V8_BINDING) && V8_BINDING
    478477        void         bufferData(in unsigned long target, in ArrayBufferView data, in unsigned long usage) raises (DOMException);
    479478        void         bufferData(in unsigned long target, in long size, in unsigned long usage) raises (DOMException);
    480479        void         bufferSubData(in unsigned long target, in long offset, in ArrayBufferView data) raises (DOMException);
    481 #else
    482         // FIXME: Unfork once JSC supports overload generation too.
    483         [Custom] void bufferData() raises(DOMException);
    484         [Custom] void bufferSubData() raises(DOMException);
    485 #endif
    486480
    487481        unsigned long checkFramebufferStatus(in unsigned long target);
     
    614608
    615609        // Supported forms:
    616 #if defined(V8_BINDING) && V8_BINDING
    617610        void         texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height,
    618611                                in long border, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises (DOMException);
     
    637630        void         texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset,
    638631                                   in HTMLVideoElement video, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException);
    639 #else
    640         // FIXME: Unfork once JSC supports overload generation too.
    641         [Custom] void texImage2D();
    642         [Custom] void texSubImage2D();
    643 #endif
     632
    644633        void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException);
    645634        [Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException);
Note: See TracChangeset for help on using the changeset viewer.