1305 Commits

Author SHA1 Message Date
Greg Spencer
ed90d05596
Fix needsCompositing propagation from child widgets. (#32717)
This fixes propagation of needsCompositing from child widgets.

When needsCompositing is turned on by a child widget, it necessarily sets the needsCompositing bit of its parent widget, but RenderPointerListener was ignoring that piece of information and only turning on compositing if it thought it needed it for itself.

This corrects that, and adds a test for the condition, and updates a test that was affected by the change.

Fixes #32525 (again)
2019-05-14 17:09:29 -07:00
Greg Spencer
96ebfec1a3
Add diagnostics around needsCompositing (#32656)
Added diagnostic output for needsCompositing to RenderObject diagnostics output.
2019-05-14 08:02:25 -07:00
Greg Spencer
a5053bfb29
Fix transforms for things with RenderPointerListeners (#32535)
This fixes #32525, because it now marks the compositing bits as needing to be recalculated if the mouse tracker changes its idea of whether or not a mouse is attached.

This bug occurred because the test framework was leaking state from one test to the next (the state about whether a mouse pointer was active), and so even though there was a "passing" test when run in order with the other tests in the file, when the test was run individually (or first), it would have failed and caught the bug.

This adds an assert to make sure that after each test there are no simulated mouse pointers connected, and now calls removePointer in all of the tests where this was a problem.
2019-05-13 15:48:12 -07:00
liyuqian
06f86c8b2f
Reland matrix check (#32521)
This relands flutter/flutter#31701 with missing const added

This reverts commit 549b412656bb4db80920de56a09912e079fdd2a2.
2019-05-13 14:36:09 -07:00
Dan Field
382704ca95
Use precisionErrorTolerance (#32499) 2019-05-10 13:28:19 -07:00
Jonah Williams
549b412656
Revert "Add more asserts to check matrix validity (#31701)" (#32496) 2019-05-10 10:05:15 -07:00
liyuqian
0dc290c023
Add more asserts to check matrix validity (#31701)
## Description

These will help identify where the matrix starts to get wrong. 

Also fixed `RenderFittexBox` to no longer paint with empty child which previously triggered invalid matrix computations (NaN with dividing by 0). See also https://github.com/flutter/flutter/pull/7489

## Related Issues

https://github.com/flutter/flutter/issues/31650
https://github.com/flutter/flutter/issues/31700
https://github.com/flutter/flutter/issues/7431

## Tests

* RenderFittedBox does not paint with empty sizes
2019-05-10 09:33:09 -07:00
Efthymis Sarmpanis
b24f1f78a7 Add breadcrumbs to TextOverflow (#32328) 2019-05-10 13:29:31 +02:00
Greg Spencer
66a6726306
Fix benchmark regression in layer.find<S>(Offset) (#32425)
This fixes a benchmark regression introduced in #32350. The performance is improved by just reverting the Layer.find<S> routines to use their old definitions, instead of defining them in terms of the findAll<S> lazy iterators.

Fixes #32387
2019-05-09 12:25:52 -07:00
Michael Goderbauer
1621baafc7
Introduce separate HitTestResults for Box and Sliver (#31894) 2019-05-09 10:00:01 +02:00
Greg Spencer
aeccd6a8bc
Fix nested listeners so that ancestor listeners can also receive enter/exit/move events. (#32350)
This changes Listener to trigger enter/move/exit in all Listeners below the pointer, not just the leaf region (the first region hit). This is because we need to allow listeners to be nested so that, say, a widget that handles changing color on hover, but also is wrapped in a Tooltip (that handles hover) can trigger both actions, not just one.

To that end, I added a findAll to Layer, similar to the existing find method that was previously used. It returns an iterator over annotated layers which match the given data type.

Since the findAll is implemented as returning an Iterable (and is sync*), I re-implemented the find routines as just returning the first result from findAll, since that should be just as efficient, and would then prevent duplication in the implementation.
2019-05-08 17:57:42 -07:00
Greg Spencer
23baae0e45
Fix RenderPointerListener so that callbacks aren't called at the wrong time. (#32142)
I recently added some code to keep hover events from being propagated when a mouse wasn't attached. While that works, there are times when it can fire callbacks during the building of other components, since they can now be called from detach/attach. This is not ideal, since it will assert then. This changes the code so that it won't update the annotations during attach/detach, but also won't push the annotation layer unless a mouse is connected, achieving the same result as before, but with better semantics.

The basic problem is that in the detach for RenderPointerListener, it would detach the annotation, which could cause onExit to be called on the annotation, since the widget was disappearing under the mouse, and thus needs to receive an onExit, but that onExit might be (and probably will be) calling setState, which marks the owning widget as needing to be built, sometimes when it already has been.

The fix creates a new _ListenerElement that overrides activate and deactivate in order to tell the render object ahead of the detach that it might be detached, and so the onExit gets called before the detach instead of during it.

In addition, I now avoid scheduling more than one check for mouse positions per frame.
2019-05-08 12:20:31 -07:00
chunhtai
21efdff8a5
fix issue 32212 Text field keyboard selection crashes (#32256) 2019-05-07 15:07:11 -07:00
Michael Goderbauer
cc239580d3
Make Hover Listener respect transforms (#32025) 2019-05-06 13:36:13 +02:00
Greg Spencer
11e0a725d4
Re-land: Add support for Tooltip hover (#31699)
This is a re-land of #31561, after fixing performance regressions.

Added change listening to the MouseTracker so that the Listener and tooltip can react to whether or not a mouse is connected at all. Added a change check to make sure Listener only repaints when something changed.

Fixes #22817
2019-05-03 13:00:36 -07:00
Gary Qian
3bd1737c0e
Partially Rollback caret change for Android (#32043) 2019-05-03 12:32:04 -07:00
Justin McCandless
0a3df1b576
Text wrap width (#31987)
Add `textWidthBasis` param to Text to allow calculating width according to longest line.
2019-05-03 11:41:07 -07:00
chunhtai
38808d9fe4
Reland fix 25807 implement move for sliver multibox widget (#31978) 2019-05-03 09:48:20 -07:00
chunhtai
caebdaf1e8
fix issue 30526: rounding error (#30979) 2019-05-02 12:42:25 -07:00
Justin McCandless
34325ba33a
Revert "Tight Paragraph Width (#30988)" (#31979)
This reverts commit 323108ff47fd6caaeb8eaf30716e70d860673a1e due to weird engine dependency bug
2019-05-02 10:36:51 -07:00
Justin McCandless
323108ff47
Tight Paragraph Width (#30988)
Add `textWidthBasis` param to Text to allow calculating width according to longest line.
2019-05-02 09:21:45 -07:00
Dan Field
5b2281e747
Make Flex only overflow on epsilon (#31890) 2019-05-01 17:28:33 -07:00
Jacob Richman
63aa5b3647
Refactor core uses of FlutterError. (#30983)
Make FlutterError objects more structured so they can be displayed better in debugging tools such as Dart DevTools.
2019-05-01 11:20:12 -07:00
Gary Qian
4102486d63
Center iOS caret, remove constant offsets that do not scale (#31687) 2019-04-30 17:41:01 -07:00
liyuqian
71a89a469a
Reland "Fix text field selection toolbar under Opacity (#31097)" (#31802)
This reverts commit 120a1fc47f7379de556e02d3eb5b49ccd78a28b6.

Updated the golden file
2019-04-30 09:47:32 -07:00
liyuqian
7cab6d5e1c
Support clipBehavior changes in hot reload (#31761)
## Description

Make `_RenderCustomClip`'s `clipBehavior` non-final so we can update it during `updateRenderObject`. This will support `clipBehavior` changes in hot reload.

## Related Issues

Fixes #30863

## Tests

I added the following tests:

* ClipRect updates clipBehavior in updateRenderObject
* ClipRRect updates clipBehavior in updateRenderObject
* ClipOval updates clipBehavior in updateRenderObject
* ClipPath updates clipBehavior in updateRenderObject
* PhysicalModel updates clipBehavior in updateRenderObject
* PhysicalShape updates clipBehavior in updateRenderObject
2019-04-30 09:46:38 -07:00
Dan Field
fe9512fa72
Re-enable const (#31600)
* Re-enable const
2019-04-29 16:02:42 -07:00
Jonah Williams
120a1fc47f
Revert "Fix text field selection toolbar under Opacity (#31097)" (#31800) 2019-04-29 12:57:35 -07:00
liyuqian
e427c2dd86
Fix text field selection toolbar under Opacity (#31097)
## Description

As we've introduced offset to the Opacity layer, we have to override
`applyTransform` to make Leader/FollowerLayer work correctly.

## Related Issues

Fixes https://github.com/flutter/flutter/issues/30587

Together with https://github.com/flutter/engine/pull/8585,
this test will also exercise test against
https://github.com/flutter/flutter/issues/30586.

## Tests

I added the following tests:
* text field selection toolbar renders correctly inside opacity
2019-04-29 11:25:41 -07:00
Greg Spencer
7775c23784
[Re-Land] Implement focus traversal for desktop platforms. (#31614)
This re-lands the Focus changes in #30040. Correctness changes in routes.dart, and removes the automatic requesting of focus on reparent when there is no current focus, which caused undesirable selections.

Addresses #11344, #1608, #13264, and #1678
Fixes #30084
Fixes #26704
2019-04-25 16:26:58 -07:00
Justin McCandless
a21a1f4105
iOS selection handles are invisible (#31332)
Fix a bug where text selection handles were invisible in iOS
2019-04-25 12:32:10 -07:00
xster
8cfc92465d
CupertinoPicker fidelity revision (#31464) 2019-04-25 00:03:04 -07:00
liyuqian
e51947241b
Don't add empty OpacityLayer to the engine (#31520)
Fixes https://github.com/flutter/flutter/issues/31517
2019-04-24 15:39:36 -07:00
chunhtai
5c5ddd1fc2
Revert "Fix 25807: implement move for sliver multibox widget (#29188)" (#31497)
This reverts commit 77ab0b83214792e8e6117295982c9397e03193a2.
2019-04-23 10:41:19 -07:00
liyuqian
981e922aa1
Improve docs to address flutter/flutter#31202 (#31454)
## Description

Clarify that ClipRect can be added to ensure that CustomPainter will be drawing within bounds.

## Related Issues

https://github.com/flutter/flutter/issues/31202
2019-04-23 09:57:05 -07:00
Greg Spencer
590cc27b31
Revert "Implement focus traversal for desktop platforms, shoehorn edition. (#30040)" (#31461)
This reverts commit 4218c0bc38bc74a97b1b03d7b8b7f0ce32e29468.
2019-04-22 18:02:35 -07:00
Greg Spencer
4218c0bc38
Implement focus traversal for desktop platforms, shoehorn edition. (#30040)
Implements focus traversal for desktop platforms, including re-implementing the existing focus manager and focus tree.

This implements a Focus widget that can be put into a widget tree to allow input focus to be given to a particular part of a widget tree.

It incorporates with the existing FocusScope and FocusNode infrastructure, and has minimal breakage to the API, although FocusScope.reparentIfNeeded is removed, replaced by a call to FocusAttachment.reparent(), so this is a breaking change:

FocusScopeNodes must now be attached to the focus tree using FocusScopeNode.attach, which takes a context and an optional onKey callback, and returns a FocusAttachment that should be kept by the widget that hosts the FocusScopeNode. This is necessary because of the need to make sure that the focus tree reflects the widget hierarchy.

Callers that used to call FocusScope(context).reparentIfNeeded in their build method will call reparent  on a FocusAttachment instead, which they will obtain by calling FocusScopeNode.attach in their initState method. Widgets that own FocusNodes will need to call dispose on the focus node in their dispose method.

Addresses #11344, #1608, #13264, and #1678
Fixes #30084
Fixes #26704
2019-04-22 09:51:40 -07:00
chunhtai
77ab0b8321
Fix 25807: implement move for sliver multibox widget (#29188) 2019-04-22 09:28:53 -07:00
Gary Qian
3c8e3b097f
Use full height of the glyph for caret height on Android v2 (#31210)
Will cause golden and Scuba changes. Caret will become taller and shift upwards by 2 pixels.
2019-04-17 15:50:03 -07:00
Gary Qian
0f5de8725e
Revert "Use full height of the glyph for caret height on Android" (#31159)
* Revert "Use full height of the glyph for caret height on Android (#30991)"

This reverts commit 96e1fc9c34a2c3a11e0dd98ceccb6fbea7ce3460.
2019-04-16 16:49:39 -07:00
Gary Qian
96e1fc9c34
Use full height of the glyph for caret height on Android (#30991) 2019-04-16 10:42:36 -07:00
chunhtai
fbeb5e0cf5
Fix issue 23527: Exception: RenderViewport exceeded its maximum number of layout cycles (#30809) 2019-04-11 16:23:11 -07:00
Greg Spencer
8bea3fb2eb
Keep hover annotation layers in sync with the mouse detector. (#30829)
Adds a paint after detaching/attaching hover annotations to keep the annotation layers in sync with the annotations attached to the mouse detector.

Fixes #30744
2019-04-11 13:11:22 -07:00
Justin McCandless
ecb468f335
Baseline Aligned Row (#30746)
Text in a baseline aligned row now works, and the height of the row is properly calculated.
2019-04-11 09:32:22 -07:00
champeauxr
a5dd074b0d Fixed Table flex column layout error #30437 (#30470)
RenderTable._computeColumnWidths() had a logic error that caused flex columns to be collapsed to their minimum widths in certain situations dependent on the layout width constraint and the number of flex columns.
2019-04-10 18:53:27 -07:00
Dan Field
d2790bd2bb
Check for invalid elevations (#30215)
* Check for invalid elevation usage in the layer tree
2019-04-10 14:57:46 -07:00
Sam Rawlins
83ddd98849 Fix additional @mustCallSuper indirect overrides and mixins (#30667) 2019-04-10 14:54:51 -07:00
Jonah Williams
f66ee3e470
Add semanticsLabel parameter to TextSpan (#30837) 2019-04-10 12:24:01 -07:00
Tim Sneath
529189791c
Replace flutter.io with flutter.dev (#30562) 2019-04-05 11:39:30 -07:00
chunhtai
2b7e98973a
Fix issue 21640: Assertion Error : '_listenerAttached': is not true (#30513) 2019-04-05 11:31:40 -07:00