1. 08 Aug, 2015 1 commit
    • Adam Barth's avatar
      Remove the flicker from MimicOverlay · bcd0d8fe
      Adam Barth authored
      There were two problems:
      
      1) When starting the mimic, we put up a bad frame because although we set the
         `begin` value of the animation, we were building using the current `value`,
         which hadn't been updated.
      
      2) When stoping the mimic, we'd dirty a component during didUnmount, which
         wouldn't get cleaned until the next frame. Now we're sure to clean all the
         components before leaving flushBuild.
      bcd0d8fe
  2. 07 Aug, 2015 1 commit
  3. 06 Aug, 2015 1 commit
    • Adam Barth's avatar
      Add widgets for reparenting widgets · 9bed37b5
      Adam Barth authored
      Wrap widgets you want to reparent in a Mimicable widget and assign the
      Mimicable widget a global key. Then, given the same global key to a Mimic
      widget to make it appear elsewhere in the view hierarchy.
      9bed37b5
  4. 05 Aug, 2015 1 commit
  5. 04 Aug, 2015 2 commits
    • Adam Barth's avatar
      Rename widgets/widget.dart to widgets/framework.dart · 054ebbf3
      Adam Barth authored
      It was confusing to have both widget.dart and widgets.dart
      054ebbf3
    • James Robinson's avatar
      Teach event system about disposition and make 'consumed' disposition terminal · 53163f8b
      James Robinson authored
      This introduces the notion of event disposition and allows event
      targets (widgets and render objects) to consume events that should not
      be processed further. This is needed by the Switch component in the
      Drawer in the stocks example. The Switch is embedded in a DrawerItem.
      The Switch handles the gesture tap event to toggle its state and should
      handle pointer events to allow swiping and draw its own radial
      reaction. The DrawerItem also handles gesture taps to allow toggling
      the switch value when tapping anywhere on the drawer and to draw its
      own ink splash. When tapping on the switch, both the switch's render
      object and the DrawerItem's listener are in the event dispatch path.
      The Switch needs to signal in some fashion that it consumed the event
      so the DrawerItem does not also try to toggle the switch's state.
      53163f8b
  6. 31 Jul, 2015 1 commit
    • Adam Barth's avatar
      Stacked does not repaint when its position changes · a98ac70b
      Adam Barth authored
      We were marking the parent *Widget's* render object as needing layout, but
      we actually need to walk up the component tree until we find the parent
      *RenderObjectWrapper* so we can mark actually mark the parent render object as
      needing layout.
      
      Fixes #408
      a98ac70b
  7. 28 Jul, 2015 3 commits
  8. 25 Jul, 2015 2 commits
    • Hixie's avatar
      Scoped focus, so you can have a dialog with input controls and not lose your... · 60177a71
      Hixie authored
      Scoped focus, so you can have a dialog with input controls and not lose your focus in the background.
      
      This introduces a GlobalKey registry so that you can tell when a key
      has gone away (so you can unfocus dead dialogs).
      
      Also I added an assert that you're not calling setState() during a
      build. It turns out that doing so means you have a bug, because since
      you're dirty already (you're building), you won't get rebuilt.
      
      The focus code itself is gnarly. It uses a Component and an internal
      Inherited TagNode to manage the focus state, and does crazy things
      like updating its state during build to pretend retroactively that it
      was built with some other state, once someone asks for focus the first
      time (i.e. the first time it's examined, so you can't tell that it was
      in a different state before). It does this so that it can autofocus
      controls which otherwise wouldn't be focused.
      
      This moves all the focus management into Navigator and showDialog(),
      so the complexity is all buried deep and not visible to apps,
      hopefully.
      
      To do something like two tabs that each have an Input widget that
      needs to be focused when you switch panes, you'd need to have two
      Focus objects, one in each tab, and you need to set their autofocus to
      true (maybe that should be the default?).
      60177a71
    • Hixie's avatar
  9. 23 Jul, 2015 3 commits
    • Hixie's avatar
      Remove the scheduleBuild() API. · 4e289380
      Hixie authored
      I've noticed an anti-pattern emerge where people call scheduleBuild()
      when they think they've changed enough state that they should rebuild,
      instead of just wrapping their changes in setState(). This leads to
      them missing state changes, having extraneous scheduleBuild() calls,
      and other similar bugs.
      
      By removing scheduleBuild(), the only way to actually schedule a build
      now is to call setState(), and hopefully that'll make it much clearer
      that you're only supposed to do this when you change state.
      4e289380
    • Hixie's avatar
      Track global keys globally. · eb90899a
      Hixie authored
      Assert that there are no duplicates.
      Export GlobalKey from basic.dart, so that people don't have to import widgets.dart just for that.
      Fix the "initialFocus" feature which actually didn't work.
      eb90899a
    • Eric Seidel's avatar
      Focus support. · 4da27671
      Eric Seidel authored
      This patch provides a class to manage focus, Focus, and a class to
      manage ownership of the keyboard, KeyboardHandle.
      
      Inherited (in widgets.dart) is adjusted to support subclasses that
      need to copy state from instance to instance.
      
      A GlobalKey key type is introduced that is basically the same as
      UniqueKey. Component classes that need a globally-unique key can
      specify that their 'key' constructor argument is a GlobalKey.
      
      Focus
      -----
      
      You can use `Focus.at(this)` to determine if you, a Component, are
      currently focused.
      
      You can use `Focus.moveTo(this)` to take the focus or give it to a
      particular component.
      
      For this to work, there has to be a Focus class in the widget
      hierarchy.
      
      Currently, there can only be one Focus class, because nested scopes
      aren't supported. We should add support for that in a future patch.
      See issue #229.
      
      KeyboardHandle
      --------------
      
      Instead of directly interacting with the keyboard service, you now ask
      for a KeyboardHandle using `_keyboard.show(client)`. This returns a
      KeyboardHandle class. On that class, you can call `handle.release()`
      when you want to hide the keyboard. If `handle.attached` is still
      true, and you need to reshow the keyboard after the user hid it, then
      you can can `handle.showByRequest()`.
      
      The point of this is that the `keyboard.show()` method maintains the
      invariant that only one KeyboardHandle is live at a time.
      
      There are some issues with the keyboard service that I filed as a
      result of doing this patch: #226 #227
      4da27671
  10. 22 Jul, 2015 3 commits
    • Adam Barth's avatar
      3d0b82eb
    • Hixie's avatar
      Introduce an explicit Key type. · 74575775
      Hixie authored
      This fixes some theoretical bugs whereby we were using hashCode to try
      to get unique keys for objects, but really we wanted object identity.
      It also lays the groundwork for a new GlobalKey concept.
      
      I tried to keep the impact on the code minimal, which is why the "Key"
      constructor is actually a factory that returns a StringKey. The code
      has this class hierarchy:
      
      ```
         KeyBase
          |
         Key--------------+---------------+
          |               |               |
         StringKey    ObjectKey       UniqueKey
      ```
      
      ...where the constructors are Key and Key.stringify (StringKey),
      Key.fromObjectIdentity (ObjectKey), and Key.unique (UniqueKey).
      
      We could instead of factory methods use regular constructors with the
      following hierarchy:
      
      ```
         KeyBase
          |
         LocalKey---------+---------------+
          |               |               |
         Key      ObjectIdentityKey   UniqueKey
      ```
      
      ...with constructors Key, Key.stringify, ObjectIdentityKey, and
      UniqueKey, but I felt that that was maybe a more confusing hierarchy.
      I don't have a strong opinion on this.
      74575775
    • Adam Barth's avatar
      Fix type error found by dartanalyzer --strong · bb8b9c61
      Adam Barth authored
      We were declaring that the function passed to setState should return a
      Function. In reality, we want the function to return void (and everyone calls
      it with a function that returns void).
      bb8b9c61
  11. 21 Jul, 2015 1 commit
  12. 16 Jul, 2015 2 commits
    • Hixie's avatar
      Remove EventTarget, and subsequent fallout. · a77a9c18
      Hixie authored
      The primary goal of this change was to remove EventTarget from the
      sky_engine C++ code. Since EventTarget is so core to the entire event
      system that sky_engine was based on, this is a rather invasive change.
      As such, it had some knock-on effects. I deleted some of the files
      that were affected, and cauterised the remainder.
      
      In many cases, a file would depend on another file that it didn't
      include directly, but instead included indirectly via another file
      that I deleted. When this happened, if the features that this broke
      were obsolete, I sometimes just removed the features instead.
      
      Specifically:
      - removed EventTarget
      - removed EventQueue, since without a target, what's a queue going to
        do?
      - same with EventDispatch*
      - removed ExecutionContext, since it had an EventQueue and nothing
        else it did was relevant to Sky anymore
      - removed ActiveDOMObject, which was all about ExecutionContexts
      - removed ContextLifecycleNotifier since it dependend on
        ExecutionContext and ActiveDOMObject
      - removed the other Lifecycle classes for consistency, and replaced
        them with four booleans in the Document class
      - removed some of the attributes that are no longer relevant from
        IDLExtendedAttributes (ConstructorCallWith and
        CallWith=ExecutionContext)
      - removed the Document member on DOMDartState since we never set it to
        anything but null.
      - removed BuiltinSky::InstallWindow since it relied on the Document
        member of DOMDartState
      - removed EventHandler, EventListener, and mentions of those in
        various binding scripts
      - removed NewEventHandler, since we're not using that either
      - removed the following interfaces from the Sky Dart API:
        - EventTarget
        - EventListener (since without a target, there's no way to listen)
        - FocusEvent (since it's only member was an EventTarget)
        - HashChangeEvent (mostly by accident, but it's defunct anyway)
        - FontFace (it used ConstructorCallWith=ExecutionContext)
      - changed the following interfaces of the Sky DART API:
        - MediaQueryList is no longer an EventTarget
        - Node is no longer an EventTarget
        - Document no longer has defaultView (depended on
          DOMDartState's document)
        - DocumentFragment, Element, Range, and Text no longer have a
          constructor (they all depended on DOMDartState's document, which
          is now gone)
        - Event lost its EventTarget members and path.
        - Window lost its WindowTimers partial interface (it used
          EventTarget and ExecutionContext a lot)
      - removed numerous hacks in the bindings around features that are now
        gone, like addEventListener
      - removed a bunch of console logging code, since that relied on
        ExecutionContext
      - cauterised the wound in FontFace.cpp by removing constructors and
        methods that called now-removed features
      - same with MediaQuery and friends
      - same with some editor features and focus-related features
      - same with Document
      - removed DOMTimer classes since they use ExecutionContexts
      a77a9c18
    • Collin Jackson's avatar