[Webkit-unassigned] [Bug 91076] [CSS Regions] Add the Region interface and the getRegions() API call

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 24 18:19:19 PDT 2012


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





--- Comment #18 from Adam Barth <abarth at webkit.org>  2012-07-24 18:19:19 PST ---
(From update of attachment 154048)
View in context: https://bugs.webkit.org/attachment.cgi?id=154048&action=review

> Source/WebCore/bindings/js/JSCSSRegionCustom.cpp:47
> +JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRegion* target)
> +{
> +    if (!target)
> +        return jsNull();
> +
> +    // FIXME: Add support for pseudo-elements as well
> +    Element* elementRegion = static_cast<Element*>(target);
> +    return toJS(exec, globalObject, static_cast<Node*>(elementRegion));
> +}

The main thing we need to do is teach the code generate how to generate this sort of toJS function.  The approach used in this implementation doesn't scale to the case where we actually have more than one type of object implementing Region.  Here you're using static_cast<Element*>, which works because there isn't any other possibility.  If there were two possibilities, we'd need to use something like dynamic_cast, which we have disabled.

I'd really prefer if the Regions spec didn't use this form of fake multiple inheritance.  It seems like a large amount of complexity to incur just to use the type Region instead of Element.  However, I'm willing to believe there are considerations that I'm not aware of.  If we need to build a dynamic_cast-like mechanism for JS wrappers, we should also consider the other cases in which we've hand-built dynamic_cast-like machanisms in toJS functions.  Those include Nodes, Exceptions, Events, and EventTargets.

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