110 Commits

Author SHA1 Message Date
Chinmay Garde
fa11ee6e2a
Fix native constructor of list of zircon handles and remove unused list factory specializations. (#21980) 2020-10-19 19:42:01 -07:00
Chris Bracken
49c35b6177
Eliminate unnecessary linter opt-outs (#21935)
Eliminates FLUTTER_NOLINT where they can be landed without triggering
lint failures.
2020-10-16 17:24:23 -07:00
Chinmay Garde
5bd7260a1e
Enable loading snapshots with sound null safety enabled. (#21820)
Snapshots compiled with sound null-safety enabled require changes to the way in
which isolates are launched. Specifically, the `Dart_IsolateFlags::null_safety`
field needs to be known upfront. The value of this field can only be determined
once the kernel snapshot is available. This poses a problem in the engine
because the engine used to launch the isolate at shell initialization and only
need the kernel mappings later at isolate launch (when transitioning the root
isolate to the `DartIsolate::Phase::Running` phase). This patch delays launch of
the isolate on the UI task runner till a kernel mapping is available. The side
effects of this delay (callers no longer having access to the non-running
isolate handle) have been addressed in this patch. The DartIsolate API has also
been amended to hide the method that could return a non-running isolate to the
caller.  Instead, it has been replaced with a method that requires a valid
isolate configuration that returns a running root isolate. The isolate will be
launched by asking the isolate configuration for its null-safety
characteristics.

A side effect of enabling null-safety is that Dart APIs that work with legacy
types will now terminate the process if used with an isolate that has sound
null-safety enabled. These APIs may no longer be used in the engine. This
primarily affects the Dart Convertors in Tonic that convert certain C++ objects
into the Dart counterparts. All known Dart Converters have been updated to
convert C++ objects to non-nullable Dart types inferred using type traits of the
corresponding C++ object. The few spots in the engine that used the old Dart
APIs directly have been manually updated. To ensure that no usage of the legacy
APIs remain in the engine (as these would cause runtime process terminations),
the legacy APIs were prefixed with the `DART_LEGACY_API` macro and the macro
defined to `[[deprecated]]` in all engine translation units. While the engine
now primarily works with non-nullable Dart types, callers can still use
`Dart_TypeToNonNullableType` to acquire nullable types for use directly or with
Tonic. One use case that is not addressed with the Tonic Dart Convertors is the
creation of non-nullable lists of nullable types. This hasn’t come up so far in
the engine.

A minor related change is reworking tonic to define a single library target.
This allows the various tonic subsystems to depend on one another. Primarily,
this is used to make the Dart convertors use the logging utilities. This now
allows errors to be more descriptive as the presence of error handles is caught
(and logged) earlier.

Fixes https://github.com/flutter/flutter/issues/59879
2020-10-16 14:53:26 -07:00
Chris Bracken
08dabe9601
Clean up C++ includes (#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Greg Spencer
98cfd1db78
Move platform specific information to PlatformConfiguration class (#19652) 2020-07-31 17:21:02 -07:00
Greg Spencer
a6cd3ebc61
Fix lint errors in lib/ui (#19988)
This fixes all of the lint errors in lib/ui, except for a few (three, I think) where it would have changed the API, converting non-const references to pointers. For those, I just did NOLINT on the particular line instead of ignoring the whole file.
2020-07-30 20:21:37 -07:00
gaaclarke
21efd7325e
Made the linter print out more information in its output and fixed bugs (#19895) 2020-07-22 15:38:09 -07:00
Dan Field
c9e51d074a
Make GetAllocationSize const (#18713) 2020-06-01 15:58:03 -07:00
chenjianguang
89cf074d37
Setup default font manager after engine created, to improve startup performance (#18225) 2020-05-28 17:53:04 -07:00
Alexander Aprelev
1c8ee9856b
Introduce runtime check that it is root isolate that makes UI native calls. (#18050)
* Revert "Do not register UI-related native functions in secondary isolates (#6401)"

This reverts commit 69ae5694de54d2a163743dcec727fcea1c7bc8e1 as it doesn't work when root and secondary isolates run in the same isolate group.

* Confirm it is root isolate that makes UI native calls.

* Fix format, UIDartState reference from Fuchsia source

* No UI isolate check for fuchsia calls

* Fix typo. Remove redundant runtime calls
2020-05-01 09:05:41 -07:00
Dan Field
c2fc31d19d
remove usage of Dart_New for paragraph/libtxt (#16837) 2020-02-28 00:15:40 -08:00
Gary Qian
ee297aa699
Reland "Engine/LibTxt/dart:ui impl of TextHeightBehavior #15087" (#16155) 2020-01-29 10:52:24 -08:00
Dan Field
53baa7aee5
Revert breaking PRs (#16148)
* Revert "Web PargraphStyle TextHeightBehavior integration (#16075)"

This reverts commit 86682a2d09e7d111a5c4fd2156b9971bd65fb693.

* Revert "Engine/LibTxt/dart:ui impl of TextHeightBehavior (#15087)"

This reverts commit cbf4536d158e25e372469c242e326c48cc730de7.
2020-01-28 10:40:05 -08:00
Gary Qian
cbf4536d15
Engine/LibTxt/dart:ui impl of TextHeightBehavior (#15087) 2020-01-27 13:37:11 -08:00
Jason Simmons
bdd4e4d948
Do not assume that createTypeface is called before getStyle in the AssetManagerFontStyleSet (#14343) 2019-12-13 09:23:08 -08:00
Gary Qian
b3463e3580
getLineBoundary edge condition use <= instead of < (#13881) 2019-11-15 15:14:03 -08:00
Jason Simmons
f5c002254b
Use Skia's matchStyleCSS3 to find bundled asset typefaces matching a font style (#13848)
This will improve font matching in SkParagraph for fonts that are bundled as
assets within the app.  Libtxt was using Minikin's FontFamily class to select
the closest matching font, but SkParagraph will rely on the matchStyle
implementation in the asset font manager.
2019-11-13 17:44:25 -08:00
Greg Spencer
f68de3f451
Add line boundary information to LineMetrics. (#13727)
This exposes the line boundary information a line by adding getLineBoundary to return the indices corresponding to a line around a TextPosition. The information is already calculated when calculating line metrics, so that we can enable moving the selection/cursor to the beginning/end of a line in a text field.
2019-11-11 16:42:40 -08:00
Gary Qian
0928c1af2f
Add 'Cough' test font and support multiple test fonts. (#13649) 2019-11-05 12:27:34 -08:00
Gary Qian
13ece5c7fc
Update the ui.LineMetrics.height metric to be more useful to external users (#11456) 2019-08-28 12:26:42 -07:00
Chris Bracken
bf86d08102
Add missing newline at EOF (#11473)
This was required by the C++ spec pre-C++11 and still gets picked up in
the Fuchsia tree due to -Wnewline-eof. It fixes:

    ../../third_party/flutter/lib/ui/text/line_metrics.h:75:47: error: no newline at end of file [-Werror,-Wnewline-eof]
    #endif  // FLUTTER_LIB_UI_TEXT_LINE_METRICS_H_
2019-08-26 21:11:57 -07:00
Gary Qian
9f1eab2f1f
Expose LineMetrics in dart:ui (#10670) 2019-08-26 13:40:22 -07:00
Jason Simmons
33d168f99f
Remove the ParagraphImpl class from the text API (#11012)
ParagraphImpl was used to switch between libtxt and Blink implementations
of text rendering and is now obsolete.
2019-08-15 15:23:00 -07:00
Jason Simmons
f7e0614b88
Change ParagraphBuilder to replace the parent style's font families with the child style's font families (#10074)
Previously ParagraphBuilder was concatenating the child's fonts to the
parent's font list, causing the parent's fonts to take precedence.

Fixes https://github.com/flutter/flutter/issues/35992
2019-07-23 17:57:56 -07:00
Jason Simmons
2cd650d269
Minimal integration with the Skia text shaper module (#9556)
This converts the libtxt Paragraph and ParagraphBuilder classes into
interfaces with Minikin and SkShaper/SkParagraph based implementations.

Use the --enable-skshaper GN flag to select the Skia shaper implementation
at build time.
2019-07-10 14:13:55 -07:00
Jason Simmons
b453d3c3dd
libtxt: fix reference counting of SkFontStyleSets held by font asset providers (#9561) 2019-07-10 12:08:15 -07:00
Gary Qian
75387dbc14
TextStyle.height property as a multiple of font size instead of multiple of ascent+descent+leading. (#9041) 2019-07-08 15:32:02 -07:00
Gary Qian
a4abfb2333
Text inline widget LibTxt/dart:ui implementation (#8207) 2019-06-03 10:32:46 -07:00
Jason Simmons
135a140591
Add font features (such as tabular numbers) as an option in text styles (#8823)
Fixes https://github.com/flutter/flutter/issues/31691
2019-05-21 16:47:57 -07:00
Matthew Dempsky
66087301cd Roll tonic and update #includes (#8950) 2019-05-14 11:57:09 -07:00
Justin McCandless
3493dcfbae
Rename tightWidth to longestLine (#8706)
Renaming a brand new and unused parameter due to some discussion about connecting with the framework.
2019-04-26 16:06:12 -07:00
Justin McCandless
a144f17aee
Tight Paragraph Width (#8530)
Calculate and expose paragraph tightWidth to the framework to allow drawing Text based on this.
2019-04-18 09:08:41 -07:00
Chinmay Garde
39e1d00f39
Remove redundant specification of the |flutter| namespace in the engine. (#8523) 2019-04-09 17:50:06 -07:00
Chinmay Garde
eec74e5c92
Rename the blink namespace to flutter. (#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00
Jason Simmons
6d1a6a4f47
Allow per-platform customization of the default Skia font manager (#8358)
The font manager returned by SkFontMgr::RefDefault is determined by Skia's
build configuration flags.  Embedders may want to use a default font manager
other than the one selected by their build of Skia.
2019-03-29 09:52:29 -07:00
Gary Qian
073aadde14
Fix TextStyle decode misalignment (#8141) 2019-03-12 13:55:31 -07:00
Gary Qian
52b67fdd5a
Expose decorationThickness to dart:ui (#8008) 2019-03-11 16:43:11 -07:00
Gary Qian
2c610bfec6
Fix dynamic array -> vector (#7645) 2019-01-30 13:03:27 -08:00
Gary Qian
c92df428ef
Strut implementation (#7414)
Engine half of flutter/flutter#26332
2019-01-30 10:16:37 -08:00
Jason Simmons
cd98f6bdb5
Clear the font collection's cache when a font is dynamically loaded (#7436)
Fixes https://github.com/flutter/flutter/issues/26293
2019-01-10 11:26:49 -08:00
Gary Qian
215ca15600
Support user-provided font-fallback. (#7241)
* Support user-provided font-fallback.

* Use tonic to pass to native

* Handle font families as a fallback vector in LibTxt

* Fix docs

* Concatentate fontFamily lists in dart before passing to engine

* Fix formatting

* Reworked font family matching to search all managers

* Fix formatting

* Proper toString null checking to keep format consistent

* Formatting

* Move _listEquals out of textstyle as it is not specific to TextStyle and will later be used for paragraphStyle too
2018-12-21 15:07:47 -08:00
Gary Qian
25b58c0c67
Revert "Support overriding font leading in TextStyle and LibTxt (#6927)" (#7187)
This reverts commit 4b233f033b8ba7b7e5e84f1607dbdf2e4dcdc5d8.
2018-12-11 10:43:03 -08:00
Gary Qian
4b233f033b
Support overriding font leading in TextStyle and LibTxt (#6927) 2018-12-10 15:35:44 -08:00
Michael Goderbauer
09ef73ff6e
Fix code smells reported by chrome's clang plugin (#6833) 2018-11-12 19:59:29 -08:00
Michael Goderbauer
70a1106b50
Unify copyright lines (#6757) 2018-11-07 12:24:35 -08:00
Mehmet Fidanboylu
3236b49cea
Add missing includes (#6670) 2018-10-26 10:16:56 -07:00
Gary Qian
9f2e2ba7b9
Add/expose API for Paragraph.getBoxesForRange BoxHeightStyle and BoxWidthStyle. (#6644) 2018-10-24 15:22:32 -07:00
Chinmay Garde
e1e60933b2
Realize kernel asset mappings on a worker thread if one is available. (#6648) 2018-10-24 11:33:46 -07:00
Gary Qian
2586e94122
Support all combinations of GetRectsForRange styles (#6591) 2018-10-23 11:06:21 -07:00
Jason Simmons
32841dd89b
Case-insensitive matching of family names for custom fonts (#6519) 2018-10-12 14:32:32 -07:00