On 7/29/16, 4:07 PM, "Alex Harui" <aha...@adobe.com> wrote:

>Related thought, so I don't forget: It isn't clear that CSSShape and
>CSSTextField which are only used in SWF implementations needed to become
>HTMLElementWrappers.

Or more accurately, that CSSShape, CSSSprite, and CSSTextField shouldn't
wrap a Shape, Sprite, TextField, but go back to just subclassing Shape,
Sprite, TextField.  These classes are leaves of the DOM tree only for SWFs
so really, there aren't any APIs to hide on them.


The pain point of not wrapping those classes is that, by wrapping elements
in the SWF implementation, we were able to change the UIBase parent
property to be an IParent instead of DisplayObjectContainer which would
definitely be an improvement by removing on of the few Flash APIs that
were still in the FlexJS API surface.  But if CSSShape subclasses Shape
instead of wrapping it, its parent property would again be
DisplayObjectContainer so CSSShape couldn't be an IChild..  That might
force us to have code in addElement that does something like:

  if (child is IChild)
  {
    $sprite.addChild(child.$displayObject)
    child.parent = this;
  }
  else
    $sprite.addChild(child as DisplayObject)

Right now there is no if statement.

Related, while digging through this, I added the flexjs_wrapper getter to
IFlexJSElement.  I first tried to give it the type HTMLElementWrapper, but
that didn't work for CSSShape and friends since they don't subclass
HTMLElementWrapper in part because HTMLElementWrapper is also a Strand and
these low-level classes don't need to take beads.

So now, I'm pondering a couple of deeper refactors.  One is something like:
-create a ElementWrapper class.  It has an element property.
-create a UIElementWrapper class.  It subclasses WrappedElement and adds
parent, x, y, width, height, visible, alpha that proxy to the element.
-rename HTMLElementWrapper to FlexJSElementWrapper.  It would add the
strand implementation.
-CSSShape and friends subclass UIElementWrapper
-HTTPService subclasses ElementWrapper
-UIBase and Application subclass FlexJSElementWrapper

Or, 

-create a ElementWrapper class.  It has an element property.
-rename HTMLElementWrapper to UIElementWrapper.  It would add the strand
implementation and and adds parent, x, y, width, height, visible, alpha
that proxy to the element
-CSSShape and friends subclass Shape and friends so addElement has the if
statement shown earlier
-HTTPService subclasses ElementWrapper
-UIBase and Application subclass UIElementWrapper

Of course, I could have missed something.

Thoughts?  I'm done for today.  Will check in my morning.

-Alex

Reply via email to