[Webkit-unassigned] [Bug 67458] Generate a WebKitCSSMatrix constructor of V8 using the IDL 'Constructor' extended attribute

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 2 11:44:07 PDT 2011


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





--- Comment #13 from Kentaro Hara <haraken at google.com>  2011-09-02 11:44:07 PST ---
> > - WebKitCSSMatrix() -> a null string is passed to WebKitCSSMatrix::create().
> > - WebKitCSSMatrix(null) -> a string "null" is passed to WebKitCSSMatrix::create().
> > - WebKitCSSMatrix(undefined) -> a string "undefined" is passed to WebKitCSSMatrix::create().
> 
> This strikes me as very un-JSy: in JS foo() and foo(undefined) is almost indistingishable and it appears sketchy to me distingish between those in DOM.

I feel so! However, the spec does not say so (http://www.w3.org/TR/WebIDL/#es-DOMString and http://www.w3.org/TR/WebIDL/#es-interface-call). You can find the similar discussion here (https://bugs.webkit.org/show_bug.cgi?id=62288).

> > I guess that adding another policy would not solve this problem. The essence is that in the current implementation there is no way to create a V8Parameter object that expresses a null String (or AtomicString). This patch enables to create the V8Parameter object that expresses a null String.
> 
> If by null string you mean result of String() (or isNull()), then apparently V8Parameter<WithNullCheck> and V8Parameter<WithUndefinedOrNullCheck> provide exactly null strings in the proper conditions.  If you really like (but I honestly find it pretty much unJSy), you can implement <WithEmptyCheck> which will give you exactly your semantics.

Hmmm, sorry for the confusion but I still think that we cannot implement <WithEmptyCheck>.

The current implementation does not have a V8Parameter constructor with no arguments. Thus, the following code is not allowed:

(Code I):
    V8Parameter<> cssValue;
    if (args.Length() >= 1)
        cssValue = V8Parameter<>(args[0]);

Instead, we will need to write as follows:

(Code II):
    V8Parameter<> cssValue(args[0]);

Here, please note that args[0] returns v8::Undefined() if args[0] does not exist. args[0] also returns v8::Undefined() if args[0] exists and the value is undefined. Therefore, we cannot distinguish inside V8Parameter code whether the argument is omitted or the value of argument is undefined. To distinguish these two cases, I think that we need to allow a V8Parameter constructor with no arguments and write a code like the Code I.

-- 
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