summaryrefslogtreecommitdiff
path: root/ui
AgeCommit message (Collapse)Author
2024-06-21Snapped rounded corner bounds of the surface to pixel boundaryZoraiz Naeem
Lacros specifies rounded corners bounds on the content layer to round the window. Lacros submits un-ceiled rounded corner bounds to exo. However for certain device scale factors, we get 1px misalignments between the content and non content area. In crrev.com/c/4726545, the rounded corner bounds were ceiled on the client side. The change was made in cc, however, given Ash Chrome uses the same code path, ceiling the rounded corner bounds caused 1px mis-alignments in the ChromeOS UI. (See b/329864176) After thorough discussion [1], and taking into account the blink expectations, it was decided to revert crrev.com/c/4726545. To fix the original lacros issue, we snap the rounded corner bounds to pixel boundary in exo itself. [1] https://chromium-review.googlesource.com/c/chromium/src/+/5606007/comments/c3506ff3_34177195 Bug: b/40267343 Change-Id: I95ad89205ea73b3fb2d335779aeb45052726bd66 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5605790 Commit-Queue: Zoraiz Naeem <zoraiznaeem@chromium.org> Reviewed-by: Antonio Gomes <tonikitoo@igalia.com> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: Kramer Ge <fangzhoug@chromium.org> Cr-Commit-Position: refs/heads/main@{#1317551} CrOS-Libchrome-Original-Commit: 96d499224fbab1784f05ee170610820787ce91f5
2024-06-19Have several ui/ headers include <iosfwd> to forward declare ostreamKevin McNee
These headers don't need the complete definition from <ostream>. Bug: 40318405 Change-Id: I365672024bb3ca19530dddf0792ce930b4173950 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5637251 Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Kevin McNee <mcnee@chromium.org> Cr-Commit-Position: refs/heads/main@{#1316474} CrOS-Libchrome-Original-Commit: 94c69ba2584bcb6ec0ea8351997bbcb1c982c2b4
2024-06-05Rename DUMP_ version of NOTREACHED()Peter Boström
NOTREACHED_NORETURN() is now a synonym for NOTREACHED() which we'll eventually move over to completely. Renaming DUMP_WILL_BE_NOTREACHED_NORETURN() first makes s/NOTREACHED_NORETURN/NOTREACHED easier. Bug: 40580068 Change-Id: I565a899b00796bc342f5a907ed1287bb5d680a57 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5595035 Owners-Override: danakj <danakj@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Commit-Queue: Peter Boström <pbos@chromium.org> Auto-Submit: Peter Boström <pbos@chromium.org> Cr-Commit-Position: refs/heads/main@{#1310055} CrOS-Libchrome-Original-Commit: cb0d53064e565bb13ea5521f38b6c8102557f7ba
2024-05-15Use NOTREACHED_IN_MIGRATION() in ui/Peter Boström
This was generated by replacing " NOTREACHED()" with " NOTREACHED_IN_MIGRATION()" and running git cl format. This prepares for making NOTREACHED() [[noreturn]] alongside NotReachedIsFatal migration of existing inventory. Bug: 40580068 Change-Id: I68712c49687cddc13ee1b04c0b45a8ab03d4c5d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539000 Auto-Submit: Peter Boström <pbos@chromium.org> Commit-Queue: Peter Boström <pbos@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Owners-Override: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1300959} CrOS-Libchrome-Original-Commit: e857a19558861d81ad34cb22ed2cf49d6aa98ae3
2024-04-27Migrate TODOs referencing old crbug IDs to the new issue tracker IDsAlison Gale
The canonical bug format is TODO(crbug.com/<id>). TODOs of the following forms will all be migrated to the new format: - TODO(crbug.com/<old id>) - TODO(https://crbug.com/<old id>) - TODO(crbug/<old id>) - TODO(crbug/monorail/<old id>) - TODO(<old id>) - TODO(issues.chromium.org/<old id>) - TODO(https://issues.chromium.org/<old id>) - TODO(https://issues.chromium.org/u/1/issues/<old id>) - TODO(bugs.chromium.org/<old id>) Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues. See go/crbug-todo-migration for details. #crbug-todo-migration Bug: b/321899722 Change-Id: I050f2f811b9f50e8aa29d2474da33746d17d59fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5494188 Owners-Override: Alison Gale <agale@chromium.org> Auto-Submit: Alison Gale <agale@chromium.org> Reviewed-by: Peter Boström <pbos@chromium.org> Commit-Queue: Peter Boström <pbos@chromium.org> Cr-Commit-Position: refs/heads/main@{#1293300} CrOS-Libchrome-Original-Commit: 71bd8f1596b301a842247d3488f901d7ae3dfad2
2024-04-17Migrate TODOs referencing old crbug IDs to the new issue tracker IDsAlison Gale
The canonical bug format is TODO(crbug.com/<id>). TODOs of the following forms will all be migrated to the new format: - TODO(crbug.com/<old id>) - TODO(https://crbug.com/<old id>) - TODO(crbug/<old id>) - TODO(crbug/monorail/<old id>) - TODO(<old id>) - TODO(issues.chromium.org/<old id>) - TODO(https://issues.chromium.org/<old id>) - TODO(https://issues.chromium.org/u/1/issues/<old id>) - TODO(bugs.chromium.org/<old id>) Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues. See go/crbug-todo-migration for details. #crbug-todo-migration Bug: b/321899722 Change-Id: I495892e2c482409d0feb42ebde36f836f5523844 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5454722 Commit-Queue: Alison Gale <agale@chromium.org> Owners-Override: Alison Gale <agale@chromium.org> Reviewed-by: Shibalik Mohapatra <shibalik@chromium.org> Cr-Commit-Position: refs/heads/main@{#1288082} CrOS-Libchrome-Original-Commit: c5ea1859abfe643b42f52650bbbb532b33e00ac7
2024-04-05Create class for calculating a three point cubic curve and add new tween type.Caroline Rising
This is based on the material 3 emphasized easing set found at https://carbon.googleplex.com/google-material-3/pages/easing-and-duration/tokens-specs#0ee2974a-77e9-45b5-af40-0e862b2df4c7. We plan to use this first for animations we will be adding to the side panel. Bug: 328295071 Change-Id: I5d353a45717ea6e7f7557560740ba3333b8f12c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5403131 Reviewed-by: Ian Vollick <vollick@chromium.org> Commit-Queue: Ian Vollick <vollick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1282673} CrOS-Libchrome-Original-Commit: 7f47834e114d7c3b42cf033eeb9cb7080d4bbf1e
2024-04-02snap-group: Fix divider UI elements in vertical modeMichele Fan
This cl fixed the UI elements associated with the divider in vertical split screen mode, including: 1. Divider bounds; 2. Feedback button; 3. Divider handler view. This cl also improves the unit test function to test the snapped windows bounds in vertical display. This cl also updated `SplitVertically()` and `SplitHorizontally()` to take references. Demo: http://b/276801578#comment5 Fixed: b/276801578, b/331874858 Test: Modified existing + manually Change-Id: I4499cd23dd8937767b5414357a2827cf36b2660e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5406553 Commit-Queue: Michele Fan <michelefan@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/main@{#1280818} CrOS-Libchrome-Original-Commit: 6bea385fb307ea75ab0acddf8ee880a4db3bf6cf
2024-03-12New unit tests for gfx::RectF ApproximatelyEqual method.Chunbo Hua
Bug: 40925408, 41490322 Change-Id: I71dd94763b25c2c05bd804445bd969d2da272a57 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5360619 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Chunbo Hua <chunbo.hua@intel.com> Cr-Commit-Position: refs/heads/main@{#1271293} CrOS-Libchrome-Original-Commit: e4bf6117e36a1cfa57e4dee5dd38ca30035d92d9
2024-02-23Exclude NOTREACHED()s hit in 123.0.6300 or laterPeter Boström
As these are about to become fatal, anything that registers in Dev or Canary is probably a good idea to exclude from the experiment as they may be very frequent in later channels. Bug: 40580068 Change-Id: I8d841eb26f3055b58c9c3192153451d553778fcf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5318785 Auto-Submit: Peter Boström <pbos@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Owners-Override: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1264305} CrOS-Libchrome-Original-Commit: ed8b1025fece1ff507dea4660986a1b9a0acda0c
2024-02-22Rename {absl => std}::optional in base + everywhere. [Final]Arthur Sonzogni
Automated patch. This is a no-op. Please avoid, as much as possible, assigning unrelated bugs to this. Context: https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email As of https://crrev.com/1204351, absl::optional is now a type alias for std::optional. We should migrate toward it. Script: ``` function replace { echo "Replacing $1 by $2" git grep -l "$1" \ | cut -f1 -d: \ | grep -v \ -e "components/cast_streaming/browser/public/receiver_config.*" \ -e "components/power_metrics/*" \ -e "components/zucchini/patch_reader.*" \ -e "third_party/abseil-cpp/*" \ -e "third_party/googletest/*" \ -e "third_party/leveldatabase/*" \ -e "third_party/libaddressinput/" \ -e "third_party/liburlpattern/*" \ -e "third_party/lzma_sdk/*" \ -e "third_party/maldoca/*" \ -e "third_party/mediapipe/*" \ -e "third_party/shell-encryption/*"\ -e "third_party/tflite_support/*" \ -e "third_party/webrtc_overrides/*" \ -e "third_party/zxcvbn-cpp/*" \ | grep \ -e "\.h" \ -e "\.cc" \ -e "\.mm" \ -e "\.pidl" \ | sort \ | uniq \ | xargs sed -i "s/$1/$2/g" } replace "absl::make_optional" "std::make_optional" replace "absl::optional" "std::optional" replace "absl::nullopt" "std::nullopt" replace "absl::in_place," "std::in_place," replace "absl::in_place_t," "std::in_place_t," replace "absl::in_place)" "std::in_place)" replace "absl::in_place_t)" "std::in_place_t)" replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>" git status echo "Formatting" echo "IncludeBlocks: Regroup" >> ".clang-format" echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format" git cl format git restore ".clang-format" ``` Bug: chromium:1500249 Change-Id: Ic2994b982bbc64d62f030d3d158979dc5d266121 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5296147 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Owners-Override: danakj <danakj@chromium.org> Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org> Cr-Commit-Position: refs/heads/main@{#1263362} CrOS-Libchrome-Original-Commit: e5fff99cbb0380ea7f44c60ee15554b6b56320fb
2024-02-22Fix HitTestLocation::Intersects(const gfx::QuadF&) false positivesFredrik Söderquist
Said function only correctly handle quad vs. rect (the quad being the "transformed rect" of HitTestLocation) - i.e queries using rectilinear quads. To avoid false positives, full-blown quad vs. quad is required. Add gfx::QuadF::IntersectsQuad() and use that. The old code-path for the rectilinear quad case is kept around although it's quite difficult to hit for the current caller. The function could potentially be improved by explicitly handling the case where both quads are rectilinear, but that is left as future work. Bug: 40364016 Change-Id: Id12f42ce10ec4e71fe91dd5910066ef6c1989bca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5307498 Commit-Queue: Fredrik Söderquist <fs@opera.com> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1263253} CrOS-Libchrome-Original-Commit: c82682c6526b113e4a58cb20e1076764e09dfa5b
2024-02-21Cleanups for angle-related codepunithnayak
* Move ui/gfx/geometry/angle_conversions.h to base/ * Use it more often (e.g. `x * 180 / pi` -> `base::RadToDeg(x)`) * Use <numbers> in place of most math constants (almost entirely for angle-related values, e.g. `std::numbers::pi`) Bug: 1414635 Change-Id: Ibc1c1bb1d1eda3a693a33eca372516ace89b7209 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5109440 Owners-Override: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Commit-Queue: Punith Nayak <npunith125@gmail.com> Cr-Commit-Position: refs/heads/main@{#1262954} CrOS-Libchrome-Original-Commit: b367adbb163be85bf7e7f0848698cf72f76e4f56
2024-02-21ui: gfx: Add Transform::Preserves2dAffineMichael Tang
Adds a function similar to Transform::Preserves2dAxisAlignment but relaxed to preserving affine-ness. It returns true if, for 2d rects on the x/y plane, a matrix can be represented as a 2d affine transform on the x/y plane. This is useful for delegated compositing since DrawQuads local space is on the x/y plane. This will let us promote more kinds of quads that have transforms which are "weird but whose weirdness doesn't affect the quad". Change-Id: Ic72b7aa6ebf4c4acff5daad72f4d6d043c29d79b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5304241 Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Commit-Queue: Michael Tang <tangm@microsoft.com> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1262918} CrOS-Libchrome-Original-Commit: c941fac73707428133d97af34040a5d5a0c6604a
2024-02-17Fix gfx::QuadF::IntersectsRect false positivesFredrik Söderquist
A rectangle can be fully outside the quad without one of the quad's edges being a separating axis. We need to check for separating axes among the edges of the rectangle too to be sure. Add a new method Extents() to gfx::QuadF to get the axis-aligned extents (AABB) of the quad. Keep the old IntersectsRect() implementation, but rename it to IntersectsRectPartial(). It can be used (as an optimization) when the pre-conditions allow. Also fix FloatRoundedRect::IntersectsQuad to correctly consider similar cases. Fixed: 40813847 Bug: 40364016 Change-Id: I279ad49f25bae080f481c0f42bbb6af6ae6fde4b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5300420 Commit-Queue: Fredrik Söderquist <fs@opera.com> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1261565} CrOS-Libchrome-Original-Commit: 9bdb9a8de00b18c027ca8fd48c8c3b67ca0447b5
2024-02-10Use EnclosingRectIgnoringError when converting dp->pixelsMitsuru Oshima
Bug: 40257754 Change-Id: Ic642a6ad884cd60c7dd35269c152716406c83028 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5278355 Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org> Reviewed-by: Eliot Courtney <edcourtney@chromium.org> Commit-Queue: Mitsuru Oshima <oshima@chromium.org> Cr-Commit-Position: refs/heads/main@{#1258693} CrOS-Libchrome-Original-Commit: 3afd74c19f587017e496dd14a38e24495183e4bc
2024-02-10Rename {absl => std}::optional in //ui/Arthur Sonzogni
#cleanup Automated patch. This is a no-op. Please avoid, as much as possible, assigning unrelated bugs to this. Context: -------- https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email As of https://crrev.com/1204351, absl::optional is now a type alias for std::optional. We should migrate toward it. This patch: ---------- This applies the rename to ui/ Script: ------- ```` cd ui function replace { echo "Replacing $1 by $2" git grep -l "$1" \ | cut -f1 -d: \ | grep \ -e "\.h" \ -e "\.cc" \ -e "\.mm" \ | sort \ | uniq \ | xargs sed -i "s/$1/$2/g" } replace "absl::make_optional" "std::make_optional" replace "absl::optional" "std::optional" replace "absl::nullopt" "std::nullopt" replace "absl::in_place," "std::in_place," replace "absl::in_place_t," "std::in_place_t," replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>" cd .. git status echo "Formatting" echo "IncludeBlocks: Regroup" >> ".clang-format" echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format" git cl format git restore ".clang-format" ``` # Skipping win-presubmit, due to a bug in depot_tools: # See https://g-issues.chromium.org/issues/324293047 NOPRESUBMIT=true CQ_INCLUDE_TRYBOTS=luci.chrome.try:chromeos-betty-pi-arc-chrome AX-Relnotes: n/a. Cleanup: This is a cleanup. Bug: chromium:1500249 Change-Id: I134bbce97a0ae63ae432a5733e934828f8f49c77 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5279376 Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org> Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1258447} CrOS-Libchrome-Original-Commit: 3eb9fd518875bee685ad2e8c2b699822a8dfd5d9
2023-11-28Fix header guards in ui/.shaochenguang
Generated mechanically as follows: git ls-files '*.h' | grep -E '^ui/' | \ xargs parallel cpplint.py --filter=-,+build/header_guard -- 2>&1 | \ grep build/header_guard | tools/apply_cpplint_header_guard.py Bug: 1200694 Change-Id: Ib235f09c17debcb15028711f3cde9545668c0db3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5052426 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Owners-Override: Nico Weber <thakis@chromium.org> Reviewed-by: Brendon Tiszka <tiszka@chromium.org> Cr-Commit-Position: refs/heads/main@{#1229722} CrOS-Libchrome-Original-Commit: 43cbfce8b43d1ffd1630d4e2dad98062e7aff236
2023-09-30Use ToEnclosingRect() when transforming MaskFilterInfo instancesAntonio Gomes
gfx::MaskFilterInfo, that holds a gfx::RRectF instance, operates over ceiled bounds in both cc and viz, as seen [1][2], for example. [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/widget/widget_base.cc;l=437?q=third_party%2Fblink%2Frenderer%2Fplatform%2Fwidget%2Fwidget_base.cc&ss=chromium [2] https://source.chromium.org/chromium/chromium/src/+/main:cc/layers/layer_impl.cc;drc=80909977e0f2480462cedc4fc82a955c39d12bfd;l=163 The problem is that MaskFilterInfo itself holds un-ceiled values. The occasional precision difference might result in having a 1-off pixel visual discrepancies (see the referenced bugs below). This CL calls gfx::ToEnclosingRect() right after transforming a MasfFilterInfo instance, so that it operates over ceiled bounds with its value also ceiled. In practice, it fixes is the alignment of pixels between content and non-content areas (because rounded corners mask is also results in clipping). Moreover, it also helps to reduce the number of render passes as viz refuses to merge mask filters that contain rounded corners when a renderer also sets rounded corners. That is, when such a content is at the border of a window, it can actually span outside the non-content's rounder corner bounds. Thus, making viz::CanMergeMaskFilterInfo fail and resulting in an unnecessary render pass BUG=1443413 R=msisov@igalia.com Change-Id: I8f982856f5ad708cc178c69db0b2508d3f61f52f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4726545 Reviewed-by: Ian Vollick <vollick@chromium.org> Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Antonio Gomes <tonikitoo@igalia.com> Cr-Commit-Position: refs/heads/main@{#1203263} CrOS-Libchrome-Original-Commit: ff0e1be53c35cfbdd1fb92874a179e7d5480a1cf
2023-08-29[ios] Enable more gfx_unittests for use_blinkIan Vollick
This CL includes a number of unit test files that had previously been excluded from the build. Some changes were required to get these tests to pass. I've also changed and simplified the gn rules regarding nine_image_painter and its corresponding test (and made the conditions for including the source/test consistent with one another). It appears that these are only used for views, so I've made the logic more explicit and unrelated to is_ios. This revealed an issue with fallback fonts (see crbug.com/1476170) for details. Bug: 1425156,1476170 Change-Id: I041afd79f048076b8ba12324efc5a53c7a5eb25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4814094 Commit-Queue: Ian Vollick <vollick@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/main@{#1189007} CrOS-Libchrome-Original-Commit: d0ef987fa9501e93add352154cc298df098098b6
2023-08-11Add gfx::RRectF::CornerBoundingRect()Antonio Gomes
This CL is a preparation CL. Basically, it extracts out an existing ComputeRoundedCornerBoundingBox() anonynous function from //components/viz/service/display/direct_renderer.cc and adds it to gfx::RRectF class. Later, it will be reused in [1]. [1] https://crrev.com/c/4743486 BUG=1462171 Change-Id: Ie1d4ff37c0ffff73722ef0ded807c08ab3a7883a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4764590 Reviewed-by: Ian Vollick <vollick@chromium.org> Reviewed-by: Peter McNeeley <petermcneeley@chromium.org> Commit-Queue: Antonio Gomes <tonikitoo@igalia.com> Cr-Commit-Position: refs/heads/main@{#1182113} CrOS-Libchrome-Original-Commit: 5dd8a988f355ce9c100fa551c6b061cba0015234
2023-06-29gfx: Add constructor RectF(const Size&)Michael Tang
This enables more conciseness in cases where we e.g. have a Size that represents an image's dimensions and we want to address the entire image with RectF texture coordinates. This allows us to replace usages of RectF(SizeF(Size())) and RectF(Rect(Size())). Change-Id: I6427df617520771d61d505661cab0c70c6ae30a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4652944 Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Michael Tang <tangm@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1163766} CrOS-Libchrome-Original-Commit: d07b408021b77930918e1357b89628012523ee98
2023-06-27Clamp result of gfx::ComputeTransform2dScaleComponents()Xianzhu Wang
This is like how we clamp float results in gfx::Transform methods, to avoid nan/infinite value, and reduce the chance of producing nan/infinite values in subsequent arithmetic operations. Bug: 1428708 Change-Id: I9f1c4de9225b723ea9e992742c1f0c88fb3c8524 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4630517 Reviewed-by: Ian Vollick <vollick@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1162488} CrOS-Libchrome-Original-Commit: 95c9bf045f02880ee54ed11e5d3f0135bf38eadf
2023-05-31Speed up SinCosDegrees() by manual range reduction.Steinar H. Gunderson
SinCosDegrees() is fortunate enough to take in its arguments in degrees (360 degrees = 1 turn) instead of radians (2pi radians = 1 turn). Accurate range reduction in degrees is much simpler than in radians; 45 is a whole number and exactly representable as a double, unlike pi/2. This means that we can get greater accuracy _and_ higher speed than the current code of fmod() + internal sincos() range reduction, by doing it ourselves, mostly branch-free. (In particular, fmod() appears to be very slow on macOS.) This gives a small boost in MotionMark for the Leaves and/or Multiply subtests, which both make heavy use of rotate() in CSS. MotionMark (mac-m1_mini_2020-perf, 95% CI, only significant results): motionmark_ramp_leaves [ +0.7%, +1.0%] Same with win-10-perf: motionmark_ramp_multiply [ +0.6%, +1.9%] Change-Id: Iedf1822d2995408531a623d0768373703941e3e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4537360 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Steinar H Gunderson <sesse@chromium.org> Cr-Commit-Position: refs/heads/main@{#1150624} CrOS-Libchrome-Original-Commit: 109a4bf331d1dfd527013cc419395525b0490f68
2023-04-27Remove `base/cxx17_backports.h` from the code in ui/Ho Cheung
Remove the reference to `base/cxx17_backports.h` from the code. Bug: 1373621 Change-Id: I1acb565862af6278a05f6fe6a6967d87f515964b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4477636 Auto-Submit: Ho Cheung <uioptt24@gmail.com> Reviewed-by: Avi Drissman <avi@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1136021} CrOS-Libchrome-Original-Commit: 2b6335bb4d7ad9a9ddda681d2017e44bee2eb6f3
2023-04-25Include client-drawn window decorations in aspect ratio.Frank Liberato
Widget::SetAspectRatio() should set the aspect ratio of the content area only, excluding the title bar and other decorations. To do so, it assumes that the underlying platform window system ignores its own title bar and other decorations when enforcing the aspect ratio. Unfortunately, this doesn't work in those cases where chrome draws the decorations in the non-client area; the underlying window manager has no idea that these should be excluded, and the aspect ratio of the Widget's contents is now wrong. This is visible in Picture in Picture windows, which have a (chrome-drawn) title bar, and which support aspect ratio lock. This CL allows a WidgetDelegate to specify an additional number of screen pixels to exclude from the aspect ratio calculation to take into account any chrome-drawn decorations. This CL includes the plumbing for the excluded margin, and an implementation for Windows. Other implementations will follow in separate CLs. Change-Id: I150a8c806d42a9a60b6710fe300671b6afe9ac8c Bug: 1407629 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4336172 Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Commit-Queue: Frank Liberato <liberato@chromium.org> Cr-Commit-Position: refs/heads/main@{#1134986} CrOS-Libchrome-Original-Commit: 3a06e758a5820009ee0f2590b08a311f00d76163
2023-04-25Convert base::clamp() to std::clamp() in ui/Ho Cheung
According to the instructions at crbug.com/1373621, we should convert base::clamp() to std::clamp() in the code. This is a continuation of the previous CLs https://chromium-review.googlesource.com/c/chromium/src/+/4410943 https://chromium-review.googlesource.com/c/chromium/src/+/4461000 https://chromium-review.googlesource.com/c/chromium/src/+/4462333 https://chromium-review.googlesource.com/c/chromium/src/+/4462797 https://chromium-review.googlesource.com/c/chromium/src/+/4460969 https://chromium-review.googlesource.com/c/chromium/src/+/4462837 https://chromium-review.googlesource.com/c/chromium/src/+/4461080 https://chromium-review.googlesource.com/c/chromium/src/+/4462838 https://chromium-review.googlesource.com/c/chromium/src/+/4461296 Bug: 1373621 Change-Id: I48f500c01fff2991b6c86650dbc48251170341bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4461002 Reviewed-by: Thomas Lukaszewicz <tluk@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Auto-Submit: Ho Cheung <uioptt24@gmail.com> Reviewed-by: Peter Kasting <pkasting@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1134612} CrOS-Libchrome-Original-Commit: 69982e42da25a60eba54c7c88e97577f7cf67fd2
2023-04-12Add missing includes causing build errors with GCC/libstdc++ 13Bruno Pitrus
Bug: 957519 Change-Id: If09ae682695714a19e37f3830013a003caba025a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4330267 Reviewed-by: Ken Rockot <rockot@google.com> Auto-Submit: Bruno Pitrus <brunopitrus@hotmail.com> Reviewed-by: Reilly Grant <reillyg@chromium.org> Commit-Queue: Ken Rockot <rockot@google.com> Reviewed-by: Robert Kaplow <rkaplow@chromium.org> Cr-Commit-Position: refs/heads/main@{#1128822} CrOS-Libchrome-Original-Commit: 6bbf6b001e085025cf33412b15eb79d46e2e670c
2023-04-06IWYU: add stdint.h for integer types in //uiStephan Hartmann
Bug: 957519 Change-Id: I33698e997a32c36db19775f0cf4b22fb13cee349 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4400997 Commit-Queue: Stephan Hartmann <stha09@googlemail.com> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/main@{#1126829} CrOS-Libchrome-Original-Commit: 7815db39abc8ccf64305c5fbac7e0f88bcc8b371
2023-03-31Adds QuadF to geometry mojomAlex Mitra
Also adds bindings so that native QuadF objects and Mojo's QuadF structs can be used interchangeably. Change-Id: I4af01201c59e477276b7d8ea8ef3dc80289377cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4380650 Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Commit-Queue: Alex Mitra <alexmitra@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/main@{#1124256} CrOS-Libchrome-Original-Commit: cd120930b6f590e984b94f56ac328ddf2a7ed31e
2023-02-20inputs: Add lacros browser tests for surrounding text.Darren Shen
Add a new test API for testing surrounding text changes. This is necessary for testing methods that require surrounding text, such as ConfirmCompositionText. Bug: b/238838841 Change-Id: I6d0a4ad9ab94a2e146b4ae2cc98b76f3da774468 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4199863 Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Commit-Queue: Darren Shen <shend@chromium.org> Reviewed-by: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Curtis McMullan <curtismcmullan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1107320} CrOS-Libchrome-Original-Commit: 2112e08f30869247c96ed361940af02d5b336632
2023-02-04[tracing] Add trace events about scroll deltas for scrolling.Violetta Fedotova
Add trace events to help us monitor low-level scrolling signals: - ScrollTree::ScrollBy - perfetto::TracedValue support for gfx geometry primitives - EventForwarder::OnTouchEvent - List of inputs that were shown together in one GPU frame - Add frame ids to Graphics.Pipeline event to make it possible to correlate this with PipelineReporter. - Add trace_id to ScrollUpdate EventLatency to be able select all debug traces related to a particular input # Example of using this tracing data Screenshot: https://screenshot.googleplex.com/BrKjcNfpSR8V2xP Script: https://paste.googleplex.com/6052006484508672 PAIR=mekk@chromium.org PAIR=altimin@chromium.org Bug: b/266910376 Change-Id: Ib72dcceb1218c77ac083c5ec7cae3e8ef0b6f8c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4194682 Reviewed-by: Robert Flack <flackr@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Jonathan Ross <jonross@chromium.org> Commit-Queue: Violetta Fedotova <violettfaid@google.com> Cr-Commit-Position: refs/heads/main@{#1101181} CrOS-Libchrome-Original-Commit: 842ccc30ea77a351443fcb13420b2f7d6eb9a9ac
2023-01-31Make MaskFilterInfo::ApplyTransform() always succeedXianzhu Wang
The return value wasn't very helpful to callers which either fell back to render nothing, DCHECK which could fail, or ignore the return value and DCHECK failures might happen later. Now let the functions handle errors internally by setting the rrect to empty to avoid later DCHECK failures. Bug: 1409809 Change-Id: I2942c71bb25cacc0b966d472eecf8d4f95bfd50a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4198642 Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Vladimir Levin <vmpstr@chromium.org> Commit-Queue: Vladimir Levin <vmpstr@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1098770} CrOS-Libchrome-Original-Commit: faf4886a8b39321021a103b23c701179a128a22f
2023-01-11Remove DCHECK on improperly scaled rrectsMason Freed
This DCHECK sporadically gets hit, due to scaling issues with the provided scale factors. Instead of DCHECKing, just return an empty rect in this case. Fixed: 1404030 Change-Id: Ic0b45774ecc4d49374d3f081b30c36d410589642 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150200 Commit-Queue: danakj <danakj@chromium.org> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1091060} CrOS-Libchrome-Original-Commit: 7ddf0ae3c1cc27b8e44a4298f3771b303cc0696f
2023-01-04Rename IsIdentityOr2DTranslation to IsIdentityOr2dTranslationXianzhu Wang
Use lowercase 'd' in '2d' to keep consistent with other names in gfx::Transform. Bug: 1359528 Change-Id: I95318a8d6963b4b20a5a72a9fe7ee6b535899b63 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4021558 Owners-Override: danakj <danakj@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1088351} CrOS-Libchrome-Original-Commit: 5ffd34c90c05f322628fc3f7cc5c381f6bad2198
2022-11-28Add missing ostream includes.Jean-Philippe Gravel
These compilation units had a transitive dependency on ostream via base/numerics/safe_conversions.h. The ostream include in safe_conversions.h is however unused and should be removed. This CL was uploaded by git cl split. R=danakj@chromium.org Bug: 1270812, 1372522 Change-Id: I0bb9381c5cc3c7891c6b04cb9f283ad25a1a0feb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4057398 Commit-Queue: Jean-Philippe Gravel <jpgravel@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Auto-Submit: Jean-Philippe Gravel <jpgravel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1076003} CrOS-Libchrome-Original-Commit: a051282eee0fe4cc1c6190e9a8856159613ad5d2
2022-11-24Add parameters to gfx::Transform::ApproximatelyEqual()Xianzhu Wang
So that it can be used in more places where different tolerances are needed. Bug: 1359528 Change-Id: I36d1e1d67cba1f2709dcb42c213ca0da17124eef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4049501 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1075194} CrOS-Libchrome-Original-Commit: f676a65e033e9219cdc2a0b5de439a4ddc43835e
2022-11-17Add constexpr to some gfx::Transform constructorsXianzhu Wang
Also revert some changes in crrev.com/c/3953120 which made the default constructor of gfx:Transform not constexpr. Bug: 1359528 Change-Id: Ieff33957fdddc176d4c2848cbacac9278e059f60 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4021534 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Owners-Override: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1072383} CrOS-Libchrome-Original-Commit: fc1476b973978acb99b34a92d31448565533c893
2022-11-13Reland "Remove some blink optimizations about 2d translations"Xianzhu Wang
This reverts commit 67bedecbcfe87d9ecda2aa7ec6267ac577685d4d. Reason for revert: Fix the build issue. Original change's description: > Revert "Remove some blink optimizations about 2d translations" > > This reverts commit 41bc3ae3beb29c170ffd6302b51e44d0dd2e334e. > > Reason for revert: broken build https://ci.chromium.org/ui/p/chromium/builders/ci/Mac%20Builder/179363/overview > > Original change's description: > > Remove some blink optimizations about 2d translations > > > > We have combined blink::TransformationMatrix and gfx::Transform. > > gfx::Transform has built-in optimization for simple 2d > > scale/translation transforms, so the blink optimizations about 2d > > translations are redundant. > > > > Bug: 1359528 > > Change-Id: I914634e458183defc9d539e3cf4d034124e97270 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4009620 > > Reviewed-by: Philip Rogers <pdr@chromium.org> > > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > > Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1070507} > > Bug: 1359528 > Change-Id: I4b3d231d933c79d92ad05e6bf01bebb28b5883f8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4024029 > Commit-Queue: Eugene Zemtsov <ezemtsov@google.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Owners-Override: Eugene Zemtsov <ezemtsov@google.com> > Cr-Commit-Position: refs/heads/main@{#1070519} Bug: 1359528 Change-Id: Ib6e219f018f0fb32454316ccbdb80cfce7799bb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4024030 Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1070701} CrOS-Libchrome-Original-Commit: 364ea96433a5b5794075c1e55e3aa36ec7b24e39
2022-11-12Revert "Remove some blink optimizations about 2d translations"Eugene Zemtsov
This reverts commit 41bc3ae3beb29c170ffd6302b51e44d0dd2e334e. Reason for revert: broken build https://ci.chromium.org/ui/p/chromium/builders/ci/Mac%20Builder/179363/overview Original change's description: > Remove some blink optimizations about 2d translations > > We have combined blink::TransformationMatrix and gfx::Transform. > gfx::Transform has built-in optimization for simple 2d > scale/translation transforms, so the blink optimizations about 2d > translations are redundant. > > Bug: 1359528 > Change-Id: I914634e458183defc9d539e3cf4d034124e97270 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4009620 > Reviewed-by: Philip Rogers <pdr@chromium.org> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1070507} Bug: 1359528 Change-Id: I4b3d231d933c79d92ad05e6bf01bebb28b5883f8 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4024029 Commit-Queue: Eugene Zemtsov <ezemtsov@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Owners-Override: Eugene Zemtsov <ezemtsov@google.com> Cr-Commit-Position: refs/heads/main@{#1070519} CrOS-Libchrome-Original-Commit: 67bedecbcfe87d9ecda2aa7ec6267ac577685d4d
2022-11-12Remove some blink optimizations about 2d translationsXianzhu Wang
We have combined blink::TransformationMatrix and gfx::Transform. gfx::Transform has built-in optimization for simple 2d scale/translation transforms, so the blink optimizations about 2d translations are redundant. Bug: 1359528 Change-Id: I914634e458183defc9d539e3cf4d034124e97270 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4009620 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1070507} CrOS-Libchrome-Original-Commit: 41bc3ae3beb29c170ffd6302b51e44d0dd2e334e
2022-11-11Optimize some 2d full matrix operations in gfx::TransformXianzhu Wang
There are two purposes: 1. To improve performance of 2d full matrix operations. Though full matrices are rare, some special apps (e.g. motionmark) use full 2d matrices heavily. This CL can improve motionmark CanvasLine Leaves and Multiply by about 1% (https://pinpoint-dot-chromeperf.appspot.com/job/112ba12e5a0000). 2. To ensure 2d preservation in Inverse and Concat operations. Bug: 1359528 Change-Id: Iab03df64166d8105e18652e2872fa1b34837f284 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4017954 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1069953} CrOS-Libchrome-Original-Commit: f7c4f08a3c5bbc31ba9916f8372671aef62a34d2
2022-11-10Remove spurious stringprintf.h includes from non-headers.Lei Zhang
Files that do not match the patterns StringPrint[fV] and StringAppend[FV] don't need this include. Bug: 242216 Change-Id: Id927c7500e6ac41f1aa1e411b0461cc75d8509fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4014655 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Owners-Override: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#1069457} CrOS-Libchrome-Original-Commit: 2d62ab6b0363a9e409f289b6ecfc57515a05f379
2022-11-09Move remaining blink::TransformationMatrixTest into gfx::XFormTestXianzhu Wang
Bug: 1359528 Change-Id: I38a7a09d134e064dd0af76e14bb90f9aeeaed50c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3992886 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#1069015} CrOS-Libchrome-Original-Commit: 963779c4f93fb29846545d869cc483d788de0914
2022-11-09Use gfx::Transform::Decompose/Blend/Compose/Accumulate for blink 2d/3dXianzhu Wang
Add gfx::AccumulateDecomposedTransforms() which extracts the original blink::Matrix3DTransformOperation::Accumulate(). Let blink::MatrixTransformOperation use the unified 2d/3d version of interpolation methods. There is a difference between gfx::Transform::Blend() and the original blink::TransformationMatrix::Blend() when |this| or |from| can't be decomposed: - gfx::Transform::Blend() returns false and doesn't change |this|. - The original blink::TransformationMatrix::Blend() automatically sets |this| to |from| if |progress| < 0.5. Modified callers to use the gfx::Transform::Blend() convention and to perform discrete interpolation as necessary. Bug: 1359528 Change-Id: I320b3a469a8271140dc02ef82f6571642b989c44 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3979782 Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/main@{#1068969} CrOS-Libchrome-Original-Commit: 91ca54c5f6672ef4d1a03dcd8a5184b0d5743526
2022-11-09Reland "Let blink::TransformationMatrix inherit gfx::Transform"Xianzhu Wang
This reverts commit ad877c510f1869b1966e83d704cfc01b86a0b90b. Reason for revert: crrev.com/c/4005199 (landed before this CL) resolves most regression of crbug.com/1379559. Subsequent CLs will improve performance more. Original change's description: > Revert "Let blink::TransformationMatrix inherit gfx::Transform" > > This reverts commit 492f5401586882bf127a3cfcc6567df79608a249. > > Reason for revert: Performance regressions, e.g. crbug.com/1379559. > > Original change's description: > > Let blink::TransformationMatrix inherit gfx::Transform > > > > Now gfx::Transform meets most requirements of blink. This CL is an > > intermediate step to combine blink::TransformationMatrix and > > gfx::Transform. > > > > Bug: 1359528 > > Change-Id: Id87f742cd38f1e14b4334ac4829236ef316ee42d > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3969568 > > Reviewed-by: Philip Rogers <pdr@chromium.org> > > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > > Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1065013} > > Bug: 1359528, 1379559 > Change-Id: I14ec2e84fe53d227245a7b85221651ce37336b75 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3993664 > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> > Reviewed-by: Philip Rogers <pdr@chromium.org> > Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Cr-Commit-Position: refs/heads/main@{#1065605} Bug: 1359528 Change-Id: I8dc7fe3a1d62dff8bdaa6627660e07ac8275a079 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3996242 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1068873} CrOS-Libchrome-Original-Commit: 0abc1c5b5770085b75b003b67837778c85e4767d
2022-11-05Other simple methods of gfx::Transform copied from blinkXianzhu Wang
Is2dProportionalUpscaleAndOr2dTranslation() IsIdentityOrInteger2dTranslation() Creates3d() ApplyTransformOrigin() To3dTranslation() Names containing "2D" or "3D" are renamed to "2d" and "3d" to keep consistent with existing methods. Bug: 1359528 Change-Id: I7570c04bda19f41ab59f412c483e5455a1a874b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4007074 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067781} CrOS-Libchrome-Original-Commit: f4222d0ef202d7bd3e527718e492b16a08ee26a1
2022-11-05gfx::Transform::Zoom()Xianzhu Wang
It is copied from blink::TransformationMatrix::Zoom(). Bug: 1359528 Change-Id: I0916d25cc6a0774950b83a551a9ca30d95233eec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4006835 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067747} CrOS-Libchrome-Original-Commit: 8e3fcddca31a2a7d0d0f06a76e08e717055886fc
2022-11-05Put gfx::Transform::matrix_ into a union instead of through unique_ptrXianzhu Wang
unique_ptr<Matrix44> caused 5% regression of MotionMark Leaves and Multiply with blink using gfx::Transform (crbug.com/1379559). This CL will avoid much of the regressions, with a bit more cost which is related to memory usage and cache localization in simple 2d translation/scale cases. Will improve that by using AxisTransform2d directly instead of Transform where we are sure the transform is always simple. Bug: 1359528, 1379559 Change-Id: Iaf6720b7ebc9387f82fcf6db1f5921ba57a4e1a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4005199 Reviewed-by: David Baron <dbaron@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067744} CrOS-Libchrome-Original-Commit: e45abc630b135b1dd9bf7c6e499fcb7cc45ed1fc
2022-11-03Rename FlattenTo2d() to Flatten() in Transform classesXianzhu Wang
The "2d" in FlattenTo2d() was different from the term "2d" used elsewhere, especially it was different from the "2d" concept in w3c geometry and css-transform specs where a 2d transform means an affine 2d transform not having perspective values. The new name looks clearer, and is consistent with IsFlat(). Bug: 1359528 Change-Id: I2238d62744fda56ebd38f89bc2d763db7816ef81 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4000870 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067373} CrOS-Libchrome-Original-Commit: 966482600043fa2cf5e19a49d3e38bc65003915d