[Webkit-unassigned] [Bug 70117] Expose HTMLCanvasElement supportsContext

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 4 11:51:10 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=70117





--- Comment #48 from Ruth Fong <ruthiecftg at gmail.com>  2013-06-04 11:49:41 PST ---
(From update of attachment 203625)
View in context: https://bugs.webkit.org/attachment.cgi?id=203625&action=review

I will be submitting a WIP patch soon that 
1) refactors the parsing attributes code used in getContext and supportsContext (I'm reverting back to the original way the parsing was implemented in getContext for now but will talk to Sam in person to better understand his suggestions)
2) includes tests to a) test default values for attributes and b) test the m_context case
3) uses Noam's bug 117181 patch that refactors checking if webgl is properly set

>> Source/WebCore/html/HTMLCanvasElement.cpp:212
>> +    // https://bugs.webkit.org/show_bug.cgi?id=117093
> 
> It doesn’t seem right to me that we should land this patch with untestable code that parses the attributes. We should hold off until we have both halves instead of landing untestable code.

The code that is parsing the attributes is already used in JSHTMLCanvasElement::getContext. 

In my next patch, I'm refactoring it out to a static helper method so both getContext and supportsContext parse attributes the same way. Alternatively, since supportsContext does not yet account for context attributes, in JSHTMLCanvasElement::supportsContext, I can simply instantiate a WebGLContextAttributes object and pass that in (without parsing attributes).

>> Source/WebCore/html/HTMLCanvasElement.cpp:217
>> +        return (!m_context || m_context->is2d());
> 
> In WebKit coding style we normally don’t use the extra parentheses here.
> 
> What is the !m_context case about? I’d like to see test cases covering this.

m_context is the instance of the context object; instantiated in HTMLCanvasElement::getContext. Currently, HTMLCanvasElement::getContext is implemented such that once a context is created, it can't be changed (bug 117095). Thus, if I've already created a 3d context and call supportsContext('2d'), it should return false. 

Looking through the canvas layout tests, I don't think any are testing this; I'll add another test in my next patch.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list