350 Commits

Author SHA1 Message Date
George Wright
b05684cee4 Formatting changes 2020-12-15 18:03:58 -08:00
George Wright
d12ccba8d3 Initial import of accessibility code from Chromium. There are no
modifications to this code.
2020-12-15 18:03:58 -08:00
Dan Field
205d2b8e18
Reland path volatility tracker (#23063)
* Revert "Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (#23044)"

This reverts commit 4f914253bd7cd2a5cca3fd97213df37494e9bf37.

* Fix tracing
2020-12-14 17:21:55 -08:00
Dan Field
4f914253bd
Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (#23044)
This reverts commit 2efc7c10aa12005010c837a1023024bb26bee143.
2020-12-11 15:39:24 -08:00
Dan Field
2efc7c10aa
Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)
This patch defaults the volatility bit on SkPaths to false, and then flips it to true if the path survives at least two frames.
2020-12-10 13:57:23 -08:00
Zachary Anderson
6625308089
Revert "Roll buildroot and benchmark (#22804)" (#22816)
This reverts commit a0c8b676f84f82a9404884dc9c2ce9fef4f09561.
2020-12-01 18:32:10 -08:00
Dan Field
a0c8b676f8
Roll buildroot and benchmark (#22804)
Roll benchmark to google/benchmark@bf585a2

Roll buildroot to flutter/buildroot@084f0d3
2020-12-01 13:39:37 -08:00
Jason Simmons
6c262173d7
libtxt: Clone an ICU line break iterator for each Paragraph/WordBreaker (#22594) 2020-11-20 13:43:03 -08:00
Filip Filmar
8bb47c5446
Roll ICU to c2a4cae149aae7fd30c4cbe3cf1b30df03b386f1 (#22465)
Changes to make this work:

- Had to change the use of an UBool constant `FALSE` to 0 because
  the file referring to it does not include the respective header.

- Had to change the license checker to ignore files in the directory
  icu/source/samples.  There were random changes to the licensing
  headers which tripped up license checks.  And since we don't include
  samples in the binaries we build, the most efficient way to fix it is
  to exclude sample code from license checks.

Issue: https://github.com/flutter/flutter/issues/70370
2020-11-13 14:52:11 -08:00
Filip Filmar
d50a83c15b
Add an include in minikin (#22466)
FontLanguageListCache.cpp uses the ICU constant FALSE of type UBool, but
does not #include <umachine.h> where it is defined.

This makes the code brittle with respect to header file reorganization,
and I found this while trying to roll ICU version 68.1 to Flutter
engine.
2020-11-12 11:08:10 -08:00
Jason Simmons
8534407db2
libtxt: use a placeholder run's width as the width of the placeholder character's glyph (#22451) 2020-11-12 10:24:01 -08:00
Daco Harkes
ccdb6819ce
WeakPersistentHandle migration (#19843)
and roll Dart to 52783837369de45d3372cb6c6b7cdd63e71cd829.
2020-11-03 13:06:53 +01:00
Jason Simmons
11ed711eb8
Invalidate the cached SkParagraph font collection when a new font manager is installed (#22157) 2020-10-29 09:31:04 -07:00
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
Jason Simmons
6fdcdd99cc
Forward font collection APIs to the SkParagraph font collection (#21734) 2020-10-19 16:27:03 -07:00
Jason Simmons
f854cbbfa5
Specify the Noto Naskh Arabic font to get consistent results in tests using Arabic characters (#21974)
See https://github.com/flutter/flutter/issues/68493
2020-10-19 13:51:39 -07:00
gaaclarke
d4ac8e6cb2
Temporarily disabled tests that were using latin and arabic characters (#21971)
while we fix them.
2020-10-19 11:51:34 -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
Jason Simmons
069b3cf8f0
Fix the offset passed to minikin::GraphemeBreak::isGraphemeBreak (#21706)
The character offset passed to isGraphemeBreak is relative to the beginning
of the string (not relative to the text_start parameter).  This caused bad
results when searching for grapheme breaks beyond the first line of text
(see https://github.com/flutter/flutter/issues/24802).

This PR fixes the offset value.  It also reverts the workaround applied in
https://github.com/flutter/engine/pull/10063, which caused incorrect
calculation of boundaries between graphemes within ligatures.
2020-10-14 11:44:38 -07:00
Jason Simmons
7e20575b6b
Clear the Minikin layout cache during engine destruction (#21473) 2020-10-08 13:53:04 -07:00
Jason Simmons
641d4e0e42
Add an adjustment to currentLineWidth comparisons when pushing greedy line breaks (#21356)
This is similar to the workaround used for
https://github.com/flutter/flutter/issues/30347

The Minikin line breaker inserts greedy breaks based on a comparison of
postBreak width and currentLineWidth.  currentLineWidth is provided by
the framework based on previous calls to Layout::measureText.
That calculation may not exactly match the calculation of postBreak.

This change ensures that breaks are only added if the difference
between postBreak and currentLineWidth is significant.

Fixes https://github.com/flutter/flutter/issues/65419
2020-10-07 15:34:59 -07:00
Dan Field
612acf349e
Fix windows popup (#21522) 2020-09-30 14:38:44 -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
Chris Bracken
16b900b63e
Prefer C++ standard headers to their C counterpart (#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Chris Bracken
36f7f3ca82
Copyright header hygiene improvements (#21089)
Add copyright headers in a few files where they were missing.

Trim trailing blank comment line where present, for consistency with
other engine code.

Use the standard libtxt copyright header in one file where it differed
(extra (C) and comma compared to other files in libtxt).

This also amends tools/const_finder/test/const_finder_test.dart to look
for a const an additional four lines down to account for the copyright
header added to the test fixture.
2020-09-11 08:55:37 -07:00
Alexander Aprelev
873c007934
Log exception in addition to the stack trace for unhandled exceptions. (#20935)
* Log exception in addition to the stack trace for unhandled exceptions.

Having exception logged can be especially useful when stack trace is blank.
2020-09-02 09:47:09 -07:00
xster
f8d2d7b42f
Fix font sorting problem due to iOS 14 fonts being broader (#20557) 2020-08-24 13:03:20 -07:00
LongCatIsLooong
d6a0b965b0
Reland "account for inline placeholders in longest line calculation (#20370)" reverted in (#20669) (#20678) 2020-08-21 16:31:02 -07:00
Zachary Anderson
dcd51b8cc1
Revert "account for inline placeholders in longest line calculation (#20370)" (#20669)
This reverts commit 9893a2936658918d742b71ef8cbb07ed63941b18.

Landing on red to fix the build.
2020-08-20 12:35:48 -07:00
LongCatIsLooong
9893a29366
account for inline placeholders in longest line calculation (#20370) 2020-08-11 16:23:26 -07:00
Daco Harkes
8e1d48eece
Migrate some Dart_WeakPersistentHandle uses to Dart_FinalizableHandle (#20107) 2020-07-30 15:56:00 +02:00
Siva
b955e15ee9
Manual roll of Dart from 24c7666def...40fd1c456e (#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
Kaushik Iska
1cb875156f
[tonic] Log stack trace for unhandles exceptions (#19811)
Before this change, when we encounter an unhandles exception,
we see:

```
[00050.147083][37665][67367][klog] ERROR: [ERROR:flutter/shell/common/shell.cc(209)] Dart Error: Unhandled exception:
[00050.147087][37665][67367][klog] INFO: UnimplementedError
```

This doesn't help identify the root cause. Adding stack trace will help
the cause.
2020-07-16 12:03:02 -07:00
David Worsham
9353692cdb
fuchsia: Enable most unittests (#19583)
Tweak the primary flutter build rule so that fuchsia is more similar to
other platforms in how tests and the shell are built.

Only embedder_unittests and GLFW tests are disabled on Fuchsia now.

TEST: Ran unittests on host/fuchsia; workstation on fuchsia
BUG: fxb/53847, fxb/54056
2020-07-13 17:36:19 -07:00
Michael Goderbauer
ed5df03dcd
Word substitutions (#19111) 2020-06-18 11:05:24 -07:00
Jason Simmons
9fcfec39c0
Avoid creating a vector when constructing Dart typed data objects for platform messages (#18838) 2020-06-18 09:58:03 -07:00
Gary Qian
c9c80011bb
Fix windows SkParagraph compilation (#19073) 2020-06-17 02:14:34 -07:00
bungeman
9ccb2e7f14
Mark conditional SkParagraph include nogncheck. (#18741) 2020-06-02 11:18:03 -07:00
Dan Field
c9e51d074a
Make GetAllocationSize const (#18713) 2020-06-01 15:58:03 -07:00
Jason Simmons
46a6d966ad
[SkParagraph] Copy text height behavior to the Skia paragraph style (#18178) 2020-05-07 18:24:08 -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
Ali Mahdiyar
b6bb7e796a
Handle paragraph alignment and direction in newline rectangles (#17750) 2020-04-20 14:35:01 -07:00
Jason Simmons
6c431f021c
Remove unused parameter from GetLineXOffset (#17745) 2020-04-17 12:24:58 -07:00
Vyacheslav Egorov
9afc6faaa3
Release acquired typed data before calling Dart_SetReturnValue. (#17729) 2020-04-15 10:35:04 -07:00
Chris Bracken
e55b4476f1
Use const refs in for loops where reasonable (#17484)
This patch optimizes C++11 range-based for loops where the variable is
copied in each iteration but it would suffice to obtain it by const
reference. This is only applied to loop variables of types that are
expensive to copy which means they are not trivially copyable or have a
non-trivial copy constructor or destructor.

To ensure that it is safe to replace the copy with a const reference
only the following cases are modified:
  * The loop variable is const-qualified.
  * The loop variable is not const, but only const methods or operators
    are invoked on it, or it is used as const reference or value argument
    in constructors or function calls.

This is an application of the internal performance-for-range-copy
clang-tidy analysis.
2020-04-03 11:44:35 -07:00
Dan Field
ff62dec5c9
Roll to clang11, mark 4 (#17483)
* "Reland Clang 11, roll buildroot to 1bc40a5f916adb93d87e2a2230a0ec43db876c1c, take 4 (#17467)" (#17482)"

This reverts commit 8166a91bca11b83c16fba8f8fd407e937a2ac89c.

* format code

* Roll buildroot to 3a27de1c5bb0f50be7d3efe3e00de4f6068c9f30
2020-04-02 13:04:49 -07:00
Greg Spencer
8ff6948e23
Make GetDefaultFontFamilies return a vector<string> instead of… (#16928)
On Linux, there is rarely just one default font that can reasonably be expected to be on the platform. This PR changes the GetDefaultFontFamily call to be GetDefaultFontFamilies, and it now returns a vector<string> so that the font collection code can look up all of them, and if any of them exist, add them to the fallback list.

For Linux, I supplied the list "Ubuntu", "Cantarell", "DejaVu Sans", "Liberation Sans", and "Arial", which should cover a large proportion of linux machines. For the other platforms, I supplied a list of length one, containing the one fallback font that used to be defined. On Windows, I added "Segoe UI" as a default, since that is the default system font on newer Windows.

The goal of this function is to provide at least one font family that is installed, since otherwise linux (or any platform) will just have no font at all if the default font isn't found.
2020-03-05 00:45:53 +01:00
Ryan Macnak
79a53b2ea2
Roll Dart to df5036eb6e738c723339ed74c1e8ca93bea2570d. (#16936) 2020-03-04 13:45:24 -08:00
Chris Bracken
78a1c7ebf9
Revert "Drop last usages of Dart_New from engine (#16838)" (#16915)
We believe this may be implicated in a Windows-specific crash during the
Flutter Gallery integration test.

See:
https://github.com/flutter/flutter/issues/51896

This reverts commit f9b78c5db2bc3087e1793947b11ca643c2d747cf.
2020-03-03 14:52:56 -08:00
Dan Field
f9b78c5db2
Drop last usages of Dart_New from engine (#16838)
Image
Codec
FrameInfo
Scene/Picture toImage
2020-03-02 21:30:28 -08:00