3051 Commits

Author SHA1 Message Date
Kaushik Iska
ce530b3770 [ios] Refactor IOSSurface factory and unify surface creation (flutter/engine#21877) 2020-10-15 19:56:13 -07:00
Kaushik Iska
6109d23046 [embedder] Platform View owns lifecycle of external view embedder (flutter/engine#21847)
Changing it to shared_ptr and migrating the ownership from surface
to platform view.
2020-10-15 17:48:14 -07:00
Chris Bracken
90c2138fb5 Add multi-step IME support to TextInputModel (flutter/engine#21682)
* Add multi-step IME support to TextInputModel

This updates the platform-independent TextInputModel to add support for
input method (abbreviated IM or IME) composing regions.

In contrast to languages such as English, where keyboard input is
managed keystroke-by-keystroke, languages such as Japanese require a
multi-step input process wherein the user begins a composing sequence,
during which point their keystrokes are captured by a system input
method and converted into a text sequence. During composing, the user is
able to edit the composing range and manage the conversion from keyboard
input to text before eventually committing the text to the underlying
text input field.

To illustrate this, in Japanese, this sequence might look something like
the following:

1. User types 'k'. The character 'k' is added to the composing region.
   Typically, the text 'k' will be inserted inline into the underlying
   text field but the composing range will be highlighted in some manner,
   frequently with a highlight or underline.
2. User types 'a'. The composing range is replaced with the phonetic
   kana character 'か' (ka). The composing range continues to be
   highlighted.
3. User types 'k'. The character 'k' is appended to the composing
   range such that the highlighted text is now 'かk'
4. User types 'u'. The trailing 'k' is replaced with the phonetic kana
   character 'く' (ku) such that the composing range now reads 'かく'
   The composing range continues to be highlighted.
5. The user presses the space bar to convert the kana characters to
   kanji. The composing range is replaced with '書く' (kaku: to write).
6. The user presses the space bar again to show other conversions. The
   user's configured input method (for example, ibus) pops up a
   completions menu populated with alternatives such as 各 (kaku:
   every), 描く (kaku: to draw), 核 (kaku: pit of a fruit, nucleus), 角
   (kaku: angle), etc.
7. The user uses the arrow keys to navigate the completions menu and
   select the alternative to input. As they do, the inline composing
   region in the text field is updated. It continues to be highlighted
   or underlined.
8. The user hits enter to commit the composing region. The text is
   committed to the underlying text field and the visual highlighting is
   removed.
9. If the user presses another key, a new composing sequence begins.

If a selection is present when composing begins, it is preserved until
the first keypress of input is received, at which point the selection is
deleted. If a composing sequence is aborted before the first keypress,
the selection is preserved. Creating a new selection (with the mouse,
for example) aborts composing and the composing region is automatically
committed. A composing range and selection, both with an extent, are
not permitted to co-exist.

During composing, keyboard navigation via the arrow keys, or home and
end (or equivalent shortcuts) is restricted to the composing range, as
are deletions via backspace and the delete key. This patch adds two new
private convenience methods, `editing_range` and `text_range`. The
former returns the range for which editing is currently active -- the
composing range, if composing, otherwise the full range of the text. The
latter, returns a range from position 0 (inclusive) to `text_.length()`
exclusive.

* Move SetComposingLength to TextRange::set_*

Adds set_base, set_extent, set_start, set_end methods to TextRange.
2020-10-15 17:43:16 -07:00
Kaushik Iska
8b0b5acd5a [fuchsia] External view embedder will be shared with platform view (flutter/engine#21850) 2020-10-15 17:22:02 -07:00
Chris Bracken
c3e83ddf84 Add TextRange::Contains tests spanning base/extent (flutter/engine#21874)
Adds tests for TextRange::Contains(const TextRange&) where the range
being tested spans the base/extent of the testing range.

This was originally intended to land in #21854, but it seems I didn't
push the additional tests before landing.
2020-10-15 16:59:15 -07:00
Kaushik Iska
fea7e59a66 Fix incldues to be flutter/shell rather than shell/ (flutter/engine#21889) 2020-10-15 16:51:17 -07:00
Adlai Holler
986c45ae4a Update more class names from GrContext to GrDirectContext (flutter/engine#21864)
This name change has to do with SkDeferredDisplayList, which Flutter
does not use. As far as Flutter is concerned, this is a no-op.
2020-10-15 16:14:23 -07:00
Jenn Magder
14dee41f00 Add flag to not publish the observatory port over mDNS (flutter/engine#21883) 2020-10-15 14:53:20 -07:00
Jenn Magder
1be440e077 Revert "Add flag to not publish the observatory port over mDNS (#21632)" (flutter/engine#21882)
This reverts commit a23a450aebfb917907e3e9647dffc210e2f31bde.
2020-10-15 12:32:24 -07:00
stuartmorgan
ac99ac4c27 Fix destruction order in C++ plugin registrar (flutter/engine#21840)
The C++ wrapper's plugin registrar can own plugins to provided lifetime
management. However, plugins expect the registrar to be valid for the
life of the object, including during destruction, so any owned plugins
must be explicitly cleared before any registrar-specific destruction
happens.
2020-10-15 10:54:08 -07:00
Jenn Magder
a23a450aeb Add flag to not publish the observatory port over mDNS (flutter/engine#21632)
* Add flag to not publish the observatory port over mDNS

* Review edits

* Format
2020-10-15 10:48:50 -07:00
Chris Bracken
60e1170f62 Migrate TextInputPlugin API to TextRange (flutter/engine#21854)
Replaces selection_base() and selection_extent() with selection() and
SetSelection(int, int) with SetSelection(range).

This also adds the following convenience methods to TextRange:
* reversed()
* Contains(size_t position)
* Contains(const TextRange& range)

as well as operator== for use in unit tests. When Flutter migrates to
C++20, we can replace that method with a default declaration.
2020-10-15 09:54:06 -07:00
gaaclarke
12cd3076af Revert "Explicitly make the X connection for EGL. (#21831)" (flutter/engine#21851)
This reverts commit a9019523c09d8c50e2f9e29d3246825cad886f64.
2020-10-14 16:30:40 -07:00
Robert Ancell
a9019523c0 Explicitly make the X connection for EGL. (flutter/engine#21831)
Explicitly make the X connection for EGL.

EGL can mistakenly choose the GBM backend when using EGL_DEFAULT_DISPLAY.

Fixes https://github.com/flutter/flutter/issues/60429
2020-10-15 11:06:08 +13:00
Jason Simmons
d6720f7085 Prevent a race between SurfaceTexture.release and updateTexImage (flutter/engine#21777) 2020-10-14 15:02:02 -07:00
Kaushik Iska
fba087b5e3 [android] Refactor surface factory and wire in external view embedder (flutter/engine#21839) 2020-10-14 14:27:02 -07:00
egdaniel
19f8afc6bc Update flutter to pass Skia the VkImageUsageFlags and Samples (flutter/engine#21842)
Previously Skia did not require the clients to pass in the usage flags and Skia would just assumed they contained specific ones depending on how the client wrapped the VkImage. Now Skia allows the client to pass in the specific usage flags used so that Skia knows exactly what type of operations are legal without having to guess/assume what the client did.

Also update to set the sample count as well while I'm in here.
2020-10-14 13:55:09 -07:00
Felipe Archondo
106d42b946 [fuchsia] add intercept_all_input flag support (flutter/engine#21821)
[fuchsia] add intercept_all_input flag support

This change also fixes an issue where FlutterRunnerProductConfiguration
crashes when a field is missing, when building with --unopt.

Test: Added unit tests
Bug: fxb/61466, fxb/61942
2020-10-13 22:11:24 -04:00
Jason Simmons
190b35170f Call PlatformView.dispose when removing hybrid composition platform views (flutter/engine#21790)
Also force disposal of all hybrid platform views when shutting down the
engine.

Fixes https://github.com/flutter/flutter/issues/66764
2020-10-13 18:40:55 -07:00
Kaushik Iska
b5c49443f9 [ios] Create a standalone external view embedder on iOS (flutter/engine#21798) 2020-10-13 17:56:31 -07:00
Emmanuel Garcia
a36600d4b0 Allow TalkBack navigation while a platform view is rendered (flutter/engine#21719) 2020-10-13 17:52:02 -07:00
Dan Field
1c9b3e2299 Ocmock dylib (flutter/engine#21786)
- Build OCMock as a dylib for iOS tests
- Set install_name for ios_flutter_test and ocmock dylibs
- Copy and sign dylibs during build process
2020-10-13 09:36:29 -07:00
Damian Wrobel
cc2aa3ca3c Support Wayland only (without X11 support in gdk) (flutter/engine#21218)
Adds a support for compiling flutter engine when
gdk does not have X11 backend. In such a configuration
the generated gdkconfig.h header file looks like the following:

 /* gdkconfig.h
  *
  * This is a generated file.  Please modify `configure.ac'
  */

 #ifndef __GDKCONFIG_H__
 #define __GDKCONFIG_H__

 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
 #error "Only <gdk/gdk.h> can be included directly."
 #endif

 #include <glib.h>

 G_BEGIN_DECLS

 #define GDK_WINDOWING_WAYLAND

 G_END_DECLS

 #endif  /* __GDKCONFIG_H__ */

Additionally headers like <gdk/gdkx.h> are not available at all.

Above configuration can be found on the most of the embedded systems.

This patch enables compilation of X11 specific code only when gdk
defines GDK_WINDOWING_X11.

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-10-13 15:54:44 +13:00
J-P Nurmi
9453cb51b6 Add workaround for missing fl_method_xxx_response_get_type() symbols (flutter/engine#21405) 2020-10-12 19:32:02 -07:00
Yuqian Li
0c645869e3 Revert "Migration to PlatformDispatcher and multi-window #20496" (flutter/engine#21792)
* Revert "Fix documentation build for window changes. (#21780)"

This reverts commit a539d91840d2fbbb4aa07eeed6a92d654db167ab.

* Revert "Migration to PlatformDispatcher and multi-window (#20496)"

This reverts commit a58fec63f196175eedfc5fbaedce9336dab5c508.
2020-10-12 19:26:41 -07:00
Chris Bracken
796b559455 Extract a TextRange class for selection (flutter/engine#21722)
Extracts a TextRange class with a base and extent, and start(), end(),
collapsed(), and length() getters.

The possibility of reversed base and extent in selections and composing
ranges makes reasoning about them complex and increases the chances of
errors in the code. This change migrates most uses of base and extent in
the text model to start()/end() or position(). The position() method is
intended purely as an aid to readability to indicate that a collapsed
selection is expected at the call site; it also enforces a debug-time
assertion that this is the case.
2020-10-12 17:50:11 -07:00
Yuqian Li
34774974ab Reland "Create root isolate asynchronously (#20142)" (flutter/engine#21747)
This reverts commit 19ebd61442fd3bf6a69af2156c8b118fc8578ec2.

Additionally, the following _flutter.runInView deadlock is fixed.

Previously, a deadlock would occur when service protocol
_flutter.runInView is used to restart the engine wihtout tearing down
the shell: the shared mutex of the service protocol will be locked
during the restart as it's in the middle of handling a service protocol
message; if ServiceProtocol::AddHandler is also called during the
restart, the deadlock happens as AddHandler also requires such lock.

test/integration.shard/background_isolate_test.dart would fail
without this fix.
2020-10-12 12:02:30 -07:00
gaaclarke
389b4fd25b Revert "fix On iOS, dialog titles are announced twice (#19826)" (flutter/engine#21714) 2020-10-09 19:57:04 -07:00
Alexander Markov
7f638cd494 Remove uses of Dart VM bytecode mode from Flutter engine (flutter/engine#21741) 2020-10-09 16:34:08 -07:00
Greg Spencer
a58fec63f1 Migration to PlatformDispatcher and multi-window (flutter/engine#20496)
This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-09 16:29:16 -07:00
George Wright
cc1041232c Add dart_entrypoint_argc/argv to the FlutterProjectArgs (flutter/engine#21737) 2020-10-09 16:17:02 -07:00
Kaushik Iska
ae5b199719 Fix filesystem access prior to macOS 10.15 (flutter/engine#21740) 2020-10-09 13:42:01 -07:00
Chris Bracken
919cb5634c Perform selection check in DeleteSelected (flutter/engine#21711)
At every call site for TextInputModel::DeleteSelected, we perform a
check for a collapsed selection. This moves that check into the method
itself.
2020-10-08 16:02:06 -07:00
Dan Field
73b959d7cb Forbid android.util.Log (flutter/engine#21696) 2020-10-08 14:52:05 -07:00
J-P Nurmi
232410d279 fl_method_response.cc: fix lint failures (flutter/engine#21406)
Fix lint issues caused by `google-readability-braces-around-statements`.
2020-10-08 14:47:07 -07:00
Hamdi Kahloun
5ee8b7c5ef SecurityException: Permission Denial (flutter/engine#21290)
Fix `java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider`

Fixes flutter/flutter#66108

Co-authored-by: Dan Field <dfield@gmail.com>
2020-10-08 14:36:51 -07:00
Kaushik Iska
9167812fc7 [macOS] Fix docs for loadAOTData and minor refactor (flutter/engine#21699) 2020-10-08 11:34:02 -07:00
Kaushik Iska
6104a7e793 [macOS] flutter_desktop_darwin_unittests can be enabled for all runtime modes (flutter/engine#21681) 2020-10-08 10:12:03 -07:00
Jason Simmons
8a6987441b Remove dependencies on _product variants of libdart from the Fuchsia release mode build (flutter/engine#21668) 2020-10-08 09:55:43 -07:00
Jonah Williams
127f3af9e0 Preserve specified AssetResolvers when performing a hot restart or updating the asset directory (flutter/engine#21611)
Follow up from #21436 . That PR works for all embeddings except for Android, which creates a special JNI AssetResolver. Since the shell cannot recreate this resolver, update the logic to preserve existing resolvers instead.
2020-10-08 09:22:01 -07:00
Dan Field
710a162790 Skip flaky test (flutter/engine#21694) 2020-10-08 08:25:48 -07:00
Chris Bracken
c2fab63106 Make TextInputModel::selection_start/end const (flutter/engine#21685)
Neither of these methods mutate the state of the model.
2020-10-07 22:04:02 -07:00
Chris Bracken
cc9990f124 Store selection base/extent as integers (flutter/engine#21663)
Previously, the selection base and extent were stored internally as
iterators over text_. Since iterators must be treated as invalidated
whenever the underlying container changes, this requires that
selection_base_ and selection_extent_ be re-assigned after every change
to text_.

This is not currently particularly problematic, but once we add fields
to track the base and extent of the composing region for multi-step
input method support, as well as support for the sub-range within the
composing region to which edits/completions apply, we end up having to
regenerate a lot of iterators with each change, many of which are
logically unchanged in position.

A side benefit is that this simplifies inspection of these fields when
debugging.
2020-10-07 18:31:17 -07:00
Chinmay Garde
6937ec8760 Avoid leaking the FlutterEngineAOTData structure in FlutterEngineCollectAOTData. (flutter/engine#21680) 2020-10-07 17:57:04 -07:00
Pieter van Loon
3ce29048c0 Enabled metal on ios simulator (flutter/engine#17881) 2020-10-07 17:47:03 -07:00
Emmanuel Garcia
2bd0e126a5 Ensure JNI is not called from raster thread (flutter/engine#21665) 2020-10-07 16:37:02 -07:00
Kaushik Iska
7287246cb2 [macOS] Allow loading of AOT snapshots and instructions from elf bundle (flutter/engine#21670) 2020-10-07 16:34:49 -07:00
Kaushik Iska
6db42cf2a9 Run desktop darwin tests in debug mode (flutter/engine#21660) 2020-10-07 16:32:01 -07:00
David Worsham
34cb178b92 fuchsia: Don't send ViewportMetrics w/ 0 DPR (flutter/engine#21392) 2020-10-06 17:57:28 -07:00
Justin McCandless
30ff61de06 hasStrings Linux (flutter/engine#21388)
hasStrings method for clipboard status, Linux
2020-10-06 16:29:12 -07:00