diff --git a/DEPS b/DEPS index 1d20622..87255ba 100644 --- a/DEPS +++ b/DEPS
@@ -202,7 +202,7 @@ # luci-go CIPD package version. # Make sure the revision is uploaded by infra-packagers builder. # https://ci.chromium.org/p/infra-internal/g/infra-packagers/console - 'luci_go': 'git_revision:91cbdea8898ac2d498f2412d35279b00784a1ece', + 'luci_go': 'git_revision:d3f13de997dcae45d2af9210be74e7eb96a98268', # This can be overridden, e.g. with custom_vars, to build clang from HEAD # instead of downloading the prebuilt pinned revision. @@ -234,15 +234,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '6dc45289aec01479497f1336dc4ef1dcddce000b', + 'skia_revision': '85bd4dff5918c593b82cc145e8fd49ca8722946a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '9ea984fb8943eeb3f7a986ad6708fedcc6df1ea4', + 'v8_revision': '4dae36a5ece685f23bb9b856fbf3bf7fcf847b65', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'f3052589f723dda12431cfe3e0d4c7bdd031f149', + 'angle_revision': 'fe42ac4df49fcd8b1e371276972b201f78a9a00d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -301,7 +301,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'fad4e048b0a489a34f444592e390b1b03b584adf', + 'catapult_revision': 'dbf853603ce6a1eb14d02a2e43875797fc9c2ad3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -791,7 +791,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': '8psIPDigEQ4L6gV80_7FCGGuyGy_ExaUlGBytDFeHX8C', + 'version': '23VjQ9dCVD98RkTWB2Y4PI7LwSQpBoyjad4NUH9io9EC', }, ], 'condition': 'checkout_android', @@ -1025,12 +1025,12 @@ # For Linux and Chromium OS. 'src/third_party/cros_system_api': { - 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + 'a2f3b1690899d89d3d979bb04b3ad751b7a21ac1', + 'url': Var('chromium_git') + '/chromiumos/platform2/system_api.git' + '@' + '48bb7e7474f066964e314a2c2e110912ce99a05b', 'condition': 'checkout_linux', }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'fc79a334667f9152f069186afb34e9be7f094809', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '98be56f2e011a0a9484ffc34bfab4edbb3fbc214', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1396,7 +1396,7 @@ Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + 'b52786888ddce9d6bc06b7825ba9bffc65924e0c', 'src/third_party/openscreen/src': - Var('chromium_git') + '/openscreen' + '@' + 'f1c6841fc07df323c0dd90fa1be000152a7cd99a', + Var('chromium_git') + '/openscreen' + '@' + 'ae15ed85690e25210f86155a799bb34144f0215a', 'src/third_party/openxr/src': { 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + 'bf21ccb1007bb531b45d9978919a56ea5059c245', @@ -1634,7 +1634,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '770facab6251abd3a78c7685b6ca4200c0a49f81', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '4b7024b57216be77a93fe27ec6dcf9020ee9cd60', + Var('webrtc_git') + '/src.git' + '@' + '7bafbd6c8c9eb2c100604fc18cac4acc0de339af', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1661,7 +1661,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/linux-amd64', - 'version': 'CseaUnLJ7HPr--xryu13CF7Iir6n0b8qmCJXm6gyZ4oC', + 'version': 'wdkOk4Hhfdk2f0Fn4TnicgWCxDVdkOK0W71K0ivXMaEC', }, ], 'dep_type': 'cipd', @@ -1671,7 +1671,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': 'W_IYtpGZzolSY2j4xqryufwbZeApZYaqqcn4-CTtpL0C', + 'version': 'BkeCwTnJJi2hffEKlsGWTiP5quyDianpBWnloFZ49ZEC', }, ], 'dep_type': 'cipd', @@ -1681,7 +1681,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-amd64', - 'version': 'VY8wueKQ3PgFlxfrtkyEqIEUBvFjmyowZ9aUNYRyEhcC', + 'version': 'gJSgm5xIzq6ePie9lIvMfyt3vEXbiVb5NreHTEkFS58C', }, ], 'dep_type': 'cipd', @@ -1692,7 +1692,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b57e733872d8defb8532283ad45a942e7102c0d8', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@13da370a50cdb3c11edc0dc342bfaac5e7ebd006', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 8a0ff10..0bef007 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2153,13 +2153,14 @@ data_deps = [ ":dbus_service_files" ] assert_no_deps = [ + "//ash/components/arc", + # Ash should not depend upon cryptohome_client or components that depend # on it. TODO(stevenjb): Assert on //chromeos/dbus/cryptohome_client once it # is extracted from //chromeos/dbus. https://crbug.com/647367. "//chromeos/cryptohome", "//chromeos/login/auth", "//chromeos/tpm", - "//components/arc", # Ash should not depend upon content at all. "//content/public/browser",
diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc index a9727216..9eac9188 100644 --- a/ash/accelerators/accelerator_commands.cc +++ b/ash/accelerators/accelerator_commands.cc
@@ -23,6 +23,7 @@ #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "base/metrics/user_metrics.h" +#include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/ui/base/window_properties.h" #include "ui/display/display.h" #include "ui/display/display_switches.h" @@ -217,6 +218,10 @@ WindowState::Get(active_window)->OnWMEvent(&event); } +void ToggleKeyboardBacklight() { + // TODO: b/194146863 Add KBL toggle implementation +} + void ToggleMaximized() { aura::Window* active_window = window_util::GetActiveWindow(); if (!active_window)
diff --git a/ash/accelerators/accelerator_commands.h b/ash/accelerators/accelerator_commands.h index a5aa594..e54d114f 100644 --- a/ash/accelerators/accelerator_commands.h +++ b/ash/accelerators/accelerator_commands.h
@@ -104,6 +104,9 @@ // by WindowStateDelegate::ToggleFullscreen(). ASH_EXPORT void ToggleFullscreen(); +// Toggle keyboard backlight. +ASH_EXPORT void ToggleKeyboardBacklight(); + // Toggles the maxmized state. If the window is in fulllscreen, it exits // fullscreen mode. ASH_EXPORT void ToggleMaximized();
diff --git a/ash/accelerators/accelerator_controller_impl.cc b/ash/accelerators/accelerator_controller_impl.cc index 811c98e..e591a8b 100644 --- a/ash/accelerators/accelerator_controller_impl.cc +++ b/ash/accelerators/accelerator_controller_impl.cc
@@ -1842,6 +1842,7 @@ case DESKS_ACTIVATE_7: case DESKS_TOGGLE_ASSIGN_TO_ALL_DESKS: return true; + case DEBUG_KEYBOARD_BACKLIGHT_TOGGLE: case DEBUG_MICROPHONE_MUTE_TOGGLE: case DEBUG_PRINT_LAYER_HIERARCHY: case DEBUG_PRINT_VIEW_HIERARCHY: @@ -1951,6 +1952,7 @@ case FOCUS_NEXT_PANE: case FOCUS_PREVIOUS_PANE: case FOCUS_SHELF: + case KEYBOARD_BACKLIGHT_TOGGLE: case KEYBOARD_BRIGHTNESS_DOWN: case KEYBOARD_BRIGHTNESS_UP: case LAUNCH_APP_0: @@ -2077,10 +2079,8 @@ case DESKS_TOGGLE_ASSIGN_TO_ALL_DESKS: HandleToggleAssignToAllDesks(); break; + case DEBUG_KEYBOARD_BACKLIGHT_TOGGLE: case DEBUG_MICROPHONE_MUTE_TOGGLE: - base::RecordAction(base::UserMetricsAction("Accel_Microphone_Mute")); - accelerators::MicrophoneMuteToggle(); - break; case DEBUG_PRINT_LAYER_HIERARCHY: case DEBUG_PRINT_VIEW_HIERARCHY: case DEBUG_PRINT_WINDOW_HIERARCHY: @@ -2134,6 +2134,10 @@ base::RecordAction(base::UserMetricsAction("Accel_Focus_Pip")); accelerators::FocusPip(); break; + case KEYBOARD_BACKLIGHT_TOGGLE: + base::RecordAction(base::UserMetricsAction("Accel_Keyboard_Backlight")); + accelerators::ToggleKeyboardBacklight(); + break; case KEYBOARD_BRIGHTNESS_DOWN: { KeyboardBrightnessControlDelegate* delegate = Shell::Get()->keyboard_brightness_control_delegate();
diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 4ab5fb3..2a7052f 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc
@@ -64,6 +64,7 @@ const AcceleratorData kDebugAcceleratorData[] = { {true, ui::VKEY_N, kDebugModifier, TOGGLE_WIFI}, + {true, ui::VKEY_X, kDebugModifier, DEBUG_KEYBOARD_BACKLIGHT_TOGGLE}, {true, ui::VKEY_M, kDebugModifier, DEBUG_MICROPHONE_MUTE_TOGGLE}, {true, ui::VKEY_O, kDebugModifier, DEBUG_SHOW_TOAST}, {true, ui::VKEY_P, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, @@ -131,7 +132,9 @@ const size_t kPreferredActionsLength = base::size(kPreferredActions); const AcceleratorAction kReservedActions[] = { - POWER_PRESSED, POWER_RELEASED, SUSPEND, + POWER_PRESSED, + POWER_RELEASED, + SUSPEND, }; const size_t kReservedActionsLength = base::size(kReservedActions); @@ -148,6 +151,7 @@ DEBUG_TOGGLE_TABLET_MODE, DEV_ADD_REMOVE_DISPLAY, DISABLE_CAPS_LOCK, + KEYBOARD_BACKLIGHT_TOGGLE, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, MAGNIFIER_ZOOM_IN, // Control+F7 @@ -212,12 +216,14 @@ const AcceleratorAction kActionsAllowedAtModalWindow[] = { BRIGHTNESS_DOWN, BRIGHTNESS_UP, + DEBUG_KEYBOARD_BACKLIGHT_TOGGLE, DEBUG_MICROPHONE_MUTE_TOGGLE, DEBUG_TOGGLE_TOUCH_PAD, DEBUG_TOGGLE_TOUCH_SCREEN, DEV_ADD_REMOVE_DISPLAY, DISABLE_CAPS_LOCK, EXIT, + KEYBOARD_BACKLIGHT_TOGGLE, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, LOCK_SCREEN, @@ -290,6 +296,7 @@ const AcceleratorAction kActionsAllowedInAppModeOrPinnedMode[] = { BRIGHTNESS_DOWN, BRIGHTNESS_UP, + DEBUG_KEYBOARD_BACKLIGHT_TOGGLE, DEBUG_MICROPHONE_MUTE_TOGGLE, DEBUG_PRINT_LAYER_HIERARCHY, DEBUG_PRINT_VIEW_HIERARCHY, @@ -298,6 +305,7 @@ DEBUG_TOGGLE_TOUCH_SCREEN, DEV_ADD_REMOVE_DISPLAY, DISABLE_CAPS_LOCK, + KEYBOARD_BACKLIGHT_TOGGLE, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, MAGNIFIER_ZOOM_IN, // Control+F7 @@ -380,6 +388,7 @@ const AcceleratorAction kActionsKeepingMenuOpen[] = { BRIGHTNESS_DOWN, BRIGHTNESS_UP, + DEBUG_KEYBOARD_BACKLIGHT_TOGGLE, DEBUG_MICROPHONE_MUTE_TOGGLE, DEBUG_TOGGLE_TOUCH_PAD, DEBUG_TOGGLE_TOUCH_SCREEN, @@ -391,6 +400,7 @@ DESKS_NEW_DESK, DESKS_REMOVE_CURRENT_DESK, DISABLE_CAPS_LOCK, + KEYBOARD_BACKLIGHT_TOGGLE, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, MEDIA_FAST_FORWARD,
diff --git a/ash/accelerators/accelerator_table_unittest.cc b/ash/accelerators/accelerator_table_unittest.cc index d380773..8d09828 100644 --- a/ash/accelerators/accelerator_table_unittest.cc +++ b/ash/accelerators/accelerator_table_unittest.cc
@@ -16,10 +16,10 @@ namespace { // The number of non-Search-based accelerators. -constexpr int kNonSearchAcceleratorsNum = 104; +constexpr int kNonSearchAcceleratorsNum = 105; // The hash of non-Search-based accelerators. See HashAcceleratorData(). constexpr char kNonSearchAcceleratorsHash[] = - "6b27f4e06b2cb15eb1d1597691269dbb"; + "5b40544d68a2355cf33f4afdf32568f1"; struct Cmp { bool operator()(const AcceleratorData& lhs, @@ -127,8 +127,8 @@ for (size_t i = 0; i < kDeprecatedAcceleratorsDataLength; ++i) { // There must never be any duplicated actions. const DeprecatedAcceleratorData& data = kDeprecatedAcceleratorsData[i]; - EXPECT_TRUE(actions.insert(data.action).second) << "Deprecated action: " - << data.action; + EXPECT_TRUE(actions.insert(data.action).second) + << "Deprecated action: " << data.action; // The UMA histogram name must be of the format "Ash.Accelerators.*" std::string uma_histogram(data.uma_histogram_name);
diff --git a/ash/accelerators/debug_commands.cc b/ash/accelerators/debug_commands.cc index cd1f0b4..91a80a4c 100644 --- a/ash/accelerators/debug_commands.cc +++ b/ash/accelerators/debug_commands.cc
@@ -100,6 +100,16 @@ } } +void HandleToggleKeyboardBacklight() { + base::RecordAction(base::UserMetricsAction("Accel_Keyboard_Backlight")); + accelerators::ToggleKeyboardBacklight(); +} + +void HandleToggleMicrophoneMute() { + base::RecordAction(base::UserMetricsAction("Accel_Microphone_Mute")); + accelerators::MicrophoneMuteToggle(); +} + void HandleToggleTouchpad() { base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad")); Shell::Get()->touch_devices_controller()->ToggleTouchpad(); @@ -152,8 +162,11 @@ return; switch (action) { + case DEBUG_KEYBOARD_BACKLIGHT_TOGGLE: + HandleToggleKeyboardBacklight(); + break; case DEBUG_MICROPHONE_MUTE_TOGGLE: - accelerators::MicrophoneMuteToggle(); + HandleToggleMicrophoneMute(); break; case DEBUG_PRINT_LAYER_HIERARCHY: HandlePrintLayerHierarchy();
diff --git a/ash/app_list/app_list_bubble_presenter.cc b/ash/app_list/app_list_bubble_presenter.cc index 34d48a8..e4ec2ac 100644 --- a/ash/app_list/app_list_bubble_presenter.cc +++ b/ash/app_list/app_list_bubble_presenter.cc
@@ -166,6 +166,8 @@ if (bubble_widget_) return; + initial_page_ = Page::kApps; + // Refresh the continue tasks before opening the launcher. If a file doesn't // exist on disk anymore then the launcher should not create or animate the // continue task view for that suggestion. @@ -208,6 +210,11 @@ ->AddObserver(this); controller_->OnVisibilityWillChange(/*visible=*/true, display_id); bubble_widget_->Show(); + // The page must be set before triggering the show animation so the correct + // animations are triggered. + if (initial_page_ == Page::kAssistant) { + bubble_view_->ShowEmbeddedAssistantUI(); + } if (features::IsProductivityLauncherAnimationEnabled()) { bubble_view_->StartShowAnimation(); } @@ -284,7 +291,14 @@ } void AppListBubblePresenter::ShowEmbeddedAssistantUI() { - bubble_view_->ShowEmbeddedAssistantUI(); + // `bubble_view_` does not exist while waiting for zero-state results. + // OnZeroStateSearchDone() sets the page in that case. + if (bubble_view_) { + bubble_view_->ShowEmbeddedAssistantUI(); + } else { + DCHECK(!bubble_widget_); + initial_page_ = Page::kAssistant; + } } void AppListBubblePresenter::OnWidgetDestroying(views::Widget* widget) {
diff --git a/ash/app_list/app_list_bubble_presenter.h b/ash/app_list/app_list_bubble_presenter.h index 74c2ea3..1b604b3c 100644 --- a/ash/app_list/app_list_bubble_presenter.h +++ b/ash/app_list/app_list_bubble_presenter.h
@@ -80,6 +80,9 @@ AppListBubbleView* bubble_view_for_test() { return bubble_view_; } private: + // The code doesn't need a value for the search page. + enum class Page { kApps, kAssistant }; + // Callback for zero state search update. Builds the bubble widget and views // on display `display_id` and triggers the show animation. void OnZeroStateSearchDone(int64_t display_id); @@ -106,6 +109,9 @@ // Whether the bubble hide animation is playing. bool in_hide_animation_ = false; + // The page to show after the views are constructed. + Page initial_page_ = Page::kApps; + // Closes the widget when the user clicks outside of it. std::unique_ptr<AppListBubbleEventFilter> bubble_event_filter_;
diff --git a/ash/app_list/app_list_bubble_presenter_unittest.cc b/ash/app_list/app_list_bubble_presenter_unittest.cc index 236dfac4..d333a17db 100644 --- a/ash/app_list/app_list_bubble_presenter_unittest.cc +++ b/ash/app_list/app_list_bubble_presenter_unittest.cc
@@ -9,9 +9,12 @@ #include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/test/app_list_test_helper.h" #include "ash/app_list/test_app_list_client.h" +#include "ash/app_list/views/app_list_bubble_apps_page.h" #include "ash/app_list/views/app_list_bubble_view.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/public/cpp/test/app_list_test_api.h" +#include "ash/public/cpp/test/assistant_test_api.h" #include "ash/shelf/home_button.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_navigation_widget.h" @@ -26,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/display/display.h" +#include "ui/events/keycodes/keyboard_codes.h" #include "ui/gfx/geometry/vector2d.h" #include "ui/views/test/widget_test.h" #include "ui/views/widget/widget.h" @@ -71,7 +75,8 @@ class AppListBubblePresenterTest : public AshTestBase { public: - AppListBubblePresenterTest() { + AppListBubblePresenterTest() + : assistant_test_api_(AssistantTestApi::Create()) { scoped_features_.InitAndEnableFeature(features::kProductivityLauncher); } ~AppListBubblePresenterTest() override = default; @@ -95,6 +100,7 @@ } base::test::ScopedFeatureList scoped_features_; + std::unique_ptr<AssistantTestApi> assistant_test_api_; }; TEST_F(AppListBubblePresenterTest, ShowOpensOneWidgetInAppListContainer) { @@ -210,6 +216,47 @@ EXPECT_EQ(0u, NumberOfWidgetsInAppListContainer()); } +// Regression test for https://crbug.com/1275755 +TEST_F(AppListBubblePresenterTest, AssistantKeyOpensToAssistantPage) { + // Simulate production behavior for animations, assistant, and zero-state + // search results. + base::test::ScopedFeatureList features( + features::kProductivityLauncherAnimation); + ui::ScopedAnimationDurationScaleMode duration( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); + assistant_test_api_->EnableAssistantAndWait(); + GetTestAppListClient()->set_run_zero_state_callback_immediately(false); + + PressAndReleaseKey(ui::VKEY_ASSISTANT); + AppListTestApi().WaitForBubbleWindow(); + + AppListBubblePresenter* presenter = GetBubblePresenter(); + EXPECT_TRUE(presenter->IsShowing()); + EXPECT_FALSE( + presenter->bubble_view_for_test()->apps_page_for_test()->GetVisible()); + EXPECT_TRUE(presenter->IsShowingEmbeddedAssistantUI()); +} + +TEST_F(AppListBubblePresenterTest, SearchKeyOpensToAppsPage) { + // Simulate production behavior for animations, assistant, and zero-state + // search results. + base::test::ScopedFeatureList features( + features::kProductivityLauncherAnimation); + ui::ScopedAnimationDurationScaleMode duration( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); + assistant_test_api_->EnableAssistantAndWait(); + GetTestAppListClient()->set_run_zero_state_callback_immediately(false); + + PressAndReleaseKey(ui::VKEY_LWIN); // Search key. + AppListTestApi().WaitForBubbleWindow(); + + AppListBubblePresenter* presenter = GetBubblePresenter(); + EXPECT_TRUE(presenter->IsShowing()); + EXPECT_TRUE( + presenter->bubble_view_for_test()->apps_page_for_test()->GetVisible()); + EXPECT_FALSE(presenter->IsShowingEmbeddedAssistantUI()); +} + TEST_F(AppListBubblePresenterTest, DoesNotCrashWhenNativeWidgetDestroyed) { AppListBubblePresenter* presenter = GetBubblePresenter(); presenter->Show(GetPrimaryDisplay().id());
diff --git a/ash/app_list/test_app_list_client.cc b/ash/app_list/test_app_list_client.cc index a2b7ee95..51bcf45 100644 --- a/ash/app_list/test_app_list_client.cc +++ b/ash/app_list/test_app_list_client.cc
@@ -8,6 +8,8 @@ #include "ash/app_list/app_list_model_provider.h" #include "ash/app_list/model/app_list_item.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "base/time/time.h" #include "ui/base/models/simple_menu_model.h" namespace ash { @@ -19,9 +21,15 @@ void TestAppListClient::StartZeroStateSearch(base::OnceClosure on_done, base::TimeDelta timeout) { start_zero_state_search_count_++; - // Unit tests generally expect the launcher to open immediately, so run the - // callback synchronously. - std::move(on_done).Run(); + if (run_zero_state_callback_immediately_) { + // Most unit tests generally expect the launcher to open immediately, so run + // the callback synchronously. + std::move(on_done).Run(); + } else { + // Simulate production behavior, which collects the results asynchronously. + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, std::move(on_done), base::Milliseconds(1)); + } } void TestAppListClient::StartSearch(const std::u16string& trimmed_query) {
diff --git a/ash/app_list/test_app_list_client.h b/ash/app_list/test_app_list_client.h index d8ca7b8..8a9fec6c 100644 --- a/ash/app_list/test_app_list_client.h +++ b/ash/app_list/test_app_list_client.h
@@ -70,6 +70,9 @@ int start_zero_state_search_count() const { return start_zero_state_search_count_; } + void set_run_zero_state_callback_immediately(bool value) { + run_zero_state_callback_immediately_ = value; + } std::u16string last_search_query() const { return last_search_query_; } // Returns the number of AppItems that have been activated. These items could @@ -89,6 +92,7 @@ private: int start_zero_state_search_count_ = 0; + bool run_zero_state_callback_immediately_ = true; std::u16string last_search_query_; std::vector<SearchResultActionId> invoked_result_actions_; int activate_item_count_ = 0;
diff --git a/ash/app_list/views/app_list_bubble_view.cc b/ash/app_list/views/app_list_bubble_view.cc index db69bf8f..23ffa75 100644 --- a/ash/app_list/views/app_list_bubble_view.cc +++ b/ash/app_list/views/app_list_bubble_view.cc
@@ -314,6 +314,9 @@ } void AppListBubbleView::ShowEmbeddedAssistantUI() { + if (IsShowingEmbeddedAssistantUI()) + return; + // The assistant has its own text input field. search_box_view_->SetVisible(false); separator_->SetVisible(false);
diff --git a/ash/app_list/views/app_list_bubble_view_unittest.cc b/ash/app_list/views/app_list_bubble_view_unittest.cc index b5db74d..a4a7bad 100644 --- a/ash/app_list/views/app_list_bubble_view_unittest.cc +++ b/ash/app_list/views/app_list_bubble_view_unittest.cc
@@ -115,12 +115,7 @@ // Simulates the Assistant being enabled. void SimulateAssistantEnabled() { assistant_test_api_ = AssistantTestApi::Create(); - assistant_test_api_->SetAssistantEnabled(true); - assistant_test_api_->GetAssistantState()->NotifyFeatureAllowed( - chromeos::assistant::AssistantAllowedState::ALLOWED); - assistant_test_api_->GetAssistantState()->NotifyStatusChanged( - chromeos::assistant::AssistantStatus::READY); - assistant_test_api_->WaitUntilIdle(); + assistant_test_api_->EnableAssistantAndWait(); } // Shows the app list on the primary display.
diff --git a/ash/app_list/views/assistant/assistant_test_api_impl.cc b/ash/app_list/views/assistant/assistant_test_api_impl.cc index 436690a..310f3287 100644 --- a/ash/app_list/views/assistant/assistant_test_api_impl.cc +++ b/ash/app_list/views/assistant/assistant_test_api_impl.cc
@@ -141,6 +141,15 @@ return Shell::Get()->GetPrimaryRootWindow(); } +void AssistantTestApiImpl::EnableAssistantAndWait() { + SetAssistantEnabled(true); + GetAssistantState()->NotifyFeatureAllowed( + chromeos::assistant::AssistantAllowedState::ALLOWED); + GetAssistantState()->NotifyStatusChanged( + chromeos::assistant::AssistantStatus::READY); + WaitUntilIdle(); +} + void AssistantTestApiImpl::SetAssistantEnabled(bool enabled) { Shell::Get()->session_controller()->GetPrimaryUserPrefService()->SetBoolean( chromeos::assistant::prefs::kAssistantEnabled, enabled);
diff --git a/ash/app_list/views/assistant/assistant_test_api_impl.h b/ash/app_list/views/assistant/assistant_test_api_impl.h index d0e510f..7ab994b 100644 --- a/ash/app_list/views/assistant/assistant_test_api_impl.h +++ b/ash/app_list/views/assistant/assistant_test_api_impl.h
@@ -32,6 +32,7 @@ void DisableAnimations() override; bool IsVisible() override; void SendTextQuery(const std::string& query) override; + void EnableAssistantAndWait() override; void SetAssistantEnabled(bool enable) override; void SetScreenContextEnabled(bool enabled) override; void SetTabletMode(bool enable) override;
diff --git a/ash/app_list/views/search_box_view.cc b/ash/app_list/views/search_box_view.cc index dd078995..2ee70921 100644 --- a/ash/app_list/views/search_box_view.cc +++ b/ash/app_list/views/search_box_view.cc
@@ -846,13 +846,10 @@ } if (selected_result->result_type() == AppListSearchResultType::kOmnibox && - (!selected_result->is_omnibox_search() || - selected_result->omnibox_type() == - SearchResultOmniboxDisplayType::kCalculatorAnswer) && + !selected_result->is_omnibox_search() && !selected_result->details().empty()) { // For url (non-search) results, use details to ensure that the url is - // displayed. For calculator results, use details to ensure that the - // calculation answer is displayed. + // displayed. search_box()->SetText(selected_result->details()); } else { search_box()->SetText(selected_result->title());
diff --git a/ash/app_list/views/search_result_view.cc b/ash/app_list/views/search_result_view.cc index 809fcd64..10bf462 100644 --- a/ash/app_list/views/search_result_view.cc +++ b/ash/app_list/views/search_result_view.cc
@@ -712,9 +712,4 @@ source->RequestFocus(); } -bool SearchResultView::IsRichImage() const { - return result() && - result()->omnibox_type() == SearchResultOmniboxDisplayType::kRichImage; -} - } // namespace ash
diff --git a/ash/components/arc/BUILD.gn b/ash/components/arc/BUILD.gn index 88716fe..8822e91 100644 --- a/ash/components/arc/BUILD.gn +++ b/ash/components/arc/BUILD.gn
@@ -111,15 +111,11 @@ deps = [ "//ash", - "//ash/components/arc/enterprise", - "//ash/components/arc/input_overlay/resources:resources_grit", "//ash/components/arc/vector_icons", "//ash/components/audio", "//ash/components/disks", - "//ash/constants", "//ash/keyboard/ui", "//ash/public/cpp", - "//base", "//chromeos/components/sensors:sensors", "//chromeos/cryptohome", "//chromeos/dbus", @@ -129,55 +125,29 @@ "//chromeos/dbus/power:power_manager_proto", "//chromeos/dbus/resourced", "//chromeos/dbus/session_manager", - "//chromeos/dbus/session_manager:login_manager_proto", - "//chromeos/dbus/upstart", "//chromeos/dbus/userdataauth", "//chromeos/dbus/userdataauth:userdataauth_proto", "//chromeos/login/login_state", "//chromeos/network", - "//chromeos/ui/base", "//chromeos/ui/frame", - "//components/account_id", "//components/device_event_log", "//components/exo", - "//components/google/core/common", "//components/guest_os", - "//components/keyed_service/core", - "//components/onc", "//components/prefs", - "//components/strings:components_strings_grit", - - # TODO(crbug.com/853604): After fully migrating the intent picker to query - # directly from App Service, we will deprecated the match functionality - # in intent_filter and this dependency will be removed. - "//components/services/app_service/public/cpp:intents", "//components/session_manager/core", - "//components/url_formatter", - "//components/user_manager", + + # TODO(b/208907272): Move (maybe split) components_strings to ash. + "//components/strings:components_strings_grit", "//components/user_prefs", - "//components/vector_icons", "//content/public/browser", - "//content/public/common", - "//device/bluetooth", - "//google_apis", "//media/capture:capture_lib", - "//services/device/public/mojom", - "//skia", "//third_party/re2", - "//ui/aura", - "//ui/base", - "//ui/base/clipboard", - "//ui/base/ime", "//ui/base/ime/ash", "//ui/chromeos/strings", "//ui/chromeos/styles:cros_styles_views_generator", "//ui/display/manager", - "//ui/events", - "//ui/events:dom_keycode_converter", "//ui/events/ozone", - "//ui/gfx", "//ui/wm/public", - "//url", ] } @@ -248,7 +218,6 @@ "//ash/components/arc/session", "//ash/components/arc/session:arc_base_enums", "//ash/components/arc/session:connection_holder", - "//components/arc/mojom", "//dbus", ] } @@ -261,10 +230,10 @@ ] deps = [ + ":arc", "//ash/constants", "//ash/public/cpp", "//base", - "//components/arc:arc", "//ui/aura", "//ui/display:test_support", "//ui/events:test_support", @@ -365,6 +334,7 @@ ] deps = [ + ":arc", "//ash/components/arc/enterprise", "//ash/constants", "//base", @@ -435,6 +405,7 @@ # TODO(b/129295708): Clean up unused deps. Update users of this target. deps = [ + ":arc", "//ash/components/arc:arc_test_support", "//ash/components/arc/enterprise", "//ash/components/arc/media_session",
diff --git a/components/arc/app/arc_playstore_search_request_state.h b/ash/components/arc/app/arc_playstore_search_request_state.h similarity index 90% rename from components/arc/app/arc_playstore_search_request_state.h rename to ash/components/arc/app/arc_playstore_search_request_state.h index f6953ac..bb6cf26 100644 --- a/components/arc/app/arc_playstore_search_request_state.h +++ b/ash/components/arc/app/arc_playstore_search_request_state.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_ -#define COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_ +#ifndef ASH_COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_ +#define ASH_COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_ namespace arc { @@ -53,4 +53,4 @@ }; } // namespace arc -#endif // COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_ +#endif // ASH_COMPONENTS_ARC_APP_ARC_PLAYSTORE_SEARCH_REQUEST_STATE_H_
diff --git a/ash/components/arc/arc_features.cc b/ash/components/arc/arc_features.cc index 2853a100..c71013fd 100644 --- a/ash/components/arc/arc_features.cc +++ b/ash/components/arc/arc_features.cc
@@ -35,8 +35,8 @@ // green (it should always be because arc.Boot is a critical test.) // 2) Change the default value of this feature to FEATURE_DISABLED_BY_DEFAULT. // 3) Monitor arc.Boot.vm at go/stainless after Chrome is rolled. -// 4) Ask ARC team (//components/arc/OWNERS) to update arc.CPUSet.vm test so the -// Tast test uses the updated ArcEnablePerVmCoreScheduling setting. +// 4) Ask ARC team (//ash/components/arc/OWNERS) to update arc.CPUSet.vm test +// so the Tast test uses the updated ArcEnablePerVmCoreScheduling setting. const base::Feature kEnablePerVmCoreScheduling{ "ArcEnablePerVmCoreScheduling", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/ash/components/arc/bitmap/OWNERS b/ash/components/arc/bitmap/OWNERS index 012a33c..ed9981cc 100644 --- a/ash/components/arc/bitmap/OWNERS +++ b/ash/components/arc/bitmap/OWNERS
@@ -1,3 +1,3 @@ per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/ash/components/arc/bluetooth/OWNERS b/ash/components/arc/bluetooth/OWNERS index 28b1b58..67d19a6 100644 --- a/ash/components/arc/bluetooth/OWNERS +++ b/ash/components/arc/bluetooth/OWNERS
@@ -1,7 +1,7 @@ per-file *_type_converter*.*=set noparent per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS -per-file *_type_converter*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_type_converter*.*=file://chromeos/SECURITY_OWNERS per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/ash/components/arc/compat_mode/arc_resize_lock_pref_delegate.h b/ash/components/arc/compat_mode/arc_resize_lock_pref_delegate.h index 6393447..9d545e4 100644 --- a/ash/components/arc/compat_mode/arc_resize_lock_pref_delegate.h +++ b/ash/components/arc/compat_mode/arc_resize_lock_pref_delegate.h
@@ -7,7 +7,7 @@ #include <string> -#include "components/arc/mojom/compatibility_mode.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" namespace arc {
diff --git a/ash/components/arc/compat_mode/metrics.h b/ash/components/arc/compat_mode/metrics.h index 171be2f..ca13794 100644 --- a/ash/components/arc/compat_mode/metrics.h +++ b/ash/components/arc/compat_mode/metrics.h
@@ -5,7 +5,7 @@ #ifndef ASH_COMPONENTS_ARC_COMPAT_MODE_METRICS_H_ #define ASH_COMPONENTS_ARC_COMPAT_MODE_METRICS_H_ -#include "components/arc/mojom/compatibility_mode.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" namespace arc {
diff --git a/ash/components/arc/file_system/OWNERS b/ash/components/arc/file_system/OWNERS new file mode 100644 index 0000000..ed9981cc --- /dev/null +++ b/ash/components/arc/file_system/OWNERS
@@ -0,0 +1,3 @@ +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/components/arc/file_system/file_system_mojom_traits.cc b/ash/components/arc/file_system/file_system_mojom_traits.cc similarity index 89% rename from components/arc/file_system/file_system_mojom_traits.cc rename to ash/components/arc/file_system/file_system_mojom_traits.cc index b1a569ad..21b754d 100644 --- a/components/arc/file_system/file_system_mojom_traits.cc +++ b/ash/components/arc/file_system/file_system_mojom_traits.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/file_system/file_system_mojom_traits.h" +#include "ash/components/arc/file_system/file_system_mojom_traits.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/notreached.h" -#include "components/arc/mojom/file_system.mojom.h" namespace mojo {
diff --git a/components/arc/file_system/file_system_mojom_traits.h b/ash/components/arc/file_system/file_system_mojom_traits.h similarity index 68% rename from components/arc/file_system/file_system_mojom_traits.h rename to ash/components/arc/file_system/file_system_mojom_traits.h index 672e2e27..f86c022 100644 --- a/components/arc/file_system/file_system_mojom_traits.h +++ b/ash/components/arc/file_system/file_system_mojom_traits.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ -#define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ +#ifndef ASH_COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ +#define ASH_COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ -#include "components/arc/mojom/file_system.mojom-shared.h" +#include "ash/components/arc/mojom/file_system.mojom-shared.h" #include "storage/browser/file_system/watcher_manager.h" namespace mojo { @@ -20,4 +20,4 @@ } // namespace mojo -#endif // COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ +#endif // ASH_COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_
diff --git a/components/arc/file_system/OWNERS b/ash/components/arc/intent_helper/OWNERS similarity index 78% rename from components/arc/file_system/OWNERS rename to ash/components/arc/intent_helper/OWNERS index 012a33c..52656497 100644 --- a/components/arc/file_system/OWNERS +++ b/ash/components/arc/intent_helper/OWNERS
@@ -1,3 +1,6 @@ +djacobo@chromium.org +dominickn@chromium.org + per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS
diff --git a/components/arc/intent_helper/intent_filter_mojom_traits.cc b/ash/components/arc/intent_helper/intent_filter_mojom_traits.cc similarity index 97% rename from components/arc/intent_helper/intent_filter_mojom_traits.cc rename to ash/components/arc/intent_helper/intent_filter_mojom_traits.cc index 69684b6..9a277e80 100644 --- a/components/arc/intent_helper/intent_filter_mojom_traits.cc +++ b/ash/components/arc/intent_helper/intent_filter_mojom_traits.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/intent_helper/intent_filter_mojom_traits.h" +#include "ash/components/arc/intent_helper/intent_filter_mojom_traits.h" #include <string> #include <utility>
diff --git a/components/arc/intent_helper/intent_filter_mojom_traits.h b/ash/components/arc/intent_helper/intent_filter_mojom_traits.h similarity index 90% rename from components/arc/intent_helper/intent_filter_mojom_traits.h rename to ash/components/arc/intent_helper/intent_filter_mojom_traits.h index 9b2fd0d..74c7ff6 100644 --- a/components/arc/intent_helper/intent_filter_mojom_traits.h +++ b/ash/components/arc/intent_helper/intent_filter_mojom_traits.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ -#define COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ +#ifndef ASH_COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ +#define ASH_COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-shared.h" #include "base/containers/span.h" #include "components/arc/intent_helper/intent_filter.h" -#include "components/arc/mojom/intent_helper.mojom-shared.h" namespace mojo { @@ -94,4 +94,4 @@ } // namespace mojo -#endif // COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ +#endif // ASH_COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_
diff --git a/ash/components/arc/mojom/BUILD.gn b/ash/components/arc/mojom/BUILD.gn index 1146b309..8a60255 100644 --- a/ash/components/arc/mojom/BUILD.gn +++ b/ash/components/arc/mojom/BUILD.gn
@@ -17,6 +17,8 @@ "accessibility_helper.mojom", "adbd.mojom", "anr.mojom", + "app.mojom", + "app_permissions.mojom", "appfuse.mojom", "arc_bridge.mojom", "audio.mojom", @@ -28,14 +30,18 @@ "cast_receiver.mojom", "cert_store.mojom", "clipboard.mojom", + "compatibility_mode.mojom", "crash_collector.mojom", "dark_theme.mojom", "digital_goods.mojom", "disk_quota.mojom", "enterprise_reporting.mojom", + "file_system.mojom", "iio_sensor.mojom", "ime.mojom", "input_method_manager.mojom", + "intent_common.mojom", + "intent_helper.mojom", "keyboard_shortcut.mojom", "keymaster.mojom", "kiosk.mojom", @@ -56,6 +62,7 @@ "process.mojom", "property.mojom", "rotation_lock.mojom", + "scale_factor.mojom", "screen_capture.mojom", "sensor.mojom", "sensor_service.mojom", @@ -77,7 +84,6 @@ "//ash/components/arc/mojom:notifications", "//ash/components/arc/mojom:oemcrypto", "//chromeos/components/sensors/mojom:mojom", - "//components/arc/mojom:mojom", "//components/payments/mojom:mojom", "//media/capture/video/chromeos/mojom:cros_camera", "//mojo/public/mojom/base", @@ -96,6 +102,15 @@ { types = [ { + mojom = "arc.mojom.AppDiscoveryRequestState" + cpp = "::arc::ArcPlayStoreSearchRequestState" + }, + ] + traits_headers = [ "app_mojom_traits.h" ] + }, + { + types = [ + { mojom = "arc.mojom.BluetoothDeviceType" cpp = "::device::BluetoothTransport" }, @@ -131,6 +146,19 @@ { types = [ { + mojom = "arc.mojom.ChangeType" + cpp = "::storage::WatcherManager::ChangeType" + }, + ] + traits_headers = + [ "//ash/components/arc/file_system/file_system_mojom_traits.h" ] + traits_sources = + [ "//ash/components/arc/file_system/file_system_mojom_traits.cc" ] + traits_public_deps = [ "//storage/browser" ] + }, + { + types = [ + { mojom = "arc.mojom.TextInputType" cpp = "::ui::TextInputType" }, @@ -149,6 +177,31 @@ { types = [ { + mojom = "arc.mojom.IntentFilter" + cpp = "::arc::IntentFilter" + move_only = true + }, + { + mojom = "arc.mojom.AuthorityEntry" + cpp = "::arc::IntentFilter::AuthorityEntry" + move_only = true + }, + { + mojom = "arc.mojom.PatternMatcher" + cpp = "::arc::IntentFilter::PatternMatcher" + move_only = true + }, + ] + traits_headers = [ + "//ash/components/arc/intent_helper/intent_filter_mojom_traits.h", + ] + traits_sources = [ + "//ash/components/arc/intent_helper/intent_filter_mojom_traits.cc", + ] + }, + { + types = [ + { mojom = "arc.mojom.PrintPageRange" cpp = "::printing::PageRange" },
diff --git a/components/arc/mojom/app.mojom b/ash/components/arc/mojom/app.mojom similarity index 98% rename from components/arc/mojom/app.mojom rename to ash/components/arc/mojom/app.mojom index c0a36f9..aa1531b 100644 --- a/components/arc/mojom/app.mojom +++ b/ash/components/arc/mojom/app.mojom
@@ -6,10 +6,10 @@ module arc.mojom; -import "components/arc/mojom/app_permissions.mojom"; -import "components/arc/mojom/compatibility_mode.mojom"; +import "ash/components/arc/mojom/app_permissions.mojom"; +import "ash/components/arc/mojom/compatibility_mode.mojom"; import "ash/components/arc/mojom/gfx.mojom"; -import "components/arc/mojom/scale_factor.mojom"; +import "ash/components/arc/mojom/scale_factor.mojom"; import "ui/accessibility/mojom/ax_assistant_structure.mojom"; // Describes installation result.
diff --git a/components/arc/mojom/app_mojom_traits.h b/ash/components/arc/mojom/app_mojom_traits.h similarity index 93% rename from components/arc/mojom/app_mojom_traits.h rename to ash/components/arc/mojom/app_mojom_traits.h index cfa23d0..abd3fac 100644 --- a/components/arc/mojom/app_mojom_traits.h +++ b/ash/components/arc/mojom/app_mojom_traits.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ -#define COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ +#ifndef ASH_COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ +#define ASH_COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ -#include "components/arc/app/arc_playstore_search_request_state.h" -#include "components/arc/mojom/app.mojom-shared.h" +#include "ash/components/arc/app/arc_playstore_search_request_state.h" +#include "ash/components/arc/mojom/app.mojom-shared.h" namespace mojo { @@ -122,4 +122,4 @@ } // namespace mojo -#endif // COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ +#endif // ASH_COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_
diff --git a/components/arc/mojom/app_permissions.mojom b/ash/components/arc/mojom/app_permissions.mojom similarity index 100% rename from components/arc/mojom/app_permissions.mojom rename to ash/components/arc/mojom/app_permissions.mojom
diff --git a/ash/components/arc/mojom/arc_bridge.mojom b/ash/components/arc/mojom/arc_bridge.mojom index a274ba4a..76039ca 100644 --- a/ash/components/arc/mojom/arc_bridge.mojom +++ b/ash/components/arc/mojom/arc_bridge.mojom
@@ -7,6 +7,8 @@ import "ash/components/arc/mojom/accessibility_helper.mojom"; import "ash/components/arc/mojom/adbd.mojom"; import "ash/components/arc/mojom/appfuse.mojom"; +import "ash/components/arc/mojom/app.mojom"; +import "ash/components/arc/mojom/app_permissions.mojom"; import "ash/components/arc/mojom/audio.mojom"; import "ash/components/arc/mojom/auth.mojom"; import "ash/components/arc/mojom/backup_settings.mojom"; @@ -16,14 +18,17 @@ import "ash/components/arc/mojom/cast_receiver.mojom"; import "ash/components/arc/mojom/cert_store.mojom"; import "ash/components/arc/mojom/clipboard.mojom"; +import "ash/components/arc/mojom/compatibility_mode.mojom"; import "ash/components/arc/mojom/crash_collector.mojom"; import "ash/components/arc/mojom/dark_theme.mojom"; import "ash/components/arc/mojom/digital_goods.mojom"; import "ash/components/arc/mojom/disk_quota.mojom"; import "ash/components/arc/mojom/enterprise_reporting.mojom"; +import "ash/components/arc/mojom/file_system.mojom"; import "ash/components/arc/mojom/iio_sensor.mojom"; import "ash/components/arc/mojom/ime.mojom"; import "ash/components/arc/mojom/input_method_manager.mojom"; +import "ash/components/arc/mojom/intent_helper.mojom"; import "ash/components/arc/mojom/keyboard_shortcut.mojom"; import "ash/components/arc/mojom/keymaster.mojom"; import "ash/components/arc/mojom/kiosk.mojom"; @@ -58,11 +63,6 @@ import "ash/components/arc/mojom/wake_lock.mojom"; import "ash/components/arc/mojom/wallpaper.mojom"; import "ash/components/arc/mojom/webapk.mojom"; -import "components/arc/mojom/app.mojom"; -import "components/arc/mojom/app_permissions.mojom"; -import "components/arc/mojom/compatibility_mode.mojom"; -import "components/arc/mojom/file_system.mojom"; -import "components/arc/mojom/intent_helper.mojom"; // Next MinVersion: 61 // Deprecated method IDs: 101, 105, 121
diff --git a/components/arc/mojom/compatibility_mode.mojom b/ash/components/arc/mojom/compatibility_mode.mojom similarity index 100% rename from components/arc/mojom/compatibility_mode.mojom rename to ash/components/arc/mojom/compatibility_mode.mojom
diff --git a/components/arc/mojom/file_system.mojom b/ash/components/arc/mojom/file_system.mojom similarity index 99% rename from components/arc/mojom/file_system.mojom rename to ash/components/arc/mojom/file_system.mojom index 341584aa..d7e099c 100644 --- a/components/arc/mojom/file_system.mojom +++ b/ash/components/arc/mojom/file_system.mojom
@@ -6,11 +6,11 @@ module arc.mojom; +import "ash/components/arc/mojom/app.mojom"; import "ash/components/arc/mojom/bitmap.mojom"; import "ash/components/arc/mojom/gfx.mojom"; +import "ash/components/arc/mojom/intent_common.mojom"; import "ash/components/arc/mojom/video_common.mojom"; -import "components/arc/mojom/app.mojom"; -import "components/arc/mojom/intent_common.mojom"; import "mojo/public/mojom/base/time.mojom"; import "url/mojom/url.mojom";
diff --git a/components/arc/mojom/intent_common.mojom b/ash/components/arc/mojom/intent_common.mojom similarity index 100% rename from components/arc/mojom/intent_common.mojom rename to ash/components/arc/mojom/intent_common.mojom
diff --git a/components/arc/mojom/intent_helper.mojom b/ash/components/arc/mojom/intent_helper.mojom similarity index 98% rename from components/arc/mojom/intent_helper.mojom rename to ash/components/arc/mojom/intent_helper.mojom index 122eccf..4aad604 100644 --- a/components/arc/mojom/intent_helper.mojom +++ b/ash/components/arc/mojom/intent_helper.mojom
@@ -6,11 +6,11 @@ module arc.mojom; +import "ash/components/arc/mojom/app.mojom"; import "ash/components/arc/mojom/bitmap.mojom"; import "ash/components/arc/mojom/camera_intent.mojom"; -import "components/arc/mojom/app.mojom"; -import "components/arc/mojom/intent_common.mojom"; -import "components/arc/mojom/scale_factor.mojom"; +import "ash/components/arc/mojom/intent_common.mojom"; +import "ash/components/arc/mojom/scale_factor.mojom"; import "mojo/public/mojom/base/safe_base_name.mojom"; import "url/mojom/url.mojom";
diff --git a/components/arc/mojom/scale_factor.mojom b/ash/components/arc/mojom/scale_factor.mojom similarity index 100% rename from components/arc/mojom/scale_factor.mojom rename to ash/components/arc/mojom/scale_factor.mojom
diff --git a/ash/components/arc/session/BUILD.gn b/ash/components/arc/session/BUILD.gn index 8fc6ea4a..4cd71deb 100644 --- a/ash/components/arc/session/BUILD.gn +++ b/ash/components/arc/session/BUILD.gn
@@ -55,7 +55,6 @@ "//chromeos/dbus/upstart", "//chromeos/memory:memory", "//chromeos/system:system", - "//components/arc/mojom", "//components/prefs:prefs", "//components/user_manager", "//components/version_info", @@ -114,7 +113,6 @@ "//ash/components/arc:arc_base", "//ash/components/arc:arc_test_support", "//ash/components/arc:prefs", - "//ash/components/arc/mojom:mojom", "//ash/constants", "//base/test:test_support", "//chromeos/cryptohome:cryptohome", @@ -124,7 +122,6 @@ "//chromeos/dbus/upstart", "//chromeos/system:system", "//components/account_id", - "//components/arc/mojom:mojom", "//components/prefs:test_support", "//components/user_manager", "//components/version_info",
diff --git a/ash/components/arc/session/arc_bridge_host_impl.cc b/ash/components/arc/session/arc_bridge_host_impl.cc index 16318f4..d9566cd 100644 --- a/ash/components/arc/session/arc_bridge_host_impl.cc +++ b/ash/components/arc/session/arc_bridge_host_impl.cc
@@ -9,6 +9,8 @@ #include "ash/components/arc/mojom/accessibility_helper.mojom.h" #include "ash/components/arc/mojom/adbd.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "ash/components/arc/mojom/appfuse.mojom.h" #include "ash/components/arc/mojom/audio.mojom.h" #include "ash/components/arc/mojom/auth.mojom.h" @@ -19,14 +21,17 @@ #include "ash/components/arc/mojom/cast_receiver.mojom.h" #include "ash/components/arc/mojom/cert_store.mojom.h" #include "ash/components/arc/mojom/clipboard.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/mojom/crash_collector.mojom.h" #include "ash/components/arc/mojom/dark_theme.mojom.h" #include "ash/components/arc/mojom/digital_goods.mojom.h" #include "ash/components/arc/mojom/disk_quota.mojom.h" #include "ash/components/arc/mojom/enterprise_reporting.mojom.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/mojom/iio_sensor.mojom.h" #include "ash/components/arc/mojom/ime.mojom.h" #include "ash/components/arc/mojom/input_method_manager.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/mojom/keyboard_shortcut.mojom.h" #include "ash/components/arc/mojom/keymaster.mojom.h" #include "ash/components/arc/mojom/kiosk.mojom.h" @@ -68,11 +73,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "chromeos/components/sensors/mojom/cros_sensor_service.mojom.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/app_permissions.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" namespace arc {
diff --git a/ash/components/arc/session/arc_bridge_service.cc b/ash/components/arc/session/arc_bridge_service.cc index b3560c66..e28abd01 100644 --- a/ash/components/arc/session/arc_bridge_service.cc +++ b/ash/components/arc/session/arc_bridge_service.cc
@@ -7,6 +7,8 @@ // These header is necessary for instantiation of ConnectionHolder. #include "ash/components/arc/mojom/accessibility_helper.mojom.h" #include "ash/components/arc/mojom/adbd.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "ash/components/arc/mojom/appfuse.mojom.h" #include "ash/components/arc/mojom/arc_bridge.mojom.h" #include "ash/components/arc/mojom/audio.mojom.h" @@ -22,9 +24,11 @@ #include "ash/components/arc/mojom/digital_goods.mojom.h" #include "ash/components/arc/mojom/disk_quota.mojom.h" #include "ash/components/arc/mojom/enterprise_reporting.mojom.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/mojom/iio_sensor.mojom.h" #include "ash/components/arc/mojom/ime.mojom.h" #include "ash/components/arc/mojom/input_method_manager.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/mojom/keyboard_shortcut.mojom.h" #include "ash/components/arc/mojom/keymaster.mojom.h" #include "ash/components/arc/mojom/kiosk.mojom.h" @@ -56,10 +60,6 @@ #include "ash/components/arc/mojom/volume_mounter.mojom.h" #include "ash/components/arc/mojom/wake_lock.mojom.h" #include "ash/components/arc/mojom/wallpaper.mojom.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/app_permissions.mojom.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" namespace arc {
diff --git a/ash/components/arc/test/fake_app_host.h b/ash/components/arc/test/fake_app_host.h index fc0cf62..07261bd 100644 --- a/ash/components/arc/test/fake_app_host.h +++ b/ash/components/arc/test/fake_app_host.h
@@ -5,13 +5,13 @@ #ifndef ASH_COMPONENTS_ARC_TEST_FAKE_APP_HOST_H_ #define ASH_COMPONENTS_ARC_TEST_FAKE_APP_HOST_H_ +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/connection_holder.h" -#include "components/arc/mojom/app.mojom.h" namespace arc { -// For tests in //components/arc that cannot use the real AppHost implementation -// in //chrome. +// For tests in //ash/components/arc that cannot use the real AppHost +// implementation in //chrome. class FakeAppHost : public mojom::AppHost { public: explicit FakeAppHost(
diff --git a/ash/components/arc/test/fake_app_instance.cc b/ash/components/arc/test/fake_app_instance.cc index 2423d3b..021e68b 100644 --- a/ash/components/arc/test/fake_app_instance.cc +++ b/ash/components/arc/test/fake_app_instance.cc
@@ -11,6 +11,7 @@ #include <utility> #include <vector> +#include "ash/components/arc/app/arc_playstore_search_request_state.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/files/file_path.h" @@ -19,7 +20,6 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" -#include "components/arc/app/arc_playstore_search_request_state.h" namespace {
diff --git a/ash/components/arc/test/fake_app_instance.h b/ash/components/arc/test/fake_app_instance.h index 46fd953..f835aa07 100644 --- a/ash/components/arc/test/fake_app_instance.h +++ b/ash/components/arc/test/fake_app_instance.h
@@ -10,7 +10,7 @@ #include <string> #include <vector> -#include "components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/ash/components/arc/test/fake_arc_bridge_host.cc b/ash/components/arc/test/fake_arc_bridge_host.cc index c21bffd7..8182a21 100644 --- a/ash/components/arc/test/fake_arc_bridge_host.cc +++ b/ash/components/arc/test/fake_arc_bridge_host.cc
@@ -6,6 +6,8 @@ #include "ash/components/arc/mojom/accessibility_helper.mojom.h" #include "ash/components/arc/mojom/adbd.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "ash/components/arc/mojom/appfuse.mojom.h" #include "ash/components/arc/mojom/arc_bridge.mojom.h" #include "ash/components/arc/mojom/audio.mojom.h" @@ -17,12 +19,15 @@ #include "ash/components/arc/mojom/cast_receiver.mojom.h" #include "ash/components/arc/mojom/cert_store.mojom.h" #include "ash/components/arc/mojom/clipboard.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/mojom/crash_collector.mojom.h" #include "ash/components/arc/mojom/dark_theme.mojom.h" #include "ash/components/arc/mojom/disk_quota.mojom.h" #include "ash/components/arc/mojom/enterprise_reporting.mojom.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/mojom/ime.mojom.h" #include "ash/components/arc/mojom/input_method_manager.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/mojom/keyboard_shortcut.mojom.h" #include "ash/components/arc/mojom/keymaster.mojom.h" #include "ash/components/arc/mojom/kiosk.mojom.h" @@ -55,11 +60,6 @@ #include "ash/components/arc/mojom/volume_mounter.mojom.h" #include "ash/components/arc/mojom/wake_lock.mojom.h" #include "ash/components/arc/mojom/wallpaper.mojom.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/app_permissions.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" namespace arc {
diff --git a/ash/components/arc/test/fake_file_system_instance.h b/ash/components/arc/test/fake_file_system_instance.h index d048e6c..e49ba99f 100644 --- a/ash/components/arc/test/fake_file_system_instance.h +++ b/ash/components/arc/test/fake_file_system_instance.h
@@ -13,9 +13,9 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/files/scoped_temp_dir.h" #include "base/threading/thread_checker.h" -#include "components/arc/mojom/file_system.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" #include "storage/browser/file_system/watcher_manager.h"
diff --git a/ash/components/arc/timer/OWNERS b/ash/components/arc/timer/OWNERS index 012a33c..ed9981cc 100644 --- a/ash/components/arc/timer/OWNERS +++ b/ash/components/arc/timer/OWNERS
@@ -1,3 +1,3 @@ per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/ash/components/arc/video_accelerator/DEPS b/ash/components/arc/video_accelerator/DEPS index 8b54cc3f..27d1d5b 100644 --- a/ash/components/arc/video_accelerator/DEPS +++ b/ash/components/arc/video_accelerator/DEPS
@@ -1,5 +1,4 @@ include_rules = [ - "+components/arc/mojom", "+gpu/config/gpu_driver_bug_workarounds.h", "+gpu/config/gpu_preferences.h", "+gpu/ipc/common/gpu_memory_buffer_support.h",
diff --git a/ash/components/arc/volume_mounter/OWNERS b/ash/components/arc/volume_mounter/OWNERS index a4479e9..3c58be2b 100644 --- a/ash/components/arc/volume_mounter/OWNERS +++ b/ash/components/arc/volume_mounter/OWNERS
@@ -2,4 +2,4 @@ per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/ash/components/phonehub/camera_roll_manager_impl.cc b/ash/components/phonehub/camera_roll_manager_impl.cc index 901cefb..85e99a3f 100644 --- a/ash/components/phonehub/camera_roll_manager_impl.cc +++ b/ash/components/phonehub/camera_roll_manager_impl.cc
@@ -255,17 +255,32 @@ void CameraRollManagerImpl::ComputeAndUpdateUiState() { if (!is_camera_roll_accessible_) { ui_state_ = CameraRollUiState::SHOULD_HIDE; - } else if (!IsCameraRollSettingEnabled()) { - ui_state_ = - (pref_service_->GetBoolean(prefs::kHasDismissedCameraRollOnboardingUi)) - ? CameraRollUiState::SHOULD_HIDE - : CameraRollUiState::CAN_OPT_IN; - } else if (is_refreshing_after_user_opt_in_) { - ui_state_ = CameraRollUiState::LOADING_VIEW; - } else if (current_items().empty()) { - ui_state_ = CameraRollUiState::SHOULD_HIDE; - } else { - ui_state_ = CameraRollUiState::ITEMS_VISIBLE; + NotifyCameraRollViewUiStateUpdated(); + return; + } + + chromeos::multidevice_setup::mojom::FeatureState feature_state = + multidevice_setup_client_->GetFeatureState( + chromeos::multidevice_setup::mojom::Feature::kPhoneHubCameraRoll); + switch (feature_state) { + case chromeos::multidevice_setup::mojom::FeatureState::kDisabledByUser: + ui_state_ = + pref_service_->GetBoolean(prefs::kHasDismissedCameraRollOnboardingUi) + ? CameraRollUiState::SHOULD_HIDE + : CameraRollUiState::CAN_OPT_IN; + break; + case chromeos::multidevice_setup::mojom::FeatureState::kEnabledByUser: + if (is_refreshing_after_user_opt_in_) { + ui_state_ = CameraRollUiState::LOADING_VIEW; + } else if (current_items().empty()) { + ui_state_ = CameraRollUiState::SHOULD_HIDE; + } else { + ui_state_ = CameraRollUiState::ITEMS_VISIBLE; + } + break; + default: + ui_state_ = CameraRollUiState::SHOULD_HIDE; + break; } NotifyCameraRollViewUiStateUpdated(); }
diff --git a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc index e23f84397..163cfeea 100644 --- a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc +++ b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc
@@ -33,6 +33,7 @@ using BatchDecodeCallback = base::OnceCallback<void(BatchDecodeResult, const std::vector<CameraRollItem>&)>; +using FeatureState = chromeos::multidevice_setup::mojom::FeatureState; using FileTransferStatus = chromeos::secure_channel::mojom::FileTransferStatus; class FakeObserver : public CameraRollManager::Observer { @@ -58,7 +59,7 @@ TestingPrefServiceSimple* pref_service) { DCHECK(pref_service); pref_service->registry()->RegisterBooleanPref( - prefs::kHasDismissedCameraRollOnboardingUi, true); + prefs::kHasDismissedCameraRollOnboardingUi, false); } void PopulateItemProto(proto::CameraRollItem* item_proto, std::string key) { @@ -139,7 +140,7 @@ fake_camera_roll_download_manager_ = fake_camera_roll_download_manager.get(); - SetCameraRollFeatureSettings(true); + SetCameraRollFeatureState(FeatureState::kEnabledByUser); camera_roll_manager_ = std::make_unique<CameraRollManagerImpl>( &pref_service_, &fake_message_receiver_, &fake_message_sender_, fake_multidevice_setup_client_.get(), &fake_connection_manager_, @@ -211,16 +212,10 @@ ->CompletePendingCallback(result); } - void SetCameraRollFeatureSettings(bool enabled) { - if (enabled) { - fake_multidevice_setup_client_->SetFeatureState( - chromeos::multidevice_setup::mojom::Feature::kPhoneHubCameraRoll, - chromeos::multidevice_setup::mojom::FeatureState::kEnabledByUser); - } else { - fake_multidevice_setup_client_->SetFeatureState( - chromeos::multidevice_setup::mojom::Feature::kPhoneHubCameraRoll, - chromeos::multidevice_setup::mojom::FeatureState::kDisabledByUser); - } + void SetCameraRollFeatureState(FeatureState feature_state) { + fake_multidevice_setup_client_->SetFeatureState( + chromeos::multidevice_setup::mojom::Feature::kPhoneHubCameraRoll, + feature_state); } void SendFetchCameraRollItemDataResponse( @@ -370,6 +365,8 @@ fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(1, GetOnCameraRollViewUiStateUpdatedCallCount()); } @@ -386,6 +383,8 @@ EXPECT_EQ(1UL, GetSentFetchCameraRollItemsRequestCount()); EXPECT_EQ(0, GetSentFetchCameraRollItemsRequest().current_item_metadata_size()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(1, GetOnCameraRollViewUiStateUpdatedCallCount()); } @@ -407,6 +406,8 @@ fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(1UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::ITEMS_VISIBLE, + camera_roll_manager()->ui_state()); EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(3, GetSentFetchCameraRollItemsRequest().current_item_metadata_size()); @@ -437,12 +438,15 @@ fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } TEST_F(CameraRollManagerImplTest, OnPhoneStatusUpdateReceivedWithCameraRollSettingsDisabled) { + SetCameraRollFeatureState(FeatureState::kDisabledByUser); proto::FetchCameraRollItemsResponse response; PopulateItemProto(response.add_items(), "key2"); PopulateItemProto(response.add_items(), "key1"); @@ -455,10 +459,11 @@ update.mutable_properties()->mutable_camera_roll_access_state(); access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); - SetCameraRollFeatureSettings(false); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::CAN_OPT_IN, + camera_roll_manager()->ui_state()); EXPECT_EQ(4, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } @@ -479,6 +484,8 @@ fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } @@ -492,6 +499,8 @@ fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); EXPECT_EQ(1UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(1, GetOnCameraRollViewUiStateUpdatedCallCount()); } @@ -511,12 +520,15 @@ fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } TEST_F(CameraRollManagerImplTest, OnPhoneStatusSnapshotReceivedWithCameraRollSettingDisabled) { + SetCameraRollFeatureState(FeatureState::kDisabledByUser); proto::FetchCameraRollItemsResponse response; PopulateItemProto(response.add_items(), "key2"); PopulateItemProto(response.add_items(), "key1"); @@ -526,13 +538,14 @@ proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(false); + access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); - SetCameraRollFeatureSettings(false); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); - EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::CAN_OPT_IN, + camera_roll_manager()->ui_state()); + EXPECT_EQ(4, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } @@ -552,24 +565,47 @@ fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } TEST_F(CameraRollManagerImplTest, OnFeatureOnFeatureStatesChangedToDisabled) { + proto::PhoneStatusSnapshot snapshot; + proto::CameraRollAccessState* access_state = + snapshot.mutable_properties()->mutable_camera_roll_access_state(); + access_state->set_feature_enabled(true); + access_state->set_storage_permission_granted(true); + fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); proto::FetchCameraRollItemsResponse response; PopulateItemProto(response.add_items(), "key2"); PopulateItemProto(response.add_items(), "key1"); fake_message_receiver_.NotifyFetchCameraRollItemsResponseReceived(response); CompleteThumbnailDecoding(BatchDecodeResult::kSuccess); - SetCameraRollFeatureSettings(false); + SetCameraRollFeatureState(FeatureState::kDisabledByUser); - EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); - EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); + EXPECT_EQ(CameraRollManager::CameraRollUiState::CAN_OPT_IN, + camera_roll_manager()->ui_state()); + EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } +TEST_F(CameraRollManagerImplTest, FeatureProhibitedByPolicy) { + SetCameraRollFeatureState(FeatureState::kProhibitedByPolicy); + + proto::PhoneStatusSnapshot snapshot; + proto::CameraRollAccessState* access_state = + snapshot.mutable_properties()->mutable_camera_roll_access_state(); + access_state->set_feature_enabled(true); + access_state->set_storage_permission_granted(true); + fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); + + EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, + camera_roll_manager()->ui_state()); +} + TEST_F(CameraRollManagerImplTest, DownloadItem) { // Make an item available to CameraRollManager. proto::FetchCameraRollItemsResponse response;
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index f63ffa1..ed8deb1 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1238,22 +1238,13 @@ const base::Feature kVirtualKeyboardBorderedKey{ "VirtualKeyboardBorderedKey", base::FEATURE_ENABLED_BY_DEFAULT}; -// Enable or disable multipaste feature for virtual keyboard on Chrome OS. -const base::Feature kVirtualKeyboardMultipaste{ - "VirtualKeyboardMultipaste", base::FEATURE_ENABLED_BY_DEFAULT}; - -// Enable or disable showing multipaste suggestions in virtual keyboard on -// Chrome OS. -const base::Feature kVirtualKeyboardMultipasteSuggestion{ - "VirtualKeyboardMultipasteSuggestion", base::FEATURE_DISABLED_BY_DEFAULT}; - // Controls whether to allow enabling wake on WiFi features in shill. const base::Feature kWakeOnWifiAllowed{"WakeOnWifiAllowed", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enable new wallpaper experience in WebUI inside system settings. +// Enable new wallpaper experience SWA. const base::Feature kWallpaperWebUI{"WallpaperWebUI", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enable full screen wallpaper preview in new wallpaper experience. Requires // |kWallpaperWebUI| to also be enabled.
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 7dc540e..d7d786ce 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -464,10 +464,6 @@ extern const base::Feature kUserActivityPrediction; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kVirtualKeyboardBorderedKey; -COMPONENT_EXPORT(ASH_CONSTANTS) -extern const base::Feature kVirtualKeyboardMultipaste; -COMPONENT_EXPORT(ASH_CONSTANTS) -extern const base::Feature kVirtualKeyboardMultipasteSuggestion; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kWakeOnWifiAllowed; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kWallpaperWebUI; COMPONENT_EXPORT(ASH_CONSTANTS)
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index 9c351113..ddc14c6 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -336,6 +336,7 @@ defines = [ "ASH_PUBLIC_IMPLEMENTATION" ] assert_no_deps = [ + "//ash/components/arc", "//ash/public/cpp/external_arc", "//components/arc", "//components/exo",
diff --git a/ash/public/cpp/accelerators.cc b/ash/public/cpp/accelerators.cc index 87e3f29..b6e9a5c 100644 --- a/ash/public/cpp/accelerators.cc +++ b/ash/public/cpp/accelerators.cc
@@ -35,6 +35,8 @@ {true, ui::VKEY_PRIVACY_SCREEN_TOGGLE, ui::EF_NONE, PRIVACY_SCREEN_TOGGLE}, {true, ui::VKEY_MICROPHONE_MUTE_TOGGLE, ui::EF_NONE, MICROPHONE_MUTE_TOGGLE}, + {true, ui::VKEY_KBD_BACKLIGHT_TOGGLE, ui::EF_NONE, + KEYBOARD_BACKLIGHT_TOGGLE}, {true, ui::VKEY_KBD_BRIGHTNESS_DOWN, ui::EF_NONE, KEYBOARD_BRIGHTNESS_DOWN}, {true, ui::VKEY_KBD_BRIGHTNESS_UP, ui::EF_NONE, KEYBOARD_BRIGHTNESS_UP}, // Maximize button.
diff --git a/ash/public/cpp/accelerators.h b/ash/public/cpp/accelerators.h index 42bfc7d..269edd46 100644 --- a/ash/public/cpp/accelerators.h +++ b/ash/public/cpp/accelerators.h
@@ -48,6 +48,7 @@ FOCUS_PREVIOUS_PANE, FOCUS_SHELF, FOCUS_PIP, + KEYBOARD_BACKLIGHT_TOGGLE, KEYBOARD_BRIGHTNESS_DOWN, KEYBOARD_BRIGHTNESS_UP, LAUNCH_APP_0, @@ -141,6 +142,7 @@ // Debug accelerators are intentionally at the end, so that if you remove one // you don't need to update tests which check hashes of the ids. + DEBUG_KEYBOARD_BACKLIGHT_TOGGLE, DEBUG_MICROPHONE_MUTE_TOGGLE, DEBUG_PRINT_LAYER_HIERARCHY, DEBUG_PRINT_VIEW_HIERARCHY,
diff --git a/ash/public/cpp/external_arc/message_center/OWNERS b/ash/public/cpp/external_arc/message_center/OWNERS index 9cf21cc..beb821e6 100644 --- a/ash/public/cpp/external_arc/message_center/OWNERS +++ b/ash/public/cpp/external_arc/message_center/OWNERS
@@ -1,3 +1,3 @@ -file://components/arc/OWNERS +file://ash/components/arc/OWNERS nancylingwang@chromium.org
diff --git a/ash/public/cpp/external_arc/overlay/OWNERS b/ash/public/cpp/external_arc/overlay/OWNERS index 3511ed95..14ba395 100644 --- a/ash/public/cpp/external_arc/overlay/OWNERS +++ b/ash/public/cpp/external_arc/overlay/OWNERS
@@ -1,3 +1,3 @@ -file://components/arc/OWNERS +file://ash/components/arc/OWNERS lpique@chromium.org
diff --git a/ash/public/cpp/test/assistant_test_api.h b/ash/public/cpp/test/assistant_test_api.h index a0612b806..58625d95 100644 --- a/ash/public/cpp/test/assistant_test_api.h +++ b/ash/public/cpp/test/assistant_test_api.h
@@ -47,6 +47,11 @@ // queries, i.e. the input text field must be visible and focussed. virtual void SendTextQuery(const std::string& query) = 0; + // Simulates the production state of assistant enabled. Equivalent to + // SetAssistantEnabled(true) followed by notifications for feature allowed and + // feature ready, then a wait for assistant actions to settle. + virtual void EnableAssistantAndWait() = 0; + // Enables/Disables Assistant in settings. // This will ensure the new value is propagated to the |AssistantState|. virtual void SetAssistantEnabled(bool enabled) = 0;
diff --git a/ash/system/time/calendar_unittest_utils.h b/ash/system/time/calendar_unittest_utils.h index ec7f405c..538e155 100644 --- a/ash/system/time/calendar_unittest_utils.h +++ b/ash/system/time/calendar_unittest_utils.h
@@ -14,6 +14,10 @@ namespace calendar_test_utils { +// A duration to let the animation finish and pass the cool down duration in +// tests. +constexpr base::TimeDelta kAnimationSettleDownDuration = base::Seconds(3); + // Creates a `google_apis::calendar::CalendarEvent` for testing. std::unique_ptr<google_apis::calendar::CalendarEvent> CreateEvent( const char* id,
diff --git a/ash/system/time/calendar_utils.h b/ash/system/time/calendar_utils.h index ca5b638..5e15363 100644 --- a/ash/system/time/calendar_utils.h +++ b/ash/system/time/calendar_utils.h
@@ -32,6 +32,13 @@ constexpr gfx::Insets kDateCellInsets{kDateVerticalPadding, kDateHorizontalPadding}; +// Duration of opacity animation for visibility changes. +constexpr base::TimeDelta kAnimationDurationForVisibility = + base::Milliseconds(100); + +// Duration of moving animation. +constexpr base::TimeDelta kAnimationDurationForMoving = base::Milliseconds(300); + // Checks if the `selected_date` is local time today. bool IsToday(const base::Time::Exploded& selected_date);
diff --git a/ash/system/time/calendar_view.cc b/ash/system/time/calendar_view.cc index 952694d..0bdc720 100644 --- a/ash/system/time/calendar_view.cc +++ b/ash/system/time/calendar_view.cc
@@ -57,13 +57,6 @@ // we wait before fetchiung more events. constexpr base::TimeDelta kScrollingSettledTimeout = base::Milliseconds(100); -// Duration of opacity animation for visibility changes. -constexpr base::TimeDelta kAnimationDurationForVisibility = - base::Milliseconds(100); - -// Duration of moving animation. -constexpr base::TimeDelta kAnimationDurationForMoving = base::Milliseconds(300); - // Duration of the delay for modifying opacity. constexpr base::TimeDelta kDelayVisibilityAnimationDuration = base::Milliseconds(200); @@ -247,16 +240,26 @@ kScrollingSettledTimeout, base::BindRepeating(&CalendarView::OnScrollingSettledTimerFired, base::Unretained(this))), - animation_restart_timer_(FROM_HERE, - kAnimationDisablingTimeout, - base::BindRepeating( - [](CalendarView* calendar_view) { - if (!calendar_view) - return; - calendar_view->should_show_animation_ = - true; - }, - base::Unretained(this))) { + header_animation_restart_timer_( + FROM_HERE, + kAnimationDisablingTimeout, + base::BindRepeating( + [](CalendarView* calendar_view) { + if (!calendar_view) + return; + calendar_view->set_should_header_animate(true); + }, + base::Unretained(this))), + months_animation_restart_timer_( + FROM_HERE, + kAnimationDisablingTimeout, + base::BindRepeating( + [](CalendarView* calendar_view) { + if (!calendar_view) + return; + calendar_view->set_should_months_animate(true); + }, + base::Unretained(this))) { CreateTitleRow(IDS_ASH_CALENDAR_TITLE); // Add the header. @@ -449,8 +452,8 @@ header_->layer()->SetOpacity(1.0f); header_->layer()->SetTransform(gfx::Transform()); scrolling_settled_timer_.Reset(); - if (!should_show_animation_) - animation_restart_timer_.Reset(); + if (!should_header_animate_) + header_animation_restart_timer_.Reset(); } void CalendarView::RestoreMonthStatus(bool is_scrolling_up) { @@ -473,8 +476,8 @@ next_month_->layer()->SetOpacity(1.0f); next_month_->layer()->SetTransform(gfx::Transform()); } - if (!should_show_animation_) - animation_restart_timer_.Reset(); + if (!should_months_animate_) + months_animation_restart_timer_.Reset(); } void CalendarView::ScrollToToday() { @@ -588,95 +591,54 @@ } void CalendarView::OnMonthChanged(const base::Time::Exploded current_month) { - if (!should_show_animation_) { + if (!should_header_animate_) { UpdateHeaders(); RestoreHeadersStatus(); return; } + + header_->layer()->SetTransform(gfx::Transform()); + header_->layer()->SetOpacity(0.0f); + UpdateHeaders(); + const int header_height = header_->GetPreferredSize().height(); - const gfx::Vector2dF moving_location = gfx::Vector2dF( + gfx::Vector2dF moving_location = gfx::Vector2dF( 0, calendar_view_controller_->was_on_later_month() ? -header_height / 2 : header_height / 2); - gfx::Transform header_moving = gfx::TransformAboutPivot( + gfx::Transform initial_state = gfx::TransformAboutPivot( header_->GetLocalBounds().CenterPoint(), gfx::Transform()); - header_moving.Translate(moving_location); - - should_show_animation_ = false; - - auto on_animation_aborted = [](base::WeakPtr<CalendarView> calendar_view) { - if (!calendar_view) - return; - calendar_view->UpdateHeaders(); - calendar_view->RestoreHeadersStatus(); - }; - - auto on_animation_ended = [](base::WeakPtr<CalendarView> calendar_view) { - if (!calendar_view) - return; - DCHECK(!calendar_view->header_->layer()->GetAnimator()->is_animating()); - - calendar_view->header_->layer()->SetTransform(gfx::Transform()); - calendar_view->header_->layer()->SetOpacity(0.0f); - calendar_view->UpdateHeaders(); - const int header_height = - calendar_view->header_->GetPreferredSize().height(); - gfx::Vector2dF moving_location = gfx::Vector2dF( - 0, calendar_view->calendar_view_controller_->was_on_later_month() - ? header_height / 2 - : -header_height / 2); - gfx::Transform initial_state = gfx::TransformAboutPivot( - calendar_view->header_->GetLocalBounds().CenterPoint(), - gfx::Transform()); - initial_state.Translate(moving_location); - views::AnimationBuilder() - .SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET) - .OnEnded(base::BindOnce( - [](base::WeakPtr<CalendarView> calendar_view) { - if (!calendar_view) - return; - calendar_view->should_show_animation_ = true; - calendar_view->scrolling_settled_timer_.Reset(); - }, - calendar_view->weak_factory_.GetWeakPtr())) - .OnAborted(base::BindOnce( - [](base::WeakPtr<CalendarView> calendar_view) { - if (!calendar_view) - return; - calendar_view->UpdateHeaders(); - calendar_view->RestoreHeadersStatus(); - }, - calendar_view->weak_factory_.GetWeakPtr())) - .Once() - .SetDuration(base::TimeDelta()) - .SetTransform(calendar_view->header_, std::move(initial_state)) - .Then() - .SetDuration(kAnimationDurationForMoving) - .SetTransform(calendar_view->header_, gfx::Transform(), - gfx::Tween::EASE_OUT_2) - .At(base::Milliseconds(0)) - .SetDuration(kDelayVisibilityAnimationDuration) - .Then() - .SetDuration(kAnimationDurationForVisibility) - .SetOpacity(calendar_view->header_, 1.0); - calendar_view->should_show_animation_ = true; - calendar_view->scrolling_settled_timer_.Reset(); - }; + initial_state.Translate(moving_location); + set_should_header_animate(false); views::AnimationBuilder() .SetPreemptionStrategy( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET) - .OnEnded(base::BindOnce(on_animation_ended, weak_factory_.GetWeakPtr())) - .OnAborted( - base::BindOnce(on_animation_aborted, weak_factory_.GetWeakPtr())) + .OnEnded(base::BindOnce( + [](base::WeakPtr<CalendarView> calendar_view) { + if (!calendar_view) + return; + calendar_view->set_should_header_animate(true); + calendar_view->reset_scrolling_settled_timer(); + }, + weak_factory_.GetWeakPtr())) + .OnAborted(base::BindOnce( + [](base::WeakPtr<CalendarView> calendar_view) { + if (!calendar_view) + return; + calendar_view->UpdateHeaders(); + calendar_view->RestoreHeadersStatus(); + }, + weak_factory_.GetWeakPtr())) .Once() - .SetDuration(kAnimationDurationForMoving) - .SetTransform(header_, std::move(header_moving), gfx::Tween::EASE_OUT_2) + .SetTransform(header_, std::move(initial_state)) + .Then() + .SetDuration(calendar_utils::kAnimationDurationForMoving) + .SetTransform(header_, gfx::Transform(), gfx::Tween::EASE_OUT_2) .At(base::Milliseconds(0)) .SetDuration(kDelayVisibilityAnimationDuration) .Then() - .SetDuration(kAnimationDurationForVisibility) - .SetOpacity(header_, 0.0); + .SetDuration(calendar_utils::kAnimationDurationForVisibility) + .SetOpacity(header_, 1.0); } void CalendarView::OnEventsFetched( @@ -814,7 +776,7 @@ // If there's already an existing animation, restores each layer's visibility // and position. - if (!should_show_animation_) { + if (!should_months_animate_) { if (is_scrolling_up) { ScrollUpOneMonthAndAutoScroll(); return; @@ -823,13 +785,15 @@ return; } - should_show_animation_ = false; - gfx::Vector2dF moving_up_location = - gfx::Vector2dF(0, previous_month_->GetPreferredSize().height() + - current_label_->GetPreferredSize().height()); - gfx::Vector2dF moving_down_location = - gfx::Vector2dF(0, -current_month_->GetPreferredSize().height() - - next_label_->GetPreferredSize().height()); + set_should_months_animate(false); + gfx::Vector2dF moving_up_location = gfx::Vector2dF( + 0, previous_month_->GetPreferredSize().height() + + current_label_->GetPreferredSize().height() + + (scroll_view_->GetVisibleRect().y() - current_month_->y())); + gfx::Vector2dF moving_down_location = gfx::Vector2dF( + 0, -current_month_->GetPreferredSize().height() - + next_label_->GetPreferredSize().height() + + (scroll_view_->GetVisibleRect().y() - current_month_->y())); gfx::Transform current_month_moving = gfx::TransformAboutPivot( current_month_->GetLocalBounds().CenterPoint(), gfx::Transform()); @@ -849,6 +813,14 @@ next_month_->GetLocalBounds().CenterPoint(), gfx::Transform()); next_month_moving.Translate(moving_down_location); + const int header_height = header_->GetPreferredSize().height(); + const gfx::Vector2dF moving_location = gfx::Vector2dF( + 0, calendar_view_controller_->was_on_later_month() ? header_height / 2 + : -header_height / 2); + gfx::Transform header_moving = gfx::TransformAboutPivot( + header_->GetLocalBounds().CenterPoint(), gfx::Transform()); + header_moving.Translate(moving_location); + views::AnimationBuilder() .SetPreemptionStrategy( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET) @@ -856,7 +828,7 @@ [](base::WeakPtr<CalendarView> calendar_view, bool is_scrolling_up) { if (!calendar_view) return; - calendar_view->should_show_animation_ = true; + calendar_view->set_should_months_animate(true); is_scrolling_up ? calendar_view->ScrollUpOneMonthAndAutoScroll() : calendar_view->ScrollDownOneMonthAndAutoScroll(); }, @@ -870,7 +842,7 @@ }, weak_factory_.GetWeakPtr(), is_scrolling_up)) .Once() - .SetDuration(kAnimationDurationForMoving * 2) + .SetDuration(calendar_utils::kAnimationDurationForMoving * 2) .SetTransform(current_month_, std::move(current_month_moving), gfx::Tween::EASE_OUT_2) .SetTransform( @@ -881,7 +853,14 @@ std::move(is_scrolling_up ? previous_month_moving : next_month_moving), gfx::Tween::EASE_OUT_2) - .SetOpacity(current_month_, 0.0); + .At(calendar_utils::kAnimationDurationForMoving) + .SetDuration(calendar_utils::kAnimationDurationForMoving) + .SetTransform(header_, std::move(header_moving), gfx::Tween::EASE_OUT_2) + .At(calendar_utils::kAnimationDurationForMoving) + .SetDuration(kDelayVisibilityAnimationDuration) + .Then() + .SetDuration(calendar_utils::kAnimationDurationForVisibility) + .SetOpacity(header_, 0.0); } void CalendarView::OnEvent(ui::Event* event) { @@ -996,6 +975,8 @@ if (is_resetting_scroll_) return; + base::AutoReset<bool> disable_header_animation(&should_header_animate_, + false); // Scrolls to the previous month if the current label is moving down and // passing the top of the visible area. if (scroll_view_->GetVisibleRect().y() <= current_label_->y()) {
diff --git a/ash/system/time/calendar_view.h b/ash/system/time/calendar_view.h index bc50dcd..81e3af7 100644 --- a/ash/system/time/calendar_view.h +++ b/ash/system/time/calendar_view.h
@@ -150,7 +150,7 @@ void UpdateHeaders(); // Resets the `header_`'s opacity and position. Also resets - // `scrolling_settled_timer_` and `animation_restart_timer_`. + // `scrolling_settled_timer_` and `header_animation_restart_timer_`. void RestoreHeadersStatus(); // Resets the the month views' opacity and position. In case the animation is @@ -179,6 +179,17 @@ std::unique_ptr<CalendarViewController> calendar_view_controller_; + // Setters for animation flags. + void set_should_header_animate(bool should_animate) { + should_header_animate_ = should_animate; + } + void set_should_months_animate(bool should_animate) { + should_months_animate_ = should_animate; + } + + // Reset `scrolling_settled_timer_`. + void reset_scrolling_settled_timer() { scrolling_settled_timer_.Reset(); } + // The content of the `scroll_view_`, which carries months and month labels. // Owned by `CalendarView`. views::View* content_view_ = nullptr; @@ -202,18 +213,24 @@ // don't need to check if we need to update the month or not. bool is_resetting_scroll_ = false; - // It's true if it should animate, but false when it is currently animating or + // It's true if the header should animate, but false when it is currently + // animating, or header changing from mouse scroll (not from the buttons) or // cooling down from the last animation. - bool should_show_animation_ = true; + bool should_header_animate_ = true; + + // It's true if the month views should animate, but false when it is currently + // animating, or cooling down from the last animation. + bool should_months_animate_ = true; // Timer that fires when we've "settled" on, i.e. finished scrolling to, a // currently-visible month base::RetainingOneShotTimer scrolling_settled_timer_; - // Timer that enables the updating month animation. When the month keeps - // getting changed, the animation will be disabled and the cool-down duration - // is `kAnimationDisablingTimeout` ms to enable the next animation. - base::RetainingOneShotTimer animation_restart_timer_; + // Timers that enable the updating month/header animations. When the month + // keeps getting changed, the animation will be disabled and the cool-down + // duration is `kAnimationDisablingTimeout` ms to enable the next animation. + base::RetainingOneShotTimer header_animation_restart_timer_; + base::RetainingOneShotTimer months_animation_restart_timer_; base::CallbackListSubscription on_contents_scrolled_subscription_; base::ScopedObservation<CalendarViewController,
diff --git a/ash/system/time/calendar_view_unittest.cc b/ash/system/time/calendar_view_unittest.cc index 2fb54d4..9b38674 100644 --- a/ash/system/time/calendar_view_unittest.cc +++ b/ash/system/time/calendar_view_unittest.cc
@@ -7,6 +7,8 @@ #include "ash/shell.h" #include "ash/style/icon_button.h" #include "ash/system/time/calendar_month_view.h" +#include "ash/system/time/calendar_unittest_utils.h" +#include "ash/system/time/calendar_utils.h" #include "ash/system/time/calendar_view_controller.h" #include "ash/system/tray/detailed_view_delegate.h" #include "ash/test/ash_test_base.h" @@ -597,11 +599,31 @@ delegate_.get(), tray_controller_.get())); } + void UpdateMonth(base::Time date) { + calendar_view_->calendar_view_controller()->UpdateMonth(date); + calendar_view_->SetMonthViews(); + } + CalendarView* calendar_view() { return calendar_view_; } views::Label* month_header() { return calendar_view_->header_->header_; } views::Label* header_year() { return calendar_view_->header_->header_year_; } CalendarHeaderView* header() { return calendar_view_->header_; } + CalendarMonthView* current_month() { return calendar_view_->current_month_; } + CalendarMonthView* previous_month() { + return calendar_view_->previous_month_; + } + CalendarMonthView* next_month() { return calendar_view_->next_month_; } + views::View* previous_label() { return calendar_view_->previous_label_; } + views::View* current_label() { return calendar_view_->current_label_; } + views::View* next_label() { return calendar_view_->next_label_; } + + void ScrollUpOneMonth() { + calendar_view_->ScrollOneMonthWithAnimation(/*is_scrolling_up=*/true); + } + void ScrollDownOneMonth() { + calendar_view_->ScrollOneMonthWithAnimation(/*is_scrolling_up=*/false); + } private: std::unique_ptr<views::Widget> widget_; @@ -613,6 +635,7 @@ static base::Time fake_time_; }; +// The header should show the new header with animation when there's an update. TEST_F(CalendarViewAnimationTest, HeaderAnimation) { ui::ScopedAnimationDurationScaleMode test_duration_mode( ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); @@ -623,9 +646,11 @@ CreateCalendarView(); // Gives it a duration to let the animation finish and pass the cool down // duration. The same for the other 3s duration. - task_environment()->FastForwardBy(base::Seconds(3)); + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); calendar_view()->calendar_view_controller()->UpdateMonth(date); - task_environment()->FastForwardBy(base::Seconds(3)); + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); EXPECT_EQ(u"October", month_header()->GetText()); EXPECT_EQ(u"2021", header_year()->GetText()); @@ -634,18 +659,11 @@ calendar_view()->calendar_view_controller()->UpdateMonth(date + base::Days(33)); - // The Opacity is updated from 1.0f to 0.0f after 200ms delay duration. - EXPECT_EQ(1.0f, header()->layer()->opacity()); - task_environment()->FastForwardBy(base::Milliseconds(100)); - EXPECT_TRUE(header()->layer()->GetAnimator()->is_animating()); - EXPECT_EQ(1.0f, header()->layer()->opacity()); - task_environment()->FastForwardBy(base::Milliseconds(200)); - // To prevent flakiness, fast forward until the header changes (see // crbug/1270161). The second animation starts after the header is updated to // the new month. while (u"November" != month_header()->GetText()) { - task_environment()->FastForwardBy(base::Milliseconds(80)); + task_environment()->FastForwardBy(base::Milliseconds(30)); } // The opacity is updated to 0 after the first animation ends. EXPECT_EQ(0.0f, header()->layer()->opacity()); @@ -656,11 +674,13 @@ EXPECT_EQ(u"2021", header_year()->GetText()); // The Opacity is back from 0.0f to 1.0 after 200ms delay duration. - task_environment()->FastForwardBy(base::Milliseconds(100)); + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForVisibility); EXPECT_EQ(0.0f, header()->layer()->opacity()); // Gives it a duration to let the animation finish. - task_environment()->FastForwardBy(base::Milliseconds(1000)); + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); EXPECT_EQ(1.0f, header()->layer()->opacity()); // The header is still with the updated new month after all animation @@ -669,4 +689,109 @@ EXPECT_EQ(u"2021", header_year()->GetText()); } +// The month views and header should animate when scrolling up or down. +TEST_F(CalendarViewAnimationTest, MonthAndHeaderAnimation) { + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + + base::Time date; + ASSERT_TRUE(base::Time::FromString("24 Oct 2021 10:00 GMT", &date)); + + CreateCalendarView(); + // Gives it a duration to let the animation finish and pass the cool down + // duration. + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); + UpdateMonth(date); + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); + + EXPECT_EQ(u"October", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); + + // Scrolls to the next month. + ScrollDownOneMonth(); + + // If scrolls down, the month views that will animate are `current_month_`, + // `next_month_` and 'next_label_`. + EXPECT_EQ(1.0f, header()->layer()->opacity()); + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForVisibility); + EXPECT_TRUE(current_month()->layer()->GetAnimator()->is_animating()); + EXPECT_TRUE(next_month()->layer()->GetAnimator()->is_animating()); + EXPECT_TRUE(next_label()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(previous_month()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(previous_label()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(current_label()->layer()->GetAnimator()->is_animating()); + EXPECT_EQ(u"October", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); + + // The header animation starts from 300ms. Its Opacity is updated from 1.0f to + // 0.0f after 300+200ms delay duration. + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForMoving); + EXPECT_TRUE(header()->layer()->GetAnimator()->is_animating()); + EXPECT_EQ(1.0f, header()->layer()->opacity()); + + // To prevent flakiness, fast forward until the header changes (see + // crbug/1270161). The second animation starts after the header is updated to + // the new month. + while (u"November" != month_header()->GetText()) { + task_environment()->FastForwardBy(base::Milliseconds(30)); + } + + // The opacity is updated to 0 after the first animation ends. + EXPECT_EQ(0.0f, header()->layer()->opacity()); + + // Now the header is updated to the new month and year before it starts + // showing up. + EXPECT_EQ(u"November", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); + + // The Opacity is back from 0.0f to 1.0 after 200ms delay duration. + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForVisibility); + EXPECT_EQ(0.0f, header()->layer()->opacity()); + + // Gives it a duration to let the animation finish. + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); + EXPECT_EQ(1.0f, header()->layer()->opacity()); + + // The header is still with the updated new month after all animation + // finished. + EXPECT_EQ(u"November", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); + + // Scrolls to the previous month. + ScrollUpOneMonth(); + + // If scrolls up, the month views that will animate are `current_month_`, + // `previous_month_` and 'current_label_`. + EXPECT_EQ(1.0f, header()->layer()->opacity()); + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForVisibility); + EXPECT_TRUE(current_month()->layer()->GetAnimator()->is_animating()); + EXPECT_TRUE(current_label()->layer()->GetAnimator()->is_animating()); + EXPECT_TRUE(previous_month()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(next_month()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(previous_label()->layer()->GetAnimator()->is_animating()); + EXPECT_FALSE(next_label()->layer()->GetAnimator()->is_animating()); + EXPECT_EQ(u"November", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); + + // The header animation starts from 300ms. Its Opacity is updated from 1.0f to + // 0.0f after 300+200ms delay duration. + task_environment()->FastForwardBy( + calendar_utils::kAnimationDurationForMoving); + EXPECT_TRUE(header()->layer()->GetAnimator()->is_animating()); + EXPECT_EQ(1.0f, header()->layer()->opacity()); + + task_environment()->FastForwardBy( + calendar_test_utils::kAnimationSettleDownDuration); + + EXPECT_EQ(u"October", month_header()->GetText()); + EXPECT_EQ(u"2021", header_year()->GetText()); +} + } // namespace ash
diff --git a/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.html b/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.html index b213c187..3a0d745b 100644 --- a/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.html +++ b/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.html
@@ -5,11 +5,9 @@ <div slot="header"> <h1>[[i18n('manuallyDisableWpTitleText')]]</h1> <div id="manuallyDisableHwwpInstructions"> - [[i18n('manuallyDisableWpInstructionsText', helpUrl_)]] + [[i18n('manuallyDisableWpInstructionsText')]] </div> </div> <div slot="body"> - <canvas id="qrCodeCanvas" width="[[canvasSize_]]" height="[[canvasSize_]]"> - </canvas> </div> </base-page>
diff --git a/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.js b/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.js index 7ec5ae25..aefd1004 100644 --- a/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.js +++ b/ash/webui/shimless_rma/resources/onboarding_wait_for_manual_wp_disable_page.js
@@ -9,14 +9,7 @@ import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getShimlessRmaService} from './mojo_interface_provider.js'; -import {HardwareWriteProtectionStateObserverInterface, HardwareWriteProtectionStateObserverReceiver, QrCode, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js'; - -// The size of each tile in pixels. -const QR_CODE_TILE_SIZE = 5; -// Amount of padding around the QR code in pixels. -const QR_CODE_PADDING = 4 * QR_CODE_TILE_SIZE; -// Styling for filled tiles in the QR code. -const QR_CODE_FILL_STYLE = '#000000'; +import {HardwareWriteProtectionStateObserverInterface, HardwareWriteProtectionStateObserverReceiver, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js'; /** * @fileoverview @@ -50,18 +43,6 @@ type: Boolean, value: true, }, - - /** @protected */ - canvasSize_: { - type: Number, - value: 0, - }, - - /** @protected */ - helpUrl_: { - type: String, - value: '', - }, }; } @@ -81,9 +62,6 @@ this.shimlessRmaService_.observeHardwareWriteProtectionState( this.hardwareWriteProtectionStateObserverReceiver_.$ .bindNewPipeAndPassRemote()); - this.shimlessRmaService_.getWriteProtectManuallyDisabledInstructions().then( - /*@type {!{string: displayUrl, qrCode: ?QrCode}}*/ (response) => - this.updateHelpInstructions_(response)); } /** @@ -111,50 +89,6 @@ new Error('Hardware Write Protection is not disabled.')); } } - - /** - * @param {!{displayUrl: string, qrCode: ?QrCode}} response - * @private - */ - updateHelpInstructions_(response) { - this.helpUrl_ = response.displayUrl; - this.updateQrCode_(response.qrCode); - } - - /** - * @param {?QrCode} qrCode - * @private - */ - updateQrCode_(qrCode) { - if (!qrCode) { - return; - } - - this.canvasSize_ = qrCode.size * QR_CODE_TILE_SIZE + 2 * QR_CODE_PADDING; - const context = this.getCanvasContext_(); - context.clearRect(0, 0, this.canvasSize_, this.canvasSize_); - context.fillStyle = QR_CODE_FILL_STYLE; - let index = 0; - for (let x = 0; x < qrCode.size; x++) { - for (let y = 0; y < qrCode.size; y++) { - if (qrCode.data[index]) { - context.fillRect( - x * QR_CODE_TILE_SIZE + QR_CODE_PADDING, - y * QR_CODE_TILE_SIZE + QR_CODE_PADDING, QR_CODE_TILE_SIZE, - QR_CODE_TILE_SIZE); - } - index++; - } - } - } - - /** - * @return {!CanvasRenderingContext2D} - * @private - */ - getCanvasContext_() { - return this.shadowRoot.querySelector('#qrCodeCanvas').getContext('2d'); - } } customElements.define(
diff --git a/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.html b/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.html index 8a4fc94cab..9aff7c9 100644 --- a/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.html +++ b/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.html
@@ -3,6 +3,11 @@ height: 200px; width: 300px; } + + paper-spinner-lite { + height: 300px; + width: 300px; + } </style> <base-page orientation="column"> @@ -11,10 +16,9 @@ <div id="calibration"> <span>[[calibrationStatusMessage_]]</span> </div> - <span hidden$="[[!calibrationComplete_]]">[[i18n('runCalibrationCompleteText')]]</span> </div> <div slot="body"> - <!-- TODO(gavindodd): Replace with accelerometer calibration image --> - <iron-icon icon="shimless:shimless-placeholder"></iron-icon> + <paper-spinner-lite active hidden$="[[calibrationComplete_]]"> + </paper-spinner-lite> </div> </base-page>
diff --git a/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.js b/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.js index 2bae2a02..e601861 100644 --- a/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.js +++ b/ash/webui/shimless_rma/resources/reimaging_calibration_run_page.js
@@ -13,18 +13,7 @@ import {ComponentTypeToId} from './data.js'; import {getShimlessRmaService} from './mojo_interface_provider.js'; -import {CalibrationComponentStatus, CalibrationObserverInterface, CalibrationObserverReceiver, CalibrationOverallStatus, CalibrationStatus, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js'; - -/** @type {!Object<!CalibrationStatus, string>} */ -const calibrationStatusTextKeys = { - [CalibrationStatus.kCalibrationWaiting]: 'runCalibrationComponentWaitingText', - [CalibrationStatus.kCalibrationInProgress]: - 'runCalibrationComponentProgressText', - [CalibrationStatus.kCalibrationComplete]: - 'runCalibrationComponentCompleteText', - [CalibrationStatus.kCalibrationFailed]: 'runCalibrationComponentFailedText', - [CalibrationStatus.kCalibrationSkip]: 'runCalibrationComponentSkippedText', -}; +import {CalibrationComponentStatus, CalibrationObserverInterface, CalibrationObserverReceiver, CalibrationOverallStatus, ShimlessRmaServiceInterface, StateResult} from './shimless_rma_types.js'; /** * @fileoverview @@ -109,6 +98,8 @@ onCalibrationStepComplete(status) { switch (status) { case CalibrationOverallStatus.kCalibrationOverallComplete: + this.calibrationStatusMessage_ = + this.i18n('runCalibrationCompleteText'); this.calibrationComplete_ = true; this.dispatchEvent(new CustomEvent( 'disable-next-button', @@ -133,19 +124,13 @@ } /** - * @private - * @return {string} * @param {!CalibrationComponentStatus} status + * @return {string} + * @private */ getCalibrationStatusString_(status) { const componentType = this.i18n(ComponentTypeToId[status.component]); - const percent = Math.round(status.progress * 100.0); - if (status.status === CalibrationStatus.kCalibrationInProgress) { - return this.i18n( - calibrationStatusTextKeys[status.status], componentType, percent); - } else { - return this.i18n(calibrationStatusTextKeys[status.status], componentType); - } + return this.i18n('runCalibrationCalibratingComponent', componentType); } }
diff --git a/ash/webui/shimless_rma/shimless_rma.cc b/ash/webui/shimless_rma/shimless_rma.cc index 82ddb0f6..20d3965 100644 --- a/ash/webui/shimless_rma/shimless_rma.cc +++ b/ash/webui/shimless_rma/shimless_rma.cc
@@ -171,16 +171,8 @@ {"runCalibrationTitleText", IDS_SHIMLESS_RMA_RUN_CALIBRATION_PAGE_TITLE}, {"runCalibrationCompleteText", IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPLETE}, {"runCalibrationStartingText", IDS_SHIMLESS_RMA_RUN_CALIBRATION_STARTING}, - {"runCalibrationComponentWaitingText", - IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_WAITING}, - {"runCalibrationComponentProgressText", - IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_PROGRESS}, - {"runCalibrationComponentCompleteText", - IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_COMPLETE}, - {"runCalibrationComponentFailedText", - IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_FAILED}, - {"runCalibrationComponentSkippedText", - IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_SKIPPED}, + {"runCalibrationCalibratingComponent", + IDS_SHIMLESS_RMA_RUN_CALIBRATING_COMPONENT}, // Device provisioning page {"provisioningPageTitleText", IDS_SHIMLESS_RMA_PROVISIONING_TITLE}, {"provisioningPageProgressText", IDS_SHIMLESS_RMA_PROVISIONING_PROGRESS},
diff --git a/ash/wm/desks/templates/desks_templates_item_view.cc b/ash/wm/desks/templates/desks_templates_item_view.cc index f15ab17..784da0b 100644 --- a/ash/wm/desks/templates/desks_templates_item_view.cc +++ b/ash/wm/desks/templates/desks_templates_item_view.cc
@@ -13,6 +13,7 @@ #include "ash/style/ash_color_provider.h" #include "ash/style/close_button.h" #include "ash/style/pill_button.h" +#include "ash/style/style_util.h" #include "ash/wm/desks/label_textfield.h" #include "ash/wm/desks/templates/desks_templates_dialog_controller.h" #include "ash/wm/desks/templates/desks_templates_icon_container.h" @@ -142,6 +143,11 @@ icon_container_view_->SetVisible(true); card_container->SetFlexForView(spacer, 1); + StyleUtil::SetUpInkDropForButton(this, gfx::Insets(), + /*highlight_on_hover=*/false, + /*highlight_on_focus=*/false); + views::InstallRoundRectHighlightPathGenerator(this, gfx::Insets(), + kCornerRadius); views::FocusRing::Install(this); views::FocusRing* focus_ring = views::FocusRing::Get(this); focus_ring->SetHasFocusPredicate([](views::View* view) {
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc index 80eb4b85..66813937 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -342,7 +342,9 @@ void* context) { ScopedDisallowAllocations guard{}; #if defined(OS_APPLE) - if (UNLIKELY(!base::IsManagedByPartitionAlloc(address) && address)) { + if (UNLIKELY(!base::IsManagedByPartitionAlloc( + reinterpret_cast<uintptr_t>(address)) && + address)) { // A memory region allocated by the system allocator is passed in this // function. Forward the request to `realloc` which supports zone- // dispatching so that it appropriately selects the right zone. @@ -363,7 +365,9 @@ void PartitionFree(const AllocatorDispatch*, void* address, void* context) { ScopedDisallowAllocations guard{}; #if defined(OS_APPLE) - if (UNLIKELY(!base::IsManagedByPartitionAlloc(address) && address)) { + if (UNLIKELY(!base::IsManagedByPartitionAlloc( + reinterpret_cast<uintptr_t>(address)) && + address)) { // A memory region allocated by the system allocator is passed in this // function. Forward the request to `free` which supports zone- // dispatching so that it appropriately selects the right zone. @@ -376,7 +380,9 @@ // it along. This should not have a runtime cost vs regular Android, since on // Android we have a PA_CHECK() rather than the branch here. #if defined(OS_ANDROID) && BUILDFLAG(IS_CHROMECAST) - if (UNLIKELY(!base::IsManagedByPartitionAlloc(address) && address)) { + if (UNLIKELY(!base::IsManagedByPartitionAlloc( + reinterpret_cast<uintptr_t>(address)) && + address)) { // A memory region allocated by the system allocator is passed in this // function. Forward the request to `free()`, which is `__real_free()` // here. @@ -396,7 +402,7 @@ return 0; #if defined(OS_APPLE) - if (!base::IsManagedByPartitionAlloc(address)) { + if (!base::IsManagedByPartitionAlloc(reinterpret_cast<uintptr_t>(address))) { // The object pointed to by `address` is not allocated by the // PartitionAlloc. The return value `0` means that the pointer does not // belong to this malloc zone.
diff --git a/base/allocator/partition_allocator/address_pool_manager.cc b/base/allocator/partition_allocator/address_pool_manager.cc index ab78f85e..a503995 100644 --- a/base/allocator/partition_allocator/address_pool_manager.cc +++ b/base/allocator/partition_allocator/address_pool_manager.cc
@@ -320,9 +320,8 @@ } void AddressPoolManager::MarkUsed(pool_handle handle, - const void* address, + uintptr_t address, size_t length) { - uintptr_t ptr_as_uintptr = reinterpret_cast<uintptr_t>(address); PartitionAutoLock scoped_lock(AddressPoolManagerBitmap::GetLock()); // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. #if BUILDFLAG(USE_BACKUP_REF_PTR) @@ -351,12 +350,11 @@ // Suppose that |ptr| points to an address inside B after the loop. If // IsManagedByBRPPoolPool(ptr) were to return true, ~raw_ptr<T>() would // crash, since the memory is not allocated by PartitionAlloc. - SetBitmap( - AddressPoolManagerBitmap::brp_pool_bits_, - (ptr_as_uintptr >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) + - AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap, - (length >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) - - AddressPoolManagerBitmap::kGuardBitsOfBRPPoolBitmap); + SetBitmap(AddressPoolManagerBitmap::brp_pool_bits_, + (address >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) + + AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap, + (length >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) - + AddressPoolManagerBitmap::kGuardBitsOfBRPPoolBitmap); } else #endif // BUILDFLAG(USE_BACKUP_REF_PTR) { @@ -365,21 +363,19 @@ (length % AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap) == 0); SetBitmap(AddressPoolManagerBitmap::regular_pool_bits_, - ptr_as_uintptr >> - AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap, + address >> AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap, length >> AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap); } } void AddressPoolManager::MarkUnused(pool_handle handle, - const void* address, + uintptr_t address, size_t length) { // Address regions allocated for normal buckets are never released, so this // function can only be called for direct map. However, do not DCHECK on // IsManagedByDirectMap(address), because many tests test this function using // small allocations. - uintptr_t ptr_as_uintptr = reinterpret_cast<uintptr_t>(address); PartitionAutoLock scoped_lock(AddressPoolManagerBitmap::GetLock()); // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. #if BUILDFLAG(USE_BACKUP_REF_PTR) @@ -392,7 +388,7 @@ // (See MarkUsed comment) ResetBitmap( AddressPoolManagerBitmap::brp_pool_bits_, - (ptr_as_uintptr >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) + + (address >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) + AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap, (length >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) - AddressPoolManagerBitmap::kGuardBitsOfBRPPoolBitmap); @@ -405,8 +401,7 @@ 0); ResetBitmap( AddressPoolManagerBitmap::regular_pool_bits_, - ptr_as_uintptr >> - AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap, + address >> AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap, length >> AddressPoolManagerBitmap::kBitShiftOfRegularPoolBitmap); } }
diff --git a/base/allocator/partition_allocator/address_pool_manager.h b/base/allocator/partition_allocator/address_pool_manager.h index 4b2a969..af6060c 100644 --- a/base/allocator/partition_allocator/address_pool_manager.h +++ b/base/allocator/partition_allocator/address_pool_manager.h
@@ -63,18 +63,19 @@ char* Reserve(pool_handle handle, void* requested_address, size_t length); // Frees address space back to GigaCage and decommits underlying system pages. + // TODO(bartekn): void* -> uintptr_t void UnreserveAndDecommit(pool_handle handle, void* ptr, size_t length); void ResetForTesting(); #if !defined(PA_HAS_64_BITS_POINTERS) - void MarkUsed(pool_handle handle, const void* address, size_t size); - void MarkUnused(pool_handle handle, const void* address, size_t size); + void MarkUsed(pool_handle handle, uintptr_t address, size_t size); + void MarkUnused(pool_handle handle, uintptr_t address, size_t size); - static bool IsManagedByRegularPool(const void* address) { + static bool IsManagedByRegularPool(uintptr_t address) { return AddressPoolManagerBitmap::IsManagedByRegularPool(address); } - static bool IsManagedByBRPPool(const void* address) { + static bool IsManagedByBRPPool(uintptr_t address) { return AddressPoolManagerBitmap::IsManagedByBRPPool(address); } #endif // !defined(PA_HAS_64_BITS_POINTERS)
diff --git a/base/allocator/partition_allocator/address_pool_manager_bitmap.h b/base/allocator/partition_allocator/address_pool_manager_bitmap.h index 1faf393..7b18db11 100644 --- a/base/allocator/partition_allocator/address_pool_manager_bitmap.h +++ b/base/allocator/partition_allocator/address_pool_manager_bitmap.h
@@ -75,8 +75,7 @@ kAddressSpaceSize / kBytesPer1BitOfRegularPoolBitmap; // Returns false for nullptr. - static bool IsManagedByRegularPool(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); + static bool IsManagedByRegularPool(uintptr_t address) { static_assert( std::numeric_limits<uintptr_t>::max() >> kBitShiftOfRegularPoolBitmap < regular_pool_bits_.size(), @@ -86,12 +85,11 @@ // is responsible for guaranteeing that the address is inside a valid // allocation and the deallocation call won't race with this call. return TS_UNCHECKED_READ( - regular_pool_bits_)[address_as_uintptr >> kBitShiftOfRegularPoolBitmap]; + regular_pool_bits_)[address >> kBitShiftOfRegularPoolBitmap]; } // Returns false for nullptr. - static bool IsManagedByBRPPool(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); + static bool IsManagedByBRPPool(uintptr_t address) { static_assert(std::numeric_limits<uintptr_t>::max() >> kBitShiftOfBRPPoolBitmap < brp_pool_bits_.size(), "The bitmap is too small, will result in unchecked out of " @@ -100,7 +98,7 @@ // is responsible for guaranteeing that the address is inside a valid // allocation and the deallocation call won't race with this call. return TS_UNCHECKED_READ( - brp_pool_bits_)[address_as_uintptr >> kBitShiftOfBRPPoolBitmap]; + brp_pool_bits_)[address >> kBitShiftOfBRPPoolBitmap]; } #if BUILDFLAG(USE_BACKUP_REF_PTR) @@ -173,7 +171,7 @@ } // namespace internal // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAlloc(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAlloc(uintptr_t address) { // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. // No need to add IsManagedByConfigurablePool, because Configurable Pool // doesn't exist on 32-bit. @@ -188,18 +186,18 @@ } // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAllocRegularPool(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAllocRegularPool(uintptr_t address) { return internal::AddressPoolManagerBitmap::IsManagedByRegularPool(address); } // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAllocBRPPool(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAllocBRPPool(uintptr_t address) { return internal::AddressPoolManagerBitmap::IsManagedByBRPPool(address); } // Returns false for nullptr. ALWAYS_INLINE bool IsManagedByPartitionAllocConfigurablePool( - const void* address) { + uintptr_t address) { // The Configurable Pool is only available on 64-bit builds. return false; }
diff --git a/base/allocator/partition_allocator/address_pool_manager_unittest.cc b/base/allocator/partition_allocator/address_pool_manager_unittest.cc index 6d603346..3f93726b 100644 --- a/base/allocator/partition_allocator/address_pool_manager_unittest.cc +++ b/base/allocator/partition_allocator/address_pool_manager_unittest.cc
@@ -243,12 +243,13 @@ TEST(PartitionAllocAddressPoolManagerTest, IsManagedByRegularPool) { constexpr size_t kAllocCount = 8; static const size_t kNumPages[kAllocCount] = {1, 4, 7, 8, 13, 16, 31, 60}; - void* addrs[kAllocCount]; + uintptr_t addrs[kAllocCount]; for (size_t i = 0; i < kAllocCount; ++i) { - addrs[i] = AddressPoolManager::GetInstance()->Reserve( - GetRegularPool(), nullptr, - AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap * - kNumPages[i]); + addrs[i] = + reinterpret_cast<uintptr_t>(AddressPoolManager::GetInstance()->Reserve( + GetRegularPool(), nullptr, + AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap * + kNumPages[i])); EXPECT_TRUE(addrs[i]); EXPECT_TRUE( !(reinterpret_cast<uintptr_t>(addrs[i]) & kSuperPageOffsetMask)); @@ -258,7 +259,7 @@ kNumPages[i]); } for (size_t i = 0; i < kAllocCount; ++i) { - const char* ptr = reinterpret_cast<const char*>(addrs[i]); + uintptr_t address = addrs[i]; size_t num_pages = bits::AlignUp( kNumPages[i] * @@ -267,12 +268,12 @@ AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap; for (size_t j = 0; j < num_pages; ++j) { if (j < kNumPages[i]) { - EXPECT_TRUE(AddressPoolManager::IsManagedByRegularPool(ptr)); + EXPECT_TRUE(AddressPoolManager::IsManagedByRegularPool(address)); } else { - EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(ptr)); + EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(address)); } - EXPECT_FALSE(AddressPoolManager::IsManagedByBRPPool(ptr)); - ptr += AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap; + EXPECT_FALSE(AddressPoolManager::IsManagedByBRPPool(address)); + address += AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap; } } for (size_t i = 0; i < kAllocCount; ++i) { @@ -281,7 +282,7 @@ AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap * kNumPages[i]); AddressPoolManager::GetInstance()->UnreserveAndDecommit( - GetRegularPool(), addrs[i], + GetRegularPool(), reinterpret_cast<void*>(addrs[i]), AddressPoolManagerBitmap::kBytesPer1BitOfRegularPoolBitmap * kNumPages[i]); EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(addrs[i])); @@ -294,10 +295,11 @@ constexpr size_t kAllocCount = 4; // Totally (1+3+7+11) * 2MB = 44MB allocation static const size_t kNumPages[kAllocCount] = {1, 3, 7, 11}; - void* addrs[kAllocCount]; + uintptr_t addrs[kAllocCount]; for (size_t i = 0; i < kAllocCount; ++i) { - addrs[i] = AddressPoolManager::GetInstance()->Reserve( - GetBRPPool(), nullptr, kSuperPageSize * kNumPages[i]); + addrs[i] = + reinterpret_cast<uintptr_t>(AddressPoolManager::GetInstance()->Reserve( + GetBRPPool(), nullptr, kSuperPageSize * kNumPages[i])); EXPECT_TRUE(addrs[i]); EXPECT_TRUE( !(reinterpret_cast<uintptr_t>(addrs[i]) & kSuperPageOffsetMask)); @@ -314,27 +316,27 @@ AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap); for (size_t i = 0; i < kAllocCount; ++i) { - const char* base_ptr = reinterpret_cast<const char*>(addrs[i]); - const char* ptr = base_ptr; + uintptr_t address = addrs[i]; size_t num_allocated_size = kNumPages[i] * kSuperPageSize; size_t num_system_pages = num_allocated_size / SystemPageSize(); for (size_t j = 0; j < num_system_pages; ++j) { - size_t offset = ptr - base_ptr; + size_t offset = address - addrs[i]; if (offset < first_guard_size || offset >= (num_allocated_size - last_guard_size)) { - EXPECT_FALSE(AddressPoolManager::IsManagedByBRPPool(ptr)); + EXPECT_FALSE(AddressPoolManager::IsManagedByBRPPool(address)); } else { - EXPECT_TRUE(AddressPoolManager::IsManagedByBRPPool(ptr)); + EXPECT_TRUE(AddressPoolManager::IsManagedByBRPPool(address)); } - EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(ptr)); - ptr += SystemPageSize(); + EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(address)); + address += SystemPageSize(); } } for (size_t i = 0; i < kAllocCount; ++i) { AddressPoolManager::GetInstance()->MarkUnused( GetBRPPool(), addrs[i], kSuperPageSize * kNumPages[i]); AddressPoolManager::GetInstance()->UnreserveAndDecommit( - GetBRPPool(), addrs[i], kSuperPageSize * kNumPages[i]); + GetBRPPool(), reinterpret_cast<void*>(addrs[i]), + kSuperPageSize * kNumPages[i]); EXPECT_FALSE(AddressPoolManager::IsManagedByRegularPool(addrs[i])); EXPECT_FALSE(AddressPoolManager::IsManagedByBRPPool(addrs[i])); }
diff --git a/base/allocator/partition_allocator/partition_address_space.cc b/base/allocator/partition_allocator/partition_address_space.cc index 8c3f0cb..1d03aae4f 100644 --- a/base/allocator/partition_allocator/partition_address_space.cc +++ b/base/allocator/partition_allocator/partition_address_space.cc
@@ -82,14 +82,12 @@ setup_.regular_pool_ = internal::AddressPoolManager::GetInstance()->Add( setup_.regular_pool_base_address_, kRegularPoolSize); PA_CHECK(setup_.regular_pool_ == kRegularPoolHandle); - PA_DCHECK(!IsInRegularPool( - reinterpret_cast<void*>(setup_.regular_pool_base_address_ - 1))); - PA_DCHECK(IsInRegularPool( - reinterpret_cast<void*>(setup_.regular_pool_base_address_))); - PA_DCHECK(IsInRegularPool(reinterpret_cast<void*>( - setup_.regular_pool_base_address_ + kRegularPoolSize - 1))); - PA_DCHECK(!IsInRegularPool(reinterpret_cast<void*>( - setup_.regular_pool_base_address_ + kRegularPoolSize))); + PA_DCHECK(!IsInRegularPool(setup_.regular_pool_base_address_ - 1)); + PA_DCHECK(IsInRegularPool(setup_.regular_pool_base_address_)); + PA_DCHECK(IsInRegularPool(setup_.regular_pool_base_address_ + + kRegularPoolSize - 1)); + PA_DCHECK( + !IsInRegularPool(setup_.regular_pool_base_address_ + kRegularPoolSize)); // Reserve an extra allocation granularity unit before the BRP pool, but keep // the pool aligned at kBRPPoolSize. A pointer immediately past an allocation @@ -108,14 +106,10 @@ setup_.brp_pool_ = internal::AddressPoolManager::GetInstance()->Add( setup_.brp_pool_base_address_, kBRPPoolSize); PA_CHECK(setup_.brp_pool_ == kBRPPoolHandle); - PA_DCHECK( - !IsInBRPPool(reinterpret_cast<void*>(setup_.brp_pool_base_address_ - 1))); - PA_DCHECK( - IsInBRPPool(reinterpret_cast<void*>(setup_.brp_pool_base_address_))); - PA_DCHECK(IsInBRPPool(reinterpret_cast<void*>(setup_.brp_pool_base_address_ + - kBRPPoolSize - 1))); - PA_DCHECK(!IsInBRPPool( - reinterpret_cast<void*>(setup_.brp_pool_base_address_ + kBRPPoolSize))); + PA_DCHECK(!IsInBRPPool(setup_.brp_pool_base_address_ - 1)); + PA_DCHECK(IsInBRPPool(setup_.brp_pool_base_address_)); + PA_DCHECK(IsInBRPPool(setup_.brp_pool_base_address_ + kBRPPoolSize - 1)); + PA_DCHECK(!IsInBRPPool(setup_.brp_pool_base_address_ + kBRPPoolSize)); #if PA_STARSCAN_USE_CARD_TABLE // Reserve memory for PCScan quarantine card table.
diff --git a/base/allocator/partition_allocator/partition_address_space.h b/base/allocator/partition_allocator/partition_address_space.h index d693c1f..0c7e8a2 100644 --- a/base/allocator/partition_allocator/partition_address_space.h +++ b/base/allocator/partition_allocator/partition_address_space.h
@@ -55,7 +55,7 @@ } static ALWAYS_INLINE std::pair<pool_handle, uintptr_t> GetPoolAndOffset( - const void* address) { + uintptr_t address) { address = memory::UnmaskPtr(address); // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. #if !BUILDFLAG(USE_BACKUP_REF_PTR) @@ -77,8 +77,7 @@ } else { PA_NOTREACHED(); } - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); - return std::make_pair(pool, address_as_uintptr - base); + return std::make_pair(pool, address - base); } static ALWAYS_INLINE constexpr size_t ConfigurablePoolMaxSize() { return kConfigurablePoolMaxSize; @@ -116,8 +115,8 @@ } // Returns false for nullptr. - static ALWAYS_INLINE bool IsInRegularPool(const void* address) { - return (reinterpret_cast<uintptr_t>(address) & kRegularPoolBaseMask) == + static ALWAYS_INLINE bool IsInRegularPool(uintptr_t address) { + return (address & kRegularPoolBaseMask) == setup_.regular_pool_base_address_; } @@ -126,14 +125,12 @@ } // Returns false for nullptr. - static ALWAYS_INLINE bool IsInBRPPool(const void* address) { - return (reinterpret_cast<uintptr_t>(address) & kBRPPoolBaseMask) == - setup_.brp_pool_base_address_; + static ALWAYS_INLINE bool IsInBRPPool(uintptr_t address) { + return (address & kBRPPoolBaseMask) == setup_.brp_pool_base_address_; } // Returns false for nullptr. - static ALWAYS_INLINE bool IsInConfigurablePool(const void* address) { - return (reinterpret_cast<uintptr_t>(address) & - setup_.configurable_pool_base_mask_) == + static ALWAYS_INLINE bool IsInConfigurablePool(uintptr_t address) { + return (address & setup_.configurable_pool_base_mask_) == setup_.configurable_pool_base_address_; } @@ -141,10 +138,9 @@ return setup_.configurable_pool_base_address_; } - static ALWAYS_INLINE uintptr_t OffsetInBRPPool(const void* address) { + static ALWAYS_INLINE uintptr_t OffsetInBRPPool(uintptr_t address) { PA_DCHECK(IsInBRPPool(address)); - return reinterpret_cast<uintptr_t>(memory::UnmaskPtr(address)) - - setup_.brp_pool_base_address_; + return memory::UnmaskPtr(address) - setup_.brp_pool_base_address_; } // PartitionAddressSpace is static_only class. @@ -246,15 +242,15 @@ }; ALWAYS_INLINE std::pair<pool_handle, uintptr_t> GetPoolAndOffset( - const void* address) { + uintptr_t address) { return PartitionAddressSpace::GetPoolAndOffset(address); } -ALWAYS_INLINE pool_handle GetPool(const void* address) { +ALWAYS_INLINE pool_handle GetPool(uintptr_t address) { return std::get<0>(GetPoolAndOffset(address)); } -ALWAYS_INLINE uintptr_t OffsetInBRPPool(const void* address) { +ALWAYS_INLINE uintptr_t OffsetInBRPPool(uintptr_t address) { return PartitionAddressSpace::OffsetInBRPPool(address); } @@ -264,7 +260,7 @@ #if defined(PA_HAS_64_BITS_POINTERS) // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAlloc(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAlloc(uintptr_t address) { // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. #if !BUILDFLAG(USE_BACKUP_REF_PTR) PA_DCHECK(!internal::PartitionAddressSpace::IsInBRPPool(address)); @@ -277,18 +273,18 @@ } // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAllocRegularPool(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAllocRegularPool(uintptr_t address) { return internal::PartitionAddressSpace::IsInRegularPool(address); } // Returns false for nullptr. -ALWAYS_INLINE bool IsManagedByPartitionAllocBRPPool(const void* address) { +ALWAYS_INLINE bool IsManagedByPartitionAllocBRPPool(uintptr_t address) { return internal::PartitionAddressSpace::IsInBRPPool(address); } // Returns false for nullptr. ALWAYS_INLINE bool IsManagedByPartitionAllocConfigurablePool( - const void* address) { + uintptr_t address) { return internal::PartitionAddressSpace::IsInConfigurablePool(address); }
diff --git a/base/allocator/partition_allocator/partition_alloc.cc b/base/allocator/partition_allocator/partition_alloc.cc index 78a279f2..af199b67 100644 --- a/base/allocator/partition_allocator/partition_alloc.cc +++ b/base/allocator/partition_allocator/partition_alloc.cc
@@ -107,11 +107,12 @@ #if (DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS)) && \ BUILDFLAG(USE_BACKUP_REF_PTR) +// TODO(bartekn): void* -> uintptr_t void CheckThatSlotOffsetIsZero(void* ptr) { // Add kPartitionPastAllocationAdjustment, because // PartitionAllocGetSlotStartInBRPPool will subtract it. PA_CHECK(PartitionAllocGetSlotStartInBRPPool( - reinterpret_cast<char*>(ptr) + + reinterpret_cast<uintptr_t>(ptr) + kPartitionPastAllocationAdjustment) == ptr); } #endif
diff --git a/base/allocator/partition_allocator/partition_alloc_unittest.cc b/base/allocator/partition_allocator/partition_alloc_unittest.cc index 27035be3..06aef016 100644 --- a/base/allocator/partition_allocator/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -948,9 +948,9 @@ EXPECT_LT(requested_size, actual_capacity); #if BUILDFLAG(USE_BACKUP_REF_PTR) for (size_t offset = 0; offset < requested_size; ++offset) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } #endif // BUILDFLAG(USE_BACKUP_REF_PTR) allocator.root()->Free(ptr); @@ -970,9 +970,9 @@ EXPECT_EQ(requested_size, actual_capacity); #if BUILDFLAG(USE_BACKUP_REF_PTR) for (size_t offset = 0; offset < requested_size; offset += 877) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } #endif // BUILDFLAG(USE_BACKUP_REF_PTR) allocator.root()->Free(ptr); @@ -997,9 +997,9 @@ EXPECT_EQ(requested_size + SystemPageSize(), actual_capacity); #if BUILDFLAG(USE_BACKUP_REF_PTR) for (size_t offset = 0; offset < requested_size; offset += 4999) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } #endif // BUILDFLAG(USE_BACKUP_REF_PTR) @@ -1017,9 +1017,9 @@ EXPECT_EQ(requested_size, actual_capacity); #if BUILDFLAG(USE_BACKUP_REF_PTR) for (size_t offset = 0; offset < requested_size; offset += 4999) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } #endif // BUILDFLAG(USE_BACKUP_REF_PTR) @@ -1043,9 +1043,9 @@ EXPECT_LT(requested_size, actual_capacity); #if BUILDFLAG(USE_BACKUP_REF_PTR) for (size_t offset = 0; offset < requested_size; offset += 16111) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } #endif // BUILDFLAG(USE_BACKUP_REF_PTR) allocator.root()->Free(ptr); @@ -1091,46 +1091,46 @@ } constexpr size_t kNumRepeats = 3; - char* ptrs[kNumRepeats]; - for (char*& ptr : ptrs) { - ptr = static_cast<char*>( - allocator.root()->Alloc(requested_size, type_name)); + void* ptrs[kNumRepeats]; + for (void*& ptr : ptrs) { + ptr = allocator.root()->Alloc(requested_size, type_name); // Double check. if (size <= MaxRegularSlotSpanSize()) { EXPECT_EQ(requested_size, allocator.root()->AllocationCapacityFromPtr(ptr)); } - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr, -kFarFarAwayDelta)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr, -kSuperPageSize)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr, -1)); - EXPECT_TRUE(PartitionAllocIsValidPtrDelta(ptr, 0)); - EXPECT_TRUE(PartitionAllocIsValidPtrDelta(ptr, requested_size / 2)); - EXPECT_TRUE(PartitionAllocIsValidPtrDelta(ptr, requested_size)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr, requested_size + 1)); - EXPECT_FALSE( - PartitionAllocIsValidPtrDelta(ptr, requested_size + kSuperPageSize)); + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address, -kFarFarAwayDelta)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address, -kSuperPageSize)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address, -1)); + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address, 0)); + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address, requested_size / 2)); + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address, requested_size)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address, requested_size + 1)); EXPECT_FALSE(PartitionAllocIsValidPtrDelta( - ptr, requested_size + kFarFarAwayDelta)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr + requested_size, + address, requested_size + kSuperPageSize)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta( + address, requested_size + kFarFarAwayDelta)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address + requested_size, kFarFarAwayDelta)); - EXPECT_FALSE( - PartitionAllocIsValidPtrDelta(ptr + requested_size, kSuperPageSize)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr + requested_size, 1)); - EXPECT_TRUE(PartitionAllocIsValidPtrDelta(ptr + requested_size, 0)); - EXPECT_TRUE(PartitionAllocIsValidPtrDelta(ptr + requested_size, + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address + requested_size, + kSuperPageSize)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address + requested_size, 1)); + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address + requested_size, 0)); + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address + requested_size, -(requested_size / 2))); - EXPECT_TRUE( - PartitionAllocIsValidPtrDelta(ptr + requested_size, -requested_size)); - EXPECT_FALSE(PartitionAllocIsValidPtrDelta(ptr + requested_size, + EXPECT_TRUE(PartitionAllocIsValidPtrDelta(address + requested_size, + -requested_size)); + EXPECT_FALSE(PartitionAllocIsValidPtrDelta(address + requested_size, -requested_size - 1)); EXPECT_FALSE(PartitionAllocIsValidPtrDelta( - ptr + requested_size, -requested_size - kSuperPageSize)); + address + requested_size, -requested_size - kSuperPageSize)); EXPECT_FALSE(PartitionAllocIsValidPtrDelta( - ptr + requested_size, -requested_size - kFarFarAwayDelta)); + address + requested_size, -requested_size - kFarFarAwayDelta)); } - for (char* ptr : ptrs) + for (void* ptr : ptrs) allocator.root()->Free(ptr); } } @@ -1158,9 +1158,9 @@ char* slot_start = reinterpret_cast<char*>(ptr) - allocator.root()->extras_offset; for (size_t offset = 0; offset < requested_size; offset += 13) { - EXPECT_PEQ( - PartitionAllocGetSlotStartInBRPPool(static_cast<char*>(ptr) + offset), - slot_start); + EXPECT_PEQ(PartitionAllocGetSlotStartInBRPPool( + reinterpret_cast<uintptr_t>(ptr) + offset), + slot_start); } allocator.root()->Free(ptr); } @@ -3462,79 +3462,80 @@ reinterpret_cast<uintptr_t>(slot_start) - PartitionPageSize(); EXPECT_EQ(0U, reservation_start & DirectMapAllocationGranularityOffsetMask()); - for (char* p = static_cast<char*>(ptr); p < (char*)ptr + large_size; ++p) { - void* ptr2 = reinterpret_cast<char*>(GetDirectMapReservationStart(p)) + - PartitionPageSize(); - EXPECT_EQ(slot_start, ptr2); + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + for (uintptr_t a = address; a < address + large_size; ++a) { + uintptr_t address2 = GetDirectMapReservationStart(a) + PartitionPageSize(); + EXPECT_EQ(reinterpret_cast<uintptr_t>(slot_start), address2); } - EXPECT_EQ(reservation_start, reinterpret_cast<uintptr_t>( - GetDirectMapReservationStart(slot_start))); + EXPECT_EQ(reservation_start, GetDirectMapReservationStart( + reinterpret_cast<uintptr_t>(slot_start))); allocator.root()->Free(ptr); } TEST_F(PartitionAllocTest, CheckReservationType) { - char* ptr = reinterpret_cast<char*>( - allocator.root()->Alloc(kTestAllocSize, type_name)); + void* ptr = allocator.root()->Alloc(kTestAllocSize, type_name); EXPECT_TRUE(ptr); - void* ptr_to_check = ptr; - EXPECT_FALSE(IsReservationStart(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_FALSE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); - ptr_to_check = ptr + kTestAllocSize - 1; - EXPECT_FALSE(IsReservationStart(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_FALSE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); - ptr_to_check = bits::AlignDown(ptr, kSuperPageSize); - EXPECT_TRUE(IsReservationStart(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_FALSE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + uintptr_t address_to_check = address; + EXPECT_FALSE(IsReservationStart(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_FALSE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); + address_to_check = address + kTestAllocSize - 1; + EXPECT_FALSE(IsReservationStart(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_FALSE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); + address_to_check = bits::AlignDown(address, kSuperPageSize); + EXPECT_TRUE(IsReservationStart(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_FALSE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); allocator.root()->Free(ptr); // Freeing keeps a normal-bucket super page in memory. - ptr_to_check = bits::AlignDown(ptr, kSuperPageSize); - EXPECT_TRUE(IsReservationStart(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_FALSE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); + address_to_check = bits::AlignDown(address, kSuperPageSize); + EXPECT_TRUE(IsReservationStart(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_FALSE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); size_t large_size = 2 * kSuperPageSize; ASSERT_GT(large_size, kMaxBucketed); - ptr = reinterpret_cast<char*>(allocator.root()->Alloc(large_size, type_name)); + ptr = allocator.root()->Alloc(large_size, type_name); EXPECT_TRUE(ptr); - ptr_to_check = ptr; - EXPECT_FALSE(IsReservationStart(ptr_to_check)); - EXPECT_FALSE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_TRUE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); - ptr_to_check = bits::AlignUp(ptr, kSuperPageSize); - EXPECT_FALSE(IsReservationStart(ptr_to_check)); - EXPECT_FALSE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_TRUE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); - ptr_to_check = ptr + large_size - 1; - EXPECT_FALSE(IsReservationStart(ptr_to_check)); - EXPECT_FALSE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_TRUE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); - ptr_to_check = bits::AlignDown(ptr, kSuperPageSize); - EXPECT_TRUE(IsReservationStart(ptr_to_check)); - EXPECT_FALSE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_TRUE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); + address = reinterpret_cast<uintptr_t>(ptr); + address_to_check = address; + EXPECT_FALSE(IsReservationStart(address_to_check)); + EXPECT_FALSE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_TRUE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); + address_to_check = bits::AlignUp(address, kSuperPageSize); + EXPECT_FALSE(IsReservationStart(address_to_check)); + EXPECT_FALSE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_TRUE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); + address_to_check = address + large_size - 1; + EXPECT_FALSE(IsReservationStart(address_to_check)); + EXPECT_FALSE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_TRUE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); + address_to_check = bits::AlignDown(address, kSuperPageSize); + EXPECT_TRUE(IsReservationStart(address_to_check)); + EXPECT_FALSE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_TRUE(IsManagedByDirectMap(address_to_check)); + EXPECT_TRUE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); allocator.root()->Free(ptr); // Freeing releases direct-map super pages. - ptr_to_check = bits::AlignDown(ptr, kSuperPageSize); + address_to_check = bits::AlignDown(address, kSuperPageSize); #if DCHECK_IS_ON() // Expect to DCHECK on unallocated region. - EXPECT_DEATH_IF_SUPPORTED(IsReservationStart(ptr_to_check), ""); + EXPECT_DEATH_IF_SUPPORTED(IsReservationStart(address_to_check), ""); #endif - EXPECT_FALSE(IsManagedByNormalBuckets(ptr_to_check)); - EXPECT_FALSE(IsManagedByDirectMap(ptr_to_check)); - EXPECT_FALSE(IsManagedByNormalBucketsOrDirectMap(ptr_to_check)); + EXPECT_FALSE(IsManagedByNormalBuckets(address_to_check)); + EXPECT_FALSE(IsManagedByDirectMap(address_to_check)); + EXPECT_FALSE(IsManagedByNormalBucketsOrDirectMap(address_to_check)); } // Test for crash http://crbug.com/1169003.
diff --git a/base/allocator/partition_allocator/partition_bucket.cc b/base/allocator/partition_allocator/partition_bucket.cc index d9abd21c..64e9c0d 100644 --- a/base/allocator/partition_allocator/partition_bucket.cc +++ b/base/allocator/partition_allocator/partition_bucket.cc
@@ -142,7 +142,8 @@ // If `MarkUsed` was called earlier, the other thread could incorrectly // determine that the allocation had come form PartitionAlloc. if (ptr) - AddressPoolManager::GetInstance()->MarkUsed(pool, ptr, requested_size); + AddressPoolManager::GetInstance()->MarkUsed( + pool, reinterpret_cast<uintptr_t>(ptr), requested_size); #endif PA_DCHECK(!(reinterpret_cast<uintptr_t>(ptr) % kSuperPageSize)); @@ -293,7 +294,8 @@ auto* super_page_extent = reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( - PartitionSuperPageToMetadataArea(reservation_start)); + PartitionSuperPageToMetadataArea( + reinterpret_cast<uintptr_t>(reservation_start))); super_page_extent->root = root; // The new structures are all located inside a fresh system page so they // will all be zeroed out. These DCHECKs are for documentation and to assert @@ -356,8 +358,9 @@ // Note that we didn't check above, because if we cannot even commit a // single page, then this is likely hopeless anyway, and we will crash very // soon. - const bool ok = root->TryRecommitSystemPagesForData(slot_start, slot_size, - PageUpdatePermissions); + const bool ok = root->TryRecommitSystemPagesForData( + reinterpret_cast<uintptr_t>(slot_start), slot_size, + PageUpdatePermissions); if (!ok) { if (!return_null) { PartitionOutOfMemoryCommitFailure(root, slot_size); @@ -366,8 +369,9 @@ { ScopedSyscallTimer<thread_safe> timer{root}; #if !defined(PA_HAS_64_BITS_POINTERS) - AddressPoolManager::GetInstance()->MarkUnused(pool, reservation_start, - reservation_size); + AddressPoolManager::GetInstance()->MarkUnused( + pool, reinterpret_cast<uintptr_t>(reservation_start), + reservation_size); #endif AddressPoolManager::GetInstance()->UnreserveAndDecommit( pool, reservation_start, reservation_size); @@ -548,8 +552,9 @@ PA_DEBUG_DATA_ON_STACK("spansize", slot_span_reservation_size); PA_DEBUG_DATA_ON_STACK("spancmt", slot_span_committed_size); - root->RecommitSystemPagesForData(slot_span_start, slot_span_committed_size, - PageUpdatePermissions); + root->RecommitSystemPagesForData( + reinterpret_cast<uintptr_t>(slot_span_start), slot_span_committed_size, + PageUpdatePermissions); } PA_CHECK(get_slots_per_span() <= @@ -639,7 +644,8 @@ // First check if this is a new extent or not. auto* latest_extent = reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( - PartitionSuperPageToMetadataArea(super_page)); + PartitionSuperPageToMetadataArea( + reinterpret_cast<uintptr_t>(super_page))); // By storing the root in every extent metadata object, we have a fast way // to go from a pointer within the partition to the root object. latest_extent->root = root; @@ -755,7 +761,8 @@ // Windows anyway). if (root->use_lazy_commit) { // TODO(lizeb): Handle commit failure. - root->RecommitSystemPagesForData(commit_start, commit_end - commit_start, + root->RecommitSystemPagesForData(reinterpret_cast<uintptr_t>(commit_start), + commit_end - commit_start, PageUpdatePermissions); } @@ -968,8 +975,8 @@ // If lazy commit is enabled, pages will be recommitted when provisioning // slots, in ProvisionMoreSlotsAndAllocOne(), not here. if (!root->use_lazy_commit) { - void* addr = - SlotSpanMetadata<thread_safe>::ToSlotSpanStartPtr(new_slot_span); + uintptr_t address = reinterpret_cast<uintptr_t>( + SlotSpanMetadata<thread_safe>::ToSlotSpanStartPtr(new_slot_span)); // If lazy commit was never used, we have a guarantee that all slot span // pages have been previously committed, and then decommitted using // PageKeepPermissionsIfPossible, so use the same option as an @@ -978,7 +985,7 @@ // used on Windows and this flag is ignored there, thus no perf impact.) // TODO(lizeb): Handle commit failure. root->RecommitSystemPagesForData( - addr, new_slot_span->bucket->get_bytes_per_span(), + address, new_slot_span->bucket->get_bytes_per_span(), root->never_used_lazy_commit ? PageKeepPermissionsIfPossible : PageUpdatePermissions); }
diff --git a/base/allocator/partition_allocator/partition_page.cc b/base/allocator/partition_allocator/partition_page.cc index 9f31683..0282fb43 100644 --- a/base/allocator/partition_allocator/partition_page.cc +++ b/base/allocator/partition_allocator/partition_page.cc
@@ -26,7 +26,7 @@ namespace { -void UnmapNow(void* reservation_start, +void UnmapNow(uintptr_t reservation_start, size_t reservation_size, pool_handle pool); @@ -57,7 +57,7 @@ PA_DCHECK(root->total_size_of_direct_mapped_pages >= reservation_size); root->total_size_of_direct_mapped_pages -= reservation_size; - char* reservation_start = reinterpret_cast<char*>( + uintptr_t reservation_start = reinterpret_cast<uintptr_t>( SlotSpanMetadata<thread_safe>::ToSlotSpanStartPtr(slot_span)); // The mapping may start at an unspecified location within a super page, but // we always reserve memory aligned to super page size. @@ -213,7 +213,8 @@ root->lock_.AssertAcquired(); PA_DCHECK(is_empty()); PA_DCHECK(!bucket->is_direct_mapped()); - void* slot_span_start = SlotSpanMetadata::ToSlotSpanStartPtr(this); + uintptr_t slot_span_start = + reinterpret_cast<uintptr_t>(SlotSpanMetadata::ToSlotSpanStartPtr(this)); // If lazy commit is enabled, only provisioned slots are committed. size_t dirty_size = bits::AlignUp(GetProvisionedSize(), SystemPageSize()); size_t size_to_decommit = @@ -292,7 +293,7 @@ } namespace { -void UnmapNow(void* reservation_start, +void UnmapNow(uintptr_t reservation_start, size_t reservation_size, pool_handle pool) { PA_DCHECK(reservation_start && reservation_size > 0); @@ -306,7 +307,7 @@ #if defined(PA_HAS_64_BITS_POINTERS) reservation_start #else - reinterpret_cast<char*>(reservation_start) + + reservation_start + AddressPoolManagerBitmap::kBytesPer1BitOfBRPPoolBitmap * AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap #endif @@ -322,21 +323,20 @@ } #endif // DCHECK_IS_ON() - uintptr_t ptr_as_uintptr = reinterpret_cast<uintptr_t>(reservation_start); - PA_DCHECK((ptr_as_uintptr & kSuperPageOffsetMask) == 0); - uintptr_t ptr_end = ptr_as_uintptr + reservation_size; - auto* offset_ptr = ReservationOffsetPointer(ptr_as_uintptr); + PA_DCHECK((reservation_start & kSuperPageOffsetMask) == 0); + uintptr_t reservation_end = reservation_start + reservation_size; + auto* offset_ptr = ReservationOffsetPointer(reservation_start); // Reset the offset table entries for the given memory before unreserving // it. Since the memory is not unreserved and not available for other // threads, the table entries for the memory are not modified by other // threads either. So we can update the table entries without race // condition. uint16_t i = 0; - while (ptr_as_uintptr < ptr_end) { - PA_DCHECK(offset_ptr < GetReservationOffsetTableEnd(ptr_as_uintptr)); + for (uintptr_t address = reservation_start; address < reservation_end; + address += kSuperPageSize) { + PA_DCHECK(offset_ptr < GetReservationOffsetTableEnd(address)); PA_DCHECK(*offset_ptr == i++); *offset_ptr++ = kOffsetTagNotAllocated; - ptr_as_uintptr += kSuperPageSize; } #if !defined(PA_HAS_64_BITS_POINTERS) @@ -346,7 +346,7 @@ // After resetting the table entries, unreserve and decommit the memory. AddressPoolManager::GetInstance()->UnreserveAndDecommit( - pool, reservation_start, reservation_size); + pool, reinterpret_cast<void*>(reservation_start), reservation_size); } } // namespace
diff --git a/base/allocator/partition_allocator/partition_page.h b/base/allocator/partition_allocator/partition_page.h index ca9b04f..726a5e5 100644 --- a/base/allocator/partition_allocator/partition_page.h +++ b/base/allocator/partition_allocator/partition_page.h
@@ -58,20 +58,24 @@ "number_of_consecutive_super_pages must be big enough"); // Returns the base of the first super page in the range of consecutive super -// pages. CAUTION! |extent| must point to the extent of the first super page in -// the range of consecutive super pages. +// pages. +// +// CAUTION! |extent| must point to the extent of the first super page in the +// range of consecutive super pages. template <bool thread_safe> ALWAYS_INLINE char* SuperPagesBeginFromExtent( PartitionSuperPageExtentEntry<thread_safe>* extent) { PA_DCHECK(0 < extent->number_of_consecutive_super_pages); - PA_DCHECK(IsManagedByNormalBuckets(extent)); + PA_DCHECK(IsManagedByNormalBuckets(reinterpret_cast<uintptr_t>(extent))); return base::bits::AlignDown(reinterpret_cast<char*>(extent), kSuperPageAlignment); } // Returns the end of the last super page in the range of consecutive super -// pages. CAUTION! |extent| must point to the extent of the first super page in -// the range of consecutive super pages. +// pages. +// +// CAUTION! |extent| must point to the extent of the first super page in the +// range of consecutive super pages. template <bool thread_safe> ALWAYS_INLINE char* SuperPagesEndFromExtent( PartitionSuperPageExtentEntry<thread_safe>* extent) { @@ -362,20 +366,20 @@ subsequent_page_metadata) == 0, ""); -ALWAYS_INLINE char* PartitionSuperPageToMetadataArea(char* ptr) { - PA_DCHECK(IsReservationStart(ptr)); - uintptr_t pointer_as_uint = reinterpret_cast<uintptr_t>(ptr); - PA_DCHECK(!(pointer_as_uint & kSuperPageOffsetMask)); +// TODO(bartekn): char* -> PartitionPage* or uintptr_t +ALWAYS_INLINE char* PartitionSuperPageToMetadataArea(uintptr_t address) { + PA_DCHECK(IsReservationStart(address)); + PA_DCHECK(!(address & kSuperPageOffsetMask)); // The metadata area is exactly one system page (the guard page) into the // super page. - return reinterpret_cast<char*>(pointer_as_uint + SystemPageSize()); + return reinterpret_cast<char*>(address + SystemPageSize()); } template <bool thread_safe> ALWAYS_INLINE PartitionSuperPageExtentEntry<thread_safe>* -PartitionSuperPageToExtent(char* ptr) { +PartitionSuperPageToExtent(uintptr_t address) { return reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( - PartitionSuperPageToMetadataArea(ptr)); + PartitionSuperPageToMetadataArea(address)); } // Size that should be reserved for state bitmap (if present) inside a super @@ -446,14 +450,17 @@ // area (i.e. area devoted to slot spans). It doesn't check whether it's within // a valid slot span. It merely ensures it doesn't fall in a meta-data region // that would surely never contain user data. -ALWAYS_INLINE bool IsWithinSuperPagePayload(void* ptr, bool with_quarantine) { - ptr = memory::UnmaskPtr(ptr); - PA_DCHECK(IsManagedByNormalBuckets(ptr)); - char* super_page_base = reinterpret_cast<char*>( - reinterpret_cast<uintptr_t>(ptr) & kSuperPageBaseMask); - void* payload_start = SuperPagePayloadBegin(super_page_base, with_quarantine); - void* payload_end = SuperPagePayloadEnd(super_page_base); - return ptr >= payload_start && ptr < payload_end; +ALWAYS_INLINE bool IsWithinSuperPagePayload(uintptr_t address, + bool with_quarantine) { + address = memory::UnmaskPtr(address); + PA_DCHECK(IsManagedByNormalBuckets(address)); + // TODO(bartekn): char* -> uintptr_t, incl. callees + char* super_page_base = reinterpret_cast<char*>(address & kSuperPageBaseMask); + uintptr_t payload_start = reinterpret_cast<uintptr_t>( + SuperPagePayloadBegin(super_page_base, with_quarantine)); + uintptr_t payload_end = + reinterpret_cast<uintptr_t>(SuperPagePayloadEnd(super_page_base)); + return address >= payload_start && address < payload_end; } // Converts from a pointer to the PartitionPage object (within super pages's @@ -477,28 +484,29 @@ // While it is generally valid for |ptr| to be in the middle of an allocation, // care has to be taken with direct maps that span multiple super pages. This // function's behavior is undefined if |ptr| lies in a subsequent super page. +// +// TODO(bartekn): void* -> uintptr_t, Ptr -> Addr template <bool thread_safe> ALWAYS_INLINE PartitionPage<thread_safe>* PartitionPage<thread_safe>::FromPtr( void* ptr) { - uintptr_t pointer_as_uint = reinterpret_cast<uintptr_t>(ptr); - char* super_page_ptr = - reinterpret_cast<char*>(pointer_as_uint & kSuperPageBaseMask); + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + uintptr_t super_page = address & kSuperPageBaseMask; #if DCHECK_IS_ON() - PA_DCHECK(IsReservationStart(super_page_ptr)); - if (IsManagedByNormalBuckets(ptr)) { + PA_DCHECK(IsReservationStart(super_page)); + if (IsManagedByNormalBuckets(address)) { auto* extent = reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( - PartitionSuperPageToMetadataArea(super_page_ptr)); + PartitionSuperPageToMetadataArea(super_page)); PA_DCHECK( - IsWithinSuperPagePayload(ptr, extent->root->IsQuarantineAllowed())); + IsWithinSuperPagePayload(address, extent->root->IsQuarantineAllowed())); } else { - PA_CHECK(ptr >= super_page_ptr + PartitionPageSize()); + PA_CHECK(address >= super_page + PartitionPageSize()); } #endif uintptr_t partition_page_index = - (pointer_as_uint & kSuperPageOffsetMask) >> PartitionPageShift(); + (address & kSuperPageOffsetMask) >> PartitionPageShift(); // Index 0 is invalid because it is the super page extent metadata and the // last index is invalid because the whole PartitionPage is set as guard // pages. This repeats part of the payload PA_DCHECK above, which may check @@ -506,13 +514,15 @@ PA_DCHECK(partition_page_index); PA_DCHECK(partition_page_index < NumPartitionPagesPerSuperPage() - 1); return reinterpret_cast<PartitionPage<thread_safe>*>( - PartitionSuperPageToMetadataArea(super_page_ptr) + + PartitionSuperPageToMetadataArea(super_page) + (partition_page_index << kPageMetadataShift)); } // Converts from a pointer to the SlotSpanMetadata object (within a super // pages's metadata) into a pointer to the beginning of the slot span. This // works on direct maps too. +// +// TODO(bartekn): void* -> uintptr_t, Ptr -> Addr template <bool thread_safe> ALWAYS_INLINE void* SlotSpanMetadata<thread_safe>::ToSlotSpanStartPtr( const SlotSpanMetadata* slot_span) { @@ -545,6 +555,8 @@ // // CAUTION! For direct-mapped allocation, |ptr| has to be within the first // partition page. +// +// TODO(bartekn): void* -> uintptr_t, Ptr -> Addr template <bool thread_safe> ALWAYS_INLINE SlotSpanMetadata<thread_safe>* SlotSpanMetadata<thread_safe>::FromSlotInnerPtr(void* ptr) { @@ -568,8 +580,8 @@ template <bool thread_safe> ALWAYS_INLINE PartitionSuperPageExtentEntry<thread_safe>* SlotSpanMetadata<thread_safe>::ToSuperPageExtent() const { - char* super_page_base = reinterpret_cast<char*>( - reinterpret_cast<uintptr_t>(this) & kSuperPageBaseMask); + uintptr_t super_page_base = + reinterpret_cast<uintptr_t>(this) & kSuperPageBaseMask; return reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( PartitionSuperPageToMetadataArea(super_page_base)); } @@ -751,15 +763,19 @@ // Returns the state bitmap from a pointer within a normal-bucket super page. // It's the caller's responsibility to ensure that the bitmap exists. +// +// TODO(bartekn): void* -> address, Ptr -> Address ALWAYS_INLINE AllocationStateMap* StateBitmapFromPointer(void* ptr) { - PA_DCHECK(IsManagedByNormalBuckets(ptr)); - auto* super_page_base = reinterpret_cast<char*>( - reinterpret_cast<uintptr_t>(ptr) & kSuperPageBaseMask); + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + PA_DCHECK(IsManagedByNormalBuckets(address)); + auto* super_page_base = reinterpret_cast<char*>(address & kSuperPageBaseMask); return SuperPageStateBitmap(super_page_base); } // Iterates over all slot spans in a super-page. |Callback| must return true if // early return is needed. +// +// TODO(bartekn): char* -> uintptr_t template <bool thread_safe, typename Callback> void IterateSlotSpans(char* super_page_base, bool with_quarantine, @@ -769,7 +785,8 @@ !(reinterpret_cast<uintptr_t>(super_page_base) % kSuperPageAlignment)); auto* extent_entry = reinterpret_cast<PartitionSuperPageExtentEntry<thread_safe>*>( - PartitionSuperPageToMetadataArea(super_page_base)); + PartitionSuperPageToMetadataArea( + reinterpret_cast<uintptr_t>(super_page_base))); extent_entry->root->lock_.AssertAcquired(); #endif
diff --git a/base/allocator/partition_allocator/partition_root.cc b/base/allocator/partition_allocator/partition_root.cc index 255f6ebe..f2f9a71 100644 --- a/base/allocator/partition_allocator/partition_root.cc +++ b/base/allocator/partition_allocator/partition_root.cc
@@ -457,8 +457,8 @@ } #if DCHECK_IS_ON() -void DCheckIfManagedByPartitionAllocBRPPool(void* ptr) { - PA_DCHECK(IsManagedByPartitionAllocBRPPool(ptr)); +void DCheckIfManagedByPartitionAllocBRPPool(uintptr_t address) { + PA_DCHECK(IsManagedByPartitionAllocBRPPool(address)); } #endif @@ -723,7 +723,8 @@ char* slot_span_start = reinterpret_cast<char*>( SlotSpan::ToSlotSpanStartPtr(slot_span)); RecommitSystemPagesForData( - slot_span_start + already_committed_size, + reinterpret_cast<uintptr_t>(slot_span_start + + already_committed_size), size_to_commit - already_committed_size, PageUpdatePermissions); } @@ -740,7 +741,8 @@ internal::SlotSpanMetadata<thread_safe>* slot_span, size_t requested_size) { PA_DCHECK(slot_span->bucket->is_direct_mapped()); - PA_DCHECK(internal::IsManagedByDirectMap(slot_span)); + PA_DCHECK( + internal::IsManagedByDirectMap(reinterpret_cast<uintptr_t>(slot_span))); size_t raw_size = AdjustSizeForExtrasAdd(requested_size); auto* extent = DirectMapExtent::FromSlotSpan(slot_span); @@ -778,16 +780,16 @@ size_t current_slot_size = slot_span->bucket->slot_size; char* slot_start = static_cast<char*>(SlotSpan::ToSlotSpanStartPtr(slot_span)); + uintptr_t slot_start_as_uintptr = reinterpret_cast<uintptr_t>(slot_start); // This is the available part of the reservation up to which the new // allocation can grow. size_t available_reservation_size = current_reservation_size - extent->padding_for_alignment - PartitionRoot<thread_safe>::GetDirectMapMetadataAndGuardPagesSize(); #if DCHECK_IS_ON() - char* reservation_start = reinterpret_cast<char*>( - reinterpret_cast<uintptr_t>(slot_start) & kSuperPageBaseMask); + uintptr_t reservation_start = slot_start_as_uintptr & kSuperPageBaseMask; PA_DCHECK(internal::IsReservationStart(reservation_start)); - PA_DCHECK(slot_start + available_reservation_size == + PA_DCHECK(slot_start_as_uintptr + available_reservation_size == reservation_start + current_reservation_size - GetDirectMapMetadataAndGuardPagesSize() + PartitionPageSize()); #endif @@ -798,15 +800,15 @@ } else if (new_slot_size < current_slot_size) { // Shrink by decommitting unneeded pages and making them inaccessible. size_t decommit_size = current_slot_size - new_slot_size; - DecommitSystemPagesForData(slot_start + new_slot_size, decommit_size, - PageUpdatePermissions); + DecommitSystemPagesForData(slot_start_as_uintptr + new_slot_size, + decommit_size, PageUpdatePermissions); // Since the decommited system pages are still reserved, we don't need to // change the entries for decommitted pages in the reservation offset table. } else if (new_slot_size <= available_reservation_size) { // Grow within the actually reserved address space. Just need to make the // pages accessible again. size_t recommit_slot_size_growth = new_slot_size - current_slot_size; - RecommitSystemPagesForData(slot_start + current_slot_size, + RecommitSystemPagesForData(slot_start_as_uintptr + current_slot_size, recommit_slot_size_growth, PageUpdatePermissions); // The recommited system pages had been already reserved and all the @@ -844,7 +846,8 @@ void* ptr, SlotSpan* slot_span, size_t new_size) { - PA_DCHECK(internal::IsManagedByNormalBuckets(ptr)); + PA_DCHECK( + internal::IsManagedByNormalBuckets(reinterpret_cast<uintptr_t>(ptr))); // TODO: note that tcmalloc will "ignore" a downsizing realloc() unless the // new size is a significant percentage smaller. We could do the same if we
diff --git a/base/allocator/partition_allocator/partition_root.h b/base/allocator/partition_allocator/partition_root.h index a8096713..2f32c9e 100644 --- a/base/allocator/partition_allocator/partition_root.h +++ b/base/allocator/partition_allocator/partition_root.h
@@ -32,6 +32,7 @@ #include <algorithm> #include <atomic> +#include <cstdint> #include "base/allocator/buildflags.h" #include "base/allocator/partition_allocator/address_pool_manager_types.h" @@ -80,9 +81,9 @@ // Avoid including partition_address_space.h from this .h file, by moving the // call to IsManagedByPartitionAllocBRPPool into the .cc file. #if DCHECK_IS_ON() -BASE_EXPORT void DCheckIfManagedByPartitionAllocBRPPool(void* ptr); +BASE_EXPORT void DCheckIfManagedByPartitionAllocBRPPool(uintptr_t address); #else -ALWAYS_INLINE void DCheckIfManagedByPartitionAllocBRPPool(void*) {} +ALWAYS_INLINE void DCheckIfManagedByPartitionAllocBRPPool(uintptr_t address) {} #endif } // namespace internal @@ -383,17 +384,17 @@ ALWAYS_INLINE void IncreaseCommittedPages(size_t len); ALWAYS_INLINE void DecreaseCommittedPages(size_t len); ALWAYS_INLINE void DecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) EXCLUSIVE_LOCKS_REQUIRED(lock_); ALWAYS_INLINE void RecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) EXCLUSIVE_LOCKS_REQUIRED(lock_); ALWAYS_INLINE bool TryRecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) LOCKS_EXCLUDED(lock_); @@ -725,18 +726,18 @@ namespace internal { -// Gets the SlotSpanMetadata object of the slot span that contains |ptr|. It's -// used with intention to do obtain the slot size. +// Gets the SlotSpanMetadata object of the slot span that contains |address|. +// It's used with intention to do obtain the slot size. // -// CAUTION! For direct-mapped allocation, |ptr| has to be within the first +// CAUTION! For direct-mapped allocation, |address| has to be within the first // partition page. template <bool thread_safe> ALWAYS_INLINE internal::SlotSpanMetadata<thread_safe>* -PartitionAllocGetSlotSpanForSizeQuery(void* ptr) { - // No need to lock here. Only |ptr| being freed by another thread could +PartitionAllocGetSlotSpanForSizeQuery(uintptr_t address) { + // No need to lock here. Only |address| being freed by another thread could // cause trouble, and the caller is responsible for that not happening. - auto* slot_span = - internal::SlotSpanMetadata<thread_safe>::FromSlotInnerPtr(ptr); + auto* slot_span = internal::SlotSpanMetadata<thread_safe>::FromSlotInnerPtr( + reinterpret_cast<void*>(address)); // TODO(crbug.com/1257655): See if we can afford to make this a CHECK. PA_DCHECK(PartitionRoot<thread_safe>::IsValidSlotSpan(slot_span)); return slot_span; @@ -744,16 +745,18 @@ #if BUILDFLAG(USE_BACKUP_REF_PTR) -ALWAYS_INLINE void* PartitionAllocGetDirectMapSlotStartInBRPPool(void* ptr) { - PA_DCHECK(IsManagedByPartitionAllocBRPPool(ptr)); +// TODO(bartekn): void* -> uintptr_t +ALWAYS_INLINE void* PartitionAllocGetDirectMapSlotStartInBRPPool( + uintptr_t address) { + PA_DCHECK(IsManagedByPartitionAllocBRPPool(address)); #if defined(PA_HAS_64_BITS_POINTERS) // Use this variant of GetDirectMapReservationStart as it has better // performance. - uintptr_t offset = OffsetInBRPPool(ptr); + uintptr_t offset = OffsetInBRPPool(address); uintptr_t reservation_start = - GetDirectMapReservationStart(ptr, kBRPPoolHandle, offset); + GetDirectMapReservationStart(address, kBRPPoolHandle, offset); #else - uintptr_t reservation_start = GetDirectMapReservationStart(ptr); + uintptr_t reservation_start = GetDirectMapReservationStart(address); #endif if (!reservation_start) return nullptr; @@ -790,7 +793,9 @@ // This function is not a template, and can be used on either variant // (thread-safe or not) of the allocator. This relies on the two PartitionRoot<> // having the same layout, which is enforced by static_assert(). -ALWAYS_INLINE void* PartitionAllocGetSlotStartInBRPPool(void* ptr) { +// +// TODO(bartekn): void* -> uinptr_t +ALWAYS_INLINE void* PartitionAllocGetSlotStartInBRPPool(uintptr_t address) { // Adjust to support pointers right past the end of an allocation, which in // some cases appear to point outside the designated allocation slot. // @@ -799,28 +804,27 @@ // no adjustment is needed (and likely wouldn't be correct as there is // a risk of going down to the previous slot). Either way, // kPartitionPastAllocationAdjustment takes care of that detail. - ptr = reinterpret_cast<char*>(ptr) - kPartitionPastAllocationAdjustment; - PA_DCHECK(IsManagedByNormalBucketsOrDirectMap(ptr)); - DCheckIfManagedByPartitionAllocBRPPool(ptr); + address -= kPartitionPastAllocationAdjustment; + PA_DCHECK(IsManagedByNormalBucketsOrDirectMap(address)); + DCheckIfManagedByPartitionAllocBRPPool(address); void* directmap_slot_start = - PartitionAllocGetDirectMapSlotStartInBRPPool(ptr); + PartitionAllocGetDirectMapSlotStartInBRPPool(address); if (UNLIKELY(directmap_slot_start)) return directmap_slot_start; auto* slot_span = internal::PartitionAllocGetSlotSpanForSizeQuery<internal::ThreadSafe>( - ptr); + address); auto* root = PartitionRoot<internal::ThreadSafe>::FromSlotSpan(slot_span); // Double check that ref-count is indeed present. PA_DCHECK(root->brp_enabled()); // Get the offset from the beginning of the slot span. - uintptr_t ptr_addr = reinterpret_cast<uintptr_t>(ptr); uintptr_t slot_span_start = reinterpret_cast<uintptr_t>( internal::SlotSpanMetadata<internal::ThreadSafe>::ToSlotSpanStartPtr( slot_span)); PA_DCHECK(slot_span_start == memory::UnmaskPtr(slot_span_start)); - size_t offset_in_slot_span = ptr_addr - slot_span_start; + size_t offset_in_slot_span = address - slot_span_start; auto* bucket = slot_span->bucket; return memory::RemaskPtr(reinterpret_cast<void*>( @@ -837,36 +841,35 @@ // This function is not a template, and can be used on either variant // (thread-safe or not) of the allocator. This relies on the two PartitionRoot<> // having the same layout, which is enforced by static_assert(). -ALWAYS_INLINE bool PartitionAllocIsValidPtrDelta(void* ptr, +ALWAYS_INLINE bool PartitionAllocIsValidPtrDelta(uintptr_t address, ptrdiff_t delta_in_bytes) { // Required for pointers right past an allocation. See // |PartitionAllocGetSlotStartInBRPPool()|. - void* adjusted_ptr = - reinterpret_cast<char*>(ptr) - kPartitionPastAllocationAdjustment; - PA_DCHECK(IsManagedByNormalBucketsOrDirectMap(adjusted_ptr)); - DCheckIfManagedByPartitionAllocBRPPool(adjusted_ptr); + uintptr_t adjusted_address = address - kPartitionPastAllocationAdjustment; + PA_DCHECK(IsManagedByNormalBucketsOrDirectMap(adjusted_address)); + DCheckIfManagedByPartitionAllocBRPPool(adjusted_address); - void* slot_start = PartitionAllocGetSlotStartInBRPPool(adjusted_ptr); - // Get |slot_span| from |slot_start| instead of |adjusted_ptr|, because for - // direct map, PartitionAllocGetSlotSpanForSizeQuery() only works on the first - // partition page of the allocation. + void* slot_start = PartitionAllocGetSlotStartInBRPPool(adjusted_address); + // Get |slot_span| from |slot_start| instead of |adjusted_address|, because + // for direct map, PartitionAllocGetSlotSpanForSizeQuery() only works on the + // first partition page of the allocation. auto* slot_span = internal::PartitionAllocGetSlotSpanForSizeQuery<internal::ThreadSafe>( - slot_start); + reinterpret_cast<uintptr_t>(slot_start)); auto* root = PartitionRoot<internal::ThreadSafe>::FromSlotSpan(slot_span); // Double check that ref-count is indeed present. PA_DCHECK(root->brp_enabled()); - // No longer use |adjusted_ptr| beyond this point. It was needed to pick the - // right slot, but now we're dealing with very concrete addresses. + // No longer use |adjusted_address| beyond this point. It was needed to pick + // the right slot, but now we're dealing with very concrete addresses. uintptr_t user_data_start = reinterpret_cast<uintptr_t>(root->AdjustPointerForExtrasAdd(slot_start)); size_t user_data_size = slot_span->GetUsableSize(root); - uintptr_t new_ptr = reinterpret_cast<uintptr_t>(ptr) + delta_in_bytes; - return user_data_start <= new_ptr && + uintptr_t new_address = address + delta_in_bytes; + return user_data_start <= new_address && // We use "greater then or equal" below because we want to include // pointers right past the end of an allocation. - new_ptr <= user_data_start + user_data_size; + new_address <= user_data_start + user_data_size; } // TODO(glazunov): Simplify the function once the non-thread-safe PartitionRoot @@ -1018,7 +1021,7 @@ #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && \ ((defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMECAST)) || \ (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))) - PA_CHECK(IsManagedByPartitionAlloc(ptr)); + PA_CHECK(IsManagedByPartitionAlloc(reinterpret_cast<uintptr_t>(ptr))); #endif // Fetch the root from the pointer, and not the SlotSpan. This is important, @@ -1063,7 +1066,8 @@ if (UNLIKELY(root->IsQuarantineEnabled())) { // PCScan safepoint. Call before potentially scheduling scanning task. PCScan::JoinScanIfNeeded(); - if (LIKELY(internal::IsManagedByNormalBuckets(ptr))) { + if (LIKELY(internal::IsManagedByNormalBuckets( + reinterpret_cast<uintptr_t>(ptr)))) { PCScan::MoveToQuarantine(memory::UnmaskPtr(slot_start), slot_span->GetUsableSize(root), slot_span->bucket->slot_size); @@ -1119,7 +1123,8 @@ // TODO(bikineev): Change the condition to LIKELY once PCScan is enabled by // default. if (UNLIKELY(IsQuarantineEnabled())) { - if (LIKELY(internal::IsManagedByNormalBuckets(ptr))) { + if (LIKELY(internal::IsManagedByNormalBuckets( + reinterpret_cast<uintptr_t>(ptr)))) { // Mark the state in the state bitmap as freed. internal::StateBitmapFromPointer(slot_start) ->Free(reinterpret_cast<uintptr_t>(slot_start)); @@ -1297,23 +1302,28 @@ return extent_entry->root; } +// TODO(bartekn): char* -> uintptr_t template <bool thread_safe> ALWAYS_INLINE PartitionRoot<thread_safe>* PartitionRoot<thread_safe>::FromFirstSuperPage(char* super_page) { - PA_DCHECK(internal::IsReservationStart(super_page)); + PA_DCHECK( + internal::IsReservationStart(reinterpret_cast<uintptr_t>(super_page))); auto* extent_entry = reinterpret_cast<SuperPageExtentEntry*>( - internal::PartitionSuperPageToMetadataArea(super_page)); + internal::PartitionSuperPageToMetadataArea( + reinterpret_cast<uintptr_t>(super_page))); PartitionRoot* root = extent_entry->root; PA_DCHECK(root->inverted_self == ~reinterpret_cast<uintptr_t>(root)); return root; } +// TODO(bartekn): char* -> uintptr_t template <bool thread_safe> ALWAYS_INLINE PartitionRoot<thread_safe>* PartitionRoot<thread_safe>::FromPointerInFirstSuperpage(char* ptr) { char* super_page = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(ptr) & kSuperPageBaseMask); - PA_DCHECK(internal::IsReservationStart(super_page)); + PA_DCHECK( + internal::IsReservationStart(reinterpret_cast<uintptr_t>(super_page))); return FromFirstSuperPage(super_page); } @@ -1343,28 +1353,30 @@ template <bool thread_safe> ALWAYS_INLINE void PartitionRoot<thread_safe>::DecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) { internal::ScopedSyscallTimer<thread_safe> timer{this}; - DecommitSystemPages(address, length, accessibility_disposition); + DecommitSystemPages(reinterpret_cast<void*>(address), length, + accessibility_disposition); DecreaseCommittedPages(length); } // Not unified with TryRecommitSystemPagesForData() to preserve error codes. template <bool thread_safe> ALWAYS_INLINE void PartitionRoot<thread_safe>::RecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) { internal::ScopedSyscallTimer<thread_safe> timer{this}; - bool ok = TryRecommitSystemPages(address, length, PageReadWriteTagged, + void* ptr = reinterpret_cast<void*>(address); + bool ok = TryRecommitSystemPages(ptr, length, PageReadWriteTagged, accessibility_disposition); if (UNLIKELY(!ok)) { // Decommit some memory and retry. The alternative is crashing. DecommitEmptySlotSpans(); - RecommitSystemPages(address, length, PageReadWriteTagged, + RecommitSystemPages(ptr, length, PageReadWriteTagged, accessibility_disposition); } @@ -1373,11 +1385,12 @@ template <bool thread_safe> ALWAYS_INLINE bool PartitionRoot<thread_safe>::TryRecommitSystemPagesForData( - void* address, + uintptr_t address, size_t length, PageAccessibilityDisposition accessibility_disposition) { internal::ScopedSyscallTimer<thread_safe> timer{this}; - bool ok = TryRecommitSystemPages(address, length, PageReadWriteTagged, + void* ptr = reinterpret_cast<void*>(address); + bool ok = TryRecommitSystemPages(ptr, length, PageReadWriteTagged, accessibility_disposition); #if defined(PA_COMMIT_CHARGE_IS_LIMITED) if (UNLIKELY(!ok)) { @@ -1385,7 +1398,7 @@ ScopedGuard guard(lock_); DecommitEmptySlotSpans(); } - ok = TryRecommitSystemPages(address, length, PageReadWriteTagged, + ok = TryRecommitSystemPages(ptr, length, PageReadWriteTagged, accessibility_disposition); } #endif // defined(PA_COMMIT_CHARGE_IS_LIMITED) @@ -1423,7 +1436,8 @@ PartitionRoot<thread_safe>::AllocationCapacityFromPtr(void* ptr) const { ptr = AdjustPointerForExtrasSubtract(ptr); auto* slot_span = - internal::PartitionAllocGetSlotSpanForSizeQuery<thread_safe>(ptr); + internal::PartitionAllocGetSlotSpanForSizeQuery<thread_safe>( + reinterpret_cast<uintptr_t>(ptr)); size_t size = AdjustSizeForExtrasSubtract(slot_span->bucket->slot_size); return size; } @@ -1665,7 +1679,8 @@ // TODO(bikineev): Change the condition to LIKELY once PCScan is enabled by // default. if (UNLIKELY(is_quarantine_enabled)) { - if (LIKELY(internal::IsManagedByNormalBuckets(ret))) { + if (LIKELY(internal::IsManagedByNormalBuckets( + reinterpret_cast<uintptr_t>(ret)))) { // Mark the corresponding bits in the state bitmap as allocated. internal::StateBitmapFromPointer(ret)->Allocate( reinterpret_cast<uintptr_t>(slot_start));
diff --git a/base/allocator/partition_allocator/reservation_offset_table.h b/base/allocator/partition_allocator/reservation_offset_table.h index 9d71344..8f735fa8 100644 --- a/base/allocator/partition_allocator/reservation_offset_table.h +++ b/base/allocator/partition_allocator/reservation_offset_table.h
@@ -111,12 +111,12 @@ } ALWAYS_INLINE uint16_t* GetReservationOffsetTable(uintptr_t address) { - pool_handle handle = GetPool(reinterpret_cast<void*>(address)); + pool_handle handle = GetPool(address); return GetReservationOffsetTable(handle); } ALWAYS_INLINE const uint16_t* GetReservationOffsetTableEnd(uintptr_t address) { - pool_handle handle = GetPool(reinterpret_cast<void*>(address)); + pool_handle handle = GetPool(address); return GetReservationOffsetTableEnd(handle); } @@ -144,7 +144,7 @@ pool_handle pool; address = memory::UnmaskPtr(address); uintptr_t offset; - std::tie(pool, offset) = GetPoolAndOffset(reinterpret_cast<void*>(address)); + std::tie(pool, offset) = GetPoolAndOffset(address); return ReservationOffsetPointer(pool, offset); #else size_t table_index = address >> kSuperPageShift; @@ -154,15 +154,15 @@ #endif } -ALWAYS_INLINE uintptr_t ComputeReservationStart(void* address, +ALWAYS_INLINE uintptr_t ComputeReservationStart(uintptr_t address, uint16_t* offset_ptr) { - return (reinterpret_cast<uintptr_t>(address) & kSuperPageBaseMask) - + return (address & kSuperPageBaseMask) - (static_cast<size_t>(*offset_ptr) << kSuperPageShift); } // If the given address doesn't point to direct-map allocated memory, // returns 0. -ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(void* address) { +ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { #if DCHECK_IS_ON() bool is_in_brp_pool = IsManagedByPartitionAllocBRPPool(address); bool is_in_regular_pool = IsManagedByPartitionAllocRegularPool(address); @@ -171,8 +171,7 @@ PA_DCHECK(!is_in_brp_pool); #endif #endif // DCHECK_IS_ON() - uintptr_t ptr_as_uintptr = reinterpret_cast<uintptr_t>(address); - uint16_t* offset_ptr = ReservationOffsetPointer(ptr_as_uintptr); + uint16_t* offset_ptr = ReservationOffsetPointer(address); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); if (*offset_ptr == kOffsetTagNormalBuckets) return 0; @@ -182,16 +181,15 @@ // In the 32-bit mode, the beginning of a reservation may be excluded from the // BRP pool, so shift the pointer. The other pools don't have this logic. PA_DCHECK(is_in_brp_pool == - IsManagedByPartitionAllocBRPPool(reinterpret_cast<void*>( + IsManagedByPartitionAllocBRPPool( reservation_start #if !defined(PA_HAS_64_BITS_POINTERS) + AddressPoolManagerBitmap::kBytesPer1BitOfBRPPoolBitmap * AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap #endif // !defined(PA_HAS_64_BITS_POINTERS) - ))); + )); PA_DCHECK(is_in_regular_pool == - IsManagedByPartitionAllocRegularPool( - reinterpret_cast<void*>(reservation_start))); + IsManagedByPartitionAllocRegularPool(reservation_start)); PA_DCHECK(*ReservationOffsetPointer(reservation_start) == 0); #endif // DCHECK_IS_ON() @@ -203,12 +201,12 @@ // returns 0. // This variant has better performance than the regular one on 64-bit builds if // the Pool that an allocation belongs to is known. -ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(void* address, +ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address, pool_handle pool, uintptr_t offset_in_pool) { PA_DCHECK(AddressPoolManager::GetInstance()->GetPoolBaseAddress(pool) + offset_in_pool == - reinterpret_cast<uintptr_t>(address)); + address); uint16_t* offset_ptr = ReservationOffsetPointer(pool, offset_in_pool); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); if (*offset_ptr == kOffsetTagNormalBuckets) @@ -223,34 +221,30 @@ // reservation, i.e. either a normal bucket super page, or the first super page // of direct map. // |address| must belong to an allocated super page. -ALWAYS_INLINE bool IsReservationStart(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); - uint16_t* offset_ptr = ReservationOffsetPointer(address_as_uintptr); +ALWAYS_INLINE bool IsReservationStart(uintptr_t address) { + uint16_t* offset_ptr = ReservationOffsetPointer(address); PA_DCHECK(*offset_ptr != kOffsetTagNotAllocated); return ((*offset_ptr == kOffsetTagNormalBuckets) || (*offset_ptr == 0)) && - (address_as_uintptr % kSuperPageSize == 0); + (address % kSuperPageSize == 0); } // Returns true if |address| belongs to a normal bucket super page. -ALWAYS_INLINE bool IsManagedByNormalBuckets(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); - uint16_t* offset_ptr = ReservationOffsetPointer(address_as_uintptr); +ALWAYS_INLINE bool IsManagedByNormalBuckets(uintptr_t address) { + uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr == kOffsetTagNormalBuckets; } // Returns true if |address| belongs to a direct map region. -ALWAYS_INLINE bool IsManagedByDirectMap(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); - uint16_t* offset_ptr = ReservationOffsetPointer(address_as_uintptr); +ALWAYS_INLINE bool IsManagedByDirectMap(uintptr_t address) { + uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr != kOffsetTagNormalBuckets && *offset_ptr != kOffsetTagNotAllocated; } // Returns true if |address| belongs to a normal bucket super page or a direct // map region, i.e. belongs to an allocated super page. -ALWAYS_INLINE bool IsManagedByNormalBucketsOrDirectMap(const void* address) { - uintptr_t address_as_uintptr = reinterpret_cast<uintptr_t>(address); - uint16_t* offset_ptr = ReservationOffsetPointer(address_as_uintptr); +ALWAYS_INLINE bool IsManagedByNormalBucketsOrDirectMap(uintptr_t address) { + uint16_t* offset_ptr = ReservationOffsetPointer(address); return *offset_ptr != kOffsetTagNotAllocated; }
diff --git a/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/base/allocator/partition_allocator/starscan/pcscan_internal.cc index 394c1e2..cb42b5b83 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/base/allocator/partition_allocator/starscan/pcscan_internal.cc
@@ -107,12 +107,12 @@ class QuarantineCardTable final { public: // Avoid the load of the base of the regular pool. - ALWAYS_INLINE static QuarantineCardTable& GetFrom(uintptr_t ptr) { - PA_SCAN_DCHECK( - IsManagedByPartitionAllocRegularPool(reinterpret_cast<void*>(ptr))); + ALWAYS_INLINE static QuarantineCardTable& GetFrom(uintptr_t address) { + PA_SCAN_DCHECK(IsManagedByPartitionAllocRegularPool(address)); constexpr uintptr_t kRegularPoolBaseMask = PartitionAddressSpace::RegularPoolBaseMask(); - return *reinterpret_cast<QuarantineCardTable*>(ptr & kRegularPoolBaseMask); + return *reinterpret_cast<QuarantineCardTable*>(address & + kRegularPoolBaseMask); } ALWAYS_INLINE void Quarantine(uintptr_t begin, size_t size) { @@ -149,8 +149,7 @@ const size_t byte = Byte(begin); const size_t need_bytes = (size + (kCardSize - 1)) / kCardSize; PA_SCAN_DCHECK(bytes_.size() >= byte + need_bytes); - PA_SCAN_DCHECK( - IsManagedByPartitionAllocRegularPool(reinterpret_cast<void*>(begin))); + PA_SCAN_DCHECK(IsManagedByPartitionAllocRegularPool(begin)); for (size_t i = byte; i < byte + need_bytes; ++i) bytes_[i] = value; } @@ -193,17 +192,15 @@ // point to guard pages or slot-span metadata. PA_SCAN_INLINE GetSlotStartResult GetSlotStartInSuperPage(uintptr_t maybe_inner_ptr) { - char* maybe_inner_ptr_as_char_ptr = reinterpret_cast<char*>(maybe_inner_ptr); - PA_SCAN_DCHECK(IsManagedByNormalBuckets(maybe_inner_ptr_as_char_ptr)); + PA_SCAN_DCHECK(IsManagedByNormalBuckets(maybe_inner_ptr)); // Don't use FromSlotInnerPtr() or FromPtr() because they expect a pointer to // a valid slot span. - char* const super_page_ptr = - reinterpret_cast<char*>(maybe_inner_ptr & kSuperPageBaseMask); + const uintptr_t super_page_base = maybe_inner_ptr & kSuperPageBaseMask; const uintptr_t partition_page_index = (maybe_inner_ptr & kSuperPageOffsetMask) >> PartitionPageShift(); auto* page = reinterpret_cast<PartitionPage<ThreadSafe>*>( - PartitionSuperPageToMetadataArea(super_page_ptr) + + PartitionSuperPageToMetadataArea(super_page_base) + (partition_page_index << kPageMetadataShift)); // Check if page is valid. The check also works for the guard pages and the // metadata page. @@ -218,9 +215,9 @@ if (!slot_span->bucket) return {}; PA_SCAN_DCHECK(PartitionRoot<ThreadSafe>::IsValidSlotSpan(slot_span)); - char* const slot_span_begin = static_cast<char*>( + const uintptr_t slot_span_start = reinterpret_cast<uintptr_t>( SlotSpanMetadata<ThreadSafe>::ToSlotSpanStartPtr(slot_span)); - const ptrdiff_t ptr_offset = maybe_inner_ptr_as_char_ptr - slot_span_begin; + const ptrdiff_t ptr_offset = maybe_inner_ptr - slot_span_start; PA_SCAN_DCHECK(0 <= ptr_offset && ptr_offset < static_cast<ptrdiff_t>( slot_span->bucket->get_pages_per_slot_span() * @@ -230,9 +227,9 @@ // the quarantine bit will anyway return false in this case. const size_t slot_size = slot_span->bucket->slot_size; const size_t slot_number = slot_span->bucket->GetSlotNumber(ptr_offset); - char* const slot_start = slot_span_begin + (slot_number * slot_size); - PA_SCAN_DCHECK(slot_start <= maybe_inner_ptr_as_char_ptr && - maybe_inner_ptr_as_char_ptr < slot_start + slot_size); + const uintptr_t slot_start = slot_span_start + (slot_number * slot_size); + PA_SCAN_DCHECK(slot_start <= maybe_inner_ptr && + maybe_inner_ptr < slot_start + slot_size); return {.slot_start = reinterpret_cast<uintptr_t>(slot_start), .slot_size = slot_size}; } @@ -392,8 +389,7 @@ using Root = PartitionRoot<ThreadSafe>; using SlotSpan = SlotSpanMetadata<ThreadSafe>; - auto* extent_entry = PartitionSuperPageToExtent<ThreadSafe>( - reinterpret_cast<char*>(super_page)); + auto* extent_entry = PartitionSuperPageToExtent<ThreadSafe>(super_page); typename Root::ScopedGuard lock(extent_entry->root->lock_); @@ -600,8 +596,7 @@ PA_SCAN_INLINE AllocationStateMap* PCScanTask::TryFindScannerBitmapForPointer( uintptr_t maybe_ptr) const { - PA_SCAN_DCHECK( - IsManagedByPartitionAllocRegularPool(reinterpret_cast<void*>(maybe_ptr))); + PA_SCAN_DCHECK(IsManagedByPartitionAllocRegularPool(maybe_ptr)); // First, check if |maybe_ptr| points to a valid super page or a quarantined // card. #if defined(PA_HAS_64_BITS_POINTERS) @@ -623,8 +618,7 @@ return nullptr; #endif #else // defined(PA_HAS_64_BITS_POINTERS) - if (LIKELY(!IsManagedByPartitionAllocRegularPool( - reinterpret_cast<void*>(maybe_ptr)))) + if (LIKELY(!IsManagedByPartitionAllocRegularPool(maybe_ptr))) return nullptr; #endif // defined(PA_HAS_64_BITS_POINTERS) @@ -651,7 +645,7 @@ // Beyond this point, we know that |maybe_ptr| is a pointer within a // normal-bucket super page. - PA_SCAN_DCHECK(IsManagedByNormalBuckets(reinterpret_cast<void*>(maybe_ptr))); + PA_SCAN_DCHECK(IsManagedByNormalBuckets(maybe_ptr)); #if !PA_STARSCAN_USE_CARD_TABLE // Pointer from a normal bucket is always in the first superpage. @@ -1401,8 +1395,8 @@ super_page != super_page_end; super_page += kSuperPageSize) { // Make sure the metadata is committed. // TODO(bikineev): Remove once this is known to work. - const volatile char* metadata = - PartitionSuperPageToMetadataArea(super_page); + const volatile char* metadata = PartitionSuperPageToMetadataArea( + reinterpret_cast<uintptr_t>(super_page)); *metadata; RecommitSystemPages(internal::SuperPageStateBitmap(super_page), state_bitmap_size_to_commit, PageReadWrite, @@ -1465,8 +1459,8 @@ PA_DCHECK(!(super_page_base % kSuperPageAlignment)); // Make sure the metadata is committed. // TODO(bikineev): Remove once this is known to work. - const volatile char* metadata = PartitionSuperPageToMetadataArea( - reinterpret_cast<char*>(super_page_base)); + const volatile char* metadata = + PartitionSuperPageToMetadataArea(super_page_base); *metadata; std::lock_guard<std::mutex> lock(roots_mutex_);
diff --git a/base/allocator/partition_allocator/starscan/pcscan_unittest.cc b/base/allocator/partition_allocator/starscan/pcscan_unittest.cc index 90bbbf4..ccd474be 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_unittest.cc +++ b/base/allocator/partition_allocator/starscan/pcscan_unittest.cc
@@ -701,7 +701,8 @@ // Initialize scannable pointers with addresses of guard pages and metadata. pointers->super_page_base = super_page; - pointers->metadata_page = PartitionSuperPageToMetadataArea(super_page); + pointers->metadata_page = + PartitionSuperPageToMetadataArea(reinterpret_cast<uintptr_t>(super_page)); pointers->guard_page1 = static_cast<char*>(pointers->metadata_page) + SystemPageSize(); pointers->scan_bitmap = SuperPageStateBitmap(super_page);
diff --git a/base/memory/raw_ptr.cc b/base/memory/raw_ptr.cc index 866bde9..3419330 100644 --- a/base/memory/raw_ptr.cc +++ b/base/memory/raw_ptr.cc
@@ -21,70 +21,44 @@ namespace internal { -void BackupRefPtrImpl::AcquireInternal(const volatile void* cv_ptr) { - // |const volatile| qualifiers are used only to compile with |T*| pointers - // passed by the caller that may have those qualifiers. From now on, the - // pointer value is used, but is never dereferenced. - // - // TODO(bartekn): Convert to |uintptr_t address|, incl. callees. - void* ptr = const_cast<void*>(cv_ptr); +void BackupRefPtrImpl::AcquireInternal(uintptr_t address) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - CHECK(IsManagedByPartitionAllocBRPPool(ptr)); + CHECK(IsManagedByPartitionAllocBRPPool(address)); #endif - void* slot_start = PartitionAllocGetSlotStartInBRPPool(ptr); + void* slot_start = PartitionAllocGetSlotStartInBRPPool(address); PartitionRefCountPointer(slot_start)->Acquire(); } -void BackupRefPtrImpl::ReleaseInternal(const volatile void* cv_ptr) { - // |const volatile| qualifiers are used only to compile with |T*| pointers - // passed by the caller that may have those qualifiers. From now on, the - // pointer value is used, but is never dereferenced. - // - // TODO(bartekn): Convert to |uintptr_t address|, incl. callees. - void* ptr = const_cast<void*>(cv_ptr); +void BackupRefPtrImpl::ReleaseInternal(uintptr_t address) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - CHECK(IsManagedByPartitionAllocBRPPool(ptr)); + CHECK(IsManagedByPartitionAllocBRPPool(address)); #endif - void* slot_start = PartitionAllocGetSlotStartInBRPPool(ptr); + void* slot_start = PartitionAllocGetSlotStartInBRPPool(address); if (PartitionRefCountPointer(slot_start)->Release()) PartitionAllocFreeForRefCounting(slot_start); } -bool BackupRefPtrImpl::IsPointeeAlive(const volatile void* cv_ptr) { - // |const volatile| qualifiers are used only to compile with |T*| pointers - // passed by the caller that may have those qualifiers. From now on, the - // pointer value is used, but is never dereferenced. - // - // TODO(bartekn): Convert to |uintptr_t address|, incl. callees. - void* ptr = const_cast<void*>(cv_ptr); +bool BackupRefPtrImpl::IsPointeeAlive(uintptr_t address) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - CHECK(IsManagedByPartitionAllocBRPPool(ptr)); + CHECK(IsManagedByPartitionAllocBRPPool(address)); #endif - void* slot_start = PartitionAllocGetSlotStartInBRPPool(ptr); + void* slot_start = PartitionAllocGetSlotStartInBRPPool(address); return PartitionRefCountPointer(slot_start)->IsAlive(); } -bool BackupRefPtrImpl::IsValidDelta(const volatile void* cv_ptr, +bool BackupRefPtrImpl::IsValidDelta(uintptr_t address, ptrdiff_t delta_in_bytes) { - // |const volatile| qualifiers are used only to compile with |T*| pointers - // passed by the caller that may have those qualifiers. From now on, the - // pointer value is used, but is never dereferenced. - // - // TODO(bartekn): Convert to |uintptr_t address|, incl. callees. - void* ptr = const_cast<void*>(cv_ptr); - return PartitionAllocIsValidPtrDelta(ptr, delta_in_bytes); + return PartitionAllocIsValidPtrDelta(address, delta_in_bytes); } #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) -void CheckThatAddressIsntWithinFirstPartitionPage(void* ptr) { - if (IsManagedByDirectMap(ptr)) { - uintptr_t reservation_start = GetDirectMapReservationStart(ptr); - CHECK(reinterpret_cast<uintptr_t>(ptr) - reservation_start >= - PartitionPageSize()); +void CheckThatAddressIsntWithinFirstPartitionPage(uintptr_t address) { + if (IsManagedByDirectMap(address)) { + uintptr_t reservation_start = GetDirectMapReservationStart(address); + CHECK(address - reservation_start >= PartitionPageSize()); } else { - CHECK(IsManagedByNormalBuckets(ptr)); - CHECK(reinterpret_cast<uintptr_t>(ptr) % kSuperPageSize >= - PartitionPageSize()); + CHECK(IsManagedByNormalBuckets(address)); + CHECK(address % kSuperPageSize >= PartitionPageSize()); } } #endif // DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS)
diff --git a/base/memory/raw_ptr.h b/base/memory/raw_ptr.h index 28fb395a..01e1b69c 100644 --- a/base/memory/raw_ptr.h +++ b/base/memory/raw_ptr.h
@@ -113,7 +113,8 @@ #if BUILDFLAG(USE_BACKUP_REF_PTR) #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) -BASE_EXPORT void CheckThatAddressIsntWithinFirstPartitionPage(void* ptr); +BASE_EXPORT void CheckThatAddressIsntWithinFirstPartitionPage( + uintptr_t address); #endif struct BackupRefPtrImpl { @@ -121,16 +122,9 @@ // modify the same smart pointer object without synchronization, a data race // will occur. - static RAW_PTR_FUNC_ATTRIBUTES bool IsSupportedAndNotNull( - const volatile void* cv_ptr) { - // |const volatile| qualifiers are used only to compile with |T*| pointers - // passed by the caller that may have those qualifiers. From now on, the - // pointer value is used, but is never dereferenced. - // - // TODO(bartekn): Convert to |uintptr_t address|, incl. callees. - void* ptr = const_cast<void*>(cv_ptr); + static RAW_PTR_FUNC_ATTRIBUTES bool IsSupportedAndNotNull(uintptr_t address) { // This covers the nullptr case, as address 0 is never in GigaCage. - bool is_in_brp_pool = IsManagedByPartitionAllocBRPPool(ptr); + bool is_in_brp_pool = IsManagedByPartitionAllocBRPPool(address); // There are many situations where the compiler can prove that // ReleaseWrappedPtr is called on a value that is always nullptr, but the @@ -141,16 +135,16 @@ // to the compiler that is_in_brp_pool will always be false for nullptr. // // This condition would look nicer and might also theoretically be nicer for - // the optimizer if it was written as "if (ptr == nullptr) { ... }", but + // the optimizer if it was written as "if (!address) { ... }", but // LLVM currently has issues with optimizing that away properly; see: // https://bugs.llvm.org/show_bug.cgi?id=49403 // https://reviews.llvm.org/D97848 // https://chromium-review.googlesource.com/c/chromium/src/+/2727400/2/base/memory/checked_ptr.h#120 #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - CHECK(ptr != nullptr || !is_in_brp_pool); + CHECK(address || !is_in_brp_pool); #endif #if HAS_BUILTIN(__builtin_assume) - __builtin_assume(ptr != nullptr || !is_in_brp_pool); + __builtin_assume(address || !is_in_brp_pool); #endif // There may be pointers immediately after the allocation, e.g. @@ -172,7 +166,7 @@ // page. #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) if (is_in_brp_pool) { - CheckThatAddressIsntWithinFirstPartitionPage(ptr); + CheckThatAddressIsntWithinFirstPartitionPage(address); } #endif @@ -182,16 +176,16 @@ // Wraps a pointer. template <typename T> static RAW_PTR_FUNC_ATTRIBUTES T* WrapRawPtr(T* ptr) { - if (IsSupportedAndNotNull(ptr)) { + uintptr_t address = reinterpret_cast<uintptr_t>(ptr); + if (IsSupportedAndNotNull(address)) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) CHECK(ptr != nullptr); #endif - AcquireInternal(ptr); + AcquireInternal(address); } #if !defined(PA_HAS_64_BITS_POINTERS) else { - AddressPoolManagerBitmap::IncrementOutsideOfBRPPoolPtrRefCount( - reinterpret_cast<uintptr_t>(ptr)); + AddressPoolManagerBitmap::IncrementOutsideOfBRPPoolPtrRefCount(address); } #endif @@ -201,16 +195,16 @@ // Notifies the allocator when a wrapped pointer is being removed or replaced. template <typename T> static RAW_PTR_FUNC_ATTRIBUTES void ReleaseWrappedPtr(T* wrapped_ptr) { - if (IsSupportedAndNotNull(wrapped_ptr)) { + uintptr_t address = reinterpret_cast<uintptr_t>(wrapped_ptr); + if (IsSupportedAndNotNull(address)) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) CHECK(wrapped_ptr != nullptr); #endif - ReleaseInternal(wrapped_ptr); + ReleaseInternal(address); } #if !defined(PA_HAS_64_BITS_POINTERS) else { - AddressPoolManagerBitmap::DecrementOutsideOfBRPPoolPtrRefCount( - reinterpret_cast<uintptr_t>(wrapped_ptr)); + AddressPoolManagerBitmap::DecrementOutsideOfBRPPoolPtrRefCount(address); } #endif } @@ -221,9 +215,10 @@ static RAW_PTR_FUNC_ATTRIBUTES T* SafelyUnwrapPtrForDereference( T* wrapped_ptr) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - if (IsSupportedAndNotNull(wrapped_ptr)) { + uintptr_t address = reinterpret_cast<uintptr_t>(wrapped_ptr); + if (IsSupportedAndNotNull(address)) { CHECK(wrapped_ptr != nullptr); - CHECK(IsPointeeAlive(wrapped_ptr)); + CHECK(IsPointeeAlive(address)); } #endif return wrapped_ptr; @@ -260,8 +255,9 @@ static RAW_PTR_FUNC_ATTRIBUTES T* Advance(T* wrapped_ptr, ptrdiff_t delta_elem) { #if DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - if (IsSupportedAndNotNull(wrapped_ptr)) - CHECK(IsValidDelta(wrapped_ptr, delta_elem * sizeof(T))); + uintptr_t address = reinterpret_cast<uintptr_t>(wrapped_ptr); + if (IsSupportedAndNotNull(address)) + CHECK(IsValidDelta(address, delta_elem * sizeof(T))); #endif T* new_wrapped_ptr = WrapRawPtr(wrapped_ptr + delta_elem); ReleaseWrappedPtr(wrapped_ptr); @@ -286,10 +282,10 @@ // lightweight |IsManagedByPartitionAllocBRPPool()| check was inlined. // Therefore, we've extracted the rest into the functions below and marked // them as NOINLINE to prevent unintended LTO effects. - static BASE_EXPORT NOINLINE void AcquireInternal(const volatile void* cv_ptr); - static BASE_EXPORT NOINLINE void ReleaseInternal(const volatile void* cv_ptr); - static BASE_EXPORT NOINLINE bool IsPointeeAlive(const volatile void* cv_ptr); - static BASE_EXPORT NOINLINE bool IsValidDelta(const volatile void* cv_ptr, + static BASE_EXPORT NOINLINE void AcquireInternal(uintptr_t address); + static BASE_EXPORT NOINLINE void ReleaseInternal(uintptr_t address); + static BASE_EXPORT NOINLINE bool IsPointeeAlive(uintptr_t address); + static BASE_EXPORT NOINLINE bool IsValidDelta(uintptr_t address, ptrdiff_t delta_in_bytes); };
diff --git a/base/task/sequence_manager/real_time_domain.cc b/base/task/sequence_manager/real_time_domain.cc index f180d02..88e9180 100644 --- a/base/task/sequence_manager/real_time_domain.cc +++ b/base/task/sequence_manager/real_time_domain.cc
@@ -20,7 +20,7 @@ } base::TimeTicks RealTimeDomain::GetNextDelayedTaskTime( - DelayedWakeUp next_wake_up, + WakeUp next_wake_up, sequence_manager::LazyNow* lazy_now) const { TimeTicks now = lazy_now->Now(); if (now >= next_wake_up.time) { @@ -35,7 +35,7 @@ } bool RealTimeDomain::MaybeFastForwardToWakeUp( - absl::optional<DelayedWakeUp> next_wake_up, + absl::optional<WakeUp> next_wake_up, bool quit_when_idle_requested) { return false; }
diff --git a/base/task/sequence_manager/real_time_domain.h b/base/task/sequence_manager/real_time_domain.h index 962d51f..ec66507 100644 --- a/base/task/sequence_manager/real_time_domain.h +++ b/base/task/sequence_manager/real_time_domain.h
@@ -26,9 +26,9 @@ // TimeDomain implementation: base::TimeTicks GetNextDelayedTaskTime( - DelayedWakeUp next_wake_up, + WakeUp next_wake_up, sequence_manager::LazyNow* lazy_now) const override; - bool MaybeFastForwardToWakeUp(absl::optional<DelayedWakeUp> next_wake_up, + bool MaybeFastForwardToWakeUp(absl::optional<WakeUp> next_wake_up, bool quit_when_idle_requested) override; protected:
diff --git a/base/task/sequence_manager/sequence_manager.h b/base/task/sequence_manager/sequence_manager.h index c51eb7d6..4581f56a 100644 --- a/base/task/sequence_manager/sequence_manager.h +++ b/base/task/sequence_manager/sequence_manager.h
@@ -180,7 +180,7 @@ // Returns a wake-up for the next delayed task which is not ripe for // execution. If there are no such tasks (immediate tasks don't count), it // returns nullopt. - virtual absl::optional<DelayedWakeUp> GetNextDelayedWakeUp() const = 0; + virtual absl::optional<WakeUp> GetNextWakeUp() const = 0; // Sets the SingleThreadTaskRunner that will be returned by // ThreadTaskRunnerHandle::Get on the main thread.
diff --git a/base/task/sequence_manager/sequence_manager_impl.cc b/base/task/sequence_manager/sequence_manager_impl.cc index 6dd3e27..9c07d57 100644 --- a/base/task/sequence_manager/sequence_manager_impl.cc +++ b/base/task/sequence_manager/sequence_manager_impl.cc
@@ -506,9 +506,8 @@ controller_->ScheduleWork(); } -void SequenceManagerImpl::SetNextDelayedWakeUp( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) { +void SequenceManagerImpl::SetNextWakeUp(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) { TimeTicks next_task_time = TimeTicks::Max(); if (wake_up) { next_task_time = main_thread_only().time_domain->GetNextDelayedTaskTime( @@ -761,11 +760,10 @@ return GetNextDelayedTaskTimeImpl(lazy_now, option); } -absl::optional<DelayedWakeUp> SequenceManagerImpl::GetNextDelayedWakeUp() - const { +absl::optional<WakeUp> SequenceManagerImpl::GetNextWakeUp() const { DCHECK_CALLED_ON_VALID_THREAD(associated_thread_->thread_checker); - return main_thread_only().wake_up_queue->GetNextDelayedWakeUp(); + return main_thread_only().wake_up_queue->GetNextWakeUp(); } TimeTicks SequenceManagerImpl::GetNextDelayedTaskTimeImpl( @@ -776,7 +774,7 @@ if (option == SelectTaskOption::kSkipDelayedTask) return TimeTicks::Max(); - auto wake_up = GetNextDelayedWakeUp(); + auto wake_up = GetNextWakeUp(); if (!wake_up) return TimeTicks::Max(); return main_thread_only().time_domain->GetNextDelayedTaskTime(*wake_up, @@ -790,7 +788,7 @@ } bool SequenceManagerImpl::OnSystemIdle() { - auto wakeup = main_thread_only().wake_up_queue->GetNextDelayedWakeUp(); + auto wakeup = main_thread_only().wake_up_queue->GetNextWakeUp(); bool have_work_to_do = main_thread_only().time_domain->MaybeFastForwardToWakeUp( wakeup, controller_->ShouldQuitRunLoopWhenIdle());
diff --git a/base/task/sequence_manager/sequence_manager_impl.h b/base/task/sequence_manager/sequence_manager_impl.h index f89e1bc..3cd479c 100644 --- a/base/task/sequence_manager/sequence_manager_impl.h +++ b/base/task/sequence_manager/sequence_manager_impl.h
@@ -140,7 +140,7 @@ void PrioritizeYieldingToNative(base::TimeTicks prioritize_until) override; void AddTaskObserver(TaskObserver* task_observer) override; void RemoveTaskObserver(TaskObserver* task_observer) override; - absl::optional<DelayedWakeUp> GetNextDelayedWakeUp() const override; + absl::optional<WakeUp> GetNextWakeUp() const override; // SequencedTaskSource implementation: absl::optional<SelectedTask> SelectNextTask( @@ -179,8 +179,7 @@ // Schedules next wake-up at the given time, canceling any previous requests. // Use absl::nullopt to cancel a wake-up. Must be called on the thread this // class was created on. Must be called from a TimeDomain only. - void SetNextDelayedWakeUp(LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up); + void SetNextWakeUp(LazyNow* lazy_now, absl::optional<WakeUp> wake_up); // Returns the currently executing TaskQueue if any. Must be called on the // thread this class was created on.
diff --git a/base/task/sequence_manager/sequence_manager_impl_unittest.cc b/base/task/sequence_manager/sequence_manager_impl_unittest.cc index 206d08ad..a22c081c 100644 --- a/base/task/sequence_manager/sequence_manager_impl_unittest.cc +++ b/base/task/sequence_manager/sequence_manager_impl_unittest.cc
@@ -344,7 +344,7 @@ // Advance time if we've run out of immediate work to do. if (!sequence_manager()->HasImmediateWork()) { LazyNow lazy_now(mock_tick_clock()); - auto wake_up = sequence_manager()->GetNextDelayedWakeUp(); + auto wake_up = sequence_manager()->GetNextWakeUp(); if (wake_up.has_value()) { AdvanceMockTickClock(wake_up->time - lazy_now.Now()); per_run_time_callback.Run(); @@ -1676,47 +1676,47 @@ EXPECT_TRUE(queue->task_runner()->RunsTasksInCurrentSequence()); } -TEST_P(SequenceManagerTest, GetNextDelayedWakeUp) { +TEST_P(SequenceManagerTest, GetNextWakeUp) { auto queues = CreateTaskQueues(2u); AdvanceMockTickClock(Microseconds(10000)); LazyNow lazy_now_1(mock_tick_clock()); // With no delayed tasks. - EXPECT_FALSE(sequence_manager()->GetNextDelayedWakeUp()); + EXPECT_FALSE(sequence_manager()->GetNextWakeUp()); // With a non-delayed task. queues[0]->task_runner()->PostTask(FROM_HERE, BindOnce(&NopTask)); - EXPECT_FALSE(sequence_manager()->GetNextDelayedWakeUp()); + EXPECT_FALSE(sequence_manager()->GetNextWakeUp()); // With a delayed task. TimeDelta expected_delay = Milliseconds(50); queues[0]->task_runner()->PostDelayedTask(FROM_HERE, BindOnce(&NopTask), expected_delay); EXPECT_EQ(lazy_now_1.Now() + expected_delay, - sequence_manager()->GetNextDelayedWakeUp()->time); + sequence_manager()->GetNextWakeUp()->time); // With another delayed task in the same queue with a longer delay. queues[0]->task_runner()->PostDelayedTask(FROM_HERE, BindOnce(&NopTask), Milliseconds(100)); EXPECT_EQ(lazy_now_1.Now() + expected_delay, - sequence_manager()->GetNextDelayedWakeUp()->time); + sequence_manager()->GetNextWakeUp()->time); // With another delayed task in the same queue with a shorter delay. expected_delay = Milliseconds(20); queues[0]->task_runner()->PostDelayedTask(FROM_HERE, BindOnce(&NopTask), expected_delay); EXPECT_EQ(lazy_now_1.Now() + expected_delay, - sequence_manager()->GetNextDelayedWakeUp()->time); + sequence_manager()->GetNextWakeUp()->time); // With another delayed task in a different queue with a shorter delay. expected_delay = Milliseconds(10); queues[1]->task_runner()->PostDelayedTask(FROM_HERE, BindOnce(&NopTask), expected_delay); EXPECT_EQ(lazy_now_1.Now() + expected_delay, - sequence_manager()->GetNextDelayedWakeUp()->time); + sequence_manager()->GetNextWakeUp()->time); } -TEST_P(SequenceManagerTest, GetNextDelayedWakeUp_MultipleQueues) { +TEST_P(SequenceManagerTest, GetNextWakeUp_MultipleQueues) { auto queues = CreateTaskQueues(3u); TimeDelta delay1 = Milliseconds(50); @@ -1731,8 +1731,7 @@ queues[0]->task_runner()->PostTask(FROM_HERE, BindOnce(&NopTask)); LazyNow lazy_now(mock_tick_clock()); - EXPECT_EQ(lazy_now.Now() + delay2, - sequence_manager()->GetNextDelayedWakeUp()->time); + EXPECT_EQ(lazy_now.Now() + delay2, sequence_manager()->GetNextWakeUp()->time); } TEST(SequenceManagerWithTaskRunnerTest, DeleteSequenceManagerInsideATask) { @@ -2204,9 +2203,9 @@ MOCK_METHOD1(GetNextAllowedWakeUp_DesiredWakeUpTime, void(TimeTicks)); - absl::optional<DelayedWakeUp> GetNextAllowedWakeUp( + absl::optional<WakeUp> GetNextAllowedWakeUp( LazyNow* lazy_now, - absl::optional<DelayedWakeUp> next_desired_wake_up, + absl::optional<WakeUp> next_desired_wake_up, bool has_immediate_work) override { if (next_desired_wake_up) GetNextAllowedWakeUp_DesiredWakeUpTime(next_desired_wake_up->time); @@ -2215,13 +2214,12 @@ return next_desired_wake_up; } - void SetNextAllowedWakeUp( - absl::optional<DelayedWakeUp> next_allowed_wake_up) { + void SetNextAllowedWakeUp(absl::optional<WakeUp> next_allowed_wake_up) { next_allowed_wake_up_ = next_allowed_wake_up; } private: - absl::optional<DelayedWakeUp> next_allowed_wake_up_; + absl::optional<WakeUp> next_allowed_wake_up_; }; } // namespace @@ -2349,7 +2347,7 @@ // GetNextAllowedWakeUp should be called when a delayed task is posted on an // empty queue. throttler.SetNextAllowedWakeUp( - base::sequence_manager::DelayedWakeUp{start_time + delay10s}); + base::sequence_manager::WakeUp{start_time + delay10s}); EXPECT_CALL(throttler, GetNextAllowedWakeUp_DesiredWakeUpTime(start_time + delay1s)); queue->task_runner()->PostDelayedTask(FROM_HERE, BindOnce(&NopTask), delay1s); @@ -2428,7 +2426,7 @@ // This test checks that when delayed work becomes available the notification // still fires. This usually happens when time advances and task becomes // available in the middle of the scheduling code. For this test we force - // notification dispatching by calling UpdateDelayedWakeUp() explicitly. + // notification dispatching by calling UpdateWakeUp() explicitly. auto queue = CreateTaskQueue(); @@ -2447,7 +2445,7 @@ EXPECT_CALL(throttler, GetNextAllowedWakeUp_DesiredWakeUpTime(_)); LazyNow lazy_now(mock_tick_clock()); - queue->UpdateDelayedWakeUp(&lazy_now); + queue->UpdateWakeUp(&lazy_now); Mock::VerifyAndClearExpectations(&throttler); // Tidy up. @@ -4581,11 +4579,11 @@ TimeTicks NowTicks() const override { return now_; } // TimeDomain: - TimeTicks GetNextDelayedTaskTime(DelayedWakeUp delayed_wakeup, + TimeTicks GetNextDelayedTaskTime(WakeUp delayed_wakeup, LazyNow* lazy_now) const override { return TimeTicks(); } - bool MaybeFastForwardToWakeUp(absl::optional<DelayedWakeUp> wakeup, + bool MaybeFastForwardToWakeUp(absl::optional<WakeUp> wakeup, bool quit_when_idle_requested) override { return MaybeFastForwardToWakeUp(quit_when_idle_requested); }
diff --git a/base/task/sequence_manager/sequence_manager_perftest.cc b/base/task/sequence_manager/sequence_manager_perftest.cc index 2fee098..c5e6bfb 100644 --- a/base/task/sequence_manager/sequence_manager_perftest.cc +++ b/base/task/sequence_manager/sequence_manager_perftest.cc
@@ -61,7 +61,7 @@ PerfTestTimeDomain& operator=(const PerfTestTimeDomain&) = delete; ~PerfTestTimeDomain() override = default; - base::TimeTicks GetNextDelayedTaskTime(DelayedWakeUp next_wake_up, + base::TimeTicks GetNextDelayedTaskTime(WakeUp next_wake_up, LazyNow* lazy_now) const override { // Check if we have a task that should be running now. if (next_wake_up.time <= NowTicks()) @@ -72,7 +72,7 @@ return base::TimeTicks::Max(); } - bool MaybeFastForwardToWakeUp(absl::optional<DelayedWakeUp> wake_up, + bool MaybeFastForwardToWakeUp(absl::optional<WakeUp> wake_up, bool quit_when_idle_requested) override { if (wake_up) { SetNowTicks(wake_up->time);
diff --git a/base/task/sequence_manager/task_queue.cc b/base/task/sequence_manager/task_queue.cc index 814d4d5..c698e6be 100644 --- a/base/task/sequence_manager/task_queue.cc +++ b/base/task/sequence_manager/task_queue.cc
@@ -235,18 +235,18 @@ return impl_->HasTaskToRunImmediatelyOrReadyDelayedTask(); } -absl::optional<DelayedWakeUp> TaskQueue::GetNextDesiredWakeUp() { +absl::optional<WakeUp> TaskQueue::GetNextDesiredWakeUp() { DCHECK_CALLED_ON_VALID_THREAD(associated_thread_->thread_checker); if (!impl_) return absl::nullopt; return impl_->GetNextDesiredWakeUp(); } -void TaskQueue::UpdateDelayedWakeUp(LazyNow* lazy_now) { +void TaskQueue::UpdateWakeUp(LazyNow* lazy_now) { DCHECK_CALLED_ON_VALID_THREAD(associated_thread_->thread_checker); if (!impl_) return; - impl_->UpdateDelayedWakeUp(lazy_now); + impl_->UpdateWakeUp(lazy_now); } void TaskQueue::SetQueuePriority(TaskQueue::QueuePriority priority) {
diff --git a/base/task/sequence_manager/task_queue.h b/base/task/sequence_manager/task_queue.h index a89235f..909820f 100644 --- a/base/task/sequence_manager/task_queue.h +++ b/base/task/sequence_manager/task_queue.h
@@ -67,7 +67,7 @@ // the TaskQueue already had a pending immediate task. // The implementation may use this to: // - Restrict task execution by inserting/updating a fence. - // - Update the TaskQueue's next delayed wake up via UpdateDelayedWakeUp(). + // - Update the TaskQueue's next delayed wake up via UpdateWakeUp(). // This allows the Throttler to perform additional operations later from // OnWakeUp(). // This is always called on the thread this TaskQueue is associated with. @@ -82,9 +82,9 @@ // tasks or ripe delayed tasks. The implementation should return the next // allowed wake up, or nullopt if no future wake-up is necessary. // This is always called on the thread this TaskQueue is associated with. - virtual absl::optional<DelayedWakeUp> GetNextAllowedWakeUp( + virtual absl::optional<WakeUp> GetNextAllowedWakeUp( LazyNow* lazy_now, - absl::optional<DelayedWakeUp> next_desired_wake_up, + absl::optional<WakeUp> next_desired_wake_up, bool has_ready_task) = 0; protected: @@ -280,7 +280,7 @@ // such tasks (immediate tasks don't count) or the queue is disabled it // returns nullopt. // NOTE: this must be called on the thread this TaskQueue was created by. - absl::optional<DelayedWakeUp> GetNextDesiredWakeUp(); + absl::optional<WakeUp> GetNextDesiredWakeUp(); // Can be called on any thread. virtual const char* GetName() const; @@ -356,7 +356,7 @@ // Updates the task queue's next wake up time in its time domain, taking into // account the desired run time of queued tasks and policies enforced by the // throttler if any. - void UpdateDelayedWakeUp(LazyNow* lazy_now); + void UpdateWakeUp(LazyNow* lazy_now); // Controls whether or not the queue will emit traces events when tasks are // posted to it while disabled. This only applies for the current or next
diff --git a/base/task/sequence_manager/task_queue_impl.cc b/base/task/sequence_manager/task_queue_impl.cc index 0399ba5..8568db2 100644 --- a/base/task/sequence_manager/task_queue_impl.cc +++ b/base/task/sequence_manager/task_queue_impl.cc
@@ -395,7 +395,7 @@ main_thread_only().delayed_incoming_queue.push(std::move(pending_task)); LazyNow lazy_now(now); - UpdateDelayedWakeUp(&lazy_now); + UpdateWakeUp(&lazy_now); TraceQueueSize(); } @@ -526,7 +526,7 @@ return !any_thread_.immediate_incoming_queue.empty(); } -absl::optional<DelayedWakeUp> TaskQueueImpl::GetNextDesiredWakeUp() { +absl::optional<WakeUp> TaskQueueImpl::GetNextDesiredWakeUp() { // Note we don't scheduled a wake-up for disabled queues. if (main_thread_only().delayed_incoming_queue.empty() || !IsQueueEnabled()) return absl::nullopt; @@ -541,7 +541,7 @@ : WakeUpResolution::kLow; const auto& top_task = main_thread_only().delayed_incoming_queue.top(); - return DelayedWakeUp{top_task.delayed_run_time, resolution}; + return WakeUp{top_task.delayed_run_time, resolution}; } void TaskQueueImpl::OnWakeUp(LazyNow* lazy_now) { @@ -568,7 +568,7 @@ } if (!tasks_to_delete->empty()) { - UpdateDelayedWakeUp(lazy_now); + UpdateWakeUp(lazy_now); return true; } @@ -618,7 +618,7 @@ // Explicitly delete tasks last. tasks_to_delete->clear(); - UpdateDelayedWakeUp(lazy_now); + UpdateWakeUp(lazy_now); } void TaskQueueImpl::TraceQueueSize() const { @@ -655,7 +655,7 @@ #if defined(OS_WIN) // Updating queue priority can change whether high resolution timer is needed. LazyNow lazy_now(sequence_manager_->main_thread_clock()); - UpdateDelayedWakeUp(&lazy_now); + UpdateWakeUp(&lazy_now); #endif static_assert(TaskQueue::QueuePriority::kLowPriority > @@ -959,8 +959,8 @@ } // If there is a throttler, it will be notified of pending delayed and - // immediate tasks inside UpdateDelayedWakeUp(). - UpdateDelayedWakeUp(&lazy_now); + // immediate tasks inside UpdateWakeUp(). + UpdateWakeUp(&lazy_now); { base::internal::CheckedAutoLock lock(any_thread_lock_); @@ -1054,7 +1054,7 @@ } LazyNow lazy_now(now); - UpdateDelayedWakeUp(&lazy_now); + UpdateWakeUp(&lazy_now); } void TaskQueueImpl::PushImmediateIncomingTaskForTest(Task task) { @@ -1107,23 +1107,22 @@ LazyNow lazy_now(sequence_manager_->main_thread_clock()); // The current delayed wake up may have been determined by the Throttler. // Update it now that there is no Throttler. - UpdateDelayedWakeUp(&lazy_now); + UpdateWakeUp(&lazy_now); } -void TaskQueueImpl::UpdateDelayedWakeUp(LazyNow* lazy_now) { - absl::optional<DelayedWakeUp> wake_up = GetNextDesiredWakeUp(); +void TaskQueueImpl::UpdateWakeUp(LazyNow* lazy_now) { + absl::optional<WakeUp> wake_up = GetNextDesiredWakeUp(); if (main_thread_only().throttler && IsQueueEnabled()) { // GetNextAllowedWakeUp() may return a non-null wake_up even if |wake_up| is // nullopt, e.g. to throttle immediate tasks. wake_up = main_thread_only().throttler->GetNextAllowedWakeUp( lazy_now, wake_up, HasTaskToRunImmediatelyOrReadyDelayedTask()); } - SetNextDelayedWakeUp(lazy_now, wake_up); + SetNextWakeUp(lazy_now, wake_up); } -void TaskQueueImpl::SetNextDelayedWakeUp( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) { +void TaskQueueImpl::SetNextWakeUp(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) { if (main_thread_only().scheduled_wake_up == wake_up) return; main_thread_only().scheduled_wake_up = wake_up;
diff --git a/base/task/sequence_manager/task_queue_impl.h b/base/task/sequence_manager/task_queue_impl.h index 6b9d9e4..c3f03b7 100644 --- a/base/task/sequence_manager/task_queue_impl.h +++ b/base/task/sequence_manager/task_queue_impl.h
@@ -121,7 +121,7 @@ bool IsEmpty() const; size_t GetNumberOfPendingTasks() const; bool HasTaskToRunImmediatelyOrReadyDelayedTask() const; - absl::optional<DelayedWakeUp> GetNextDesiredWakeUp(); + absl::optional<WakeUp> GetNextDesiredWakeUp(); void SetQueuePriority(TaskQueue::QueuePriority priority); TaskQueue::QueuePriority GetQueuePriority() const; void AddTaskObserver(TaskObserver* task_observer); @@ -265,12 +265,11 @@ // Updates this queue's next wake up time in the time domain, // taking into account the desired run time of queued tasks and // policies enforced by the Throttler. - void UpdateDelayedWakeUp(LazyNow* lazy_now); + void UpdateWakeUp(LazyNow* lazy_now); protected: // Sets this queue's next wake up time to |wake_up| in the time domain. - void SetNextDelayedWakeUp(LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up); + void SetNextWakeUp(LazyNow* lazy_now, absl::optional<WakeUp> wake_up); private: friend class WorkQueue; @@ -420,7 +419,7 @@ TaskExecutionTraceLogger task_execution_trace_logger; // Last reported wake up, used only in UpdateWakeUp to avoid // excessive calls. - absl::optional<DelayedWakeUp> scheduled_wake_up; + absl::optional<WakeUp> scheduled_wake_up; // If false, queue will be disabled. Used only for tests. bool is_enabled_for_test = true; // The time at which the task queue was disabled, if it is currently
diff --git a/base/task/sequence_manager/tasks.h b/base/task/sequence_manager/tasks.h index 6430393..b5b102b7 100644 --- a/base/task/sequence_manager/tasks.h +++ b/base/task/sequence_manager/tasks.h
@@ -48,20 +48,18 @@ enum class WakeUpResolution { kLow, kHigh }; // Represents a time at which a task wants to run. -struct DelayedWakeUp { +struct WakeUp { TimeTicks time; WakeUpResolution resolution; - bool operator!=(const DelayedWakeUp& other) const { + bool operator!=(const WakeUp& other) const { return time != other.time || resolution != other.resolution; } - bool operator==(const DelayedWakeUp& other) const { - return !(*this != other); - } + bool operator==(const WakeUp& other) const { return !(*this != other); } // Used for a min-heap. - bool operator>(const DelayedWakeUp& other) const { + bool operator>(const WakeUp& other) const { return std::tie(time, resolution) > std::tie(other.time, other.resolution); } };
diff --git a/base/task/sequence_manager/test/mock_time_domain.cc b/base/task/sequence_manager/test/mock_time_domain.cc index 02bc6f17..7d38806b 100644 --- a/base/task/sequence_manager/test/mock_time_domain.cc +++ b/base/task/sequence_manager/test/mock_time_domain.cc
@@ -23,13 +23,13 @@ } TimeTicks MockTimeDomain::GetNextDelayedTaskTime( - DelayedWakeUp next_wake_up, + WakeUp next_wake_up, sequence_manager::LazyNow* lazy_now) const { return TimeTicks::Max(); } bool MockTimeDomain::MaybeFastForwardToWakeUp( - absl::optional<DelayedWakeUp> next_wake_up, + absl::optional<WakeUp> next_wake_up, bool quit_when_idle_requested) { return false; }
diff --git a/base/task/sequence_manager/test/mock_time_domain.h b/base/task/sequence_manager/test/mock_time_domain.h index c362f41..9d3ec32 100644 --- a/base/task/sequence_manager/test/mock_time_domain.h +++ b/base/task/sequence_manager/test/mock_time_domain.h
@@ -28,9 +28,9 @@ // TimeDomain implementation: TimeTicks GetNextDelayedTaskTime( - DelayedWakeUp next_wake_up, + WakeUp next_wake_up, sequence_manager::LazyNow* lazy_now) const override; - bool MaybeFastForwardToWakeUp(absl::optional<DelayedWakeUp> next_wake_up, + bool MaybeFastForwardToWakeUp(absl::optional<WakeUp> next_wake_up, bool quit_when_idle_requested) override; const char* GetName() const override;
diff --git a/base/task/sequence_manager/time_domain.h b/base/task/sequence_manager/time_domain.h index a860efb2..d9fde65 100644 --- a/base/task/sequence_manager/time_domain.h +++ b/base/task/sequence_manager/time_domain.h
@@ -34,16 +34,15 @@ // typically aligned with `next_wake_up.time` but virtual time domains may // elect otherwise. Can be called from main thread only. // TODO(857101): Pass `lazy_now` by reference. - virtual TimeTicks GetNextDelayedTaskTime(DelayedWakeUp next_wake_up, + virtual TimeTicks GetNextDelayedTaskTime(WakeUp next_wake_up, LazyNow* lazy_now) const = 0; // Invoked when the thread reaches idle. Gives an opportunity to a virtual // time domain impl to fast-forward time and return true to indicate that // there's more work to run. If RunLoop::QuitWhenIdle has been called then // `quit_when_idle_requested` will be true. - virtual bool MaybeFastForwardToWakeUp( - absl::optional<DelayedWakeUp> next_wake_up, - bool quit_when_idle_requested) = 0; + virtual bool MaybeFastForwardToWakeUp(absl::optional<WakeUp> next_wake_up, + bool quit_when_idle_requested) = 0; // Debug info. Value AsValue() const;
diff --git a/base/task/sequence_manager/wake_up_queue.cc b/base/task/sequence_manager/wake_up_queue.cc index af2c7706..6b680dc8 100644 --- a/base/task/sequence_manager/wake_up_queue.cc +++ b/base/task/sequence_manager/wake_up_queue.cc
@@ -42,7 +42,7 @@ void WakeUpQueue::SetNextWakeUpForQueue(internal::TaskQueueImpl* queue, LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) { + absl::optional<WakeUp> wake_up) { DCHECK_CALLED_ON_VALID_THREAD(associated_thread_->thread_checker); DCHECK_EQ(queue->wake_up_queue(), this); DCHECK(queue->IsQueueEnabled() || !wake_up); @@ -84,7 +84,7 @@ DCHECK_GE(pending_high_res_wake_up_count_, 0); if (new_wake_up != previous_wake_up) - OnNextDelayedWakeUpChanged(lazy_now, GetNextDelayedWakeUp()); + OnNextWakeUpChanged(lazy_now, GetNextWakeUp()); } void WakeUpQueue::MoveReadyDelayedTasksToWorkQueues(LazyNow* lazy_now) { @@ -109,17 +109,17 @@ // becomes the next one to wake up, since that wake up can't be moved up. // `wake_up_queue_` is non-empty here, per the condition above. internal::TaskQueueImpl* queue = wake_up_queue_.top().queue; - queue->UpdateDelayedWakeUp(lazy_now); + queue->UpdateWakeUp(lazy_now); while (!wake_up_queue_.empty()) { internal::TaskQueueImpl* old_queue = std::exchange(queue, wake_up_queue_.top().queue); if (old_queue == queue) break; - queue->UpdateDelayedWakeUp(lazy_now); + queue->UpdateWakeUp(lazy_now); } } -absl::optional<DelayedWakeUp> WakeUpQueue::GetNextDelayedWakeUp() const { +absl::optional<WakeUp> WakeUpQueue::GetNextWakeUp() const { DCHECK_CALLED_ON_VALID_THREAD(associated_thread_->thread_checker); if (wake_up_queue_.empty()) return absl::nullopt; @@ -145,10 +145,9 @@ DefaultWakeUpQueue::~DefaultWakeUpQueue() = default; -void DefaultWakeUpQueue::OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) { - sequence_manager_->SetNextDelayedWakeUp(lazy_now, wake_up); +void DefaultWakeUpQueue::OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) { + sequence_manager_->SetNextWakeUp(lazy_now, wake_up); } void DefaultWakeUpQueue::UnregisterQueue(internal::TaskQueueImpl* queue) { @@ -167,9 +166,9 @@ NonWakingWakeUpQueue::~NonWakingWakeUpQueue() = default; -void NonWakingWakeUpQueue::OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) {} +void NonWakingWakeUpQueue::OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) { +} const char* NonWakingWakeUpQueue::GetName() const { return "NonWakingWakeUpQueue";
diff --git a/base/task/sequence_manager/wake_up_queue.h b/base/task/sequence_manager/wake_up_queue.h index 8166eecd..d1288bd4 100644 --- a/base/task/sequence_manager/wake_up_queue.h +++ b/base/task/sequence_manager/wake_up_queue.h
@@ -34,7 +34,7 @@ // Returns a wake-up for the next pending delayed task (pending delayed tasks // that are ripe may be ignored). If there are no such tasks (immediate tasks // don't count) or queues are disabled it returns nullopt. - absl::optional<DelayedWakeUp> GetNextDelayedWakeUp() const; + absl::optional<WakeUp> GetNextWakeUp() const; // Debug info. Value AsValue(TimeTicks now) const; @@ -55,13 +55,13 @@ // previously set wake up for `queue`. void SetNextWakeUpForQueue(internal::TaskQueueImpl* queue, LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up); + absl::optional<WakeUp> wake_up); // Remove the TaskQueue from any internal data structures. virtual void UnregisterQueue(internal::TaskQueueImpl* queue) = 0; // Removes all canceled delayed tasks from the front of the queue. After - // calling this, GetNextDelayedWakeUp() is guaranteed to return a wake up time + // calling this, GetNextWakeUp() is guaranteed to return a wake up time // for a non-canceled task. void RemoveAllCanceledDelayedTasksFromFront(LazyNow* lazy_now); @@ -72,20 +72,19 @@ // Called every time the next `next_wake_up` changes. absl::nullopt is used to // cancel the next wake-up. Subclasses may use this to tell SequenceManager to // schedule the next wake-up at the given time. - virtual void OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> next_wake_up) = 0; + virtual void OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> next_wake_up) = 0; virtual const char* GetName() const = 0; private: friend class MockWakeUpQueue; - struct ScheduledDelayedWakeUp { - DelayedWakeUp wake_up; + struct ScheduledWakeUp { + WakeUp wake_up; internal::TaskQueueImpl* queue; - bool operator>(const ScheduledDelayedWakeUp& other) const { + bool operator>(const ScheduledWakeUp& other) const { return wake_up > other.wake_up; } @@ -102,7 +101,7 @@ HeapHandle GetHeapHandle() const { return queue->heap_handle(); } }; - IntrusiveHeap<ScheduledDelayedWakeUp, std::greater<>> wake_up_queue_; + IntrusiveHeap<ScheduledWakeUp, std::greater<>> wake_up_queue_; int pending_high_res_wake_up_count_ = 0; scoped_refptr<internal::AssociatedThreadId> associated_thread_; @@ -119,9 +118,8 @@ private: // WakeUpQueue implementation: - void OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) override; + void OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) override; const char* GetName() const override; void UnregisterQueue(internal::TaskQueueImpl* queue) override; @@ -138,9 +136,8 @@ private: // WakeUpQueue implementation: - void OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) override; + void OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) override; const char* GetName() const override; void UnregisterQueue(internal::TaskQueueImpl* queue) override; };
diff --git a/base/task/sequence_manager/wake_up_queue_unittest.cc b/base/task/sequence_manager/wake_up_queue_unittest.cc index 685e3647..b627576 100644 --- a/base/task/sequence_manager/wake_up_queue_unittest.cc +++ b/base/task/sequence_manager/wake_up_queue_unittest.cc
@@ -32,7 +32,7 @@ : TaskQueueImpl(sequence_manager, wake_up_queue, spec) {} ~TaskQueueImplForTest() = default; - using TaskQueueImpl::SetNextDelayedWakeUp; + using TaskQueueImpl::SetNextWakeUp; }; class MockWakeUpQueue : public WakeUpQueue { @@ -48,11 +48,10 @@ using WakeUpQueue::SetNextWakeUpForQueue; using WakeUpQueue::UnregisterQueue; - void OnNextDelayedWakeUpChanged( - LazyNow* lazy_now, - absl::optional<DelayedWakeUp> wake_up) override { + void OnNextWakeUpChanged(LazyNow* lazy_now, + absl::optional<WakeUp> wake_up) override { TimeTicks time = wake_up ? wake_up->time : TimeTicks::Max(); - OnNextDelayedWakeUpChanged_TimeTicks(time); + OnNextWakeUpChanged_TimeTicks(time); } const char* GetName() const override { return "Test"; } void UnregisterQueue(internal::TaskQueueImpl* queue) override { @@ -71,7 +70,7 @@ return wake_up_queue_.top().wake_up.time; } - MOCK_METHOD1(OnNextDelayedWakeUpChanged_TimeTicks, void(TimeTicks run_time)); + MOCK_METHOD1(OnNextWakeUpChanged_TimeTicks, void(TimeTicks run_time)); }; class WakeUpQueueTest : public testing::Test { @@ -98,9 +97,9 @@ TimeTicks delayed_runtime = now + delay; EXPECT_TRUE(wake_up_queue_->empty()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(delayed_runtime)); + OnNextWakeUpChanged_TimeTicks(delayed_runtime)); LazyNow lazy_now(now); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{delayed_runtime}); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{delayed_runtime}); EXPECT_FALSE(wake_up_queue_->empty()); EXPECT_EQ(delayed_runtime, wake_up_queue_->NextScheduledRunTime()); @@ -109,7 +108,7 @@ Mock::VerifyAndClearExpectations(wake_up_queue_.get()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(TimeTicks::Max())) + OnNextWakeUpChanged_TimeTicks(TimeTicks::Max())) .Times(AnyNumber()); } @@ -120,9 +119,9 @@ TimeTicks delayed_runtime1 = now + delay1; TimeTicks delayed_runtime2 = now + delay2; EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(delayed_runtime1)); + OnNextWakeUpChanged_TimeTicks(delayed_runtime1)); LazyNow lazy_now(now); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{delayed_runtime1}); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{delayed_runtime1}); EXPECT_EQ(delayed_runtime1, wake_up_queue_->NextScheduledRunTime()); @@ -131,14 +130,14 @@ // Now schedule a later wake_up, which should replace the previously // requested one. EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(delayed_runtime2)); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{delayed_runtime2}); + OnNextWakeUpChanged_TimeTicks(delayed_runtime2)); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{delayed_runtime2}); EXPECT_EQ(delayed_runtime2, wake_up_queue_->NextScheduledRunTime()); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(TimeTicks::Max())) + OnNextWakeUpChanged_TimeTicks(TimeTicks::Max())) .Times(AnyNumber()); } @@ -165,27 +164,25 @@ TimeTicks now = tick_clock_.NowTicks(); LazyNow lazy_now(now); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(now + delay1)); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{now + delay1}); + OnNextWakeUpChanged_TimeTicks(now + delay1)); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{now + delay1}); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); // SetNextDelayedDoWork should not be called when scheduling later tasks. - EXPECT_CALL(*wake_up_queue_.get(), OnNextDelayedWakeUpChanged_TimeTicks(_)) - .Times(0); - task_queue2->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{now + delay2}); - task_queue3->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{now + delay3}); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(_)).Times(0); + task_queue2->SetNextWakeUp(&lazy_now, WakeUp{now + delay2}); + task_queue3->SetNextWakeUp(&lazy_now, WakeUp{now + delay3}); // SetNextDelayedDoWork should be called when scheduling earlier tasks. Mock::VerifyAndClearExpectations(wake_up_queue_.get()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(now + delay4)); - task_queue4->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{now + delay4}); + OnNextWakeUpChanged_TimeTicks(now + delay4)); + task_queue4->SetNextWakeUp(&lazy_now, WakeUp{now + delay4}); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); - EXPECT_CALL(*wake_up_queue_.get(), OnNextDelayedWakeUpChanged_TimeTicks(_)) - .Times(2); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(_)).Times(2); task_queue2->UnregisterTaskQueue(); task_queue3->UnregisterTaskQueue(); task_queue4->UnregisterTaskQueue(); @@ -200,20 +197,18 @@ TimeTicks now = tick_clock_.NowTicks(); LazyNow lazy_now(now); TimeTicks wake_up1 = now + Milliseconds(10); - EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(wake_up1)) + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(wake_up1)) .Times(1); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{wake_up1}); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{wake_up1}); TimeTicks wake_up2 = now + Milliseconds(100); - task_queue2->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{wake_up2}); + task_queue2->SetNextWakeUp(&lazy_now, WakeUp{wake_up2}); EXPECT_FALSE(wake_up_queue_->empty()); EXPECT_EQ(task_queue_.get(), wake_up_queue_->NextScheduledTaskQueue()); testing::Mock::VerifyAndClearExpectations(wake_up_queue_.get()); - EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(wake_up2)) + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(wake_up2)) .Times(1); wake_up_queue_->UnregisterQueue(task_queue_.get()); @@ -226,7 +221,7 @@ testing::Mock::VerifyAndClearExpectations(wake_up_queue_.get()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(TimeTicks::Max())) + OnNextWakeUpChanged_TimeTicks(TimeTicks::Max())) .Times(1); wake_up_queue_->UnregisterQueue(task_queue2.get()); @@ -243,9 +238,8 @@ LazyNow lazy_now_1(now); TimeTicks delayed_runtime = now + delay; EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(delayed_runtime)); - task_queue_->SetNextDelayedWakeUp(&lazy_now_1, - DelayedWakeUp{delayed_runtime}); + OnNextWakeUpChanged_TimeTicks(delayed_runtime)); + task_queue_->SetNextWakeUp(&lazy_now_1, WakeUp{delayed_runtime}); EXPECT_EQ(delayed_runtime, wake_up_queue_->NextScheduledRunTime()); @@ -253,7 +247,7 @@ EXPECT_EQ(delayed_runtime, wake_up_queue_->NextScheduledRunTime()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(TimeTicks::Max())); + OnNextWakeUpChanged_TimeTicks(TimeTicks::Max())); tick_clock_.SetNowTicks(delayed_runtime); LazyNow lazy_now_2(&tick_clock_); wake_up_queue_->MoveReadyDelayedTasksToWorkQueues(&lazy_now_2); @@ -265,15 +259,14 @@ LazyNow lazy_now(now); TimeTicks run_time = now + Milliseconds(20); - EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(run_time)); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{run_time}); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(run_time)); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{run_time}); EXPECT_EQ(task_queue_.get(), wake_up_queue_->NextScheduledTaskQueue()); EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(TimeTicks::Max())); - task_queue_->SetNextDelayedWakeUp(&lazy_now, absl::nullopt); + OnNextWakeUpChanged_TimeTicks(TimeTicks::Max())); + task_queue_->SetNextWakeUp(&lazy_now, absl::nullopt); EXPECT_FALSE(wake_up_queue_->NextScheduledTaskQueue()); } @@ -286,29 +279,26 @@ LazyNow lazy_now(now); TimeTicks run_time1 = now + Milliseconds(20); TimeTicks run_time2 = now + Milliseconds(40); - EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(run_time1)); - task_queue_->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{run_time1}); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(run_time1)); + task_queue_->SetNextWakeUp(&lazy_now, WakeUp{run_time1}); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); - EXPECT_CALL(*wake_up_queue_.get(), OnNextDelayedWakeUpChanged_TimeTicks(_)) - .Times(0); - task_queue2->SetNextDelayedWakeUp(&lazy_now, DelayedWakeUp{run_time2}); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(_)).Times(0); + task_queue2->SetNextWakeUp(&lazy_now, WakeUp{run_time2}); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); EXPECT_EQ(task_queue_.get(), wake_up_queue_->NextScheduledTaskQueue()); EXPECT_EQ(run_time1, wake_up_queue_->NextScheduledRunTime()); - EXPECT_CALL(*wake_up_queue_.get(), - OnNextDelayedWakeUpChanged_TimeTicks(run_time2)); - task_queue_->SetNextDelayedWakeUp(&lazy_now, absl::nullopt); + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(run_time2)); + task_queue_->SetNextWakeUp(&lazy_now, absl::nullopt); EXPECT_EQ(task_queue2.get(), wake_up_queue_->NextScheduledTaskQueue()); EXPECT_EQ(run_time2, wake_up_queue_->NextScheduledRunTime()); Mock::VerifyAndClearExpectations(wake_up_queue_.get()); - EXPECT_CALL(*wake_up_queue_.get(), OnNextDelayedWakeUpChanged_TimeTicks(_)) + EXPECT_CALL(*wake_up_queue_.get(), OnNextWakeUpChanged_TimeTicks(_)) .Times(AnyNumber()); // Tidy up. @@ -328,10 +318,10 @@ // Add two high resolution wake-ups. EXPECT_FALSE(wake_up_queue_->has_pending_high_resolution_tasks()); wake_up_queue_->SetNextWakeUpForQueue( - &q1, &lazy_now, DelayedWakeUp{run_time1, WakeUpResolution::kHigh}); + &q1, &lazy_now, WakeUp{run_time1, WakeUpResolution::kHigh}); EXPECT_TRUE(wake_up_queue_->has_pending_high_resolution_tasks()); wake_up_queue_->SetNextWakeUpForQueue( - &q2, &lazy_now, DelayedWakeUp{run_time2, WakeUpResolution::kHigh}); + &q2, &lazy_now, WakeUp{run_time2, WakeUpResolution::kHigh}); EXPECT_TRUE(wake_up_queue_->has_pending_high_resolution_tasks()); // Remove one of the wake-ups. @@ -344,15 +334,15 @@ // Change a low resolution wake-up to a high resolution one. wake_up_queue_->SetNextWakeUpForQueue( - &q1, &lazy_now, DelayedWakeUp{run_time1, WakeUpResolution::kLow}); + &q1, &lazy_now, WakeUp{run_time1, WakeUpResolution::kLow}); EXPECT_FALSE(wake_up_queue_->has_pending_high_resolution_tasks()); wake_up_queue_->SetNextWakeUpForQueue( - &q1, &lazy_now, DelayedWakeUp{run_time1, WakeUpResolution::kHigh}); + &q1, &lazy_now, WakeUp{run_time1, WakeUpResolution::kHigh}); EXPECT_TRUE(wake_up_queue_->has_pending_high_resolution_tasks()); // Move a high resolution wake-up in time. wake_up_queue_->SetNextWakeUpForQueue( - &q1, &lazy_now, DelayedWakeUp{run_time2, WakeUpResolution::kHigh}); + &q1, &lazy_now, WakeUp{run_time2, WakeUpResolution::kHigh}); EXPECT_TRUE(wake_up_queue_->has_pending_high_resolution_tasks()); // Cancel the wake-up twice.
diff --git a/base/test/task_environment.cc b/base/test/task_environment.cc index cdc9076a..caa2574c 100644 --- a/base/test/task_environment.cc +++ b/base/test/task_environment.cc
@@ -207,7 +207,7 @@ // sequence_manager::TimeDomain: base::TimeTicks GetNextDelayedTaskTime( - sequence_manager::DelayedWakeUp next_wake_up, + sequence_manager::WakeUp next_wake_up, sequence_manager::LazyNow* lazy_now) const override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -228,7 +228,7 @@ // non-delayed work. Advances time to the next task unless // |quit_when_idle_requested| or TaskEnvironment controls mock time. bool MaybeFastForwardToWakeUp( - absl::optional<sequence_manager::DelayedWakeUp> next_wake_up, + absl::optional<sequence_manager::WakeUp> next_wake_up, bool quit_when_idle_requested) override { if (quit_when_idle_requested) return false; @@ -263,7 +263,7 @@ // tasks, expected to be called after being just idle, racily scheduling // immediate tasks doesn't affect the outcome of this call. NextTaskSource FastForwardToNextTaskOrCap( - absl::optional<sequence_manager::DelayedWakeUp> next_main_thread_wake_up, + absl::optional<sequence_manager::WakeUp> next_main_thread_wake_up, TimeTicks fast_forward_cap) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -674,7 +674,7 @@ // FastForwardToNextTaskOrCap isn't affected by canceled tasks. sequence_manager_->ReclaimMemory(); } while (mock_time_domain_->FastForwardToNextTaskOrCap( - sequence_manager_->GetNextDelayedWakeUp(), fast_forward_until) != + sequence_manager_->GetNextWakeUp(), fast_forward_until) != MockTimeDomain::NextTaskSource::kNone); if (task_tracker_ && !could_run_tasks) @@ -726,8 +726,8 @@ sequence_manager::LazyNow lazy_now(mock_time_domain_->NowTicks()); if (!sequence_manager_->IsIdleForTesting()) return TimeDelta(); - absl::optional<sequence_manager::DelayedWakeUp> wake_up = - sequence_manager_->GetNextDelayedWakeUp(); + absl::optional<sequence_manager::WakeUp> wake_up = + sequence_manager_->GetNextWakeUp(); return wake_up ? wake_up->time - lazy_now.Now() : TimeDelta::Max(); }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index c3cc56d..501075b 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20211202.2.1 +7.20211202.3.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index c3cc56d..501075b 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20211202.2.1 +7.20211202.3.1
diff --git a/build/rust/tests/test_cpp_including_rust/unittests.cc b/build/rust/tests/test_cpp_including_rust/unittests.cc index b8b8110..b4ff5bd5 100644 --- a/build/rust/tests/test_cpp_including_rust/unittests.cc +++ b/build/rust/tests/test_cpp_including_rust/unittests.cc
@@ -24,8 +24,10 @@ // Verify that PartitionAlloc is consistently used in C++ and Rust. auto cpp_allocated_int = std::make_unique<int>(); SomeStruct* rust_allocated_ptr = allocate_via_rust().into_raw(); - EXPECT_EQ(base::IsManagedByPartitionAlloc(rust_allocated_ptr), - base::IsManagedByPartitionAlloc(cpp_allocated_int.get())); + EXPECT_EQ(base::IsManagedByPartitionAlloc( + reinterpret_cast<uintptr_t>(rust_allocated_ptr)), + base::IsManagedByPartitionAlloc( + reinterpret_cast<uintptr_t>(cpp_allocated_int.get()))); rust::Box<SomeStruct>::from_raw(rust_allocated_ptr); }
diff --git a/cc/metrics/compositor_frame_reporter.cc b/cc/metrics/compositor_frame_reporter.cc index eaa81a9b..f564f27 100644 --- a/cc/metrics/compositor_frame_reporter.cc +++ b/cc/metrics/compositor_frame_reporter.cc
@@ -1051,29 +1051,34 @@ kTraceCategory, "PipelineReporter", trace_track, args_.frame_time, [&](perfetto::EventContext context) { using perfetto::protos::pbzero::ChromeFrameReporter; - bool frame_dropped = TestReportType(FrameReportType::kDroppedFrame); ChromeFrameReporter::State state; - if (frame_dropped) { - state = ChromeFrameReporter::STATE_DROPPED; - } else if (frame_termination_status_ == - FrameTerminationStatus::kDidNotProduceFrame) { - state = ChromeFrameReporter::STATE_NO_UPDATE_DESIRED; - } else { - state = has_partial_update_ - ? ChromeFrameReporter::STATE_PRESENTED_PARTIAL - : ChromeFrameReporter::STATE_PRESENTED_ALL; + switch (info.final_state) { + case FrameInfo::FrameFinalState::kPresentedAll: + state = ChromeFrameReporter::STATE_PRESENTED_ALL; + break; + case FrameInfo::FrameFinalState::kPresentedPartialNewMain: + case FrameInfo::FrameFinalState::kPresentedPartialOldMain: + state = ChromeFrameReporter::STATE_PRESENTED_PARTIAL; + break; + case FrameInfo::FrameFinalState::kNoUpdateDesired: + state = ChromeFrameReporter::STATE_NO_UPDATE_DESIRED; + break; + case FrameInfo::FrameFinalState::kDropped: + state = ChromeFrameReporter::STATE_DROPPED; + break; } + auto* reporter = context.event()->set_chrome_frame_reporter(); reporter->set_state(state); reporter->set_frame_source(args_.frame_id.source_id); reporter->set_frame_sequence(args_.frame_id.sequence_number); reporter->set_layer_tree_host_id(layer_tree_host_id_); - reporter->set_has_missing_content(has_missing_content_); + reporter->set_has_missing_content(info.has_missing_content); if (info.IsDroppedAffectingSmoothness()) { DCHECK(state == ChromeFrameReporter::STATE_DROPPED || state == ChromeFrameReporter::STATE_PRESENTED_PARTIAL); - reporter->set_affects_smoothness(true); } + reporter->set_affects_smoothness(info.IsDroppedAffectingSmoothness()); ChromeFrameReporter::ScrollState scroll_state; switch (scrolling_thread_) { case FrameSequenceMetrics::ThreadType::kMain:
diff --git a/chrome/VERSION b/chrome/VERSION index 7305287..4b1a7a3 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=98 MINOR=0 -BUILD=4744 +BUILD=4745 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java index 2405f9d..1dc0c82 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -138,10 +138,10 @@ */ private void createPageSequence() { FREMobileIdentityConsistencyFieldTrial.createFirstRunTrial(); + BooleanSupplier showWelcomePage = () -> !FirstRunStatus.shouldSkipWelcomePage(); if (FREMobileIdentityConsistencyFieldTrial.isEnabled()) { - mPages.add(new FirstRunPage<>(SigninFirstRunFragment.class, () -> true)); + mPages.add(new FirstRunPage<>(SigninFirstRunFragment.class, showWelcomePage)); } else { - BooleanSupplier showWelcomePage = () -> !FirstRunStatus.shouldSkipWelcomePage(); // TODO(crbug.com/1111490): Revisit during post-MVP. // There's an edge case where we accept the welcome page in the main app, abort the FRE, // then go through this CCT FRE again. @@ -559,6 +559,11 @@ } @Override + public boolean isLaunchedFromCct() { + return mLaunchedFromCCT; + } + + @Override public void acceptTermsOfService(boolean allowCrashUpload) { // If default is true then it corresponds to opt-out and false corresponds to opt-in. UmaUtils.recordMetricsReportingDefaultOptIn(!DEFAULT_METRICS_AND_CRASH_REPORTING);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunPageDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunPageDelegate.java index 1450e11..26ef2d2e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunPageDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunPageDelegate.java
@@ -64,6 +64,11 @@ boolean didAcceptTermsOfService(); /** + * Returns whether chrome is launched as a custom tab. + */ + boolean isLaunchedFromCct(); + + /** * Notifies all interested parties that the user has accepted Chrome Terms of Service. * Must be called only after native has been initialized. * @param allowCrashUpload True if the user allows to upload crash dumps and collect stats.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java index 2cab87e..4bf508d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java
@@ -48,13 +48,6 @@ private static long sForegroundStartTimeMs; private static long sBackgroundTimeMs; - private static boolean sSkipRecordingNextForegroundStartTimeForTesting; - - // Will short-circuit out of the next recordForegroundStartTime() call. - public static void skipRecordingNextForegroundStartTimeForTesting() { - sSkipRecordingNextForegroundStartTimeForTesting = true; - } - /** * Record the time in the application lifecycle at which Chrome code first runs * (Application.attachBaseContext()). @@ -71,11 +64,6 @@ * Record the time at which Chrome was brought to foreground. */ public static void recordForegroundStartTime() { - if (sSkipRecordingNextForegroundStartTimeForTesting) { - sSkipRecordingNextForegroundStartTimeForTesting = false; - return; - } - // Since this can be called from multiple places (e.g. ChromeActivitySessionTracker // and FirstRunActivity), only set the time if it hasn't been set previously or if // Chrome has been sent to background since the last foreground time.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProvider.java index 67bed9e..efc86742 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProvider.java
@@ -10,10 +10,11 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; import android.util.DisplayMetrics; +import android.util.Pair; +import android.widget.RemoteViews; import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; @@ -47,31 +48,28 @@ */ public static class QuickActionSearchWidgetProviderSearch extends QuickActionSearchWidgetProvider { - protected static - @Nullable QuickActionSearchWidgetProviderDelegate sExtraSmallWidgetDelegate; - protected static @Nullable QuickActionSearchWidgetProviderDelegate sSmallWidgetDelegate; - protected static @Nullable QuickActionSearchWidgetProviderDelegate sMediumWidgetDelegate; - - @Override - public void onAppWidgetOptionsChanged( - Context context, AppWidgetManager manager, int widgetId, Bundle newOptions) { - onUpdate(context, manager, new int[] {widgetId}); - super.onAppWidgetOptionsChanged(context, manager, widgetId, newOptions); - } - @Override @NonNull - QuickActionSearchWidgetProviderDelegate getDelegate( + Pair<Integer, Integer> getOrientationSpecificLayoutRes( Context context, AppWidgetManager manager, int widgetId) { Bundle options = manager.getAppWidgetOptions(widgetId); - DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); - boolean isLandscapeMode = context.getResources().getConfiguration().orientation - == Configuration.ORIENTATION_LANDSCAPE; - // MIN_HEIGHT is reported for landscape mode, whereas MAX_HEIGHT is used with portrait. - int newWidgetHeightDp = - options.getInt(isLandscapeMode ? AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT - : AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT); + return new Pair<>(getLayoutForHeight(context, + options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT)), + getLayoutForHeight( + context, options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT))); + } + + /** + * Given height, identify the WidgetProviderDelegate maintaining widgets that will fit in + * the space. + * + * @param context Current context. + * @param heightDp Are height in distance points. + * @return Widget LayoutRes appropriate for the supplied height. + */ + private @LayoutRes int getLayoutForHeight(Context context, int heightDp) { + DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); float smallWidgetMinHeightDp = context.getResources().getDimension( R.dimen.quick_action_search_widget_small_height) / displayMetrics.density; @@ -80,37 +78,12 @@ R.dimen.quick_action_search_widget_medium_height) / displayMetrics.density; - if (newWidgetHeightDp < smallWidgetMinHeightDp) { - return getExtraSmallWidgetDelegate(); - } else if (newWidgetHeightDp < mediumWidgetMinHeightDp) { - return getSmallWidgetDelegate(); - } else { - return getMediumWidgetDelegate(); + if (heightDp < smallWidgetMinHeightDp) { + return R.layout.quick_action_search_widget_xsmall_layout; + } else if (heightDp < mediumWidgetMinHeightDp) { + return R.layout.quick_action_search_widget_small_layout; } - } - - private @NonNull QuickActionSearchWidgetProviderDelegate getExtraSmallWidgetDelegate() { - if (sExtraSmallWidgetDelegate == null) { - sExtraSmallWidgetDelegate = - createDelegate(R.layout.quick_action_search_widget_xsmall_layout); - } - return sExtraSmallWidgetDelegate; - } - - private @NonNull QuickActionSearchWidgetProviderDelegate getSmallWidgetDelegate() { - if (sSmallWidgetDelegate == null) { - sSmallWidgetDelegate = - createDelegate(R.layout.quick_action_search_widget_small_layout); - } - return sSmallWidgetDelegate; - } - - private @NonNull QuickActionSearchWidgetProviderDelegate getMediumWidgetDelegate() { - if (sMediumWidgetDelegate == null) { - sMediumWidgetDelegate = - createDelegate(R.layout.quick_action_search_widget_medium_layout); - } - return sMediumWidgetDelegate; + return R.layout.quick_action_search_widget_medium_layout; } } @@ -120,24 +93,30 @@ */ public static class QuickActionSearchWidgetProviderDino extends QuickActionSearchWidgetProvider { - private static QuickActionSearchWidgetProviderDelegate sDelegate; - @Override - protected QuickActionSearchWidgetProviderDelegate getDelegate( + @NonNull + Pair<Integer, Integer> getOrientationSpecificLayoutRes( Context context, AppWidgetManager manager, int widgetId) { - if (sDelegate == null) { - sDelegate = createDelegate(R.layout.quick_action_search_widget_dino_layout); - } - return sDelegate; + return new Pair<>(R.layout.quick_action_search_widget_dino_layout, + R.layout.quick_action_search_widget_dino_layout); } } + private static @Nullable QuickActionSearchWidgetProviderDelegate sDelegate; + @Override public void onUpdate(@NonNull Context context, @NonNull AppWidgetManager manager, @Nullable int[] widgetIds) { updateWidgets(context, manager, SearchActivityPreferencesManager.getCurrent(), widgetIds); } + @Override + public void onAppWidgetOptionsChanged( + Context context, AppWidgetManager manager, int widgetId, Bundle newOptions) { + super.onAppWidgetOptionsChanged(context, manager, widgetId, newOptions); + onUpdate(context, manager, new int[] {widgetId}); + } + /** * Apply update to widgets, reflecting feature availability on the widget surface. * @@ -156,22 +135,25 @@ for (int index = 0; index < widgetIds.length; index++) { int widgetId = widgetIds[index]; + Pair<Integer, Integer> layouts = + getOrientationSpecificLayoutRes(context, manager, widgetId); manager.updateAppWidget(widgetId, - getDelegate(context, manager, widgetId) - .createWidgetRemoteViews(context, preferences)); + new RemoteViews(getDelegate().createWidgetRemoteViews( + context, layouts.first, preferences), + getDelegate().createWidgetRemoteViews( + context, layouts.second, preferences))); } } /** - * Create a new QuickActionSearchWidgetProviderDelegate. - * - * This method should only be used when a new instance of the ProviderDelegate is needed. - * In all other cases, use the getDelegate() method. - * - * @param widgetType The type of the Widget for which the ProviderDelegate should be built. + * Get (create if necessary) an instance of QuickActionSearchWidgetProviderDelegate. */ - protected QuickActionSearchWidgetProviderDelegate createDelegate(@LayoutRes int layout) { + @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) + @NonNull + protected QuickActionSearchWidgetProviderDelegate getDelegate() { + if (sDelegate != null) return sDelegate; + Context context = ContextUtils.getApplicationContext(); ComponentName searchActivityComponent = new ComponentName(context, SearchActivity.class); Intent trustedIncognitoIntent = @@ -181,8 +163,9 @@ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT); Intent dinoIntent = createDinoIntent(context); - return new QuickActionSearchWidgetProviderDelegate( - layout, searchActivityComponent, trustedIncognitoIntent, dinoIntent); + sDelegate = new QuickActionSearchWidgetProviderDelegate( + searchActivityComponent, trustedIncognitoIntent, dinoIntent); + return sDelegate; } /** @@ -210,19 +193,16 @@ } /** - * This function lazily initializes and returns the - * {@link QuickActionSearchWidgetProviderDelegate} - * for this instance. - * <p> - * We don't initialize the delegate in the constructor because creation of the - * QuickActionSearchWidgetProvider is done by the system. + * Acquire screen orientation specific layouts that will be applied to the + * widget. + * The two layouts represent screen orientations in Landscape and Portrait mode. * * @param context Current context. * @param manager The AppWidgetManager instance to query widget info. * @param widgetId The widget to get the delegate for. */ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) - abstract QuickActionSearchWidgetProviderDelegate getDelegate( + abstract Pair<Integer, Integer> getOrientationSpecificLayoutRes( Context context, AppWidgetManager manager, int widgetId); /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java index 133172fd..325fec3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninFirstRunFragment.java
@@ -61,11 +61,13 @@ super.onAttach(context); getPageDelegate().getPolicyLoadListener().onAvailable( hasPolicies -> notifyCoordinatorWhenNativeAndPolicyAreLoaded()); - mSkipTosDialogPolicyListener = new SkipTosDialogPolicyListener( - getPageDelegate().getPolicyLoadListener(), EnterpriseInfo.getInstance(), null); - mSkipTosDialogPolicyListener.onAvailable((Boolean skipTos) -> { - if (skipTos) exitFirstRun(); - }); + if (getPageDelegate().isLaunchedFromCct()) { + mSkipTosDialogPolicyListener = new SkipTosDialogPolicyListener( + getPageDelegate().getPolicyLoadListener(), EnterpriseInfo.getInstance(), null); + mSkipTosDialogPolicyListener.onAvailable((Boolean skipTos) -> { + if (skipTos) exitFirstRun(); + }); + } mModalDialogManager = ((ModalDialogManagerHolder) getActivity()).getModalDialogManager(); } @@ -185,9 +187,10 @@ // Make sure this function is called at most once. if (!mExitFirstRunCalled) { mExitFirstRunCalled = true; - getPageDelegate().acceptTermsOfService(false); - new Handler().postDelayed( - () -> getPageDelegate().exitFirstRun(), FirstRunUtils.getSkipTosExitDelayMs()); + new Handler().postDelayed(() -> { + getPageDelegate().acceptTermsOfService(false); + getPageDelegate().exitFirstRun(); + }, FirstRunUtils.getSkipTosExitDelayMs()); } } @@ -213,9 +216,4 @@ notifyCoordinatorWhenNativeAndPolicyAreLoaded(); return view; } - - @VisibleForTesting - public boolean isExitFirstRunCalled() { - return mExitFirstRunCalled; - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java index f35c7e4..3d4cc7d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java
@@ -556,6 +556,41 @@ waitForActivity(ChromeTabbedActivity.class); } + @Test + @MediumTest + @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) + @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) + public void testSigninFirstRunPages_WithCctPolicy_AbsenceOfPromos() throws Exception { + runFirstRunPagesTest(new FirstRunPagesTestCase().withCctTosDisabled()); + } + + @Test + @MediumTest + @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) + @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) + public void testSigninFirstRunPages_WithCctPolicy_SearchPromo() throws Exception { + runFirstRunPagesTest(new FirstRunPagesTestCase().withCctTosDisabled().withSearchPromo()); + } + + @Test + @MediumTest + @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) + @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) + public void testSigninFirstRunPages_WithCctPolicy_SearchPromo_SigninPromo() throws Exception { + runFirstRunPagesTest(new FirstRunPagesTestCase() + .withCctTosDisabled() + .withSearchPromo() + .withSigninPromo()); + } + + @Test + @MediumTest + @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) + @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) + public void testSigninFirstRunPages_WithCctPolicy_SigninPromo() throws Exception { + runFirstRunPagesTest(new FirstRunPagesTestCase().withCctTosDisabled().withSigninPromo()); + } + private void runFirstRunPagesTest(FirstRunPagesTestCase testCase) throws Exception { initializePreferences(testCase); @@ -1413,7 +1448,13 @@ int jumpCallCount = mScopedObserverData.jumpToPageCallback.getCallCount(); int acceptCallCount = mScopedObserverData.acceptTermsOfServiceCallback.getCallCount(); - clickButton(mFirstRunActivity, R.id.terms_accept, "Failed to accept ToS"); + if (Matchers.instanceOf(SigninFirstRunFragment.class) + .matches(mFirstRunActivity.getCurrentFragmentForTesting())) { + clickButton( + mFirstRunActivity, R.id.signin_fre_continue_button, "Failed to accept ToS"); + } else { + clickButton(mFirstRunActivity, R.id.terms_accept, "Failed to accept ToS"); + } mScopedObserverData.jumpToPageCallback.waitForCallback( "Failed to try moving to the next screen", jumpCallCount); mScopedObserverData.acceptTermsOfServiceCallback.waitForCallback(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java index b6135a7..aebaacb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
@@ -24,7 +24,6 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.webapps.WebApkActivityLifecycleUmaTracker; @@ -34,7 +33,6 @@ import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; -import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; @@ -57,8 +55,6 @@ "Startup.Android.Cold.TimeToFirstVisibleContent"; private static final String VISIBLE_CONTENT_HISTOGRAM = "Startup.Android.Cold.TimeToVisibleContent"; - private static final String FIRST_COMMIT_OCCURRED_PRE_FOREGROUND_HISTOGRAM = - "Startup.Android.Cold.FirstNavigationCommitOccurredPreForeground"; private static final String TABBED_SUFFIX = ChromeTabbedActivity.STARTUP_UMA_HISTOGRAM_SUFFIX; private static final String WEBAPK_SUFFIX = @@ -127,15 +123,6 @@ Assert.assertEquals(expectedCount, RecordHistogram.getHistogramTotalCountForTesting(VISIBLE_CONTENT_HISTOGRAM)); } - - // Verify that the first nav commit (if it occurred) was registered as having occurred - // post-foregrounding (otherwise the above metrics would not have been recorded). - Assert.assertEquals(expectedCount, - RecordHistogram.getHistogramValueCountForTesting( - FIRST_COMMIT_OCCURRED_PRE_FOREGROUND_HISTOGRAM, 0)); - Assert.assertEquals(0, - RecordHistogram.getHistogramValueCountForTesting( - FIRST_COMMIT_OCCURRED_PRE_FOREGROUND_HISTOGRAM, 1)); } /** @@ -262,51 +249,4 @@ }); assertHistogramsRecorded(0, TABBED_SUFFIX); } - - @Test - @LargeTest - @DisableFeatures(ChromeFeatureList.ELIDE_TAB_PRELOAD_AT_STARTUP) - public void testRecordingOfFirstNavigationCommitPreForeground() throws Exception { - UmaUtils.skipRecordingNextForegroundStartTimeForTesting(); - - runAndWaitForPageLoadMetricsRecorded(() -> { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.addCategory(Intent.CATEGORY_LAUNCHER); - mTabbedActivityTestRule.startMainActivityFromIntent(intent, mTestPage); - }); - - ActivityTabStartupMetricsTracker startupMetricsTracker = - mTabbedActivityTestRule.getActivity().getActivityTabStartupMetricsTracker(); - - // Startup metrics should not have been recorded since the browser is not in the - // foreground. - Assert.assertEquals(0, - RecordHistogram.getHistogramTotalCountForTesting( - FIRST_COMMIT_HISTOGRAM + TABBED_SUFFIX)); - Assert.assertEquals(0, - RecordHistogram.getHistogramTotalCountForTesting(FIRST_VISIBLE_CONTENT_HISTOGRAM)); - - // The metric for the first navigation commit having occurred - // pre-foregrounding should also not have been recorded at this point, as there hasn't yet - // been a notification that the browser has come to the foreground. - Assert.assertEquals(0, - RecordHistogram.getHistogramValueCountForTesting( - FIRST_COMMIT_OCCURRED_PRE_FOREGROUND_HISTOGRAM, 1)); - - // Trigger the come-to-foreground event. - TestThreadUtils.runOnUiThreadBlocking(() -> UmaUtils.recordForegroundStartTime()); - - // Startup metrics should still not have been recorded... - Assert.assertEquals(0, - RecordHistogram.getHistogramTotalCountForTesting( - FIRST_COMMIT_HISTOGRAM + TABBED_SUFFIX)); - Assert.assertEquals(0, - RecordHistogram.getHistogramTotalCountForTesting(FIRST_VISIBLE_CONTENT_HISTOGRAM)); - - // ...but the metric for the first navigation commit having occurred - // pre-foregrounding *should* now have been recorded. - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - FIRST_COMMIT_OCCURRED_PRE_FOREGROUND_HISTOGRAM, 1)); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java index c9a9ccb3..6434698ad 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java
@@ -59,6 +59,7 @@ import org.chromium.base.Callback; import org.chromium.base.test.util.ApplicationTestUtils; +import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.Matchers; @@ -174,6 +175,7 @@ SigninCheckerProvider.setForTests(mSigninCheckerMock); when(mPolicyLoadListenerMock.get()).thenReturn(false); when(mFirstRunPageDelegateMock.getPolicyLoadListener()).thenReturn(mPolicyLoadListenerMock); + when(mFirstRunPageDelegateMock.isLaunchedFromCct()).thenReturn(false); mChromeActivityTestRule.startMainActivityOnBlankPage(); mFragment = new CustomSigninFirstRunFragment(); mFragment.setPageDelegate(mFirstRunPageDelegateMock); @@ -684,6 +686,14 @@ @MediumTest public void testFragmentWithTosDialogBehaviorPolicy() throws Exception { TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); + CallbackHelper callbackHelper = new CallbackHelper(); + doAnswer(invocation -> { + callbackHelper.notifyCalled(); + return null; + }) + .when(mFirstRunPageDelegateMock) + .exitFirstRun(); + when(mFirstRunPageDelegateMock.isLaunchedFromCct()).thenReturn(true); doAnswer(AdditionalAnswers.answerVoid( (Callback<OwnedState> callback) -> callback.onResult(new OwnedState( @@ -698,8 +708,9 @@ when(mFirstRunUtils.getCctTosDialogEnabled()).thenReturn(false); launchActivityWithFragment(); - CriteriaHelper.pollUiThread(() -> mFragment.isExitFirstRunCalled()); + callbackHelper.waitForFirst(); verify(mFirstRunPageDelegateMock).acceptTermsOfService(false); + verify(mFirstRunPageDelegateMock).exitFirstRun(); } private void checkFragmentWithSelectedAccount(String email, String fullName, String givenName) {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProviderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProviderTest.java index a145a2b9..ad77097 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProviderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/quickactionsearchwidget/QuickActionSearchWidgetProviderTest.java
@@ -6,7 +6,6 @@ import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -14,8 +13,12 @@ import android.appwidget.AppWidgetManager; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.os.Bundle; +import android.util.Pair; +import android.widget.RemoteViews; +import androidx.annotation.LayoutRes; import androidx.test.core.app.ApplicationProvider; import androidx.test.filters.SmallTest; @@ -51,8 +54,13 @@ */ private class TestProvider extends QuickActionSearchWidgetProvider { @Override - protected QuickActionSearchWidgetProviderDelegate getDelegate( + Pair<Integer, Integer> getOrientationSpecificLayoutRes( Context context, AppWidgetManager manager, int widgetId) { + return new Pair<>(0, 0); + } + + @Override + protected QuickActionSearchWidgetProviderDelegate getDelegate() { return mDelegateMock; } } @@ -65,10 +73,13 @@ private QuickActionSearchWidgetProviderDelegate mDelegateMock; @Mock private Bundle mBundleMock; + private RemoteViews mRemoteViews; private QuickActionSearchWidgetProvider mWidgetProvider; private Context mContext; - private int mMediumWidgetMinHeight; + private int mXSmallWidgetMinHeightDp; + private int mSmallWidgetMinHeightDp; + private int mMediumWidgetMinHeightDp; @Before public void setUp() { @@ -76,15 +87,30 @@ MockitoAnnotations.initMocks(this); mContext = Mockito.spy(ApplicationProvider.getApplicationContext()); + // Inflate an actual RemoteViews to avoid stubbing internal methods or making + // any other assumptions about the class. + mRemoteViews = new RemoteViews( + mContext.getPackageName(), R.layout.quick_action_search_widget_medium_layout); mWidgetProvider = Mockito.spy(new TestProvider()); when(mContext.getSystemService(Context.APPWIDGET_SERVICE)) .thenReturn(mAppWidgetManagerMock); when(mAppWidgetManagerMock.getAppWidgetOptions(anyInt())).thenReturn(mBundleMock); + when(mDelegateMock.createWidgetRemoteViews(any(), anyInt(), any())) + .thenReturn(mRemoteViews); + + Resources res = mContext.getResources(); + float density = res.getDisplayMetrics().density; + // Depend on device-supplied defaults to test also on different form factors. // The computation below infers the size specific to a particular device running tests. - mMediumWidgetMinHeight = (int) (mContext.getResources().getDimension( - R.dimen.quick_action_search_widget_medium_height) - / mContext.getResources().getDisplayMetrics().density); + mXSmallWidgetMinHeightDp = + (int) (res.getDimension(R.dimen.quick_action_search_widget_xsmall_height) + / density); + mSmallWidgetMinHeightDp = + (int) (res.getDimension(R.dimen.quick_action_search_widget_small_height) / density); + mMediumWidgetMinHeightDp = + (int) (res.getDimension(R.dimen.quick_action_search_widget_medium_height) + / density); } @Test @@ -98,44 +124,12 @@ verify(mWidgetProvider, times(1)).onUpdate(mContext, mAppWidgetManagerMock, WIDGET_IDS); verify(mWidgetProvider, times(1)).onUpdate(any(), any(), any()); - // We create dedicated view based on widget size for every widget instance. - verify(mDelegateMock, times(2)).createWidgetRemoteViews(any(), any()); - } + // There are 2 fake widgets that we work with, so expect both being evaluated + verify(mWidgetProvider, times(2)).getOrientationSpecificLayoutRes(any(), any(), anyInt()); - /** - * Test that a different provider delegate is returned for widgets when these are scaled - * vertically. - * This takes under consideration the fact that "dipi" and "dpi" dimensions are different - */ - @Test - @SmallTest - public void testVerticalDynamicWidgetResizeForSmallWidgetProvider() { - doVerticalDynamicWidgetResize( - "Small Widget provider", new QuickActionSearchWidgetProviderSearch()); - } - - private void doVerticalDynamicWidgetResize( - String providerType, QuickActionSearchWidgetProvider provider) { - when(mBundleMock.getInt(anyString())) - .thenReturn(mMediumWidgetMinHeight - 10) - .thenReturn(mMediumWidgetMinHeight + 10) - .thenReturn(mMediumWidgetMinHeight - 1) - .thenReturn(mMediumWidgetMinHeight); - - QuickActionSearchWidgetProviderDelegate delegate1 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate2 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate3 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate4 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - - Assert.assertNotEquals(providerType, delegate1, - delegate2); // Small and medium widget delegates are different. - Assert.assertEquals(providerType, delegate1, delegate3); // Small widget delegates are same. - Assert.assertEquals( - providerType, delegate2, delegate4); // Medium widget delegates are same. + // We create dedicated view based on widget size for every widget instance and screen + // orientation. + verify(mDelegateMock, times(4)).createWidgetRemoteViews(any(), anyInt(), any()); } /** @@ -149,54 +143,75 @@ "Small Widget provider", new QuickActionSearchWidgetProviderSearch()); } + static class VerticalResizeHeightVariant { + /** Reported widget height (in distance point) for this variant. */ + public final int heightDp; + /** String representation (for human readable logs). */ + public final String variantName; + /** Expected Layout Resource ID for that height. */ + public final Integer layoutRes; + + VerticalResizeHeightVariant(int heightDp, String variantName, @LayoutRes int layoutRes) { + this.heightDp = heightDp; + this.variantName = variantName; + this.layoutRes = layoutRes; + } + } + private void doVerticalWidgetResizeOfSmallWidget( String providerType, QuickActionSearchWidgetProvider provider) { - when(mBundleMock.getInt(anyString())) - .thenReturn(0) - .thenReturn(1) - .thenReturn(mMediumWidgetMinHeight - 10) - .thenReturn(mMediumWidgetMinHeight - 1); + // Validate all height pairs (exhausts the solution space). + // This includes both reasonable and unreasonable pairs, ie. the assertion that the + // MIN_HEIGHT <= MAX_HEIGHT does not have to hold true. + // We want to be thorough and test both the lower and the upper boundary against what we + // expect to be returned. + VerticalResizeHeightVariant[] variants = new VerticalResizeHeightVariant[] { + // The following 2 variants "should never happen" and technically violate any + // assumptions that could be made about Android widget sizing, but we keep these to + // verify that we're not doing anything unexpected / bad, like crashing. + new VerticalResizeHeightVariant(0, // + "zero", R.layout.quick_action_search_widget_xsmall_layout), + new VerticalResizeHeightVariant(mXSmallWidgetMinHeightDp - 1, + "XSmallMinHeightDp - 1", R.layout.quick_action_search_widget_xsmall_layout), - QuickActionSearchWidgetProviderDelegate delegate1 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate2 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate3 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate4 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); + // The following variants test every valid variant at its boundaries. + new VerticalResizeHeightVariant(mXSmallWidgetMinHeightDp, // + "XSmallMinHeightDp", R.layout.quick_action_search_widget_xsmall_layout), + new VerticalResizeHeightVariant(mXSmallWidgetMinHeightDp + 1, + "XSmallMinHeightDp + 1", R.layout.quick_action_search_widget_xsmall_layout), + new VerticalResizeHeightVariant(mSmallWidgetMinHeightDp - 1, // + "SmallMinHeightDp - 1", R.layout.quick_action_search_widget_xsmall_layout), + new VerticalResizeHeightVariant(mSmallWidgetMinHeightDp, // + "SmallMinHeightDp", R.layout.quick_action_search_widget_small_layout), + new VerticalResizeHeightVariant(mSmallWidgetMinHeightDp + 1, // + "SmallMinHeightDp + 1", R.layout.quick_action_search_widget_small_layout), + new VerticalResizeHeightVariant(mMediumWidgetMinHeightDp - 1, + "MediumMinHeightDp - 1", R.layout.quick_action_search_widget_small_layout), + new VerticalResizeHeightVariant(mMediumWidgetMinHeightDp, // + "MediumMinHeightDp", R.layout.quick_action_search_widget_medium_layout), + new VerticalResizeHeightVariant(mMediumWidgetMinHeightDp + 1, + "MediumMinHeightDp + 1", R.layout.quick_action_search_widget_medium_layout), + }; - Assert.assertEquals(providerType, delegate1, delegate2); - Assert.assertNotEquals(providerType, delegate1, delegate3); - Assert.assertEquals(providerType, delegate3, delegate4); - } + for (VerticalResizeHeightVariant minHeightVariant : variants) { + for (VerticalResizeHeightVariant maxHeightVariant : variants) { + when(mBundleMock.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT)) + .thenReturn(minHeightVariant.heightDp); + when(mBundleMock.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)) + .thenReturn(maxHeightVariant.heightDp); - /** - * Test that the same delegate is used for all medium size widgets. - * This takes under consideration the fact that "dipi" and "dpi" dimensions are different - */ - @Test - @SmallTest - public void testVerticalWidgetResizeOfMediumWidget() { - doVerticalWidgetResizeOfMediumWidget( - "Small Widget provider", new QuickActionSearchWidgetProviderSearch()); - } + Pair<Integer, Integer> layouts = provider.getOrientationSpecificLayoutRes( + mContext, mAppWidgetManagerMock, 0); - private void doVerticalWidgetResizeOfMediumWidget( - String providerType, QuickActionSearchWidgetProvider provider) { - when(mBundleMock.getInt(anyString())) - .thenReturn(mMediumWidgetMinHeight) - .thenReturn(mMediumWidgetMinHeight + 1) - .thenReturn(mMediumWidgetMinHeight * 10); - - QuickActionSearchWidgetProviderDelegate delegate1 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate2 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - QuickActionSearchWidgetProviderDelegate delegate3 = - provider.getDelegate(mContext, mAppWidgetManagerMock, 1); - - Assert.assertEquals(providerType, delegate1, delegate2); - Assert.assertEquals(providerType, delegate1, delegate3); + Assert.assertEquals( + "Landscape layout invalid where MIN_HEIGHT=" + minHeightVariant.variantName + + " and MAX_HEIGHT=" + maxHeightVariant.variantName, + minHeightVariant.layoutRes, layouts.first); + Assert.assertEquals( + "Portrait layout invalid where MIN_HEIGHT=" + minHeightVariant.variantName + + " and MAX_HEIGHT=" + maxHeightVariant.variantName, + maxHeightVariant.layoutRes, layouts.second); + } + } } }
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 197b1f0..cd9b303 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -700,13 +700,13 @@ #endif } - ALLOW_UNUSED_LOCAL(channel); ALLOW_UNUSED_LOCAL(is_canary_dev); // Start heap profiling as early as possible so it can start recording // memory allocations. if (is_browser_process) { - heap_profiler_controller_ = std::make_unique<HeapProfilerController>(); + heap_profiler_controller_ = + std::make_unique<HeapProfilerController>(channel); heap_profiler_controller_->Start(); #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 36c98c81..ef6099e 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2509,7 +2509,6 @@ "//chromeos/services/network_health/public/mojom:mojom", "//chromeos/system", "//chromeos/tpm", - "//components/arc/mojom", "//components/certificate_transparency", "//components/drive", "//components/quirks", @@ -4891,6 +4890,7 @@ deps += [ "//ash", "//ash/components/account_manager", + "//ash/components/arc", "//ash/components/arc:arc_base", "//ash/components/arc:arc_base_utils", "//ash/components/arc/enterprise", @@ -4958,7 +4958,6 @@ "//components/account_manager_core", "//components/app_restore", "//components/arc", - "//components/arc/mojom", "//components/desks_storage", "//components/metrics/structured:neutrino_logging", "//components/metrics/structured:neutrino_logging_util", @@ -6365,6 +6364,15 @@ "signin/signin_util_win.h", ] } + + # TODO(https://crbug.com/1198523: Remove this once enable_dice_support is no + # longer defined on Lacros. + if (is_chromeos_lacros) { + sources -= [ + "signin/signin_manager_factory.cc", + "signin/signin_manager_factory.h", + ] + } } if (enable_media_remoting) { @@ -7689,6 +7697,7 @@ "//chromeos/login/auth", "//components/session_manager/core", "//components/soda", + "//components/user_manager:test_support", "//components/webapk:proto", "//extensions/browser/api/messaging", "//ui/base:test_support",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index d48cb7c..ad83924 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1400,7 +1400,8 @@ {ntp_features::kNtpChromeCartModuleAbandonedCartDiscountUseUtmParam, "true"}, {"partner-merchant-pattern", - "(electronicexpress.com|zazzle.com|wish.com|homesquare.com|iherb.com)"}}; + "(electronicexpress.com|zazzle.com|wish.com|homesquare.com|iherb.com|" + "zappos.com|otterbox.com)"}}; const FeatureEntry::FeatureParam kNtpChromeCartModuleHeuristicsImprovement[] = { {ntp_features::kNtpChromeCartModuleHeuristicsImprovementParam, "true"}}; const FeatureEntry::FeatureParam kNtpChromeCartModuleRBDAndCouponDiscount[] = { @@ -3486,6 +3487,10 @@ flag_descriptions::kVoiceButtonInTopToolbarName, flag_descriptions::kVoiceButtonInTopToolbarDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kVoiceButtonInTopToolbar)}, + {"assistant-consent-simplified-text", + flag_descriptions::kAssistantConsentSimplifiedTextName, + flag_descriptions::kAssistantConsentSimplifiedTextDescription, kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kAssistantConsentSimplifiedText)}, {"assistant-consent-v2", flag_descriptions::kAssistantConsentV2Name, flag_descriptions::kAssistantConsentV2Description, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kAssistantConsentV2, @@ -3531,6 +3536,9 @@ flag_descriptions::kLightweightReactionsAndroidDescription, kOsAndroid, FEATURE_VALUE_TYPE(content_creation::kLightweightReactions)}, #endif // OS_ANDROID + {"enable-automatic-snooze", flag_descriptions::kEnableAutomaticSnoozeName, + flag_descriptions::kEnableAutomaticSnoozeDescription, kOsAll, + FEATURE_VALUE_TYPE(feature_engagement::kEnableAutomaticSnooze)}, {"in-product-help-demo-mode-choice", flag_descriptions::kInProductHelpDemoModeChoiceName, flag_descriptions::kInProductHelpDemoModeChoiceDescription, kOsAll, @@ -4168,16 +4176,6 @@ flag_descriptions::kVirtualKeyboardBorderedKeyName, flag_descriptions::kVirtualKeyboardBorderedKeyDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kVirtualKeyboardBorderedKey)}, - {"enable-cros-virtual-keyboard-multipaste", - flag_descriptions::kVirtualKeyboardMultipasteName, - flag_descriptions::kVirtualKeyboardMultipasteDescription, kOsCrOS, - FEATURE_VALUE_TYPE(chromeos::features::kVirtualKeyboardMultipaste)}, - {"enable-cros-virtual-keyboard-multipaste-suggestion", - flag_descriptions::kVirtualKeyboardMultipasteSuggestionName, - flag_descriptions::kVirtualKeyboardMultipasteSuggestionDescription, - kOsCrOS, - FEATURE_VALUE_TYPE( - chromeos::features::kVirtualKeyboardMultipasteSuggestion)}, {"enable-experimental-accessibility-dictation-extension", flag_descriptions::kExperimentalAccessibilityDictationExtensionName, flag_descriptions::kExperimentalAccessibilityDictationExtensionDescription,
diff --git a/chrome/browser/apps/app_service/app_icon/app_icon_factory.h b/chrome/browser/apps/app_service/app_icon/app_icon_factory.h index 73235e10..ccacb9c4 100644 --- a/chrome/browser/apps/app_service/app_icon/app_icon_factory.h +++ b/chrome/browser/apps/app_service/app_icon/app_icon_factory.h
@@ -17,8 +17,8 @@ #include "ui/gfx/image/image_skia.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace content {
diff --git a/chrome/browser/apps/app_service/app_icon/app_icon_factory_unittest.cc b/chrome/browser/apps/app_service/app_icon/app_icon_factory_unittest.cc index 448c3d1..212d526 100644 --- a/chrome/browser/apps/app_service/app_icon/app_icon_factory_unittest.cc +++ b/chrome/browser/apps/app_service/app_icon/app_icon_factory_unittest.cc
@@ -47,13 +47,13 @@ #include "ui/gfx/image/image_unittest_util.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/constants/ash_features.h" #include "chrome/browser/apps/icon_standardizer.h" #include "chrome/browser/ash/arc/icon_decode_request.h" #include "chrome/browser/ui/app_list/md_icon_normalizer.h" #include "chrome/common/chrome_features.h" #include "chrome/grit/chrome_unscaled_resources.h" -#include "components/arc/mojom/intent_helper.mojom.h" #endif namespace {
diff --git a/chrome/browser/apps/app_service/app_icon/app_icon_loader.h b/chrome/browser/apps/app_service/app_icon/app_icon_loader.h index 3789fab..5ae2c9d 100644 --- a/chrome/browser/apps/app_service/app_icon/app_icon_loader.h +++ b/chrome/browser/apps/app_service/app_icon/app_icon_loader.h
@@ -21,7 +21,7 @@ #include "ui/gfx/image/image_skia.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "components/arc/mojom/intent_helper.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace arc {
diff --git a/chrome/browser/apps/app_service/app_icon/arc_activity_adaptive_icon_impl.h b/chrome/browser/apps/app_service/app_icon/arc_activity_adaptive_icon_impl.h index db9457d..1ac6d50e 100644 --- a/chrome/browser/apps/app_service/app_icon/arc_activity_adaptive_icon_impl.h +++ b/chrome/browser/apps/app_service/app_icon/arc_activity_adaptive_icon_impl.h
@@ -7,8 +7,8 @@ #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "components/arc/intent_helper/adaptive_icon_delegate.h" -#include "components/arc/mojom/intent_helper.mojom.h" namespace arc { class AdaptiveIconDelegate;
diff --git a/chrome/browser/apps/app_service/app_shortcut_item.h b/chrome/browser/apps/app_service/app_shortcut_item.h index 2ba6ed0f..3eaad054 100644 --- a/chrome/browser/apps/app_service/app_shortcut_item.h +++ b/chrome/browser/apps/app_service/app_shortcut_item.h
@@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ui/gfx/image/image_skia.h" namespace apps {
diff --git a/chrome/browser/apps/app_service/intent_util.cc b/chrome/browser/apps/app_service/intent_util.cc index 554d72d6..03d56ce 100644 --- a/chrome/browser/apps/app_service/intent_util.cc +++ b/chrome/browser/apps/app_service/intent_util.cc
@@ -34,6 +34,8 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/intent_common.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/constants/ash_features.h" #include "ash/webui/projector_app/public/cpp/projector_app_constants.h" #include "base/files/file_path.h" @@ -42,8 +44,6 @@ #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h" #include "components/arc/intent_helper/intent_constants.h" #include "components/arc/intent_helper/intent_filter.h" -#include "components/arc/mojom/intent_common.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "storage/browser/file_system/file_system_url.h" #endif
diff --git a/chrome/browser/apps/app_service/intent_util.h b/chrome/browser/apps/app_service/intent_util.h index 50927e9..d45e513 100644 --- a/chrome/browser/apps/app_service/intent_util.h +++ b/chrome/browser/apps/app_service/intent_util.h
@@ -19,8 +19,8 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "components/arc/mojom/intent_common.mojom-forward.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" +#include "ash/components/arc/mojom/intent_common.mojom-forward.h" +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" namespace arc { class IntentFilter;
diff --git a/chrome/browser/apps/app_service/intent_util_unittest.cc b/chrome/browser/apps/app_service/intent_util_unittest.cc index 065141b..0a757b7 100644 --- a/chrome/browser/apps/app_service/intent_util_unittest.cc +++ b/chrome/browser/apps/app_service/intent_util_unittest.cc
@@ -8,6 +8,8 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/intent_common.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/check.h" #include "base/containers/flat_map.h" #include "base/files/file_path.h" @@ -20,8 +22,6 @@ #include "chrome/browser/web_applications/web_app.h" #include "components/arc/intent_helper/intent_constants.h" #include "components/arc/intent_helper/intent_filter.h" -#include "components/arc/mojom/intent_common.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/services/app_service/public/cpp/file_handler.h" #include "components/services/app_service/public/cpp/intent_filter_util.h" #include "components/services/app_service/public/cpp/intent_util.h"
diff --git a/chrome/browser/apps/app_service/launch_utils.h b/chrome/browser/apps/app_service/launch_utils.h index 718b0d2..697ee049 100644 --- a/chrome/browser/apps/app_service/launch_utils.h +++ b/chrome/browser/apps/app_service/launch_utils.h
@@ -20,7 +20,7 @@ #endif // defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app.mojom.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) class Browser;
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.cc b/chrome/browser/apps/app_service/publishers/arc_apps.cc index 0db4d272..73f92ca 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.cc +++ b/chrome/browser/apps/app_service/publishers/arc_apps.cc
@@ -10,6 +10,10 @@ #include "ash/components/arc/arc_util.h" #include "ash/components/arc/metrics/arc_metrics_constants.h" #include "ash/components/arc/metrics/arc_metrics_service.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" +#include "ash/components/arc/mojom/file_system.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/constants/ash_features.h" @@ -47,10 +51,6 @@ #include "components/app_restore/features.h" #include "components/app_restore/full_restore_save_handler.h" #include "components/app_restore/full_restore_utils.h" -#include "components/arc/mojom/app_permissions.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/services/app_service/public/cpp/icon_types.h" #include "components/services/app_service/public/cpp/intent_filter_util.h" #include "components/services/app_service/public/cpp/intent_util.h"
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.h b/chrome/browser/apps/app_service/publishers/arc_apps.h index ae98413..ec981cc 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.h +++ b/chrome/browser/apps/app_service/publishers/arc_apps.h
@@ -11,6 +11,7 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "ash/public/cpp/message_center/arc_notification_manager_base.h" #include "ash/public/cpp/message_center/arc_notifications_host_initializer.h" #include "base/callback.h" @@ -31,7 +32,6 @@ #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/arc_intent_helper_observer.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" #include "components/services/app_service/public/cpp/instance_registry.h" #include "components/services/app_service/public/cpp/publisher_base.h"
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc b/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc index 4ed5e47f..96d244a 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc +++ b/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/apps/app_service/publishers/arc_apps.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -21,7 +22,6 @@ #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/intent_constants.h" #include "components/arc/intent_helper/intent_filter.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/arc/test/fake_intent_helper_instance.h" #include "components/services/app_service/public/cpp/preferred_apps_list_handle.h" #include "content/public/test/browser_task_environment.h"
diff --git a/chrome/browser/apps/app_service/webapk/webapk_manager.cc b/chrome/browser/apps/app_service/webapk/webapk_manager.cc index 4374c2c4..6589aab3 100644 --- a/chrome/browser/apps/app_service/webapk/webapk_manager.cc +++ b/chrome/browser/apps/app_service/webapk/webapk_manager.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/apps/app_service/webapk/webapk_manager.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/connection_holder.h" #include "base/bind.h" #include "base/check.h" @@ -21,7 +22,6 @@ #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/web_app_utils.h" -#include "components/arc/mojom/app.mojom.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "components/services/app_service/public/cpp/intent_util.h"
diff --git a/chrome/browser/apps/app_service/webapk/webapk_manager.h b/chrome/browser/apps/app_service/webapk/webapk_manager.h index 2f73df2..4fe92be 100644 --- a/chrome/browser/apps/app_service/webapk/webapk_manager.h +++ b/chrome/browser/apps/app_service/webapk/webapk_manager.h
@@ -8,12 +8,12 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "base/scoped_observation.h" #include "chrome/browser/apps/app_service/app_service_proxy_forward.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" class PrefChangeRegistrar;
diff --git a/chrome/browser/apps/app_service/webapk/webapk_manager_unittest.cc b/chrome/browser/apps/app_service/webapk/webapk_manager_unittest.cc index 7681b48..d4663ac 100644 --- a/chrome/browser/apps/app_service/webapk/webapk_manager_unittest.cc +++ b/chrome/browser/apps/app_service/webapk/webapk_manager_unittest.cc
@@ -7,6 +7,7 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/fake_app_instance.h" #include "ash/constants/ash_features.h" #include "base/strings/strcat.h" @@ -25,7 +26,6 @@ #include "chrome/browser/web_applications/test/fake_web_app_provider.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/app.mojom.h" #include "components/prefs/pref_service.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 2285838..3fd6e20 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -4609,7 +4609,10 @@ } }; -#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_WIN) +// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch +// of lacros-chrome is complete. +#if (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || defined(OS_MAC) || \ + defined(OS_WIN) // This verifies the fix for http://crbug.com/667708. IN_PROC_BROWSER_TEST_F(ChromeSignInWebViewTest, ClosingChromeSignInShouldNotCrash) {
diff --git a/chrome/browser/ash/app_restore/arc_window_handler.h b/chrome/browser/ash/app_restore/arc_window_handler.h index b029a48..b2d260fe 100644 --- a/chrome/browser/ash/app_restore/arc_window_handler.h +++ b/chrome/browser/ash/app_restore/arc_window_handler.h
@@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_ASH_APP_RESTORE_ARC_WINDOW_HANDLER_H_ #define CHROME_BROWSER_ASH_APP_RESTORE_ARC_WINDOW_HANDLER_H_ +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" -#include "components/arc/mojom/app.mojom-forward.h" #include "components/exo/client_controlled_shell_surface.h" #include "components/exo/wm_helper.h"
diff --git a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc index df23fe0..dd18224 100644 --- a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc +++ b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc
@@ -8,6 +8,7 @@ #include <map> #include <memory> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/arc_util_test_support.h" @@ -59,7 +60,6 @@ #include "components/app_restore/full_restore_utils.h" #include "components/app_restore/window_info.h" #include "components/app_restore/window_properties.h" -#include "components/arc/mojom/app.mojom.h" #include "components/exo/buffer.h" #include "components/exo/shell_surface_util.h" #include "components/exo/surface.h"
diff --git a/chrome/browser/ash/apps/apk_web_app_installer.h b/chrome/browser/ash/apps/apk_web_app_installer.h index 0324f1e..73293f10 100644 --- a/chrome/browser/ash/apps/apk_web_app_installer.h +++ b/chrome/browser/ash/apps/apk_web_app_installer.h
@@ -8,11 +8,11 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/app.mojom.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_application_info.h" -#include "components/arc/mojom/app.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" class GURL;
diff --git a/chrome/browser/ash/apps/apk_web_app_service.cc b/chrome/browser/ash/apps/apk_web_app_service.cc index 22390de4..0e88ef2 100644 --- a/chrome/browser/ash/apps/apk_web_app_service.cc +++ b/chrome/browser/ash/apps/apk_web_app_service.cc
@@ -7,6 +7,7 @@ #include <map> #include <utility> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/connection_holder.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -23,7 +24,6 @@ #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_utils.h" #include "chrome/common/chrome_features.h" -#include "components/arc/mojom/app.mojom.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/webapps/browser/installable/installable_metrics.h"
diff --git a/chrome/browser/ash/arc/DIR_METADATA b/chrome/browser/ash/arc/DIR_METADATA index 54a0fa6..d2f93ef0 100644 --- a/chrome/browser/ash/arc/DIR_METADATA +++ b/chrome/browser/ash/arc/DIR_METADATA
@@ -1 +1 @@ -mixins: "//components/arc/COMMON_METADATA" +mixins: "//ash/components/arc/COMMON_METADATA"
diff --git a/chrome/browser/ash/arc/OWNERS b/chrome/browser/ash/arc/OWNERS index 02d6b48..203e15a4 100644 --- a/chrome/browser/ash/arc/OWNERS +++ b/chrome/browser/ash/arc/OWNERS
@@ -1 +1 @@ -file://components/arc/OWNERS +file://ash/components/arc/OWNERS
diff --git a/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_request.h b/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_request.h index 114ea2a3..aa4240b 100644 --- a/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_request.h +++ b/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_request.h
@@ -8,10 +8,10 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/apps/app_service/app_shortcut_item.h" -#include "components/arc/mojom/app.mojom-forward.h" namespace arc {
diff --git a/chrome/browser/ash/arc/arc_optin_uma.cc b/chrome/browser/ash/arc/arc_optin_uma.cc index f14918c4..ab8861a 100644 --- a/chrome/browser/ash/arc/arc_optin_uma.cc +++ b/chrome/browser/ash/arc/arc_optin_uma.cc
@@ -8,6 +8,7 @@ #include "ash/components/arc/arc_util.h" #include "ash/components/arc/metrics/stability_metrics_manager.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/mojom/auth.mojom.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" @@ -17,7 +18,6 @@ #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "components/arc/mojom/app.mojom.h" namespace arc {
diff --git a/chrome/browser/ash/arc/arc_optin_uma.h b/chrome/browser/ash/arc/arc_optin_uma.h index c38d3c3f..93f7e14b 100644 --- a/chrome/browser/ash/arc/arc_optin_uma.h +++ b/chrome/browser/ash/arc/arc_optin_uma.h
@@ -7,8 +7,8 @@ #include <ostream> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "ash/components/arc/mojom/auth.mojom-forward.h" -#include "components/arc/mojom/app.mojom-forward.h" class Profile;
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h index aa96bd3..ece137df1 100644 --- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h +++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.h
@@ -16,6 +16,7 @@ #include <vector> #include "ash/components/arc/mojom/bluetooth.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "base/callback_forward.h" #include "base/containers/unique_ptr_adapters.h" @@ -24,7 +25,6 @@ #include "base/threading/thread_checker.h" #include "base/timer/timer.h" #include "chrome/browser/ash/arc/bluetooth/arc_bluetooth_task_queue.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h"
diff --git a/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.cc b/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.cc index 071159c..791fcce 100644 --- a/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.cc +++ b/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.cc
@@ -11,6 +11,7 @@ #include <utility> #include "ash/components/arc/arc_browser_context_keyed_service_factory_base.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -29,7 +30,6 @@ #include "chrome/browser/ash/file_manager/path_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_paths.h" -#include "components/arc/mojom/file_system.mojom.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.h b/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.h index ddb5e4c..a849e45 100644 --- a/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.h +++ b/chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_service.h
@@ -10,12 +10,12 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "ash/components/arc/volume_mounter/arc_volume_mounter_bridge.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "components/arc/mojom/file_system.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" namespace base {
diff --git a/chrome/browser/ash/arc/file_system_watcher/file_system_scanner.cc b/chrome/browser/ash/arc/file_system_watcher/file_system_scanner.cc index 6522bd12..5abae55 100644 --- a/chrome/browser/ash/arc/file_system_watcher/file_system_scanner.cc +++ b/chrome/browser/ash/arc/file_system_watcher/file_system_scanner.cc
@@ -7,13 +7,13 @@ #include <fts.h> #include <sys/stat.h> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "base/files/file_enumerator.h" #include "base/task/post_task.h" #include "base/task/sequenced_task_runner.h" #include "base/task/thread_pool.h" #include "chrome/browser/ash/arc/file_system_watcher/arc_file_system_watcher_util.h" -#include "components/arc/mojom/file_system.mojom.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h index e1ef977..f395686 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h
@@ -11,13 +11,13 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "base/callback_forward.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h" -#include "components/arc/mojom/file_system.mojom-forward.h" #include "storage/browser/file_system/async_file_util.h" #include "storage/browser/file_system/watcher_manager.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_unittest.cc index a5b0807..d66c158 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_unittest.cc +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root_unittest.cc
@@ -11,6 +11,7 @@ #include <utility> #include "ash/components/arc/arc_features.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/connection_holder_util.h" @@ -22,7 +23,6 @@ #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/file_system.mojom.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/test/browser_task_environment.h" #include "storage/browser/file_system/file_system_operation.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.cc b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.cc index c7c8c7be..08cd904 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.cc +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.cc
@@ -7,11 +7,11 @@ #include <algorithm> #include <utility> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/containers/contains.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "components/arc/mojom/file_system.mojom.h" #include "net/base/escape.h" #include "net/base/mime_util.h" #include "storage/browser/file_system/file_system_url.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h index ee1cc3b..77250fe 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h
@@ -10,8 +10,8 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "base/files/file_path.h" -#include "components/arc/mojom/file_system.mojom-forward.h" class GURL;
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util_unittest.cc index 8744e20..84df85a 100644 --- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_util_unittest.cc +++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_util_unittest.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h" +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/files/file_path.h" -#include "components/arc/mojom/file_system.mojom.h" #include "storage/browser/file_system/file_system_url.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/storage_key/storage_key.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h index 20124f6..232b08e3 100644 --- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h +++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h
@@ -12,13 +12,13 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "chrome/browser/ash/arc/fileapi/arc_select_files_handler.h" #include "chrome/browser/ash/arc/fileapi/file_stream_forwarder.h" -#include "components/arc/mojom/file_system.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" #include "storage/browser/file_system/file_system_operation.h" #include "storage/browser/file_system/watcher_manager.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h index 5c0e69c6..4f6d9f9 100644 --- a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h +++ b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h
@@ -12,13 +12,13 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h" #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" -#include "components/arc/mojom/file_system.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" #include "storage/browser/file_system/watcher_manager.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc index 390d3ba..4f3a5db9 100644 --- a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc +++ b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc
@@ -7,6 +7,7 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/connection_holder_util.h" @@ -15,7 +16,6 @@ #include "base/callback_helpers.h" #include "base/run_loop.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/file_system.mojom.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_select_files_handler.h b/chrome/browser/ash/arc/fileapi/arc_select_files_handler.h index 72507e8..3b2a55e 100644 --- a/chrome/browser/ash/arc/fileapi/arc_select_files_handler.h +++ b/chrome/browser/ash/arc/fileapi/arc_select_files_handler.h
@@ -7,11 +7,11 @@ #include <vector> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/files/file_path.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/views/select_file_dialog_extension.h" -#include "components/arc/mojom/file_system.mojom.h" #include "content/public/browser/render_frame_host.h" #include "ui/shell_dialogs/select_file_dialog.h"
diff --git a/chrome/browser/ash/arc/fileapi/arc_select_files_handler_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_select_files_handler_unittest.cc index 051f23f..29b56a6 100644 --- a/chrome/browser/ash/arc/fileapi/arc_select_files_handler_unittest.cc +++ b/chrome/browser/ash/arc/fileapi/arc_select_files_handler_unittest.cc
@@ -6,6 +6,7 @@ #include <string> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/json/json_reader.h" #include "base/strings/stringprintf.h" #include "base/test/mock_callback.h" @@ -14,7 +15,6 @@ #include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile_manager.h" -#include "components/arc/mojom/file_system.mojom.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc index d1ed66a..8a222a34 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc
@@ -7,10 +7,10 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "base/test/task_environment.h" #include "base/time/time.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h index 326014a..5d08a3b 100644 --- a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h +++ b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h
@@ -10,9 +10,9 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "chrome/browser/apps/intent_helper/apps_navigation_types.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/page_transition_types.h" #include "url/origin.h"
diff --git a/chrome/browser/ash/arc/intent_helper/arc_settings_service.h b/chrome/browser/ash/arc/intent_helper/arc_settings_service.h index 7a273f7..95acfb0f 100644 --- a/chrome/browser/ash/arc/intent_helper/arc_settings_service.h +++ b/chrome/browser/ash/arc/intent_helper/arc_settings_service.h
@@ -7,9 +7,9 @@ #include <memory> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" class Profile;
diff --git a/chrome/browser/ash/arc/intent_helper/custom_tab_session_impl.h b/chrome/browser/ash/arc/intent_helper/custom_tab_session_impl.h index 33dc44a..acb8f92 100644 --- a/chrome/browser/ash/arc/intent_helper/custom_tab_session_impl.h +++ b/chrome/browser/ash/arc/intent_helper/custom_tab_session_impl.h
@@ -7,10 +7,10 @@ #include <memory> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/memory/weak_ptr.h" #include "base/timer/elapsed_timer.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.cc b/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.cc index 5bc7cb70..26e6173 100644 --- a/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.cc +++ b/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.cc
@@ -9,6 +9,7 @@ #include <utility> #include "ash/components/arc/metrics/arc_metrics_constants.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/bind.h" @@ -26,7 +27,6 @@ #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/grit/generated_resources.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/renderer_context_menu/render_view_context_menu_proxy.h" #include "content/public/browser/context_menu_params.h" #include "ui/base/models/image_model.h"
diff --git a/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.h b/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.h index 84d39927..458deb08 100644 --- a/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.h +++ b/chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.h
@@ -8,7 +8,7 @@ #include <memory> #include <vector> -#include "components/arc/mojom/intent_helper.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "components/renderer_context_menu/render_view_context_menu_observer.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h"
diff --git a/chrome/browser/ash/arc/print_spooler/OWNERS b/chrome/browser/ash/arc/print_spooler/OWNERS index f6f4b52..fbeef67 100644 --- a/chrome/browser/ash/arc/print_spooler/OWNERS +++ b/chrome/browser/ash/arc/print_spooler/OWNERS
@@ -1 +1,2 @@ -file://components/arc/print_spooler/OWNERS +bmgordon@chromium.org +skau@chromium.org
diff --git a/chrome/browser/ash/arc/session/OWNERS b/chrome/browser/ash/arc/session/OWNERS index 8edfc24..7b124e3 100644 --- a/chrome/browser/ash/arc/session/OWNERS +++ b/chrome/browser/ash/arc/session/OWNERS
@@ -1 +1 @@ -file://components/arc/session/OWNERS +file://ash/components/arc/session/OWNERS
diff --git a/chrome/browser/ash/arc/user_session/arc_user_session_service.h b/chrome/browser/ash/arc/user_session/arc_user_session_service.h index 7b9251e8..ce898c85 100644 --- a/chrome/browser/ash/arc/user_session/arc_user_session_service.h +++ b/chrome/browser/ash/arc/user_session/arc_user_session_service.h
@@ -5,8 +5,8 @@ #ifndef CHROME_BROWSER_ASH_ARC_USER_SESSION_ARC_USER_SESSION_SERVICE_H_ #define CHROME_BROWSER_ASH_ARC_USER_SESSION_ARC_USER_SESSION_SERVICE_H_ +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/keyed_service/core/keyed_service.h" #include "components/session_manager/core/session_manager_observer.h"
diff --git a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc index 837d606..89bdac6 100644 --- a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc +++ b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/components/arc/mojom/app.mojom.h" #include "base/bind.h" #include "base/test/metrics/histogram_tester.h" #include "base/time/time.h" @@ -20,7 +21,6 @@ #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/system_clock/system_clock_client.h" #include "components/account_id/account_id.h" -#include "components/arc/mojom/app.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "components/session_manager/core/session_manager.h" #include "content/public/test/browser_task_environment.h"
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc index da13a43..89244aa 100644 --- a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc +++ b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc
@@ -9,6 +9,8 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "ash/components/arc/test/fake_app_instance.h" #include "base/containers/contains.h" #include "base/containers/flat_map.h" @@ -35,8 +37,6 @@ #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/app_permissions.mojom.h" #include "components/services/app_service/public/cpp/app_update.h" #include "components/services/app_service/public/mojom/types.mojom.h" #include "components/webapps/browser/installable/installable_metrics.h"
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc index 7a591f9..13d2125 100644 --- a/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc +++ b/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc
@@ -5,6 +5,8 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -31,8 +33,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/mixin_based_in_process_browser_test.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/app_permissions.mojom.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "content/public/test/browser_test.h"
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc index 612342c..2c8adf4 100644 --- a/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc +++ b/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/time_limits/app_time_controller.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/fake_app_instance.h" #include "ash/components/settings/timezone_settings.h" #include "base/bind.h" @@ -30,7 +31,6 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/dbus/system_clock/system_clock_client.h" -#include "components/arc/mojom/app.mojom.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/services/app_service/public/cpp/icon_loader.h"
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_test_utils.h b/chrome/browser/ash/child_accounts/time_limits/app_time_test_utils.h index 00fa3aa..3e95d128 100644 --- a/chrome/browser/ash/child_accounts/time_limits/app_time_test_utils.h +++ b/chrome/browser/ash/child_accounts/time_limits/app_time_test_utils.h
@@ -7,8 +7,8 @@ #include <memory> +#include "ash/components/arc/mojom/app.mojom.h" #include "base/memory/scoped_refptr.h" -#include "components/arc/mojom/app.mojom.h" namespace extensions { class Extension;
diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index d48da61..8fa69775 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc
@@ -71,6 +71,7 @@ #include "chromeos/crosapi/mojom/video_capture.mojom.h" #include "chromeos/crosapi/mojom/web_page_info.mojom.h" #include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h" +#include "chromeos/tpm/install_attributes.h" #include "components/account_manager_core/account_manager_util.h" #include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_service.h" @@ -388,6 +389,9 @@ params->ash_capabilities = {{kBrowserManagerReloadBrowserCapability}}; + params->is_device_enterprised_managed = + chromeos::InstallAttributes::Get()->IsEnterpriseManaged(); + return params; }
diff --git a/chrome/browser/ash/file_manager/app_service_file_tasks.cc b/chrome/browser/ash/file_manager/app_service_file_tasks.cc index 27f4ccb..b366890 100644 --- a/chrome/browser/ash/file_manager/app_service_file_tasks.cc +++ b/chrome/browser/ash/file_manager/app_service_file_tasks.cc
@@ -9,6 +9,8 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -33,8 +35,6 @@ #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/extensions/api/file_manager_private.h" #include "components/arc/intent_helper/intent_constants.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/services/app_service/public/cpp/intent_util.h" #include "components/services/app_service/public/mojom/types.mojom-shared.h" #include "components/services/app_service/public/mojom/types.mojom.h"
diff --git a/chrome/browser/ash/file_manager/arc_file_tasks.cc b/chrome/browser/ash/file_manager/arc_file_tasks.cc index 60be9d59..9942417e 100644 --- a/chrome/browser/ash/file_manager/arc_file_tasks.cc +++ b/chrome/browser/ash/file_manager/arc_file_tasks.cc
@@ -11,6 +11,8 @@ #include "ash/components/arc/metrics/arc_metrics_constants.h" #include "ash/components/arc/metrics/arc_metrics_service.h" +#include "ash/components/arc/mojom/file_system.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/bind.h" @@ -32,8 +34,6 @@ #include "chrome/common/extensions/api/file_manager_private.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/intent_constants.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/entry_info.h" #include "storage/browser/file_system/file_system_context.h"
diff --git a/chrome/browser/ash/file_manager/documents_provider_root_manager.h b/chrome/browser/ash/file_manager/documents_provider_root_manager.h index d324c84..86806c83 100644 --- a/chrome/browser/ash/file_manager/documents_provider_root_manager.h +++ b/chrome/browser/ash/file_manager/documents_provider_root_manager.h
@@ -8,10 +8,10 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h" -#include "components/arc/mojom/file_system.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h"
diff --git a/chrome/browser/ash/input_method/assistive_suggester.cc b/chrome/browser/ash/input_method/assistive_suggester.cc index edb62ad..cf53c9bf 100644 --- a/chrome/browser/ash/input_method/assistive_suggester.cc +++ b/chrome/browser/ash/input_method/assistive_suggester.cc
@@ -319,7 +319,8 @@ // surrounding text change, which is triggered by a keydown event. As a // result, the next key event after suggesting would be a keyup event of the // same key, and that event is meaningless to us. - if (IsSuggestionShown() && event.type() == ui::ET_KEY_PRESSED) { + if (IsSuggestionShown() && event.type() == ui::ET_KEY_PRESSED && + !event.IsControlDown() && !event.IsAltDown() && !event.IsShiftDown()) { SuggestionStatus status = current_suggester_->HandleKeyEvent(event); switch (status) { case SuggestionStatus::kAccept:
diff --git a/chrome/browser/ash/input_method/assistive_suggester_unittest.cc b/chrome/browser/ash/input_method/assistive_suggester_unittest.cc index 53999d5..82b1bd4 100644 --- a/chrome/browser/ash/input_method/assistive_suggester_unittest.cc +++ b/chrome/browser/ash/input_method/assistive_suggester_unittest.cc
@@ -17,6 +17,8 @@ #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/ime/ash/ime_bridge.h" +#include "ui/events/base_event_utils.h" +#include "ui/events/keycodes/dom/dom_code.h" namespace ash { namespace input_method { @@ -26,6 +28,33 @@ using ::chromeos::ime::TextSuggestionMode; using ::chromeos::ime::TextSuggestionType; +ui::KeyEvent GenerateKeyEvent(const ui::DomCode& code, + const ui::EventType& event_type, + int flags) { + return ui::KeyEvent(event_type, ui::VKEY_UNKNOWN, code, flags, + ui::DomKey::NONE, ui::EventTimeForNow()); +} + +ui::KeyEvent PressKey(const ui::DomCode& code) { + return GenerateKeyEvent(code, ui::EventType::ET_KEY_PRESSED, + ui::EventFlags::EF_NONE); +} + +ui::KeyEvent PressKeyWithAlt(const ui::DomCode& code) { + return GenerateKeyEvent(code, ui::EventType::ET_KEY_PRESSED, + ui::EventFlags::EF_ALT_DOWN); +} + +ui::KeyEvent PressKeyWithCtrl(const ui::DomCode& code) { + return GenerateKeyEvent(code, ui::EventType::ET_KEY_PRESSED, + ui::EventFlags::EF_CONTROL_DOWN); +} + +ui::KeyEvent PressKeyWithShift(const ui::DomCode& code) { + return GenerateKeyEvent(code, ui::EventType::ET_KEY_PRESSED, + ui::EventFlags::EF_SHIFT_DOWN); +} + } // namespace const char kEmojiData[] = "happy,😀;😃;😄"; @@ -571,6 +600,61 @@ AssistiveType::kMultiWordPrediction, 2); } +TEST_F(AssistiveSuggesterMultiWordTest, PressingTabShouldAcceptSuggestion) { + std::vector<TextSuggestion> suggestions = { + TextSuggestion{.mode = TextSuggestionMode::kCompletion, + .type = TextSuggestionType::kMultiWord, + .text = "aren\'t you"}}; + + assistive_suggester_->OnFocus(5); + assistive_suggester_->OnSurroundingTextChanged(u"why ar", 6, 6); + assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); + + EXPECT_TRUE(assistive_suggester_->OnKeyEvent(PressKey(ui::DomCode::TAB))); +} + +TEST_F(AssistiveSuggesterMultiWordTest, AltPlusTabShouldNotAcceptSuggestion) { + std::vector<TextSuggestion> suggestions = { + TextSuggestion{.mode = TextSuggestionMode::kCompletion, + .type = TextSuggestionType::kMultiWord, + .text = "aren\'t you"}}; + + assistive_suggester_->OnFocus(5); + assistive_suggester_->OnSurroundingTextChanged(u"why ar", 6, 6); + assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); + + EXPECT_FALSE( + assistive_suggester_->OnKeyEvent(PressKeyWithAlt(ui::DomCode::TAB))); +} + +TEST_F(AssistiveSuggesterMultiWordTest, CtrlPlusTabShouldNotAcceptSuggestion) { + std::vector<TextSuggestion> suggestions = { + TextSuggestion{.mode = TextSuggestionMode::kCompletion, + .type = TextSuggestionType::kMultiWord, + .text = "aren\'t you"}}; + + assistive_suggester_->OnFocus(5); + assistive_suggester_->OnSurroundingTextChanged(u"why ar", 6, 6); + assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); + + EXPECT_FALSE( + assistive_suggester_->OnKeyEvent(PressKeyWithCtrl(ui::DomCode::TAB))); +} + +TEST_F(AssistiveSuggesterMultiWordTest, ShiftPlusTabShouldNotAcceptSuggestion) { + std::vector<TextSuggestion> suggestions = { + TextSuggestion{.mode = TextSuggestionMode::kCompletion, + .type = TextSuggestionType::kMultiWord, + .text = "aren\'t you"}}; + + assistive_suggester_->OnFocus(5); + assistive_suggester_->OnSurroundingTextChanged(u"why ar", 6, 6); + assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); + + EXPECT_FALSE( + assistive_suggester_->OnKeyEvent(PressKeyWithShift(ui::DomCode::TAB))); +} + class AssistiveSuggesterEmojiTest : public testing::Test { protected: AssistiveSuggesterEmojiTest() {
diff --git a/chrome/browser/ash/input_method/input_method_engine_unittest.cc b/chrome/browser/ash/input_method/input_method_engine_unittest.cc index adc1b175..dc3e271 100644 --- a/chrome/browser/ash/input_method/input_method_engine_unittest.cc +++ b/chrome/browser/ash/input_method/input_method_engine_unittest.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ash/input_method/input_method_configuration.h" #include "chrome/browser/ash/input_method/input_method_engine_base.h" #include "chrome/browser/ash/input_method/mock_input_method_manager_impl.h" +#include "chrome/browser/ash/input_method/stub_input_method_engine_observer.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client_test_helper.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" @@ -77,14 +78,11 @@ InitializeForTesting(manager); } -// TODO(crbug.com/1148157): Use StubInputMethodEngineObserver. -class TestObserver : public InputMethodEngineBase::Observer { +class TestObserver : public StubInputMethodEngineObserver { public: TestObserver() : calls_bitmap_(NONE) {} - TestObserver(const TestObserver&) = delete; TestObserver& operator=(const TestObserver&) = delete; - ~TestObserver() override = default; void OnActivate(const std::string& engine_id) override { @@ -104,33 +102,16 @@ void OnBlur(const std::string& engine_id, int context_id) override { calls_bitmap_ |= ONBLUR; } - void OnTouch(ui::EventPointerType pointerType) override {} void OnKeyEvent( const std::string& engine_id, const ui::KeyEvent& event, ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) override { std::move(callback).Run(/* handled */ true); } - void OnCandidateClicked( - const std::string& engine_id, - int candidate_id, - InputMethodEngineBase::MouseButtonEvent button) override {} - void OnMenuItemActivated(const std::string& engine_id, - const std::string& menu_id) override {} - void OnSurroundingTextChanged(const std::string& engine_id, - const std::u16string& text, - int cursor_pos, - int anchor_pos, - int offset) override {} void OnCompositionBoundsChanged( const std::vector<gfx::Rect>& bounds) override { calls_bitmap_ |= ONCOMPOSITIONBOUNDSCHANGED; } - void OnScreenProjectionChanged(bool is_projected) override {} - - void OnSuggestionsChanged( - const std::vector<std::string>& suggestions) override {} - void OnInputMethodOptionsChanged(const std::string& engine_id) override {} void OnReset(const std::string& engine_id) override { calls_bitmap_ |= RESET;
diff --git a/chrome/browser/ash/input_method/native_input_method_engine_browsertest.cc b/chrome/browser/ash/input_method/native_input_method_engine_browsertest.cc index 6a08c5b..51b6833 100644 --- a/chrome/browser/ash/input_method/native_input_method_engine_browsertest.cc +++ b/chrome/browser/ash/input_method/native_input_method_engine_browsertest.cc
@@ -16,6 +16,7 @@ #include "base/values.h" #include "build/branding_buildflags.h" #include "chrome/browser/ash/input_method/assistive_window_controller.h" +#include "chrome/browser/ash/input_method/stub_input_method_engine_observer.h" #include "chrome/browser/ash/input_method/suggestion_enums.h" #include "chrome/browser/ash/input_method/textinput_test_helper.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" @@ -53,45 +54,19 @@ constexpr char kEmojiData[] = "happy,😀;😃;😄"; -// TODO(crbug.com/1148157): Use StubInputMethodEngineObserver. -class TestObserver : public InputMethodEngineBase::Observer { +class TestObserver : public StubInputMethodEngineObserver { public: TestObserver() = default; ~TestObserver() override = default; TestObserver(const TestObserver&) = delete; TestObserver& operator=(const TestObserver&) = delete; - void OnActivate(const std::string& engine_id) override {} - void OnDeactivated(const std::string& engine_id) override {} - void OnFocus( - const std::string& engine_id, - int context_id, - const ui::IMEEngineHandlerInterface::InputContext& context) override {} - void OnTouch(ui::EventPointerType pointerType) override {} - void OnBlur(const std::string& engine_id, int context_id) override {} void OnKeyEvent( const std::string& engine_id, const ui::KeyEvent& event, ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) override { std::move(callback).Run(/*handled=*/false); } - void OnCandidateClicked( - const std::string& engine_id, - int candidate_id, - InputMethodEngineBase::MouseButtonEvent button) override {} - void OnMenuItemActivated(const std::string& engine_id, - const std::string& menu_id) override {} - void OnSurroundingTextChanged(const std::string& engine_id, - const std::u16string& text, - int cursor_pos, - int anchor_pos, - int offset) override {} - void OnCompositionBoundsChanged( - const std::vector<gfx::Rect>& bounds) override {} - void OnScreenProjectionChanged(bool is_projected) override {} - void OnReset(const std::string& engine_id) override {} - void OnSuggestionsChanged( - const std::vector<std::string>& suggestions) override {} void OnInputMethodOptionsChanged(const std::string& engine_id) override { changed_engine_id_ = engine_id; }
diff --git a/chrome/browser/ash/note_taking_helper.cc b/chrome/browser/ash/note_taking_helper.cc index f9446ce..53a4789d 100644 --- a/chrome/browser/ash/note_taking_helper.cc +++ b/chrome/browser/ash/note_taking_helper.cc
@@ -10,6 +10,9 @@ #include "apps/launcher.h" #include "ash/components/arc/metrics/arc_metrics_constants.h" #include "ash/components/arc/metrics/arc_metrics_service.h" +#include "ash/components/arc/mojom/file_system.mojom.h" +#include "ash/components/arc/mojom/intent_common.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/connection_holder.h" @@ -39,9 +42,6 @@ #include "chrome/browser/web_applications/web_app_id_constants.h" #include "chrome/common/pref_names.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_common.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/prefs/pref_service.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" #include "components/services/app_service/public/cpp/app_update.h"
diff --git a/chrome/browser/ash/note_taking_helper.h b/chrome/browser/ash/note_taking_helper.h index 619ee3f..80553fc1 100644 --- a/chrome/browser/ash/note_taking_helper.h +++ b/chrome/browser/ash/note_taking_helper.h
@@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" @@ -17,7 +18,6 @@ #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" #include "chrome/browser/profiles/profile_manager_observer.h" #include "components/arc/intent_helper/arc_intent_helper_observer.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "components/prefs/pref_change_registrar.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" #include "extensions/browser/extension_registry.h"
diff --git a/chrome/browser/ash/note_taking_helper_unittest.cc b/chrome/browser/ash/note_taking_helper_unittest.cc index b4a85dc7..155e11ae 100644 --- a/chrome/browser/ash/note_taking_helper_unittest.cc +++ b/chrome/browser/ash/note_taking_helper_unittest.cc
@@ -8,6 +8,9 @@ #include <utility> #include "ash/components/arc/arc_prefs.h" +#include "ash/components/arc/mojom/file_system.mojom.h" +#include "ash/components/arc/mojom/intent_common.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/connection_holder.h" @@ -52,9 +55,6 @@ #include "chromeos/dbus/session_manager/fake_session_manager_client.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/file_system.mojom.h" -#include "components/arc/mojom/intent_common.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/arc/test/fake_intent_helper_instance.h" #include "components/crx_file/id_util.h" #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc index abee198..4f2b7f11 100644 --- a/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc +++ b/chrome/browser/ash/policy/reporting/arc_app_install_event_log_collector_unittest.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/constants/ash_switches.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" @@ -20,7 +21,6 @@ #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/shill/shill_service_client.h" #include "chromeos/network/network_handler_test_helper.h" -#include "components/arc/mojom/app.mojom.h" #include "components/policy/proto/device_management_backend.pb.h" #include "components/prefs/pref_service.h" #include "components/prefs/testing_pref_service.h"
diff --git a/chrome/browser/autofill/mock_autofill_popup_controller.h b/chrome/browser/autofill/mock_autofill_popup_controller.h index 8415fa2..8e544b9 100644 --- a/chrome/browser/autofill/mock_autofill_popup_controller.h +++ b/chrome/browser/autofill/mock_autofill_popup_controller.h
@@ -78,8 +78,12 @@ MOCK_CONST_METHOD0(GetPopupType, PopupType()); void set_suggestions(const std::vector<int>& ids) { - for (const auto& id : ids) - suggestions_.push_back(autofill::Suggestion("", "", "", id)); + for (const auto& id : ids) { + // Accessibility requires all focusable AutofillPopupItemView to have + // ui::AXNodeData with non-empty names. We specify dummy values and labels + // to satisfy this. + suggestions_.emplace_back("dummy_value", "dummy_label", "", id); + } } void set_suggestions(const std::vector<Suggestion>& suggestions) {
diff --git a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc index 7bf1d23b..8a16d85 100644 --- a/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc +++ b/chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.cc
@@ -25,8 +25,6 @@ #include "components/permissions/bluetooth_chooser_desktop.h" #include "components/permissions/bluetooth_scanning_prompt_desktop.h" #include "components/strings/grit/components_strings.h" -#include "extensions/browser/app_window/app_window_registry.h" -#include "extensions/browser/extensions_browser_client.h" #endif // OS_ANDROID ChromeBluetoothDelegateImplClient::ChromeBluetoothDelegateImplClient() = @@ -56,13 +54,6 @@ frame, event_handler, std::make_unique<ChromeBluetoothChooserAndroidDelegate>()); #else - if (extensions::AppWindowRegistry::Get(frame->GetBrowserContext()) - ->GetAppWindowForWebContents( - content::WebContents::FromRenderFrameHost(frame))) { - return extensions::ExtensionsBrowserClient::Get()->CreateBluetoothChooser( - frame, event_handler); - } - auto controller = std::make_unique<ChromeBluetoothChooserController>(frame, event_handler); auto controller_weak = controller->GetWeakPtr(); @@ -81,12 +72,6 @@ frame, event_handler, std::make_unique<ChromeBluetoothScanningPromptAndroidDelegate>()); #else - if (extensions::AppWindowRegistry::Get(frame->GetBrowserContext()) - ->GetAppWindowForWebContents( - content::WebContents::FromRenderFrameHost(frame))) { - return nullptr; - } - return std::make_unique<permissions::BluetoothScanningPromptDesktop>( frame, event_handler, CreateExtensionAwareChooserTitle(frame,
diff --git a/chrome/browser/cart/resources/cart_domain_cart_url_mapping.json b/chrome/browser/cart/resources/cart_domain_cart_url_mapping.json index 2e6f1f298..8113091c 100644 --- a/chrome/browser/cart/resources/cart_domain_cart_url_mapping.json +++ b/chrome/browser/cart/resources/cart_domain_cart_url_mapping.json
@@ -71,6 +71,7 @@ "nordstrom.com": "https://www.nordstrom.com/shopping-bag", "officedepot.com": "https://www.officedepot.com/cart/shoppingCart.do", "opticsplanet.com": "https://www.opticsplanet.com/checkout/cart", +"otterbox.com": "https://www.otterbox.com/en-us/cart", "overstock.com": "https://www.overstock.com/cart", "pacsun.com": "https://www.pacsun.com/on/demandware.store/Sites-pacsun-Site/default/Cart-Show", "petsmart.com": "https://www.petsmart.com/cart/",
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 7025cd0..2c9e883 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -80,6 +80,7 @@ "//apps", "//ash", "//ash/components/account_manager", + "//ash/components/arc", "//ash/components/arc/enterprise", "//ash/components/arc/input_overlay/resources:resources_grit", "//ash/components/arc/media_session",
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc index 50a51ee..f13411e 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc
@@ -6,6 +6,7 @@ #include <stddef.h> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/bind.h" @@ -17,7 +18,6 @@ #include "chrome/browser/ui/views/select_file_dialog_extension.h" #include "chrome/common/extensions/api/file_manager_private.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "content/public/browser/browser_thread.h" #include "net/base/mime_util.h" #include "ui/shell_dialogs/selected_file_info.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h index 30ff1681..999215e5e 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h
@@ -10,9 +10,9 @@ #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "chrome/browser/chromeos/extensions/file_manager/logged_extension_function.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" namespace ui { struct SelectedFileInfo;
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc index df44729e..bb827c4 100644 --- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc +++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
@@ -10,6 +10,7 @@ #include <string> #include <utility> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "base/bind.h" #include "base/files/file_path.h" #include "base/metrics/histogram_macros.h" @@ -20,7 +21,6 @@ #include "chrome/browser/ash/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/chromeos/fileapi/recent_file.h" #include "chrome/browser/profiles/profile.h" -#include "components/arc/mojom/file_system.mojom.h" #include "content/public/browser/browser_thread.h" #include "storage/browser/file_system/external_mount_points.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source_unittest.cc b/chrome/browser/chromeos/fileapi/recent_arc_media_source_unittest.cc index 7311744..16045580 100644 --- a/chrome/browser/chromeos/fileapi/recent_arc_media_source_unittest.cc +++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source_unittest.cc
@@ -4,6 +4,7 @@ #include <utility> +#include "ash/components/arc/mojom/file_system.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/connection_holder_util.h" @@ -20,7 +21,6 @@ #include "chrome/browser/chromeos/fileapi/recent_file.h" #include "chrome/browser/chromeos/fileapi/recent_source.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/file_system.mojom.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/enterprise/reporting/android_app_info_generator.cc b/chrome/browser/enterprise/reporting/android_app_info_generator.cc index 148e839..025588ae 100644 --- a/chrome/browser/enterprise/reporting/android_app_info_generator.cc +++ b/chrome/browser/enterprise/reporting/android_app_info_generator.cc
@@ -7,9 +7,9 @@ #include <map> #include <sstream> +#include "ash/components/arc/mojom/app_permissions.mojom.h" #include "base/strings/stringprintf.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "components/arc/mojom/app_permissions.mojom.h" #include "components/policy/proto/device_management_backend.pb.h" namespace em = enterprise_management;
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index cafafea..eeadf3db 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -80,12 +80,8 @@ "api/commands/commands.h", "api/content_settings/content_settings_api.cc", "api/content_settings/content_settings_api.h", - "api/content_settings/content_settings_api_constants.cc", - "api/content_settings/content_settings_api_constants.h", "api/content_settings/content_settings_custom_extension_provider.cc", "api/content_settings/content_settings_custom_extension_provider.h", - "api/content_settings/content_settings_helpers.cc", - "api/content_settings/content_settings_helpers.h", "api/content_settings/content_settings_service.cc", "api/content_settings/content_settings_service.h", "api/content_settings/content_settings_store.cc", @@ -1118,6 +1114,7 @@ } deps += [ "//ash", + "//ash/components/arc", "//ash/components/attestation", "//ash/components/disks", "//ash/components/enhanced_network_tts/mojom", @@ -1158,7 +1155,6 @@ "//chromeos/system", "//chromeos/tpm", "//chromeos/ui/base", - "//components/arc", "//components/constrained_window", "//components/crash/content/browser/error_reporting", "//components/drive",
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index dec4d4c..0416672 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -61,6 +61,7 @@ #include "chromeos/login/login_state/scoped_test_public_session_login_state.h" #include "components/account_id/account_id.h" #include "components/sync/driver/sync_driver_switches.h" +#include "components/user_manager/scoped_user_manager.h" #include "content/public/common/content_switches.h" #include "extensions/browser/extension_dialog_auto_confirm.h" #endif @@ -532,6 +533,10 @@ void SetUp() override { ActiveTabTest::SetUp(); + // These tests need a real user manager. + scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( + ash::ChromeUserManagerImpl::CreateChromeUserManager()); + // Necessary to prevent instantiation of SyncService, which messes // with our signin state below. base::CommandLine::ForCurrentProcess()->AppendSwitch( @@ -578,9 +583,12 @@ ash::ChromeUserManagerImpl::ResetPublicAccountDelegatesForTesting(); ash::ChromeUserManager::Get()->Shutdown(); + scoped_user_manager_.reset(); + ActiveTabTest::TearDown(); } + std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; std::unique_ptr<ScopedTestingLocalState> local_state_; TestWallpaperController test_wallpaper_controller_; std::unique_ptr<WallpaperControllerClientImpl> wallpaper_controller_client_;
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.cc b/chrome/browser/extensions/api/content_settings/content_settings_api.cc index 5a24388..2825be7 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
@@ -17,8 +17,6 @@ #include "base/values.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_api_constants.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h" #include "chrome/browser/extensions/api/content_settings/content_settings_service.h" #include "chrome/browser/extensions/api/content_settings/content_settings_store.h" #include "chrome/browser/extensions/api/preference/preference_api_constants.h" @@ -35,6 +33,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/webplugininfo.h" +#include "extensions/browser/api/content_settings/content_settings_helpers.h" #include "extensions/browser/extension_prefs_scope.h" #include "extensions/browser/extension_util.h" #include "extensions/common/error_utils.h" @@ -72,6 +71,14 @@ return *content_type != ContentSettingsType::DEFAULT; } +// Errors. +constexpr char kIncognitoContextError[] = + "Can't modify regular settings from an incognito context."; +constexpr char kIncognitoSessionOnlyError[] = + "You cannot read incognito content settings when no incognito window " + "is open."; +constexpr char kInvalidUrlError[] = "The URL \"*\" is invalid."; + } // namespace namespace extensions { @@ -98,8 +105,7 @@ } else if (browser_context()->IsOffTheRecord()) { // Incognito profiles can't access regular mode ever, they only exist in // split mode. - return RespondNow( - Error(content_settings_api_constants::kIncognitoContextError)); + return RespondNow(Error(kIncognitoContextError)); } scoped_refptr<ContentSettingsStore> store = @@ -121,16 +127,15 @@ GURL primary_url(params->details.primary_url); if (!primary_url.is_valid()) { - return RespondNow(Error(content_settings_api_constants::kInvalidUrlError, - params->details.primary_url)); + return RespondNow(Error(kInvalidUrlError, params->details.primary_url)); } GURL secondary_url(primary_url); if (params->details.secondary_url.get()) { secondary_url = GURL(*params->details.secondary_url); if (!secondary_url.is_valid()) { - return RespondNow(Error(content_settings_api_constants::kInvalidUrlError, - *params->details.secondary_url)); + return RespondNow( + Error(kInvalidUrlError, *params->details.secondary_url)); } } @@ -147,8 +152,7 @@ if (!profile->HasPrimaryOTRProfile()) { // TODO(bauerb): Allow reading incognito content settings // outside of an incognito session. - return RespondNow( - Error(content_settings_api_constants::kIncognitoSessionOnlyError)); + return RespondNow(Error(kIncognitoSessionOnlyError)); } map = HostContentSettingsMapFactory::GetForProfile( profile->GetPrimaryOTRProfile(/*create_if_needed=*/true)); @@ -285,8 +289,7 @@ // Incognito profiles can't access regular mode ever, they only exist in // split mode. if (browser_context()->IsOffTheRecord()) - return RespondNow( - Error(content_settings_api_constants::kIncognitoContextError)); + return RespondNow(Error(kIncognitoContextError)); } if (scope == kExtensionPrefsScopeIncognitoSessionOnly &&
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api_constants.cc b/chrome/browser/extensions/api/content_settings/content_settings_api_constants.cc deleted file mode 100644 index b47bf925..0000000 --- a/chrome/browser/extensions/api/content_settings/content_settings_api_constants.cc +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/api/content_settings/content_settings_api_constants.h" - -namespace extensions { -namespace content_settings_api_constants { - -// Errors. -const char kIncognitoContextError[] = - "Can't modify regular settings from an incognito context."; -const char kIncognitoSessionOnlyError[] = - "You cannot read incognito content settings when no incognito window " - "is open."; -const char kInvalidUrlError[] = "The URL \"*\" is invalid."; - -} // namespace content_settings_api_constants -} // namespace extensions
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api_constants.h b/chrome/browser/extensions/api/content_settings/content_settings_api_constants.h deleted file mode 100644 index 8f4eba7..0000000 --- a/chrome/browser/extensions/api/content_settings/content_settings_api_constants.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Constants used for the Content Settings API. - -#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_CONSTANTS_H__ -#define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_CONSTANTS_H__ - -namespace extensions { -namespace content_settings_api_constants { - -// Errors. -extern const char kIncognitoContextError[]; -extern const char kIncognitoSessionOnlyError[]; -extern const char kInvalidUrlError[]; - -} // namespace content_settings_api_constants -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_CONSTANTS_H__
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc index 9a1ae4aa..7ba69221 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc
@@ -18,7 +18,6 @@ #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_api_constants.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/permissions/permission_manager_factory.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.cc b/chrome/browser/extensions/api/content_settings/content_settings_store.cc index 3923e3f..b448523 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
@@ -16,7 +16,6 @@ #include "base/notreached.h" #include "base/strings/string_util.h" #include "base/values.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h" #include "components/content_settings/core/browser/content_settings_info.h" #include "components/content_settings/core/browser/content_settings_origin_identifier_value_map.h" #include "components/content_settings/core/browser/content_settings_registry.h" @@ -27,6 +26,7 @@ #include "components/content_settings/core/common/content_settings_utils.h" #include "components/permissions/features.h" #include "content/public/browser/browser_thread.h" +#include "extensions/browser/api/content_settings/content_settings_helpers.h" using content::BrowserThread; using content_settings::ConcatenationIterator;
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index e1705235..56dafd7 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -62,13 +62,13 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/components/arc/arc_util.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/web_applications/web_app_utils.h" -#include "components/arc/mojom/intent_helper.mojom.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
diff --git a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc index bbd940a..47da7d21 100644 --- a/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc +++ b/chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.cc
@@ -569,13 +569,6 @@ "multilingualtyping", base::FeatureList::IsEnabled(chromeos::features::kMultilingualTyping))); features.Append(GenerateFeatureFlag( - "multipaste", base::FeatureList::IsEnabled( - chromeos::features::kVirtualKeyboardMultipaste))); - features.Append(GenerateFeatureFlag( - "multipaste-suggestion", - base::FeatureList::IsEnabled( - chromeos::features::kVirtualKeyboardMultipasteSuggestion))); - features.Append(GenerateFeatureFlag( "imeoptionsinsettings", base::FeatureList::IsEnabled(chromeos::features::kImeOptionsInSettings)));
diff --git a/chrome/browser/extensions/chrome_extension_chooser_dialog.h b/chrome/browser/extensions/chrome_extension_chooser_dialog.h index 27b04a9..ec402669 100644 --- a/chrome/browser/extensions/chrome_extension_chooser_dialog.h +++ b/chrome/browser/extensions/chrome_extension_chooser_dialog.h
@@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_CHOOSER_DIALOG_H_ #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_CHOOSER_DIALOG_H_ -#include "base/memory/raw_ptr.h" +#include <memory> namespace content { class WebContents; @@ -15,25 +15,8 @@ class ChooserController; } -class ChromeExtensionChooserDialog { - public: - explicit ChromeExtensionChooserDialog(content::WebContents* web_contents) - : web_contents_(web_contents) {} - - ChromeExtensionChooserDialog(const ChromeExtensionChooserDialog&) = delete; - ChromeExtensionChooserDialog& operator=(const ChromeExtensionChooserDialog&) = - delete; - - ~ChromeExtensionChooserDialog() {} - - void ShowDialog( - std::unique_ptr<permissions::ChooserController> chooser_controller) const; - - private: - void ShowDialogImpl( - std::unique_ptr<permissions::ChooserController> chooser_controller) const; - - raw_ptr<content::WebContents> web_contents_; -}; +void ShowConstrainedDeviceChooserDialog( + content::WebContents* web_contents, + std::unique_ptr<permissions::ChooserController> controller); #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_CHOOSER_DIALOG_H_
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index 6a19e65..603373b 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -46,7 +46,6 @@ #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h" #include "chrome/browser/safe_browsing/extension_telemetry/tabs_execute_script_signal.h" #include "chrome/browser/task_manager/web_contents_tags.h" -#include "chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" #include "chrome/common/channel_info.h" #include "chrome/common/chrome_paths.h" @@ -464,14 +463,6 @@ ChromeUpdateClientConfig::Create(context, override_url)); } -std::unique_ptr<content::BluetoothChooser> -ChromeExtensionsBrowserClient::CreateBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler) { - return std::make_unique<ChromeExtensionBluetoothChooser>(frame, - event_handler); -} - bool ChromeExtensionsBrowserClient::IsActivityLoggingEnabled( content::BrowserContext* context) { ActivityLog* activity_log = ActivityLog::GetInstance(context);
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.h b/chrome/browser/extensions/chrome_extensions_browser_client.h index d0bee73..626bfc79 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.h +++ b/chrome/browser/extensions/chrome_extensions_browser_client.h
@@ -137,9 +137,6 @@ mojom::ViewType view_type) override; scoped_refptr<update_client::UpdateClient> CreateUpdateClient( content::BrowserContext* context) override; - std::unique_ptr<content::BluetoothChooser> CreateBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler) override; bool IsActivityLoggingEnabled(content::BrowserContext* context) override; void GetTabAndWindowIdForWebContents(content::WebContents* web_contents, int* tab_id,
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc index fc7a206..697ee74 100644 --- a/chrome/browser/extensions/test_extension_system.cc +++ b/chrome/browser/extensions/test_extension_system.cc
@@ -35,6 +35,8 @@ #include "extensions/browser/user_script_manager.h" #include "services/data_decoder/data_decoder_service.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "components/user_manager/fake_user_manager.h" +#include "components/user_manager/scoped_user_manager.h" #include "components/user_manager/user_manager.h" #endif @@ -53,8 +55,10 @@ quota_service_(new QuotaService()), app_sorting_(new ChromeAppSorting(profile_)) { #if BUILDFLAG(IS_CHROMEOS_ASH) - if (!user_manager::UserManager::IsInitialized()) - test_user_manager_ = std::make_unique<ash::ScopedTestUserManager>(); + if (!user_manager::UserManager::IsInitialized()) { + scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( + std::make_unique<user_manager::FakeUserManager>()); + } #endif }
diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h index eea5dc02..b561f15 100644 --- a/chrome/browser/extensions/test_extension_system.h +++ b/chrome/browser/extensions/test_extension_system.h
@@ -13,10 +13,6 @@ #include "extensions/browser/extension_system.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/login/users/scoped_test_user_manager.h" -#endif - class Profile; namespace base { @@ -28,6 +24,12 @@ class BrowserContext; } +#if BUILDFLAG(IS_CHROMEOS_ASH) +namespace user_manager { +class ScopedUserManager; +} // namespace user_manager +#endif + namespace value_store { class TestingValueStore; class TestValueStoreFactory; @@ -119,7 +121,7 @@ in_process_data_decoder_; #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr<ash::ScopedTestUserManager> test_user_manager_; + std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; #endif };
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroController.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroController.java index 4b74c82..c747316 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroController.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroController.java
@@ -155,7 +155,9 @@ // TODO(crbug/1152592): Also check for certificate errors or SafeBrowser warnings. if (tab.isIncognito() || !(url.getScheme().equals("http") || url.getScheme().equals("https"))) { - Log.i(TAG, "No intro: tab is incognito, or URL scheme is not HTTP or HTTPS"); + Log.i(TAG, + "No intro: tab is incognito, or URL scheme is not HTTP or HTTPS" + + url.getValidSpecOrEmpty()); return; } mRecommendationFetcher.beginFetch(tab, url, result -> {
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java index 93cf248..814f8eda 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedFollowIntroControllerTest.java
@@ -186,6 +186,7 @@ mBaseTestValues.addFieldTrialParamOverride( ChromeFeatureList.WEB_FEED, "intro_style", "IPH"); mBaseTestValues.addFeatureFlagOverride(ChromeFeatureList.SNOOZABLE_IPH, false); + mBaseTestValues.addFeatureFlagOverride(ChromeFeatureList.ENABLE_AUTOMATIC_SNOOZE, false); FeatureList.setTestValues(mBaseTestValues); resetWebFeedFollowIntroController();
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 654fbef..be40a1e 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -314,6 +314,14 @@ "expiry_milestone": 96 }, { + "name": "assistant-consent-simplified-text", + "owners": [ + "jds@google.com", + "chrome-voice@google.com" + ], + "expiry_milestone": 103 + }, + { "name": "assistant-consent-v2", "owners": [ "basiaz@google.com", @@ -1506,6 +1514,11 @@ "expiry_milestone": 98 }, { + "name": "enable-automatic-snooze", + "owners": [ "shaktisahu", "haileywang" ], + "expiry_milestone": 101 + }, + { "name": "enable-background-blur", "owners": [ "newcomer" ], "expiry_milestone": 86
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 5d05683..7b61c443 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -268,6 +268,12 @@ "try to use a secure HTTPS connection to look up the addresses of websites " "and other web resources."; +extern const char kAssistantConsentSimplifiedTextName[] = + "AssistantConsentSimplifiedText"; +extern const char kAssistantConsentSimplifiedTextDescription[] = + "Enables simplified consent copy in the Assistant voice search consent " + "dialog."; + extern const char kAssistantConsentV2Name[] = "AssistanConsentV2"; extern const char kAssistantConsentV2Description[] = "Enables different strategies for handling backing off from the consent " @@ -1157,6 +1163,10 @@ const char kMemlogStackModeNativeWithThreadNames[] = "Native with thread names"; const char kMemlogStackModePseudo[] = "Trace events"; +const char kEnableAutomaticSnoozeName[] = "Enable Automatic Snooze"; +const char kEnableAutomaticSnoozeDescription[] = + "Enables automatic snoozing on In-Product Help with no snooze button."; + const char kEnableLensRegionSearchFlagId[] = "enable-lens-region-search"; const char kEnableLensRegionSearchName[] = "Search your screen with Google Lens"; @@ -5177,16 +5187,6 @@ "Always disable virtual keyboard regardless of device mode. Workaround for " "virtual keyboard showing with some external keyboards."; -const char kVirtualKeyboardMultipasteName[] = "Virtual Keyboard MultiPaste"; -const char kVirtualKeyboardMultipasteDescription[] = - "Show virtual keyboard with multipaste UI"; - -const char kVirtualKeyboardMultipasteSuggestionName[] = - "Virtual Keyboard MultiPaste Suggestion"; -const char kVirtualKeyboardMultipasteSuggestionDescription[] = - "Show multipaste items in virtual keyboard suggestion bar if they are " - "copied recently"; - const char kWakeOnWifiAllowedName[] = "Allow enabling wake on WiFi features"; const char kWakeOnWifiAllowedDescription[] = "Allows wake on WiFi features in shill to be enabled.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index a53583f..80aa0de 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -165,6 +165,9 @@ extern const char kAndroidPictureInPictureAPIName[]; extern const char kAndroidPictureInPictureAPIDescription[]; +extern const char kAssistantConsentSimplifiedTextName[]; +extern const char kAssistantConsentSimplifiedTextDescription[]; + extern const char kAssistantConsentV2Name[]; extern const char kAssistantConsentV2Description[]; @@ -357,6 +360,9 @@ extern const char kDnsHttpssvcName[]; extern const char kDnsHttpssvcDescription[]; +extern const char kEnableAutomaticSnoozeName[]; +extern const char kEnableAutomaticSnoozeDescription[]; + extern const char kEnableFirstPartySetsName[]; extern const char kEnableFirstPartySetsDescription[]; @@ -2993,12 +2999,6 @@ extern const char kVirtualKeyboardDisabledName[]; extern const char kVirtualKeyboardDisabledDescription[]; -extern const char kVirtualKeyboardMultipasteName[]; -extern const char kVirtualKeyboardMultipasteDescription[]; - -extern const char kVirtualKeyboardMultipasteSuggestionName[]; -extern const char kVirtualKeyboardMultipasteSuggestionDescription[]; - extern const char kWakeOnWifiAllowedName[]; extern const char kWakeOnWifiAllowedDescription[];
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 7fb28d6..6333997 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -140,6 +140,7 @@ &features::kToolbarUseHardwareBitmapDraw, &features::kWebNfc, &features::kIncognitoNtpRevamp, + &feature_engagement::kEnableAutomaticSnooze, &feature_engagement::kIPHHomepagePromoCardFeature, &feature_engagement::kIPHNewTabPageHomeButtonFeature, &feature_engagement::kIPHSnooze, @@ -167,6 +168,7 @@ &kAllowNewIncognitoTabIntents, &kAndroidLayoutChangeTabReparenting, &kAndroidSearchEngineChoiceNotification, + &kAssistantConsentSimplifiedText, &kAssistantConsentV2, &kAssistantIntentExperimentId, &kAssistantIntentPageUrl, @@ -404,6 +406,9 @@ const base::Feature kAndroidSearchEngineChoiceNotification{ "AndroidSearchEngineChoiceNotification", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kAssistantConsentSimplifiedText{ + "AssistantConsentSimplifiedText", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kAssistantConsentV2{"AssistantConsentV2", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h index 1aba694..23ad9d8 100644 --- a/chrome/browser/flags/android/chrome_feature_list.h +++ b/chrome/browser/flags/android/chrome_feature_list.h
@@ -19,6 +19,7 @@ extern const base::Feature kAllowNewIncognitoTabIntents; extern const base::Feature kAndroidLayoutChangeTabReparenting; extern const base::Feature kAndroidSearchEngineChoiceNotification; +extern const base::Feature kAssistantConsentSimplifiedText; extern const base::Feature kAssistantConsentV2; extern const base::Feature kAssistantIntentExperimentId; extern const base::Feature kAssistantIntentPageUrl;
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index 420b9e07..9af676c 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -221,6 +221,7 @@ public static final String ANDROID_SEARCH_ENGINE_CHOICE_NOTIFICATION = "AndroidSearchEngineChoiceNotification"; public static final String APP_LANGUAGE_PROMPT = "AppLanguagePrompt"; + public static final String ASSISTANT_CONSENT_SIMPLIFIED_TEXT = "AssistantConsentSimplifiedText"; public static final String ASSISTANT_CONSENT_V2 = "AssistantConsentV2"; public static final String ASSISTANT_INTENT_EXPERIMENT_ID = "AssistantIntentExperimentId"; public static final String ASSISTANT_INTENT_PAGE_URL = "AssistantIntentPageUrl"; @@ -330,6 +331,7 @@ public static final String ELIDE_PRIORITIZATION_OF_PRE_NATIVE_BOOTSTRAP_TASKS = "ElidePrioritizationOfPreNativeBootstrapTasks"; public static final String ELIDE_TAB_PRELOAD_AT_STARTUP = "ElideTabPreloadAtStartup"; + public static final String ENABLE_AUTOMATIC_SNOOZE = "EnableAutomaticSnooze"; public static final String ENABLE_DANGEROUS_DOWNLOAD_DIALOG = "EnableDangerousDownloadDialog"; public static final String ENABLE_DUPLICATE_DOWNLOAD_DIALOG = "EnableDuplicateDownloadDialog"; public static final String ENHANCED_PROTECTION_PROMO_CARD = "EnhancedProtectionPromoCard";
diff --git a/chrome/browser/lacros/download_controller_client_lacros.cc b/chrome/browser/lacros/download_controller_client_lacros.cc index cbad098..1c22dd4 100644 --- a/chrome/browser/lacros/download_controller_client_lacros.cc +++ b/chrome/browser/lacros/download_controller_client_lacros.cc
@@ -10,6 +10,7 @@ #include "chromeos/crosapi/mojom/download_controller.mojom.h" #include "chromeos/lacros/lacros_service.h" #include "components/download/public/common/download_item.h" +#include "components/download/public/common/download_item_utils.h" #include "components/download/public/common/simple_download_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/download_item_utils.h" @@ -17,49 +18,12 @@ namespace { -crosapi::mojom::DownloadState ConvertMojoDownloadState( - download::DownloadItem::DownloadState value) { - switch (value) { - case download::DownloadItem::IN_PROGRESS: - return crosapi::mojom::DownloadState::kInProgress; - case download::DownloadItem::COMPLETE: - return crosapi::mojom::DownloadState::kComplete; - case download::DownloadItem::CANCELLED: - return crosapi::mojom::DownloadState::kCancelled; - case download::DownloadItem::INTERRUPTED: - return crosapi::mojom::DownloadState::kInterrupted; - case download::DownloadItem::MAX_DOWNLOAD_STATE: - NOTREACHED(); - return crosapi::mojom::DownloadState::kUnknown; - } -} - crosapi::mojom::DownloadItemPtr ConvertToMojoDownloadItem( download::DownloadItem* item) { - auto* profile = Profile::FromBrowserContext( - content::DownloadItemUtils::GetBrowserContext(item)); - - auto download = crosapi::mojom::DownloadItem::New(); - download->guid = item->GetGuid(); - download->state = ConvertMojoDownloadState(item->GetState()); - download->full_path = item->GetFullPath(); - download->target_file_path = item->GetTargetFilePath(); - download->is_from_incognito_profile = profile->IsIncognitoProfile(); - download->is_paused = item->IsPaused(); - download->has_is_paused = true; - download->open_when_complete = item->GetOpenWhenComplete(); - download->has_open_when_complete = true; - download->received_bytes = item->GetReceivedBytes(); - download->has_received_bytes = true; - download->total_bytes = item->GetTotalBytes(); - download->has_total_bytes = true; - download->start_time = item->GetStartTime(); - download->is_dangerous = item->IsDangerous(); - download->has_is_dangerous = true; - download->is_mixed_content = item->IsMixedContent(); - download->has_is_mixed_content = true; - - return download; + return download::download_item_utils::ConvertToMojoDownloadItem( + item, /*is_from_incognito_profile=*/Profile::FromBrowserContext( + content::DownloadItemUtils::GetBrowserContext(item)) + ->IsIncognitoProfile()); } } // namespace
diff --git a/chrome/browser/media/cast_mirroring_performance_browsertest.cc b/chrome/browser/media/cast_mirroring_performance_browsertest.cc index 8c38041..b36cd51 100644 --- a/chrome/browser/media/cast_mirroring_performance_browsertest.cc +++ b/chrome/browser/media/cast_mirroring_performance_browsertest.cc
@@ -931,12 +931,14 @@ // Returns AUDIO + VIDEO std::pair<openscreen::cast::Stream, openscreen::cast::Stream> GetStreamsFromOffer(const Json::Value& offer_message_body) { - auto offer = openscreen::cast::Offer::Parse(offer_message_body["offer"]); - EXPECT_TRUE(offer); - EXPECT_LT(0u, offer.value().audio_streams.size()); - EXPECT_LT(0u, offer.value().video_streams.size()); - return std::make_pair(offer.value().audio_streams[0].stream, - offer.value().video_streams[0].stream); + openscreen::cast::Offer offer; + EXPECT_TRUE( + openscreen::cast::Offer::TryParse(offer_message_body["offer"], &offer) + .ok()); + EXPECT_LT(0u, offer.audio_streams.size()); + EXPECT_LT(0u, offer.video_streams.size()); + return std::make_pair(offer.audio_streams[0].stream, + offer.video_streams[0].stream); } void SetSharedConfigs(const std::pair<openscreen::cast::Stream,
diff --git a/chrome/browser/media/unified_autoplay_config_unittest.cc b/chrome/browser/media/unified_autoplay_config_unittest.cc index 3fa76927..d6b6ec4 100644 --- a/chrome/browser/media/unified_autoplay_config_unittest.cc +++ b/chrome/browser/media/unified_autoplay_config_unittest.cc
@@ -59,10 +59,25 @@ ->NavigateAndCommit(GURL("https://first.example.com")); } + protected: + base::test::ScopedFeatureList scoped_feature_list_; + private: PrefService* GetPrefs() { return profile()->GetPrefs(); } +}; - base::test::ScopedFeatureList scoped_feature_list_; +// Create a class to test when the feature is disabled. The feature must be +// disabled in the construction of the test harness before the test body is run +// in order to avoid race conditions. +class UnifiedAutoplaySoundSettingsTestFeatureDisabled + : public UnifiedAutoplaySoundSettingsTest { + void SetUp() override { + scoped_feature_list_.InitWithFeatures({}, + {media::kAutoplayDisableSettings}); + ChromeRenderViewHostTestHarness::SetUp(); + + SoundContentSettingObserver::CreateForWebContents(web_contents()); + } }; TEST_F(UnifiedAutoplaySoundSettingsTest, ContentSetting_Allow) { @@ -96,19 +111,6 @@ GetAppliedAutoplayPolicy()); } -TEST_F(UnifiedAutoplaySoundSettingsTest, Feature_DisabledNoop) { - // Explicitly disable the feature. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({}, {media::kAutoplayDisableSettings}); - - SetAutoplayPrefValue(false); - EXPECT_FALSE(ShouldBlockAutoplay()); - - NavigateToTestPage(); - EXPECT_EQ(blink::mojom::AutoplayPolicy::kDocumentUserActivationRequired, - GetAppliedAutoplayPolicy()); -} - TEST_F(UnifiedAutoplaySoundSettingsTest, Pref_DefaultEnabled) { EXPECT_TRUE(ShouldBlockAutoplay()); @@ -161,3 +163,12 @@ EXPECT_EQ(blink::mojom::AutoplayPolicy::kUserGestureRequired, GetAppliedAutoplayPolicy()); } + +TEST_F(UnifiedAutoplaySoundSettingsTestFeatureDisabled, Feature_DisabledNoop) { + SetAutoplayPrefValue(false); + EXPECT_FALSE(ShouldBlockAutoplay()); + + NavigateToTestPage(); + EXPECT_EQ(blink::mojom::AutoplayPolicy::kDocumentUserActivationRequired, + GetAppliedAutoplayPolicy()); +}
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 8efb70d5..cc907a5 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -97,7 +97,7 @@ #include "chrome/browser/signin/identity_manager_factory.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/primary_account_mutator.h" -#endif // BUIDLFLAG(ENABLE_DICE_SUPPORT) +#endif // ENABLE_DICE_SUPPORT using autofill::ParsingResult; using base::ASCIIToUTF16; @@ -4045,7 +4045,7 @@ EXPECT_TRUE(prompt_observer.IsSavePromptAvailable()); } -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // This test suite only applies to Gaia signin page, and checks that the // signin interception bubble and the password bubbles never conflict. class PasswordManagerBrowserTestWithSigninInterception @@ -4218,7 +4218,7 @@ FillAndSubmitGaiaPassword(); EXPECT_FALSE(prompt_observer.IsSavePromptShownAutomatically()); } -#endif // BUIDLFLAG(ENABLE_DICE_SUPPORT) +#endif // ENABLE_DICE_SUPPORT && !BUILDFLAG(IS_CHROMEOS_LACROS) class TestPasswordManagerClient : public ChromePasswordManagerClient { public:
diff --git a/chrome/browser/password_manager/password_manager_interactive_uitest.cc b/chrome/browser/password_manager/password_manager_interactive_uitest.cc index d531cc13..1fcd15c 100644 --- a/chrome/browser/password_manager/password_manager_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_manager_interactive_uitest.cc
@@ -29,14 +29,14 @@ #include "content/public/test/browser_test_utils.h" #include "third_party/blink/public/common/switches.h" -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/password_manager/password_manager_signin_intercept_test_helper.h" #include "chrome/browser/signin/dice_web_signin_interceptor.h" -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // ENABLE_DICE_SUPPORT namespace { -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // Wait until |condition| returns true. void WaitForCondition(base::RepeatingCallback<bool()> condition) { while (!condition.Run()) { @@ -46,7 +46,7 @@ run_loop.Run(); } } -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // ENABLE_DICE_SUPPORT } // namespace @@ -494,7 +494,9 @@ } } -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +// TODO(crbug.com/1198490): Remove explicit !BUILDFLAG(IS_CHROMEOS_LACROS) when +// DICE is not enabled on Lacros. +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // This test suite only applies to Gaia signin page, and checks that the // signin interception bubble and the password bubbles never conflict. class PasswordManagerInteractiveTestWithSigninInterception @@ -578,6 +580,6 @@ navigation_observer.Wait(); EXPECT_TRUE(prompt_observer.IsUpdatePromptShownAutomatically()); } -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // ENABLE_DICE_SUPPORT } // namespace password_manager
diff --git a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.h b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.h index 1fdcf3a..074ec67b 100644 --- a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.h +++ b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_PERFORMANCE_MANAGER_POLICIES_WORKING_SET_TRIMMER_POLICY_ARCVM_H_ #include "ash/components/arc/metrics/arc_metrics_service.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/connection_holder.h" #include "base/memory/memory_pressure_listener.h" @@ -13,7 +14,6 @@ #include "base/time/time.h" #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" #include "chrome/browser/performance_manager/policies/working_set_trimmer_policy_chromeos.h" -#include "components/arc/mojom/app.mojom.h" #include "ui/wm/public/activation_change_observer.h" namespace aura {
diff --git a/chrome/browser/performance_monitor/process_monitor.cc b/chrome/browser/performance_monitor/process_monitor.cc index a79de09..783fce5 100644 --- a/chrome/browser/performance_monitor/process_monitor.cc +++ b/chrome/browser/performance_monitor/process_monitor.cc
@@ -29,6 +29,10 @@ #include "extensions/common/manifest_handlers/background_info.h" #endif +#if defined(OS_WIN) +#include "sandbox/policy/mojom/sandbox.mojom-shared.h" +#endif + using content::BrowserThread; namespace performance_monitor { @@ -185,6 +189,14 @@ // Find all child processes (does not include renderers), which has to be // done on the IO thread. for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { +#if defined(OS_WIN) + // Cannot gather process metrics for elevated process as browser has no + // access to them. + if (iter.GetData().sandbox_type == + sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges) { + continue; + } +#endif ProcessMetadata child_process_data; child_process_data.handle = iter.GetData().GetProcess().Handle(); child_process_data.process_type = iter.GetData().process_type; @@ -203,8 +215,6 @@ processes.push_back(browser_process_data); - // Update metrics for all watched processes; remove dead entries from the map. - return processes; }
diff --git a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc index 26ef703..9314a53 100644 --- a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc +++ b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc
@@ -18,19 +18,8 @@ } } -void LastTabStandingTrackerTabHelper::DidFinishNavigation( - content::NavigationHandle* navigation_handle) { - // TODO(https://crbug.com/1218946): With MPArch there may be multiple main - // frames. This caller was converted automatically to the primary main frame - // to preserve its semantics. Follow up to confirm correctness. - if (!navigation_handle->IsInPrimaryMainFrame() || - !navigation_handle->HasCommitted() || - navigation_handle->IsSameDocument()) { - return; - } - - url::Origin new_origin = - web_contents()->GetMainFrame()->GetLastCommittedOrigin(); +void LastTabStandingTrackerTabHelper::PrimaryPageChanged(content::Page& page) { + url::Origin new_origin = page.GetMainDocument().GetLastCommittedOrigin(); if (last_committed_origin_ && *last_committed_origin_ == new_origin) return; auto* last_tab_standing_tracker =
diff --git a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h index 3657b43..d49ddfac 100644 --- a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h +++ b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h
@@ -23,8 +23,7 @@ const LastTabStandingTrackerTabHelper&) = delete; // content::WebContentObserver - void DidFinishNavigation( - content::NavigationHandle* navigation_handle) override; + void PrimaryPageChanged(content::Page& page) override; void WebContentsDestroyed() override; private:
diff --git a/chrome/browser/policy/chrome_browser_policy_connector.cc b/chrome/browser/policy/chrome_browser_policy_connector.cc index 9ece442..9814e5b 100644 --- a/chrome/browser/policy/chrome_browser_policy_connector.cc +++ b/chrome/browser/policy/chrome_browser_policy_connector.cc
@@ -72,6 +72,8 @@ #if BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/lacros/device_settings_lacros.h" +#include "chromeos/crosapi/mojom/crosapi.mojom.h" +#include "chromeos/lacros/lacros_service.h" #include "components/policy/core/common/policy_loader_lacros.h" #endif @@ -134,8 +136,13 @@ #endif bool ChromeBrowserPolicyConnector::IsDeviceEnterpriseManaged() const { +#if BUILDFLAG(IS_CHROMEOS_LACROS) + auto* lacros_service = chromeos::LacrosService::Get(); + return lacros_service->init_params()->is_device_enterprised_managed; +#else NOTREACHED() << "This method is only defined for Chrome OS"; return false; +#endif } bool ChromeBrowserPolicyConnector::HasMachineLevelPolicies() {
diff --git a/chrome/browser/policy/messaging_layer/proto/synced/README b/chrome/browser/policy/messaging_layer/proto/synced/README index 1400894..b21dc5d 100644 --- a/chrome/browser/policy/messaging_layer/proto/synced/README +++ b/chrome/browser/policy/messaging_layer/proto/synced/README
@@ -1 +1,2 @@ -Files in this directory are automatically generated. Do not modify them. +Files in this directory are synced to other locations. If modifying or adding files, +please see instructions for syncing: google3/chrome/cros/reporting/api/proto/synced/README.md
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc index 01cc5f1..20032900 100644 --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -489,7 +489,9 @@ SigninProfileAttributesUpdaterFactory::GetInstance(); if (site_engagement::SiteEngagementService::IsEnabled()) site_engagement::SiteEngagementServiceFactory::GetInstance(); -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +// TODO(https://crbug.com/1198523: Remove Lacros check once Dice is no longer +// supported on Lacros. +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) SigninManagerFactory::GetInstance(); #endif #if BUILDFLAG(ENABLE_SPELLCHECK)
diff --git a/chrome/browser/resources/pdf/controller.js b/chrome/browser/resources/pdf/controller.js index 4eb15091..027c76ae 100644 --- a/chrome/browser/resources/pdf/controller.js +++ b/chrome/browser/resources/pdf/controller.js
@@ -198,6 +198,7 @@ this.pendingTokens_ = new Map(); this.requestResolverMap_ = new Map(); + this.viewport_.setContent(this.plugin_); this.plugin_.addEventListener( 'message', e => this.handlePluginMessage_(e), false); if (!this.plugin_.postMessage) {
diff --git a/chrome/browser/resources/pdf/ink_controller.js b/chrome/browser/resources/pdf/ink_controller.js index 95b8a5b..9e580f5 100644 --- a/chrome/browser/resources/pdf/ink_controller.js +++ b/chrome/browser/resources/pdf/ink_controller.js
@@ -54,9 +54,6 @@ /** @private {!Viewport} */ this.viewport_; - /** @private {!HTMLDivElement} */ - this.contentElement_; - /** @private {?ViewerInkHostElement} */ this.inkHost_ = null; @@ -66,11 +63,9 @@ /** * @param {!Viewport} viewport - * @param {!HTMLDivElement} contentElement */ - init(viewport, contentElement) { + init(viewport) { this.viewport_ = viewport; - this.contentElement_ = contentElement; } /** @@ -78,9 +73,9 @@ * @override */ get isActive() { - // Check whether `contentElement_` is defined as a signal that `init()` was + // Check whether `viewport_` is defined as a signal that `init()` was // called. - return !!this.contentElement_ && this.isActive_; + return !!this.viewport_ && this.isActive_; } /** @@ -158,7 +153,7 @@ load(filename, data) { if (!this.inkHost_) { const inkHost = document.createElement('viewer-ink-host'); - this.contentElement_.appendChild(inkHost); + this.viewport_.setContent(inkHost); this.inkHost_ = /** @type {!ViewerInkHostElement} */ (inkHost); this.inkHost_.viewport = this.viewport_; inkHost.addEventListener('stroke-added', e => {
diff --git a/chrome/browser/resources/pdf/pdf_viewer.js b/chrome/browser/resources/pdf/pdf_viewer.js index 4e30222..42407ef 100644 --- a/chrome/browser/resources/pdf/pdf_viewer.js +++ b/chrome/browser/resources/pdf/pdf_viewer.js
@@ -303,16 +303,6 @@ // </if> } - /** @override */ - getContent() { - return /** @type {!HTMLDivElement} */ (this.$$('#content')); - } - - /** @override */ - getSizer() { - return /** @type {!HTMLDivElement} */ (this.$$('#sizer')); - } - /** * @return {!ViewerToolbarElement} * @private @@ -328,14 +318,16 @@ /** @param {!BrowserApi} browserApi */ init(browserApi) { - super.init(browserApi); + super.init( + browserApi, /** @type {!HTMLElement} */ (this.$$('#scroller')), + /** @type {!HTMLDivElement} */ (this.$$('#sizer')), + /** @type {!HTMLDivElement} */ (this.$$('#content'))); this.pluginController_ = PluginController.getInstance(); // <if expr="enable_ink"> this.inkController_ = InkController.getInstance(); - this.inkController_.init( - this.viewport, /** @type {!HTMLDivElement} */ (this.getContent())); + this.inkController_.init(this.viewport); this.tracker.add( this.inkController_.getEventTarget(), InkControllerEventType.HAS_UNSAVED_CHANGES,
diff --git a/chrome/browser/resources/pdf/pdf_viewer_base.js b/chrome/browser/resources/pdf/pdf_viewer_base.js index b16113bc..15b33cc 100644 --- a/chrome/browser/resources/pdf/pdf_viewer_base.js +++ b/chrome/browser/resources/pdf/pdf_viewer_base.js
@@ -117,18 +117,6 @@ } /** - * @return {!HTMLDivElement} - * @protected - */ - getContent() {} - - /** - * @return {!HTMLDivElement} - * @protected - */ - getSizer() {} - - /** * @param {!FittingType} view * @protected */ @@ -149,17 +137,26 @@ return this.shadowRoot.querySelector(query); } + /** + * Whether to enable the new UI. + * @return {boolean} + * @protected + */ + isNewUiEnabled() { + return true; + } + /** @return {number} */ getBackgroundColor() { return -1; } /** - * @param {boolean} isPrintPreview Is the plugin for Print Preview. + * Creates the plugin element. * @return {!HTMLEmbedElement} The plugin * @private */ - createPlugin_(isPrintPreview) { + createPlugin_() { // Create the plugin object dynamically. The plugin element is sized to // fill the entire window and is set to be fixed positioning, acting as a // viewport. The plugin renders into this viewport according to the scroll @@ -189,7 +186,7 @@ plugin.toggleAttribute('full-frame', true); } - if (!isPrintPreview) { + if (this.isNewUiEnabled()) { plugin.toggleAttribute('pdf-viewer-update-enabled', true); } @@ -208,8 +205,14 @@ return plugin; } - /** @param {!BrowserApi} browserApi */ - init(browserApi) { + /** + * Initializes the PDF viewer. + * @param {!BrowserApi} browserApi The interface with the browser. + * @param {!HTMLElement} scroller The viewport's scroller element. + * @param {!HTMLDivElement} sizer The viewport's sizer element. + * @param {!HTMLDivElement} content The viewport's content element. + */ + init(browserApi, scroller, sizer, content) { this.browserApi = browserApi; this.originalUrl = this.browserApi.getStreamInfo().originalUrl; @@ -220,13 +223,6 @@ return PluginController.getInstance().getNamedDestination(destination); }); - // Determine the scrolling container. - const isPrintPreview = - document.documentElement.hasAttribute('is-print-preview'); - const scrollContainer = isPrintPreview ? - document.documentElement : - /** @type {!HTMLElement} */ (this.getSizer().offsetParent); - // Create the viewport. const defaultZoom = this.browserApi.getZoomBehavior() === ZoomBehavior.MANAGE ? @@ -234,8 +230,7 @@ 1.0; this.viewport_ = new Viewport( - scrollContainer, this.getSizer(), this.getContent(), - getScrollbarWidth(), defaultZoom); + scroller, sizer, content, getScrollbarWidth(), defaultZoom); this.viewport_.setViewportChangedCallback(() => this.viewportChanged_()); this.viewport_.setBeforeZoomCallback( () => this.currentController.beforeZoom()); @@ -255,8 +250,7 @@ }, false); // Create the plugin. - this.plugin_ = this.createPlugin_(isPrintPreview); - this.getContent().appendChild(this.plugin_); + this.plugin_ = this.createPlugin_(); const pluginController = PluginController.getInstance(); pluginController.init( @@ -306,7 +300,7 @@ if (progress === -1) { // Document load failed. this.showErrorDialog = true; - this.getSizer().style.display = 'none'; + this.viewport_.setContent(null); this.setLoadState(LoadState.FAILED); this.sendDocumentLoadedMessage(); } else if (progress === 100) {
diff --git a/chrome/browser/resources/pdf/pdf_viewer_pp.js b/chrome/browser/resources/pdf/pdf_viewer_pp.js index 9efadf3..d25b9c3d 100644 --- a/chrome/browser/resources/pdf/pdf_viewer_pp.js +++ b/chrome/browser/resources/pdf/pdf_viewer_pp.js
@@ -55,13 +55,8 @@ } /** @override */ - getContent() { - return /** @type {!HTMLDivElement} */ (this.$$('#content')); - } - - /** @override */ - getSizer() { - return /** @type {!HTMLDivElement} */ (this.$$('#sizer')); + isNewUiEnabled() { + return false; } /** @override */ @@ -79,7 +74,10 @@ /** @param {!BrowserApi} browserApi */ init(browserApi) { - super.init(browserApi); + super.init( + browserApi, document.documentElement, + /** @type {!HTMLDivElement} */ (this.$$('#sizer')), + /** @type {!HTMLDivElement} */ (this.$$('#content'))); /** @private {?PluginController} */ this.pluginController_ = PluginController.getInstance();
diff --git a/chrome/browser/resources/pdf/viewport.js b/chrome/browser/resources/pdf/viewport.js index 84f9846f..0f2b1a6 100644 --- a/chrome/browser/resources/pdf/viewport.js +++ b/chrome/browser/resources/pdf/viewport.js
@@ -199,6 +199,28 @@ 'change-zoom', e => this.setZoom(e.detail.zoom)); } + /** + * Sets the contents of the viewport. + * @param {?Node} content The new viewport contents, or null to clear the + * viewport. + */ + setContent(content) { + if (content === null) { + this.sizer_.style.display = 'none'; + return; + } + + // We don't actually replace the content in the DOM, as the controller + // implementations take care of "removal" in controller-specific ways: + // + // 1. Plugin content gets added once, then hidden and revealed using CSS. + // 2. Ink content gets removed directly from the DOM on unload. + if (!content.parentNode) { + this.content_.appendChild(content); + } + assert(content.parentNode === this.content_); + } + /** @param {function():void} viewportChangedCallback */ setViewportChangedCallback(viewportChangedCallback) { this.viewportChangedCallback_ = viewportChangedCallback;
diff --git a/chrome/browser/resources/print_preview/ui/app.ts b/chrome/browser/resources/print_preview/ui/app.ts index fce9b41f..c813e3c 100644 --- a/chrome/browser/resources/print_preview/ui/app.ts +++ b/chrome/browser/resources/print_preview/ui/app.ts
@@ -210,7 +210,7 @@ // Escape key closes the topmost dialog that is currently open within // Print Preview. If no such dialog exists, then the Print Preview dialog // itself is closed. - if (e.key === 'Escape' && !hasKeyModifiers(e)) { + if (e.code === 'Escape' && !hasKeyModifiers(e)) { // Don't close the Print Preview dialog if there is a child dialog open. if (this.openDialogs_.length !== 0) { // Manually cancel the dialog, since we call preventDefault() to prevent @@ -239,7 +239,7 @@ } // On Mac, Cmd+Period should close the print dialog. - if (isMac && e.key === '.' && e.metaKey) { + if (isMac && e.code === 'Period' && e.metaKey) { this.close_(); e.preventDefault(); return; @@ -247,7 +247,7 @@ // Ctrl + Shift + p / Mac equivalent. Doesn't apply on Chrome OS. // <if expr="not chromeos and not lacros"> - if (e.key === 'p') { + if (e.code === 'KeyP') { if ((isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || (!isMac && e.shiftKey && e.ctrlKey && !e.altKey && !e.metaKey)) { // Don't use system dialog if the link isn't available. @@ -267,7 +267,7 @@ } // </if> - if ((e.key === 'Enter' || e.key === 'NumpadEnter') && + if ((e.code === 'Enter' || e.code === 'NumpadEnter') && this.state === State.READY && this.openDialogs_.length === 0) { const activeElementTag = (e.composedPath()[0] as HTMLElement).tagName; if (['CR-BUTTON', 'BUTTON', 'SELECT', 'A', 'CR-CHECKBOX'].includes(
diff --git a/chrome/browser/resources/print_preview/ui/input_mixin.ts b/chrome/browser/resources/print_preview/ui/input_mixin.ts index 48ae8a7..d9b9c6f 100644 --- a/chrome/browser/resources/print_preview/ui/input_mixin.ts +++ b/chrome/browser/resources/print_preview/ui/input_mixin.ts
@@ -63,7 +63,7 @@ * Called when a key is pressed on the input. */ private onKeyDown_(event: KeyboardEvent) { - if (event.key !== 'Enter' && event.key !== 'Tab') { + if (event.code !== 'Enter' && event.code !== 'Tab') { return; }
diff --git a/chrome/browser/resources/print_preview/ui/layout_settings.ts b/chrome/browser/resources/print_preview/ui/layout_settings.ts index fcf60e6..b684e9b 100644 --- a/chrome/browser/resources/print_preview/ui/layout_settings.ts +++ b/chrome/browser/resources/print_preview/ui/layout_settings.ts
@@ -30,8 +30,6 @@ }; } - disabled: boolean; - static get observers() { return ['onLayoutSettingChange_(settings.layout.value)']; } @@ -45,11 +43,5 @@ } } -declare global { - interface HTMLElementTagNameMap { - 'print-preview-layout-settings': PrintPreviewLayoutSettingsElement; - } -} - customElements.define( PrintPreviewLayoutSettingsElement.is, PrintPreviewLayoutSettingsElement);
diff --git a/chrome/browser/resources/print_preview/ui/link_container.ts b/chrome/browser/resources/print_preview/ui/link_container.ts index abdff4f0..8b763c5 100644 --- a/chrome/browser/resources/print_preview/ui/link_container.ts +++ b/chrome/browser/resources/print_preview/ui/link_container.ts
@@ -8,21 +8,11 @@ import './print_preview_vars_css.js'; import './throbber_css.js'; +import {isWindows} from 'chrome://resources/js/cr.m.js'; import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Destination, DestinationOrigin, GooglePromotedDestinationId} from '../data/destination.js'; -export interface PrintPreviewLinkContainerElement { - $: { - // <if expr="is_macosx"> - openPdfInPreviewLink: HTMLDivElement, - openPdfInPreviewThrobber: HTMLDivElement, - // </if> - systemDialogLink: HTMLDivElement, - systemDialogThrobber: HTMLDivElement, - }; -} - export class PrintPreviewLinkContainerElement extends PolymerElement { static get is() { return 'print-preview-link-container'; @@ -79,26 +69,19 @@ if (this.appKioskMode) { return false; } - // <if expr="not is_win"> - return true; - // </if> - // <if expr="is_win"> + if (!isWindows) { + return true; + } return !!this.destination && this.destination.origin === DestinationOrigin.LOCAL && this.destination.id !== GooglePromotedDestinationId.SAVE_AS_PDF; - // </if> } /** * @return Whether the system dialog link should be disabled */ private computeSystemDialogLinkDisabled_(): boolean { - // <if expr="not is_win"> - return false; - // </if> - // <if expr="is_win"> - return this.disabled; - // </if> + return isWindows && this.disabled; } private fire_(eventName: string) {
diff --git a/chrome/browser/resources/print_preview/ui/more_settings.ts b/chrome/browser/resources/print_preview/ui/more_settings.ts index a9378016..a2a2f43c 100644 --- a/chrome/browser/resources/print_preview/ui/more_settings.ts +++ b/chrome/browser/resources/print_preview/ui/more_settings.ts
@@ -13,13 +13,6 @@ import {MetricsContext, PrintSettingsUiBucket} from '../metrics.js'; -interface PrintPreviewMoreSettingsElement { - $: { - label: HTMLElement, - }; -} - - class PrintPreviewMoreSettingsElement extends PolymerElement { static get is() { return 'print-preview-more-settings'; @@ -72,11 +65,5 @@ } } -declare global { - interface HTMLElementTagNameMap { - 'print-preview-more-settings': PrintPreviewMoreSettingsElement; - } -} - customElements.define( PrintPreviewMoreSettingsElement.is, PrintPreviewMoreSettingsElement);
diff --git a/chrome/browser/resources/print_preview/ui/preview_area.ts b/chrome/browser/resources/print_preview/ui/preview_area.ts index 351c334..0dc01ea 100644 --- a/chrome/browser/resources/print_preview/ui/preview_area.ts +++ b/chrome/browser/resources/print_preview/ui/preview_area.ts
@@ -434,7 +434,7 @@ if (!this.pluginProxy_.pluginReady() || !['PageUp', 'PageDown', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'] - .includes(e.key) || + .includes(e.code) || hasKeyModifiers(e)) { return; } @@ -450,7 +450,7 @@ // element, and work up the DOM tree to see if any element has a // scrollbar. If there exists a scrollbar, do not handle the key event // here. - const isEventHorizontal = ['ArrowLeft', 'ArrowRight'].includes(e.key); + const isEventHorizontal = ['ArrowLeft', 'ArrowRight'].includes(e.code); for (let i = 0; i < e.composedPath().length; i++) { const element = e.composedPath()[i] as HTMLElement; if (element.scrollHeight > element.clientHeight && !isEventHorizontal ||
diff --git a/chrome/browser/safe_browsing/chrome_user_population_helper.cc b/chrome/browser/safe_browsing/chrome_user_population_helper.cc index c498aa8..1aba9cac 100644 --- a/chrome/browser/safe_browsing/chrome_user_population_helper.cc +++ b/chrome/browser/safe_browsing/chrome_user_population_helper.cc
@@ -100,9 +100,8 @@ num_loaded_profiles = profile_manager->GetLoadedProfiles().size(); // On ChromeOS multiple profiles doesn't apply, and GetLastOpenedProfiles - // causes -// crashes on ChromeOS. See https://crbug.com/1211793. -#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) + // causes crashes on ChromeOS. See https://crbug.com/1211793. +#if !BUILDFLAG(IS_CHROMEOS_ASH) num_open_profiles = profile_manager->GetLastOpenedProfiles().size(); #endif }
diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc index 6c1f0f0..0093a0e 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.cc +++ b/chrome/browser/signin/account_consistency_mode_manager.cc
@@ -92,7 +92,12 @@ DCHECK(profile_); DCHECK(ShouldBuildServiceForProfile(profile)); -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(IS_CHROMEOS_LACROS) + // Lacros doesn't support account inconsistency. + // TODO(crbug.com/1220066): Remove this section when Lacros stops building + // with DICE. + profile->GetPrefs()->SetBoolean(prefs::kSigninAllowed, true); +#elif BUILDFLAG(ENABLE_DICE_SUPPORT) PrefService* prefs = profile->GetPrefs(); // Propagate settings changes from the previous launch to the signin-allowed // pref. @@ -183,10 +188,17 @@ #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) + bool is_account_manager_available = true; // Account consistency is unavailable on Managed Guest Sessions and Public // Sessions. if (profiles::IsPublicSession()) - return AccountConsistencyMethod::kDisabled; + is_account_manager_available = false; + + if (is_account_manager_available) + return AccountConsistencyMethod::kMirror; + // else: Fall through to ENABLE_DICE_SUPPORT section below. + // TODO(crbug.com/1198490): Return `AccountConsistencyMethod::kDisabled` if + // AccountManager is not available, when DICE has been disabled on Lacros. #endif #if BUILDFLAG(ENABLE_MIRROR)
diff --git a/chrome/browser/signin/account_consistency_mode_manager_unittest.cc b/chrome/browser/signin/account_consistency_mode_manager_unittest.cc index d0a4ee9..53912100 100644 --- a/chrome/browser/signin/account_consistency_mode_manager_unittest.cc +++ b/chrome/browser/signin/account_consistency_mode_manager_unittest.cc
@@ -13,6 +13,7 @@ #include "build/buildflag.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/prefs/browser_prefs.h" +#include "chrome/browser/supervised_user/supervised_user_constants.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "components/prefs/pref_notifier_impl.h" @@ -43,7 +44,7 @@ BuildTestingProfile(/*is_new_profile=*/false); signin::AccountConsistencyMethod method = -#if BUILDFLAG(ENABLE_MIRROR) +#if BUILDFLAG(ENABLE_MIRROR) || BUILDFLAG(IS_CHROMEOS_LACROS) signin::AccountConsistencyMethod::kMirror; #elif BUILDFLAG(ENABLE_DICE_SUPPORT) signin::AccountConsistencyMethod::kDice; @@ -61,7 +62,9 @@ AccountConsistencyModeManager::IsDiceEnabledForProfile(profile.get())); } -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +// TODO(crbug.com/1220066): Remove the lacros exclusion when DICE is disabled on +// Lacros. +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // Checks that changing the signin-allowed pref changes the Dice state on next // startup. TEST(AccountConsistencyModeManagerTest, SigninAllowedChangesDiceState) { @@ -199,9 +202,9 @@ profile.get())); } } -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) -#if BUILDFLAG(ENABLE_MIRROR) +#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) // Mirror is enabled by default on Chrome OS, unless specified otherwise. TEST(AccountConsistencyModeManagerTest, MirrorEnabledByDefault) { // Creation of this object sets the current thread's id as UI thread. @@ -255,5 +258,19 @@ EXPECT_EQ(signin::AccountConsistencyMethod::kDisabled, AccountConsistencyModeManager::GetMethodForProfile(otr_profile)); } +#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(ENABLE_MIRROR) +// Test that Mirror is enabled for child accounts. +TEST(AccountConsistencyModeManagerTest, MirrorChildAccount) { + content::BrowserTaskEnvironment task_environment; + TestingProfile profile; + profile.SetSupervisedUserId(supervised_users::kChildAccountSUID); + EXPECT_TRUE( + AccountConsistencyModeManager::IsMirrorEnabledForProfile(&profile)); + EXPECT_FALSE( + AccountConsistencyModeManager::IsDiceEnabledForProfile(&profile)); + EXPECT_EQ(signin::AccountConsistencyMethod::kMirror, + AccountConsistencyModeManager::GetMethodForProfile(&profile)); +} #endif // BUILDFLAG(ENABLE_MIRROR)
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc index b85dde4..00a7ce5a 100644 --- a/chrome/browser/signin/chrome_signin_helper.cc +++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -207,13 +207,14 @@ class ManageAccountsHeaderReceivedUserData : public base::SupportsUserData::Data {}; -#if BUILDFLAG(ENABLE_MIRROR) // Processes the mirror response header on the UI thread. Currently depending // on the value of |header_value|, it either shows the profile avatar menu, or // opens an incognito window/tab. void ProcessMirrorHeader( ManageAccountsParams manage_accounts_params, const content::WebContents::Getter& web_contents_getter) { +#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || \ + defined(OS_ANDROID) DCHECK_CURRENTLY_ON(content::BrowserThread::UI); GAIAServiceType service_type = manage_accounts_params.service_type; @@ -231,6 +232,8 @@ AccountReconcilor* account_reconcilor = AccountReconcilorFactory::GetForProfile(profile); account_reconcilor->OnReceivedManageAccountsResponse(service_type); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || + // defined(OS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) signin_metrics::LogAccountReconcilorStateOnGaiaResponse( @@ -389,7 +392,6 @@ } #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) } -#endif // BUILDFLAG(ENABLE_MIRROR) #if BUILDFLAG(ENABLE_DICE_SUPPORT) @@ -450,7 +452,6 @@ } #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) -#if BUILDFLAG(ENABLE_MIRROR) // Looks for the X-Chrome-Manage-Accounts response header, and if found, // tries to show the avatar bubble in the browser identified by the // child/route id. Must be called on IO thread. @@ -501,7 +502,6 @@ FROM_HERE, base::BindOnce(ProcessMirrorHeader, params, response->GetWebContentsGetter())); } -#endif #if BUILDFLAG(ENABLE_DICE_SUPPORT) void ProcessDiceResponseHeaderIfExists(ResponseAdapter* response, @@ -635,10 +635,6 @@ if (is_off_the_record) return; // Account consistency is disabled in incognito. - // If new url is eligible to have the header, add it, otherwise remove it. - -// Mirror header: -#if BUILDFLAG(ENABLE_MIRROR) int profile_mode_mask = PROFILE_MODE_DEFAULT; if (incognito_availibility == static_cast<int>(IncognitoModePrefs::Availability::kDisabled) || @@ -654,14 +650,10 @@ } #endif - AppendOrRemoveMirrorRequestHeader( - request, redirect_url, gaia_id, is_child_account, account_consistency, - cookie_settings, profile_mode_mask, kChromeMirrorHeaderSource, - /*force_account_consistency=*/false); -#endif // BUILDFLAG(ENABLE_MIRROR) + // If new url is eligible to have the header, add it, otherwise remove it. -// Dice header: #if BUILDFLAG(ENABLE_DICE_SUPPORT) + // Dice header: bool dice_header_added = AppendOrRemoveDiceRequestHeader( request, redirect_url, gaia_id, is_sync_enabled, account_consistency, cookie_settings, signin_scoped_device_id); @@ -677,6 +669,12 @@ &AccountReconcilorLockWrapper::DestroyAfterDelay, lock_wrapper)); } #endif + + // Mirror header: + AppendOrRemoveMirrorRequestHeader( + request, redirect_url, gaia_id, is_child_account, account_consistency, + cookie_settings, profile_mode_mask, kChromeMirrorHeaderSource, + /*force_account_consistency=*/false); } void ProcessAccountConsistencyResponseHeaders(ResponseAdapter* response, @@ -685,12 +683,10 @@ if (!gaia::IsGaiaSignonRealm(response->GetOrigin())) return; -#if BUILDFLAG(ENABLE_MIRROR) // See if the response contains the X-Chrome-Manage-Accounts header. If so // show the profile avatar bubble so that user can complete signin/out // action the native UI. ProcessMirrorResponseHeaderIfExists(response, is_off_the_record); -#endif #if BUILDFLAG(ENABLE_DICE_SUPPORT) // Process the Dice header: on sign-in, exchange the authorization code for a
diff --git a/chrome/browser/signin/signin_ui_util_unittest.cc b/chrome/browser/signin/signin_ui_util_unittest.cc index 43be4319f..59397971 100644 --- a/chrome/browser/signin/signin_ui_util_unittest.cc +++ b/chrome/browser/signin/signin_ui_util_unittest.cc
@@ -71,7 +71,9 @@ EXPECT_EQ("example-1.com", GetAllowedDomain("email@example-1.com")); } -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +// TODO(https://crbug.com/1198523: Remove Lacros check once Dice is no longer +// supported on Lacros. +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) namespace {
diff --git a/chrome/browser/signin/signin_util_unittest.cc b/chrome/browser/signin/signin_util_unittest.cc index 8086257..ca18cbbb 100644 --- a/chrome/browser/signin/signin_util_unittest.cc +++ b/chrome/browser/signin/signin_util_unittest.cc
@@ -7,8 +7,6 @@ #include <memory> #include "base/feature_list.h" -#include "build/buildflag.h" -#include "build/chromeos_buildflags.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/signin/signin_features.h" @@ -45,7 +43,6 @@ EXPECT_FALSE(signin_util::IsForceSigninEnabled()); } -#if !BUILDFLAG(IS_CHROMEOS_LACROS) class SigninUtilEnterpriseTest : public BrowserWithTestWindowTest { public: SigninUtilEnterpriseTest() @@ -124,4 +121,3 @@ EXPECT_TRUE(signin_util::ProfileSeparationEnforcedByPolicy( profile.get(), "primary_account_strict")); } -#endif
diff --git a/chrome/browser/sync/test/integration/sync_arc_package_helper.h b/chrome/browser/sync/test/integration/sync_arc_package_helper.h index f35c1c8..fed38ab 100644 --- a/chrome/browser/sync/test/integration/sync_arc_package_helper.h +++ b/chrome/browser/sync/test/integration/sync_arc_package_helper.h
@@ -9,8 +9,8 @@ #include <string> #include <unordered_map> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/memory/singleton.h" -#include "components/arc/mojom/app.mojom-forward.h" class Profile; class SyncTest;
diff --git a/chrome/browser/task_manager/providers/arc/arc_process_task.h b/chrome/browser/task_manager/providers/arc/arc_process_task.h index d07f4f9..240a51b 100644 --- a/chrome/browser/task_manager/providers/arc/arc_process_task.h +++ b/chrome/browser/task_manager/providers/arc/arc_process_task.h
@@ -8,13 +8,13 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "ash/components/arc/mojom/process.mojom-forward.h" #include "ash/components/arc/session/connection_observer.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ash/arc/process/arc_process.h" #include "chrome/browser/task_manager/providers/task.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" namespace task_manager {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 2d5a203..4c98e4f5 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -938,8 +938,6 @@ "blocked_content/popunder_preventer.h", "bluetooth/chrome_bluetooth_chooser_controller.cc", "bluetooth/chrome_bluetooth_chooser_controller.h", - "bluetooth/chrome_extension_bluetooth_chooser.cc", - "bluetooth/chrome_extension_bluetooth_chooser.h", "bookmarks/bookmark_bar.h", "bookmarks/bookmark_bubble_observer.h", "bookmarks/bookmark_context_menu_controller.cc", @@ -1966,6 +1964,8 @@ "app_list/search/omnibox_result.h", "app_list/search/os_settings_provider.cc", "app_list/search/os_settings_provider.h", + "app_list/search/ranking/answer_ranker.cc", + "app_list/search/ranking/answer_ranker.h", "app_list/search/ranking/category_item_ranker.cc", "app_list/search/ranking/category_item_ranker.h", "app_list/search/ranking/category_usage_ranker.cc", @@ -2881,6 +2881,7 @@ "//ash/assistant/model", "//ash/assistant/util", "//ash/components/account_manager", + "//ash/components/arc", "//ash/components/audio", "//ash/components/disks", "//ash/components/drivefs", @@ -3210,6 +3211,8 @@ "webui/discards/site_data_provider_impl.h", "webui/signin/inline_login_handler.cc", "webui/signin/inline_login_handler.h", + "webui/signin/inline_login_ui.cc", + "webui/signin/inline_login_ui.h", "webui/signin/signin_web_dialog_ui.cc", "webui/signin/signin_web_dialog_ui.h", "webui/signin/sync_confirmation_handler.cc", @@ -3223,13 +3226,6 @@ ] } - if (is_win || is_mac || is_linux || is_chromeos_ash || is_fuchsia) { - sources += [ - "webui/signin/inline_login_ui.cc", - "webui/signin/inline_login_ui.h", - ] - } - if (enable_one_click_signin) { sources += [ "sync/one_click_signin_links_delegate.h", @@ -3253,17 +3249,14 @@ sources += [ "profile_picker.cc", "profile_picker.h", - "signin/profile_customization_bubble_sync_controller.h", + "signin_reauth_view_controller.cc", + "signin_reauth_view_controller.h", "startup/default_browser_infobar_delegate.cc", "startup/default_browser_infobar_delegate.h", "startup/default_browser_prompt.cc", "startup/default_browser_prompt.h", "views/profiles/badged_profile_photo.cc", "views/profiles/badged_profile_photo.h", - "views/profiles/profile_customization_bubble_sync_controller.cc", - "views/profiles/profile_customization_bubble_sync_controller.h", - "views/profiles/profile_customization_bubble_view.cc", - "views/profiles/profile_customization_bubble_view.h", "views/profiles/profile_menu_view.cc", "views/profiles/profile_menu_view.h", "views/profiles/profile_picker_force_signin_dialog_delegate.cc", @@ -3287,16 +3280,16 @@ "webui/settings/system_handler.h", "webui/signin/dice_turn_sync_on_helper.cc", "webui/signin/dice_turn_sync_on_helper.h", + "webui/signin/dice_turn_sync_on_helper_delegate_impl.cc", + "webui/signin/dice_turn_sync_on_helper_delegate_impl.h", "webui/signin/enterprise_profile_welcome_handler.cc", "webui/signin/enterprise_profile_welcome_handler.h", "webui/signin/enterprise_profile_welcome_ui.cc", "webui/signin/enterprise_profile_welcome_ui.h", + "webui/signin/inline_login_handler_impl.cc", + "webui/signin/inline_login_handler_impl.h", "webui/signin/profile_creation_customize_themes_handler.cc", "webui/signin/profile_creation_customize_themes_handler.h", - "webui/signin/profile_customization_handler.cc", - "webui/signin/profile_customization_handler.h", - "webui/signin/profile_customization_ui.cc", - "webui/signin/profile_customization_ui.h", "webui/signin/profile_picker_handler.cc", "webui/signin/profile_picker_handler.h", "webui/signin/profile_picker_ui.cc", @@ -3317,6 +3310,24 @@ "webui/signin/signin_ui_error.h", "webui/signin/signin_utils_desktop.cc", "webui/signin/signin_utils_desktop.h", + "webui/welcome/bookmark_handler.cc", + "webui/welcome/bookmark_handler.h", + "webui/welcome/bookmark_item.cc", + "webui/welcome/bookmark_item.h", + "webui/welcome/google_apps_handler.cc", + "webui/welcome/google_apps_handler.h", + "webui/welcome/helpers.cc", + "webui/welcome/helpers.h", + "webui/welcome/ntp_background_fetcher.cc", + "webui/welcome/ntp_background_fetcher.h", + "webui/welcome/ntp_background_handler.cc", + "webui/welcome/ntp_background_handler.h", + "webui/welcome/set_as_default_handler.cc", + "webui/welcome/set_as_default_handler.h", + "webui/welcome/welcome_handler.cc", + "webui/welcome/welcome_handler.h", + "webui/welcome/welcome_ui.cc", + "webui/welcome/welcome_ui.h", ] deps += [ @@ -3332,10 +3343,13 @@ "passwords/account_storage_auth_helper.h", "signin/dice_web_signin_interceptor_delegate.cc", "signin/dice_web_signin_interceptor_delegate.h", - "signin_reauth_view_controller.cc", - "signin_reauth_view_controller.h", + "signin/profile_customization_bubble_sync_controller.h", "views/profiles/dice_web_signin_interception_bubble_view.cc", "views/profiles/dice_web_signin_interception_bubble_view.h", + "views/profiles/profile_customization_bubble_sync_controller.cc", + "views/profiles/profile_customization_bubble_sync_controller.h", + "views/profiles/profile_customization_bubble_view.cc", + "views/profiles/profile_customization_bubble_view.h", "views/profiles/profile_picker_dice_sign_in_provider.cc", "views/profiles/profile_picker_dice_sign_in_provider.h", "views/profiles/profile_picker_dice_sign_in_toolbar.cc", @@ -3344,32 +3358,14 @@ "views/sync/dice_bubble_sync_promo_view.h", "views/sync/dice_signin_button_view.cc", "views/sync/dice_signin_button_view.h", - "webui/signin/dice_turn_sync_on_helper_delegate_impl.cc", - "webui/signin/dice_turn_sync_on_helper_delegate_impl.h", "webui/signin/dice_web_signin_intercept_handler.cc", "webui/signin/dice_web_signin_intercept_handler.h", "webui/signin/dice_web_signin_intercept_ui.cc", "webui/signin/dice_web_signin_intercept_ui.h", - "webui/signin/inline_login_handler_impl.cc", - "webui/signin/inline_login_handler_impl.h", - "webui/welcome/bookmark_handler.cc", - "webui/welcome/bookmark_handler.h", - "webui/welcome/bookmark_item.cc", - "webui/welcome/bookmark_item.h", - "webui/welcome/google_apps_handler.cc", - "webui/welcome/google_apps_handler.h", - "webui/welcome/helpers.cc", - "webui/welcome/helpers.h", - "webui/welcome/ntp_background_fetcher.cc", - "webui/welcome/ntp_background_fetcher.h", - "webui/welcome/ntp_background_handler.cc", - "webui/welcome/ntp_background_handler.h", - "webui/welcome/set_as_default_handler.cc", - "webui/welcome/set_as_default_handler.h", - "webui/welcome/welcome_handler.cc", - "webui/welcome/welcome_handler.h", - "webui/welcome/welcome_ui.cc", - "webui/welcome/welcome_ui.h", + "webui/signin/profile_customization_handler.cc", + "webui/signin/profile_customization_handler.h", + "webui/signin/profile_customization_ui.cc", + "webui/signin/profile_customization_ui.h", ] } }
diff --git a/chrome/browser/ui/android/omnibox/BUILD.gn b/chrome/browser/ui/android/omnibox/BUILD.gn index 4d9de4f..155b55d 100644 --- a/chrome/browser/ui/android/omnibox/BUILD.gn +++ b/chrome/browser/ui/android/omnibox/BUILD.gn
@@ -298,6 +298,7 @@ "java/res/drawable/trending_up_black_24dp.xml", "java/res/layout-sw600dp/location_bar.xml", "java/res/layout/assistant_voice_search_consent_ui.xml", + "java/res/layout/assistant_voice_search_simplified_consent_ui.xml", "java/res/layout/location_bar.xml", "java/res/layout/location_bar_base.xml", "java/res/layout/location_status.xml",
diff --git a/chrome/browser/ui/android/omnibox/java/res/layout/assistant_voice_search_simplified_consent_ui.xml b/chrome/browser/ui/android/omnibox/java/res/layout/assistant_voice_search_simplified_consent_ui.xml new file mode 100644 index 0000000..688c2f63 --- /dev/null +++ b/chrome/browser/ui/android/omnibox/java/res/layout/assistant_voice_search_simplified_consent_ui.xml
@@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/avs_consent_ui" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:gravity="center_horizontal" + android:paddingHorizontal="20dp" + android:paddingVertical="10dp" + android:importantForAccessibility="no"> + + <ImageView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:src="@drawable/ic_logo_assistant_24dp" + android:importantForAccessibility="no"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:layout_marginHorizontal="30dp" + android:textAlignment="center" + style="@style/TextAppearance.Headline.Primary" + android:text="@string/avs_consent_ui_simplified_title" /> + + <View + style="@style/HorizontalDivider" + android:layout_marginTop="20dp" + android:layout_marginHorizontal="30dp" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="14dp" + style="@style/TextAppearance.TextSmall.Secondary" + android:text="@string/avs_consent_ui_simplified_body" /> + + <TextView + android:id="@+id/avs_consent_ui_learn_more" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + style="@style/TextAppearance.TextSmall.Blue" + android:text="@string/learn_more" /> + + <org.chromium.components.browser_ui.widget.DualControlLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + app:buttonAlignment="apart" + app:primaryButtonText="@string/avs_consent_ui_simplified_accept" + app:secondaryButtonText="@string/avs_consent_ui_simplified_deny" + app:stackedMargin="@dimen/button_bar_stacked_margin" /> +</LinearLayout>
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchConsentUi.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchConsentUi.java index e721da8..74b0b4f 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchConsentUi.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchConsentUi.java
@@ -17,6 +17,7 @@ import androidx.annotation.VisibleForTesting; import org.chromium.base.Callback; +import org.chromium.base.FeatureList; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.PostTask; import org.chromium.base.task.TaskTraits; @@ -116,8 +117,15 @@ mWindowAndroid = windowAndroid; mWindowAndroid.addActivityStateObserver(this); - mContentView = LayoutInflater.from(context).inflate( - R.layout.assistant_voice_search_consent_ui, /* root= */ null); + if (FeatureList.isInitialized() + && ChromeFeatureList.isEnabled( + ChromeFeatureList.ASSISTANT_CONSENT_SIMPLIFIED_TEXT)) { + mContentView = LayoutInflater.from(context).inflate( + R.layout.assistant_voice_search_simplified_consent_ui, /* root= */ null); + } else { + mContentView = LayoutInflater.from(context).inflate( + R.layout.assistant_voice_search_consent_ui, /* root= */ null); + } mBottomSheetObserver = new EmptyBottomSheetObserver() { @Override
diff --git a/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegate.java b/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegate.java index 750941be..c7f5ea9 100644 --- a/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegate.java +++ b/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegate.java
@@ -24,7 +24,6 @@ * contains as much of the widget logic for the Quick Action Search Widget as possible. */ public class QuickActionSearchWidgetProviderDelegate { - private final @LayoutRes int mLayoutRes; private final ComponentName mSearchActivityComponent; private final Intent mStartIncognitoTabIntent; private final Intent mStartDinoGameIntent; @@ -37,10 +36,8 @@ * events will be propagated. * @param startIncognitoIntent A trusted intent starting a new Incognito tab. */ - public QuickActionSearchWidgetProviderDelegate(@LayoutRes int layoutRes, - @NonNull ComponentName searchActivityComponent, @NonNull Intent startIncognitoTabIntent, - @NonNull Intent startDinoGameIntent) { - mLayoutRes = layoutRes; + public QuickActionSearchWidgetProviderDelegate(@NonNull ComponentName searchActivityComponent, + @NonNull Intent startIncognitoTabIntent, @NonNull Intent startDinoGameIntent) { mSearchActivityComponent = searchActivityComponent; mStartIncognitoTabIntent = startIncognitoTabIntent; mStartDinoGameIntent = startDinoGameIntent; @@ -53,12 +50,13 @@ * widget. * * @param context The {@link Context} from which the widget is being updated. + * @param layoutRes The Layout to inflate. * @param prefs Structure describing current preferences and feature availability. * @return Widget RemoteViews structure describing layout and content of the widget. */ - public RemoteViews createWidgetRemoteViews( - @NonNull Context context, @NonNull SearchActivityPreferences prefs) { - RemoteViews remoteViews = new RemoteViews(context.getPackageName(), mLayoutRes); + public RemoteViews createWidgetRemoteViews(@NonNull Context context, @LayoutRes int layoutRes, + @NonNull SearchActivityPreferences prefs) { + RemoteViews remoteViews = new RemoteViews(context.getPackageName(), layoutRes); // Search Bar Intent PendingIntent textSearchPendingIntent = createPendingIntentForAction(
diff --git a/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegateTest.java b/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegateTest.java index 68e7374..014bd78 100644 --- a/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegateTest.java +++ b/chrome/browser/ui/android/quickactionsearchwidget/java/src/org/chromium/chrome/browser/ui/quickactionsearchwidget/QuickActionSearchWidgetProviderDelegateTest.java
@@ -71,8 +71,7 @@ ComponentName searchActivityComponent = new ComponentName(mContext, SearchActivity.class); - mDelegate = new QuickActionSearchWidgetProviderDelegate( - R.layout.quick_action_search_widget_medium_layout, searchActivityComponent, + mDelegate = new QuickActionSearchWidgetProviderDelegate(searchActivityComponent, IntentHandler.createTrustedOpenNewTabIntent(mContext, /*incognito=*/true), createDinoIntent(mContext)); @@ -135,7 +134,10 @@ AppWidgetManager widgetManager = AppWidgetManager.getInstance(mContext); SearchActivityPreferences prefs = new SearchActivityPreferences("EngineName", "http://engine", true, true, true); - mWidgetView = mDelegate.createWidgetRemoteViews(mContext, prefs).apply(mContext, null); + mWidgetView = mDelegate + .createWidgetRemoteViews(mContext, + R.layout.quick_action_search_widget_medium_layout, prefs) + .apply(mContext, null); } /**
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index e700b64..4fe24de 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -5250,6 +5250,18 @@ <message name="IDS_AVS_CONSENT_UI_CLOSED_DESCRIPTION" desc="Enable button text for a dialog asking the user's permission to use Assistant for voice search."> Assistant voice search consent ui closed </message> + <message name="IDS_AVS_CONSENT_UI_SIMPLIFIED_TITLE" desc="Simplified title for a dialog asking the user's permission to use Assistant for voice search."> + Get a better voice experience + </message> + <message name="IDS_AVS_CONSENT_UI_SIMPLIFIED_BODY" desc="Simplified body for a dialog asking the user's permission to use Assistant for voice search."> + Knowing the URLs of sites allows Google Assistant to help you complete tasks. You can turn off Assistant in Chrome settings. + </message> + <message name="IDS_AVS_CONSENT_UI_SIMPLIFIED_ACCEPT" desc="Button text for the accept button for a dialog asking the user's permission to use Assistant for voice search."> + Yes, I’m in + </message> + <message name="IDS_AVS_CONSENT_UI_SIMPLIFIED_DENY" desc="Button text for the deny button for a dialog asking the user's permission to use Assistant for voice search."> + No thanks + </message> <!-- Assistant settings strings--> <message name="IDS_AVS_SETTING_CATEGORY_TITLE" desc="Title of the Assistant voice search setting category.">
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_ACCEPT.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_ACCEPT.png.sha1 new file mode 100644 index 0000000..dea47a5 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_ACCEPT.png.sha1
@@ -0,0 +1 @@ +7dedd196044d48433b72d3fa715557a87a27b1fe \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_BODY.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_BODY.png.sha1 new file mode 100644 index 0000000..687a2f0 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_BODY.png.sha1
@@ -0,0 +1 @@ +eb0b34b084dd8cad3be0ba82adbede5f50337449 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_DENY.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_DENY.png.sha1 new file mode 100644 index 0000000..3ec3a74 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_DENY.png.sha1
@@ -0,0 +1 @@ +00257b1ae378cf1373b429f5dd73464fc78b7d13 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_TITLE.png.sha1 new file mode 100644 index 0000000..f7608ff --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_AVS_CONSENT_UI_SIMPLIFIED_TITLE.png.sha1
@@ -0,0 +1 @@ +57e5d7db5bc682912fe92f01084158d7bd885230 \ No newline at end of file
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java index 4ac45edc..4b5da4c 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/IncognitoToggleTabLayout.java
@@ -94,14 +94,18 @@ public void onTabModelSelected(TabModel newModel, TabModel oldModel) { setStateBasedOnModel(); } + + @Override + public void onTabStateInitialized() { + updateTabSwitcherDrawableCount(); + } }; mTabModelSelector.addObserver(mTabModelSelectorObserver); setStateBasedOnModel(); - assert mTabModelSelector.isTabStateInitialized(); - mTabSwitcherDrawable.updateForTabCount( - mTabModelSelector.getTabModelFilterProvider().getTabModelFilter(false).getCount(), - false); + if (mTabModelSelector.isTabStateInitialized()) { + updateTabSwitcherDrawableCount(); + } } public void setTabCountProvider(TabCountProvider tabCountProvider) { @@ -173,4 +177,10 @@ : R.string.accessibility_tab_switcher_standard_stack_selected; announceForAccessibility(getResources().getString(stackAnnouncementId)); } + + private void updateTabSwitcherDrawableCount() { + mTabSwitcherDrawable.updateForTabCount( + mTabModelSelector.getTabModelFilterProvider().getTabModelFilter(false).getCount(), + false); + } }
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc index 248e602..fe0b19fa 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
@@ -12,6 +12,7 @@ #include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/arc_util.h" #include "ash/components/arc/compat_mode/arc_resize_lock_manager.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/connection_holder.h" @@ -45,7 +46,6 @@ #include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h" #include "chrome/common/chrome_features.h" #include "chrome/grit/generated_resources.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "components/crx_file/id_util.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/scoped_user_pref_update.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h index c3cb394..cc09fa6a 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -15,6 +15,8 @@ #include <vector> #include "ash/components/arc/compat_mode/arc_resize_lock_pref_delegate.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/session/connection_observer.h" #include "base/callback.h" #include "base/files/file_path.h" @@ -27,8 +29,6 @@ #include "chrome/browser/ash/arc/policy/arc_policy_bridge.h" #include "chrome/browser/ash/arc/session/arc_session_manager_observer.h" #include "chrome/browser/ui/app_list/arc/arc_app_icon_descriptor.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/layout.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h index 7582213a..9cc8600 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h
@@ -8,9 +8,9 @@ #include <memory> #include <unordered_map> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "ash/components/arc/session/connection_holder.h" #include "base/memory/singleton.h" -#include "components/arc/mojom/app.mojom-forward.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" class ArcAppListPrefs;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_test.h b/chrome/browser/ui/app_list/arc/arc_app_test.h index b813ad8..1b30956 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_test.h +++ b/chrome/browser/ui/app_list/arc/arc_app_test.h
@@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "components/arc/mojom/app.mojom-forward.h" +#include "ash/components/arc/mojom/app.mojom-forward.h" namespace arc { namespace mojom {
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc index de5adb5..af9f6f8 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -15,6 +15,8 @@ #include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/arc_util.h" #include "ash/components/arc/metrics/arc_metrics_constants.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -76,8 +78,6 @@ #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "components/arc/test/fake_intent_helper_instance.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" #include "components/services/app_service/public/cpp/app_types.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc index 90306a5..1a8356a 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
@@ -14,6 +14,7 @@ #include "ash/components/arc/arc_util.h" #include "ash/components/arc/metrics/arc_metrics_constants.h" #include "ash/components/arc/metrics/arc_metrics_service.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/check.h" @@ -53,7 +54,6 @@ #include "chrome/common/pref_names.h" #include "components/app_restore/app_restore_utils.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/language/core/browser/pref_names.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_context.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.h b/chrome/browser/ui/app_list/arc/arc_app_utils.h index 13cd0e0..afee809 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_utils.h +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.h
@@ -11,9 +11,9 @@ #include <vector> #include "ash/components/arc/metrics/arc_metrics_constants.h" +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/observer_list_types.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "components/arc/mojom/app.mojom-forward.h" #include "components/services/app_service/public/mojom/types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chrome/browser/ui/app_list/arc/arc_pai_starter.h b/chrome/browser/ui/app_list/arc/arc_pai_starter.h index f15397e2..b672aab 100644 --- a/chrome/browser/ui/app_list/arc/arc_pai_starter.h +++ b/chrome/browser/ui/app_list/arc/arc_pai_starter.h
@@ -7,12 +7,12 @@ #include <vector> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" -#include "components/arc/mojom/app.mojom-forward.h" class PrefService; class Profile;
diff --git a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc index 39380aaf..03c7592 100644 --- a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc +++ b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h" #include "ash/components/arc/arc_util.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -21,7 +22,6 @@ #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/arc/mojom/app.mojom.h" #include "components/user_manager/scoped_user_manager.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h"
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_app_result.h b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_app_result.h index ee4f4ce9..f134fe1c 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_app_result.h +++ b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_app_result.h
@@ -7,9 +7,9 @@ #include <string> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/public/cpp/app_list/app_list_metrics.h" #include "chrome/browser/ui/app_list/search/chrome_search_result.h" -#include "components/arc/mojom/app.mojom.h" #include "ui/gfx/image/image_skia.h" namespace app_list {
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc index 7b22ee2..6286533 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc
@@ -7,6 +7,7 @@ #include <map> #include <utility> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/fake_app_instance.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/app_list/app_list_features.h" @@ -23,7 +24,6 @@ #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/mojom/app.mojom.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "extensions/grit/extensions_browser_resources.h"
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_shortcut_search_result.h b/chrome/browser/ui/app_list/search/arc/arc_app_shortcut_search_result.h index b5a3dd28..9987af8 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_shortcut_search_result.h +++ b/chrome/browser/ui/app_list/search/arc/arc_app_shortcut_search_result.h
@@ -8,10 +8,10 @@ #include <memory> #include <string> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/public/cpp/app_list/app_list_metrics.h" #include "chrome/browser/ui/app_icon_loader_delegate.h" #include "chrome/browser/ui/app_list/search/chrome_search_result.h" -#include "components/arc/mojom/app.mojom.h" #include "ui/gfx/image/image_skia.h" class AppListControllerDelegate;
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider.h b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider.h index 83ee544..df34fc1d 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider.h +++ b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider.h
@@ -8,9 +8,9 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/app_list/search/search_provider.h" -#include "components/arc/mojom/app.mojom-forward.h" class AppListControllerDelegate; class Profile;
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc index d68b5fb..a69cfff 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/public/cpp/app_list/app_list_features.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/strcat.h" @@ -22,7 +23,6 @@ #include "chrome/browser/ui/app_list/arc/arc_app_test.h" #include "chrome/browser/ui/app_list/search/chrome_search_result.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace app_list {
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc index 9b94652..fd384cd 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "ash/components/arc/app/arc_playstore_search_request_state.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/bind.h" @@ -18,7 +19,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h" -#include "components/arc/app/arc_playstore_search_request_state.h" namespace { constexpr int kHistogramBuckets = 13;
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h index d982742..637742a 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider.h
@@ -7,9 +7,9 @@ #include <vector> +#include "ash/components/arc/mojom/app.mojom-forward.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/app_list/search/search_provider.h" -#include "components/arc/mojom/app.mojom-forward.h" class Profile; class AppListControllerDelegate;
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider_unittest.cc index ae30338..92be08f6 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_provider_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <utility> +#include "ash/components/arc/app/arc_playstore_search_request_state.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -20,7 +21,6 @@ #include "chrome/browser/ui/app_list/search/chrome_search_result.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/test/base/testing_profile.h" -#include "components/arc/app/arc_playstore_search_request_state.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h"
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc index 65e10b7..b1e40a5 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/public/cpp/app_list/app_list_config.h" @@ -19,7 +20,6 @@ #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/arc/arc_playstore_app_context_menu.h" #include "chrome/browser/ui/app_list/search/search_tags_util.h" -#include "components/arc/mojom/app.mojom.h" #include "components/crx_file/id_util.h" #include "ui/base/models/image_model.h" #include "ui/gfx/canvas.h"
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h index ba79060..493355b 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h +++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
@@ -9,11 +9,11 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/public/cpp/app_list/app_list_metrics.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/search/chrome_search_result.h" -#include "components/arc/mojom/app.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" class AppListControllerDelegate;
diff --git a/chrome/browser/ui/app_list/search/ranking/answer_ranker.cc b/chrome/browser/ui/app_list/search/ranking/answer_ranker.cc new file mode 100644 index 0000000..88f6420 --- /dev/null +++ b/chrome/browser/ui/app_list/search/ranking/answer_ranker.cc
@@ -0,0 +1,23 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/ranking/answer_ranker.h" + +namespace app_list { + +AnswerRanker::AnswerRanker() = default; +AnswerRanker::~AnswerRanker() = default; + +void AnswerRanker::Start(const std::u16string& query, + ResultsMap& results, + CategoriesList& categories) { + // TODO(crbug.com/1275408): WIP. +} + +void AnswerRanker::UpdateResultRanks(ResultsMap& results, + ProviderType provider) { + // TODO(crbug.com/1275408): WIP. +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/answer_ranker.h b/chrome/browser/ui/app_list/search/ranking/answer_ranker.h new file mode 100644 index 0000000..55cdcdb6b --- /dev/null +++ b/chrome/browser/ui/app_list/search/ranking/answer_ranker.h
@@ -0,0 +1,32 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_ANSWER_RANKER_H_ +#define CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_ANSWER_RANKER_H_ + +#include "chrome/browser/ui/app_list/search/ranking/ranker.h" +#include "chrome/browser/ui/app_list/search/ranking/types.h" + +namespace app_list { + +// A ranker that selects at most one result to be an Answer card. It will modify +// the DisplayType of the selected answer only. +class AnswerRanker : public Ranker { + public: + AnswerRanker(); + ~AnswerRanker() override; + + AnswerRanker(const AnswerRanker&) = delete; + AnswerRanker& operator=(const AnswerRanker&) = delete; + + // Ranker: + void Start(const std::u16string& query, + ResultsMap& results, + CategoriesList& categories) override; + void UpdateResultRanks(ResultsMap& results, ProviderType provider) override; +}; + +} // namespace app_list + +#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_ANSWER_RANKER_H_
diff --git a/chrome/browser/ui/ash/assistant/assistant_context_util.cc b/chrome/browser/ui/ash/assistant/assistant_context_util.cc index c715bfc..df70bc8f 100644 --- a/chrome/browser/ui/ash/assistant/assistant_context_util.cc +++ b/chrome/browser/ui/ash/assistant/assistant_context_util.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/bind.h" @@ -15,7 +16,6 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chromeos/ui/base/window_properties.h" -#include "components/arc/mojom/app.mojom.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "ui/accessibility/ax_assistant_structure.h"
diff --git a/chrome/browser/ui/ash/assistant/device_actions.cc b/chrome/browser/ui/ash/assistant/device_actions.cc index 49688f0..c1d4add 100644 --- a/chrome/browser/ui/ash/assistant/device_actions.cc +++ b/chrome/browser/ui/ash/assistant/device_actions.cc
@@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/constants/ash_pref_names.h" @@ -23,7 +24,6 @@ #include "chromeos/dbus/power_manager/backlight.pb.h" #include "chromeos/network/network_event_log.h" #include "chromeos/network/network_state_handler.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/prefs/pref_service.h" #include "components/user_manager/user_manager.h" #include "ui/display/types/display_constants.h"
diff --git a/chrome/browser/ui/ash/chrome_new_window_client.cc b/chrome/browser/ui/ash/chrome_new_window_client.cc index 8f41e8d..caea33b 100644 --- a/chrome/browser/ui/ash/chrome_new_window_client.cc +++ b/chrome/browser/ui/ash/chrome_new_window_client.cc
@@ -10,6 +10,7 @@ #include "apps/launcher.h" #include "ash/components/arc/arc_util.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/app_list/internal_app_id_constants.h" #include "ash/public/cpp/keyboard_shortcut_viewer.h" @@ -70,7 +71,6 @@ #include "chrome/common/webui_url_constants.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/custom_tab.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/services/app_service/public/cpp/intent_util.h" #include "components/services/app_service/public/cpp/types_util.h" #include "components/services/app_service/public/mojom/types.mojom.h" @@ -695,8 +695,8 @@ std::move(web_contents), /* foreground= */ true); // TODO(crbug.com/955171): Remove this temporary conversion to InterfacePtr - // once OnOpenCustomTab from //components/arc/mojom/intent_helper.mojom could - // take pending_remote directly. Refer to crrev.com/c/1868870. + // once OnOpenCustomTab from //ash/components/arc/mojom/intent_helper.mojom + // could take pending_remote directly. Refer to crrev.com/c/1868870. auto custom_tab_remote( CustomTabSessionImpl::Create(std::move(custom_tab), custom_tab_browser)); std::move(callback).Run(std::move(custom_tab_remote));
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_downloads_delegate.cc b/chrome/browser/ui/ash/holding_space/holding_space_downloads_delegate.cc index c267a4c..9858a42 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_downloads_delegate.cc +++ b/chrome/browser/ui/ash/holding_space/holding_space_downloads_delegate.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/holding_space/holding_space_util.h" #include "components/download/public/common/download_item.h" +#include "components/download/public/common/download_item_utils.h" #include "components/download/public/common/simple_download_manager.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/browser_context.h" @@ -38,55 +39,19 @@ // Helpers --------------------------------------------------------------------- -// Returns a mojo download state converted from the specified item `state`. -crosapi::mojom::DownloadState ConvertToMojoDownloadState( - download::DownloadItem::DownloadState state) { - switch (state) { - case download::DownloadItem::IN_PROGRESS: - return crosapi::mojom::DownloadState::kInProgress; - case download::DownloadItem::COMPLETE: - return crosapi::mojom::DownloadState::kComplete; - case download::DownloadItem::CANCELLED: - return crosapi::mojom::DownloadState::kCancelled; - case download::DownloadItem::INTERRUPTED: - return crosapi::mojom::DownloadState::kInterrupted; - case download::DownloadItem::MAX_DOWNLOAD_STATE: - return crosapi::mojom::DownloadState::kUnknown; - } -} - // Returns a mojo download item converted from the specified `item`. crosapi::mojom::DownloadItemPtr ConvertToMojoDownloadItem( const download::DownloadItem* item) { - auto mojo_download_item = crosapi::mojom::DownloadItem::New(); - mojo_download_item->guid = item->GetGuid(); - mojo_download_item->state = ConvertToMojoDownloadState(item->GetState()); - mojo_download_item->target_file_path = item->GetTargetFilePath(); - mojo_download_item->full_path = item->GetFullPath(); - mojo_download_item->is_paused = item->IsPaused(); - mojo_download_item->has_is_paused = true; - mojo_download_item->open_when_complete = item->GetOpenWhenComplete(); - mojo_download_item->has_open_when_complete = true; - mojo_download_item->received_bytes = item->GetReceivedBytes(); - mojo_download_item->has_received_bytes = true; - mojo_download_item->total_bytes = item->GetTotalBytes(); - mojo_download_item->has_total_bytes = true; - mojo_download_item->start_time = item->GetStartTime(); - mojo_download_item->is_dangerous = item->IsDangerous(); - mojo_download_item->has_is_dangerous = true; - mojo_download_item->is_mixed_content = item->IsMixedContent(); - mojo_download_item->has_is_mixed_content = true; - // NOTE: `browser_context` may be `nullptr` in tests. We assume in this case // that the item is not from an incognito profile; tests exercising incognito // behavior should make sure `browser_context` is not `nullptr`. auto* browser_context = content::DownloadItemUtils::GetBrowserContext(item); - mojo_download_item->is_from_incognito_profile = + const bool is_from_incognito_profile = browser_context ? Profile::FromBrowserContext(browser_context)->IsIncognitoProfile() : false; - - return mojo_download_item; + return download::download_item_utils::ConvertToMojoDownloadItem( + item, is_from_incognito_profile); } // Returns a `gfx::ImageSkia` to show as a placeholder in a holding space image
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.h b/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.h index 5b7eb80e..31de2e8 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.h +++ b/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.h
@@ -8,6 +8,7 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/file_system.mojom-forward.h" #include "ash/components/arc/session/connection_holder.h" #include "ash/components/arc/session/connection_observer.h" #include "ash/components/drivefs/drivefs_host_observer.h" @@ -20,7 +21,6 @@ #include "chrome/browser/chromeos/fileapi/file_change_service_observer.h" #include "chrome/browser/ui/ash/holding_space/holding_space_keyed_service_delegate.h" #include "chrome/browser/ui/ash/holding_space/holding_space_util.h" -#include "components/arc/mojom/file_system.mojom-forward.h" namespace base { class FilePath;
diff --git a/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc b/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc index c3a733f..109fae8 100644 --- a/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc +++ b/chrome/browser/ui/ash/keyboard_shortcut_viewer_metadata_unittest.cc
@@ -24,9 +24,9 @@ namespace { // The total number of Ash accelerators. -constexpr int kAshAcceleratorsTotalNum = 134; +constexpr int kAshAcceleratorsTotalNum = 135; // The hash of Ash accelerators. -constexpr char kAshAcceleratorsHash[] = "fa5ce79337b4c24766e97caf126f414d"; +constexpr char kAshAcceleratorsHash[] = "0b18bee490324b5f9a101e1d7fe97ea7"; #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // Internal builds add an extra accelerator for the Feedback app. // The total number of Chrome accelerators (available on Chrome OS).
diff --git a/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.h b/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.h index b3433e1..be556efd 100644 --- a/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.h +++ b/chrome/browser/ui/ash/shelf/arc_shelf_spinner_item_controller.h
@@ -9,6 +9,7 @@ #include <string> +#include "ash/components/arc/mojom/app.mojom.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" #include "base/timer/timer.h" @@ -16,7 +17,6 @@ #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/ash/shelf/shelf_spinner_item_controller.h" -#include "components/arc/mojom/app.mojom.h" // ArcShelfSpinnerItemController displays the icon of the ARC app that // cannot be launched immediately (due to ARC not being ready) on Chrome OS'
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc index cc8cbc96..27a90ac 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -16,6 +16,8 @@ #include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/metrics/arc_metrics_constants.h" +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/compatibility_mode.mojom.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/fake_app_instance.h" #include "ash/constants/ash_features.h" @@ -114,8 +116,6 @@ #include "chromeos/dbus/concierge/concierge_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "components/account_id/account_id.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/compatibility_mode.mojom.h" #include "components/exo/shell_surface_util.h" #include "components/keep_alive_registry/scoped_keep_alive.h" #include "components/prefs/pref_notifier_impl.h"
diff --git a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc index 2cfbf3ca1..9bbc354 100644 --- a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc +++ b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "ash/components/arc/metrics/arc_metrics_constants.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/fake_app_instance.h" #include "ash/public/cpp/app_menu_constants.h" #include "ash/public/cpp/shelf_item.h" @@ -53,7 +54,6 @@ #include "chromeos/dbus/concierge/concierge_client.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/seneschal/seneschal_client.h" -#include "components/arc/mojom/app.mojom.h" #include "components/exo/shell_surface_util.h" #include "components/prefs/pref_service.h" #include "components/session_manager/core/session_manager.h"
diff --git a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc b/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc deleted file mode 100644 index 06085c2..0000000 --- a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h" - -#include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" -#include "chrome/browser/ui/bluetooth/chrome_bluetooth_chooser_controller.h" -#include "content/public/browser/web_contents.h" - -ChromeExtensionBluetoothChooser::ChromeExtensionBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler) { - auto controller = - std::make_unique<ChromeBluetoothChooserController>(frame, event_handler); - // Since ChromeExtensionBluetoothChooser object is destroyed before the - // view object which owns |bluetooth_chooser_controller_| when the chooser - // bubble/dialog closes, it is safe to store and use the raw pointer here. - bluetooth_chooser_controller_ = controller.get(); - chooser_dialog_ = std::make_unique<ChromeExtensionChooserDialog>( - content::WebContents::FromRenderFrameHost(frame)); - chooser_dialog_->ShowDialog(std::move(controller)); -} - -ChromeExtensionBluetoothChooser::~ChromeExtensionBluetoothChooser() {} - -void ChromeExtensionBluetoothChooser::SetAdapterPresence( - AdapterPresence presence) { - bluetooth_chooser_controller_->OnAdapterPresenceChanged(presence); -} - -void ChromeExtensionBluetoothChooser::ShowDiscoveryState(DiscoveryState state) { - bluetooth_chooser_controller_->OnDiscoveryStateChanged(state); -} - -void ChromeExtensionBluetoothChooser::AddOrUpdateDevice( - const std::string& device_id, - bool should_update_name, - const std::u16string& device_name, - bool is_gatt_connected, - bool is_paired, - int signal_strength_level) { - bluetooth_chooser_controller_->AddOrUpdateDevice( - device_id, should_update_name, device_name, is_gatt_connected, is_paired, - signal_strength_level); -}
diff --git a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h b/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h deleted file mode 100644 index 782f900..0000000 --- a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h +++ /dev/null
@@ -1,55 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_BLUETOOTH_CHROME_EXTENSION_BLUETOOTH_CHOOSER_H_ -#define CHROME_BROWSER_UI_BLUETOOTH_CHROME_EXTENSION_BLUETOOTH_CHOOSER_H_ - -#include <memory> - -#include "base/memory/raw_ptr.h" -#include "content/public/browser/bluetooth_chooser.h" - -class ChromeExtensionChooserDialog; - -namespace content { -class RenderFrameHost; -} - -namespace permissions { -class BluetoothChooserController; -} - -// Represents a Bluetooth chooser to ask the user to select a Bluetooth -// device from a list of options. This implementation is for extensions. -class ChromeExtensionBluetoothChooser : public content::BluetoothChooser { - public: - ChromeExtensionBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler); - - ChromeExtensionBluetoothChooser(const ChromeExtensionBluetoothChooser&) = - delete; - ChromeExtensionBluetoothChooser& operator=( - const ChromeExtensionBluetoothChooser&) = delete; - - ~ChromeExtensionBluetoothChooser() override; - - // content::BluetoothChooser: - void SetAdapterPresence(AdapterPresence presence) override; - void ShowDiscoveryState(DiscoveryState state) override; - void AddOrUpdateDevice(const std::string& device_id, - bool should_update_name, - const std::u16string& device_name, - bool is_gatt_connected, - bool is_paired, - int signal_strength_level) override; - - private: - // Weak. DeviceChooserContentView[Cocoa] owns it. - raw_ptr<permissions::BluetoothChooserController> - bluetooth_chooser_controller_; - std::unique_ptr<ChromeExtensionChooserDialog> chooser_dialog_; -}; - -#endif // CHROME_BROWSER_UI_BLUETOOTH_CHROME_EXTENSION_BLUETOOTH_CHOOSER_H_
diff --git a/chrome/browser/ui/breadcrumb_manager_browser_agent_unittest.cc b/chrome/browser/ui/breadcrumb_manager_browser_agent_unittest.cc new file mode 100644 index 0000000..cc92782 --- /dev/null +++ b/chrome/browser/ui/breadcrumb_manager_browser_agent_unittest.cc
@@ -0,0 +1,116 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/breadcrumb_manager_browser_agent.h" + +#include "base/feature_list.h" +#include "chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/test/base/browser_with_test_window_test.h" +#include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" +#include "components/breadcrumbs/core/features.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/web_contents_tester.h" +#include "testing/gtest/include/gtest/gtest.h" + +// Test fixture for testing BreadcrumbManagerBrowserAgent class. +class BreadcrumbManagerBrowserAgentTest : public BrowserWithTestWindowTest { + protected: + BreadcrumbManagerBrowserAgentTest() { + scoped_feature_list_.InitWithFeatures({breadcrumbs::kLogBreadcrumbs}, {}); + } + + void SetUp() override { + BrowserWithTestWindowTest::SetUp(); + breadcrumb_service_ = + static_cast<breadcrumbs::BreadcrumbManagerKeyedService*>( + BreadcrumbManagerKeyedServiceFactory::GetForBrowserContext( + profile())); + } + + void InsertTab(Browser* browser) { + std::unique_ptr<content::WebContents> contents = + content::WebContentsTester::CreateTestWebContents(profile(), nullptr); + browser->tab_strip_model()->AppendWebContents(std::move(contents), + /*foreground=*/true); + } + + std::list<std::string> GetEvents() const { + return breadcrumb_service_->GetEvents(/*event_count_limit=*/0); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; + breadcrumbs::BreadcrumbManagerKeyedService* breadcrumb_service_ = nullptr; +}; + +// Tests that an event logged by the BrowserAgent is returned with events for +// the associated tab. +TEST_F(BreadcrumbManagerBrowserAgentTest, LogEvent) { + ASSERT_EQ(0u, GetEvents().size()); + InsertTab(browser()); + EXPECT_EQ(1u, GetEvents().size()); +} + +// Tests that events logged through BrowserAgents associated with different +// Browser instances are returned with events for the associated tab and are +// uniquely identifiable. +TEST_F(BreadcrumbManagerBrowserAgentTest, MultipleBrowsers) { + ASSERT_EQ(0u, GetEvents().size()); + + // Insert tab into `browser`. + InsertTab(browser()); + + // Create and set up second Browser. + Browser::CreateParams create_params(profile(), false); + std::unique_ptr<BrowserWindow> test_window = CreateBrowserWindow(); + create_params.window = test_window.get(); + std::unique_ptr<Browser> browser2(Browser::Create(create_params)); + EXPECT_TRUE(browser2); + + // Insert tab into `browser2`. + InsertTab(browser2.get()); + + const std::list<std::string> events = GetEvents(); + EXPECT_EQ(2u, events.size()); + const std::string event1 = events.front(); + const std::string event2 = events.back(); + + // Separately compare the start and end of the event strings to ensure + // uniqueness at both the Browser and tab layer. + const size_t event1_split_pos = event1.find("Insert"); + const size_t event2_split_pos = event2.find("Insert"); + + // The start of the string must be unique to differentiate the associated + // Browser object by including the BreadcrumbManagerBrowserAgent's + // `unique_id_`. + // (The timestamp will match due to TimeSource::MOCK_TIME in the `task_env_`.) + const std::string event1_browser_part = event1.substr(event1_split_pos); + const std::string event2_browser_part = event2.substr(event2_split_pos); + EXPECT_NE(event1_browser_part, event2_browser_part); + + // The end of the string must be unique because the tabs are different + // and that needs to be represented in the event string. + const std::string event1_tab_part = + event1.substr(event1_split_pos, event1.length() - event1_split_pos); + const std::string event2_tab_part = + event2.substr(event2_split_pos, event2.length() - event2_split_pos); + EXPECT_NE(event1_tab_part, event2_tab_part); + + // Empty `browser2`'s tab strip so that it can be destroyed. + browser2->tab_strip_model()->CloseAllTabs(); +} + +// Tests batch closing. +TEST_F(BreadcrumbManagerBrowserAgentTest, BatchOperations) { + InsertTab(browser()); + InsertTab(browser()); + + // Close multiple tabs. + browser()->tab_strip_model()->CloseAllTabs(); + const std::list<std::string> events = GetEvents(); + ASSERT_EQ(3u, events.size()); + EXPECT_NE(std::string::npos, events.back().find("Closed 2 tabs")) + << events.back(); +}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 970a4c8..5ae65ab 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -1878,13 +1878,6 @@ FileSelectHelper::EnumerateDirectory(web_contents, std::move(listener), path); } -bool Browser::CanEnterFullscreenModeForTab( - content::RenderFrameHost* requesting_frame, - const blink::mojom::FullscreenOptions& options) { - return exclusive_access_manager_->fullscreen_controller() - ->CanEnterFullscreenModeForTab(requesting_frame, options.display_id); -} - void Browser::EnterFullscreenModeForTab( content::RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) {
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 10e4e20..3c4525ae 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -849,9 +849,6 @@ void EnumerateDirectory(content::WebContents* web_contents, scoped_refptr<content::FileSelectListener> listener, const base::FilePath& path) override; - bool CanEnterFullscreenModeForTab( - content::RenderFrameHost* requesting_frame, - const blink::mojom::FullscreenOptions& options) override; void EnterFullscreenModeForTab( content::RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) override;
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc index cf2a4ef..391865d 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -47,14 +47,6 @@ const char kFullscreenBubbleReshowsHistogramName[] = "ExclusiveAccess.BubbleReshowsPerSession.Fullscreen"; -bool IsAnotherScreen(WebContents* web_contents, const int64_t display_id) { - if (display_id == display::kInvalidDisplayId) - return false; - auto* screen = display::Screen::GetScreen(); - auto display = screen->GetDisplayNearestView(web_contents->GetNativeView()); - return display_id != display.id(); -} - } // namespace FullscreenController::FullscreenController(ExclusiveAccessManager* manager) @@ -126,32 +118,10 @@ return state_prior_to_tab_fullscreen_ == STATE_NORMAL; } -bool FullscreenController::CanEnterFullscreenModeForTab( - content::RenderFrameHost* requesting_frame, - const int64_t display_id) { - DCHECK(requesting_frame); - auto* web_contents = WebContents::FromRenderFrameHost(requesting_frame); - DCHECK(web_contents); - - if ((web_contents != - exclusive_access_manager()->context()->GetActiveWebContents() || - IsWindowFullscreenForTabOrPending()) && - !IsAnotherScreen(web_contents, display_id)) - return false; - - return true; -} - void FullscreenController::EnterFullscreenModeForTab( content::RenderFrameHost* requesting_frame, const int64_t display_id) { DCHECK(requesting_frame); - // This function should never fail. Any possible failures must be checked in - // |CanEnterFullscreenModeForTab()| instead. Silently dropping the request - // could cause requestFullscreen promises to hang. If we are in this function, - // the renderer expects a visual property update to call - // |blink::FullscreenController::DidEnterFullscreen| to resolve promises. - DCHECK(CanEnterFullscreenModeForTab(requesting_frame, display_id)); auto* web_contents = WebContents::FromRenderFrameHost(requesting_frame); DCHECK(web_contents); @@ -161,6 +131,24 @@ return; } + auto* screen = display::Screen::GetScreen(); + bool requesting_another_screen = false; + auto display = screen->GetDisplayNearestView(web_contents->GetNativeView()); + requesting_another_screen = + display_id != display.id() && display_id != display::kInvalidDisplayId; + if ((web_contents != + exclusive_access_manager()->context()->GetActiveWebContents() || + IsWindowFullscreenForTabOrPending()) && + !requesting_another_screen) { + // TODO(enne): this early out (and other early outs in this function) + // could cause requestFullscreen promises to hang. If we are in this + // function, the renderer expects a visual property update to call + // blink::FullscreenController::DidEnterFullscreen to resolve promises. + // This needs to be refactored to send more explicit/nuanced feedback + // to the renderer, rather than just silently dropping these requests. + return; + } + SetTabWithExclusiveAccess(web_contents); requesting_origin_ = requesting_frame->GetLastCommittedURL().DeprecatedGetOriginAsURL(); @@ -171,8 +159,7 @@ // UI style. exclusive_access_context->UpdateUIForTabFullscreen(); - if (!exclusive_access_context->IsFullscreen() || - IsAnotherScreen(web_contents, display_id)) { + if (!exclusive_access_context->IsFullscreen() || requesting_another_screen) { // Normal -> Tab Fullscreen. state_prior_to_tab_fullscreen_ = STATE_NORMAL; EnterFullscreenModeInternal(TAB, requesting_frame, display_id);
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h index 112cf0b2a..6cfeb5a 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h
@@ -106,20 +106,12 @@ // previously in user-initiated fullscreen). bool IsFullscreenCausedByTab() const; - // Returns whether entering fullscreen with |EnterFullscreenModeForTab()| is - // allowed. - bool CanEnterFullscreenModeForTab( - content::RenderFrameHost* requesting_frame, - const int64_t display_id = display::kInvalidDisplayId); - // Enter tab-initiated fullscreen mode. FullscreenController decides whether // to also fullscreen the browser window. See 'FullscreenWithinTab Note'. // |requesting_frame| is the specific content frame requesting fullscreen. // If the Window Placement experiment is enabled, fullscreen may be requested // on a particular display. In that case, |display_id| is the display's id; // otherwise, display::kInvalidDisplayId indicates no display is specified. - // - // |CanEnterFullscreenModeForTab()| must return true on entry. void EnterFullscreenModeForTab( content::RenderFrameHost* requesting_frame, const int64_t display_id = display::kInvalidDisplayId);
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc index d7d901e..1d2c84c85 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc
@@ -277,11 +277,8 @@ content::WebContents* const active_tab = GetBrowser()->tab_strip_model()->GetActiveWebContents(); if (event == TAB_FULLSCREEN_TRUE) { - if (GetFullscreenController()->CanEnterFullscreenModeForTab( - active_tab->GetMainFrame())) { - GetFullscreenController()->EnterFullscreenModeForTab( - active_tab->GetMainFrame()); - } + GetFullscreenController()->EnterFullscreenModeForTab( + active_tab->GetMainFrame()); } else { GetFullscreenController()->ExitFullscreenModeForTab(active_tab); }
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 27eeb97..5d1acc6 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -25,7 +25,6 @@ #include "base/threading/thread_restrictions.h" #include "build/branding_buildflags.h" #include "build/build_config.h" -#include "build/buildflag.h" #include "build/chromeos_buildflags.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" @@ -96,7 +95,6 @@ #include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/policy_constants.h" #include "components/prefs/pref_service.h" -#include "components/signin/public/base/signin_buildflags.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" @@ -123,6 +121,7 @@ #include "chrome/browser/ui/profile_picker.h" #include "chrome/browser/ui/webui/signin/profile_picker_handler.h" #include "chrome/browser/ui/webui/signin/profile_picker_ui.h" +#include "chrome/browser/ui/webui/welcome/helpers.h" #include "components/policy/core/common/external_data_fetcher.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_types.h" @@ -140,10 +139,6 @@ #include "ui/views/widget/widget.h" #endif -#if BUILDFLAG(ENABLE_DICE_SUPPORT) -#include "chrome/browser/ui/webui/welcome/helpers.h" -#endif - #if defined(OS_WIN) || defined(OS_MAC) || \ (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) #include "chrome/browser/ui/startup/web_app_url_handling_startup_test_utils.h" @@ -2947,9 +2942,7 @@ class StartupBrowserCreatorFirstRunTest : public InProcessBrowserTest { public: StartupBrowserCreatorFirstRunTest() { -#if BUILDFLAG(ENABLE_DICE_SUPPORT) scoped_feature_list_.InitWithFeatures({welcome::kForceEnabled}, {}); -#endif } StartupBrowserCreatorFirstRunTest(const StartupBrowserCreatorFirstRunTest&) = delete;
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index c4eadbf3..69c7c8ec 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -346,17 +346,17 @@ !SessionStartupPref::TypeHasRecommendedValue(profile_->GetPrefs()); } - // TODO(https://crbug.com/1276034): Cleanup this code, in particular on Ash - // where the welcome flow is never shown. bool welcome_enabled = true; -#if BUILDFLAG(IS_CHROMEOS_LACROS) - if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile_)) - welcome_enabled = false; -#elif !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_CHROMEOS_ASH) welcome_enabled = welcome::IsEnabled(profile_) && welcome::HasModulesToShow(profile_); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS_LACROS) + if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile_)) + welcome_enabled = false; +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) + const bool whats_new_enabled = promotional_tabs_enabled && whats_new::ShouldShowForState(local_state);
diff --git a/chrome/browser/ui/views/DEPS b/chrome/browser/ui/views/DEPS index 31fd86c..c4fd4de1 100644 --- a/chrome/browser/ui/views/DEPS +++ b/chrome/browser/ui/views/DEPS
@@ -28,6 +28,7 @@ ], ".*test.*": [ "!ash", + "+ash/components/arc/mojom", "+ash/components/arc/intent_helper", "+ash/components/arc/session", "+ash/components/arc/test",
diff --git a/chrome/browser/ui/views/apps/DEPS b/chrome/browser/ui/views/apps/DEPS index 0054b379f..3657eb1 100644 --- a/chrome/browser/ui/views/apps/DEPS +++ b/chrome/browser/ui/views/apps/DEPS
@@ -10,4 +10,7 @@ "+ash/wm/window_state_observer.h", "+components/app_restore/full_restore_utils.h", ], + "chrome/browser/ui/views/apps/app_dialog/app_dialog_view_browsertest.cc": [ + "+ash/components/arc/mojom/app.mojom.h", + ], }
diff --git a/chrome/browser/ui/views/apps/app_dialog/app_dialog_view_browsertest.cc b/chrome/browser/ui/views/apps/app_dialog/app_dialog_view_browsertest.cc index 4bf0d4f0..e149af7 100644 --- a/chrome/browser/ui/views/apps/app_dialog/app_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/apps/app_dialog/app_dialog_view_browsertest.cc
@@ -4,6 +4,7 @@ #include <memory> +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -23,7 +24,6 @@ #include "chrome/browser/ui/views/apps/app_dialog/app_block_dialog_view.h" #include "chrome/browser/ui/views/apps/app_dialog/app_pause_dialog_view.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/arc/mojom/app.mojom.h" #include "content/public/test/browser_test.h" class AppDialogViewBrowserTest : public DialogBrowserTest {
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc index 3afd670..e8f1ae5 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc
@@ -96,6 +96,11 @@ void SetUp() override { BrowserWithTestWindowTest::SetUp(); #if BUILDFLAG(IS_CHROMEOS_ASH) + // Sets up a fake user manager over |BrowserWithTestWindowTest| user + // manager. + arc_test_ = std::make_unique<ArcAppTest>(); + arc_test_->SetUp(extension_environment_.profile()); + shelf_model_ = std::make_unique<ash::ShelfModel>(); chrome_shelf_item_factory_ = std::make_unique<ChromeShelfItemFactory>(); shelf_model_->SetShelfItemFactory(chrome_shelf_item_factory_.get()); @@ -108,7 +113,6 @@ std::make_unique<ShelfControllerHelper>( extension_environment_.profile())); chrome_shelf_controller_->Init(); - arc_test_.SetUp(extension_environment_.profile()); #endif extension_ = extension_environment_.MakePackagedApp(kTestExtensionId, true); chrome_app_ = extension_environment_.MakePackagedApp( @@ -120,9 +124,12 @@ extension_ = nullptr; chrome_app_ = nullptr; #if BUILDFLAG(IS_CHROMEOS_ASH) - arc_test_.TearDown(); chrome_shelf_controller_.reset(); shelf_model_.reset(); + if (arc_test_) { + arc_test_->TearDown(); + arc_test_.reset(); + } #endif // The Browser class had dependencies on LocalState, which is owned by @@ -200,7 +207,7 @@ std::unique_ptr<ash::ShelfModel> shelf_model_; std::unique_ptr<ChromeShelfItemFactory> chrome_shelf_item_factory_; std::unique_ptr<ChromeShelfController> chrome_shelf_controller_; - ArcAppTest arc_test_; + std::unique_ptr<ArcAppTest> arc_test_; #endif }; @@ -238,16 +245,21 @@ browser_window->Close(); browser_window.reset(); + // The following serves two purposes: + // it ensures the Widget close is being triggered by the DeleteProfile() call + // rather than the code above. And prevents a race condition while tearing + // down arc_test user_manager. + base::RunLoop().RunUntilIdle(); + #if BUILDFLAG(IS_CHROMEOS_ASH) + // Avoid a race condition when tearing down arc_test_ and deleting the user + // manager. chrome_shelf_controller_.reset(); shelf_model_.reset(); - arc_test_.TearDown(); + arc_test_->TearDown(); + arc_test_.reset(); #endif - // The following does nothing: it just ensures the Widget close is being - // triggered by the DeleteProfile() call rather than the code above. - base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(widget_); EXPECT_FALSE(widget_->IsClosed()); extension_environment_.DeleteProfile();
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.cc index c6b52e76..311815d 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel.cc
@@ -6,12 +6,12 @@ #include <memory> +#include "ash/components/arc/mojom/app.mojom.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/grit/generated_resources.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/app.mojom.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/display/display.h"
diff --git a/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc b/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc index 2ab72c9..23cea80 100644 --- a/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/app_list/arc/arc_app_dialog.h" +#include "ash/components/arc/mojom/app.mojom.h" #include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/fake_app_instance.h" @@ -24,7 +25,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/arc/mojom/app.mojom.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h"
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc index c156f462..d8fd040 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
@@ -335,6 +335,7 @@ // views::View: void GetAccessibleNodeData(ui::AXNodeData* node_data) override; + void OnPaint(gfx::Canvas* canvas) override; void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override; void OnMouseReleased(const ui::MouseEvent& event) override; @@ -388,6 +389,11 @@ // All the labels inside this view. std::vector<views::Label*> inner_labels_; + + // The Autofill popup may be hovered by the mouse after its creation. In this + // case, we want to ignore clicks on the hovered menu item until the user made + // an explicit choice. See crbug.com/1240472, crbug.com/1241585. + bool mouse_observed_outside_of_item_ = false; }; int AutofillPopupItemView::GetFrontendId() const { @@ -620,19 +626,35 @@ node_data->AddIntAttribute(ax::mojom::IntAttribute::kPosInSet, pos_in_set); } +void AutofillPopupItemView::OnPaint(gfx::Canvas* canvas) { + AutofillPopupRowView::OnPaint(canvas); + mouse_observed_outside_of_item_ |= !IsMouseHovered(); +} + void AutofillPopupItemView::OnMouseEntered(const ui::MouseEvent& event) { + // OnMouseEntered() also fires if the had been hovering over the item and + // moved only a little bit. In that case, clicks shall still be ignored and we + // don't want to show a preview. + if (!mouse_observed_outside_of_item_) + return; AutofillPopupController* controller = popup_view()->controller(); if (controller) controller->SetSelectedLine(GetLineNumber()); } void AutofillPopupItemView::OnMouseExited(const ui::MouseEvent& event) { + mouse_observed_outside_of_item_ = true; AutofillPopupController* controller = popup_view()->controller(); if (controller) controller->SelectionCleared(); } void AutofillPopupItemView::OnMouseReleased(const ui::MouseEvent& event) { + // Ignore mouse clicks in case the popup appeared directly under the mouse + // cursor and we have no indication that the user intentionally selected the + // current item. + if (!mouse_observed_outside_of_item_) + return; AutofillPopupController* controller = popup_view()->controller(); if (controller && event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) {
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc index 472eb70f1..a2c1a66 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/containers/contains.h" #include "base/no_destructor.h" #include "base/strings/string_util.h" #include "build/build_config.h" @@ -17,40 +18,46 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/compositor/canvas_painter.h" #include "ui/events/base_event_utils.h" #include "ui/events/test/event_generator.h" #include "ui/views/test/ax_event_counter.h" +#include "ui/views/widget/widget.h" #include "ui/views/widget/widget_utils.h" using testing::NiceMock; namespace { -struct TypeClicks { - autofill::PopupItemId id; - int click; +const std::vector<autofill::PopupItemId> kClickablePopupItemIds{ + autofill::POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, + autofill::POPUP_ITEM_ID_PASSWORD_ENTRY, + autofill::POPUP_ITEM_ID_CLEAR_FORM, + autofill::POPUP_ITEM_ID_AUTOFILL_OPTIONS, + autofill::POPUP_ITEM_ID_DATALIST_ENTRY, + autofill::POPUP_ITEM_ID_SCAN_CREDIT_CARD, + autofill::POPUP_ITEM_ID_TITLE, + autofill::POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO, + autofill::POPUP_ITEM_ID_USERNAME_ENTRY, + autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY, + autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_OPT_IN, + autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_RE_SIGNIN, + autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_OPT_IN_AND_GENERATE, + autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_EMPTY, + autofill::POPUP_ITEM_ID_VIRTUAL_CREDIT_CARD_ENTRY, }; -const struct TypeClicks kClickTestCase[] = { - {autofill::POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, 1}, - {autofill::POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE, 0}, - {autofill::POPUP_ITEM_ID_PASSWORD_ENTRY, 1}, - {autofill::POPUP_ITEM_ID_SEPARATOR, 0}, - {autofill::POPUP_ITEM_ID_CLEAR_FORM, 1}, - {autofill::POPUP_ITEM_ID_AUTOFILL_OPTIONS, 1}, - {autofill::POPUP_ITEM_ID_DATALIST_ENTRY, 1}, - {autofill::POPUP_ITEM_ID_SCAN_CREDIT_CARD, 1}, - {autofill::POPUP_ITEM_ID_TITLE, 1}, - {autofill::POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO, 1}, - {autofill::POPUP_ITEM_ID_USERNAME_ENTRY, 1}, - {autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY, 1}, - {autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_OPT_IN, 1}, - {autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_RE_SIGNIN, 1}, - {autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_OPT_IN_AND_GENERATE, 1}, - {autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_EMPTY, 1}, - {autofill::POPUP_ITEM_ID_VIRTUAL_CREDIT_CARD_ENTRY, 1}, +const std::vector<autofill::PopupItemId> kUnclickablePopupItemIds{ + autofill::POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE, + autofill::POPUP_ITEM_ID_SEPARATOR, }; +bool IsClickable(autofill::PopupItemId id) { + DCHECK(base::Contains(kClickablePopupItemIds, id) ^ + base::Contains(kUnclickablePopupItemIds, id)); + return base::Contains(kClickablePopupItemIds, id); +} + class AutofillPopupViewNativeViewsTest : public ChromeViewsTestBase { public: AutofillPopupViewNativeViewsTest() = default; @@ -81,10 +88,45 @@ widget_->SetContentsView(view_.get()); widget_->Show(); + view_->SchedulePaint(); + } + + void Paint() { +#if !defined(OS_MAC) + Paint(widget_->GetRootView()); +#else + // TODO(crbug.com/123): On Mac OS we need to trigger Paint() on the roots of + // the individual rows. The reason is that the views::ViewScrollView() + // created in AutofillPopupViewNativeViews::CreateChildViews() owns a Layer. + // As a consequence, views::View::Paint() does not propagate to the rows + // because the recursion stops in views::View::RecursivePaintHelper(). + for (views::View* row : view()->GetRowsForTesting()) { + views::View* root = row; + while (!root->layer() && root->parent()) + root = root->parent(); + Paint(root); + } +#endif + } + + void Paint(views::View* view) { + SkBitmap bitmap; + gfx::Size size = view->size(); + ui::CanvasPainter canvas_painter(&bitmap, size, 1.f, SK_ColorTRANSPARENT, + false); + view->Paint( + views::PaintInfo::CreateRootPaintInfo(canvas_painter.context(), size)); } autofill::AutofillPopupViewNativeViews* view() { return view_.get(); } + gfx::Point GetCenterOfSuggestion(int row_index) { + return view() + ->GetRowsForTesting()[row_index] + ->GetBoundsInScreen() + .CenterPoint(); + } + protected: std::unique_ptr<autofill::AutofillPopupViewNativeViews> view_; NiceMock<autofill::MockAutofillPopupController> autofill_popup_controller_; @@ -92,9 +134,22 @@ std::unique_ptr<ui::test::EventGenerator> generator_; }; -class AutofillPopupViewNativeViewsForEveryTypeTest +class AutofillPopupViewNativeViewsTestWithAnyPopupItemId : public AutofillPopupViewNativeViewsTest, - public ::testing::WithParamInterface<TypeClicks> {}; + public ::testing::WithParamInterface<autofill::PopupItemId> { + public: + autofill::PopupItemId popup_item_id() const { return GetParam(); } +}; + +class AutofillPopupViewNativeViewsTestWithClickablePopupItemId + : public AutofillPopupViewNativeViewsTest, + public ::testing::WithParamInterface<autofill::PopupItemId> { + public: + autofill::PopupItemId popup_item_id() const { + DCHECK(IsClickable(GetParam())); + return GetParam(); + } +}; TEST_F(AutofillPopupViewNativeViewsTest, ShowHideTest) { CreateAndShowView({0}); @@ -238,20 +293,128 @@ widget_->OnMouseEvent(&click_mouse_event); } -TEST_P(AutofillPopupViewNativeViewsForEveryTypeTest, ShowClickTest) { - const TypeClicks& click = GetParam(); - CreateAndShowView({click.id}); - EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(click.click); - gfx::Point center = - view()->GetRowsForTesting()[0]->GetBoundsInScreen().CenterPoint(); +// Tests that (only) clickable items trigger an AcceptSuggestion event. +TEST_P(AutofillPopupViewNativeViewsTestWithAnyPopupItemId, ShowClickTest) { + CreateAndShowView({popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion) + .Times(IsClickable(popup_item_id())); + generator_->MoveMouseTo(gfx::Point(1000, 1000)); + ASSERT_FALSE(view()->IsMouseHovered()); + Paint(); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} - generator_->set_current_screen_location(center); +// Tests that after the mouse moves into the popup after display, clicking a +// suggestion triggers an AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + AcceptSuggestionIfUnfocusedAtPaint) { + CreateAndShowView({popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(1); + generator_->MoveMouseTo(gfx::Point(1000, 1000)); + ASSERT_FALSE(view()->IsMouseHovered()); + Paint(); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} + +// Tests that after the mouse moves from one suggestion to another, clicking the +// suggestion triggers an AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + AcceptSuggestionIfMouseSelectedAnotherRow) { + CreateAndShowView({popup_item_id(), popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(1); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + ASSERT_TRUE(view()->IsMouseHovered()); + Paint(); + generator_->MoveMouseTo(GetCenterOfSuggestion(1)); // Selects another row. + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} + +// Tests that after the mouse moves from one suggestion to another and back to +// the first one, clicking the suggestion triggers an AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + AcceptSuggestionIfMouseTemporarilySelectedAnotherRow) { + CreateAndShowView({popup_item_id(), popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(1); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + ASSERT_TRUE(view()->IsMouseHovered()); + Paint(); + generator_->MoveMouseTo(GetCenterOfSuggestion(1)); // Selects another row. + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} + +// Tests that even if the mouse hovers a suggestion when the popup is displayed, +// after moving the mouse out and back in on the popup, clicking the suggestion +// triggers an AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + AcceptSuggestionIfMouseExitedPopupSincePaint) { + CreateAndShowView({popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(1); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + ASSERT_TRUE(view()->IsMouseHovered()); + Paint(); + generator_->MoveMouseTo(gfx::Point(1000, 1000)); // Exits the popup. + ASSERT_FALSE(view()->IsMouseHovered()); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} + +// Tests that if the mouse hovers a suggestion when the popup is displayed, +// clicking the suggestion triggers no AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + IgnoreClickIfFocusedAtPaintWithoutExit) { + CreateAndShowView({popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(0); + generator_->MoveMouseTo(GetCenterOfSuggestion(0)); + ASSERT_TRUE(view()->IsMouseHovered()); + Paint(); + generator_->ClickLeftButton(); + view()->RemoveAllChildViews(); +} + +// Tests that if the mouse hovers a suggestion when the popup is displayed and +// moves around on this suggestion, clicking the suggestion triggers no +// AcceptSuggestion() event. +TEST_P(AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + IgnoreClickIfFocusedAtPaintWithSlightMouseMovement) { + CreateAndShowView({popup_item_id()}); + EXPECT_CALL(autofill_popup_controller_, AcceptSuggestion).Times(0); + int width = view()->GetRowsForTesting()[0]->width(); + int height = view()->GetRowsForTesting()[0]->height(); + for (int x : {-width / 3, width / 3}) { + for (int y : {-height / 3, height / 3}) { + generator_->MoveMouseTo(GetCenterOfSuggestion(0) + gfx::Vector2d(x, y)); + ASSERT_TRUE(view()->IsMouseHovered()); + Paint(); + } + } generator_->ClickLeftButton(); view()->RemoveAllChildViews(); } INSTANTIATE_TEST_SUITE_P(All, - AutofillPopupViewNativeViewsForEveryTypeTest, - ::testing::ValuesIn(kClickTestCase)); + AutofillPopupViewNativeViewsTestWithAnyPopupItemId, + testing::ValuesIn([] { + std::vector<autofill::PopupItemId> all_ids; + all_ids.insert(all_ids.end(), + kClickablePopupItemIds.begin(), + kClickablePopupItemIds.end()); + all_ids.insert(all_ids.end(), + kUnclickablePopupItemIds.begin(), + kUnclickablePopupItemIds.end()); + return all_ids; + }())); + +INSTANTIATE_TEST_SUITE_P( + All, + AutofillPopupViewNativeViewsTestWithClickablePopupItemId, + testing::ValuesIn(kClickablePopupItemIds)); } // namespace
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc index 2cc8742..bb610f8 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view_unittest.cc
@@ -105,8 +105,6 @@ BookmarkBubbleView::bookmark_bubble()->GetFootnoteViewForTesting()); } -// TODO(https://crbug.com/1260291): Add support for Lacros. -#if !BUILDFLAG(IS_CHROMEOS_LACROS) // Verifies that the sync promo is displayed for a user that is not signed in. TEST_F(BookmarkBubbleViewTest, SyncPromoNotSignedIn) { CreateBubbleView(); @@ -118,4 +116,3 @@ EXPECT_TRUE(footnote); #endif } -#endif // !BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/ui/views/browser_dialogs_views.cc b/chrome/browser/ui/views/browser_dialogs_views.cc index 064defc..4812ac47 100644 --- a/chrome/browser/ui/views/browser_dialogs_views.cc +++ b/chrome/browser/ui/views/browser_dialogs_views.cc
@@ -8,7 +8,6 @@ #include "build/build_config.h" #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" -#include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/login/login_handler.h" @@ -48,11 +47,6 @@ ShowDialogViews(); } -void ChromeExtensionChooserDialog::ShowDialog( - std::unique_ptr<permissions::ChooserController> chooser_controller) const { - ShowDialogImpl(std::move(chooser_controller)); -} - namespace chrome { #if !defined(OS_MAC)
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc index 2e3d4a1..12d485a 100644 --- a/chrome/browser/ui/views/chrome_layout_provider.cc +++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -134,6 +134,8 @@ return 8; case DISTANCE_OMNIBOX_TWO_LINE_CELL_VERTICAL_PADDING: return 4; + case DISTANCE_SIDE_PANEL_HEADER_VECTOR_ICON_SIZE: + return 18; } NOTREACHED(); return 0;
diff --git a/chrome/browser/ui/views/chrome_layout_provider.h b/chrome/browser/ui/views/chrome_layout_provider.h index 1dd363f3..6d05c5a 100644 --- a/chrome/browser/ui/views/chrome_layout_provider.h +++ b/chrome/browser/ui/views/chrome_layout_provider.h
@@ -76,6 +76,8 @@ // Vertical padding at the top and bottom of the an omnibox match row for two // line layout. DISTANCE_OMNIBOX_TWO_LINE_CELL_VERTICAL_PADDING, + // Width and Height of a vector icon in the side panel header. + DISTANCE_SIDE_PANEL_HEADER_VECTOR_ICON_SIZE }; class ChromeLayoutProvider : public views::LayoutProvider {
diff --git a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc index c738fff..948d791 100644 --- a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc
@@ -102,16 +102,17 @@ BEGIN_METADATA(ChooserDialogView, views::DialogDelegateView) END_METADATA -void ChromeExtensionChooserDialog::ShowDialogImpl( - std::unique_ptr<permissions::ChooserController> chooser_controller) const { +void ShowConstrainedDeviceChooserDialog( + content::WebContents* web_contents, + std::unique_ptr<permissions::ChooserController> controller) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(chooser_controller); + DCHECK(controller); web_modal::WebContentsModalDialogManager* manager = - web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); + web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); if (manager) { constrained_window::ShowWebModalDialogViews( - new ChooserDialogView(std::move(chooser_controller)), web_contents_); + new ChooserDialogView(std::move(controller)), web_contents); } }
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index e3ae78e..a2bef32 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -3887,8 +3887,7 @@ profiles::BubbleViewMode bubble_view_mode; profiles::BubbleViewModeFromAvatarBubbleMode(mode, GetProfile(), &bubble_view_mode); -// TODO(https://crbug.com/1260291): Add support for Lacros. -#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) +#if !BUILDFLAG(IS_CHROMEOS_ASH) if (SigninViewController::ShouldShowSigninForMode(bubble_view_mode)) { browser_->signin_view_controller()->ShowSignin(bubble_view_mode, access_point);
diff --git a/chrome/browser/ui/views/lens/lens_side_panel_view.cc b/chrome/browser/ui/views/lens/lens_side_panel_view.cc index 303dc60..44fe73c 100644 --- a/chrome/browser/ui/views/lens/lens_side_panel_view.cc +++ b/chrome/browser/ui/views/lens/lens_side_panel_view.cc
@@ -113,12 +113,13 @@ base::RepeatingClosure close_callback, base::RepeatingClosure launch_callback) { auto header = std::make_unique<views::FlexLayoutView>(); - // LayoutProvider for providing margins. - views::LayoutProvider* const layout_provider = views::LayoutProvider::Get(); + // ChromeLayoutProvider for providing margins. + ChromeLayoutProvider* const chrome_layout_provider = + ChromeLayoutProvider::Get(); // Set the interior margins of the header on the left and right sides. header->SetInteriorMargin(gfx::Insets( - 0, layout_provider->GetDistanceMetric( + 0, chrome_layout_provider->GetDistanceMetric( views::DistanceMetric::DISTANCE_RELATED_CONTROL_HORIZONTAL))); // Set alignments for horizontal (main) and vertical (cross) axes. header->SetMainAxisAlignment(views::LayoutAlignment::kStart); @@ -146,16 +147,16 @@ this, launch_callback, views::kLaunchIcon, gfx::Insets( 0, 0, 0, - layout_provider->GetDistanceMetric( + chrome_layout_provider->GetDistanceMetric( views::DistanceMetric::DISTANCE_RELATED_CONTROL_HORIZONTAL)), l10n_util::GetStringUTF16(IDS_ACCNAME_OPEN), ChromeLayoutProvider::Get()->GetDistanceMetric( - ChromeDistanceMetric::DISTANCE_BUBBLE_HEADER_VECTOR_ICON_SIZE))); + ChromeDistanceMetric::DISTANCE_SIDE_PANEL_HEADER_VECTOR_ICON_SIZE))); close_button_ = header->AddChildView(CreateControlButton( this, close_callback, views::kIcCloseIcon, gfx::Insets(), l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE), ChromeLayoutProvider::Get()->GetDistanceMetric( - ChromeDistanceMetric::DISTANCE_BUBBLE_HEADER_VECTOR_ICON_SIZE))); + ChromeDistanceMetric::DISTANCE_SIDE_PANEL_HEADER_VECTOR_ICON_SIZE))); // Install header. AddChildView(std::move(header));
diff --git a/chrome/browser/ui/views/permission_bubble/chooser_bubble_ui.cc b/chrome/browser/ui/views/permission_bubble/chooser_bubble_ui.cc index c2753014..1b33e290 100644 --- a/chrome/browser/ui/views/permission_bubble/chooser_bubble_ui.cc +++ b/chrome/browser/ui/views/permission_bubble/chooser_bubble_ui.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h" #include "chrome/browser/ui/views/title_origin_label.h" #include "components/permissions/chooser_controller.h" +#include "extensions/buildflags/buildflags.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_frame_view.h" @@ -24,6 +25,11 @@ #include "ui/views/layout/fill_layout.h" #include "ui/views/widget/widget.h" +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" +#include "extensions/browser/app_window/app_window_registry.h" +#endif + using bubble_anchor_util::AnchorConfiguration; namespace { @@ -185,6 +191,17 @@ content::RenderFrameHost* owner, std::unique_ptr<permissions::ChooserController> controller) { auto* contents = content::WebContents::FromRenderFrameHost(owner); + +#if BUILDFLAG(ENABLE_EXTENSIONS) + if (extensions::AppWindowRegistry::Get(owner->GetBrowserContext()) + ->GetAppWindowForWebContents(contents)) { + ShowConstrainedDeviceChooserDialog(contents, std::move(controller)); + // This version of the chooser dialog does not support being closed by the + // code which created it. + return base::DoNothing(); + } +#endif + auto* browser = chrome::FindBrowserWithWebContents(contents); if (!browser) return base::DoNothing();
diff --git a/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc b/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc index b25bcd52..49b11db 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc +++ b/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc
@@ -141,12 +141,13 @@ std::unique_ptr<views::View> SidePanelCoordinator::CreateHeader() { auto header = std::make_unique<views::FlexLayoutView>(); - // LayoutProvider for providing margins. - views::LayoutProvider* const layout_provider = views::LayoutProvider::Get(); + // ChromeLayoutProvider for providing margins. + ChromeLayoutProvider* const chrome_layout_provider = + ChromeLayoutProvider::Get(); // Set the interior margins of the header on the left and right sides. header->SetInteriorMargin(gfx::Insets( - 0, layout_provider->GetDistanceMetric( + 0, chrome_layout_provider->GetDistanceMetric( views::DistanceMetric::DISTANCE_RELATED_CONTROL_HORIZONTAL))); // Set alignments for horizontal (main) and vertical (cross) axes. header->SetMainAxisAlignment(views::LayoutAlignment::kStart); @@ -189,7 +190,7 @@ views::kIcCloseIcon, gfx::Insets(), l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE), ChromeLayoutProvider::Get()->GetDistanceMetric( - ChromeDistanceMetric::DISTANCE_BUBBLE_HEADER_VECTOR_ICON_SIZE))); + ChromeDistanceMetric::DISTANCE_SIDE_PANEL_HEADER_VECTOR_ICON_SIZE))); return header; }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h index 41f85bf..8b929587 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -36,8 +36,8 @@ #include "url/origin.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" // nogncheck https://crbug.com/784179 #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" // nogncheck https://crbug.com/784179 #endif // BUILDFLAG(IS_CHROMEOS_ASH) class AppMenuButton;
diff --git a/chrome/browser/ui/views/touch_selection_menu_chromeos.h b/chrome/browser/ui/views/touch_selection_menu_chromeos.h index ad3dff45..a6a2fa5 100644 --- a/chrome/browser/ui/views/touch_selection_menu_chromeos.h +++ b/chrome/browser/ui/views/touch_selection_menu_chromeos.h
@@ -7,7 +7,7 @@ #include <vector> -#include "components/arc/mojom/intent_helper.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ui/views/touchui/touch_selection_menu_views.h" namespace views {
diff --git a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h index ef72add..18ae769a 100644 --- a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h +++ b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h
@@ -8,8 +8,8 @@ #include <memory> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "base/memory/weak_ptr.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" #include "ui/aura/window_tracker.h" #include "ui/views/touchui/touch_selection_menu_runner_views.h"
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc index ae3fcc9..9f3ea5d2 100644 --- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc
@@ -799,7 +799,7 @@ // Validate that a point marked "app-region: no-drag" within a draggable // region is not draggable. - gfx::Point non_draggable_point(105, 105); + gfx::Point non_draggable_point(106, 106); views::View::ConvertPointToTarget( helper()->browser_view()->contents_web_view(), frame_view, &non_draggable_point); @@ -817,6 +817,15 @@ EXPECT_TRUE(helper()->browser_view()->ShouldDescendIntoChildForEventHandling( helper()->browser_view()->GetWidget()->GetNativeView(), kBorderPoint)); + // Validate that draggable region does not clear after history.replaceState is + // invoked. + std::string kHistoryReplaceState = + "history.replaceState({ test: 'test' }, null);"; + EXPECT_TRUE(ExecuteScript(helper()->browser_view()->GetActiveWebContents(), + kHistoryReplaceState)); + EXPECT_FALSE(helper()->browser_view()->ShouldDescendIntoChildForEventHandling( + helper()->browser_view()->GetWidget()->GetNativeView(), draggable_point)); + // Validate that the draggable region is reset on navigation and the point is // no longer draggable. ASSERT_TRUE(ui_test_utils::NavigateToURL(helper()->browser_view()->browser(),
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_test_helper.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_test_helper.cc index b75599a..b3e8c90a 100644 --- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_test_helper.cc +++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_test_helper.cc
@@ -105,8 +105,8 @@ " position: relative;" " top: 5px;" " left: 5px;" - " height: 1px;" - " width: 1px;" + " height: 2px;" + " width: 2px;" " }" " #target {" " padding-left: env(titlebar-area-x);"
diff --git a/chrome/browser/ui/web_applications/app_browser_controller.cc b/chrome/browser/ui/web_applications/app_browser_controller.cc index dc92d1b..1ab9469 100644 --- a/chrome/browser/ui/web_applications/app_browser_controller.cc +++ b/chrome/browser/ui/web_applications/app_browser_controller.cc
@@ -290,7 +290,8 @@ void AppBrowserController::DidFinishNavigation( content::NavigationHandle* navigation_handle) { - if (!navigation_handle->IsInMainFrame()) + if (!navigation_handle->IsInMainFrame() || + navigation_handle->IsSameDocument()) return; // Reset the draggable regions so they are not cached on navigation.
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc index 02517ef..ad7c67b2 100644 --- a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc +++ b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
@@ -149,7 +149,7 @@ public: ChromeURLDataManagerWebUITrustedTypesTest() { std::vector<base::Feature> enabled_features; -#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) +#if !BUILDFLAG(IS_CHROMEOS_ASH) if (GetParam() == std::string("chrome://welcome")) enabled_features.push_back(welcome::kForceEnabled); #endif @@ -331,10 +331,10 @@ #if !defined(OS_CHROMEOS) "chrome://apps", "chrome://browser-switch", - "chrome://welcome", #endif #if !BUILDFLAG(IS_CHROMEOS_ASH) "chrome://signin-email-confirmation", + "chrome://welcome", #endif #if !defined(OS_MAC) "chrome://sandbox",
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index cd2e316..fb7b4c05 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -143,6 +143,7 @@ #include "chrome/browser/ui/webui/read_later/read_later_ui.h" #include "chrome/browser/ui/webui/settings/settings_ui.h" #include "chrome/browser/ui/webui/settings/settings_utils.h" +#include "chrome/browser/ui/webui/signin/inline_login_ui.h" #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h" #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_internals_ui.h" #include "chrome/browser/ui/webui/system_info_ui.h" @@ -286,8 +287,6 @@ #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) #include "chrome/browser/ui/webui/browser_switch/browser_switch_ui.h" -#include "chrome/browser/ui/webui/welcome/helpers.h" -#include "chrome/browser/ui/webui/welcome/welcome_ui.h" #endif #if !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID) @@ -298,10 +297,8 @@ #include "chrome/browser/ui/webui/signin/signin_email_confirmation_ui.h" #include "chrome/browser/ui/webui/signin/signin_error_ui.h" #include "chrome/browser/ui/webui/signin/signin_reauth_ui.h" -#endif - -#if !BUILDFLAG(IS_CHROMEOS_LACROS) && !defined(OS_ANDROID) -#include "chrome/browser/ui/webui/signin/inline_login_ui.h" +#include "chrome/browser/ui/webui/welcome/helpers.h" +#include "chrome/browser/ui/webui/welcome/welcome_ui.h" #endif #if defined(OS_WIN) @@ -577,7 +574,7 @@ } #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) +#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) template <> WebUIController* NewWebUI<WelcomeUI>(WebUI* web_ui, const GURL& url) { return new WelcomeUI(web_ui, url); @@ -714,10 +711,6 @@ !profile->IsGuestSession()) { return &NewWebUI<AppLauncherPageUI>; } - if (url.host_piece() == chrome::kChromeUIWelcomeHost && - welcome::IsEnabled(profile)) { - return &NewWebUI<WelcomeUI>; - } #endif // !defined(OS_CHROMEOS) if (profile->IsGuestSession() && (url.host_piece() == chrome::kChromeUIAppLauncherPageHost || @@ -772,11 +765,9 @@ return &NewWebUI<SyncFileSystemInternalsUI>; if (url.host_piece() == chrome::kChromeUISystemInfoHost) return &NewWebUI<SystemInfoUI>; -#if !BUILDFLAG(IS_CHROMEOS_LACROS) - // Inline login UI is available on all platforms except Android and Lacros. + // Inline login UI is available on all platforms except Android. if (url.host_piece() == chrome::kChromeUIChromeSigninHost) return &NewWebUI<InlineLoginUI>; -#endif if (base::FeatureList::IsEnabled(features::kAccessCodeCastUI)) { if (url.host_piece() == chrome::kChromeUIAccessCodeCastHost) return &NewWebUI<AccessCodeCastUI>; @@ -1048,6 +1039,9 @@ !profile->IsOffTheRecord()) { return &NewWebUI<SigninReauthUI>; } + if (url.host_piece() == chrome::kChromeUIWelcomeHost && + welcome::IsEnabled(profile)) + return &NewWebUI<WelcomeUI>; #endif #if BUILDFLAG(ENABLE_NACL)
diff --git a/chrome/browser/ui/webui/extensions/extensions_internals_source.cc b/chrome/browser/ui/webui/extensions/extensions_internals_source.cc index 836be23..84b02e7 100644 --- a/chrome/browser/ui/webui/extensions/extensions_internals_source.cc +++ b/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
@@ -95,7 +95,7 @@ base::Value CreationFlagsToList(int creation_flags) { base::Value flags_value(base::Value::Type::LIST); - if (creation_flags & extensions::Extension::NO_FLAGS) + if (creation_flags == extensions::Extension::NO_FLAGS) flags_value.Append("NO_FLAGS"); if (creation_flags & extensions::Extension::REQUIRE_KEY) flags_value.Append("REQUIRE_KEY");
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 657639a..fa6a7d9 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -53,6 +53,7 @@ #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/web_applications/extension_status_utils.h" #include "chrome/browser/web_applications/extensions/bookmark_app_util.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" @@ -1351,7 +1352,15 @@ options.os_hooks[web_app::OsHookType::kFileHandlers] = true; options.os_hooks[web_app::OsHookType::kProtocolHandlers] = true; options.os_hooks[web_app::OsHookType::kRunOnOsLogin] = false; - options.os_hooks[web_app::OsHookType::kUninstallationViaOsSettings] = true; + + // Installed WebApp here is user uninstallable app, but it needs to + // check user uninstall-ability if there are apps with different source types. + // WebApp::CanUserUninstallApp will handles it. + const web_app::WebApp* web_app = + web_app_provider_->registrar().GetAppById(app_id); + options.os_hooks[web_app::OsHookType::kUninstallationViaOsSettings] = + web_app->CanUserUninstallWebApp(); + #if defined(OS_WIN) || defined(OS_MAC) || \ (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) options.os_hooks[web_app::OsHookType::kUrlHandlers] = true;
diff --git a/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler.cc b/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler.cc index be9ebaa0..4cfb292 100644 --- a/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler.cc
@@ -63,13 +63,14 @@ base::Value::ConstListView args) { AllowJavascript(); CHECK_EQ(2U, args.size()); + CHECK_EQ(args[1].type(), base::Value::Type::DICTIONARY); const base::Value& callback_id = args[0]; - const bool metrics_consent = args[1].GetBool(); + absl::optional<bool> metrics_consent = args[1].FindBoolKey("consent"); + CHECK(metrics_consent); auto* stats_reporting_controller = ash::StatsReportingController::Get(); - - stats_reporting_controller->SetEnabled(profile_, metrics_consent); + stats_reporting_controller->SetEnabled(profile_, metrics_consent.value()); // Re-read from |stats_reporting_controller|. If |profile_| is not owner, then // the consent should not have changed to |metrics_consent|.
diff --git a/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler_unittest.cc index 1817bd5e..cc67d19 100644 --- a/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/webui/settings/chromeos/metrics_consent_handler.h" #include "ash/components/settings/cros_settings_names.h" +#include "base/values.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" @@ -62,7 +63,11 @@ void UpdateMetricsConsent(bool metrics_consent) { base::ListValue args; args.Append(base::Value("callback-id")); - args.Append(base::Value(metrics_consent)); + + base::DictionaryValue dict; + dict.SetBoolKey("consent", metrics_consent); + args.Append(std::move(dict)); + HandleUpdateMetricsConsent(args.GetList()); } };
diff --git a/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chrome/browser/ui/webui/settings/people_handler_unittest.cc index ade8543..34b10657 100644 --- a/chrome/browser/ui/webui/settings/people_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -1247,7 +1247,9 @@ handler_->OnDidClosePage(&did_abort); } -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +// TODO(crbug.com/1220066): Remove the lacros exclusion when DICE is disabled on +// Lacros. +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) TEST(PeopleHandlerDiceUnifiedConsentTest, StoredAccountsList) { ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); @@ -1289,7 +1291,7 @@ EXPECT_EQ("a@gmail.com", accounts_list[0].FindKey("email")->GetString()); EXPECT_EQ("b@gmail.com", accounts_list[1].FindKey("email")->GetString()); } -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) #if BUILDFLAG(IS_CHROMEOS_ASH) // Regression test for crash in guest mode. https://crbug.com/1040476
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc index a02b652..b4fbc9b 100644 --- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc +++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -717,7 +717,6 @@ kDiceTurnOnSyncHelper_Abort); } #else - // TODO(https://crbug.com/1260291): Implement on Lacros. NOTIMPLEMENTED() << "Profiles without accounts are not yet supported on lacros."; #endif
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc index 6437e2f..5e0509a2 100644 --- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc +++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
@@ -611,8 +611,6 @@ CheckDelegateCalls(); } -// TODO(https://crbug.com/1260291): Enable this test on Lacros. -#if !BUILDFLAG(IS_CHROMEOS_LACROS) // Tests that the login error is displayed and that the account is removed. TEST_F(DiceTurnSyncOnHelperTest, CanOfferSigninErrorRemoveAccount) { // Set expectations. @@ -629,7 +627,6 @@ EXPECT_FALSE(identity_manager()->HasAccountWithRefreshToken(account_id())); CheckDelegateCalls(); } -#endif // Tests that the sync disabled message is displayed and that the account is // removed upon the ABORT_SYNC action. @@ -721,8 +718,6 @@ CheckDelegateCalls(); } -// TODO(https://crbug.com/1260291): Enable this test on Lacros. -#if !BUILDFLAG(IS_CHROMEOS_LACROS) // Aborts the flow after the cross account dialog. TEST_F(DiceTurnSyncOnHelperTest, CrossAccountAbort) { // Set expectations. @@ -740,7 +735,6 @@ EXPECT_FALSE(identity_manager()->HasAccountWithRefreshToken(account_id())); CheckDelegateCalls(); } -#endif // Merge data after the cross account dialog. TEST_F(DiceTurnSyncOnHelperTest, CrossAccountContinue) { @@ -761,8 +755,6 @@ CheckDelegateCalls(); } -// TODO(https://crbug.com/1260291): Enable these tests on Lacros. -#if !BUILDFLAG(IS_CHROMEOS_LACROS) // Create a new profile after the cross account dialog and show the signin page. TEST_F(DiceTurnSyncOnHelperTest, CrossAccountNewProfile) { // Set expectations. @@ -804,7 +796,6 @@ EXPECT_FALSE(identity_manager()->HasAccountWithRefreshToken(account_id())); CheckDelegateCalls(); } -#endif // Continue after the enterprise confirmation prompt. TEST_F(DiceTurnSyncOnHelperTest, DISABLED_EnterpriseConfirmationContinue) { @@ -825,8 +816,6 @@ CheckDelegateCalls(); } -// TODO(https://crbug.com/1260291): Enable this test on Lacros. -#if !BUILDFLAG(IS_CHROMEOS_LACROS) // Continue with a new profile after the enterprise confirmation prompt. TEST_F(DiceTurnSyncOnHelperTest, EnterpriseConfirmationNewProfile) { // Set expectations. @@ -884,7 +873,6 @@ signin::ConsentLevel::kSignin)); CheckDelegateCalls(); } -#endif // Tests that the sync confirmation is shown and the user can abort. TEST_F(DiceTurnSyncOnHelperTest, UndoSync) {
diff --git a/chrome/browser/ui/webui/signin/login_ui_test_utils.cc b/chrome/browser/ui/webui/signin/login_ui_test_utils.cc index 467bbc5..89525dd 100644 --- a/chrome/browser/ui/webui/signin/login_ui_test_utils.cc +++ b/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
@@ -442,7 +442,7 @@ bool SignInWithUI(Browser* browser, const std::string& username, const std::string& password) { -#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_CHROMEOS_ASH) NOTREACHED(); return false; #else
diff --git a/chrome/browser/ui/webui/signin/profile_picker_ui.cc b/chrome/browser/ui/webui/signin/profile_picker_ui.cc index bcf819c..ff60fa67 100644 --- a/chrome/browser/ui/webui/signin/profile_picker_ui.cc +++ b/chrome/browser/ui/webui/signin/profile_picker_ui.cc
@@ -33,7 +33,6 @@ #include "components/policy/core/common/policy_service.h" #include "components/policy/policy_constants.h" #include "components/prefs/pref_service.h" -#include "components/signin/public/base/signin_buildflags.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui_data_source.h" @@ -202,11 +201,7 @@ g_browser_process->local_state()->GetBoolean( prefs::kBrowserShowProfilePickerOnStartup)); html_source->AddBoolean("signInProfileCreationFlowSupported", -#if BUILDFLAG(ENABLE_DICE_SUPPORT) AccountConsistencyModeManager::IsDiceSignInAllowed()); -#else - true); -#endif html_source->AddString("minimumPickerSize", base::StringPrintf("%ipx", kMinimumPickerSizePx));
diff --git a/chrome/browser/ui/zoom/zoom_controller_browsertest.cc b/chrome/browser/ui/zoom/zoom_controller_browsertest.cc index a80918d..c768aa5 100644 --- a/chrome/browser/ui/zoom/zoom_controller_browsertest.cc +++ b/chrome/browser/ui/zoom/zoom_controller_browsertest.cc
@@ -340,8 +340,7 @@ } #endif // !defined(OS_MAC) -// TODO(https://crbug.com/1260291): Add support for Lacros. -#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) +#if !BUILDFLAG(IS_CHROMEOS_ASH) // Regression test: crbug.com/438979. IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, SettingsZoomAfterSigninWorks) { @@ -395,7 +394,7 @@ zoom_controller->SetZoomLevel(new_zoom_level); zoom_change_watcher.Wait(); } -#endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS) +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) class ZoomControllerForPrerenderingTest : public ZoomControllerBrowserTest, public zoom::ZoomObserver {
diff --git a/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelper.java b/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelper.java index 8658af08..5664093 100644 --- a/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelper.java +++ b/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelper.java
@@ -101,7 +101,14 @@ return; } - if (triggerDetails.shouldShowSnooze) { + // Automatic snoozes are handled separately. If automatic snoozing is enabled, we won't show + // snooze UI in the IPH, but we will treat the dismiss as an implicit snooze action. + boolean shouldShowSnoozeButton = triggerDetails.shouldShowSnooze + && !ChromeFeatureList.isEnabled(ChromeFeatureList.ENABLE_AUTOMATIC_SNOOZE); + boolean treatDismissAsImplicitSnooze = + ChromeFeatureList.isEnabled(ChromeFeatureList.ENABLE_AUTOMATIC_SNOOZE) + && triggerDetails.shouldShowSnooze; + if (shouldShowSnoozeButton) { // TODO(crbug.com/1243973): Implement explicit dismiss. boolean showExplicitDismiss = false; Runnable snoozeRunnable = showExplicitDismiss @@ -127,6 +134,9 @@ textBubble.setPreferredVerticalOrientation(iphCommand.preferredVerticalOrientation); textBubble.setDismissOnTouchInteraction(iphCommand.dismissOnTouch); textBubble.addOnDismissListener(() -> mHandler.postDelayed(() -> { + if (treatDismissAsImplicitSnooze) { + tracker.dismissedWithSnooze(featureName, SnoozeAction.SNOOZED); + } if (featureName != null) tracker.dismissed(featureName); iphCommand.onDismissCallback.run(); if (highlightParams != null) {
diff --git a/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelperTest.java b/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelperTest.java index e5f3cc0d0..b219b76 100644 --- a/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelperTest.java +++ b/chrome/browser/user_education/java/src/org/chromium/chrome/browser/user_education/UserEducationHelperTest.java
@@ -111,6 +111,7 @@ @MediumTest public void testShowIPHWithSnooze() throws Throwable { mTestValues.addFeatureFlagOverride(ChromeFeatureList.SNOOZABLE_IPH, true); + mTestValues.addFeatureFlagOverride(ChromeFeatureList.ENABLE_AUTOMATIC_SNOOZE, false); FeatureList.setTestValues(mTestValues); TestThreadUtils.runOnUiThreadBlocking(() -> { when(mTracker.shouldTriggerHelpUIWithSnooze(FeatureConstants.DOWNLOAD_HOME_FEATURE))
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 2191b37..c76bea1 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -330,7 +330,6 @@ "//ash/webui/shortcut_customization_ui", "//chrome/browser/ash/crosapi:browser_util", "//chromeos/strings", - "//components/arc/mojom", ] if (!is_official_build) { @@ -576,13 +575,12 @@ if (is_chromeos_ash) { deps += [ + "//ash/components/arc:arc", "//ash/components/arc:arc_test_support", "//ash/components/arc/mojom", "//ash/constants", "//chrome/browser/chromeos", - "//components/arc:arc", "//components/arc:arc_test_support", - "//components/arc/mojom", ] }
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.cc b/chrome/browser/web_applications/externally_managed_app_install_task.cc index 1b8b3ea..39ad94d 100644 --- a/chrome/browser/web_applications/externally_managed_app_install_task.cc +++ b/chrome/browser/web_applications/externally_managed_app_install_task.cc
@@ -16,6 +16,7 @@ #include "build/chromeos_buildflags.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/security_state_tab_helper.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_manager.h" @@ -305,7 +306,10 @@ // configured from somewhere else rather than always true. options.os_hooks[OsHookType::kFileHandlers] = true; options.os_hooks[OsHookType::kProtocolHandlers] = true; - options.os_hooks[OsHookType::kUninstallationViaOsSettings] = true; + + const WebApp* web_app = registrar_->GetAppById(app_id); + options.os_hooks[OsHookType::kUninstallationViaOsSettings] = + web_app->CanUserUninstallWebApp(); #if defined(OS_WIN) || defined(OS_MAC) || \ (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) options.os_hooks[OsHookType::kUrlHandlers] = true;
diff --git a/chrome/browser/web_applications/os_integration_manager.cc b/chrome/browser/web_applications/os_integration_manager.cc index 7bdb35cd..4933cba3 100644 --- a/chrome/browser/web_applications/os_integration_manager.cc +++ b/chrome/browser/web_applications/os_integration_manager.cc
@@ -806,7 +806,8 @@ if (options.os_hooks[OsHookType::kUninstallationViaOsSettings] && base::FeatureList::IsEnabled( features::kEnableWebAppUninstallFromOsSettings)) { - RegisterWebAppOsUninstallation(app_id, registrar_->GetAppShortName(app_id)); + RegisterWebAppOsUninstallation( + app_id, registrar_ ? registrar_->GetAppShortName(app_id) : ""); } }
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index ce6838c5..718ea335 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc
@@ -91,9 +91,13 @@ } bool WebApp::HasOnlySource(Source::Type source) const { - Sources specified_sources; + WebAppSources specified_sources; specified_sources[source] = true; - return HasAnySpecifiedSourcesAndNoOtherSources(specified_sources); + return HasAnySpecifiedSourcesAndNoOtherSources(sources_, specified_sources); +} + +WebAppSources WebApp::GetSources() const { + return sources_; } bool WebApp::IsSynced() const { @@ -121,19 +125,7 @@ } bool WebApp::CanUserUninstallWebApp() const { - Sources specified_sources; - specified_sources[Source::kDefault] = true; - specified_sources[Source::kSync] = true; - specified_sources[Source::kWebAppStore] = true; - specified_sources[Source::kSubApp] = true; - return HasAnySpecifiedSourcesAndNoOtherSources(specified_sources); -} - -bool WebApp::HasAnySpecifiedSourcesAndNoOtherSources( - Sources specified_sources) const { - bool has_any_specified_sources = (sources_ & specified_sources).any(); - bool has_no_other_sources = (sources_ & ~specified_sources).none(); - return has_any_specified_sources && has_no_other_sources; + return web_app::CanUserUninstallWebApp(sources_); } bool WebApp::WasInstalledByUser() const {
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index 7e94461..352cdb3 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h
@@ -27,6 +27,7 @@ namespace web_app { +using WebAppSources = std::bitset<Source::kMaxValue + 1>; class WebApp { public: explicit WebApp(const AppId& app_id); @@ -246,6 +247,7 @@ void RemoveSource(Source::Type source); bool HasAnySources() const; bool HasOnlySource(Source::Type source) const; + WebAppSources GetSources() const; bool IsSynced() const; bool IsPreinstalledApp() const; @@ -322,16 +324,13 @@ base::Value AsDebugValue() const; private: - using Sources = std::bitset<Source::kMaxValue + 1>; - bool HasAnySpecifiedSourcesAndNoOtherSources(Sources specified_sources) const; - friend class WebAppDatabase; friend std::ostream& operator<<(std::ostream&, const WebApp&); AppId app_id_; // This set always contains at least one source. - Sources sources_; + WebAppSources sources_; std::string name_; std::string description_;
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc index 4f9643d..ea549e6 100644 --- a/chrome/browser/web_applications/web_app_database.cc +++ b/chrome/browser/web_applications/web_app_database.cc
@@ -582,7 +582,7 @@ return nullptr; } - WebApp::Sources sources; + WebAppSources sources; sources[Source::kSystem] = local_data.sources().system(); sources[Source::kPolicy] = local_data.sources().policy(); sources[Source::kWebAppStore] = local_data.sources().web_app_store();
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.cc b/chrome/browser/web_applications/web_app_install_finalizer.cc index 34645ce1..74104fa 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.cc +++ b/chrome/browser/web_applications/web_app_install_finalizer.cc
@@ -171,6 +171,16 @@ // promoted to |true|, but not vice versa. if (!web_app->is_locally_installed()) web_app->SetIsLocallyInstalled(options.locally_installed); + + // There is a chance that existing sources type(s) are user uninstallable + // but the newly added source type is NOT user uninstallable. In this + // case, the following call will unregister os uninstallation. + // TODO(https://crbug.com/1273270): This does NOT block installation, and + // there is a possible edge case here where installation completes before + // this os hook is written. The best place to fix this is to put this code + // is where OS Hooks are called - however that is currently separate from + // this class. See https://crbug.com/1273269. + MaybeUnregisterOsUninstall(web_app.get(), source, *os_integration_manager_); } else { // New app. web_app = std::make_unique<WebApp>(app_id); @@ -511,18 +521,33 @@ ConvertSourceTypeToWebAppUninstallSource(source); UninstallWebAppInternal(app_id, uninstall_source, std::move(callback)); } else { - ScopedRegistryUpdate update(sync_bridge_); - WebApp* app_to_update = update->UpdateApp(app_id); - app_to_update->RemoveSource(source); - if (install_source_removed_callback_for_testing_) - install_source_removed_callback_for_testing_.Run(app_id); - - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), - /*uninstalled=*/true)); + // There is a chance that removed source type is NOT user uninstallable + // but the remaining source (after removal) types are user uninstallable. + // In this case, the following call will register os uninstallation. + MaybeRegisterOsUninstall( + app, source, *os_integration_manager_, + base::BindOnce(&WebAppInstallFinalizer::OnMaybeRegisterOsUninstall, + weak_ptr_factory_.GetWeakPtr(), app_id, source, + std::move(callback))); } } +void WebAppInstallFinalizer::OnMaybeRegisterOsUninstall( + const AppId& app_id, + Source::Type source, + UninstallWebAppCallback callback, + OsHooksErrors os_hooks_errors) { + ScopedRegistryUpdate update(sync_bridge_); + WebApp* app_to_update = update->UpdateApp(app_id); + app_to_update->RemoveSource(source); + if (install_source_removed_callback_for_testing_) + install_source_removed_callback_for_testing_.Run(app_id); + + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), + /*uninstalled=*/true)); +} + void WebAppInstallFinalizer::SetWebAppManifestFieldsAndWriteData( const WebApplicationInfo& web_app_info, std::unique_ptr<WebApp> web_app,
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.h b/chrome/browser/web_applications/web_app_install_finalizer.h index 9b6e58b..287043f 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.h +++ b/chrome/browser/web_applications/web_app_install_finalizer.h
@@ -173,6 +173,11 @@ Source::Type source, UninstallWebAppCallback callback); + void OnMaybeRegisterOsUninstall(const AppId& app_id, + Source::Type source, + UninstallWebAppCallback callback, + OsHooksErrors os_hooks_errors); + void SetWebAppManifestFieldsAndWriteData( const WebApplicationInfo& web_app_info, std::unique_ptr<WebApp> web_app,
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc index 41c92d228..ee24bb1d 100644 --- a/chrome/browser/web_applications/web_app_install_task.cc +++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -37,12 +37,12 @@ #include "url/gurl.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/app.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "components/arc/mojom/app.mojom.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "net/base/url_util.h" #endif @@ -909,7 +909,16 @@ // configured from somewhere else rather than always true. options.os_hooks[OsHookType::kFileHandlers] = true; options.os_hooks[OsHookType::kProtocolHandlers] = true; - options.os_hooks[OsHookType::kUninstallationViaOsSettings] = true; + + // Apps that can't be uninstalled from users shouldn't register to + // OS Settings. + const WebApp* web_app = registrar_->GetAppById(app_id); + if (web_app) { + // Certain unit tests could have nullptr web_app. + options.os_hooks[OsHookType::kUninstallationViaOsSettings] = + web_app->CanUserUninstallWebApp(); + } + #if defined(OS_WIN) || defined(OS_MAC) || \ (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) options.os_hooks[OsHookType::kUrlHandlers] = true;
diff --git a/chrome/browser/web_applications/web_app_install_task_unittest.cc b/chrome/browser/web_applications/web_app_install_task_unittest.cc index 4f28e10..92cb301 100644 --- a/chrome/browser/web_applications/web_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_task_unittest.cc
@@ -66,13 +66,13 @@ #include "url/gurl.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/fake_app_instance.h" #include "chrome/browser/ui/app_list/arc/arc_app_test.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/arc/test/fake_intent_helper_instance.h" #endif
diff --git a/chrome/browser/web_applications/web_app_install_utils.cc b/chrome/browser/web_applications/web_app_install_utils.cc index 9a84de0..2b08d3e 100644 --- a/chrome/browser/web_applications/web_app_install_utils.cc +++ b/chrome/browser/web_applications/web_app_install_utils.cc
@@ -19,10 +19,14 @@ #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" +#include "build/build_config.h" #include "chrome/browser/favicon/favicon_utils.h" #include "chrome/browser/ssl/security_state_tab_helper.h" +#include "chrome/browser/web_applications/os_integration_manager.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_file_handler_manager.h" #include "chrome/browser/web_applications/web_app_icon_generator.h" +#include "chrome/browser/web_applications/web_app_utils.h" #include "components/services/app_service/public/cpp/icon_info.h" #include "components/services/app_service/public/cpp/protocol_handler_info.h" #include "components/services/app_service/public/cpp/share_target.h" @@ -716,4 +720,50 @@ #endif } +void MaybeRegisterOsUninstall(const WebApp* web_app, + Source::Type source_uninstalling, + OsIntegrationManager& os_integration_manager, + InstallOsHooksCallback callback) { +#if defined(OS_WIN) + // |web_app| object will remove target |source_uninstalling| type. + // If the remaining source types and they happen to be user + // uninstallable, then it should register OsSettings. + WebAppSources sources = web_app->GetSources(); + DCHECK(sources.test(source_uninstalling)); + bool user_installable_before_uninstall = CanUserUninstallWebApp(sources); + sources[source_uninstalling] = false; + bool user_installable_after_uninstall = CanUserUninstallWebApp(sources); + + if (!user_installable_before_uninstall && user_installable_after_uninstall) { + InstallOsHooksOptions options; + options.os_hooks[OsHookType::kUninstallationViaOsSettings] = true; + os_integration_manager.InstallOsHooks( + web_app->app_id(), std::move(callback), nullptr, options); + return; + } +#endif + std::move(callback).Run(OsHooksErrors()); +} + +void MaybeUnregisterOsUninstall(const WebApp* web_app, + Source::Type source_installing, + OsIntegrationManager& os_integration_manager) { +#if defined(OS_WIN) + // |web_app| object will add target |source_installing| type. + // If the old source types are user installable, but new type is not, then + // it should unregister OsSettings. + WebAppSources sources = web_app->GetSources(); + bool user_installable_before_install = CanUserUninstallWebApp(sources); + sources[source_installing] = true; + bool user_installable_after_install = CanUserUninstallWebApp(sources); + + if (user_installable_before_install && !user_installable_after_install) { + OsHooksOptions options; + options[OsHookType::kUninstallationViaOsSettings] = true; + os_integration_manager.UninstallOsHooks(web_app->app_id(), options, + base::DoNothing()); + } +#endif +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_install_utils.h b/chrome/browser/web_applications/web_app_install_utils.h index b2e8358..e03a311 100644 --- a/chrome/browser/web_applications/web_app_install_utils.h +++ b/chrome/browser/web_applications/web_app_install_utils.h
@@ -8,6 +8,7 @@ #include <vector> #include "base/strings/string_piece_forward.h" +#include "chrome/browser/web_applications/os_integration_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_application_info.h" #include "components/services/app_service/public/cpp/file_handler.h" @@ -32,6 +33,8 @@ namespace web_app { +class WebApp; + enum class ForInstallableSite { kYes, kNo, @@ -92,6 +95,17 @@ void CreateWebAppInstallTabHelpers(content::WebContents* web_contents); +// The function should be called before removing a source from the WebApp. +void MaybeRegisterOsUninstall(const WebApp* web_app, + Source::Type source_uninstalling, + OsIntegrationManager& os_integration_manager, + InstallOsHooksCallback callback); + +// The function should be called before adding source to the WebApp. +void MaybeUnregisterOsUninstall(const WebApp* web_app, + Source::Type source_installing, + OsIntegrationManager& os_integration_manager); + } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INSTALL_UTILS_H_
diff --git a/chrome/browser/web_applications/web_app_install_utils_unittest.cc b/chrome/browser/web_applications/web_app_install_utils_unittest.cc index 9f7ca47..45c0bf8e 100644 --- a/chrome/browser/web_applications/web_app_install_utils_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_utils_unittest.cc
@@ -11,6 +11,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" +#include "build/build_config.h" #include "chrome/browser/web_applications/test/web_app_icon_test_utils.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_file_handler_manager.h" @@ -27,6 +28,16 @@ #include "url/gurl.h" #include "url/origin.h" +#if defined(OS_WIN) +#include "base/test/bind.h" +#include "chrome/browser/web_applications/test/mock_os_integration_manager.h" +#include "chrome/browser/web_applications/web_app.h" +#include "components/webapps/browser/installable/installable_metrics.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gmock/include/gmock/gmock-actions.h" +#include "testing/gmock/include/gmock/gmock.h" + +#endif namespace web_app { using Purpose = blink::mojom::ManifestImageResource_Purpose; @@ -1046,4 +1057,151 @@ INSTANTIATE_TEST_SUITE_P(, FileHandlersFromManifestTest, testing::Bool()); +#if defined(OS_WIN) +class RegisterOsSettingsTest : public testing::Test { + public: + RegisterOsSettingsTest() { + feature_list_.InitWithFeatures( + {features::kEnableWebAppUninstallFromOsSettings}, {}); + } + ~RegisterOsSettingsTest() override = default; + + private: + base::test::ScopedFeatureList feature_list_; + content::BrowserTaskEnvironment browser_task_environment_; +}; + +TEST_F(RegisterOsSettingsTest, MaybeRegisterOsUninstall) { + // MaybeRegisterOsUninstall + // Scenario 1. + // web app sources: kDefault, kPolicy + // removed source: kPolicy + // check web_app.CanUserUninstallWebApp is false + // check RegisterWebAppOsUninstallation is called + const AppId app_id = "test"; + testing::StrictMock<MockOsIntegrationManager> manager; + manager.ScopedSuppressOsHooksForTesting(); + // InstallOsHooks from MaybeRegisterOsUninstall + // sets only kUninstallationViaOsSettings that will async call from + // InstallOsHooks. Test ends before async is called so we test against + // InstallOsHooks. + EXPECT_CALL(manager, MacAppShimOnAppInstalledForProfile(app_id)).Times(1); + EXPECT_CALL(manager, RegisterWebAppOsUninstallation(app_id, testing::_)) + .Times(1); + + // Scenario 1. + auto web_app = std::make_unique<WebApp>(app_id); + web_app->AddSource(Source::kDefault); + web_app->AddSource(Source::kPolicy); + EXPECT_FALSE(web_app->CanUserUninstallWebApp()); + + base::RunLoop run_loop; + MaybeRegisterOsUninstall( + web_app.get(), Source::kPolicy, manager, + base::BindLambdaForTesting( + [&](OsHooksErrors os_hooks_errors) { run_loop.Quit(); })); + run_loop.Run(); +} + +TEST_F(RegisterOsSettingsTest, MaybeRegisterOsSettings_NoRegistration) { + // MaybeRegisterOsUninstall + // Scenario 2. + // web app sources: kSync, kPolicy + // removed source: kSync + // check web_app.CanUserUninstallWebApp is false + // check RegisterWebAppOsUninstallation is not called + + // Scenario 3. + // web app sources: kDefault, kSync, kWewbAppStore + // removed source: kSync + // check web_app.CanUserUninstallWebApp is true + // check RegisterWebAppOsUninstallation is not called + const AppId app_id = "test"; + testing::StrictMock<MockOsIntegrationManager> manager; + manager.ScopedSuppressOsHooksForTesting(); + // InstallOsHooks from MaybeRegisterOsUninstall + // sets only kUninstallationViaOsSettings that will async call from + // InstallOsHooks. Test ends before async is called so we test against + // InstallOsHooks. + EXPECT_CALL(manager, RegisterWebAppOsUninstallation(app_id, testing::_)) + .Times(0); + + // Scenario 2. + auto web_app = std::make_unique<WebApp>(app_id); + web_app->AddSource(Source::kSync); + web_app->AddSource(Source::kPolicy); + EXPECT_FALSE(web_app->CanUserUninstallWebApp()); + MaybeRegisterOsUninstall(web_app.get(), Source::kSync, manager, + base::DoNothing()); + + // Scenario 3. + auto web_app2 = std::make_unique<WebApp>(app_id); + web_app2->AddSource(Source::kDefault); + web_app2->AddSource(Source::kSync); + web_app2->AddSource(Source::kWebAppStore); + EXPECT_TRUE(web_app2->CanUserUninstallWebApp()); + MaybeRegisterOsUninstall(web_app2.get(), Source::kDefault, manager, + base::DoNothing()); +} + +TEST_F(RegisterOsSettingsTest, MaybeUnregisterOsUninstall) { + // MaybeUnregisterOsUninstall + // Scenario 1. + // web app sources: kDefault + // added source: kPolicy + // check web_app.CanUserUninstallWebApp is false + // check UnregisterWebAppOsUninstallation is called + const AppId app_id = "test"; + testing::StrictMock<MockOsIntegrationManager> manager; + manager.ScopedSuppressOsHooksForTesting(); + // InstallOsHooks from MaybeRegisterOsUninstall + // sets only kUninstallationViaOsSettings that will async call from + // InstallOsHooks. Test ends before async is called so we test against + // InstallOsHooks. + EXPECT_CALL(manager, UnregisterWebAppOsUninstallation(app_id)).Times(1); + + // Scenario 1. + auto web_app = std::make_unique<WebApp>(app_id); + web_app->AddSource(Source::kDefault); + EXPECT_TRUE(web_app->CanUserUninstallWebApp()); + MaybeUnregisterOsUninstall(web_app.get(), Source::kPolicy, manager); +} + +TEST_F(RegisterOsSettingsTest, MaybeUnregisterOsSettings_NoUnregistration) { + // MaybeUnregisterOsUninstall + // Scenario 2. + // web app sources: kSync, kPolicy + // added source: kSync + // check web_app.CanUserUninstallWebApp is false + // check UnregisterWebAppOsUninstallation is not called + + // Scenario 3. + // web app sources: kSync + // added source: kSync + // check web_app.CanUserUninstallWebApp is true + // check UnregisterWebAppOsUninstallation is not called + const AppId app_id = "test"; + testing::StrictMock<MockOsIntegrationManager> manager; + manager.ScopedSuppressOsHooksForTesting(); + // InstallOsHooks from MaybeRegisterOsUninstall + // sets only kUninstallationViaOsSettings that will async call from + // InstallOsHooks. Test ends before async is called so we test against + // InstallOsHooks. + EXPECT_CALL(manager, UnregisterWebAppOsUninstallation(app_id)).Times(0); + + // Scenario 2. + auto web_app = std::make_unique<WebApp>(app_id); + web_app->AddSource(Source::kPolicy); + EXPECT_FALSE(web_app->CanUserUninstallWebApp()); + MaybeUnregisterOsUninstall(web_app.get(), Source::kSync, manager); + + // Scenario 3. + auto web_app2 = std::make_unique<WebApp>(app_id); + web_app2->AddSource(Source::kSync); + EXPECT_TRUE(web_app2->CanUserUninstallWebApp()); + MaybeUnregisterOsUninstall(web_app2.get(), Source::kDefault, manager); +} + +#endif // defined(OS_WIN) + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_shortcut_linux.cc b/chrome/browser/web_applications/web_app_shortcut_linux.cc index d5fc7dd3..22344794 100644 --- a/chrome/browser/web_applications/web_app_shortcut_linux.cc +++ b/chrome/browser/web_applications/web_app_shortcut_linux.cc
@@ -370,6 +370,8 @@ bool DeleteShortcutInAutoStart(base::Environment* env, const base::FilePath& shortcut_filename) { + // TODO(crbug.com/1276141): Support shortcut testing in Auto Start. + DCHECK(!web_app::GetShortcutOverrideForTesting()); base::FilePath autostart_path = AutoStart::GetAutostartDirectory(env); return base::DeleteFile(autostart_path.Append(shortcut_filename)); } @@ -377,6 +379,8 @@ bool DeleteShortcutInApplicationsMenu( const base::FilePath& shortcut_filename, const base::FilePath& directory_filename) { + // TODO(crbug.com/1276141): Support shortcut testing in Applications Menu. + DCHECK(!web_app::GetShortcutOverrideForTesting()); std::vector<std::string> argv; argv.push_back("xdg-desktop-menu"); argv.push_back("uninstall"); @@ -583,11 +587,14 @@ // directory. It doesn't matter: this will still delete the shortcut even if // it isn't in the directory. - bool deleted_from_autostart = - DeleteShortcutInAutoStart(env, shortcut_filename); + bool deleted_from_autostart = true; + if (!web_app::GetShortcutOverrideForTesting()) + deleted_from_autostart = DeleteShortcutInAutoStart(env, shortcut_filename); - bool deleted_from_application_menu = DeleteShortcutInApplicationsMenu( - shortcut_filename, base::FilePath(kDirectoryFilename)); + bool deleted_from_application_menu = true; + if (!web_app::GetShortcutOverrideForTesting()) + deleted_from_application_menu = DeleteShortcutInApplicationsMenu( + shortcut_filename, base::FilePath(kDirectoryFilename)); return (deleted_from_desktop && deleted_from_autostart && deleted_from_application_menu); } @@ -615,7 +622,8 @@ shell_integration_linux::GetExistingProfileShortcutFilenames( profile_path, autostart_path); for (const auto& shortcut : shortcut_filenames_autostart) { - if (!DeleteShortcutInAutoStart(env, shortcut)) + if (!web_app::GetShortcutOverrideForTesting() && + !DeleteShortcutInAutoStart(env, shortcut)) result = false; } @@ -627,7 +635,8 @@ shell_integration_linux::GetExistingProfileShortcutFilenames( profile_path, applications_menu); for (const auto& menu : shortcut_filenames_app_menu) { - if (!DeleteShortcutInApplicationsMenu(menu, + if (!web_app::GetShortcutOverrideForTesting() && + !DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename))) { result = false; }
diff --git a/chrome/browser/web_applications/web_app_utils.cc b/chrome/browser/web_applications/web_app_utils.cc index 0d71024..2a60ca6 100644 --- a/chrome/browser/web_applications/web_app_utils.cc +++ b/chrome/browser/web_applications/web_app_utils.cc
@@ -371,4 +371,20 @@ } } +bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, + WebAppSources specified_sources) { + bool has_any_specified_sources = (sources & specified_sources).any(); + bool has_no_other_sources = (sources & ~specified_sources).none(); + return has_any_specified_sources && has_no_other_sources; +} + +bool CanUserUninstallWebApp(WebAppSources sources) { + WebAppSources specified_sources; + specified_sources[Source::kDefault] = true; + specified_sources[Source::kSync] = true; + specified_sources[Source::kWebAppStore] = true; + specified_sources[Source::kSubApp] = true; + return HasAnySpecifiedSourcesAndNoOtherSources(sources, specified_sources); +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_utils.h b/chrome/browser/web_applications/web_app_utils.h index 7dc6ac40..273924e 100644 --- a/chrome/browser/web_applications/web_app_utils.h +++ b/chrome/browser/web_applications/web_app_utils.h
@@ -10,6 +10,7 @@ #include "base/callback.h" #include "build/chromeos_buildflags.h" +#include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_id.h" #include "components/services/app_service/public/cpp/file_handler.h" @@ -143,6 +144,13 @@ bool allowed, base::OnceClosure update_finished_callback); +// Check if only |specified_sources| exist in the |sources| +bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, + WebAppSources specified_sources); + +// Check if all types of |sources| are uninstallable by the user. +bool CanUserUninstallWebApp(WebAppSources sources); + #if BUILDFLAG(IS_CHROMEOS_ASH) // The kLacrosPrimary and kWebAppsCrosapi features are each independently // sufficient to enable the web apps Crosapi (used for Lacros web app
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index c58debb..e8d8395 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1638468001-951219899e073cd135e2655b300017659c6ae883.profdata +chrome-linux-main-1638489589-596dd2f44b3a467d1b853b190ee3340b2a2477c5.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index a3f852f..b732152 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1638468001-d47638d05b9c93089b5c835a199dc8373c0b7008.profdata +chrome-mac-main-1638489589-3b117dd109d840d8c61278b96db976fcddb93c57.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 70086429..cb7536a 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1638468001-da49c1e910acd4f80c39eabbcedb7bf4ed9795fc.profdata +chrome-win32-main-1638489589-b1dd7fd623393fab2b334165324776b22c0d4b41.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 3d0285e..c6072d1 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1638478316-431b2571febaf766192bee435af724fd7c5cba42.profdata +chrome-win64-main-1638489589-66735ec8627a8fadf33b975d93b50988fd18590c.profdata
diff --git a/chrome/renderer/cart/commerce_hint_agent.cc b/chrome/renderer/cart/commerce_hint_agent.cc index ad2411d3..730538a 100644 --- a/chrome/renderer/cart/commerce_hint_agent.cc +++ b/chrome/renderer/cart/commerce_hint_agent.cc
@@ -58,7 +58,8 @@ constexpr base::FeatureParam<std::string> kAddToCartPattern{ &ntp_features::kNtpChromeCartModule, "add-to-cart-pattern", "(\\b|[^a-z])" - "((add(ed)?(-|_|(%20))?(item)?(-|_|(%20))?to(-|_|(%20))?(cart|basket|bag)" + "((add(ed)?(-|_|(%20)|\\s)?(item)?(-|_|(%20)|\\s)?to(-|_|(%20)|\\s)?(cart|" + "basket|bag)" ")|(cart\\/add)|(checkout\\/basket)|(cart_type)|(isquickaddtocartbutton))" "(\\b|[^a-z])"}; @@ -494,6 +495,9 @@ GetProductIdFromRequest(url.spec().substr(0, kLengthLimit), nullptr); } else if (navigation_url.host() == kGStoreHost) { is_add_to_cart = url.spec().find("O2JPA") != std::string::npos; + } else if (url.DomainIs("zappos.com")) { + is_add_to_cart = url.spec().find("mobileapi/v1/cart?displayRewards=true") != + std::string::npos; } else { is_add_to_cart = CommerceHintAgent::IsAddToCart(url.path_piece()); } @@ -554,7 +558,10 @@ if (navigation_url.DomainIs("groupon.com") && buf.size() > 10000) return false; - if (CommerceHintAgent::IsAddToCart(str)) { + // Per-site skipping length limit when checking request text. + bool skip_length_limit = navigation_url.DomainIs("otterbox.com"); + + if (CommerceHintAgent::IsAddToCart(str, skip_length_limit)) { std::string product_id; if (commerce_renderer_feature::IsPartnerMerchant(url)) { GetProductIdFromRequest(str.substr(0, kLengthLimit), &product_id); @@ -627,8 +634,10 @@ CommerceHintAgent::~CommerceHintAgent() = default; -bool CommerceHintAgent::IsAddToCart(base::StringPiece str) { - return PartialMatch(str.substr(0, kLengthLimit), GetAddToCartPattern()); +bool CommerceHintAgent::IsAddToCart(base::StringPiece str, + bool skip_length_limit) { + return PartialMatch(skip_length_limit ? str : str.substr(0, kLengthLimit), + GetAddToCartPattern()); } bool CommerceHintAgent::IsVisitCart(const GURL& url) {
diff --git a/chrome/renderer/cart/commerce_hint_agent.h b/chrome/renderer/cart/commerce_hint_agent.h index 78bc99b..7a7e2c1b 100644 --- a/chrome/renderer/cart/commerce_hint_agent.h +++ b/chrome/renderer/cart/commerce_hint_agent.h
@@ -27,8 +27,10 @@ CommerceHintAgent& operator=(const CommerceHintAgent&) = delete; // Whether the string, either from path of URL or XHR form contents, matches - // the add-to-cart heuristics. - static bool IsAddToCart(base::StringPiece str); + // the add-to-cart heuristics. |skip_length_limit| to decide whether to + // crop the string to under length limit when matching. + static bool IsAddToCart(base::StringPiece str, + bool skip_length_limit = false); // Whether the main frame URL is a shopping cart. static bool IsVisitCart(const GURL& main_frame_url); // Whether the main frame URL is a checkout page.
diff --git a/chrome/renderer/cart/commerce_hint_agent_unittest.cc b/chrome/renderer/cart/commerce_hint_agent_unittest.cc index 06fef2c..e19860b1 100644 --- a/chrome/renderer/cart/commerce_hint_agent_unittest.cc +++ b/chrome/renderer/cart/commerce_hint_agent_unittest.cc
@@ -778,6 +778,19 @@ } } +TEST(CommerceHintAgentTest, IsAddToCart_SkipLengthLimit) { + std::string str = "a"; + for (int i = 0; i < 12; ++i) { + str += str; + } + // This is equal to length limit in CommerceHintAgent. + EXPECT_EQ(str.size(), 4096U); + + str += "/add-to-cart"; + EXPECT_FALSE(CommerceHintAgent::IsAddToCart(str)); + EXPECT_TRUE(CommerceHintAgent::IsAddToCart(str, true)); +} + TEST(CommerceHintAgentTest, IsVisitCart) { for (auto* str : kVisitCart) { EXPECT_TRUE(CommerceHintAgent::IsVisitCart(GURL(str))) << str;
diff --git a/chrome/renderer/resources/cart/cart_domain_product_id_regex.json b/chrome/renderer/resources/cart/cart_domain_product_id_regex.json index 0a9e1c2c..6f2d570 100644 --- a/chrome/renderer/resources/cart/cart_domain_product_id_regex.json +++ b/chrome/renderer/resources/cart/cart_domain_product_id_regex.json
@@ -1,9 +1,11 @@ { "product_url": {}, "product_image_url": -{"www.wish.com": "(\\w+)-\\d+-medium", -"www.homesquare.com": "(images.cymax.com/Images/\\d+/(\\w+)-)"}, +{"www.homesquare.com": "(images.cymax.com/Images/\\d+/(\\w+)-)", +"www.wish.com": "(\\w+)-\\d+-medium"}, "product_element": -{"www.electronicexpress.com": "<a href=\"#modal-(\\w+)", -"checkout.iherb.com": "product id: ([\\w|-]+)"} +{"checkout.iherb.com": "product id: ([\\w|-]+)", +"www.electronicexpress.com": "<a href=\"#modal-(\\w+)", +"www.otterbox.com": "sku:\\s*</span>\\s*<span class=\"value\">([\\w|-]+)", +"www.zappos.com": "StockId</dt><dd class=\"[\\w|-]+\">(\\w+)"} }
diff --git a/chrome/services/file_util/public/cpp/sandboxed_rar_analyzer.cc b/chrome/services/file_util/public/cpp/sandboxed_rar_analyzer.cc index 8c801f4..387adf6 100644 --- a/chrome/services/file_util/public/cpp/sandboxed_rar_analyzer.cc +++ b/chrome/services/file_util/public/cpp/sandboxed_rar_analyzer.cc
@@ -81,7 +81,7 @@ if (base::CreateTemporaryFile(&temp_path)) { temp_file.Initialize( temp_path, (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | - base::File::FLAG_WRITE | base::File::FLAG_TEMPORARY | + base::File::FLAG_WRITE | base::File::FLAG_WIN_TEMPORARY | base::File::FLAG_DELETE_ON_CLOSE)); }
diff --git a/chrome/services/file_util/public/cpp/sandboxed_zip_analyzer.cc b/chrome/services/file_util/public/cpp/sandboxed_zip_analyzer.cc index ccc4301..259be65b 100644 --- a/chrome/services/file_util/public/cpp/sandboxed_zip_analyzer.cc +++ b/chrome/services/file_util/public/cpp/sandboxed_zip_analyzer.cc
@@ -56,7 +56,7 @@ if (base::CreateTemporaryFile(&temp_path)) { temp_file.Initialize( temp_path, (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | - base::File::FLAG_WRITE | base::File::FLAG_TEMPORARY | + base::File::FLAG_WRITE | base::File::FLAG_WIN_TEMPORARY | base::File::FLAG_DELETE_ON_CLOSE)); }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index dbad98e..f0617a3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2056,6 +2056,7 @@ "../browser/ui/webui/support_tool_ui_browsertest.cc", "../browser/ui/webui/tab_search/tab_search_ui_browsertest.cc", "../browser/ui/webui/webui_load_timer_browsertest.cc", + "../browser/ui/webui/webui_webview_browsertest.cc", "../browser/ui/zoom/zoom_controller_browsertest.cc", "../browser/ukm_worker_browsertest.cc", "../browser/unload_browsertest.cc", @@ -2137,9 +2138,6 @@ # https://crbug.com/1252812 The intent picker (launch icon) actions # are not working on Lacros. "../browser/ui/views/web_apps/web_app_integration_browsertest.cc", - - # Lacros does not seem to have any actual WebView-based UI to test. - "../browser/ui/webui/webui_webview_browsertest.cc", ] } @@ -2359,6 +2357,7 @@ "../browser/policy/test/hardware_acceleration_mode_enabled_browsertest.cc", "../browser/policy/test/variation_restrict_parameter_policy_browsertest.cc", "../browser/profiles/profile_window_browsertest.cc", + "../browser/ui/signin_reauth_view_controller_browsertest.cc", "../browser/ui/views/accessibility/accessibility_focus_highlight_browsertest.cc", "../browser/ui/views/profiles/signin_view_controller_delegate_views_browsertest.cc", ] @@ -2449,13 +2448,17 @@ "../browser/signin/dice_browsertest.cc", "../browser/signin/dice_web_signin_interceptor_browsertest.cc", "../browser/signin/signin_ui_util_browsertest.cc", - "../browser/ui/signin_reauth_view_controller_browsertest.cc", - "../browser/ui/views/sync/inline_login_ui_browsertest.cc", "../browser/unified_consent/unified_consent_browsertest.cc", ] if (is_win) { sources += [ "../browser/signin/signin_util_win_browsertest.cc" ] } + + # TODO(https://crbug.com/1198523: Remove this once enable_dice_support is + # no longer defined on Lacros. + if (is_chromeos_lacros) { + sources -= [ "../browser/signin/signin_ui_util_browsertest.cc" ] + } } else { sources += [ "../browser/signin/mirror_browsertest.cc" ] } @@ -2985,6 +2988,7 @@ "../browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl_browsertest.cc", "../browser/ui/views/session_crashed_bubble_view_browsertest.cc", "../browser/ui/views/status_bubble_views_browsertest.cc", + "../browser/ui/views/sync/inline_login_ui_browsertest.cc", "../browser/ui/views/sync/profile_signin_confirmation_dialog_views_browsertest.cc", "../browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc", "../browser/ui/views/tabs/tab_group_editor_bubble_view_browsertest.cc", @@ -3653,6 +3657,9 @@ # chromeos does not use the profile chooser view "../browser/ui/views/profiles/profile_menu_view_browsertest.cc", + + # inline login UI is disabled on chromeos + "../browser/ui/views/sync/inline_login_ui_browsertest.cc", "../browser/ui/views/sync/profile_signin_confirmation_dialog_views_browsertest.cc", "../browser/ui/webui/profile_helper_browsertest.cc", @@ -3666,8 +3673,12 @@ "//ash/app_list", "//ash/app_list:test_support", "//ash/app_list/model:app_list_model", + "//ash/components/arc:arc_base", + "//ash/components/arc:arc_metrics_constants", "//ash/components/arc:arc_test_support", + "//ash/components/arc:prefs", "//ash/components/arc/enterprise", + "//ash/components/arc/session:arc_base_enums", "//ash/components/attestation", "//ash/components/attestation:test_support", "//ash/components/audio", @@ -5191,6 +5202,7 @@ "//chrome/browser:buildflags", "//chrome/browser:permissions_proto", "//chrome/browser:theme_properties", + "//chrome/browser/breadcrumbs", "//chrome/browser/breadcrumbs:unit_tests", "//chrome/browser/browsing_data:constants", "//chrome/browser/commerce:feature_list", @@ -5249,6 +5261,7 @@ "//components/bookmarks/common", "//components/bookmarks/managed", "//components/breadcrumbs/core", + "//components/breadcrumbs/core:feature_flags", "//components/browser_sync", "//components/browsing_data/content", "//components/browsing_data/content:test_support", @@ -5710,10 +5723,19 @@ "../browser/signin/process_dice_header_delegate_impl_unittest.cc", "../browser/signin/signin_manager_unittest.cc", "../browser/ui/passwords/account_storage_auth_helper_unittest.cc", - "../browser/ui/startup/startup_browser_policy_unittest.cc", "../browser/ui/views/profiles/dice_web_signin_interception_bubble_view_unittest.cc", "../browser/ui/views/profiles/profile_customization_bubble_sync_controller_unittest.cc", ] + + # TODO(https://crbug.com/1198523: Remove this once enable_dice_support is no + # longer defined on Lacros. + if (is_chromeos_lacros) { + sources -= [ + "../browser/password_manager/multi_profile_credentials_filter_unittest.cc", + "../browser/signin/dice_web_signin_interceptor_unittest.cc", + "../browser/signin/signin_manager_unittest.cc", + ] + } } if (is_win || is_mac || (is_linux || is_chromeos_lacros)) { @@ -6040,6 +6062,7 @@ "../browser/ui/autofill/autofill_popup_controller_unittest.cc", "../browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc", "../browser/ui/bookmarks/bookmark_unittest.cc", + "../browser/ui/breadcrumb_manager_browser_agent_unittest.cc", "../browser/ui/browser_close_unittest.cc", "../browser/ui/browser_command_controller_unittest.cc", "../browser/ui/browser_instant_controller_unittest.cc", @@ -6673,6 +6696,7 @@ "//ash:test_support", "//ash/app_list:test_support", "//ash/app_list/model:app_list_model", + "//ash/components/arc", "//ash/components/arc:arc_test_support", "//ash/public/cpp/assistant/test_support", "//ash/public/cpp/resources:ash_public_unscaled_resources", @@ -6819,7 +6843,6 @@ "../browser/extensions/api/browsing_data/browsing_data_unittest.cc", "../browser/extensions/api/chrome_extensions_api_client_unittest.cc", "../browser/extensions/api/content_settings/content_settings_store_unittest.cc", - "../browser/extensions/api/content_settings/content_settings_unittest.cc", "../browser/extensions/api/cookies/cookies_helpers_unittest.cc", "../browser/extensions/api/cookies/cookies_unittest.cc", "../browser/extensions/api/cryptotoken_private/cryptotoken_private_api_unittest.cc", @@ -7288,6 +7311,9 @@ "../browser/ui/startup/startup_tab_provider_unittest.cc", ] } + if (!is_android && !is_chromeos_ash) { + sources += [ "../browser/ui/startup/startup_browser_policy_unittest.cc" ] + } if (use_gio) { configs += [ "//build/linux:gio_config" ] @@ -9035,6 +9061,7 @@ deps += [ "//ash/app_list:test_support", "//ash/components/arc:arc_test_support", + "//ash/components/arc/mojom", "//chromeos/printing", "//components/desks_storage", "//components/user_manager:test_support",
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index cdb775e..b2ae093c 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -38,6 +38,9 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/crosapi/crosapi_manager.h" #include "chrome/browser/ash/crosapi/idle_service_ash.h" +#include "components/user_manager/fake_user_manager.h" +#include "components/user_manager/scoped_user_manager.h" +#include "components/user_manager/user_manager.h" #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) @@ -55,6 +58,10 @@ void BrowserWithTestWindowTest::SetUp() { testing::Test::SetUp(); #if BUILDFLAG(IS_CHROMEOS_ASH) + if (!user_manager::UserManager::IsInitialized()) { + scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>( + std::make_unique<user_manager::FakeUserManager>()); + } ash_test_helper_.SetUp(); #endif
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h index dd21900..a89e9da1 100644 --- a/chrome/test/base/browser_with_test_window_test.h +++ b/chrome/test/base/browser_with_test_window_test.h
@@ -25,7 +25,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/test/ash_test_helper.h" #include "ash/test/ash_test_views_delegate.h" -#include "chrome/browser/ash/login/users/scoped_test_user_manager.h" #include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h" #include "chromeos/tpm/stub_install_attributes.h" #else @@ -52,6 +51,10 @@ namespace crosapi { class CrosapiManager; } + +namespace user_manager { +class ScopedUserManager; +} // namespace user_manager #endif class TestingProfileManager; @@ -225,7 +228,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) ash::ScopedCrosSettingsTestHelper cros_settings_test_helper_; - ash::ScopedTestUserManager test_user_manager_; + std::unique_ptr<user_manager::ScopedUserManager> scoped_user_manager_; std::unique_ptr<crosapi::CrosapiManager> manager_; #endif
diff --git a/chrome/test/base/chromeos/ash_browser_test_starter.cc b/chrome/test/base/chromeos/ash_browser_test_starter.cc index ae6ef6e9..2c70a7b 100644 --- a/chrome/test/base/chromeos/ash_browser_test_starter.cc +++ b/chrome/test/base/chromeos/ash_browser_test_starter.cc
@@ -47,20 +47,28 @@ class LacrosStartedObserver : public crosapi::BrowserManagerObserver { public: - explicit LacrosStartedObserver(base::OnceClosure quit_closure) - : quit_closure_(std::move(quit_closure)) {} + LacrosStartedObserver() = default; LacrosStartedObserver(const LacrosStartedObserver&) = delete; LacrosStartedObserver& operator=(const LacrosStartedObserver&) = delete; ~LacrosStartedObserver() override = default; void OnStateChanged() override { if (crosapi::BrowserManager::Get()->IsRunning()) { - std::move(quit_closure_).Run(); + run_loop_.Quit(); } } + void Wait(base::TimeDelta timeout) { + if (crosapi::BrowserManager::Get()->IsRunning()) { + return; + } + base::ThreadPool::PostDelayedTask(FROM_HERE, run_loop_.QuitClosure(), + timeout); + run_loop_.Run(); + } + private: - base::OnceClosure quit_closure_; + base::RunLoop run_loop_; }; void WaitForExoStarted(const base::FilePath& xdg_path) { @@ -85,13 +93,12 @@ WaitForExoStarted(scoped_temp_dir_xdg_.GetPath()); crosapi::BrowserManager::Get()->NewWindow(/*incongnito=*/false); - base::RunLoop run_loop; - LacrosStartedObserver observer(run_loop.QuitClosure()); + + LacrosStartedObserver observer; crosapi::BrowserManager::Get()->AddObserver(&observer); - base::ThreadPool::PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), - TestTimeouts::action_max_timeout()); - run_loop.Run(); + observer.Wait(TestTimeouts::action_max_timeout()); crosapi::BrowserManager::Get()->RemoveObserver(&observer); + CHECK(crosapi::BrowserManager::Get()->IsRunning()); // Create a new ash browser window so browser() can work.
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index f661a1d3..14629b6 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -8,7 +8,6 @@ import("//chrome/test/base/js2gtest.gni") import("//chrome/test/include_js_tests.gni") import("//chromeos/components/chromebox_for_meetings/buildflags/buildflags.gni") -import("//components/signin/features.gni") import("//printing/buildflags/buildflags.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") @@ -162,11 +161,8 @@ "webview_manager/webview_manager_browsertest.js", ] } else { - sources += [ "signin/signin_browsertest.js" ] - } - - if (enable_dice_support) { sources += [ + "signin/signin_browsertest.js", "welcome/a11y_tests.js", "welcome/welcome_browsertest.js", ] @@ -190,7 +186,7 @@ if (!is_android) { sources += [ "access_code_cast/access_code_cast_browsertest.js", - "commander/commander_browsertest.js", + "commander/commander_browsertest.js" ] } if (is_cfm) {
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/onboarding_wait_for_manual_wp_disable_page_test.js b/chrome/test/data/webui/chromeos/shimless_rma/onboarding_wait_for_manual_wp_disable_page_test.js index 20b8967..68652c0 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/onboarding_wait_for_manual_wp_disable_page_test.js +++ b/chrome/test/data/webui/chromeos/shimless_rma/onboarding_wait_for_manual_wp_disable_page_test.js
@@ -99,19 +99,4 @@ assertDeepEquals(savedResult, expectedResult); }); - - test('ManualWpDisablePageRendersQrCode', async () => { - await initializeWaitForManualWpDisablePage(); - - const expectedCanvasSize = 60; - - assertEquals(suppressedComponentCanvasSize_(component), expectedCanvasSize); - const canvas = component.shadowRoot.querySelector('#qrCodeCanvas'); - assertTrue(!!canvas); - assertEquals(canvas.width, expectedCanvasSize); - assertEquals(canvas.height, expectedCanvasSize); - - const context = canvas.getContext('2d'); - assertTrue(!!context); - }); }
diff --git a/chrome/test/data/webui/chromeos/shimless_rma/reimaging_calibration_run_page_test.js b/chrome/test/data/webui/chromeos/shimless_rma/reimaging_calibration_run_page_test.js index 16835da..af4a0682 100644 --- a/chrome/test/data/webui/chromeos/shimless_rma/reimaging_calibration_run_page_test.js +++ b/chrome/test/data/webui/chromeos/shimless_rma/reimaging_calibration_run_page_test.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js'; import {FakeShimlessRmaService} from 'chrome://shimless-rma/fake_shimless_rma_service.js'; import {setShimlessRmaServiceForTesting} from 'chrome://shimless-rma/mojo_interface_provider.js'; @@ -169,7 +170,9 @@ test('CalibrationProgressUpdatesStatusMessage', async () => { await initializeCalibrationRunPage(); const statusMessage = component.shadowRoot.querySelector('#calibration'); - let message = statusMessage.innerHTML; + assertEquals( + loadTimeData.getString('runCalibrationStartingText'), + statusMessage.textContent.trim()); service.triggerCalibrationObserver( { component: ComponentType.kBaseGyroscope, @@ -178,8 +181,11 @@ }, 0); await flushTasks(); - let message2 = statusMessage.innerHTML; - assertNotEquals(message, statusMessage.innerHTML); + assertEquals( + loadTimeData.getStringF( + 'runCalibrationCalibratingComponent', + loadTimeData.getString('componentBaseGyroscope')), + statusMessage.textContent.trim()); service.triggerCalibrationObserver( { component: ComponentType.kLidAccelerometer, @@ -188,7 +194,10 @@ }, 0); await flushTasks(); - assertNotEquals(message, statusMessage.innerHTML); - assertNotEquals(message2, statusMessage.innerHTML); + assertEquals( + loadTimeData.getStringF( + 'runCalibrationCalibratingComponent', + loadTimeData.getString('componentLidAccelerometer')), + statusMessage.textContent.trim()); }); }
diff --git a/chrome/test/data/webui/cr_components/chromeos/bluetooth/bluetooth_pairing_ui_test.js b/chrome/test/data/webui/cr_components/chromeos/bluetooth/bluetooth_pairing_ui_test.js index 3e8c418..070e919 100644 --- a/chrome/test/data/webui/cr_components/chromeos/bluetooth/bluetooth_pairing_ui_test.js +++ b/chrome/test/data/webui/cr_components/chromeos/bluetooth/bluetooth_pairing_ui_test.js
@@ -699,4 +699,61 @@ deviceHandler.completePairDevice(/*success=*/ true); await finishedPromise; }); + + test('Cancel pairing and fail pairing ', async function() { + await init(); + assertTrue(!!getDeviceSelectionPage()); + const deviceId = '123456'; + + const device = createDefaultBluetoothDevice( + deviceId, + /*publicName=*/ 'BeatsX', + /*connectionState=*/ + chromeos.bluetoothConfig.mojom.DeviceConnectionState.kConnected, + /*opt_nickname=*/ 'device1', + /*opt_audioCapability=*/ + mojom.AudioOutputCapability.kCapableOfAudioOutput, + /*opt_deviceType=*/ mojom.DeviceType.kMouse); + const pairingCode = '123456'; + + // Try pairing. + await selectDevice(device.deviceProperties); + await flushTasks(); + + let deviceHandler = bluetoothConfig.getLastCreatedPairingHandler(); + deviceHandler.requireAuthentication( + PairingAuthType.CONFIRM_PASSKEY, pairingCode); + await flushTasks(); + + // Confirmation code page should be shown. + assertTrue(!!getConfirmCodePage()); + assertEquals(getConfirmCodePage().code, pairingCode); + + // Simulate pairing failure. + deviceHandler.completePairDevice(/*success=*/ false); + await flushTasks(); + + // The device selection page should be shown and failed device ID + // should be set since the pairing operation failed. + assertTrue(!!getDeviceSelectionPage()); + assertEquals(getDeviceSelectionPage().failedPairingDeviceId, deviceId); + + // Retry pairing. + await selectDevice(device.deviceProperties); + await flushTasks(); + + deviceHandler.requireAuthentication( + PairingAuthType.CONFIRM_PASSKEY, pairingCode); + await flushTasks(); + + // Simulate clicking 'Cancel'. + await simulateCancelation(); + await flushTasks(); + + // The device selection page should be shown, but no failed device ID + // should be set since the operation was cancelled and did not explicitly + // fail. + assertTrue(!!getDeviceSelectionPage()); + assertFalse(!!getDeviceSelectionPage().failedPairingDeviceId); + }); });
diff --git a/chrome/test/data/webui/print_preview/BUILD.gn b/chrome/test/data/webui/print_preview/BUILD.gn index 809fa569..f03595de 100644 --- a/chrome/test/data/webui/print_preview/BUILD.gn +++ b/chrome/test/data/webui/print_preview/BUILD.gn
@@ -16,7 +16,7 @@ "destination_store_test.ts", "duplex_settings_test.ts", "invalid_settings_browsertest.ts", - "key_event_test.ts", + "key_event_test.js", "native_layer_stub.ts", "policy_test.js", "preview_generation_test.js", @@ -41,7 +41,8 @@ "destination_list_test.ts", "dpi_settings_test.ts", "header_test.ts", - "layout_settings_test.ts", + "layout_settings_test.js", + "link_container_test.js", "margins_settings_test.js", "media_size_settings_test.js", "model_settings_availability_test.js", @@ -86,7 +87,6 @@ "destination_search_test.ts", "destination_select_test.ts", ] - preprocessed_tests += [ "link_container_test.ts" ] } generate_grd("build_grdp") {
diff --git a/chrome/test/data/webui/print_preview/key_event_test.ts b/chrome/test/data/webui/print_preview/key_event_test.js similarity index 69% rename from chrome/test/data/webui/print_preview/key_event_test.ts rename to chrome/test/data/webui/print_preview/key_event_test.js index feea78d..bcd6c628 100644 --- a/chrome/test/data/webui/print_preview/key_event_test.ts +++ b/chrome/test/data/webui/print_preview/key_event_test.js
@@ -18,28 +18,30 @@ import {getCddTemplateWithAdvancedSettings, getDefaultInitialSettings} from './print_preview_test_utils.js'; import {TestPluginProxy} from './test_plugin_proxy.js'; -const key_event_test = { - suiteName: 'KeyEventTest', - TestNames: { - EnterTriggersPrint: 'enter triggers print', - NumpadEnterTriggersPrint: 'numpad enter triggers print', - EnterOnInputTriggersPrint: 'enter on input triggers print', - EnterOnDropdownDoesNotPrint: 'enter on dropdown does not print', - EnterOnButtonDoesNotPrint: 'enter on button does not print', - EnterOnCheckboxDoesNotPrint: 'enter on checkbox does not print', - EscapeClosesDialogOnMacOnly: 'escape closes dialog on mac only', - CmdPeriodClosesDialogOnMacOnly: 'cmd period closes dialog on mac only', - CtrlShiftPOpensSystemDialog: 'ctrl shift p opens system dialog', - }, +window.key_event_test = {}; +const key_event_test = window.key_event_test; +key_event_test.suiteName = 'KeyEventTest'; +/** @enum {string} */ +key_event_test.TestNames = { + EnterTriggersPrint: 'enter triggers print', + NumpadEnterTriggersPrint: 'numpad enter triggers print', + EnterOnInputTriggersPrint: 'enter on input triggers print', + EnterOnDropdownDoesNotPrint: 'enter on dropdown does not print', + EnterOnButtonDoesNotPrint: 'enter on button does not print', + EnterOnCheckboxDoesNotPrint: 'enter on checkbox does not print', + EscapeClosesDialogOnMacOnly: 'escape closes dialog on mac only', + CmdPeriodClosesDialogOnMacOnly: 'cmd period closes dialog on mac only', + CtrlShiftPOpensSystemDialog: 'ctrl shift p opens system dialog', }; -Object.assign(window, {key_event_test: key_event_test}); - suite(key_event_test.suiteName, function() { - let page: PrintPreviewAppElement; + /** @type {!PrintPreviewAppElement} */ + let page; - let nativeLayer: NativeLayerStub; + /** @type {!NativeLayerStub} */ + let nativeLayer; + /** @override */ setup(function() { const initialSettings = getDefaultInitialSettings(); nativeLayer = new NativeLayerStub(); @@ -58,7 +60,8 @@ PluginProxyImpl.setInstance(pluginProxy); document.body.innerHTML = ''; - page = document.createElement('print-preview-app'); + page = /** @type {!PrintPreviewAppElement} */ ( + document.createElement('print-preview-app')); document.body.appendChild(page); // Wait for initialization to complete. @@ -75,14 +78,14 @@ // Tests that the enter key triggers a call to print. test(assert(key_event_test.TestNames.EnterTriggersPrint), function() { const whenPrintCalled = nativeLayer.whenCalled('print'); - keyEventOn(page, 'keydown', 0, [], 'Enter'); + keyEventOn(page, 'keydown', 'Enter', [], 'Enter'); return whenPrintCalled; }); // Tests that the numpad enter key triggers a call to print. test(assert(key_event_test.TestNames.NumpadEnterTriggersPrint), function() { const whenPrintCalled = nativeLayer.whenCalled('print'); - keyEventOn(page, 'keydown', 0, [], 'Enter'); + keyEventOn(page, 'keydown', 'NumpadEnter', [], 'Enter'); return whenPrintCalled; }); @@ -91,11 +94,12 @@ test(assert(key_event_test.TestNames.EnterOnInputTriggersPrint), function() { const whenPrintCalled = nativeLayer.whenCalled('print'); keyEventOn( - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-copies-settings')!.shadowRoot! - .querySelector('print-preview-number-settings-section')!.shadowRoot! - .querySelector('cr-input')!.inputElement, - 'keydown', 0, [], 'Enter'); + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot.querySelector('print-preview-copies-settings') + .shadowRoot.querySelector('print-preview-number-settings-section') + .shadowRoot.querySelector('cr-input') + .inputElement, + 'keydown', 'Enter', [], 'Enter'); return whenPrintCalled; }); @@ -105,10 +109,10 @@ assert(key_event_test.TestNames.EnterOnDropdownDoesNotPrint), function() { const whenKeyEventFired = eventToPromise('keydown', page); keyEventOn( - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-layout-settings')!.shadowRoot! - .querySelector<HTMLSelectElement>('.md-select')!, - 'keydown', 0, [], 'Enter'); + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot.querySelector('print-preview-layout-settings') + .shadowRoot.querySelector('.md-select'), + 'keydown', 'Enter', [], 'Enter'); return whenKeyEventFired.then( () => assertEquals(0, nativeLayer.getCallCount('print'))); }); @@ -117,15 +121,15 @@ // comes from a button. test(assert(key_event_test.TestNames.EnterOnButtonDoesNotPrint), async () => { const moreSettingsElement = - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-more-settings')!; + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot.querySelector('print-preview-more-settings'); moreSettingsElement.$.label.click(); const button = - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-advanced-options-settings')! - .shadowRoot!.querySelector('cr-button')!; + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot.querySelector('print-preview-advanced-options-settings') + .shadowRoot.querySelector('cr-button'); const whenKeyEventFired = eventToPromise('keydown', button); - keyEventOn(button, 'keydown', 0, [], 'Enter'); + keyEventOn(button, 'keydown', 'Enter', [], 'Enter'); await whenKeyEventFired; await flushTasks(); assertEquals(0, nativeLayer.getCallCount('print')); @@ -136,15 +140,16 @@ test( assert(key_event_test.TestNames.EnterOnCheckboxDoesNotPrint), function() { const moreSettingsElement = - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-more-settings')!; + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot.querySelector('print-preview-more-settings'); moreSettingsElement.$.label.click(); const whenKeyEventFired = eventToPromise('keydown', page); keyEventOn( - page.shadowRoot!.querySelector('print-preview-sidebar')!.shadowRoot! - .querySelector('print-preview-other-options-settings')! - .shadowRoot!.querySelector('cr-checkbox')!, - 'keydown', 0, [], 'Enter'); + page.shadowRoot.querySelector('print-preview-sidebar') + .shadowRoot + .querySelector('print-preview-other-options-settings') + .shadowRoot.querySelector('cr-checkbox'), + 'keydown', 'Enter', [], 'Enter'); return whenKeyEventFired.then( () => assertEquals(0, nativeLayer.getCallCount('print'))); }); @@ -157,7 +162,7 @@ eventToPromise('keydown', page).then(() => { assertEquals(0, nativeLayer.getCallCount('dialogClose')); }); - keyEventOn(page, 'keydown', 0, [], 'Escape'); + keyEventOn(page, 'keydown', 'Escape', [], 'Escape'); return promise; }); @@ -170,14 +175,14 @@ eventToPromise('keydown', page).then(() => { assertEquals(0, nativeLayer.getCallCount('dialogClose')); }); - keyEventOn(page, 'keydown', 0, ['meta'], 'Period'); + keyEventOn(page, 'keydown', 'Period', ['meta'], 'Period'); return promise; }); // Tests that Ctrl+Shift+P opens the system dialog. test( assert(key_event_test.TestNames.CtrlShiftPOpensSystemDialog), function() { - let promise: Promise<void>; + let promise = null; if (isChromeOS || isLacros) { // Chrome OS doesn't have a system dialog. Just make sure the key // event does not trigger a crash. @@ -190,7 +195,7 @@ promise = nativeLayer.whenCalled('showSystemDialog'); } const modifiers = isMac ? ['meta', 'alt'] : ['ctrl', 'shift']; - keyEventOn(page, 'keydown', 0, modifiers, 'p'); + keyEventOn(page, 'keydown', 'KeyP', modifiers, 'KeyP'); return promise; }); });
diff --git a/chrome/test/data/webui/print_preview/layout_settings_test.ts b/chrome/test/data/webui/print_preview/layout_settings_test.js similarity index 69% rename from chrome/test/data/webui/print_preview/layout_settings_test.ts rename to chrome/test/data/webui/print_preview/layout_settings_test.js index ec57e17ad..37fe4eb5 100644 --- a/chrome/test/data/webui/print_preview/layout_settings_test.ts +++ b/chrome/test/data/webui/print_preview/layout_settings_test.js
@@ -3,7 +3,8 @@ // found in the LICENSE file. import 'chrome://print/print_preview.js'; -import {PrintPreviewLayoutSettingsElement} from 'chrome://print/print_preview.js'; + +import {assert} from 'chrome://resources/js/assert.m.js'; import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise, fakeDataBind} from 'chrome://webui-test/test_util.js'; @@ -11,15 +12,18 @@ import {selectOption} from './print_preview_test_utils.js'; suite('LayoutSettingsTest', function() { - let layoutSection: PrintPreviewLayoutSettingsElement; + /** @type {!PrintPreviewLayoutSettingsElement} */ + let layoutSection; /** @override */ setup(function() { document.body.innerHTML = ''; - const model = document.createElement('print-preview-model'); + const model = /** @type {!PrintPreviewModelElement} */ ( + document.createElement('print-preview-model')); document.body.appendChild(model); - layoutSection = document.createElement('print-preview-layout-settings'); + layoutSection = /** @type {!PrintPreviewLayoutSettingsElement} */ ( + document.createElement('print-preview-layout-settings')); layoutSection.settings = model.settings; layoutSection.disabled = false; fakeDataBind(model, layoutSection, 'settings'); @@ -28,7 +32,7 @@ // Tests that setting the setting updates the UI. test('set setting', async () => { - const select = layoutSection.shadowRoot!.querySelector('select')!; + const select = layoutSection.shadowRoot.querySelector('select'); assertEquals('portrait', select.value); layoutSection.setSetting('layout', true); @@ -39,15 +43,17 @@ // Tests that selecting a new option in the dropdown updates the setting. test('select option', async () => { // Verify that the selected option and names are as expected. - const select = layoutSection.shadowRoot!.querySelector('select')!; + const select = layoutSection.shadowRoot.querySelector('select'); assertEquals('portrait', select.value); - assertFalse(layoutSection.getSettingValue('layout') as boolean); + assertFalse( + /** @type {boolean} */ (layoutSection.getSettingValue('layout'))); assertFalse(layoutSection.getSetting('layout').setFromUi); assertEquals(2, select.options.length); // Verify that selecting an new option in the dropdown sets the setting. await selectOption(layoutSection, 'landscape'); - assertTrue(layoutSection.getSettingValue('layout') as boolean); + assertTrue( + /** @type {boolean} */ (layoutSection.getSettingValue('layout'))); assertTrue(layoutSection.getSetting('layout').setFromUi); }); });
diff --git a/chrome/test/data/webui/print_preview/link_container_test.ts b/chrome/test/data/webui/print_preview/link_container_test.js similarity index 61% rename from chrome/test/data/webui/print_preview/link_container_test.ts rename to chrome/test/data/webui/print_preview/link_container_test.js index e07adfa6..cec5208 100644 --- a/chrome/test/data/webui/print_preview/link_container_test.ts +++ b/chrome/test/data/webui/print_preview/link_container_test.js
@@ -4,31 +4,33 @@ import {Destination, DestinationConnectionStatus, DestinationOrigin, DestinationType, PrintPreviewLinkContainerElement} from 'chrome://print/print_preview.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {isWindows} from 'chrome://resources/js/cr.m.js'; +import {isMac, isWindows} from 'chrome://resources/js/cr.m.js'; import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise} from 'chrome://webui-test/test_util.js'; import {getCddTemplate} from './print_preview_test_utils.js'; -const link_container_test = { - suiteName: 'LinkContainerTest', - TestNames: { - HideInAppKioskMode: 'hide in app kiosk mode', - SystemDialogLinkClick: 'system dialog link click', - InvalidState: 'invalid state', - OpenInPreviewLinkClick: 'open in preview link click', - }, +window.link_container_test = {}; +const link_container_test = window.link_container_test; +link_container_test.suiteName = 'LinkContainerTest'; +/** @enum {string} */ +link_container_test.TestNames = { + HideInAppKioskMode: 'hide in app kiosk mode', + SystemDialogLinkClick: 'system dialog link click', + InvalidState: 'invalid state', + OpenInPreviewLinkClick: 'open in preview link click', }; -Object.assign(window, {link_container_test: link_container_test}); - suite(link_container_test.suiteName, function() { - let linkContainer: PrintPreviewLinkContainerElement; + /** @type {!PrintPreviewLinkContainerElement} */ + let linkContainer; + /** @override */ setup(function() { document.body.innerHTML = ''; - linkContainer = document.createElement('print-preview-link-container'); + linkContainer = /** @type {!PrintPreviewLinkContainerElement} */ ( + document.createElement('print-preview-link-container')); document.body.appendChild(linkContainer); /** Set inputs to some defaults. */ @@ -44,7 +46,9 @@ /** Tests that the system dialog link is hidden in App Kiosk mode. */ test(assert(link_container_test.TestNames.HideInAppKioskMode), function() { - const systemDialogLink = linkContainer.$.systemDialogLink; + const systemDialogLink = + /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector('#systemDialogLink')); assertFalse(systemDialogLink.hidden); linkContainer.set('appKioskMode', true); assertTrue(systemDialogLink.hidden); @@ -56,10 +60,13 @@ */ test(assert(link_container_test.TestNames.SystemDialogLinkClick), function() { const promise = eventToPromise('print-with-system-dialog', linkContainer); - const throbber = linkContainer.$.systemDialogThrobber; + const throbber = /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector('#systemDialogThrobber')); assertTrue(throbber.hidden); - const link = linkContainer.$.systemDialogLink; + const link = + /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector('#systemDialogLink')); link.click(); return promise.then(function() { assertEquals(isWindows, throbber.hidden); @@ -72,44 +79,52 @@ * and enabled on other platforms. */ test(assert(link_container_test.TestNames.InvalidState), function() { - const systemDialogLink = linkContainer.$.systemDialogLink; + const systemDialogLink = + /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector('#systemDialogLink')); - function validateLinkState(link: HTMLDivElement, disabled: boolean) { + /** + * @param {!HTMLDivElement} link + * @param {boolean} disabled + */ + const validateLinkState = (link, disabled) => { assertFalse(link.hidden); assertEquals(!disabled, link.hasAttribute('actionable')); - assertEquals(disabled, link.querySelector('cr-icon-button')!.disabled); - } + assertEquals(disabled, link.querySelector('cr-icon-button').disabled); + }; validateLinkState(systemDialogLink, false); - // <if expr="is_macosx"> - const openInPreviewLink = linkContainer.$.openPdfInPreviewLink; - validateLinkState(openInPreviewLink, false); - // </if> + let openInPreviewLink; + if (isMac) { + openInPreviewLink = /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector('#openPdfInPreviewLink')); + validateLinkState(openInPreviewLink, false); + } // Set disabled to true, indicating that there is a validation error or // printer error. linkContainer.disabled = true; validateLinkState(systemDialogLink, isWindows); - // <if expr="is_macosx"> - validateLinkState(assert(openInPreviewLink), true); - // </if> + if (isMac) { + validateLinkState(assert(openInPreviewLink), true); + } }); - // <if expr="is_macosx"> /** * Test that clicking the open in preview link correctly results in a * property change and that the throbber appears. Mac only. */ test( assert(link_container_test.TestNames.OpenInPreviewLinkClick), function() { - const throbber = linkContainer.$.openPdfInPreviewThrobber; + const throbber = /** @type {!HTMLDivElement} */ ( + linkContainer.shadowRoot.querySelector( + '#openPdfInPreviewThrobber')); assertTrue(throbber.hidden); const promise = eventToPromise('open-pdf-in-preview', linkContainer); - linkContainer.$.openPdfInPreviewLink.click(); + linkContainer.shadowRoot.querySelector('#openPdfInPreviewLink').click(); return promise.then(function() { assertFalse(throbber.hidden); }); }); - // </if> });
diff --git a/chrome/test/data/webui/signin/signin_browsertest.js b/chrome/test/data/webui/signin/signin_browsertest.js index 8ea1a79..6f81bce 100644 --- a/chrome/test/data/webui/signin/signin_browsertest.js +++ b/chrome/test/data/webui/signin/signin_browsertest.js
@@ -55,7 +55,6 @@ mocha.run(); }); -GEN('#if !BUILDFLAG(IS_CHROMEOS_LACROS)'); /** * Test fixture for * chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept.html. @@ -71,7 +70,6 @@ TEST_F('DiceWebSigninInterceptTest', 'Bubble', function() { mocha.run(); }); -GEN('#endif // !BUILDFLAG(IS_CHROMEOS_LACROS)'); /** * Test fixture for
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn index bb0b580..7350952 100644 --- a/chromecast/browser/BUILD.gn +++ b/chromecast/browser/BUILD.gn
@@ -247,6 +247,7 @@ "//chromecast/net:connectivity_checker", "//chromecast/net:socket_util", "//chromecast/service", + "//chromecast/ui:display_settings_manager", "//chromecast/ui:display_settings_public", "//components/cast/message_port:message_port_cast", "//components/cdm/browser", @@ -314,17 +315,7 @@ "//components/embedder_support/android:view", ] } else { - sources += [ - "cast_display_configurator.cc", - "cast_display_configurator.h", - "cast_touch_device_manager.cc", - "cast_touch_device_manager.h", - ] - - deps += [ - "//mojo/public/cpp/bindings", - "//ui/aura", - ] + deps += [ ":display_configurator" ] } if (is_linux || is_chromeos) { @@ -349,6 +340,7 @@ deps += [ "//chromecast/ui:media_control_ui", + "//ui/aura", "//ui/views:views", ] @@ -546,6 +538,32 @@ } } +cast_source_set("display_configurator") { + sources = [ + "cast_display_configurator.cc", + "cast_display_configurator.h", + "cast_touch_device_manager.cc", + "cast_touch_device_manager.h", + ] + + deps = [ + "//base", + "//chromecast:chromecast_buildflags", + "//chromecast/base", + "//chromecast/graphics", + "//chromecast/public", + "//ui/display", + "//ui/events/devices", + "//ui/gfx/geometry", + ] + + if (use_ozone) { + deps += [ "//ui/ozone" ] + } + + public_configs = [ "//skia:skia_config" ] +} + cast_source_set("simple_main_parts") { sources = [ "cast_browser_main_parts_simple.cc" ] @@ -727,6 +745,7 @@ deps = [ ":browser", + ":display_configurator", ":test_support", "//base", "//base/test:test_support",
diff --git a/chromecast/browser/accessibility/accessibility_service_impl.cc b/chromecast/browser/accessibility/accessibility_service_impl.cc index b9ee795..ea02e6f 100644 --- a/chromecast/browser/accessibility/accessibility_service_impl.cc +++ b/chromecast/browser/accessibility/accessibility_service_impl.cc
@@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include "base/bind.h" #include "base/check.h" #include "base/command_line.h" #include "base/logging.h" @@ -28,13 +29,13 @@ #include "chromecast/browser/cast_browser_process.h" #include "chromecast/browser/cast_web_contents.h" #include "chromecast/common/extensions_api/accessibility_private.h" -#include "chromecast/common/mojom/accessibility.mojom.h" #include "chromecast/graphics/cast_window_manager.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_file_task_runner.h" +#include "mojo/public/cpp/bindings/remote.h" namespace { constexpr char kExtensionsDirDefault[] = "/system/chrome/extensions"; @@ -59,9 +60,7 @@ DCHECK(browser_context); } -AccessibilityServiceImpl::~AccessibilityServiceImpl() { - receivers_.Clear(); -} +AccessibilityServiceImpl::~AccessibilityServiceImpl() = default; void AccessibilityServiceImpl::SetColorInversion(bool enable) { if (enable != color_inversion_enabled_) { @@ -221,11 +220,6 @@ std::move(callback).Run(std::move(settings)); } -void AccessibilityServiceImpl::AddBinding( - mojom::CastAccessibilityServiceRequest request) { - receivers_.Add(this, std::move(request)); -} - #if BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) void AccessibilityServiceImpl::LoadChromeVoxExtension( extensions::CastExtensionSystem* extension_system) {
diff --git a/chromecast/browser/accessibility/accessibility_service_impl.h b/chromecast/browser/accessibility/accessibility_service_impl.h index 5b6cce2..e1aa8176 100644 --- a/chromecast/browser/accessibility/accessibility_service_impl.h +++ b/chromecast/browser/accessibility/accessibility_service_impl.h
@@ -7,9 +7,6 @@ #include "chromecast/chromecast_buildflags.h" #include "chromecast/common/mojom/accessibility.mojom.h" -#include "mojo/public/cpp/bindings/receiver.h" -#include "mojo/public/cpp/bindings/receiver_set.h" -#include "mojo/public/cpp/bindings/remote_set.h" #if BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) #include "chromecast/browser/extensions/cast_extension_system.h" @@ -48,8 +45,6 @@ void GetAccessibilitySettings( GetAccessibilitySettingsCallback callback) override; - void AddBinding(mojom::CastAccessibilityServiceRequest request); - void Stop(); private: @@ -72,7 +67,6 @@ content::BrowserContext* const browser_context_; DisplaySettingsManager* const display_settings_manager_; - mojo::ReceiverSet<mojom::CastAccessibilityService> receivers_; #if BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) bool chromevox_enabled_ = false;
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc index 6b1f7fe..2b936ca 100644 --- a/chromecast/browser/cast_browser_main_parts.cc +++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -35,6 +35,7 @@ #include "chromecast/base/metrics/cast_metrics_helper.h" #include "chromecast/base/metrics/grouped_histogram.h" #include "chromecast/base/version.h" +#include "chromecast/browser/accessibility/accessibility_service_impl.h" #include "chromecast/browser/cast_browser_context.h" #include "chromecast/browser/cast_browser_process.h" #include "chromecast/browser/cast_content_browser_client.h" @@ -66,6 +67,7 @@ #include "chromecast/net/connectivity_checker.h" #include "chromecast/public/cast_media_shlib.h" #include "chromecast/service/cast_service.h" +#include "chromecast/ui/display_settings_manager_impl.h" #include "components/heap_profiling/multi_process/client_connection_manager.h" #include "components/heap_profiling/multi_process/supervisor.h" #include "components/prefs/pref_service.h" @@ -115,7 +117,7 @@ // header, but is exported to allow injecting the overlay-composited // callback. #include "chromecast/browser/accessibility/accessibility_manager_impl.h" -#include "chromecast/browser/cast_display_configurator.h" +#include "chromecast/browser/cast_display_configurator.h" // nogncheck #include "chromecast/browser/devtools/cast_ui_devtools.h" #include "chromecast/graphics/cast_screen.h" #include "chromecast/graphics/cast_window_manager_aura.h" @@ -477,6 +479,11 @@ return media_connector_.get(); } +AccessibilityServiceImpl* CastBrowserMainParts::accessibility_service() { + CHECK(accessibility_service_); + return accessibility_service_.get(); +} + void CastBrowserMainParts::PreCreateMainMessageLoop() { // GroupedHistograms needs to be initialized before any threads are created // to prevent race conditions between calls to Preregister and those threads @@ -673,6 +680,19 @@ ::media::InitializeMediaLibrary(); media_caps_->Initialize(); + display_settings_manager_ = std::make_unique<DisplaySettingsManagerImpl>( + window_manager_.get(), +#if defined(USE_AURA) + cast_browser_process_->display_configurator() +#else + nullptr +#endif // defined(USE_AURA) + ); + cast_browser_process_->SetAccessibilityService( + std::make_unique<AccessibilityServiceImpl>( + cast_browser_process_->browser_context(), + display_settings_manager_.get())); + web_service_ = std::make_unique<CastWebService>( cast_browser_process_->browser_context(), window_manager_.get()); browser_service_->AddInterface<::chromecast::mojom::CastWebService>( @@ -688,7 +708,9 @@ cast_browser_process_->browser_context(), cast_system_memory_pressure_evaluator_adjuster_, cast_browser_process_->pref_service(), video_plane_controller_.get(), - window_manager_.get(), web_service_.get())); + window_manager_.get(), web_service_.get(), + display_settings_manager_.get(), + cast_browser_process_->accessibility_service())); cast_browser_process_->cast_service()->Initialize(); #if BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS)
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h index bad446a..b32d013 100644 --- a/chromecast/browser/cast_browser_main_parts.h +++ b/chromecast/browser/cast_browser_main_parts.h
@@ -37,6 +37,7 @@ namespace chromecast { class CastSystemMemoryPressureEvaluatorAdjuster; class CastWebService; +class DisplaySettingsManager; class ServiceConnector; class ServiceManagerContext; class WaylandServerController; @@ -72,6 +73,7 @@ } // namespace metrics namespace shell { +class AccessibilityServiceImpl; class CastBrowserProcess; class CastContentBrowserClient; @@ -99,6 +101,7 @@ external_mojo::BrokerService* broker_service(); external_service_support::ExternalConnector* connector(); external_service_support::ExternalConnector* media_connector(); + AccessibilityServiceImpl* accessibility_service(); // content::BrowserMainParts implementation: void PreCreateMainMessageLoop() override; @@ -141,6 +144,8 @@ std::unique_ptr<CastWindowManager> window_manager_; #endif // defined(USE_AURA) std::unique_ptr<CastWebService> web_service_; + std::unique_ptr<DisplaySettingsManager> display_settings_manager_; + std::unique_ptr<AccessibilityServiceImpl> accessibility_service_; #if defined(OS_ANDROID) void StartPeriodicCrashReportUpload();
diff --git a/chromecast/browser/cast_browser_process.cc b/chromecast/browser/cast_browser_process.cc index 56a62582..cb63060 100644 --- a/chromecast/browser/cast_browser_process.cc +++ b/chromecast/browser/cast_browser_process.cc
@@ -8,6 +8,7 @@ #include "base/check_op.h" #include "build/build_config.h" +#include "chromecast/browser/accessibility/accessibility_service_impl.h" #include "chromecast/browser/cast_browser_context.h" #include "chromecast/browser/cast_content_browser_client.h" #include "chromecast/browser/cast_network_contexts.h" @@ -25,7 +26,7 @@ #include "chromecast/browser/accessibility/accessibility_manager.h" #endif // BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) -#include "chromecast/browser/cast_display_configurator.h" +#include "chromecast/browser/cast_display_configurator.h" // nogncheck #include "chromecast/graphics/cast_screen.h" #endif // defined(USE_AURA) @@ -133,6 +134,12 @@ connectivity_checker_.swap(connectivity_checker); } +void CastBrowserProcess::SetAccessibilityService( + std::unique_ptr<AccessibilityServiceImpl> accessibility_service) { + DCHECK(!accessibility_service_); + accessibility_service_ = std::move(accessibility_service); +} + #if BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) void CastBrowserProcess::AccessibilityStateChanged(bool enabled) { cast_service_->AccessibilityStateChanged(enabled);
diff --git a/chromecast/browser/cast_browser_process.h b/chromecast/browser/cast_browser_process.h index 15067543..b1b5f81 100644 --- a/chromecast/browser/cast_browser_process.h +++ b/chromecast/browser/cast_browser_process.h
@@ -30,6 +30,7 @@ class AccessibilityManager; #endif // defined(USE_AURA) && BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) +class AccessibilityServiceImpl; class CastBrowserContext; class CastContentBrowserClient; class CastDisplayConfigurator; @@ -75,6 +76,8 @@ std::unique_ptr<RemoteDebuggingServer> remote_debugging_server); void SetConnectivityChecker( scoped_refptr<ConnectivityChecker> connectivity_checker); + void SetAccessibilityService( + std::unique_ptr<AccessibilityServiceImpl> accessibility_service); CastContentBrowserClient* browser_client() const { return cast_content_browser_client_; @@ -104,6 +107,9 @@ RemoteDebuggingServer* remote_debugging_server() const { return remote_debugging_server_.get(); } + AccessibilityServiceImpl* accessibility_service() const { + return accessibility_service_.get(); + } private: // Note: The following objects should be declared in the same order as they @@ -124,6 +130,7 @@ scoped_refptr<ConnectivityChecker> connectivity_checker_; std::unique_ptr<metrics::CastBrowserMetrics> cast_browser_metrics_; std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_; + std::unique_ptr<AccessibilityServiceImpl> accessibility_service_; #if defined(USE_AURA) && BUILDFLAG(ENABLE_CHROMECAST_EXTENSIONS) // Destroyed in PostMainMessageLoopRun, just after CastService::Stop(). It's // not clear why this has to be destroyed before CastService.
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc index 0577227..7319682 100644 --- a/chromecast/browser/cast_content_browser_client.cc +++ b/chromecast/browser/cast_content_browser_client.cc
@@ -200,7 +200,9 @@ PrefService* pref_service, media::VideoPlaneController* video_plane_controller, CastWindowManager* window_manager, - CastWebService* web_service) { + CastWebService* web_service, + DisplaySettingsManager* display_settings_manager, + AccessibilityServiceImpl* accessibility_service) { return std::make_unique<CastServiceSimple>(web_service); }
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h index 96be8f7e..1d8d144 100644 --- a/chromecast/browser/cast_content_browser_client.h +++ b/chromecast/browser/cast_content_browser_client.h
@@ -63,6 +63,7 @@ class CastWebService; class CastWindowManager; class CastFeatureListCreator; +class DisplaySettingsManager; class GeneralAudienceBrowsingService; class MemoryPressureControllerImpl; class ServiceConnector; @@ -79,6 +80,7 @@ } namespace shell { +class AccessibilityServiceImpl; class CastBrowserMainParts; class CastNetworkContexts; @@ -114,7 +116,9 @@ PrefService* pref_service, media::VideoPlaneController* video_plane_controller, CastWindowManager* window_manager, - CastWebService* web_service); + CastWebService* web_service, + DisplaySettingsManager* display_settings_manager, + AccessibilityServiceImpl* accessibility_service); virtual media::VideoModeSwitcher* GetVideoModeSwitcher();
diff --git a/chromecast/browser/cast_web_view_default.cc b/chromecast/browser/cast_web_view_default.cc index 61f1d90a5..da91313d 100644 --- a/chromecast/browser/cast_web_view_default.cc +++ b/chromecast/browser/cast_web_view_default.cc
@@ -14,6 +14,7 @@ #include "chromecast/base/cast_features.h" #include "chromecast/base/chromecast_switches.h" #include "chromecast/base/metrics/cast_metrics_helper.h" +#include "chromecast/browser/accessibility/accessibility_service_impl.h" #include "chromecast/browser/cast_browser_process.h" #include "chromecast/browser/cast_web_service.h" #include "chromecast/browser/lru_renderer_cache.h" @@ -102,6 +103,9 @@ : web_service->CreateWindow(params_->Clone())) { DCHECK(web_service_); DCHECK(window_); + cast_web_contents_.local_interfaces() + ->AddInterface<chromecast::shell::mojom::CastAccessibilityService>( + shell::CastBrowserProcess::GetInstance()->accessibility_service()); window_->SetCastWebContents(&cast_web_contents_); web_contents_->SetDelegate(this); #if defined(USE_AURA)
diff --git a/chromecast/cast_core/cast_runtime_content_browser_client.cc b/chromecast/cast_core/cast_runtime_content_browser_client.cc index 2efd9ab..4ab7b0a 100644 --- a/chromecast/cast_core/cast_runtime_content_browser_client.cc +++ b/chromecast/cast_core/cast_runtime_content_browser_client.cc
@@ -31,7 +31,9 @@ PrefService* pref_service, media::VideoPlaneController* video_plane_controller, CastWindowManager* window_manager, - CastWebService* web_service) { + CastWebService* web_service, + DisplaySettingsManager* display_settings_manager, + shell::AccessibilityServiceImpl* accessibility_service) { auto network_context_getter = base::BindRepeating( [](CastRuntimeContentBrowserClient* client) -> network::mojom::NetworkContext* { @@ -111,8 +113,7 @@ app->GetUrlRewriteRulesManager(); DCHECK(url_rewrite_rules_manager); - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& rules = - url_rewrite_rules_manager->GetCachedRules(); + const auto& rules = url_rewrite_rules_manager->GetCachedRules(); if (!rules) { LOG(WARNING) << "Can't create URL throttle as URL rules are not available"; return nullptr;
diff --git a/chromecast/cast_core/cast_runtime_content_browser_client.h b/chromecast/cast_core/cast_runtime_content_browser_client.h index 42a9ac46..df16eeef 100644 --- a/chromecast/cast_core/cast_runtime_content_browser_client.h +++ b/chromecast/cast_core/cast_runtime_content_browser_client.h
@@ -27,7 +27,9 @@ PrefService* pref_service, media::VideoPlaneController* video_plane_controller, CastWindowManager* window_manager, - CastWebService* web_service) final; + CastWebService* web_service, + DisplaySettingsManager* display_settings_manager, + shell::AccessibilityServiceImpl* accessibility_service) final; void OverrideWebkitPrefs(content::WebContents* web_contents, blink::web_pref::WebPreferences* prefs) override; std::unique_ptr<::media::CdmFactory> CreateCdmFactory(
diff --git a/chromecast/cast_core/cast_runtime_content_renderer_client.cc b/chromecast/cast_core/cast_runtime_content_renderer_client.cc index 36e3c88..795f4976 100644 --- a/chromecast/cast_core/cast_runtime_content_renderer_client.cc +++ b/chromecast/cast_core/cast_runtime_content_renderer_client.cc
@@ -23,8 +23,8 @@ CastRuntimeContentRendererClient::~CastRuntimeContentRendererClient() = default; -scoped_refptr<url_rewrite::UrlRequestRewriteRules>& -CastRuntimeContentRendererClient::GetUrlRewriteRules(int routing_id) { +const scoped_refptr<url_rewrite::UrlRequestRewriteRules>& +CastRuntimeContentRendererClient::GetUrlRewriteRules(int routing_id) const { auto iter = url_rewrite_rules_providers_.find(routing_id); DCHECK(iter != url_rewrite_rules_providers_.end()); return iter->second->GetCachedRules();
diff --git a/chromecast/cast_core/cast_runtime_content_renderer_client.h b/chromecast/cast_core/cast_runtime_content_renderer_client.h index 6b097343..2332625 100644 --- a/chromecast/cast_core/cast_runtime_content_renderer_client.h +++ b/chromecast/cast_core/cast_runtime_content_renderer_client.h
@@ -37,8 +37,8 @@ CastRuntimeContentRendererClient&&) = delete; // Returns URL rewrite rules for provided RenderFrame |routing_id|. - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& GetUrlRewriteRules( - int routing_id); + const scoped_refptr<url_rewrite::UrlRequestRewriteRules>& GetUrlRewriteRules( + int routing_id) const; // content::ContentRendererClient overrides. void RenderFrameCreated(content::RenderFrame* render_frame) override;
diff --git a/chromecast/cast_core/cast_runtime_url_loader_throttle_provider.cc b/chromecast/cast_core/cast_runtime_url_loader_throttle_provider.cc index 3490021..4d4a03c4 100644 --- a/chromecast/cast_core/cast_runtime_url_loader_throttle_provider.cc +++ b/chromecast/cast_core/cast_runtime_url_loader_throttle_provider.cc
@@ -44,8 +44,7 @@ blink::WebVector<std::unique_ptr<blink::URLLoaderThrottle>> throttles; - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& rules = - renderer_client_->GetUrlRewriteRules(render_frame_id); + const auto& rules = renderer_client_->GetUrlRewriteRules(render_frame_id); if (rules) { auto url_loader_throttle = std::make_unique<url_rewrite::URLLoaderThrottle>( rules, base::BindRepeating(&IsHeaderCorsExempt));
diff --git a/chromecast/cast_core/url_rewrite_rules_provider.cc b/chromecast/cast_core/url_rewrite_rules_provider.cc index 45be1717..28a8f9d 100644 --- a/chromecast/cast_core/url_rewrite_rules_provider.cc +++ b/chromecast/cast_core/url_rewrite_rules_provider.cc
@@ -23,8 +23,8 @@ UrlRewriteRulesProvider::~UrlRewriteRulesProvider() = default; -scoped_refptr<url_rewrite::UrlRequestRewriteRules>& -UrlRewriteRulesProvider::GetCachedRules() { +const scoped_refptr<url_rewrite::UrlRequestRewriteRules>& +UrlRewriteRulesProvider::GetCachedRules() const { return url_request_rules_receiver_.GetCachedRules(); }
diff --git a/chromecast/cast_core/url_rewrite_rules_provider.h b/chromecast/cast_core/url_rewrite_rules_provider.h index 46d31b46..3ac49cbc 100644 --- a/chromecast/cast_core/url_rewrite_rules_provider.h +++ b/chromecast/cast_core/url_rewrite_rules_provider.h
@@ -32,7 +32,8 @@ UrlRewriteRulesProvider(const UrlRewriteRulesProvider&) = delete; UrlRewriteRulesProvider& operator=(const UrlRewriteRulesProvider&) = delete; - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& GetCachedRules(); + const scoped_refptr<url_rewrite::UrlRequestRewriteRules>& GetCachedRules() + const; private: // content::RenderFrameObserver implementation.
diff --git a/chromecast/ui/BUILD.gn b/chromecast/ui/BUILD.gn index 22c6f8f..f94d8455 100644 --- a/chromecast/ui/BUILD.gn +++ b/chromecast/ui/BUILD.gn
@@ -36,13 +36,16 @@ deps = [ ":display_settings_public", "//base", - "//chromecast/browser", "//chromecast/graphics", "//chromecast/ui/display_settings", "//chromecast/ui/mojom", "//mojo/public/cpp/bindings", "//ui/display/types", ] + + if (use_aura) { + deps += [ "//chromecast/browser:display_configurator" ] + } } cast_source_set("aura_components") {
diff --git a/chromecast/ui/display_settings/BUILD.gn b/chromecast/ui/display_settings/BUILD.gn index a9a7c6a..4bd5bc2e 100644 --- a/chromecast/ui/display_settings/BUILD.gn +++ b/chromecast/ui/display_settings/BUILD.gn
@@ -16,7 +16,7 @@ deps = [ "//base", - "//chromecast/browser", + "//chromecast/browser:display_configurator", "//chromecast/graphics", "//chromecast/ui:display_settings_public", "//skia", @@ -33,37 +33,31 @@ deps += [ ":screen_power_controller_aura", - "//ui/aura" + "//ui/aura", ] } else { - deps += [ - ":screen_power_controller_default", - ] + deps += [ ":screen_power_controller_default" ] } } cast_source_set("screen_power_controller_default") { sources = [ "screen_power_controller.h", - "screen_power_controller_default.h", "screen_power_controller_default.cc", + "screen_power_controller_default.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } cast_source_set("screen_power_controller_aura") { sources = [ "screen_power_controller.h", - "screen_power_controller_aura.h", "screen_power_controller_aura.cc", + "screen_power_controller_aura.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } test("cast_display_settings_unittests") { @@ -80,12 +74,8 @@ ] if (use_aura) { - sources += [ - "screen_power_controller_aura_unittest.cc", - ] + sources += [ "screen_power_controller_aura_unittest.cc" ] - deps += [ - ":screen_power_controller_aura", - ] + deps += [ ":screen_power_controller_aura" ] } }
diff --git a/chromecast/ui/display_settings/gamma_configurator.cc b/chromecast/ui/display_settings/gamma_configurator.cc index 639f48fe..88379b8 100644 --- a/chromecast/ui/display_settings/gamma_configurator.cc +++ b/chromecast/ui/display_settings/gamma_configurator.cc
@@ -17,9 +17,9 @@ std::vector<display::GammaRampRGBEntry> CreateDefaultGammaLut() { std::vector<display::GammaRampRGBEntry> gamma_lut; for (size_t i = 0; i < kGammaTableSize; ++i) { - float value = - static_cast<float>(kGammaTableSize - i - 1) / (kGammaTableSize - 1); - value *= kMaxGammaValue; + const uint16_t value = static_cast<uint16_t>( + kMaxGammaValue * + (static_cast<float>(kGammaTableSize - i - 1) / (kGammaTableSize - 1))); gamma_lut.push_back({value, value, value}); }
diff --git a/chromecast/ui/display_settings_manager.h b/chromecast/ui/display_settings_manager.h index 373e2de3..51773ef7 100644 --- a/chromecast/ui/display_settings_manager.h +++ b/chromecast/ui/display_settings_manager.h
@@ -41,6 +41,9 @@ virtual void SetDelegate(Delegate* delegate) = 0; + virtual void SetColorTemperatureConfig( + const ColorTemperatureConfig& config) = 0; + virtual void ResetDelegate() = 0; virtual void SetGammaCalibration(
diff --git a/chromecast/ui/display_settings_manager_impl.cc b/chromecast/ui/display_settings_manager_impl.cc index ffaaabd..29fdff5 100644 --- a/chromecast/ui/display_settings_manager_impl.cc +++ b/chromecast/ui/display_settings_manager_impl.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/check.h" #include "base/logging.h" #include "base/time/time.h" #include "chromecast/graphics/cast_window_manager.h" @@ -14,8 +15,7 @@ #include "ui/display/types/gamma_ramp_rgb_entry.h" #if defined(USE_AURA) -#include "chromecast/browser/cast_browser_process.h" -#include "chromecast/browser/cast_display_configurator.h" +#include "chromecast/browser/cast_display_configurator.h" // nogncheck #include "chromecast/ui/display_settings/gamma_configurator.h" #endif // defined(USE_AURA) @@ -33,22 +33,15 @@ DisplaySettingsManagerImpl::DisplaySettingsManagerImpl( CastWindowManager* window_manager, - const DisplaySettingsManager::ColorTemperatureConfig& - color_temperature_config) + shell::CastDisplayConfigurator* display_configurator) : window_manager_(window_manager), + display_configurator_(display_configurator), #if defined(USE_AURA) - display_configurator_( - shell::CastBrowserProcess::GetInstance()->display_configurator()), gamma_configurator_( std::make_unique<GammaConfigurator>(display_configurator_)), -#else - display_configurator_(nullptr), #endif // defined(USE_AURA) brightness_(-1.0f), screen_power_controller_(ScreenPowerController::Create(this)), - color_temperature_animation_(std::make_unique<ColorTemperatureAnimation>( - display_configurator_, - color_temperature_config)), weak_factory_(this) { DCHECK(window_manager_); #if defined(USE_AURA) @@ -69,6 +62,13 @@ brightness_animation_.reset(); } +void DisplaySettingsManagerImpl::SetColorTemperatureConfig( + const DisplaySettingsManager::ColorTemperatureConfig& config) { + DCHECK(!color_temperature_animation_); + color_temperature_animation_ = std::make_unique<ColorTemperatureAnimation>( + display_configurator_, config); +} + void DisplaySettingsManagerImpl::SetGammaCalibration( const std::vector<display::GammaRampRGBEntry>& gamma) { #if defined(USE_AURA) @@ -115,6 +115,9 @@ void DisplaySettingsManagerImpl::SetColorTemperature(float temperature) { DVLOG(4) << "Setting color temperature to " << temperature << " Kelvin."; + if (!color_temperature_animation_) { + return; + } color_temperature_animation_->AnimateToNewValue(temperature, kAnimationDuration); } @@ -124,10 +127,16 @@ base::TimeDelta duration) { DVLOG(4) << "Setting color temperature to " << temperature << " Kelvin. Duration: " << duration; + if (!color_temperature_animation_) { + return; + } color_temperature_animation_->AnimateToNewValue(temperature, duration); } void DisplaySettingsManagerImpl::ResetColorTemperature() { + if (!color_temperature_animation_) { + return; + } color_temperature_animation_->AnimateToNeutral(kAnimationDuration); }
diff --git a/chromecast/ui/display_settings_manager_impl.h b/chromecast/ui/display_settings_manager_impl.h index ec0bef59..666bcaa 100644 --- a/chromecast/ui/display_settings_manager_impl.h +++ b/chromecast/ui/display_settings_manager_impl.h
@@ -30,7 +30,7 @@ namespace shell { class CastDisplayConfigurator; -} +} // namespace shell class DisplaySettingsManagerImpl : public DisplaySettingsManager, public ScreenPowerController::Delegate, @@ -38,8 +38,7 @@ public: DisplaySettingsManagerImpl( CastWindowManager* window_manager, - const DisplaySettingsManager::ColorTemperatureConfig& - color_temperature_config); + shell::CastDisplayConfigurator* display_configurator); DisplaySettingsManagerImpl(const DisplaySettingsManagerImpl&) = delete; DisplaySettingsManagerImpl& operator=(const DisplaySettingsManagerImpl&) = delete; @@ -48,6 +47,8 @@ // DisplaySettingsManager implementation: void SetDelegate(DisplaySettingsManager::Delegate* delegate) override; void ResetDelegate() override; + void SetColorTemperatureConfig( + const DisplaySettingsManager::ColorTemperatureConfig& config) override; void SetGammaCalibration( const std::vector<display::GammaRampRGBEntry>& gamma) override; void NotifyBrightnessChanged(float new_brightness,
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index e2ce9763..03cf8a0 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -2204,7 +2204,7 @@ </message> <!-- Manual write protect disable complete page --> <message name="IDS_SHIMLESS_RMA_WP_DISABLE_COMPLETE_PAGE_TITLE" translateable="false" desc="Title for the manual write protect disable complete page. Displays next steps, either reassemble device or leave wp disabled until further notice."> - Hardware Write Protection Disabled Manually + Manual write-protect disable complete </message> <message name="IDS_SHIMLESS_RMA_WP_DISABLE_SKIPPED_MESSAGE" translateable="false" desc="If the device already had write protection disabled before reaching the 'choose method' page the flow skips straight to this page and informs the user they can manually re-enable if it is currently manually disabled. It is not possible for the device to determine this automatically, so the instructions must cover both cases."> Write protection is already disabled. If the device is disassembled you may reassemble it now. @@ -2213,7 +2213,7 @@ Write protection disable complete, you can reassemble the device. </message> <message name="IDS_SHIMLESS_RMA_WP_DISABLE_LEAVE_DISASSEMBLED_MESSAGE" translateable="false" desc="If the device needs write protection to remain disabled for the remainder of RMA then inform user they can must leave it disabled."> - Write protection disable complete, you can reassemble the device. + Write protection disable complete, you must keep the device disassembled. </message> <!-- Check calibration page --> <message name="IDS_SHIMLESS_RMA_CHECK_CALIBRATION_PAGE_TITLE" translateable="false" desc="Title for the page shown when confirming components to calibrate."> @@ -2323,20 +2323,8 @@ <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_STARTING" translateable="false" desc="Message to display when when waiting for calibration to start."> Calibration starting... </message> - <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_WAITING" translateable="false" desc="Status message for a single component waiting to calibrate."> - Waiting to calibrate <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph> - </message> - <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_PROGRESS" translateable="false" desc="Status message for a single component waiting to calibrate."> - Calibrating <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph> <ph name="CALIBRATION_PROGRESS">$2<ex>25</ex></ph>% complete - </message> - <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_COMPLETE" translateable="false" desc="Status message for a single component waiting to calibrate."> - Calibrated <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph> - </message> - <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_FAILED" translateable="false" desc="Status message for a single component waiting to calibrate."> - Failed to calibrate <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph> - </message> - <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATION_COMPONENT_SKIPPED" translateable="false" desc="Status message for a single component waiting to calibrate."> - Skipped calibrating <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph> + <message name="IDS_SHIMLESS_RMA_RUN_CALIBRATING_COMPONENT" translateable="false" desc="Status message for a single component while it's being calibrated."> + Calibrating <ph name="COMPONENT_NAME">$1<ex>Audio</ex></ph>... </message> <!-- OS update page --> <message name="IDS_SHIMLESS_RMA_UPDATE_OS_PAGE_TITLE" translateable="false" desc="Title of Chrome OS update page."> @@ -2371,7 +2359,7 @@ </message> <!-- Manually disable wp page --> <message name="IDS_SHIMLESS_RMA_MANUALLY_DISABLE_WP_INSTRUCTIONS" translateable="false" desc="The text instructions for how to manually disable write-protect on the device."> - Disable write-protect to continue to the next screen. Learn how to disable write-proect for this device by viewing the instructions at <ph name="HELP_LINK">$1<ex>g.co/help</ex></ph> or scanning the QR code. Once you disable write-protect, you will need to leave it disabled until the repair process is finished. + Disable write-protect to continue to the next screen. Learn how to disable write-protect for this device by viewing the instructions at the device manufacturer's support page. Once you disable write-protect, you will need to leave it disabled until the repair process is finished. Please expect a reboot after disabling write protection. </message> <message name="IDS_SHIMLESS_RMA_MANUALLY_DISABLE_WP_TITLE" translateable="false" desc="The title for the page to manually disable write-protect on the device."> Manually disable write-protect
diff --git a/chromeos/components/cdm_factory_daemon/DEPS b/chromeos/components/cdm_factory_daemon/DEPS index 71baed22..cde472b 100644 --- a/chromeos/components/cdm_factory_daemon/DEPS +++ b/chromeos/components/cdm_factory_daemon/DEPS
@@ -1,7 +1,6 @@ include_rules = [ "+ash/components/arc/mojom", "+ash/shell.h", - "+components/arc/mojom", "+content/public/browser", "+content/public/test", "+media/base",
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index ec511a8..3bc68a3 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -606,8 +606,8 @@ // If ash-chrome is newer than the browser, then some fields may not be // processed by the browser. // -// Next version: 35 -// Next id: 35 +// Next version: 36 +// Next id: 36 [Stable, RenamedFrom="crosapi.mojom.LacrosInitParams"] struct BrowserInitParams { // This is ash-chrome's version of the Crosapi interface. This is used by @@ -837,6 +837,10 @@ // See `ash::features::IsHoldingSpaceInProgressDownloadsNotificationSuppressionEnabled()`. [MinVersion=34] bool is_holding_space_in_progress_downloads_notification_suppression_enabled@34; + + // Whether the device is either enterprise managed or in demo mode. + [MinVersion=35] + bool is_device_enterprised_managed@35; }; // BrowserService defines the APIs that live in a browser (such as
diff --git a/chromeos/crosapi/mojom/download_controller.mojom b/chromeos/crosapi/mojom/download_controller.mojom index acd1946d..cfc59add 100644 --- a/chromeos/crosapi/mojom/download_controller.mojom +++ b/chromeos/crosapi/mojom/download_controller.mojom
@@ -18,6 +18,46 @@ kInterrupted }; +// This mirrors `download::DownloadDangerType`, anything added or removed here +// must also be added or removed there. +[Stable, Extensible] +enum DownloadDangerType { + [Default] kDownloadDangerTypeInvalid = -1, + kDownloadDangerTypeNotDangerous = 0, + kDownloadDangerTypeDangerousFile = 1, + kDownloadDangerTypeDangerousUrl = 2, + kDownloadDangerTypeDangerousContent = 3, + kDownloadDangerTypeMaybeDangerousContent = 4, + kDownloadDangerTypeUncommonContent = 5, + kDownloadDangerTypeUserValidated = 6, + kDownloadDangerTypeDangerousHost = 7, + kDownloadDangerTypePotentiallyUnwanted = 8, + kDownloadDangerTypeAllowlistedByPolicy = 9, + kDownloadDangerTypeAsyncScanning = 10, + kDownloadDangerTypeBlockedPasswordProtected = 11, + kDownloadDangerTypeBlockedTooLarge = 12, + kDownloadDangerTypeSensitiveContentWarning = 13, + kDownloadDangerTypeSensitiveContentBlock = 14, + kDownloadDangerTypeDeepScannedSafe = 15, + kDownloadDangerTypeDeepScannedOpenedDangerous = 16, + kDownloadDangerTypePromptForScanning = 17, + kDownloadDangerTypeBlockedUnsupportedFiletype = 18, + kDownloadDangerTypeDangerousAccountCompromise = 19, +}; + +// This mirrors `download::DownloadItem::MixedContentStatus`, anything added or +// removed here must also be added or removed there. +[Stable, Extensible] +enum DownloadMixedContentStatus { + [Default] kInvalid = -1, + kUnknown = 0, + kSafe = 1, + kValidated = 2, + kWarn = 3, + kBlock = 4, + kSilentBlock = 5, +}; + // This mirrors `download::DownloadItem`. See: // https://source.chromium.org/chromium/chromium/src/+/main:components/download/public/common/download_item.h?q=download_item.h // @@ -25,8 +65,8 @@ // non-nullable `field`. This is for backwards compatibility, so that older // clients know when values are present or are absent by default. // -// Next MinVersion: 4 -// Next ID: 18 +// Next MinVersion: 5 +// Next ID: 20 [Stable, RenamedFrom="crosapi.mojom.DownloadEvent"] struct DownloadItem { DownloadState state@0; @@ -47,6 +87,8 @@ [MinVersion=3] bool is_dangerous@15; [MinVersion=3] bool has_is_mixed_content@16; [MinVersion=3] bool is_mixed_content@17; + [MinVersion=4] DownloadDangerType danger_type@18; + [MinVersion=4] DownloadMixedContentStatus mixed_content_status@19; }; // A client implemented in lacros-chrome for the DownloadController which is
diff --git a/chromeos/dbus/arc/OWNERS b/chromeos/dbus/arc/OWNERS index 02d6b48..203e15a4 100644 --- a/chromeos/dbus/arc/OWNERS +++ b/chromeos/dbus/arc/OWNERS
@@ -1 +1 @@ -file://components/arc/OWNERS +file://ash/components/arc/OWNERS
diff --git a/chromeos/dbus/services/cros_dbus_service_unittest.cc b/chromeos/dbus/services/cros_dbus_service_unittest.cc index be332a7..260c016 100644 --- a/chromeos/dbus/services/cros_dbus_service_unittest.cc +++ b/chromeos/dbus/services/cros_dbus_service_unittest.cc
@@ -27,6 +27,8 @@ namespace chromeos { +namespace { + class MockProxyResolutionService : public CrosDBusService::ServiceProviderInterface { public: @@ -34,6 +36,8 @@ exported_object)); }; +} // namespace + class CrosDBusServiceTest : public testing::Test { public: CrosDBusServiceTest() = default;
diff --git a/components/OWNERS b/components/OWNERS index fd9ced8..e47f144d 100644 --- a/components/OWNERS +++ b/components/OWNERS
@@ -7,7 +7,7 @@ # For build configuration things and simple changes. thakis@chromium.org -per-file arc_strings.grdp=file://components/arc/OWNERS +per-file arc_strings.grdp=file://ash/components/arc/OWNERS per-file android_system_error_page_strings.grdp=file://components/android_system_error_page/OWNERS per-file autofill_assistant_strings.grdp=file://components/autofill_assistant/OWNERS per-file autofill_payments_strings.grdp=file://components/autofill/core/browser/payments/OWNERS
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 5510e28b..42368cf 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -25,83 +25,17 @@ "intent_helper/open_url_delegate.h", ] - # TODO(b/129295708): Remove these public_deps. - public_deps = [ - "//ash/components/arc:arc", - "//ash/components/arc:arc_base", - "//ash/components/arc:arc_metrics_constants", - "//ash/components/arc:prefs", - ] - - # TODO(b/129295708): Clean up unused deps. Update users of this target. deps = [ - "//ash:ash", - "//ash/components/arc/enterprise", - "//ash/components/arc/input_overlay/resources:resources_grit", - "//ash/components/arc/vector_icons", - "//ash/components/audio", - "//ash/components/disks", - "//ash/constants", - "//ash/keyboard/ui", + "//ash/components/arc", "//ash/public/cpp", - "//base", - "//chromeos/components/sensors:sensors", - "//chromeos/cryptohome", - "//chromeos/dbus", - "//chromeos/dbus/cryptohome", - "//chromeos/dbus/permission_broker", - "//chromeos/dbus/power", - "//chromeos/dbus/power:power_manager_proto", - "//chromeos/dbus/resourced:resourced", - "//chromeos/dbus/session_manager", - "//chromeos/dbus/session_manager:login_manager_proto", - "//chromeos/dbus/upstart:upstart", - "//chromeos/dbus/userdataauth", - "//chromeos/dbus/userdataauth:userdataauth_proto", - "//chromeos/login/login_state", - "//chromeos/network", - "//chromeos/ui/base", - "//chromeos/ui/frame", - "//components/account_id", "//components/exo", "//components/google/core/common", - "//components/guest_os", - "//components/keyed_service/core", - "//components/onc", - "//components/prefs", - "//components/strings:components_strings_grit", # TODO(crbug.com/853604): After fully migrating the intent picker to query # directly from App Service, we will deprecated the match functionality # in intent_filter and this dependency will be removed. "//components/services/app_service/public/cpp:intents", - "//components/session_manager/core", "//components/url_formatter", - "//components/user_manager", - "//components/user_prefs:user_prefs", - "//components/vector_icons", - "//content/public/browser:browser", - "//content/public/common", - "//device/bluetooth", - "//google_apis", - "//media/capture:capture_lib", - "//services/device/public/mojom", - "//skia", - "//third_party/re2:re2", - "//ui/aura", - "//ui/base:base", - "//ui/base/clipboard", - "//ui/base/ime", - "//ui/base/ime/ash", - "//ui/chromeos/strings", - "//ui/chromeos/styles:cros_styles_views_generator", - "//ui/display/manager", - "//ui/events", - "//ui/events:dom_keycode_converter", - "//ui/events/ozone", - "//ui/gfx", - "//ui/wm/public", - "//url:url", ] } @@ -112,10 +46,7 @@ "test/fake_intent_helper_instance.h", ] - deps = [ - "//ash/components/arc/mojom", - "//components/arc/mojom", - ] + deps = [ "//ash/components/arc/mojom" ] } source_set("unit_tests") { @@ -131,6 +62,8 @@ deps = [ ":arc", ":arc_test_support", + "//ash/components/arc/mojom", + "//ash/components/arc/session", "//base/test:test_support", "//testing/gmock", "//testing/gtest",
diff --git a/components/arc/intent_helper/OWNERS b/components/arc/intent_helper/OWNERS index 52656497..8aa79d75 100644 --- a/components/arc/intent_helper/OWNERS +++ b/components/arc/intent_helper/OWNERS
@@ -3,4 +3,4 @@ per-file *_mojom_traits*.*=set noparent per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=file://chromeos/SECURITY_OWNERS
diff --git a/components/arc/intent_helper/activity_icon_loader.h b/components/arc/intent_helper/activity_icon_loader.h index 0289b6f..c14a6f603 100644 --- a/components/arc/intent_helper/activity_icon_loader.h +++ b/components/arc/intent_helper/activity_icon_loader.h
@@ -10,11 +10,11 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "ui/base/layout.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h"
diff --git a/components/arc/intent_helper/adaptive_icon_delegate.h b/components/arc/intent_helper/adaptive_icon_delegate.h index c33da4d..f0e6da0 100644 --- a/components/arc/intent_helper/adaptive_icon_delegate.h +++ b/components/arc/intent_helper/adaptive_icon_delegate.h
@@ -7,8 +7,8 @@ #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/callback.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "ui/gfx/image/image_skia.h" namespace arc {
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.h b/components/arc/intent_helper/arc_intent_helper_bridge.h index bbd24506..e05914eb 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.h +++ b/components/arc/intent_helper/arc_intent_helper_bridge.h
@@ -11,11 +11,11 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" #include "components/arc/intent_helper/activity_icon_loader.h" #include "components/arc/intent_helper/arc_intent_helper_observer.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "url/gurl.h"
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc b/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc index cd9438e..f3911cbc 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc
@@ -9,15 +9,15 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" +#include "ash/components/arc/mojom/intent_helper.mojom-shared.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "ash/components/arc/session/arc_bridge_service.h" #include "base/files/file_path.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "components/arc/intent_helper/intent_constants.h" #include "components/arc/intent_helper/open_url_delegate.h" -#include "components/arc/mojom/intent_helper.mojom-forward.h" -#include "components/arc/mojom/intent_helper.mojom-shared.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "mojo/public/cpp/bindings/clone_traits.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/arc/intent_helper/arc_intent_helper_observer.h b/components/arc/intent_helper/arc_intent_helper_observer.h index 802d24c..abca849 100644 --- a/components/arc/intent_helper/arc_intent_helper_observer.h +++ b/components/arc/intent_helper/arc_intent_helper_observer.h
@@ -7,7 +7,7 @@ #include <string> -#include "components/arc/mojom/intent_helper.mojom-forward.h" +#include "ash/components/arc/mojom/intent_helper.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace base {
diff --git a/components/arc/intent_helper/intent_filter.cc b/components/arc/intent_helper/intent_filter.cc index dc179b8b..e12127e 100644 --- a/components/arc/intent_helper/intent_filter.cc +++ b/components/arc/intent_helper/intent_filter.cc
@@ -7,10 +7,10 @@ #include <algorithm> #include <utility> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/compiler_specific.h" #include "base/strings/string_util.h" #include "components/arc/intent_helper/intent_constants.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "components/services/app_service/public/cpp/intent_util.h" #include "url/gurl.h"
diff --git a/components/arc/intent_helper/intent_filter_unittest.cc b/components/arc/intent_helper/intent_filter_unittest.cc index 386bd04..c39c172 100644 --- a/components/arc/intent_helper/intent_filter_unittest.cc +++ b/components/arc/intent_helper/intent_filter_unittest.cc
@@ -7,10 +7,10 @@ #include <utility> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/bind.h" #include "base/memory/ref_counted.h" #include "components/arc/intent_helper/intent_filter.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h"
diff --git a/components/arc/intent_helper/link_handler_model.h b/components/arc/intent_helper/link_handler_model.h index 02dd0b2..7d63af27 100644 --- a/components/arc/intent_helper/link_handler_model.h +++ b/components/arc/intent_helper/link_handler_model.h
@@ -9,10 +9,10 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "url/gurl.h" namespace content {
diff --git a/components/arc/intent_helper/open_url_delegate.h b/components/arc/intent_helper/open_url_delegate.h index 42831a44..78ff2558 100644 --- a/components/arc/intent_helper/open_url_delegate.h +++ b/components/arc/intent_helper/open_url_delegate.h
@@ -5,7 +5,7 @@ #ifndef COMPONENTS_ARC_INTENT_HELPER_OPEN_URL_DELEGATE_H_ #define COMPONENTS_ARC_INTENT_HELPER_OPEN_URL_DELEGATE_H_ -#include "components/arc/mojom/intent_helper.mojom.h" +#include "ash/components/arc/mojom/intent_helper.mojom.h" class GURL;
diff --git a/components/arc/mojom/ARC_SECURITY_OWNERS b/components/arc/mojom/ARC_SECURITY_OWNERS deleted file mode 100644 index 84c8d11c9..0000000 --- a/components/arc/mojom/ARC_SECURITY_OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -# Prefer ARC++ security owners for changes to ARC++ IPC. -file://chromeos/SECURITY_OWNERS
diff --git a/components/arc/mojom/BUILD.gn b/components/arc/mojom/BUILD.gn deleted file mode 100644 index b675d61..0000000 --- a/components/arc/mojom/BUILD.gn +++ /dev/null
@@ -1,92 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/chromeos/ui_mode.gni") -import("//mojo/public/tools/bindings/mojom.gni") - -# This needs to be conditionally-compiled since the typemaps are -# unconditionally-included from //mojo/public/tools/bindings/mojom.gni. The -# inclusion is done through read_file(), which does not respect the global -# defines for GN, so it itself cannot use the "is_chromeos" variable. -if (is_chromeos_ash) { - mojom("mojom") { - sources = [ - "app.mojom", - "app_permissions.mojom", - "compatibility_mode.mojom", - "file_system.mojom", - "intent_common.mojom", - "intent_helper.mojom", - "scale_factor.mojom", - ] - - public_deps = [ - "//ash/components/arc/mojom:camera_intent", - "//ash/components/arc/mojom:media", - "//ash/components/arc/mojom:notifications", - "//ash/components/arc/mojom:oemcrypto", - "//chromeos/components/sensors/mojom:mojom", - "//components/payments/mojom:mojom", - "//media/capture/video/chromeos/mojom:cros_camera", - "//mojo/public/mojom/base", - "//printing/mojom", - "//sandbox/policy/mojom", - "//services/device/public/mojom:usb", - "//services/media_session/public/mojom", - "//services/resource_coordinator/public/mojom", - "//third_party/blink/public/mojom:android_mojo_bindings", - "//ui/accessibility/mojom:ax_assistant_mojom", - "//ui/gfx/geometry/mojom", - "//url/mojom:url_mojom_gurl", - ] - - cpp_typemaps = [ - { - types = [ - { - mojom = "arc.mojom.AppDiscoveryRequestState" - cpp = "::arc::ArcPlayStoreSearchRequestState" - }, - ] - traits_headers = [ "app_mojom_traits.h" ] - }, - { - types = [ - { - mojom = "arc.mojom.ChangeType" - cpp = "::storage::WatcherManager::ChangeType" - }, - ] - traits_headers = - [ "//components/arc/file_system/file_system_mojom_traits.h" ] - traits_sources = - [ "//components/arc/file_system/file_system_mojom_traits.cc" ] - traits_public_deps = [ "//storage/browser" ] - }, - { - types = [ - { - mojom = "arc.mojom.IntentFilter" - cpp = "::arc::IntentFilter" - move_only = true - }, - { - mojom = "arc.mojom.AuthorityEntry" - cpp = "::arc::IntentFilter::AuthorityEntry" - move_only = true - }, - { - mojom = "arc.mojom.PatternMatcher" - cpp = "::arc::IntentFilter::PatternMatcher" - move_only = true - }, - ] - traits_headers = - [ "//components/arc/intent_helper/intent_filter_mojom_traits.h" ] - traits_sources = - [ "//components/arc/intent_helper/intent_filter_mojom_traits.cc" ] - }, - ] - } -}
diff --git a/components/arc/mojom/OWNERS b/components/arc/mojom/OWNERS deleted file mode 100644 index 29d6990e82..0000000 --- a/components/arc/mojom/OWNERS +++ /dev/null
@@ -1,7 +0,0 @@ -per-file *.mojom=set noparent -per-file *.mojom=file://ipc/SECURITY_OWNERS -per-file *.mojom=file:ARC_SECURITY_OWNERS - -per-file *_mojom_traits*.*=set noparent -per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_mojom_traits*.*=file:ARC_SECURITY_OWNERS
diff --git a/components/arc/print_spooler/OWNERS b/components/arc/print_spooler/OWNERS deleted file mode 100644 index fbeef67..0000000 --- a/components/arc/print_spooler/OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -bmgordon@chromium.org -skau@chromium.org
diff --git a/components/arc/sharesheet/OWNERS b/components/arc/sharesheet/OWNERS deleted file mode 100644 index 81ebf5fe5..0000000 --- a/components/arc/sharesheet/OWNERS +++ /dev/null
@@ -1,3 +0,0 @@ -melzhang@chromium.org -mxcai@chromium.org -phshah@chromium.org
diff --git a/components/arc/test/fake_intent_helper_instance.h b/components/arc/test/fake_intent_helper_instance.h index 60293681..0662532 100644 --- a/components/arc/test/fake_intent_helper_instance.h +++ b/components/arc/test/fake_intent_helper_instance.h
@@ -9,8 +9,8 @@ #include <string> #include <vector> +#include "ash/components/arc/mojom/intent_helper.mojom.h" #include "base/callback.h" -#include "components/arc/mojom/intent_helper.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/components/arc_strings_grdp/OWNERS b/components/arc_strings_grdp/OWNERS index 02d6b48..203e15a4 100644 --- a/components/arc_strings_grdp/OWNERS +++ b/components/arc_strings_grdp/OWNERS
@@ -1 +1 @@ -file://components/arc/OWNERS +file://ash/components/arc/OWNERS
diff --git a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/textbubble/TextBubble.java b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/textbubble/TextBubble.java index 25c5b4d..5bc0ca8 100644 --- a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/textbubble/TextBubble.java +++ b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/textbubble/TextBubble.java
@@ -531,4 +531,14 @@ view, R.style.TextAppearance_TextMediumThick_Blue); } } + + /** For testing only, get the list of active text bubbles. */ + public static Set<TextBubble> getTextBubbleSetForTesting() { + return sBubbles; + } + + /** For testing only, get the content view of a TextBubble. */ + public View getTextBubbleContentViewForTesting() { + return mContentView; + } }
diff --git a/components/download/public/common/BUILD.gn b/components/download/public/common/BUILD.gn index d9f677ae..f79fbdc 100644 --- a/components/download/public/common/BUILD.gn +++ b/components/download/public/common/BUILD.gn
@@ -106,6 +106,14 @@ if (is_win && is_component_build) { ldflags = [ "/IGNORE:4217" ] } + + if (is_chromeos) { + sources += [ + "download_item_utils.cc", + "download_item_utils.h", + ] + deps += [ "//chromeos/crosapi/mojom" ] + } } if (is_android) {
diff --git a/components/download/public/common/DEPS b/components/download/public/common/DEPS index 2ebb3b7..66e3c3a 100644 --- a/components/download/public/common/DEPS +++ b/components/download/public/common/DEPS
@@ -1,8 +1,10 @@ include_rules = [ - "+crypto", + "+chromeos/crosapi/mojom/download_controller.mojom-forward.h", + "+chromeos/crosapi/mojom/download_controller.mojom.h", "+components/keyed_service/core", "+components/services/quarantine/public/mojom/quarantine.mojom.h", "+components/enterprise/common/download_item_reroute_info.h", + "+crypto", "+mojo/public/cpp/bindings", "+mojo/public/cpp/system", "+net/base/io_buffer.h",
diff --git a/components/download/public/common/download_item_utils.cc b/components/download/public/common/download_item_utils.cc new file mode 100644 index 0000000..8696d02 --- /dev/null +++ b/components/download/public/common/download_item_utils.cc
@@ -0,0 +1,151 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/download/public/common/download_item_utils.h" + +#include "chromeos/crosapi/mojom/download_controller.mojom.h" +#include "components/download/public/common/download_item.h" + +namespace download { +namespace download_item_utils { +namespace { + +crosapi::mojom::DownloadDangerType ConvertToMojoDownloadDangerType( + DownloadDangerType value) { + switch (value) { + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeNotDangerous; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDangerousFile; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDangerousUrl; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDangerousContent; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeMaybeDangerousContent; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeUncommonContent; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_USER_VALIDATED: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeUserValidated; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDangerousHost; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypePotentiallyUnwanted; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_ALLOWLISTED_BY_POLICY: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeAllowlistedByPolicy; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeAsyncScanning; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeBlockedPasswordProtected; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_BLOCKED_TOO_LARGE: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeBlockedTooLarge; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_WARNING: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeSensitiveContentWarning; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_BLOCK: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeSensitiveContentBlock; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_SAFE: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDeepScannedSafe; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDeepScannedOpenedDangerous; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypePromptForScanning; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeBlockedUnsupportedFiletype; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return crosapi::mojom::DownloadDangerType:: + kDownloadDangerTypeDangerousAccountCompromise; + case DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAX: + NOTREACHED(); + return crosapi::mojom::DownloadDangerType::kDownloadDangerTypeInvalid; + } +} + +crosapi::mojom::DownloadMixedContentStatus +ConvertToMojoDownloadMixedContentStatus( + DownloadItem::MixedContentStatus value) { + switch (value) { + case DownloadItem::MixedContentStatus::UNKNOWN: + return crosapi::mojom::DownloadMixedContentStatus::kUnknown; + case DownloadItem::MixedContentStatus::SAFE: + return crosapi::mojom::DownloadMixedContentStatus::kSafe; + case DownloadItem::MixedContentStatus::VALIDATED: + return crosapi::mojom::DownloadMixedContentStatus::kValidated; + case DownloadItem::MixedContentStatus::WARN: + return crosapi::mojom::DownloadMixedContentStatus::kWarn; + case DownloadItem::MixedContentStatus::BLOCK: + return crosapi::mojom::DownloadMixedContentStatus::kBlock; + case DownloadItem::MixedContentStatus::SILENT_BLOCK: + return crosapi::mojom::DownloadMixedContentStatus::kSilentBlock; + } +} + +crosapi::mojom::DownloadState ConvertToMojoDownloadState( + DownloadItem::DownloadState value) { + switch (value) { + case DownloadItem::IN_PROGRESS: + return crosapi::mojom::DownloadState::kInProgress; + case DownloadItem::COMPLETE: + return crosapi::mojom::DownloadState::kComplete; + case DownloadItem::CANCELLED: + return crosapi::mojom::DownloadState::kCancelled; + case DownloadItem::INTERRUPTED: + return crosapi::mojom::DownloadState::kInterrupted; + case DownloadItem::MAX_DOWNLOAD_STATE: + NOTREACHED(); + return crosapi::mojom::DownloadState::kUnknown; + } +} + +} // namespace + +crosapi::mojom::DownloadItemPtr ConvertToMojoDownloadItem( + const DownloadItem* item, + bool is_from_incognito_profile) { + auto download = crosapi::mojom::DownloadItem::New(); + download->guid = item->GetGuid(); + download->state = ConvertToMojoDownloadState(item->GetState()); + download->full_path = item->GetFullPath(); + download->target_file_path = item->GetTargetFilePath(); + download->is_from_incognito_profile = is_from_incognito_profile; + download->is_paused = item->IsPaused(); + download->has_is_paused = true; + download->open_when_complete = item->GetOpenWhenComplete(); + download->has_open_when_complete = true; + download->received_bytes = item->GetReceivedBytes(); + download->has_received_bytes = true; + download->total_bytes = item->GetTotalBytes(); + download->has_total_bytes = true; + download->start_time = item->GetStartTime(); + download->is_dangerous = item->IsDangerous(); + download->has_is_dangerous = true; + download->is_mixed_content = item->IsMixedContent(); + download->has_is_mixed_content = true; + download->danger_type = + ConvertToMojoDownloadDangerType(item->GetDangerType()); + download->mixed_content_status = + ConvertToMojoDownloadMixedContentStatus(item->GetMixedContentStatus()); + return download; +} + +} // namespace download_item_utils +} // namespace download
diff --git a/components/download/public/common/download_item_utils.h b/components/download/public/common/download_item_utils.h new file mode 100644 index 0000000..9accd522 --- /dev/null +++ b/components/download/public/common/download_item_utils.h
@@ -0,0 +1,27 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_UTILS_H_ +#define COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_UTILS_H_ + +#include "chromeos/crosapi/mojom/download_controller.mojom-forward.h" +#include "components/download/public/common/download_export.h" + +namespace download { + +class DownloadItem; + +namespace download_item_utils { + +// Returns a new `crosapi::mojom::DownloadItemPtr` from the specified +// `DownloadItem*`. +COMPONENTS_DOWNLOAD_EXPORT +crosapi::mojom::DownloadItemPtr ConvertToMojoDownloadItem( + const DownloadItem* download_item, + bool is_from_incognito_profile); + +} // namespace download_item_utils +} // namespace download + +#endif // COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_UTILS_H_
diff --git a/components/exo/BUILD.gn b/components/exo/BUILD.gn index 58ec19c..28b2688 100644 --- a/components/exo/BUILD.gn +++ b/components/exo/BUILD.gn
@@ -128,6 +128,7 @@ ] assert_no_deps = [ + "//ash/components/arc", "//components/arc", "//content/public/browser", "//content/public/common",
diff --git a/components/feature_engagement/public/feature_constants.cc b/components/feature_engagement/public/feature_constants.cc index 9c6fda6f..6eaf79fe4 100644 --- a/components/feature_engagement/public/feature_constants.cc +++ b/components/feature_engagement/public/feature_constants.cc
@@ -7,6 +7,8 @@ namespace feature_engagement { // Features used by the In-Product Help system. +const base::Feature kEnableAutomaticSnooze{"EnableAutomaticSnooze", + base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kIPHDemoMode{"IPH_DemoMode", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kIPHSnooze{"IPH_Snooze", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/feature_engagement/public/feature_constants.h b/components/feature_engagement/public/feature_constants.h index 5dbd230..26dd44c 100644 --- a/components/feature_engagement/public/feature_constants.h +++ b/components/feature_engagement/public/feature_constants.h
@@ -10,6 +10,11 @@ namespace feature_engagement { +// A feature for enabling automatic snooze mode for In-Product Help (IPH). When +// this flag is enabled, we don't show snooze button/UI on the IPH, but on +// dismiss we will implicitly snooze it until the snooze limit count is reached. +extern const base::Feature kEnableAutomaticSnooze; + // A feature for enabling a demonstration mode for In-Product Help (IPH). extern const base::Feature kIPHDemoMode;
diff --git a/components/feed/core/v2/web_feed_subscription_coordinator.cc b/components/feed/core/v2/web_feed_subscription_coordinator.cc index 49b4b5d..00f8b741 100644 --- a/components/feed/core/v2/web_feed_subscription_coordinator.cc +++ b/components/feed/core/v2/web_feed_subscription_coordinator.cc
@@ -662,11 +662,16 @@ void WebFeedSubscriptionCoordinator::FetchRecommendedWebFeedsComplete( FetchRecommendedWebFeedsTask::Result result) { DCHECK(model_); + feed::WebFeedSubscriptions::RefreshResult refresh_result; + refresh_result.success = false; fetching_recommended_web_feeds_ = false; feed_stream_->GetMetricsReporter().RefreshRecommendedWebFeedsAttempted( result.status, result.recommended_web_feeds.size()); - if (result.status == WebFeedRefreshStatus::kSuccess) + if (result.status == WebFeedRefreshStatus::kSuccess) { + refresh_result.success = true; model_->UpdateRecommendedFeeds(std::move(result.recommended_web_feeds)); + } + CallRefreshRecommendedFeedsCompleteCallbacks(refresh_result); } void WebFeedSubscriptionCoordinator::
diff --git a/components/feed/core/v2/web_feed_subscription_coordinator.h b/components/feed/core/v2/web_feed_subscription_coordinator.h index 57a0764..480ef99a8 100644 --- a/components/feed/core/v2/web_feed_subscription_coordinator.h +++ b/components/feed/core/v2/web_feed_subscription_coordinator.h
@@ -167,7 +167,7 @@ void FetchSubscribedWebFeedsStart(); void FetchSubscribedWebFeedsComplete( FetchSubscribedWebFeedsTask::Result result); - void CallRefreshCompleteCallbacks(RefreshResult); + void CallRefreshCompleteCallbacks(RefreshResult result); void IsWebFeedSubscriberDone(base::OnceCallback<void(bool)> callback); void SubscribedWebFeedCountDone(base::OnceCallback<void(int)> callback);
diff --git a/components/heap_profiling/in_process/BUILD.gn b/components/heap_profiling/in_process/BUILD.gn index db06601..6d0a53ed1 100644 --- a/components/heap_profiling/in_process/BUILD.gn +++ b/components/heap_profiling/in_process/BUILD.gn
@@ -18,6 +18,7 @@ "//components/metrics", "//components/metrics:child_call_stack_profile_builder", "//components/services/heap_profiling/public/cpp:cpp", + "//components/version_info", ] } } @@ -34,6 +35,7 @@ "//base/test:test_support", "//components/metrics", "//components/metrics:child_call_stack_profile_builder", + "//components/version_info", ] } }
diff --git a/components/heap_profiling/in_process/DEPS b/components/heap_profiling/in_process/DEPS index c94083d..34645b7 100644 --- a/components/heap_profiling/in_process/DEPS +++ b/components/heap_profiling/in_process/DEPS
@@ -1,7 +1,7 @@ include_rules = [ "+components/metrics/call_stack_profile_builder.h", - "+components/metrics/call_stack_profile_metrics_provider.h", "+components/services/heap_profiling/public", + "+components/version_info", ] specific_include_rules = {
diff --git a/components/heap_profiling/in_process/heap_profiler_controller.cc b/components/heap_profiling/in_process/heap_profiler_controller.cc index e4fea36..be654e6 100644 --- a/components/heap_profiling/in_process/heap_profiler_controller.cc +++ b/components/heap_profiling/in_process/heap_profiler_controller.cc
@@ -20,13 +20,50 @@ #include "base/time/time.h" #include "build/build_config.h" #include "components/metrics/call_stack_profile_builder.h" -#include "components/metrics/call_stack_profile_metrics_provider.h" #include "components/services/heap_profiling/public/cpp/merge_samples.h" +#include "components/version_info/channel.h" namespace { +// Platform-specific parameter defaults. + +#if defined(OS_IOS) || defined(OS_ANDROID) +// Average 1M bytes per sample. +constexpr int kDefaultSamplingRate = 1000000; + +// Default on iOS is equal to mean value of up process time. Android is +// more similar to iOS than to Desktop. +constexpr int kDefaultCollectionIntervalInMinutes = 30; +#else +// Average 10M bytes per sample. +constexpr int kDefaultSamplingRate = 10000000; + +// Default on desktop is once per day. +constexpr int kDefaultCollectionIntervalInMinutes = 24 * 60; +#endif + +// Sets the chance that this client will report heap samples through a metrics +// provider if it's on the stable channel. +constexpr base::FeatureParam<double> kStableProbability{ + &HeapProfilerController::kHeapProfilerReporting, "stable-probability", + 0.01}; + +// Sets the chance that this client will report heap samples through a metrics +// provider if it's on a non-stable channel. +constexpr base::FeatureParam<double> kNonStableProbability{ + &HeapProfilerController::kHeapProfilerReporting, "nonstable-probability", + 0.5}; + // Sets heap sampling interval in bytes. -const char kHeapProfilerSamplingRate[] = "sampling-rate"; +constexpr base::FeatureParam<int> kSamplingRate{ + &HeapProfilerController::kHeapProfilerReporting, "sampling-rate", + kDefaultSamplingRate}; + +// Sets the interval between snapshots. +constexpr base::FeatureParam<int> kCollectionIntervalMinutes{ + &HeapProfilerController::kHeapProfilerReporting, + "heap-profiler-collection-interval-minutes", + kDefaultCollectionIntervalInMinutes}; base::TimeDelta RandomInterval(base::TimeDelta mean) { // Time intervals between profile collections form a Poisson stream with @@ -34,45 +71,39 @@ return -std::log(base::RandDouble()) * mean; } -// Returns collection interval by trying these steps: -// - get from command line if available to allow override for a single client -// - get from finch if available to allow experiment with different intervals -// - return default interval that is best suited for current OS -int GetCollectionIntervalInMinutes() { -#if defined(OS_IOS) || defined(OS_ANDROID) - // Default on iOS is equal to mean value of up process time. Android is more - // similar to iOS than to Desktop. - const int kDefaultValueInMinutes = 30; -#else - const int kDefaultValueInMinutes = 24 * 60; -#endif - - return base::GetFieldTrialParamByFeatureAsInt( - metrics::CallStackProfileMetricsProvider::kHeapProfilerReporting, - "heap-profiler-collection-interval-minutes", kDefaultValueInMinutes); +bool DecideIfCollectionIsEnabled(version_info::Channel channel) { + // TODO(crbug.com/1271555): Register a synthetic field trial + // (go/synthetic-trials) to keep track of which clients are opted in. + if (!base::FeatureList::IsEnabled( + HeapProfilerController::kHeapProfilerReporting)) + return false; + const double probability = (channel == version_info::Channel::STABLE) + ? kStableProbability.Get() + : kNonStableProbability.Get(); + return base::RandDouble() < probability; } } // namespace -HeapProfilerController::HeapProfilerController() - : stopped_(base::MakeRefCounted<StoppedFlag>()) {} +constexpr base::Feature HeapProfilerController::kHeapProfilerReporting{ + "HeapProfilerReporting", base::FEATURE_ENABLED_BY_DEFAULT}; + +HeapProfilerController::HeapProfilerController(version_info::Channel channel) + : profiling_enabled_(DecideIfCollectionIsEnabled(channel)), + stopped_(base::MakeRefCounted<StoppedFlag>()) {} HeapProfilerController::~HeapProfilerController() { stopped_->data.Set(); } void HeapProfilerController::Start() { - if (!base::FeatureList::IsEnabled( - metrics::CallStackProfileMetricsProvider::kHeapProfilerReporting)) { + if (!profiling_enabled_) return; - } - int sampling_rate = base::GetFieldTrialParamByFeatureAsInt( - metrics::CallStackProfileMetricsProvider::kHeapProfilerReporting, - kHeapProfilerSamplingRate, 0); + int sampling_rate = kSamplingRate.Get(); if (sampling_rate > 0) base::SamplingHeapProfiler::Get()->SetSamplingInterval(sampling_rate); base::SamplingHeapProfiler::Get()->Start(); - const int interval = GetCollectionIntervalInMinutes(); + const int interval = kCollectionIntervalMinutes.Get(); DCHECK_GT(interval, 0); ScheduleNextSnapshot( stopped_, {.interval = base::Minutes(interval),
diff --git a/components/heap_profiling/in_process/heap_profiler_controller.h b/components/heap_profiling/in_process/heap_profiler_controller.h index 8a874fc..0d482eb8 100644 --- a/components/heap_profiling/in_process/heap_profiler_controller.h +++ b/components/heap_profiling/in_process/heap_profiler_controller.h
@@ -8,16 +8,20 @@ #include <map> #include <vector> +#include "base/feature_list.h" #include "base/memory/ref_counted.h" #include "base/sampling_heap_profiler/sampling_heap_profiler.h" #include "base/synchronization/atomic_flag.h" #include "base/time/time.h" +#include "components/version_info/channel.h" // HeapProfilerController controls collection of sampled heap allocation // snapshots for the current process. class HeapProfilerController { public: - HeapProfilerController(); + // `channel` is used to determine the probability that this client will be + // opted in to profiling. + explicit HeapProfilerController(version_info::Channel channel); HeapProfilerController(const HeapProfilerController&) = delete; HeapProfilerController& operator=(const HeapProfilerController&) = delete; @@ -50,6 +54,14 @@ // Merges samples that have identical stack traces, excluding total and size. static SampleMap MergeSamples(const std::vector<Sample>& samples); + // If this is disabled, the client will not collect heap profiles. If it is + // enabled, the client may enable the sampling heap profiler (with probability + // based on the "stable-probability" parameter if the client is on the stable + // channel, or the "nonstable-probability" parameter otherwise). Sampled heap + // profiles will then be reported through the metrics service iff metrics + // reporting is enabled. + static const base::Feature kHeapProfilerReporting; + // Uses the exact parameter values for the sampling interval and time between // samples, instead of a distribution around those values. This must be called // before Start. @@ -68,6 +80,10 @@ CollectionInterval heap_collection_interval); static void RetrieveAndSendSnapshot(); + // On startup this will be determined randomly based on the current channel + // and the probability parameters of the HeapProfilerReporting feature. + const bool profiling_enabled_; + scoped_refptr<StoppedFlag> stopped_; bool suppress_randomness_for_testing_ = false; };
diff --git a/components/heap_profiling/in_process/heap_profiler_controller_unittest.cc b/components/heap_profiling/in_process/heap_profiler_controller_unittest.cc index 3ad7fd7..c9fdc8db 100644 --- a/components/heap_profiling/in_process/heap_profiler_controller_unittest.cc +++ b/components/heap_profiling/in_process/heap_profiler_controller_unittest.cc
@@ -5,53 +5,69 @@ #include "components/heap_profiling/in_process/heap_profiler_controller.h" #include <atomic> +#include <memory> +#include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" +#include "base/metrics/field_trial_params.h" #include "base/sampling_heap_profiler/poisson_allocation_sampler.h" #include "base/sampling_heap_profiler/sampling_heap_profiler.h" +#include "base/strings/string_number_conversions.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/metrics/call_stack_profile_builder.h" -#include "components/metrics/call_stack_profile_metrics_provider.h" +#include "components/version_info/channel.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/metrics_proto/sampled_profile.pb.h" namespace heap_profiling { -class HeapProfilerControllerTest : public ::testing::Test { - protected: - HeapProfilerControllerTest() { - feature_list_.InitAndEnableFeature( - metrics::CallStackProfileMetricsProvider::kHeapProfilerReporting); - // Clear any samples set in the global SamplingHeapProfiler before the - // ScopedMuteHookedSamplesForTesting was created. - base::SamplingHeapProfiler::Get()->ClearSamplesForTesting(); - base::PoissonAllocationSampler::Get()->SuppressRandomnessForTest(true); - } +namespace { - ~HeapProfilerControllerTest() override { - base::PoissonAllocationSampler::Get()->SuppressRandomnessForTest(false); - } +constexpr size_t kSamplingRate = 1024; +constexpr size_t kAllocationSize = 42 * kSamplingRate; - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; - base::test::ScopedFeatureList feature_list_; - base::PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting mute_hooks_; +// Configurations of the HeapProfilerReporting feature to test. +// The default parameters always enable reporting on all channels. +struct HeapProfilerReportingConfig { + bool enabled = true; + double stable_probability = 1.0; + double nonstable_probability = 1.0; }; // A wrapper that sets up a HeapProfilerController for testing. class HeapProfilerControllerTester { public: - explicit HeapProfilerControllerTester( + HeapProfilerControllerTester( + version_info::Channel channel, base::RepeatingCallback<void(base::TimeTicks, metrics::SampledProfile)> - receiver_callback) { - controller_.SuppressRandomnessForTesting(); + receiver_callback, + const HeapProfilerReportingConfig& feature_config = + HeapProfilerReportingConfig()) { + if (feature_config.enabled) { + feature_list_.InitAndEnableFeatureWithParameters( + HeapProfilerController::kHeapProfilerReporting, + {{"stable-probability", + base::NumberToString(feature_config.stable_probability)}, + {"nonstable-probability", + base::NumberToString(feature_config.nonstable_probability)}, + {"sampling-rate", base::NumberToString(kSamplingRate)}}); + } else { + feature_list_.InitAndDisableFeature( + HeapProfilerController::kHeapProfilerReporting); + // Set the sampling rate manually since there's no param to read. + base::SamplingHeapProfiler::Get()->SetSamplingInterval(kSamplingRate); + } + metrics::CallStackProfileBuilder::SetBrowserProcessReceiverCallback( std::move(receiver_callback)); + + controller_ = std::make_unique<HeapProfilerController>(channel); + controller_->SuppressRandomnessForTesting(); } ~HeapProfilerControllerTester() { @@ -63,27 +79,62 @@ HeapProfilerControllerTester& operator=(const HeapProfilerControllerTester&) = delete; - HeapProfilerController& controller() { return controller_; } + HeapProfilerController& controller() { return *controller_; } private: - HeapProfilerController controller_; + std::unique_ptr<HeapProfilerController> controller_; + base::test::ScopedFeatureList feature_list_; +}; + +// A callback that fails the test if any samples are received. +void ExpectNoSamples(base::TimeTicks, metrics::SampledProfile) { + ADD_FAILURE(); +} + +} // namespace + +class HeapProfilerControllerTest : public ::testing::Test { + protected: + HeapProfilerControllerTest() { + // Clear any samples set in the global SamplingHeapProfiler before the + // ScopedMuteHookedSamplesForTesting was created. + base::SamplingHeapProfiler::Get()->ClearSamplesForTesting(); + base::PoissonAllocationSampler::Get()->SuppressRandomnessForTest(true); + } + + ~HeapProfilerControllerTest() override { + base::PoissonAllocationSampler::Get()->SuppressRandomnessForTest(false); + } + + void AddOneSampleAndWait() { + auto* sampler = base::PoissonAllocationSampler::Get(); + sampler->RecordAlloc(reinterpret_cast<void*>(0x1337), kAllocationSize, + base::PoissonAllocationSampler::kManualForTesting, + nullptr); + // Advance several days to be sure the sample isn't scheduled right on the + // boundary of the fast-forward. + task_environment_.FastForwardBy(base::Days(2)); + // Free the allocation so that other tests can re-use the address. + sampler->RecordFree(reinterpret_cast<void*>(0x1337)); + } + + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + base::PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting mute_hooks_; }; TEST_F(HeapProfilerControllerTest, EmptyProfileIsNotEmitted) { - HeapProfilerControllerTester tester(base::BindLambdaForTesting( - [](base::TimeTicks time, metrics::SampledProfile profile) { - ADD_FAILURE(); - })); + HeapProfilerControllerTester tester(version_info::Channel::STABLE, + base::BindRepeating(&ExpectNoSamples)); tester.controller().Start(); - - task_environment_.FastForwardBy(base::Days(365)); + // Advance several days to be sure the sample isn't scheduled right on the + // boundary of the fast-forward. + task_environment_.FastForwardBy(base::Days(2)); } // Sampling profiler is not capable of unwinding stack on Android under tests. #if !defined(OS_ANDROID) TEST_F(HeapProfilerControllerTest, ProfileCollectionsScheduler) { - constexpr size_t kSamplingRate = 1024; - constexpr size_t kAllocationSize = 42 * kSamplingRate; constexpr int kSnapshotsToCollect = 3; std::atomic<int> profile_count{0}; @@ -109,10 +160,8 @@ ++profile_count; }; - base::SamplingHeapProfiler::Get()->SetSamplingInterval(kSamplingRate); - HeapProfilerControllerTester tester( - base::BindLambdaForTesting(check_profile)); + version_info::Channel::STABLE, base::BindLambdaForTesting(check_profile)); tester.controller().Start(); auto* sampler = base::PoissonAllocationSampler::Get(); @@ -135,4 +184,74 @@ } #endif +// Test that disabling the HeapProfilerReporting feature disables metrics +// uploading. +TEST_F(HeapProfilerControllerTest, DisableFeature) { + HeapProfilerControllerTester tester( + version_info::Channel::STABLE, base::BindRepeating(&ExpectNoSamples), + HeapProfilerReportingConfig{.enabled = false}); + tester.controller().Start(); + AddOneSampleAndWait(); +} + +// Test that the "stable-probability" param can disable metrics uploading on the +// stable channel. +TEST_F(HeapProfilerControllerTest, StableProbability) { + HeapProfilerReportingConfig feature_config{ + .enabled = true, .stable_probability = 0.0, .nonstable_probability = 1.0}; + + // Test stable channel. + { + HeapProfilerControllerTester tester(version_info::Channel::STABLE, + base::BindRepeating(&ExpectNoSamples), + feature_config); + tester.controller().Start(); + AddOneSampleAndWait(); + } + + // Test canary channel. + { + std::atomic<bool> got_sample; + auto watch_for_sample = [&](base::TimeTicks, metrics::SampledProfile) { + got_sample = true; + }; + HeapProfilerControllerTester tester( + version_info::Channel::CANARY, + base::BindLambdaForTesting(watch_for_sample), feature_config); + tester.controller().Start(); + AddOneSampleAndWait(); + EXPECT_TRUE(got_sample); + } +} + +// Test that the "nonstable-probability" param can disable metrics uploading on +// the canary channel. +TEST_F(HeapProfilerControllerTest, NonStableProbability) { + HeapProfilerReportingConfig feature_config{ + .enabled = true, .stable_probability = 1.0, .nonstable_probability = 0.0}; + + // Test stable channel. + { + std::atomic<bool> got_sample; + auto watch_for_sample = [&](base::TimeTicks, metrics::SampledProfile) { + got_sample = true; + }; + HeapProfilerControllerTester tester( + version_info::Channel::STABLE, + base::BindLambdaForTesting(watch_for_sample), feature_config); + tester.controller().Start(); + AddOneSampleAndWait(); + EXPECT_TRUE(got_sample); + } + + // Test canary channel. + { + HeapProfilerControllerTester tester(version_info::Channel::CANARY, + base::BindRepeating(&ExpectNoSamples), + feature_config); + tester.controller().Start(); + AddOneSampleAndWait(); + } +} + } // namespace heap_profiling
diff --git a/components/metrics/call_stack_profile_metrics_provider.cc b/components/metrics/call_stack_profile_metrics_provider.cc index 76114cef..ecdcd47 100644 --- a/components/metrics/call_stack_profile_metrics_provider.cc +++ b/components/metrics/call_stack_profile_metrics_provider.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/bind.h" +#include "base/check.h" #include "base/feature_list.h" #include "base/no_destructor.h" #include "base/synchronization/lock.h" @@ -233,9 +234,6 @@ CallStackProfileMetricsProvider::kSamplingProfilerReporting = { "SamplingProfilerReporting", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature CallStackProfileMetricsProvider::kHeapProfilerReporting{ - "HeapProfilerReporting", base::FEATURE_DISABLED_BY_DEFAULT}; - CallStackProfileMetricsProvider::CallStackProfileMetricsProvider() = default; CallStackProfileMetricsProvider::~CallStackProfileMetricsProvider() = default; @@ -250,12 +248,10 @@ return; } - const base::Feature& feature = - profile.trigger_event() == SampledProfile::PERIODIC_HEAP_COLLECTION - ? kHeapProfilerReporting - : kSamplingProfilerReporting; - if (!base::FeatureList::IsEnabled(feature)) + if (profile.trigger_event() != SampledProfile::PERIODIC_HEAP_COLLECTION && + !base::FeatureList::IsEnabled(kSamplingProfilerReporting)) { return; + } PendingProfiles::GetInstance()->MaybeCollectProfile(profile_start_time, std::move(profile)); } @@ -302,12 +298,13 @@ std::vector<SampledProfile> profiles = PendingProfiles::GetInstance()->RetrieveProfiles(); - DCHECK(base::FeatureList::IsEnabled(kSamplingProfilerReporting) || - base::FeatureList::IsEnabled(kHeapProfilerReporting) || - profiles.empty()); - - for (auto& profile : profiles) + for (auto& profile : profiles) { + // Only heap samples should ever be received if SamplingProfilerReporting is + // disabled. + DCHECK(base::FeatureList::IsEnabled(kSamplingProfilerReporting) || + profile.trigger_event() == SampledProfile::PERIODIC_HEAP_COLLECTION); *uma_proto->add_sampled_profile() = std::move(profile); + } } // static
diff --git a/components/metrics/call_stack_profile_metrics_provider.h b/components/metrics/call_stack_profile_metrics_provider.h index 598ed14c..33b318b 100644 --- a/components/metrics/call_stack_profile_metrics_provider.h +++ b/components/metrics/call_stack_profile_metrics_provider.h
@@ -59,9 +59,6 @@ void ProvideCurrentSessionData( ChromeUserMetricsExtension* uma_proto) override; - // Enables reporting of sampling heap profiles. - static const base::Feature kHeapProfilerReporting; - protected: // base::Feature for reporting CPU profiles. Provided here for test use. static const base::Feature kSamplingProfilerReporting;
diff --git a/components/metrics/call_stack_profile_metrics_provider_unittest.cc b/components/metrics/call_stack_profile_metrics_provider_unittest.cc index e03b6bd2..10fb3f6 100644 --- a/components/metrics/call_stack_profile_metrics_provider_unittest.cc +++ b/components/metrics/call_stack_profile_metrics_provider_unittest.cc
@@ -209,26 +209,9 @@ EXPECT_EQ(0, uma_proto.sampled_profile_size()); } -// Checks that a heap profile is not reported when Finch experiment is not -// enabled. -TEST_F(CallStackProfileMetricsProviderTest, - HeapProfileNotProvidedWithoutFinch) { - CallStackProfileMetricsProvider provider; - base::TimeTicks profile_start_time = base::TimeTicks::Now(); - SampledProfile profile; - profile.set_trigger_event(SampledProfile::PERIODIC_HEAP_COLLECTION); - CallStackProfileMetricsProvider::ReceiveProfile(profile_start_time, profile); - ChromeUserMetricsExtension uma_proto; - provider.ProvideCurrentSessionData(&uma_proto); - EXPECT_EQ(0, uma_proto.sampled_profile_size()); -} - // Checks that a heap profile is not reported when recording is disabled. TEST_F(CallStackProfileMetricsProviderTest, HeapProfileNotProvidedWhenDisabled) { - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - CallStackProfileMetricsProvider::kHeapProfilerReporting); CallStackProfileMetricsProvider provider; provider.OnRecordingDisabled(); base::TimeTicks profile_start_time = base::TimeTicks::Now(); @@ -243,9 +226,6 @@ // Checks that a heap profile is provided to ProvideCurrentSessionData // if recording is enabled. TEST_F(CallStackProfileMetricsProviderTest, HeapProfileProvidedWhenEnabled) { - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - CallStackProfileMetricsProvider::kHeapProfilerReporting); CallStackProfileMetricsProvider provider; provider.OnRecordingEnabled(); base::TimeTicks profile_start_time = base::TimeTicks::Now(); @@ -257,21 +237,29 @@ EXPECT_EQ(1, uma_proto.sampled_profile_size()); } -// Checks that a CPU profile is not reported when the heap profiler Finch -// experiment is enabled, but sampling CPU Finch is disabled. +// Checks that heap profiles but not CPU profiles are reported when sampling CPU +// Finch is disabled. TEST_F(CallStackProfileMetricsProviderTest, CpuProfileNotProvidedWithoutFinch) { base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures( - {CallStackProfileMetricsProvider::kHeapProfilerReporting}, - {TestState::kSamplingProfilerReporting}); + scoped_feature_list.InitAndDisableFeature( + TestState::kSamplingProfilerReporting); CallStackProfileMetricsProvider provider; base::TimeTicks profile_start_time = base::TimeTicks::Now(); + SampledProfile profile; profile.set_trigger_event(SampledProfile::PERIODIC_COLLECTION); CallStackProfileMetricsProvider::ReceiveProfile(profile_start_time, profile); + + SampledProfile heap_profile; + heap_profile.set_trigger_event(SampledProfile::PERIODIC_HEAP_COLLECTION); + CallStackProfileMetricsProvider::ReceiveProfile(profile_start_time, + heap_profile); + ChromeUserMetricsExtension uma_proto; provider.ProvideCurrentSessionData(&uma_proto); - EXPECT_EQ(0, uma_proto.sampled_profile_size()); + ASSERT_EQ(1, uma_proto.sampled_profile_size()); + EXPECT_EQ(SampledProfile::PERIODIC_HEAP_COLLECTION, + uma_proto.sampled_profile(0).trigger_event()); } } // namespace metrics
diff --git a/components/mirroring/service/receiver_response.cc b/components/mirroring/service/receiver_response.cc index 8f16652..88727a5e 100644 --- a/components/mirroring/service/receiver_response.cc +++ b/components/mirroring/service/receiver_response.cc
@@ -209,8 +209,8 @@ switch (response->type_) { case ResponseType::ANSWER: response->answer_ = std::make_unique<openscreen::cast::Answer>(); - if (!openscreen::cast::Answer::ParseAndValidate( - root_node["answer"], response->answer_.get())) { + if (!openscreen::cast::Answer::TryParse(root_node["answer"], + response->answer_.get())) { response->valid_ = false; } break;
diff --git a/components/nacl/browser/pnacl_host.cc b/components/nacl/browser/pnacl_host.cc index 823dc6a..0b6ae64 100644 --- a/components/nacl/browser/pnacl_host.cc +++ b/components/nacl/browser/pnacl_host.cc
@@ -191,10 +191,9 @@ PLOG(ERROR) << "Temp file creation failed."; } else { file.Initialize( - file_path, - base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | - base::File::FLAG_WRITE | base::File::FLAG_TEMPORARY | - base::File::FLAG_DELETE_ON_CLOSE); + file_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | + base::File::FLAG_WRITE | base::File::FLAG_WIN_TEMPORARY | + base::File::FLAG_DELETE_ON_CLOSE); if (!file.IsValid()) PLOG(ERROR) << "Temp file open failed: " << file.error_details();
diff --git a/components/payments/content/BUILD.gn b/components/payments/content/BUILD.gn index 840277e..a8fa36b 100644 --- a/components/payments/content/BUILD.gn +++ b/components/payments/content/BUILD.gn
@@ -98,10 +98,7 @@ deps += [ "//ash/components/arc", - "//ash/components/arc/mojom", "//ash/public/cpp/external_arc", - "//components/arc", - "//components/arc/mojom", ] } @@ -270,11 +267,11 @@ sources += [ "android_app_communication_test_support_chrome_os.cc" ] deps += [ + "//ash/components/arc", "//ash/components/arc:arc_test_support", "//ash/components/arc/mojom", "//ash/public/cpp/external_arc:test_support", "//components/arc", - "//components/arc/mojom", ] }
diff --git a/components/policy/resources/policy_templates_it.xtb b/components/policy/resources/policy_templates_it.xtb index acf0ba6..5d62336 100644 --- a/components/policy/resources/policy_templates_it.xtb +++ b/components/policy/resources/policy_templates_it.xtb
@@ -1484,6 +1484,10 @@ <translation id="2716623398185506073">Se il criterio viene impostato su Attivato, i dispositivi registrati segnalano statistiche hardware e identificatori relativi al consumo di energia. Se il criterio viene impostato su Disattivato o se non viene configurato, i dispositivi registrati non segnalano statistiche relative al consumo di energia.</translation> +<translation id="2717628606602248727">Questo criterio è impostato su Attivato per impostazione predefinita. Consente di stabilire se i dispositivi registrati devono segnalare o meno le informazioni sulla memoria. + + Se il criterio viene impostato su Disattivato, i dispositivi registrati non segnalano informazioni sulla memoria. + Eccezione: le informazioni relative alla memoria libera vengono controllate tramite il criterio <ph name="REPORT_DEVICE_HARDWARE_STATUS" /> per M95 e versioni precedenti.</translation> <translation id="2721185634942265347">Disattiva i suggerimenti di ricerca</translation> <translation id="2721582713721006926">Disattiva definizioni di Risposte rapide</translation> <translation id="2723692978495226412">Se il criterio viene impostato su Attivato, vengono visualizzati dei consigli per le app precedentemente installate dall'utente su altri dispositivi. Questi consigli vengono visualizzati in Avvio app in seguito ai consigli sulle app locali, se non viene inserito alcun testo di ricerca. @@ -3986,6 +3990,9 @@ Se il criterio è impostato su False o non è configurato, le informazioni non vengono segnalate. Se è impostato su True, le informazioni sui VPD del dispositivo vengono segnalate. I Vital Product Data (VPD) sono una raccolta di dati informativi e di configurazione (come numeri di serie o di componenti) associati al dispositivo.</translation> +<translation id="576158229686912964">Questo criterio è stato ritirato nella versione M96. Usa i criteri <ph name="REPORT_DEVICE_NETWORK_CONFIGURATION" /> e <ph name="REPORT_DEVICE_NETWORK_STATUS" />. + + Se il criterio viene impostato su Attivato o se non viene configurato, i dispositivi registrati segnalano l'elenco di interfacce di rete con i relativi tipi e indirizzi hardware. Se il criterio viene impostato su Disattivato, i dispositivi registrati non segnalano l'interfaccia di rete.</translation> <translation id="5762969307102447459">Disattiva la compilazione automatica per gli indirizzi</translation> <translation id="5765780083710877561">Descrizione:</translation> <translation id="5766438888216077649">Non impostare <ph name="WINDOW_OPENER_PROPERTY" /> per i link indirizzati alla pagina <ph name="BLANK_PAGE_NAME" /></translation> @@ -5404,6 +5411,10 @@ Se questo criterio non viene impostato, per tutti i siti viene usato il valore predefinito globale del criterio "DefaultKeygenSetting" (se impostato) o della configurazione personale dell'utente (se non impostato). Per informazioni dettagliate sui pattern URL validi, visita la pagina https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns. <ph name="WILDCARD_VALUE" /> non è un valore accettato per questo criterio.</translation> +<translation id="7394023172636522064">Se il criterio viene impostato su Attivato, viene segnalato lo stato di sicurezza TPM dei dispositivi. + + Se il criterio viene impostato su Disattivato o se non viene configurato, i dispositivi registrati non registrano o non segnalano lo stato di sicurezza TPM. + Eccezione: le informazioni relative a TPM vengono controllate tramite il criterio <ph name="REPORT_DEVICE_HARDWARE_STATUS" /> per M95 e versioni precedenti.</translation> <translation id="739556497251174388">Consenti il riutilizzo delle credenziali di accesso di <ph name="PRODUCT_OS_NAME" /> per l'autenticazione della rete</translation> <translation id="7400971609879083218">Se il criterio viene impostato su Attivato, le immagini di terze parti su una pagina possono visualizzare un prompt di autenticazione. @@ -5481,6 +5492,9 @@ Se il criterio non viene configurato, il valore predefinito è <ph name="LACROS_AVAILABILITY_LACROS_DISALLOWED_VALUE" /> per gli utenti gestiti a livello aziendale e <ph name="LACROS_AVAILABILITY_USER_CHOICE_VALUE" /> per gli utenti non gestiti. In futuro sarà possibile impostare <ph name="LACROS_NAME" /> come unico browser disponibile in <ph name="PRODUCT_OS_NAME" /> impostando il valore <ph name="LACROS_AVAILABILITY_LACROS_ONLY_VALUE" />.</translation> +<translation id="7509761893401042250">Questo criterio è stato ritirato a partire dalla versione M96. Usa i criteri <ph name="REPORT_DEVICE_CPU_INFO" />, <ph name="REPORT_DEVICE_MEMORY_INFO" />, <ph name="REPORT_DEVICE_STORAGE_STATUS" />, <ph name="REPORT_DEVICE_SECURITY_STATUS" /> e <ph name="REPORT_DEVICE_AUDIO_STATUS" />. + + Se il criterio viene impostato su Attivato o se non viene configurato, i dispositivi registrati segnalano statistiche hardware quali l'utilizzo di CPU/RAM. Se il criterio viene impostato su Disattivato, i dispositivi registrati non segnalano le statistiche hardware.</translation> <translation id="7519218194072744342">L'URL del gestore di protocollo.</translation> <translation id="7519251620064708155">Consenti la generazione di chiavi su questi siti</translation> <translation id="7529144158022474049">Fattore di dispersione aggiornamento automatico</translation> @@ -5488,6 +5502,10 @@ Se il criterio non viene impostato o viene impostato su True, viene mostrato un avviso per ricordare agli utenti di uscire dalla modalità a schermo intero prima di digitare la password. Se il criterio viene impostato su False, l'avviso non viene mostrato.</translation> <translation id="7534199150025803530">Questa norma non influisce sull'app Google Drive per Android. Se vuoi impedire l'utilizzo di Google Drive tramite rete cellulare, non devi consentire l'installazione dell'app Google Drive per Android.</translation> +<translation id="7538583957913002726">Questo criterio è impostato su Attivato per impostazione predefinita. Consente di stabilire se i dispositivi registrati devono segnalare o meno informazioni quali nome del modello, architettura e velocità di clock massima della CPU (oltre a utilizzo e temperatura della CPU per M96 e versioni successive). + + Se il criterio viene impostato su Disattivato, i dispositivi registrati non segnalano informazioni sulla CPU. + Eccezione: la segnalazione dell'utilizzo e della temperatura della CPU viene controllata tramite il criterio <ph name="REPORT_DEVICE_HARDWARE_STATUS" /> per M95 e versioni precedenti.</translation> <translation id="7540622499178214923">Permette di consentire l'uso del controller DTC (Diagnostics and Telemetry Controller) wilco</translation> <translation id="7540826630642174841">Impostare il criterio significa che i criteri relativi ai dispositivi specificati vengono ignorati (si usano le impostazioni predefinite di questi criteri) durante gli intervalli indicati. I criteri relativi ai dispositivi vengono applicati di nuovo da <ph name="PRODUCT_NAME" /> all'inizio o alla fine del periodo del criterio. L'utente viene avvisato e deve disconnettersi quando questo periodo e le impostazioni dei criteri relativi ai dispositivi cambiano (ad esempio, quando un utente accede con un account non autorizzato).</translation> <translation id="7540945123920084379">La configurazione del criterio consente di stabilire le modalità di sblocco rapido che è possibile usare per sbloccare la schermata di blocco. @@ -5663,6 +5681,10 @@ Nota: per esempi approfonditi, consulta la pagina The Chromium Projects (https://www.chromium.org/developers/design-documents/network-settings#TOC-Command-line-options-for-proxy-sett).</translation> <translation id="7717938661004793600">Configura le funzioni di accessibilità di <ph name="PRODUCT_OS_NAME" />.</translation> +<translation id="7718127720248642697">Questo criterio è impostato su Attivato per impostazione predefinita. Consente di stabilire se i dispositivi registrati devono segnalare o meno statistiche hardware e identificatori per i dispositivi di archiviazione. + + Se il criterio viene impostato su Disattivato, i dispositivi registrati non segnalano statistiche relative all'archiviazione. + Eccezione: le dimensioni del disco e lo spazio libero su disco vengono controllati tramite il criterio <ph name="REPORT_DEVICE_HARDWARE_STATUS" /> per M95 e versioni precedenti.</translation> <translation id="7721944091689270995">ID utente <ph name="PLUGIN_VM_NAME" /></translation> <translation id="7724161903134898864">Se il criterio è impostato su 1, i siti web possono mostrare i popup. Se il criterio è impostato su 2, i popup vengono negati. @@ -6793,6 +6815,10 @@ Per informazioni dettagliate sui pattern URL validi, visita la pagina https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns.</translation> <translation id="9068629430243705879">porta 6566 (può essere sbloccata fino al 15/10/2021)</translation> +<translation id="9069588907259547232">Se il criterio viene impostato su Attivato o se non viene configurato, i dispositivi registrati segnalano il relativo volume dell'audio. + + Se il criterio viene impostato su Disattivato, i dispositivi registrati non registrano o non segnalano lo stato dell'audio. + Eccezione: le informazioni relative al livello del volume di sistema vengono controllate tramite il criterio <ph name="REPORT_DEVICE_HARDWARE_STATUS" /> per M95 e versioni precedenti.</translation> <translation id="9073405975862312795">Se il criterio viene impostato su Attivato o se non viene configurato, i dispositivi registrati segnalano i periodi di attività di un utente sul dispositivo. Se il criterio viene impostato su Disattivato, i dispositivi registrati non registrano e non segnalano i tempi di attività.</translation>
diff --git a/components/reporting/proto/synced/README b/components/reporting/proto/synced/README index 1400894..b21dc5d 100644 --- a/components/reporting/proto/synced/README +++ b/components/reporting/proto/synced/README
@@ -1 +1,2 @@ -Files in this directory are automatically generated. Do not modify them. +Files in this directory are synced to other locations. If modifying or adding files, +please see instructions for syncing: google3/chrome/cros/reporting/api/proto/synced/README.md
diff --git a/components/safe_browsing/content/common/file_type_policies_unittest.cc b/components/safe_browsing/content/common/file_type_policies_unittest.cc index d727342..96fec0b 100644 --- a/components/safe_browsing/content/common/file_type_policies_unittest.cc +++ b/components/safe_browsing/content/common/file_type_policies_unittest.cc
@@ -10,7 +10,6 @@ #include "base/files/file_path.h" #include "build/build_config.h" -#include "build/chromeos_buildflags.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -79,7 +78,7 @@ EXPECT_EQ(13l, file_type.uma_value()); EXPECT_FALSE(file_type.is_archive()); EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting()); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) EXPECT_EQ(DownloadFileType::NOT_DANGEROUS, file_type.platform_settings(0).danger_level()); EXPECT_EQ(DownloadFileType::ALLOW_AUTO_OPEN, @@ -117,7 +116,7 @@ EXPECT_EQ(143, file_type.uma_value()); EXPECT_FALSE(file_type.is_archive()); EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting()); -#if defined(OS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE, file_type.platform_settings(0).danger_level()); EXPECT_EQ(DownloadFileType::DISALLOW_AUTO_OPEN, @@ -138,7 +137,7 @@ EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting()); // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if defined(OS_LINUX) EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE, file_type.platform_settings(0).danger_level()); EXPECT_EQ(DownloadFileType::DISALLOW_AUTO_OPEN,
diff --git a/components/safe_browsing/content/resources/BUILD.gn b/components/safe_browsing/content/resources/BUILD.gn index b0411fa75..0abd890 100644 --- a/components/safe_browsing/content/resources/BUILD.gn +++ b/components/safe_browsing/content/resources/BUILD.gn
@@ -24,13 +24,13 @@ # in the python script. if (is_android) { target_arch = "android" - } else if (is_chromeos_ash) { + } else if (is_chromeos) { target_arch = "chromeos" } else if (is_win) { target_arch = "win" } else if (is_mac) { target_arch = "mac" - } else if (is_linux || is_chromeos) { + } else if (is_linux) { target_arch = "linux" } else if (is_fuchsia) { target_arch = "fuchsia"
diff --git a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc index b85011fc..582abe66 100644 --- a/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc +++ b/components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc
@@ -12,7 +12,6 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" #include "build/build_config.h" -#include "build/chromeos_buildflags.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/core/browser/referrer_chain_provider.h" #include "components/safe_browsing/core/browser/verdict_cache_manager.h" @@ -102,13 +101,13 @@ RTLookupRequest::OSType GetRTLookupRequestOSType() { #if defined(OS_ANDROID) return RTLookupRequest::OS_TYPE_ANDROID; -#elif BUILDFLAG(IS_CHROMEOS_ASH) +#elif defined(OS_CHROMEOS) return RTLookupRequest::OS_TYPE_CHROME_OS; #elif defined(OS_FUCHSIA) return RTLookupRequest::OS_TYPE_FUCHSIA; #elif defined(OS_IOS) return RTLookupRequest::OS_TYPE_IOS; -#elif defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif defined(OS_LINUX) return RTLookupRequest::OS_TYPE_LINUX; #elif defined(OS_MAC) return RTLookupRequest::OS_TYPE_MAC;
diff --git a/components/safe_browsing/core/common/utils.cc b/components/safe_browsing/core/common/utils.cc index c4419ed..a29141d 100644 --- a/components/safe_browsing/core/common/utils.cc +++ b/components/safe_browsing/core/common/utils.cc
@@ -12,7 +12,6 @@ #include "base/strings/string_number_conversions.h" #include "base/time/time.h" #include "build/build_config.h" -#include "build/chromeos_buildflags.h" #include "components/policy/core/browser/browser_policy_connector.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/core/common/features.h" @@ -56,13 +55,13 @@ return ChromeUserPopulation::ENTERPRISE_MANAGED; else return ChromeUserPopulation::NOT_MANAGED; -#elif BUILDFLAG(IS_CHROMEOS_ASH) +#elif defined(OS_CHROMEOS) if (!bpc || !bpc->IsDeviceEnterpriseManaged()) return ChromeUserPopulation::NOT_MANAGED; return ChromeUserPopulation::ENTERPRISE_MANAGED; #else return ChromeUserPopulation::UNAVAILABLE; -#endif // #if defined(OS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) +#endif // #if defined(OS_WIN) || defined(OS_CHROMEOS) } void SetDelayInPref(PrefService* prefs,
diff --git a/components/send_tab_to_self/features.cc b/components/send_tab_to_self/features.cc index 1713b088..8c9c2277 100644 --- a/components/send_tab_to_self/features.cc +++ b/components/send_tab_to_self/features.cc
@@ -5,6 +5,7 @@ #include "components/send_tab_to_self/features.h" #include "base/feature_list.h" +#include "build/build_config.h" #include "build/buildflag.h" #include "build/chromeos_buildflags.h" #include "components/sync/base/sync_prefs.h" @@ -30,8 +31,14 @@ #endif }; -const base::Feature kSendTabToSelfV2{"SendTabToSelfV2", - base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kSendTabToSelfV2{ + "SendTabToSelfV2", +#if defined(OS_ANDROID) || defined(OS_IOS) + base::FEATURE_DISABLED_BY_DEFAULT +#else + base::FEATURE_ENABLED_BY_DEFAULT +#endif +}; bool IsReceivingEnabledByUserOnThisDevice(PrefService* prefs) { // TODO(crbug.com/1015322): SyncPrefs is used directly instead of methods in
diff --git a/components/signin/core/browser/signin_header_helper_unittest.cc b/components/signin/core/browser/signin_header_helper_unittest.cc index 52df4a17..9638885 100644 --- a/components/signin/core/browser/signin_header_helper_unittest.cc +++ b/components/signin/core/browser/signin_header_helper_unittest.cc
@@ -329,7 +329,7 @@ // Mirror is always enabled on Android and iOS, so these tests are only relevant // on Desktop. -#if BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) TEST_F(SigninHeaderHelperTest, TestMirrorRequestGaiaURL) { // No request when account consistency is disabled. @@ -636,7 +636,7 @@ } } -#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) && !BUILDFLAG(IS_CHROMEOS_LACROS) // Tests that the Mirror header request is returned normally when the redirect // URL is eligible.
diff --git a/components/signin/features.gni b/components/signin/features.gni index e253b1e4..5e0fe03 100644 --- a/components/signin/features.gni +++ b/components/signin/features.gni
@@ -5,7 +5,8 @@ import("//build/config/chromeos/ui_mode.gni") # Dice is supported on the platform (but not necessarily enabled). -enable_dice_support = is_linux || is_mac || is_win || is_fuchsia +enable_dice_support = + is_linux || is_chromeos_lacros || is_mac || is_win || is_fuchsia # Mirror is enabled and other account consistency mechanisms are not available. -enable_mirror = is_android || is_chromeos_ash || is_chromeos_lacros || is_ios +enable_mirror = is_android || is_chromeos_ash || is_ios
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_builder.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_builder.cc index 55a8894..c17cc2e 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_builder.cc +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_builder.cc
@@ -52,7 +52,7 @@ signin_client, std::move(device_accounts_provider), account_tracker_service); } -#elif BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_CHROMEOS_ASH) std::unique_ptr<ProfileOAuth2TokenServiceDelegate> CreateCrOsOAuthDelegate( AccountTrackerService* account_tracker_service, network::NetworkConnectionTracker* network_connection_tracker, @@ -64,6 +64,18 @@ } #elif BUILDFLAG(ENABLE_DICE_SUPPORT) +#if BUILDFLAG(IS_CHROMEOS_LACROS) +std::unique_ptr<ProfileOAuth2TokenServiceDelegate> CreateCrOsOAuthDelegate( + AccountTrackerService* account_tracker_service, + network::NetworkConnectionTracker* network_connection_tracker, + account_manager::AccountManagerFacade* account_manager_facade, + bool is_regular_profile) { + return std::make_unique<signin::ProfileOAuth2TokenServiceDelegateChromeOS>( + account_tracker_service, network_connection_tracker, + account_manager_facade, is_regular_profile); +} +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) + std::unique_ptr<MutableProfileOAuth2TokenServiceDelegate> CreateMutableProfileOAuthDelegate( AccountTrackerService* account_tracker_service, @@ -121,10 +133,25 @@ return CreateIOSOAuthDelegate(signin_client, std::move(device_accounts_provider), account_tracker_service); -#elif BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_CHROMEOS_ASH) return CreateCrOsOAuthDelegate(account_tracker_service, network_connection_tracker, account_manager_facade, is_regular_profile); +#elif BUILDFLAG(IS_CHROMEOS_LACROS) + // For the time being, Mirror is enabled only in the first / "Main" Profile in + // Lacros. + if (account_consistency == signin::AccountConsistencyMethod::kMirror) { + return CreateCrOsOAuthDelegate(account_tracker_service, + network_connection_tracker, + account_manager_facade, is_regular_profile); + } else { + // TODO(crbug.com/1198490): Remove this when we don't need DICE and + // `MutableProfileOAuth2TokenServiceDelegate` on Lacros anymore. + return CreateMutableProfileOAuthDelegate( + account_tracker_service, account_consistency, + delete_signin_cookies_on_exit, token_web_data, signin_client, + network_connection_tracker); + } #elif BUILDFLAG(ENABLE_DICE_SUPPORT) // Fall back to |MutableProfileOAuth2TokenServiceDelegate| on all platforms // other than Android, iOS, and Chrome OS (Ash and Lacros).
diff --git a/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc b/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc index 44388a4..637ed07 100644 --- a/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc +++ b/components/url_rewrite/browser/url_request_rewrite_rules_manager.cc
@@ -62,8 +62,8 @@ return true; } -scoped_refptr<UrlRequestRewriteRules>& -UrlRequestRewriteRulesManager::GetCachedRules() { +const scoped_refptr<UrlRequestRewriteRules>& +UrlRequestRewriteRulesManager::GetCachedRules() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return cached_rules_; } @@ -74,7 +74,7 @@ UrlRequestRewriteRulesManager::Updater::Updater( content::WebContents* web_contents, - scoped_refptr<UrlRequestRewriteRules>& cached_rules) + const scoped_refptr<UrlRequestRewriteRules>& cached_rules) : content::WebContentsObserver(web_contents), cached_rules_(cached_rules) {} UrlRequestRewriteRulesManager::Updater::~Updater() { @@ -82,7 +82,7 @@ } void UrlRequestRewriteRulesManager::Updater::OnRulesUpdated( - scoped_refptr<UrlRequestRewriteRules>& cached_rules) { + const scoped_refptr<UrlRequestRewriteRules>& cached_rules) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(cached_rules);
diff --git a/components/url_rewrite/browser/url_request_rewrite_rules_manager.h b/components/url_rewrite/browser/url_request_rewrite_rules_manager.h index 80e8fcc..9fb8ee0 100644 --- a/components/url_rewrite/browser/url_request_rewrite_rules_manager.h +++ b/components/url_rewrite/browser/url_request_rewrite_rules_manager.h
@@ -41,7 +41,7 @@ // rules have been successfully validated and updated, false otherwise. bool OnRulesUpdated(mojom::UrlRequestRewriteRulesPtr rules); - scoped_refptr<UrlRequestRewriteRules>& GetCachedRules(); + const scoped_refptr<UrlRequestRewriteRules>& GetCachedRules() const; // Used for testing. size_t GetUpdatersSizeForTesting() const; @@ -52,13 +52,14 @@ class Updater final : public content::WebContentsObserver { public: Updater(content::WebContents* web_contents, - scoped_refptr<UrlRequestRewriteRules>& cached_rules); + const scoped_refptr<UrlRequestRewriteRules>& cached_rules); Updater(const Updater&) = delete; Updater& operator=(const Updater&) = delete; ~Updater() override; // Notifies UrlRequestRulesReceivers that URL rewrite rules are updated. - void OnRulesUpdated(scoped_refptr<UrlRequestRewriteRules>& cached_rules); + void OnRulesUpdated( + const scoped_refptr<UrlRequestRewriteRules>& cached_rules); private: // content::WebContentsObserver implementation.
diff --git a/components/url_rewrite/renderer/url_request_rules_receiver.cc b/components/url_rewrite/renderer/url_request_rules_receiver.cc index 24ebf729..93b8b2f9 100644 --- a/components/url_rewrite/renderer/url_request_rules_receiver.cc +++ b/components/url_rewrite/renderer/url_request_rules_receiver.cc
@@ -27,8 +27,8 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -scoped_refptr<UrlRequestRewriteRules>& -UrlRequestRulesReceiver::GetCachedRules() { +const scoped_refptr<UrlRequestRewriteRules>& +UrlRequestRulesReceiver::GetCachedRules() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return cached_rules_; }
diff --git a/components/url_rewrite/renderer/url_request_rules_receiver.h b/components/url_rewrite/renderer/url_request_rules_receiver.h index bc2c4eb5..54296bc8 100644 --- a/components/url_rewrite/renderer/url_request_rules_receiver.h +++ b/components/url_rewrite/renderer/url_request_rules_receiver.h
@@ -27,7 +27,7 @@ UrlRequestRulesReceiver(const UrlRequestRulesReceiver&) = delete; UrlRequestRulesReceiver& operator=(const UrlRequestRulesReceiver&) = delete; - scoped_refptr<UrlRequestRewriteRules>& GetCachedRules(); + const scoped_refptr<UrlRequestRewriteRules>& GetCachedRules() const; private: void OnUrlRequestRulesReceiverAssociatedReceiver(
diff --git a/content/browser/accessibility/browser_accessibility_fuchsia.cc b/content/browser/accessibility/browser_accessibility_fuchsia.cc index 65df3dd..b4c4adb7 100644 --- a/content/browser/accessibility/browser_accessibility_fuchsia.cc +++ b/content/browser/accessibility/browser_accessibility_fuchsia.cc
@@ -18,9 +18,7 @@ BrowserAccessibilityFuchsia::BrowserAccessibilityFuchsia( BrowserAccessibilityManager* manager, ui::AXNode* node) - : BrowserAccessibility(manager, node) { - ax_node_id_ = GetId(); -} + : BrowserAccessibility(manager, node) {} ui::AccessibilityBridgeFuchsia* BrowserAccessibilityFuchsia::GetAccessibilityBridge() const { @@ -43,16 +41,23 @@ DeleteNode(); } +uint32_t BrowserAccessibilityFuchsia::GetFuchsiaNodeID() const { + return static_cast<uint32_t>(GetUniqueId()); +} + fuchsia::accessibility::semantics::Node BrowserAccessibilityFuchsia::ToFuchsiaNodeData() const { fuchsia::accessibility::semantics::Node fuchsia_node_data; + fuchsia_node_data.set_node_id(GetFuchsiaNodeID()); fuchsia_node_data.set_role(GetFuchsiaRole()); fuchsia_node_data.set_states(GetFuchsiaStates()); fuchsia_node_data.set_attributes(GetFuchsiaAttributes()); fuchsia_node_data.set_actions(GetFuchsiaActions()); fuchsia_node_data.set_location(GetFuchsiaLocation()); fuchsia_node_data.set_node_to_container_transform(GetFuchsiaTransform()); + fuchsia_node_data.set_container_id(GetOffsetContainerOrRootNodeID()); + fuchsia_node_data.set_child_ids(GetFuchsiaChildIDs()); return fuchsia_node_data; } @@ -60,6 +65,15 @@ void BrowserAccessibilityFuchsia::OnDataChanged() { BrowserAccessibility::OnDataChanged(); + // Declare this node as the fuchsia tree root if it's the root of the main + // frame's tree. + if (manager()->IsRootTree() && manager()->GetRoot() == this) { + ui::AccessibilityBridgeFuchsia* accessibility_bridge = + GetAccessibilityBridge(); + if (accessibility_bridge) + accessibility_bridge->SetRootID(GetUniqueId()); + } + UpdateNode(); } @@ -72,6 +86,16 @@ return static_cast<BrowserAccessibilityFuchsia*>(obj); } +std::vector<uint32_t> BrowserAccessibilityFuchsia::GetFuchsiaChildIDs() const { + std::vector<uint32_t> child_ids; + for (const BrowserAccessibility& child : PlatformChildren()) { + child_ids.push_back(static_cast<const BrowserAccessibilityFuchsia&>(child) + .GetFuchsiaNodeID()); + } + + return child_ids; +} + std::vector<fuchsia::accessibility::semantics::Action> BrowserAccessibilityFuchsia::GetFuchsiaActions() const { std::vector<fuchsia::accessibility::semantics::Action> actions; @@ -324,49 +348,32 @@ return fuchsia_transform.value; } -ui::AXNodeID BrowserAccessibilityFuchsia::GetOffsetContainerOrRootNodeID() - const { +uint32_t BrowserAccessibilityFuchsia::GetOffsetContainerOrRootNodeID() const { int offset_container_id = GetData().relative_bounds.offset_container_id; - if (offset_container_id != ui::kInvalidAXNodeID) - return offset_container_id; + BrowserAccessibility* offset_container = + offset_container_id == -1 ? manager()->GetRoot() + : manager()->GetFromID(offset_container_id); - ui::AXNode* root_node = manager()->GetRootAsAXNode(); - DCHECK(root_node); + BrowserAccessibilityFuchsia* fuchsia_container = + ToBrowserAccessibilityFuchsia(offset_container); + DCHECK(fuchsia_container); - return root_node->id(); + return fuchsia_container->GetFuchsiaNodeID(); } void BrowserAccessibilityFuchsia::UpdateNode() { if (!GetAccessibilityBridge()) return; - ui::AXTreeID ax_tree_id = manager()->ax_tree_id(); - - ui::AXNodeUpdateFuchsia update; - update.node_id = ui::AXNodeDescriptorFuchsia(ax_tree_id, GetId()); - update.node_data = ToFuchsiaNodeData(); - - for (const auto* child : node()->children()) { - DCHECK(child); - update.child_ids.emplace_back(ax_tree_id, child->id()); - } - - update.offset_container_id.emplace(ax_tree_id, - GetOffsetContainerOrRootNodeID()); - - BrowserAccessibility* root = manager()->GetRoot(); - update.is_root = manager()->IsRootTree() && root && root->GetId() == GetId(); - - GetAccessibilityBridge()->UpdateNode(std::move(update)); + GetAccessibilityBridge()->UpdateNode(ToFuchsiaNodeData()); } void BrowserAccessibilityFuchsia::DeleteNode() { if (!GetAccessibilityBridge()) return; - GetAccessibilityBridge()->DeleteNode( - ui::AXNodeDescriptorFuchsia(manager()->ax_tree_id(), ax_node_id_)); + GetAccessibilityBridge()->DeleteNode(GetFuchsiaNodeID()); } } // namespace content
diff --git a/content/browser/accessibility/browser_accessibility_fuchsia.h b/content/browser/accessibility/browser_accessibility_fuchsia.h index 6b4f664..beda348 100644 --- a/content/browser/accessibility/browser_accessibility_fuchsia.h +++ b/content/browser/accessibility/browser_accessibility_fuchsia.h
@@ -7,6 +7,8 @@ #include <fuchsia/accessibility/semantics/cpp/fidl.h> +#include <vector> + #include "content/browser/accessibility/browser_accessibility.h" #include "content/browser/accessibility/browser_accessibility_manager_fuchsia.h" #include "content/common/content_export.h" @@ -14,7 +16,6 @@ #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_relative_bounds.h" #include "ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h" -#include "ui/accessibility/platform/fuchsia/fuchsia_types.h" namespace content { @@ -34,20 +35,19 @@ // Returns the fuchsia representation of the AXNode to which this // BrowserAccessibility object refers. - // NOTE: BrowserAccessibilityFuchsia does not have access to the - // (AXTreeID, AXNodeID) <-> FuchsiaNodeID mapping, this method will NOT fill - // any of the ID fields in the fuchsia node (container_id, child_ids, - // node_id). fuchsia::accessibility::semantics::Node ToFuchsiaNodeData() const; - // Returns the AXNodeID of this node's offset container if the offset + // Returns the fuchsia ID of this node's offset container if the offset // container ID is valid. Otherwise, returns the ID of this tree's root node. - ui::AXNodeID GetOffsetContainerOrRootNodeID() const; + uint32_t GetOffsetContainerOrRootNodeID() const; // BrowserAccessibility overrides. void OnDataChanged() override; void OnLocationChanged() override; + // Returns this object's AXUniqueID as a uint32_t. + uint32_t GetFuchsiaNodeID() const; + protected: friend class BrowserAccessibility; // Needs access to our constructor. @@ -63,8 +63,7 @@ fuchsia::accessibility::semantics::Attributes GetFuchsiaAttributes() const; fuchsia::ui::gfx::BoundingBox GetFuchsiaLocation() const; fuchsia::ui::gfx::mat4 GetFuchsiaTransform() const; - - ui::AXNodeID ax_node_id_ = ui::kInvalidAXNodeID; + std::vector<uint32_t> GetFuchsiaChildIDs() const; }; BrowserAccessibilityFuchsia* CONTENT_EXPORT
diff --git a/content/browser/accessibility/browser_accessibility_fuchsia_unittest.cc b/content/browser/accessibility/browser_accessibility_fuchsia_unittest.cc index a0c36a46..7031fb1 100644 --- a/content/browser/accessibility/browser_accessibility_fuchsia_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_fuchsia_unittest.cc
@@ -514,4 +514,96 @@ EXPECT_EQ(location.max.y, y_max); } +TEST_F(BrowserAccessibilityFuchsiaTest, + ToFuchsiaNodeDataTranslatesOffsetContainerID) { + ui::AXNodeData node; + node.id = kRootId; + node.child_ids = {2}; + ui::AXNodeData node_2; + node_2.id = 2; + node_2.child_ids = {3}; + node_2.relative_bounds.offset_container_id = -1; + ui::AXNodeData node_3; + node_3.id = 3; + node_3.relative_bounds.offset_container_id = 2; + std::unique_ptr<BrowserAccessibilityManager> manager( + BrowserAccessibilityManager::Create( + MakeAXTreeUpdate(node, node_2, node_3), + test_browser_accessibility_delegate_.get())); + + // Verify that node 2's offset container was translated correctly. + BrowserAccessibilityFuchsia* root = + ToBrowserAccessibilityFuchsia(manager->GetFromID(kRootId)); + BrowserAccessibilityFuchsia* child = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + ASSERT_TRUE(child); + auto child_node_data = child->ToFuchsiaNodeData(); + ASSERT_TRUE(child_node_data.has_container_id()); + EXPECT_EQ(child_node_data.container_id(), root->GetFuchsiaNodeID()); + + // Verify that node 3's offset container was translated correctly. + BrowserAccessibilityFuchsia* grandchild = + ToBrowserAccessibilityFuchsia(manager->GetFromID(3)); + ASSERT_TRUE(grandchild); + auto grandchild_node_data = grandchild->ToFuchsiaNodeData(); + ASSERT_TRUE(grandchild_node_data.has_container_id()); + EXPECT_EQ(grandchild_node_data.container_id(), child->GetFuchsiaNodeID()); +} + +TEST_F(BrowserAccessibilityFuchsiaTest, + ToFuchsiaNodeDataTranslatesNodeIDAndChildIDs) { + ui::AXNodeData node; + node.id = kRootId; + node.child_ids = {2, 3}; + ui::AXNodeData node_2; + node_2.id = 2; + ui::AXNodeData node_3; + node_3.id = 3; + std::unique_ptr<BrowserAccessibilityManager> manager( + BrowserAccessibilityManager::Create( + MakeAXTreeUpdate(node, node_2, node_3), + test_browser_accessibility_delegate_.get())); + + BrowserAccessibilityFuchsia* browser_accessibility_fuchsia = + ToBrowserAccessibilityFuchsia(manager->GetRoot()); + + ASSERT_TRUE(browser_accessibility_fuchsia); + auto fuchsia_node_data = browser_accessibility_fuchsia->ToFuchsiaNodeData(); + + BrowserAccessibilityFuchsia* root = + ToBrowserAccessibilityFuchsia(manager->GetFromID(kRootId)); + BrowserAccessibilityFuchsia* child_1 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + BrowserAccessibilityFuchsia* child_2 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(3)); + + ASSERT_TRUE(child_1); + ASSERT_TRUE(child_2); + EXPECT_EQ(fuchsia_node_data.node_id(), root->GetFuchsiaNodeID()); + ASSERT_EQ(fuchsia_node_data.child_ids().size(), 2u); + EXPECT_EQ(fuchsia_node_data.child_ids()[0], child_1->GetFuchsiaNodeID()); + EXPECT_EQ(fuchsia_node_data.child_ids()[1], child_2->GetFuchsiaNodeID()); +} + +TEST_F(BrowserAccessibilityFuchsiaTest, GetFuchsiaNodeIDNonRootTree) { + // We want to verify that the root of a non-root tree will NOT be assigned ID + // = 0, so Specify that this tree is not the root. + test_browser_accessibility_delegate_->is_root_frame_ = false; + + ui::AXNodeData node; + node.id = kRootId; + + std::unique_ptr<BrowserAccessibilityManager> manager( + BrowserAccessibilityManager::Create( + MakeAXTreeUpdate(node), test_browser_accessibility_delegate_.get())); + + BrowserAccessibilityFuchsia* browser_accessibility_fuchsia = + ToBrowserAccessibilityFuchsia(manager->GetRoot()); + + ASSERT_TRUE(browser_accessibility_fuchsia); + auto fuchsia_node_data = browser_accessibility_fuchsia->ToFuchsiaNodeData(); + + EXPECT_GT(fuchsia_node_data.node_id(), 0u); +} + } // namespace content
diff --git a/content/browser/accessibility/browser_accessibility_manager_fuchsia.cc b/content/browser/accessibility/browser_accessibility_manager_fuchsia.cc index 6d8b29af..d1d370b 100644 --- a/content/browser/accessibility/browser_accessibility_manager_fuchsia.cc +++ b/content/browser/accessibility/browser_accessibility_manager_fuchsia.cc
@@ -6,7 +6,6 @@ #include "content/browser/accessibility/browser_accessibility_fuchsia.h" #include "ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia_registry.h" -#include "ui/accessibility/platform/fuchsia/fuchsia_types.h" namespace content { @@ -55,14 +54,14 @@ BrowserAccessibilityFuchsia* old_focus_fuchsia = ToBrowserAccessibilityFuchsia(GetLastFocusedNode()); + if (old_focus_fuchsia) { GetAccessibilityBridge()->UnfocusNode( - ui::AXNodeDescriptorFuchsia(ax_tree_id(), old_focus_fuchsia->GetId())); + old_focus_fuchsia->GetFuchsiaNodeID()); } if (new_focus_fuchsia) { - GetAccessibilityBridge()->FocusNode( - ui::AXNodeDescriptorFuchsia(ax_tree_id(), new_focus_fuchsia->GetId())); + GetAccessibilityBridge()->FocusNode(new_focus_fuchsia->GetFuchsiaNodeID()); } }
diff --git a/content/browser/accessibility/browser_accessibility_manager_fuchsia_unittest.cc b/content/browser/accessibility/browser_accessibility_manager_fuchsia_unittest.cc index 98c9850..3f0f435 100644 --- a/content/browser/accessibility/browser_accessibility_manager_fuchsia_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_manager_fuchsia_unittest.cc
@@ -8,6 +8,7 @@ #include <vector> #include "content/browser/accessibility/browser_accessibility.h" +#include "content/browser/accessibility/browser_accessibility_fuchsia.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/test_browser_accessibility_delegate.h" #include "content/common/render_accessibility.mojom.h" @@ -25,45 +26,42 @@ ~MockAccessibilityBridge() override = default; // ui::AccessibilityBridgeFuchsia overrides. - void UpdateNode(ui::AXNodeUpdateFuchsia node_update) override { - node_updates_.push_back(std::move(node_update)); + void UpdateNode(fuchsia::accessibility::semantics::Node node) override { + node_updates_.push_back(std::move(node)); } - void DeleteNode(ui::AXNodeDescriptorFuchsia node_id) override { + void DeleteNode(uint32_t node_id) override { node_deletions_.push_back(node_id); } - void FocusNode(ui::AXNodeDescriptorFuchsia new_focus) override { + void FocusNode(uint32_t new_focus) override { new_focus_.emplace(std::move(new_focus)); } - void UnfocusNode(ui::AXNodeDescriptorFuchsia old_focus) override { + void UnfocusNode(uint32_t old_focus) override { old_focus_.emplace(std::move(old_focus)); } - void OnAccessibilityHitTestResult( - int hit_test_request_id, - ui::AXNodeDescriptorFuchsia result) override { + void OnAccessibilityHitTestResult(int hit_test_request_id, + uint32_t result) override { hit_test_results_[hit_test_request_id] = result; } - const std::vector<ui::AXNodeUpdateFuchsia>& node_updates() { + void SetRootID(uint32_t root_node_id) override { + root_node_id_ = root_node_id; + } + + const std::vector<fuchsia::accessibility::semantics::Node>& node_updates() { return node_updates_; } - const std::vector<ui::AXNodeDescriptorFuchsia>& node_deletions() { - return node_deletions_; - } - const std::map<int, ui::AXNodeDescriptorFuchsia> hit_test_results() { - return hit_test_results_; - } + const std::vector<uint32_t>& node_deletions() { return node_deletions_; } + const std::map<int, uint32_t> hit_test_results() { return hit_test_results_; } - const absl::optional<ui::AXNodeDescriptorFuchsia>& old_focus() { - return old_focus_; - } + const absl::optional<uint32_t>& old_focus() { return old_focus_; } - const absl::optional<ui::AXNodeDescriptorFuchsia>& new_focus() { - return new_focus_; - } + const absl::optional<uint32_t>& new_focus() { return new_focus_; } + + const absl::optional<uint32_t>& root_node_id() { return root_node_id_; } void reset() { node_updates_.clear(); @@ -72,13 +70,13 @@ } private: - std::vector<ui::AXNodeUpdateFuchsia> node_updates_; - std::vector<ui::AXNodeDescriptorFuchsia> node_deletions_; - std::map<int /* hit test request id */, - ui::AXNodeDescriptorFuchsia /* hit test result */> + std::vector<fuchsia::accessibility::semantics::Node> node_updates_; + std::vector<uint32_t> node_deletions_; + std::map<int /* hit test request id */, uint32_t /* hit test result */> hit_test_results_; - absl::optional<ui::AXNodeDescriptorFuchsia> old_focus_; - absl::optional<ui::AXNodeDescriptorFuchsia> new_focus_; + absl::optional<uint32_t> old_focus_; + absl::optional<uint32_t> new_focus_; + absl::optional<uint32_t> root_node_id_; }; class BrowserAccessibilityManagerFuchsiaTest : public testing::Test { @@ -120,7 +118,18 @@ { const auto& node_updates = mock_accessibility_bridge_->node_updates(); ASSERT_EQ(node_updates.size(), 1u); - EXPECT_EQ(node_updates[0].node_id.node_id, 1); + + BrowserAccessibilityFuchsia* node_1 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(1)); + ASSERT_TRUE(node_1); + + EXPECT_EQ(node_updates[0].node_id(), node_1->GetFuchsiaNodeID()); + + // Verify that the the accessibility bridge root ID was set to node 1's + // unique ID. + ASSERT_TRUE(mock_accessibility_bridge_->root_node_id().has_value()); + EXPECT_EQ(*mock_accessibility_bridge_->root_node_id(), + static_cast<uint32_t>(node_1->GetFuchsiaNodeID())); const auto& node_deletions = mock_accessibility_bridge_->node_deletions(); EXPECT_TRUE(node_deletions.empty()); @@ -140,8 +149,21 @@ { const auto& node_updates = mock_accessibility_bridge_->node_updates(); ASSERT_EQ(node_updates.size(), 3u); - EXPECT_EQ(node_updates[1].node_id.node_id, 1); - EXPECT_EQ(node_updates[2].node_id.node_id, 2); + + BrowserAccessibilityFuchsia* node_1 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(1)); + ASSERT_TRUE(node_1); + BrowserAccessibilityFuchsia* node_2 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + ASSERT_TRUE(node_2); + + // Node 1 is the root of the root tree, so its fuchsia ID should be 0. + EXPECT_EQ(node_updates[1].node_id(), node_1->GetFuchsiaNodeID()); + ASSERT_EQ(node_updates[1].child_ids().size(), 1u); + EXPECT_EQ(node_updates[1].child_ids()[0], node_2->GetFuchsiaNodeID()); + + // Node 2 is NOT the root, so its fuchsia ID should be its AXUniqueID. + EXPECT_EQ(node_updates[2].node_id(), node_2->GetFuchsiaNodeID()); } } @@ -171,6 +193,16 @@ EXPECT_TRUE(node_deletions.empty()); } + // Get the fuchsia IDs for nodes 1 and 2 before they are deleted. + BrowserAccessibilityFuchsia* node_1 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(1)); + ASSERT_TRUE(node_1); + uint32_t node_1_fuchsia_id = node_1->GetFuchsiaNodeID(); + BrowserAccessibilityFuchsia* node_2 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + ASSERT_TRUE(node_2); + uint32_t node_2_fuchsia_id = node_2->GetFuchsiaNodeID(); + // Delete node 2. ui::AXTreeUpdate updated_state; updated_state.nodes.resize(1); @@ -178,11 +210,11 @@ manager->ax_tree()->Unserialize(updated_state); - // Verify that the accessibility bridge received deletions for both nodes. + // Verify that the accessibility bridge received a deletion for node 2. { const auto& node_deletions = mock_accessibility_bridge_->node_deletions(); ASSERT_EQ(node_deletions.size(), 1u); - EXPECT_EQ(node_deletions[0].node_id, 2); + EXPECT_EQ(node_deletions[0], static_cast<uint32_t>(node_2_fuchsia_id)); } // Destroy manager. Doing so should force the remainder of the tree to be @@ -193,8 +225,7 @@ { const auto& node_deletions = mock_accessibility_bridge_->node_deletions(); ASSERT_EQ(node_deletions.size(), 2u); - EXPECT_EQ(node_deletions[0].node_id, 2); - EXPECT_EQ(node_deletions[1].node_id, 1); + EXPECT_EQ(node_deletions[1], node_1_fuchsia_id); } } @@ -219,7 +250,8 @@ ASSERT_TRUE(manager); { - const auto& node_updates = mock_accessibility_bridge_->node_updates(); + const std::vector<fuchsia::accessibility::semantics::Node>& node_updates = + mock_accessibility_bridge_->node_updates(); ASSERT_EQ(node_updates.size(), 2u); } @@ -232,11 +264,19 @@ manager->OnLocationChanges(std::move(changes)); { - const auto& node_updates = mock_accessibility_bridge_->node_updates(); + BrowserAccessibilityFuchsia* node_2 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + ASSERT_TRUE(node_2); + + const std::vector<fuchsia::accessibility::semantics::Node>& node_updates = + mock_accessibility_bridge_->node_updates(); ASSERT_EQ(node_updates.size(), 3u); - EXPECT_EQ(node_updates.back().node_id.node_id, 2); - ASSERT_TRUE(node_updates.back().node_data.has_location()); - const auto& location = node_updates.back().node_data.location(); + const fuchsia::accessibility::semantics::Node& node_update = + node_updates.back(); + EXPECT_EQ(node_update.node_id(), + static_cast<uint32_t>(node_2->GetFuchsiaNodeID())); + ASSERT_TRUE(node_update.has_location()); + const fuchsia::ui::gfx::BoundingBox& location = node_update.location(); EXPECT_EQ(location.min.x, 1); EXPECT_EQ(location.min.y, 2); EXPECT_EQ(location.max.x, 4); @@ -270,6 +310,14 @@ initial_state, test_browser_accessibility_delegate_.get())); ASSERT_TRUE(manager); + BrowserAccessibilityFuchsia* node_1 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(1)); + ASSERT_TRUE(node_1); + + BrowserAccessibilityFuchsia* node_2 = + ToBrowserAccessibilityFuchsia(manager->GetFromID(2)); + ASSERT_TRUE(node_2); + // Set focus to node 1, and check that the focus was updated from null to // node 1. { @@ -286,7 +334,8 @@ ASSERT_FALSE(mock_accessibility_bridge_->old_focus()); ASSERT_TRUE(mock_accessibility_bridge_->new_focus()); - EXPECT_EQ(mock_accessibility_bridge_->new_focus()->node_id, 1); + EXPECT_EQ(*mock_accessibility_bridge_->new_focus(), + node_1->GetFuchsiaNodeID()); // Set focus to node 2, and check that focus was updated from node 1 to node // 2. @@ -303,9 +352,11 @@ } ASSERT_TRUE(mock_accessibility_bridge_->old_focus()); - EXPECT_EQ(mock_accessibility_bridge_->old_focus()->node_id, 1); + EXPECT_EQ(*mock_accessibility_bridge_->old_focus(), + node_1->GetFuchsiaNodeID()); ASSERT_TRUE(mock_accessibility_bridge_->new_focus()); - EXPECT_EQ(mock_accessibility_bridge_->new_focus()->node_id, 2); + EXPECT_EQ(*mock_accessibility_bridge_->new_focus(), + node_2->GetFuchsiaNodeID()); } } // namespace
diff --git a/content/browser/back_forward_cache_features_browsertest.cc b/content/browser/back_forward_cache_features_browsertest.cc index 7e668e4f..b90e524 100644 --- a/content/browser/back_forward_cache_features_browsertest.cc +++ b/content/browser/back_forward_cache_features_browsertest.cc
@@ -442,9 +442,10 @@ // Tests the case when the page starts fetching in a dedicated worker, goes to // BFcache, and then the response amount reaches the threshold. The cached page // should evicted in this case. +// TODO(crbug.com/1275106): Test flaky. IN_PROC_BROWSER_TEST_F( BackForwardCacheWithDedicatedWorkerBrowserTest, - FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit) { + DISABLED_FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit) { CreateHttpsServer(); net::test_server::ControllableHttpResponse image_response(https_server(), @@ -499,9 +500,10 @@ // Tests the case when the page starts fetching in a nested dedicated worker, // goes to BFcache, and then the response amount reaches the threshold. The // cached page should evicted in this case. +// TODO(crbug.com/1275106): Test flaky. IN_PROC_BROWSER_TEST_F( BackForwardCacheWithDedicatedWorkerBrowserTest, - FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit_Nested) { + DISABLED_FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit_Nested) { CreateHttpsServer(); net::test_server::ControllableHttpResponse image_response(https_server(),
diff --git a/content/browser/renderer_host/render_frame_host_delegate.cc b/content/browser/renderer_host/render_frame_host_delegate.cc index 1f89dfec..387b326e 100644 --- a/content/browser/renderer_host/render_frame_host_delegate.cc +++ b/content/browser/renderer_host/render_frame_host_delegate.cc
@@ -77,9 +77,7 @@ mojo::PendingReceiver<device::mojom::NFC> receiver) {} #endif -bool RenderFrameHostDelegate::CanEnterFullscreenMode( - RenderFrameHostImpl* requesting_frame, - const blink::mojom::FullscreenOptions& options) { +bool RenderFrameHostDelegate::CanEnterFullscreenMode() { return true; }
diff --git a/content/browser/renderer_host/render_frame_host_delegate.h b/content/browser/renderer_host/render_frame_host_delegate.h index 760a2dd..e4e0ed5 100644 --- a/content/browser/renderer_host/render_frame_host_delegate.h +++ b/content/browser/renderer_host/render_frame_host_delegate.h
@@ -300,9 +300,7 @@ #endif // Returns whether entering fullscreen with EnterFullscreenMode() is allowed. - virtual bool CanEnterFullscreenMode( - RenderFrameHostImpl* requesting_frame, - const blink::mojom::FullscreenOptions& options); + virtual bool CanEnterFullscreenMode(); // Notification that the frame with the given host wants to enter fullscreen // mode. Must only be called if CanEnterFullscreenMode returns true.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 3779804..ce6cba4b 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -5960,7 +5960,7 @@ // Frames (possibly a subframe) that are not active nor belonging to a primary // page should not enter fullscreen. if (!IsActive() || !GetPage().IsPrimary() || - !delegate_->CanEnterFullscreenMode(this, *options)) { + !delegate_->CanEnterFullscreenMode()) { std::move(callback).Run(/*granted=*/false); return; }
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index 4a709bb92..d60a24e 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -866,6 +866,12 @@ FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root(); InstallBeforeUnloadHandler(root->child_at(0), SHOW_DIALOG); + // This test assumes a beforeunload handler is present on the main frame. + static_cast<RenderFrameHostImpl*>(web_contents()->GetMainFrame()) + ->SuddenTerminationDisablerChanged( + true, + blink::mojom::SuddenTerminationDisablerType::kBeforeUnloadHandler); + // Disable beforeunload timer to prevent flakiness. PrepContentsForBeforeUnloadTest(web_contents());
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index e05b0e4..eba55f4 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3321,26 +3321,22 @@ ->GetRenderWidgetHost(); } -bool WebContentsImpl::CanEnterFullscreenMode( - RenderFrameHostImpl* requesting_frame, - const blink::mojom::FullscreenOptions& options) { +bool WebContentsImpl::CanEnterFullscreenMode() { // It's possible that this WebContents was spawned while blocking UI was on // the screen, or that it was downstream from a WebContents when UI was // blocked. Therefore, disqualify it from fullscreen if it or any upstream // WebContents has an active blocker. auto openers = GetAllOpeningWebContents(this); - return std::all_of(openers.begin(), openers.end(), - [](auto* opener) { - return opener->fullscreen_blocker_count_ == 0; - }) && - delegate_->CanEnterFullscreenModeForTab(requesting_frame, options); + return std::all_of(openers.begin(), openers.end(), [](auto* opener) { + return opener->fullscreen_blocker_count_ == 0; + }); } void WebContentsImpl::EnterFullscreenMode( RenderFrameHostImpl* requesting_frame, const blink::mojom::FullscreenOptions& options) { OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); - DCHECK(CanEnterFullscreenMode(requesting_frame, options)); + DCHECK(CanEnterFullscreenMode()); DCHECK(requesting_frame->IsActive()); if (delegate_) {
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 122415e..246d89e7 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -648,9 +648,7 @@ void GetNFC(RenderFrameHost*, mojo::PendingReceiver<device::mojom::NFC>) override; #endif - bool CanEnterFullscreenMode( - RenderFrameHostImpl* requesting_frame, - const blink::mojom::FullscreenOptions& options) override; + bool CanEnterFullscreenMode() override; void EnterFullscreenMode( RenderFrameHostImpl* requesting_frame, const blink::mojom::FullscreenOptions& options) override;
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc index 2c87b89..894000be9 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc
@@ -158,12 +158,6 @@ return false; } -bool WebContentsDelegate::CanEnterFullscreenModeForTab( - RenderFrameHost* requesting_frame, - const blink::mojom::FullscreenOptions& options) { - return true; -} - blink::mojom::DisplayMode WebContentsDelegate::GetDisplayMode( const WebContents* web_contents) { return blink::mojom::DisplayMode::kBrowser;
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index f04506b..177bc12 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h
@@ -443,15 +443,8 @@ base::OnceCallback<void()> on_confirm, base::OnceCallback<void()> on_cancel); - // Returns whether entering fullscreen with |EnterFullscreenModeForTab()| is - // allowed. - virtual bool CanEnterFullscreenModeForTab( - RenderFrameHost* requesting_frame, - const blink::mojom::FullscreenOptions& options); - // Called when the renderer puts a tab into fullscreen mode. // |requesting_frame| is the specific content frame requesting fullscreen. - // |CanEnterFullscreenModeForTab()| must return true on entry. virtual void EnterFullscreenModeForTab( RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) {}
diff --git a/content/public/test/fake_download_item.cc b/content/public/test/fake_download_item.cc index fa5d9196..5648d1ca 100644 --- a/content/public/test/fake_download_item.cc +++ b/content/public/test/fake_download_item.cc
@@ -265,6 +265,15 @@ is_mixed_content_ = is_mixed_content; } +void FakeDownloadItem::SetDangerType(download::DownloadDangerType danger_type) { + danger_type_ = danger_type; +} + +void FakeDownloadItem::SetMixedContentStatus( + download::DownloadItem::MixedContentStatus mixed_content_status) { + mixed_content_status_ = mixed_content_status; +} + bool FakeDownloadItem::GetOpenWhenComplete() const { return open_when_complete_; } @@ -483,14 +492,12 @@ } download::DownloadDangerType FakeDownloadItem::GetDangerType() const { - NOTREACHED(); - return download::DownloadDangerType(); + return danger_type_; } download::DownloadItem::MixedContentStatus FakeDownloadItem::GetMixedContentStatus() const { - NOTREACHED(); - return download::DownloadItem::MixedContentStatus(); + return mixed_content_status_; } bool FakeDownloadItem::TimeRemaining(base::TimeDelta* remaining) const {
diff --git a/content/public/test/fake_download_item.h b/content/public/test/fake_download_item.h index 4d96a06..6d0990b 100644 --- a/content/public/test/fake_download_item.h +++ b/content/public/test/fake_download_item.h
@@ -172,6 +172,9 @@ void SetDummyFilePath(const base::FilePath& dummy_file_path); void SetIsDangerous(bool is_dangerous); void SetIsMixedContent(bool is_mixed_content); + void SetDangerType(download::DownloadDangerType danger_type); + void SetMixedContentStatus( + download::DownloadItem::MixedContentStatus mixed_content_status); private: base::ObserverList<Observer>::Unchecked observers_; @@ -209,6 +212,10 @@ bool is_dangerous_ = false; bool is_mixed_content_ = false; absl::optional<net::IsolationInfo> isolation_info_; + download::DownloadDangerType danger_type_ = + download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS; + download::DownloadItem::MixedContentStatus mixed_content_status_ = + download::DownloadItem::MixedContentStatus::UNKNOWN; // The members below are to be returned by methods, which return by reference. GURL dummy_url;
diff --git a/docs/fuchsia/platform_versioning.md b/docs/fuchsia/platform_versioning.md new file mode 100644 index 0000000..bfb85916 --- /dev/null +++ b/docs/fuchsia/platform_versioning.md
@@ -0,0 +1,19 @@ +# Fuchsia platform versioning + +When building for Fuchsia, the binaries are built against a target API level, +which is set via `fuchsia_target_api_level` in the [`.gn` file](../../.gn). This +information becomes embedded in the compiled component as a target ABI +revision, which indicates the semantics the component expects from the +platform. + +Updates to the `fuchsia_target_api_level` are currently done manually. As a +general rule, we want to be using the latest API level supported by the Fuchsia +SDK checked out. An older API level might be needed if one of the following are +true: + +1. There are unresolved compatibility issues. +2. The binaries are intended to ship on an older release of Fuchsia. + +For instance, if M97 is shipped on a Fuchsia release that only supports API +level up to 5, the target API level cannot be updated in Chromium until M97 +branch is cut.
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index 6d795b4..9476a69 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -58,6 +58,8 @@ "api/api_resource.cc", "api/api_resource.h", "api/api_resource_manager.h", + "api/content_settings/content_settings_helpers.cc", + "api/content_settings/content_settings_helpers.h", "api/declarative/declarative_api.cc", "api/declarative/declarative_api.h", "api/declarative/declarative_rule.h", @@ -530,6 +532,8 @@ "//build:chromeos_buildflags", "//components/back_forward_cache", "//components/cast_certificate", + "//components/content_settings/core/browser", + "//components/content_settings/core/common", "//components/crx_file", "//components/crx_file:crx_creator", "//components/guest_view/browser", @@ -789,6 +793,7 @@ "api/api_resource_manager_unittest.cc", "api/bluetooth/bluetooth_event_router_unittest.cc", "api/bluetooth_socket/bluetooth_socket_api_unittest.cc", + "api/content_settings/content_settings_unittest.cc", "api/declarative/declarative_rule_unittest.cc", "api/declarative/deduping_factory_unittest.cc", "api/declarative/rules_registry_unittest.cc",
diff --git a/extensions/browser/api/DEPS b/extensions/browser/api/DEPS index 34fc6171..3a353ca4 100644 --- a/extensions/browser/api/DEPS +++ b/extensions/browser/api/DEPS
@@ -1,5 +1,7 @@ include_rules = [ "+ash/components/audio", + "+components/content_settings/core/browser", + "+components/content_settings/core/common", "+components/device_event_log", "+components/ukm", "+services/device/public",
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/extensions/browser/api/content_settings/content_settings_helpers.cc similarity index 97% rename from chrome/browser/extensions/api/content_settings/content_settings_helpers.cc rename to extensions/browser/api/content_settings/content_settings_helpers.cc index 9ac988d..1b76e6c2 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc +++ b/extensions/browser/api/content_settings/content_settings_helpers.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h" +#include "extensions/browser/api/content_settings/content_settings_helpers.h" #include <memory>
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.h b/extensions/browser/api/content_settings/content_settings_helpers.h similarity index 83% rename from chrome/browser/extensions/api/content_settings/content_settings_helpers.h rename to extensions/browser/api/content_settings/content_settings_helpers.h index 06be49c2..45f13a4 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.h +++ b/extensions/browser/api/content_settings/content_settings_helpers.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H__ -#define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H__ +#ifndef EXTENSIONS_BROWSER_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H_ +#define EXTENSIONS_BROWSER_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H_ #include <string> @@ -33,4 +33,4 @@ } // namespace content_settings_helpers } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H__ +#endif // EXTENSIONS_BROWSER_API_CONTENT_SETTINGS_CONTENT_SETTINGS_HELPERS_H_
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_unittest.cc b/extensions/browser/api/content_settings/content_settings_unittest.cc similarity index 95% rename from chrome/browser/extensions/api/content_settings/content_settings_unittest.cc rename to extensions/browser/api/content_settings/content_settings_unittest.cc index 6a12903..b8bdd58 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_unittest.cc +++ b/extensions/browser/api/content_settings/content_settings_unittest.cc
@@ -5,7 +5,7 @@ #include <stddef.h> #include "base/cxx17_backports.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h" +#include "extensions/browser/api/content_settings/content_settings_helpers.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions {
diff --git a/extensions/browser/extensions_browser_client.cc b/extensions/browser/extensions_browser_client.cc index 5dab2d8..34ff7ea 100644 --- a/extensions/browser/extensions_browser_client.cc +++ b/extensions/browser/extensions_browser_client.cc
@@ -45,13 +45,6 @@ return scoped_refptr<update_client::UpdateClient>(nullptr); } -std::unique_ptr<content::BluetoothChooser> -ExtensionsBrowserClient::CreateBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler) { - return nullptr; -} - void ExtensionsBrowserClient::ReportError( content::BrowserContext* context, std::unique_ptr<ExtensionError> error) {
diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h index 40566a88b..564a62eb 100644 --- a/extensions/browser/extensions_browser_client.h +++ b/extensions/browser/extensions_browser_client.h
@@ -303,10 +303,6 @@ virtual scoped_refptr<update_client::UpdateClient> CreateUpdateClient( content::BrowserContext* context); - virtual std::unique_ptr<content::BluetoothChooser> CreateBluetoothChooser( - content::RenderFrameHost* frame, - const content::BluetoothChooser::EventHandler& event_handler); - // Returns true if activity logging is enabled for the given |context|. virtual bool IsActivityLoggingEnabled(content::BrowserContext* context);
diff --git a/fuchsia/engine/browser/web_engine_content_browser_client.cc b/fuchsia/engine/browser/web_engine_content_browser_client.cc index 97d9a1c..91feb4b 100644 --- a/fuchsia/engine/browser/web_engine_content_browser_client.cc +++ b/fuchsia/engine/browser/web_engine_content_browser_client.cc
@@ -271,7 +271,7 @@ std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles; auto* frame_impl = FrameImpl::FromWebContents(wc_getter.Run()); DCHECK(frame_impl); - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& rules = + const auto& rules = frame_impl->url_request_rewrite_rules_manager()->GetCachedRules(); if (rules) { throttles.emplace_back(std::make_unique<url_rewrite::URLLoaderThrottle>(
diff --git a/fuchsia/engine/renderer/web_engine_url_loader_throttle_provider.cc b/fuchsia/engine/renderer/web_engine_url_loader_throttle_provider.cc index 32508db4..dc0108ac 100644 --- a/fuchsia/engine/renderer/web_engine_url_loader_throttle_provider.cc +++ b/fuchsia/engine/renderer/web_engine_url_loader_throttle_provider.cc
@@ -35,7 +35,7 @@ DCHECK_NE(render_frame_id, MSG_ROUTING_NONE); blink::WebVector<std::unique_ptr<blink::URLLoaderThrottle>> throttles; - scoped_refptr<url_rewrite::UrlRequestRewriteRules>& rules = + const auto& rules = content_renderer_client_ ->GetWebEngineRenderFrameObserverForRenderFrameId(render_frame_id) ->url_request_rules_receiver()
diff --git a/ios/chrome/browser/ios_chrome_main_parts.mm b/ios/chrome/browser/ios_chrome_main_parts.mm index 497b41f..72bae1e 100644 --- a/ios/chrome/browser/ios_chrome_main_parts.mm +++ b/ios/chrome/browser/ios_chrome_main_parts.mm
@@ -146,8 +146,9 @@ void IOSChromeMainParts::PreCreateThreads() { // Create and start the stack sampling profiler if CANARY or DEV. The warning // below doesn't apply. - if (::GetChannel() == version_info::Channel::CANARY || - ::GetChannel() == version_info::Channel::DEV) { + const version_info::Channel channel = ::GetChannel(); + if (channel == version_info::Channel::CANARY || + channel == version_info::Channel::DEV) { sampling_profiler_ = IOSThreadProfiler::CreateAndStartOnMainThread(); IOSThreadProfiler::SetMainThreadTaskRunner( base::ThreadTaskRunnerHandle::Get()); @@ -223,7 +224,8 @@ if (malloc_intercepted) { // Start heap profiling as early as possible so it can start recording // memory allocations. Requires the allocator shim to be enabled. - heap_profiler_controller_ = std::make_unique<HeapProfilerController>(); + heap_profiler_controller_ = + std::make_unique<HeapProfilerController>(channel); heap_profiler_controller_->Start(); } }
diff --git a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java index 2f62fb7a..56f64b4 100644 --- a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java +++ b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
@@ -68,7 +68,7 @@ } // Native callback context variable. - private final long mNativeScreenCaptureMachineAndroid; + private long mNativeScreenCaptureMachineAndroid; private final Object mCaptureStateLock = new Object(); private @CaptureState int mCaptureState = CaptureState.STOPPED; @@ -282,9 +282,17 @@ return true; } + @CalledByNative + private void onNativeDestroyed() { + // Native must have called stopCapture prior to it's destruction if it started capture. + assert (mCaptureState != CaptureState.STARTED); + mNativeScreenCaptureMachineAndroid = 0; + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode != REQUEST_MEDIA_PROJECTION) return; + if (mNativeScreenCaptureMachineAndroid == 0) return; if (resultCode == Activity.RESULT_OK) { mResultCode = resultCode;
diff --git a/media/capture/content/android/screen_capture_machine_android.cc b/media/capture/content/android/screen_capture_machine_android.cc index 9d6a08c6..d8d417f 100644 --- a/media/capture/content/android/screen_capture_machine_android.cc +++ b/media/capture/content/android/screen_capture_machine_android.cc
@@ -21,9 +21,13 @@ namespace media { -ScreenCaptureMachineAndroid::ScreenCaptureMachineAndroid() {} +ScreenCaptureMachineAndroid::ScreenCaptureMachineAndroid() = default; -ScreenCaptureMachineAndroid::~ScreenCaptureMachineAndroid() {} +ScreenCaptureMachineAndroid::~ScreenCaptureMachineAndroid() { + if (j_capture_.obj() != nullptr) { + Java_ScreenCapture_onNativeDestroyed(AttachCurrentThread(), j_capture_); + } +} // static ScopedJavaLocalRef<jobject>
diff --git a/media/formats/BUILD.gn b/media/formats/BUILD.gn index 57339c27..7b2bb26 100644 --- a/media/formats/BUILD.gn +++ b/media/formats/BUILD.gn
@@ -171,11 +171,14 @@ # TODO(https://crbug.com/1266991): These should be gated behind `enable_hls_demuxer`, once that's enabled by default. sources += [ + "hls/items.cc", + "hls/items.h", "hls/parse_status.h", "hls/types.cc", "hls/types.h", ] deps += [ "//third_party/re2" ] + public_deps = [ "//third_party/abseil-cpp:absl" ] } static_library("test_support") { @@ -274,7 +277,19 @@ } # TODO(https://crbug.com/1266991): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. - sources += [ "hls/types_unittest.cc" ] + sources += [ + "hls/items_unittest.cc", + "hls/types_unittest.cc", + ] +} + +# TODO(https://crbug.com/1266991): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. +fuzzer_test("hls_items_fuzzer") { + sources = [ "hls/items_fuzzer.cc" ] + deps = [ + "//base", + "//media", + ] } if (proprietary_codecs) {
diff --git a/media/formats/hls/items.cc b/media/formats/hls/items.cc new file mode 100644 index 0000000..97c41c5 --- /dev/null +++ b/media/formats/hls/items.cc
@@ -0,0 +1,137 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/formats/hls/items.h" + +#include <utility> + +#include "base/strings/string_piece.h" +#include "base/strings/string_util.h" +#include "media/formats/hls/parse_status.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/abseil-cpp/absl/types/variant.h" + +namespace media { +namespace hls { + +namespace { + +// A non-blank line. This may be a comment, tag, or URI. +struct LineItem { + size_t number; + + // The content of the line. This does not include the line ending. + base::StringPiece text; +}; + +// Constructs a new Line from the given source text. Verifies that line endings +// are respected, and advances `src` and `line_number` to the following line. +ParseStatus::Or<LineItem> GetLineItem(base::StringPiece* src, + size_t* line_number) { + // Caller must not pass in an empty line + DCHECK(!src->empty()); + + auto line_end = src->find_first_of("\r\n"); + if (line_end == base::StringPiece::npos) { + return ParseStatusCode::kInvalidEOL; + } + + auto text = src->substr(0, line_end); + const auto following = src->substr(line_end); + + // Trim (and validate) newline sequence from the following text + if (base::StartsWith(following, "\n")) { + *src = following.substr(1); + } else if (base::StartsWith(following, "\r\n")) { + *src = following.substr(2); + } else { + return ParseStatusCode::kInvalidEOL; + } + + return LineItem{.number = (*line_number)++, .text = text}; +} + +// Attempts to determine tag type, if this line contains a tag. +absl::optional<TagItem> GetTagItem(LineItem line) { + constexpr base::StringPiece kTagPrefix = "#EXT"; + + // If this line does not begin with #EXT prefix, it must be a comment. + if (!base::StartsWith(line.text, kTagPrefix)) { + return absl::nullopt; + } + + auto content = line.text.substr(kTagPrefix.size()); + + constexpr std::pair<base::StringPiece, TagKind> kTagKindPrefixes[] = { + {"M3U", TagKind::kM3u}, + {"-X-VERSION:", TagKind::kXVersion}, + {"INF:", TagKind::kInf}, + }; + + for (const auto& tag : kTagKindPrefixes) { + if (base::StartsWith(content, tag.first)) { + content = content.substr(tag.first.size()); + return TagItem(tag.second, line.number, content); + } + } + + return TagItem(TagKind::kUnknown, line.number, content); +} + +} // namespace + +TagItem::TagItem(TagKind kind, size_t line_number, base::StringPiece content) + : kind(kind), line_number(line_number), content(content) {} + +TagItem::~TagItem() = default; +TagItem::TagItem(const TagItem&) = default; +TagItem::TagItem(TagItem&&) = default; +TagItem& TagItem::operator=(const TagItem&) = default; +TagItem& TagItem::operator=(TagItem&&) = default; + +UriItem::UriItem(size_t line_number, base::StringPiece text) + : line_number(line_number), text(text) {} + +UriItem::~UriItem() = default; +UriItem::UriItem(const UriItem&) = default; +UriItem::UriItem(UriItem&&) = default; +UriItem& UriItem::operator=(const UriItem&) = default; +UriItem& UriItem::operator=(UriItem&&) = default; + +ParseStatus::Or<GetNextLineItemResult> GetNextLineItem(base::StringPiece* src, + size_t* line_number) { + while (!src->empty()) { + auto result = GetLineItem(src, line_number); + if (result.has_error()) { + // Forward error to caller + return std::move(result).error(); + } + + auto line = std::move(result).value(); + + // Empty lines are permitted, but ignored + if (line.text.empty()) { + continue; + } + + // Tags and comments start with '#', try to get a tag + if (line.text.front() == '#') { + auto tag = GetTagItem(line); + if (!tag.has_value()) { + continue; + } + return GetNextLineItemResult(std::move(tag).value()); + } + + // If not empty, tag, or comment, it must be a URI. + // This line may contain leading, trailing, or interior whitespace, + // but that's the URI parser's responsibility. + return GetNextLineItemResult(UriItem(line.number, line.text)); + } + + return ParseStatusCode::kReachedEOF; +} + +} // namespace hls +} // namespace media
diff --git a/media/formats/hls/items.h b/media/formats/hls/items.h new file mode 100644 index 0000000..4b59c31 --- /dev/null +++ b/media/formats/hls/items.h
@@ -0,0 +1,75 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_FORMATS_HLS_ITEMS_H_ +#define MEDIA_FORMATS_HLS_ITEMS_H_ + +#include <cstddef> +#include "base/strings/string_piece.h" +#include "media/base/media_export.h" +#include "media/formats/hls/parse_status.h" +#include "third_party/abseil-cpp/absl/types/variant.h" + +namespace media { +namespace hls { + +// An 'Item' is a lexical item in an HLS manifest which has been determined to +// have some type based on its context, but has yet been fully parsed, +// validated, or undergone variable substitution. + +enum class TagKind { + kUnknown, + kM3u, + kXVersion, + kInf, + kMaxValue = kInf, +}; + +// An item which has been determined to of a known or unknown tag type, but not +// a comment. +struct MEDIA_EXPORT TagItem { + // TODO(crbug.com/1275317): These constructors should be removed + TagItem(TagKind, size_t line_number, base::StringPiece content); + ~TagItem(); + TagItem(const TagItem&); + TagItem(TagItem&&); + TagItem& operator=(const TagItem&); + TagItem& operator=(TagItem&&); + + TagKind kind; + size_t line_number; + + // The content of the tag. This does not include the tag prefix or line + // ending. + base::StringPiece content; +}; + +// A URI. This may be a URI line or a URI appearing within a tag. +struct MEDIA_EXPORT UriItem { + // TODO(crbug.com/1275317): These constructors should be removed + UriItem(size_t line_number, base::StringPiece text); + ~UriItem(); + UriItem(const UriItem&); + UriItem(UriItem&&); + UriItem& operator=(const UriItem&); + UriItem& operator=(UriItem&&); + + size_t line_number; + base::StringPiece text; +}; + +using GetNextLineItemResult = absl::variant<TagItem, UriItem>; + +// Returns the next line-level item from the source text. Verifies that line +// endings are respected, and advances `src` and `line_number` to the following +// line. If no further items could be retrieved, returns +// `ParseStatusCode::kReachedEOF`. +MEDIA_EXPORT ParseStatus::Or<GetNextLineItemResult> GetNextLineItem( + base::StringPiece* src, + size_t* line_number); + +} // namespace hls +} // namespace media + +#endif // MEDIA_FORMATS_HLS_ITEMS_H_
diff --git a/media/formats/hls/items_fuzzer.cc b/media/formats/hls/items_fuzzer.cc new file mode 100644 index 0000000..d65340cbc --- /dev/null +++ b/media/formats/hls/items_fuzzer.cc
@@ -0,0 +1,76 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <cstddef> +#include <cstdint> + +#include "base/check.h" +#include "base/strings/string_piece.h" +#include "media/formats/hls/items.h" +#include "third_party/abseil-cpp/absl/types/variant.h" + +namespace { + +bool IsSubstring(base::StringPiece sub, base::StringPiece base) { + return base.data() <= sub.data() && + base.data() + base.size() >= sub.data() + sub.size(); +} + +} // namespace + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + // Create a StringPiece from the given input + base::StringPiece manifest(reinterpret_cast<const char*>(data), size); + size_t line_number = 1; + + while (true) { + const auto old_manifest = manifest; + const auto old_line_number = line_number; + auto result = media::hls::GetNextLineItem(&manifest, &line_number); + + if (result.has_error()) { + // Ensure that this was an error this function is expected to return + CHECK(result.code() == media::hls::ParseStatusCode::kReachedEOF || + result.code() == media::hls::ParseStatusCode::kInvalidEOL); + + // Ensure that `manifest` is still a substring of the original manifest + CHECK(IsSubstring(manifest, old_manifest)); + break; + } + + auto value = std::move(result).value(); + base::StringPiece item_content; + size_t item_line_number; + static_assert( + absl::variant_size<media::hls::GetNextLineItemResult>::value == 2, ""); + if (auto* tag = absl::get_if<media::hls::TagItem>(&value)) { + item_content = tag->content; + item_line_number = tag->line_number; + + // Ensure the tag kind returned was valid + CHECK(tag->kind >= media::hls::TagKind::kUnknown && + tag->kind <= media::hls::TagKind::kMaxValue); + } else { + auto uri = absl::get<media::hls::UriItem>(std::move(value)); + item_content = uri.text; + item_line_number = uri.line_number; + } + + // Ensure that the line number associated with this item is between the + // original line number and the updated line number + CHECK(item_line_number >= old_line_number && + item_line_number < line_number); + + // Ensure that `item_content` is a substring of the original manifest + CHECK(IsSubstring(item_content, old_manifest)); + + // Ensure that `manifest` is a substring of the original manifest + CHECK(IsSubstring(manifest, old_manifest)); + + // Ensure that `item_content` is NOT a substring of the updated manifest + CHECK(!IsSubstring(item_content, manifest)); + } + + return 0; +}
diff --git a/media/formats/hls/items_unittest.cc b/media/formats/hls/items_unittest.cc new file mode 100644 index 0000000..efb11db3 --- /dev/null +++ b/media/formats/hls/items_unittest.cc
@@ -0,0 +1,139 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/formats/hls/items.h" +#include "base/strings/string_piece.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/variant.h" + +namespace media { +namespace hls { + +namespace { + +using LineResult = GetNextLineItemResult; + +// Calls `GetNextLineItem` for each expectation, and verifies that the result +// matches. +template <typename T> +void RunTest(base::StringPiece manifest, const T& expectations) { + size_t line_number = 1; + + for (auto expectation : expectations) { + auto result = GetNextLineItem(&manifest, &line_number); + + if (expectation.has_value()) { + auto expected_value = std::move(expectation).value(); + + EXPECT_TRUE(result.has_value()); + auto value = std::move(result).value(); + + // Ensure that resulting variants are the same + static_assert(absl::variant_size<LineResult>::value == 2, ""); + if (auto* expected_tag = absl::get_if<TagItem>(&expected_value)) { + auto tag = absl::get<TagItem>(std::move(value)); + EXPECT_EQ(expected_tag->kind, tag.kind); + EXPECT_EQ(expected_tag->line_number, tag.line_number); + EXPECT_EQ(expected_tag->content, tag.content); + } else { + auto expected_uri = absl::get<UriItem>(std::move(expected_value)); + auto uri = absl::get<UriItem>(std::move(value)); + EXPECT_EQ(expected_uri.line_number, uri.line_number); + EXPECT_EQ(expected_uri.text, uri.text); + } + } else { + EXPECT_TRUE(result.has_error()); + auto error = std::move(result).error(); + auto expected_error = std::move(expectation).error(); + EXPECT_EQ(error.code(), expected_error.code()); + } + } +} + +} // namespace + +TEST(HlsFormatParserTest, GetNextLineItemTest1) { + constexpr base::StringPiece kManifest = + "#EXTM3U\n" + "\n" + "#ExTm3U\n" + "# EXTM3U\n" + "#EXTasdf\n" + "##Comment\n" + "EXTM3U\n" + "\r\n" + "# Comment\n" + "http://www.example.com\n" + "../media.m3u8\n" + "foobar.jpg\n" + " video about food.mov\r\n" + "uri_with_{$variable}.mov\r\n" + "#EXT-X-VERSION:7\n" + "#EXT-X-VERSION:\n" + "#EXTINF:1234,\t\n"; + + const ParseStatus::Or<LineResult> kExpectations[] = { + LineResult(TagItem(TagKind::kM3u, 1, "")), + // Unknown tag content should be entire line following "#EXT" + LineResult(TagItem(TagKind::kUnknown, 5, "asdf")), + // Lines without leading # should be considered URIs + LineResult(UriItem(7, "EXTM3U")), + LineResult(UriItem(10, "http://www.example.com")), + LineResult(UriItem(11, "../media.m3u8")), + LineResult(UriItem(12, "foobar.jpg")), + // Whitespace is not allowed here, but that's not this function's + // responsibility. + LineResult(UriItem(13, " video about food.mov")), + // Variable substitution is not this function's responsibility. + LineResult(UriItem(14, "uri_with_{$variable}.mov")), + LineResult(TagItem(TagKind::kXVersion, 15, "7")), + LineResult(TagItem(TagKind::kXVersion, 16, "")), + LineResult(TagItem(TagKind::kInf, 17, "1234,\t")), + ParseStatusCode::kReachedEOF, ParseStatusCode::kReachedEOF}; + + RunTest(kManifest, kExpectations); +} + +TEST(HlsFormatParserTest, GetNextLineItemTest2) { + constexpr base::StringPiece kManifest = + "#EXTM3U\n" + "https://ww\rw.example.com\n" + "#EXT-X-VERSION:3\n"; + + const ParseStatus::Or<LineResult> kExpectations[] = { + LineResult(TagItem(TagKind::kM3u, 1, "")), ParseStatusCode::kInvalidEOL, + ParseStatusCode::kInvalidEOL}; + + RunTest(kManifest, kExpectations); +} + +TEST(HlsFormatParserTest, GetNextLineItemTest3) { + constexpr base::StringPiece kManifest = "#EXTM3U"; + + const ParseStatus::Or<LineResult> kExpectations[] = { + ParseStatusCode::kInvalidEOL, ParseStatusCode::kInvalidEOL}; + + RunTest(kManifest, kExpectations); +} + +TEST(HlsFormatParserTest, GetNextLineItemTest4) { + constexpr base::StringPiece kManifest = "#EXTM3U\r"; + + const ParseStatus::Or<LineResult> kExpectations[] = { + ParseStatusCode::kInvalidEOL, ParseStatusCode::kInvalidEOL}; + + RunTest(kManifest, kExpectations); +} + +TEST(HlsFormatParserTest, GetNextLineItemTest5) { + constexpr base::StringPiece kManifest = "\n"; + + const ParseStatus::Or<LineResult> kExpectations[] = { + ParseStatusCode::kReachedEOF, ParseStatusCode::kReachedEOF}; + + RunTest(kManifest, kExpectations); +} + +} // namespace hls +} // namespace media
diff --git a/media/formats/hls/parse_status.h b/media/formats/hls/parse_status.h index e05a0631..43673a8 100644 --- a/media/formats/hls/parse_status.h +++ b/media/formats/hls/parse_status.h
@@ -11,6 +11,7 @@ namespace hls { enum class ParseStatusCode : StatusCodeType { + kReachedEOF, kInvalidEOL, kMalformedTag, kFailedToParseDecimalInteger,
diff --git a/media/formats/hls/types.h b/media/formats/hls/types.h index 2ac2005..7224b55 100644 --- a/media/formats/hls/types.h +++ b/media/formats/hls/types.h
@@ -14,7 +14,7 @@ namespace types { // Data-types used in HLS, as described by the spec -using DecimalInteger = std::uint64_t; +using DecimalInteger = uint64_t; using DecimalFloatingPoint = double; using SignedDecimalFloatingPoint = double;
diff --git a/net/base/ip_address.cc b/net/base/ip_address.cc index ead7ef9..635d260b7 100644 --- a/net/base/ip_address.cc +++ b/net/base/ip_address.cc
@@ -68,11 +68,11 @@ const uint8_t address[4]; size_t prefix_length_in_bits; } static const kReservedIPv4Ranges[] = { - {{0, 0, 0, 0}, 8}, {{10, 0, 0, 0}, 8}, {{100, 64, 0, 0}, 10}, - {{127, 0, 0, 0}, 8}, {{169, 254, 0, 0}, 16}, {{172, 16, 0, 0}, 12}, - {{192, 0, 2, 0}, 24}, {{192, 88, 99, 0}, 24}, {{192, 168, 0, 0}, 16}, - {{198, 18, 0, 0}, 15}, {{198, 51, 100, 0}, 24}, {{203, 0, 113, 0}, 24}, - {{224, 0, 0, 0}, 3}}; + {{0, 0, 0, 0}, 8}, {{10, 0, 0, 0}, 8}, {{100, 64, 0, 0}, 10}, + {{127, 0, 0, 0}, 8}, {{169, 254, 0, 0}, 16}, {{172, 16, 0, 0}, 12}, + {{192, 0, 0, 0}, 24}, {{192, 0, 2, 0}, 24}, {{192, 88, 99, 0}, 24}, + {{192, 168, 0, 0}, 16}, {{198, 18, 0, 0}, 15}, {{198, 51, 100, 0}, 24}, + {{203, 0, 113, 0}, 24}, {{224, 0, 0, 0}, 3}}; for (const auto& range : kReservedIPv4Ranges) { if (IPAddressPrefixCheck(ip_address, range.address,
diff --git a/net/base/ip_address_unittest.cc b/net/base/ip_address_unittest.cc index 715b877..2483a030 100644 --- a/net/base/ip_address_unittest.cc +++ b/net/base/ip_address_unittest.cc
@@ -150,8 +150,8 @@ {"172.32.0.0", NOT_RESERVED}, {"191.255.255.255", NOT_RESERVED}, // 192.0.0.0/24 (including sub ranges) - {"192.0.0.0", NOT_RESERVED}, - {"192.0.0.255", NOT_RESERVED}, + {"192.0.0.0", RESERVED}, + {"192.0.0.255", RESERVED}, // Unreserved block(s) {"192.0.1.0", NOT_RESERVED}, {"192.0.1.255", NOT_RESERVED},
diff --git a/remoting/host/installer/win/BUILD.gn b/remoting/host/installer/win/BUILD.gn index f3613ac..2accf5cf 100644 --- a/remoting/host/installer/win/BUILD.gn +++ b/remoting/host/installer/win/BUILD.gn
@@ -4,6 +4,7 @@ import("//remoting/build/config/remoting_build.gni") import("//remoting/host/installer/win/generate_clsids.gni") +import("//remoting/host/installer/win/wix_path.gni") action("remoting_me2me_host_archive") { script = "//remoting/host/installer/build-installer-archive.py" @@ -129,7 +130,10 @@ # We do not release a 64 bits binary. So to avoid any potential # misunderstanding, we only build 32 bits MSI file. -if (is_chrome_branded && !is_component_build && target_cpu == "x86") { +# TODO(yuweih): Replace the remoting_wix_path check with is_chrome_branded once +# everyone is able to use their Google machines again, or remove the check +# altogether if we decide to build the MSI with non-official builders. +if (remoting_wix_path != "" && !is_component_build && target_cpu == "x86") { # The script uses "ia32" instead of "x86". msi_script_arch = "ia32" @@ -139,7 +143,7 @@ outputs = [ "$root_out_dir/chromoting.msi" ] args = [ "--wix_path", - rebase_path("//third_party/wix", root_build_dir), + remoting_wix_path, "--intermediate_dir", rebase_path("$root_gen_dir/remoting_installation", root_build_dir), "--target_arch",
diff --git a/remoting/host/installer/win/wix_path.gni b/remoting/host/installer/win/wix_path.gni new file mode 100644 index 0000000..b05a102a --- /dev/null +++ b/remoting/host/installer/win/wix_path.gni
@@ -0,0 +1,14 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") + +declare_args() { + # Absolute directory containing the wix binary. + remoting_wix_path = "" +} + +if (remoting_wix_path == "" && is_chrome_branded) { + remoting_wix_path = rebase_path("//third_party/wix", root_build_dir) +}
diff --git a/sandbox/win/BUILD.gn b/sandbox/win/BUILD.gn index e69d74c4..f33d9e8 100644 --- a/sandbox/win/BUILD.gn +++ b/sandbox/win/BUILD.gn
@@ -81,12 +81,6 @@ "src/process_thread_interception.h", "src/process_thread_policy.cc", "src/process_thread_policy.h", - "src/registry_dispatcher.cc", - "src/registry_dispatcher.h", - "src/registry_interception.cc", - "src/registry_interception.h", - "src/registry_policy.cc", - "src/registry_policy.h", "src/resolver.cc", "src/resolver.h", "src/restricted_token.cc", @@ -203,7 +197,6 @@ "src/process_mitigations_unittest.cc", "src/process_mitigations_win32k_unittest.cc", "src/process_policy_test.cc", - "src/registry_policy_test.cc", "src/restricted_token_test.cc", "src/unload_dll_test.cc", "tests/common/controller.cc",
diff --git a/sandbox/win/src/interceptors_64.cc b/sandbox/win/src/interceptors_64.cc index 61006e2..ba1726b 100644 --- a/sandbox/win/src/interceptors_64.cc +++ b/sandbox/win/src/interceptors_64.cc
@@ -10,7 +10,6 @@ #include "sandbox/win/src/policy_target.h" #include "sandbox/win/src/process_mitigations_win32k_interception.h" #include "sandbox/win/src/process_thread_interception.h" -#include "sandbox/win/src/registry_interception.h" #include "sandbox/win/src/sandbox_nt_types.h" #include "sandbox/win/src/sandbox_types.h" #include "sandbox/win/src/signed_interception.h" @@ -233,43 +232,6 @@ // ----------------------------------------------------------------------- -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtCreateKey64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG title_index, - PUNICODE_STRING class_name, - ULONG create_options, - PULONG disposition) { - NtCreateKeyFunction orig_fn = - reinterpret_cast<NtCreateKeyFunction>(g_originals[CREATE_KEY_ID]); - return TargetNtCreateKey(orig_fn, key, desired_access, object_attributes, - title_index, class_name, create_options, - disposition); -} - -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtOpenKey64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes) { - NtOpenKeyFunction orig_fn = - reinterpret_cast<NtOpenKeyFunction>(g_originals[OPEN_KEY_ID]); - return TargetNtOpenKey(orig_fn, key, desired_access, object_attributes); -} - -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtOpenKeyEx64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG open_options) { - NtOpenKeyExFunction orig_fn = - reinterpret_cast<NtOpenKeyExFunction>(g_originals[OPEN_KEY_EX_ID]); - return TargetNtOpenKeyEx(orig_fn, key, desired_access, object_attributes, - open_options); -} - -// ----------------------------------------------------------------------- - SANDBOX_INTERCEPT BOOL WINAPI TargetGdiDllInitialize64(HANDLE dll, DWORD reason) { GdiDllInitializeFunction orig_fn =
diff --git a/sandbox/win/src/interceptors_64.h b/sandbox/win/src/interceptors_64.h index a5d80e3..36b3a1e 100644 --- a/sandbox/win/src/interceptors_64.h +++ b/sandbox/win/src/interceptors_64.h
@@ -156,32 +156,6 @@ LPDWORD thread_id); // ----------------------------------------------------------------------- -// Interceptors handled by the registry dispatcher. - -// Interception of NtCreateKey on the child process. -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtCreateKey64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG title_index, - PUNICODE_STRING class_name, - ULONG create_options, - PULONG disposition); - -// Interception of NtOpenKey on the child process. -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtOpenKey64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes); - -// Interception of NtOpenKeyEx on the child process. -SANDBOX_INTERCEPT NTSTATUS WINAPI -TargetNtOpenKeyEx64(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG open_options); - -// ----------------------------------------------------------------------- // Interceptors handled by the process mitigations win32k lockdown code. // Interceptor for the GdiDllInitialize function.
diff --git a/sandbox/win/src/ipc_leak_test.cc b/sandbox/win/src/ipc_leak_test.cc index e77cd941..dc34063 100644 --- a/sandbox/win/src/ipc_leak_test.cc +++ b/sandbox/win/src/ipc_leak_test.cc
@@ -19,7 +19,6 @@ #include "sandbox/win/src/policy_low_level.h" #include "sandbox/win/src/policy_params.h" #include "sandbox/win/src/process_thread_interception.h" -#include "sandbox/win/src/registry_interception.h" #include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox_nt_util.h" #include "sandbox/win/src/sharedmem_ipc_client.h" @@ -39,8 +38,6 @@ TESTIPC_NTCREATEFILE, TESTIPC_CREATETHREAD, TESTIPC_CREATENAMEDPIPEW, - TESTIPC_NTOPENKEY, - TESTIPC_NTCREATEKEY, TESTIPC_LAST }; @@ -55,60 +52,6 @@ return policy; } -// NtOpenKey -NTSTATUS WINAPI DummyNtOpenKey(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes) { - return STATUS_ACCESS_DENIED; -} - -void TestNtOpenKey() { - NTSTATUS status; - UNICODE_STRING path_str; - HANDLE handle = INVALID_HANDLE_VALUE; - OBJECT_ATTRIBUTES attr; - BINDNTDLL(RtlInitUnicodeString); - - RtlInitUnicodeString(&path_str, L"\\??\\leak"); - InitializeObjectAttributes(&attr, &path_str, OBJ_CASE_INSENSITIVE, nullptr, - nullptr); - - status = TargetNtOpenKey(reinterpret_cast<NtOpenKeyFunction>(DummyNtOpenKey), - &handle, KEY_READ, &attr); - if (NT_SUCCESS(status)) - CloseHandle(handle); -} - -// NtCreateKey -NTSTATUS WINAPI DummyNtCreateKey(PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG title_index, - PUNICODE_STRING class_name, - ULONG create_options, - PULONG disposition) { - return STATUS_ACCESS_DENIED; -} - -void TestNtCreateKey() { - NTSTATUS status; - UNICODE_STRING path_str; - HANDLE handle = INVALID_HANDLE_VALUE; - OBJECT_ATTRIBUTES attr; - BINDNTDLL(RtlInitUnicodeString); - - RtlInitUnicodeString(&path_str, L"\\Registry\\Machine\\BADBAD"); - InitializeObjectAttributes(&attr, &path_str, OBJ_CASE_INSENSITIVE, nullptr, - nullptr); - - ULONG disposition; - status = - TargetNtCreateKey(reinterpret_cast<NtCreateKeyFunction>(DummyNtCreateKey), - &handle, KEY_READ, &attr, 0, nullptr, 0, &disposition); - if (NT_SUCCESS(status)) - CloseHandle(handle); -} - // CreateNamedPipeW HANDLE WINAPI DummyCreateNamedPipeW(LPCWSTR pipe_name, DWORD open_mode, @@ -290,12 +233,6 @@ case TESTIPC_CREATENAMEDPIPEW: TestCreateNamedPipeW(); break; - case TESTIPC_NTOPENKEY: - TestNtOpenKey(); - break; - case TESTIPC_NTCREATEKEY: - TestNtCreateKey(); - break; case TESTIPC_LAST: NOTREACHED_NT(); break; @@ -335,16 +272,11 @@ {TESTIPC_NTCREATEFILE, "TESTIPC_NTCREATEFILE", nullptr}, {TESTIPC_CREATETHREAD, "TESTIPC_CREATETHREAD", nullptr}, {TESTIPC_CREATENAMEDPIPEW, "TESTIPC_CREATENAMEDPIPEW", - INVALID_HANDLE_VALUE}, - {TESTIPC_NTOPENKEY, "TESTIPC_NTOPENKEY", nullptr}, - {TESTIPC_NTCREATEKEY, "TESTIPC_NTCREATEEY", nullptr}}; + INVALID_HANDLE_VALUE}}; static_assert(base::size(test_data) == TESTIPC_LAST, "Not enough tests."); for (auto test : test_data) { TestRunner runner; - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE\\Software\\*")); std::wstring command = std::wstring(L"IPC_Leak "); command += std::to_wstring(test.test_id); EXPECT_EQ(test.expected_result,
diff --git a/sandbox/win/src/ipc_tags.h b/sandbox/win/src/ipc_tags.h index 4d3d249..d1ab005 100644 --- a/sandbox/win/src/ipc_tags.h +++ b/sandbox/win/src/ipc_tags.h
@@ -23,8 +23,6 @@ NTOPENPROCESS, NTOPENPROCESSTOKEN, NTOPENPROCESSTOKENEX, - NTCREATEKEY, - NTOPENKEY, GDI_GDIDLLINITIALIZE, GDI_GETSTOCKOBJECT, USER_REGISTERCLASSW,
diff --git a/sandbox/win/src/registry_dispatcher.cc b/sandbox/win/src/registry_dispatcher.cc deleted file mode 100644 index 45dd6c4f..0000000 --- a/sandbox/win/src/registry_dispatcher.cc +++ /dev/null
@@ -1,168 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "sandbox/win/src/registry_dispatcher.h" - -#include <stdint.h> - -#include "base/win/scoped_handle.h" -#include "base/win/windows_version.h" -#include "sandbox/win/src/crosscall_client.h" -#include "sandbox/win/src/interception.h" -#include "sandbox/win/src/interceptors.h" -#include "sandbox/win/src/ipc_tags.h" -#include "sandbox/win/src/policy_broker.h" -#include "sandbox/win/src/policy_params.h" -#include "sandbox/win/src/registry_interception.h" -#include "sandbox/win/src/registry_policy.h" -#include "sandbox/win/src/sandbox.h" -#include "sandbox/win/src/sandbox_nt_util.h" -#include "sandbox/win/src/win_utils.h" - -namespace { - -// Builds a path using the root directory and the name. -bool GetCompletePath(HANDLE root, - const std::wstring& name, - std::wstring* complete_name) { - if (root) { - if (!sandbox::GetPathFromHandle(root, complete_name)) - return false; - - *complete_name += L"\\"; - *complete_name += name; - } else { - *complete_name = name; - } - - return true; -} - -} // namespace - -namespace sandbox { - -RegistryDispatcher::RegistryDispatcher(PolicyBase* policy_base) - : policy_base_(policy_base) { - static const IPCCall create_params = { - {IpcTag::NTCREATEKEY, - {WCHAR_TYPE, UINT32_TYPE, VOIDPTR_TYPE, UINT32_TYPE, UINT32_TYPE, - UINT32_TYPE}}, - reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtCreateKey)}; - - static const IPCCall open_params = { - {IpcTag::NTOPENKEY, {WCHAR_TYPE, UINT32_TYPE, VOIDPTR_TYPE, UINT32_TYPE}}, - reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtOpenKey)}; - - ipc_calls_.push_back(create_params); - ipc_calls_.push_back(open_params); -} - -bool RegistryDispatcher::SetupService(InterceptionManager* manager, - IpcTag service) { - if (IpcTag::NTCREATEKEY == service) - return INTERCEPT_NT(manager, NtCreateKey, CREATE_KEY_ID, 32); - - if (IpcTag::NTOPENKEY == service) { - bool result = INTERCEPT_NT(manager, NtOpenKey, OPEN_KEY_ID, 16); - result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20); - return result; - } - - return false; -} - -bool RegistryDispatcher::NtCreateKey(IPCInfo* ipc, - std::wstring* name, - uint32_t attributes, - HANDLE root, - uint32_t desired_access, - uint32_t title_index, - uint32_t create_options) { - base::win::ScopedHandle root_handle; - std::wstring real_path = *name; - - // If there is a root directory, we need to duplicate the handle to make - // it valid in this process. - if (root) { - if (!::DuplicateHandle(ipc->client_info->process, root, - ::GetCurrentProcess(), &root, 0, false, - DUPLICATE_SAME_ACCESS)) - return false; - - root_handle.Set(root); - } - - if (!GetCompletePath(root, *name, &real_path)) - return false; - - const wchar_t* regname = real_path.c_str(); - CountedParameterSet<OpenKey> params; - params[OpenKey::NAME] = ParamPickerMake(regname); - params[OpenKey::ACCESS] = ParamPickerMake(desired_access); - - EvalResult result = - policy_base_->EvalPolicy(IpcTag::NTCREATEKEY, params.GetBase()); - - HANDLE handle; - NTSTATUS nt_status; - ULONG disposition = 0; - if (!RegistryPolicy::CreateKeyAction( - result, *ipc->client_info, *name, attributes, root, desired_access, - title_index, create_options, &handle, &nt_status, &disposition)) { - ipc->return_info.nt_status = STATUS_ACCESS_DENIED; - return true; - } - - // Return operation status on the IPC. - ipc->return_info.extended[0].unsigned_int = disposition; - ipc->return_info.nt_status = nt_status; - ipc->return_info.handle = handle; - return true; -} - -bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, - std::wstring* name, - uint32_t attributes, - HANDLE root, - uint32_t desired_access) { - base::win::ScopedHandle root_handle; - std::wstring real_path = *name; - - // If there is a root directory, we need to duplicate the handle to make - // it valid in this process. - if (root) { - if (!::DuplicateHandle(ipc->client_info->process, root, - ::GetCurrentProcess(), &root, 0, false, - DUPLICATE_SAME_ACCESS)) - return false; - root_handle.Set(root); - } - - if (!GetCompletePath(root, *name, &real_path)) - return false; - - const wchar_t* regname = real_path.c_str(); - CountedParameterSet<OpenKey> params; - params[OpenKey::NAME] = ParamPickerMake(regname); - params[OpenKey::ACCESS] = ParamPickerMake(desired_access); - - EvalResult result = - policy_base_->EvalPolicy(IpcTag::NTOPENKEY, params.GetBase()); - HANDLE handle; - NTSTATUS nt_status; - if (!RegistryPolicy::OpenKeyAction(result, *ipc->client_info, *name, - attributes, root, desired_access, &handle, - &nt_status)) { - ipc->return_info.nt_status = STATUS_ACCESS_DENIED; - return true; - } - - // Return operation status on the IPC. - ipc->return_info.nt_status = nt_status; - ipc->return_info.handle = handle; - return true; -} - -} // namespace sandbox
diff --git a/sandbox/win/src/registry_dispatcher.h b/sandbox/win/src/registry_dispatcher.h deleted file mode 100644 index 44a5570..0000000 --- a/sandbox/win/src/registry_dispatcher.h +++ /dev/null
@@ -1,54 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SANDBOX_WIN_SRC_REGISTRY_DISPATCHER_H_ -#define SANDBOX_WIN_SRC_REGISTRY_DISPATCHER_H_ - -#include <stdint.h> - -#include <string> - -#include "base/memory/raw_ptr.h" -#include "sandbox/win/src/crosscall_server.h" -#include "sandbox/win/src/ipc_tags.h" -#include "sandbox/win/src/sandbox_policy_base.h" - -namespace sandbox { - -// This class handles registry-related IPC calls. -class RegistryDispatcher : public Dispatcher { - public: - explicit RegistryDispatcher(PolicyBase* policy_base); - - RegistryDispatcher(const RegistryDispatcher&) = delete; - RegistryDispatcher& operator=(const RegistryDispatcher&) = delete; - - ~RegistryDispatcher() override {} - - // Dispatcher interface. - bool SetupService(InterceptionManager* manager, IpcTag service) override; - - private: - // Processes IPC requests coming from calls to NtCreateKey in the target. - bool NtCreateKey(IPCInfo* ipc, - std::wstring* name, - uint32_t attributes, - HANDLE root, - uint32_t desired_access, - uint32_t title_index, - uint32_t create_options); - - // Processes IPC requests coming from calls to NtOpenKey in the target. - bool NtOpenKey(IPCInfo* ipc, - std::wstring* name, - uint32_t attributes, - HANDLE root, - uint32_t desired_access); - - raw_ptr<PolicyBase> policy_base_; -}; - -} // namespace sandbox - -#endif // SANDBOX_WIN_SRC_REGISTRY_DISPATCHER_H_
diff --git a/sandbox/win/src/registry_interception.cc b/sandbox/win/src/registry_interception.cc deleted file mode 100644 index ec09aeb..0000000 --- a/sandbox/win/src/registry_interception.cc +++ /dev/null
@@ -1,236 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "sandbox/win/src/registry_interception.h" - -#include <stdint.h> - -#include "sandbox/win/src/crosscall_client.h" -#include "sandbox/win/src/ipc_tags.h" -#include "sandbox/win/src/policy_params.h" -#include "sandbox/win/src/policy_target.h" -#include "sandbox/win/src/sandbox_factory.h" -#include "sandbox/win/src/sandbox_nt_util.h" -#include "sandbox/win/src/sharedmem_ipc_client.h" -#include "sandbox/win/src/target_services.h" - -namespace sandbox { - -NTSTATUS WINAPI TargetNtCreateKey(NtCreateKeyFunction orig_CreateKey, - PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG title_index, - PUNICODE_STRING class_name, - ULONG create_options, - PULONG disposition) { - // Check if the process can create it first. - NTSTATUS status = - orig_CreateKey(key, desired_access, object_attributes, title_index, - class_name, create_options, disposition); - if (NT_SUCCESS(status)) - return status; - - // We don't trust that the IPC can work this early. - if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) - return status; - - do { - if (!ValidParameter(key, sizeof(HANDLE), WRITE)) - break; - - if (disposition && !ValidParameter(disposition, sizeof(ULONG), WRITE)) - break; - - // At this point we don't support class_name. - if (class_name && class_name->Buffer && class_name->Length) - break; - - // We don't support creating link keys, volatile keys and backup/restore. - if (create_options) - break; - - void* memory = GetGlobalIPCMemory(); - if (!memory) - break; - - std::unique_ptr<wchar_t, NtAllocDeleter> name; - uint32_t attributes = 0; - HANDLE root_directory = 0; - NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, - &root_directory); - if (!NT_SUCCESS(ret) || !name) - break; - - uint32_t desired_access_uint32 = desired_access; - CountedParameterSet<OpenKey> params; - params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); - - bool query_broker = false; - { - std::unique_ptr<wchar_t, NtAllocDeleter> full_name; - const wchar_t* name_ptr = name.get(); - const wchar_t* full_name_ptr = nullptr; - - if (root_directory) { - ret = sandbox::AllocAndGetFullPath(root_directory, name.get(), - &full_name); - if (!NT_SUCCESS(ret) || !full_name) - break; - full_name_ptr = full_name.get(); - params[OpenKey::NAME] = ParamPickerMake(full_name_ptr); - } else { - params[OpenKey::NAME] = ParamPickerMake(name_ptr); - } - - query_broker = QueryBroker(IpcTag::NTCREATEKEY, params.GetBase()); - } - - if (!query_broker) - break; - - SharedMemIPCClient ipc(memory); - CrossCallReturn answer = {0}; - - ResultCode code = CrossCall(ipc, IpcTag::NTCREATEKEY, name.get(), - attributes, root_directory, desired_access, - title_index, create_options, &answer); - - if (SBOX_ALL_OK != code) - break; - - if (!NT_SUCCESS(answer.nt_status)) - // TODO(nsylvain): We should return answer.nt_status here instead - // of status. We can do this only after we checked the policy. - // otherwise we will returns ACCESS_DENIED for all paths - // that are not specified by a policy, even though your token allows - // access to that path, and the original call had a more meaningful - // error. Bug 4369 - break; - - __try { - *key = answer.handle; - - if (disposition) - *disposition = answer.extended[0].unsigned_int; - - status = answer.nt_status; - } __except (EXCEPTION_EXECUTE_HANDLER) { - break; - } - } while (false); - - return status; -} - -NTSTATUS WINAPI CommonNtOpenKey(NTSTATUS status, - PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes) { - // We don't trust that the IPC can work this early. - if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) - return status; - - do { - if (!ValidParameter(key, sizeof(HANDLE), WRITE)) - break; - - void* memory = GetGlobalIPCMemory(); - if (!memory) - break; - - std::unique_ptr<wchar_t, NtAllocDeleter> name; - uint32_t attributes; - HANDLE root_directory; - NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, - &root_directory); - if (!NT_SUCCESS(ret) || !name) - break; - - uint32_t desired_access_uint32 = desired_access; - CountedParameterSet<OpenKey> params; - params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); - - bool query_broker = false; - { - std::unique_ptr<wchar_t, NtAllocDeleter> full_name; - const wchar_t* name_ptr = name.get(); - const wchar_t* full_name_ptr = nullptr; - - if (root_directory) { - ret = sandbox::AllocAndGetFullPath(root_directory, name.get(), - &full_name); - if (!NT_SUCCESS(ret) || !full_name) - break; - full_name_ptr = full_name.get(); - params[OpenKey::NAME] = ParamPickerMake(full_name_ptr); - } else { - params[OpenKey::NAME] = ParamPickerMake(name_ptr); - } - - query_broker = QueryBroker(IpcTag::NTOPENKEY, params.GetBase()); - } - - if (!query_broker) - break; - - SharedMemIPCClient ipc(memory); - CrossCallReturn answer = {0}; - ResultCode code = CrossCall(ipc, IpcTag::NTOPENKEY, name.get(), attributes, - root_directory, desired_access, &answer); - - if (SBOX_ALL_OK != code) - break; - - if (!NT_SUCCESS(answer.nt_status)) - // TODO(nsylvain): We should return answer.nt_status here instead - // of status. We can do this only after we checked the policy. - // otherwise we will returns ACCESS_DENIED for all paths - // that are not specified by a policy, even though your token allows - // access to that path, and the original call had a more meaningful - // error. Bug 4369 - break; - - __try { - *key = answer.handle; - status = answer.nt_status; - } __except (EXCEPTION_EXECUTE_HANDLER) { - break; - } - } while (false); - - return status; -} - -NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, - PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes) { - // Check if the process can open it first. - NTSTATUS status = orig_OpenKey(key, desired_access, object_attributes); - if (NT_SUCCESS(status)) - return status; - - return CommonNtOpenKey(status, key, desired_access, object_attributes); -} - -NTSTATUS WINAPI TargetNtOpenKeyEx(NtOpenKeyExFunction orig_OpenKeyEx, - PHANDLE key, - ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, - ULONG open_options) { - // Check if the process can open it first. - NTSTATUS status = - orig_OpenKeyEx(key, desired_access, object_attributes, open_options); - - // We do not support open_options at this time. The 2 current known values - // are REG_OPTION_CREATE_LINK, to open a symbolic link, and - // REG_OPTION_BACKUP_RESTORE to open the key with special privileges. - if (NT_SUCCESS(status) || open_options != 0) - return status; - - return CommonNtOpenKey(status, key, desired_access, object_attributes); -} - -} // namespace sandbox
diff --git a/sandbox/win/src/registry_interception.h b/sandbox/win/src/registry_interception.h deleted file mode 100644 index f47e56ce..0000000 --- a/sandbox/win/src/registry_interception.h +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SANDBOX_WIN_SRC_REGISTRY_INTERCEPTION_H_ -#define SANDBOX_WIN_SRC_REGISTRY_INTERCEPTION_H_ - -#include "sandbox/win/src/nt_internals.h" -#include "sandbox/win/src/sandbox_types.h" - -namespace sandbox { - -extern "C" { - -// Interception of NtCreateKey on the child process. -// It should never be called directly -SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtCreateKey( - NtCreateKeyFunction orig_CreateKey, PHANDLE key, ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, ULONG title_index, - PUNICODE_STRING class_name, ULONG create_options, PULONG disposition); - -// Interception of NtOpenKey on the child process. -// It should never be called directly -SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenKey( - NtOpenKeyFunction orig_OpenKey, PHANDLE key, ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes); - -// Interception of NtOpenKeyEx on the child process. -// It should never be called directly -SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenKeyEx( - NtOpenKeyExFunction orig_OpenKeyEx, PHANDLE key, ACCESS_MASK desired_access, - POBJECT_ATTRIBUTES object_attributes, ULONG open_options); - -} // extern "C" - -} // namespace sandbox - -#endif // SANDBOX_WIN_SRC_REGISTRY_INTERCEPTION_H_
diff --git a/sandbox/win/src/registry_policy.cc b/sandbox/win/src/registry_policy.cc deleted file mode 100644 index 665aa51e..0000000 --- a/sandbox/win/src/registry_policy.cc +++ /dev/null
@@ -1,230 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "sandbox/win/src/registry_policy.h" - -#include <stdint.h> - -#include <string> - -#include "base/check.h" -#include "base/notreached.h" -#include "sandbox/win/src/ipc_tags.h" -#include "sandbox/win/src/policy_engine_opcodes.h" -#include "sandbox/win/src/policy_params.h" -#include "sandbox/win/src/sandbox_types.h" -#include "sandbox/win/src/sandbox_utils.h" -#include "sandbox/win/src/win_utils.h" - -namespace { - -static const uint32_t kAllowedRegFlags = - KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_READ | - GENERIC_READ | GENERIC_EXECUTE | READ_CONTROL; - -// Opens the key referenced by |obj_attributes| with |access| and -// checks what permission was given. Remove the WRITE flags and update -// |access| with the new value. -NTSTATUS TranslateMaximumAllowed(OBJECT_ATTRIBUTES* obj_attributes, - DWORD* access) { - NtOpenKeyFunction NtOpenKey = nullptr; - ResolveNTFunctionPtr("NtOpenKey", &NtOpenKey); - - NtCloseFunction NtClose = nullptr; - ResolveNTFunctionPtr("NtClose", &NtClose); - - NtQueryObjectFunction NtQueryObject = nullptr; - ResolveNTFunctionPtr("NtQueryObject", &NtQueryObject); - - // Open the key. - HANDLE handle; - NTSTATUS status = NtOpenKey(&handle, *access, obj_attributes); - if (!NT_SUCCESS(status)) - return status; - - OBJECT_BASIC_INFORMATION info = {0}; - status = NtQueryObject(handle, ObjectBasicInformation, &info, sizeof(info), - nullptr); - CHECK(NT_SUCCESS(NtClose(handle))); - if (!NT_SUCCESS(status)) - return status; - - *access = info.GrantedAccess & kAllowedRegFlags; - return STATUS_SUCCESS; -} - -NTSTATUS NtCreateKeyInTarget(HANDLE* target_key_handle, - ACCESS_MASK desired_access, - OBJECT_ATTRIBUTES* obj_attributes, - ULONG title_index, - UNICODE_STRING* class_name, - ULONG create_options, - ULONG* disposition, - HANDLE target_process) { - *target_key_handle = nullptr; - NtCreateKeyFunction NtCreateKey = nullptr; - ResolveNTFunctionPtr("NtCreateKey", &NtCreateKey); - - if (MAXIMUM_ALLOWED & desired_access) { - NTSTATUS status = TranslateMaximumAllowed(obj_attributes, &desired_access); - if (!NT_SUCCESS(status)) - return STATUS_ACCESS_DENIED; - } - - HANDLE local_handle = INVALID_HANDLE_VALUE; - NTSTATUS status = - NtCreateKey(&local_handle, desired_access, obj_attributes, title_index, - class_name, create_options, disposition); - if (!NT_SUCCESS(status)) - return status; - - if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, target_process, - target_key_handle, 0, false, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - return STATUS_ACCESS_DENIED; - } - return STATUS_SUCCESS; -} - -NTSTATUS NtOpenKeyInTarget(HANDLE* target_key_handle, - ACCESS_MASK desired_access, - OBJECT_ATTRIBUTES* obj_attributes, - HANDLE target_process) { - *target_key_handle = nullptr; - NtOpenKeyFunction NtOpenKey = nullptr; - ResolveNTFunctionPtr("NtOpenKey", &NtOpenKey); - - if (MAXIMUM_ALLOWED & desired_access) { - NTSTATUS status = TranslateMaximumAllowed(obj_attributes, &desired_access); - if (!NT_SUCCESS(status)) - return STATUS_ACCESS_DENIED; - } - - HANDLE local_handle = INVALID_HANDLE_VALUE; - NTSTATUS status = NtOpenKey(&local_handle, desired_access, obj_attributes); - - if (!NT_SUCCESS(status)) - return status; - - if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, target_process, - target_key_handle, 0, false, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - return STATUS_ACCESS_DENIED; - } - return STATUS_SUCCESS; -} - -} // namespace - -namespace sandbox { - -bool RegistryPolicy::GenerateRules(const wchar_t* name, - TargetPolicy::Semantics semantics, - LowLevelPolicy* policy) { - std::wstring resolved_name(name); - if (resolved_name.empty()) { - return false; - } - - if (!ResolveRegistryName(resolved_name, &resolved_name)) - return false; - - name = resolved_name.c_str(); - - EvalResult result = ASK_BROKER; - - PolicyRule open(result); - PolicyRule create(result); - - switch (semantics) { - case TargetPolicy::REG_ALLOW_READONLY: { - // We consider all flags that are not known to be readonly as potentially - // used for write. Here we also support MAXIMUM_ALLOWED, but we are going - // to expand it to read-only before the call. - uint32_t restricted_flags = ~(kAllowedRegFlags | MAXIMUM_ALLOWED); - open.AddNumberMatch(IF_NOT, OpenKey::ACCESS, restricted_flags, AND); - create.AddNumberMatch(IF_NOT, OpenKey::ACCESS, restricted_flags, AND); - break; - } - case TargetPolicy::REG_ALLOW_ANY: { - break; - } - default: { - NOTREACHED(); - return false; - } - } - - if (!create.AddStringMatch(IF, OpenKey::NAME, name, CASE_INSENSITIVE) || - !policy->AddRule(IpcTag::NTCREATEKEY, &create)) { - return false; - } - - if (!open.AddStringMatch(IF, OpenKey::NAME, name, CASE_INSENSITIVE) || - !policy->AddRule(IpcTag::NTOPENKEY, &open)) { - return false; - } - - return true; -} - -bool RegistryPolicy::CreateKeyAction(EvalResult eval_result, - const ClientInfo& client_info, - const std::wstring& key, - uint32_t attributes, - HANDLE root_directory, - uint32_t desired_access, - uint32_t title_index, - uint32_t create_options, - HANDLE* handle, - NTSTATUS* nt_status, - ULONG* disposition) { - // The only action supported is ASK_BROKER which means create the requested - // file as specified. - if (ASK_BROKER != eval_result) { - *nt_status = STATUS_ACCESS_DENIED; - return false; - } - - // We don't support creating link keys, volatile keys or backup/restore. - if (create_options) { - *nt_status = STATUS_ACCESS_DENIED; - return false; - } - - UNICODE_STRING uni_name = {0}; - OBJECT_ATTRIBUTES obj_attributes = {0}; - InitObjectAttribs(key, attributes, root_directory, &obj_attributes, &uni_name, - nullptr); - *nt_status = NtCreateKeyInTarget(handle, desired_access, &obj_attributes, - title_index, nullptr, create_options, - disposition, client_info.process); - return true; -} - -bool RegistryPolicy::OpenKeyAction(EvalResult eval_result, - const ClientInfo& client_info, - const std::wstring& key, - uint32_t attributes, - HANDLE root_directory, - uint32_t desired_access, - HANDLE* handle, - NTSTATUS* nt_status) { - // The only action supported is ASK_BROKER which means open the requested - // file as specified. - if (ASK_BROKER != eval_result) { - *nt_status = STATUS_ACCESS_DENIED; - return false; - } - - UNICODE_STRING uni_name = {0}; - OBJECT_ATTRIBUTES obj_attributes = {0}; - InitObjectAttribs(key, attributes, root_directory, &obj_attributes, &uni_name, - nullptr); - *nt_status = NtOpenKeyInTarget(handle, desired_access, &obj_attributes, - client_info.process); - return true; -} - -} // namespace sandbox
diff --git a/sandbox/win/src/registry_policy.h b/sandbox/win/src/registry_policy.h deleted file mode 100644 index 9d629f1..0000000 --- a/sandbox/win/src/registry_policy.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SANDBOX_WIN_SRC_REGISTRY_POLICY_H_ -#define SANDBOX_WIN_SRC_REGISTRY_POLICY_H_ - -#include <stdint.h> - -#include <string> - -#include "sandbox/win/src/crosscall_server.h" -#include "sandbox/win/src/nt_internals.h" -#include "sandbox/win/src/policy_low_level.h" -#include "sandbox/win/src/sandbox_policy.h" - -namespace sandbox { - -// This class centralizes most of the knowledge related to registry policy -class RegistryPolicy { - public: - // Creates the required low-level policy rules to evaluate a high-level - // policy rule for registry IO, in particular open or create actions. - static bool GenerateRules(const wchar_t* name, - TargetPolicy::Semantics semantics, - LowLevelPolicy* policy); - - // Performs the desired policy action on a create request with an - // API that is compatible with the IPC-received parameters. - static bool CreateKeyAction(EvalResult eval_result, - const ClientInfo& client_info, - const std::wstring& key, - uint32_t attributes, - HANDLE root_directory, - uint32_t desired_access, - uint32_t title_index, - uint32_t create_options, - HANDLE* handle, - NTSTATUS* nt_status, - ULONG* disposition); - - // Performs the desired policy action on an open request with an - // API that is compatible with the IPC-received parameters. - static bool OpenKeyAction(EvalResult eval_result, - const ClientInfo& client_info, - const std::wstring& key, - uint32_t attributes, - HANDLE root_directory, - uint32_t desired_access, - HANDLE* handle, - NTSTATUS* nt_status); -}; - -} // namespace sandbox - -#endif // SANDBOX_WIN_SRC_REGISTRY_POLICY_H_
diff --git a/sandbox/win/src/registry_policy_test.cc b/sandbox/win/src/registry_policy_test.cc deleted file mode 100644 index 83ce586..0000000 --- a/sandbox/win/src/registry_policy_test.cc +++ /dev/null
@@ -1,322 +0,0 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <shlobj.h> - -#include "sandbox/win/src/nt_internals.h" -#include "sandbox/win/src/registry_policy.h" -#include "sandbox/win/src/sandbox.h" -#include "sandbox/win/src/sandbox_factory.h" -#include "sandbox/win/src/sandbox_policy.h" -#include "sandbox/win/src/win_utils.h" -#include "sandbox/win/tests/common/controller.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -static const DWORD kAllowedRegFlags = KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | - KEY_NOTIFY | KEY_READ | GENERIC_READ | - GENERIC_EXECUTE | READ_CONTROL; - -#define BINDNTDLL(name) \ - name##Function name = reinterpret_cast<name##Function>( \ - ::GetProcAddress(::GetModuleHandle(L"ntdll.dll"), #name)) - -bool IsKeyOpenForRead(HKEY handle) { - BINDNTDLL(NtQueryObject); - - OBJECT_BASIC_INFORMATION info = {0}; - NTSTATUS status = NtQueryObject(handle, ObjectBasicInformation, &info, - sizeof(info), nullptr); - - if (!NT_SUCCESS(status)) - return false; - - if ((info.GrantedAccess & (~kAllowedRegFlags)) != 0) - return false; - return true; -} - -} // namespace - -namespace sandbox { - -SBOX_TESTS_COMMAND int Reg_OpenKey(int argc, wchar_t** argv) { - if (argc != 4) - return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - - REGSAM desired_access = 0; - ULONG options = 0; - if (wcscmp(argv[1], L"read") == 0) { - desired_access = KEY_READ; - } else if (wcscmp(argv[1], L"write") == 0) { - desired_access = KEY_ALL_ACCESS; - } else if (wcscmp(argv[1], L"link") == 0) { - options = REG_OPTION_CREATE_LINK; - desired_access = KEY_ALL_ACCESS; - } else { - desired_access = MAXIMUM_ALLOWED; - } - - HKEY root = GetReservedKeyFromName(argv[2]); - HKEY key; - LRESULT result = 0; - - if (wcscmp(argv[0], L"create") == 0) - result = ::RegCreateKeyEx(root, argv[3], 0, nullptr, options, - desired_access, nullptr, &key, nullptr); - else - result = ::RegOpenKeyEx(root, argv[3], 0, desired_access, &key); - - if (ERROR_SUCCESS == result) { - if (MAXIMUM_ALLOWED == desired_access) { - if (!IsKeyOpenForRead(key)) { - ::RegCloseKey(key); - return SBOX_TEST_FAILED; - } - } - ::RegCloseKey(key); - return SBOX_TEST_SUCCEEDED; - } else if (ERROR_ACCESS_DENIED == result) { - return SBOX_TEST_DENIED; - } - - return SBOX_TEST_FAILED; -} - -TEST(RegistryPolicyTest, TestKeyAnyAccess) { - TestRunner runner; - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); - - // Tests read access on key allowed for read-write. - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey create read HKEY_LOCAL_MACHINE software\\microsoft")); - - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey open read HKEY_LOCAL_MACHINE software\\microsoft")); - - if (::IsUserAnAdmin()) { - // Tests write access on key allowed for read-write. - EXPECT_EQ(SBOX_TEST_SUCCEEDED, - runner.RunTest(L"Reg_OpenKey create write HKEY_LOCAL_MACHINE " - L"software\\microsoft")); - - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey open write HKEY_LOCAL_MACHINE software\\microsoft")); - } - - // Tests subdirectory access on keys where we don't have subdirectory acess. - EXPECT_EQ(SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey create read " - L"HKEY_LOCAL_MACHINE software\\microsoft\\Windows")); - - EXPECT_EQ(SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey open read " - L"HKEY_LOCAL_MACHINE software\\microsoft\\windows")); - - // Tests to see if we can create keys where we dont have subdirectory access. - // This is denied. - EXPECT_EQ(SBOX_TEST_DENIED, - runner.RunTest( - L"Reg_OpenKey create write " - L"HKEY_LOCAL_MACHINE software\\Microsoft\\google_unit_tests")); - - RegDeleteKey(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\google_unit_tests"); - - // Tests if we need to handle differently the "\\" at the end. - // This is denied. We need to add both rules. - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest( - L"Reg_OpenKey create read HKEY_LOCAL_MACHINE software\\microsoft\\")); - - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest( - L"Reg_OpenKey open read HKEY_LOCAL_MACHINE software\\microsoft\\")); -} - -TEST(RegistryPolicyTest, TestKeyNoAccess) { - TestRunner runner; - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - - // Tests read access where we don't have access at all. - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey create read HKEY_LOCAL_MACHINE software")); - - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey open read HKEY_LOCAL_MACHINE software")); -} - -TEST(RegistryPolicyTest, TestKeyReadOnlyAccess) { - TestRunner runner; - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies\\*")); - - // Tests subdirectory acess on keys where we have subdirectory acess. - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest(L"Reg_OpenKey create read " - L"HKEY_LOCAL_MACHINE software\\Policies\\microsoft")); - - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest(L"Reg_OpenKey open read " - L"HKEY_LOCAL_MACHINE software\\Policies\\microsoft")); - - // Tests to see if we can create keys where we have subdirectory access. - EXPECT_EQ(SBOX_TEST_DENIED, - runner.RunTest( - L"Reg_OpenKey create write " - L"HKEY_LOCAL_MACHINE software\\Policies\\google_unit_tests")); - - RegDeleteKey(HKEY_LOCAL_MACHINE, L"software\\Policies\\google_unit_tests"); -} - -TEST(RegistryPolicyTest, TestKeyAllAccessSubDir) { - TestRunner runner; - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies\\*")); - - if (::IsUserAnAdmin()) { - // Tests to see if we can create keys where we have subdirectory access. - EXPECT_EQ(SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey create write " - L"HKEY_LOCAL_MACHINE software\\Policies\\google_unit_tests")); - - RegDeleteKey(HKEY_LOCAL_MACHINE, L"software\\Policies\\google_unit_tests"); - } -} - -TEST(RegistryPolicyTest, TestKeyCreateLink) { - TestRunner runner; - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Policies\\*")); - - // Tests to see if we can create a registry link key. - // NOTE: In theory here we should make sure to check for SBOX_TEST_DENIED - // instead of !SBOX_TEST_SUCCEEDED, but unfortunately the result is not - // access denied. Internally RegCreateKeyEx (At least on Vista 64) tries to - // create the link, and we return successfully access denied, then, it - // decides to try to break the path in multiple chunks, and create the links - // one by one. In this scenario, it tries to create "HKLM\Software" as a - // link key, which obviously fail with STATUS_OBJECT_NAME_COLLISION, and - // this is what is returned to the user. - EXPECT_NE(SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey create link " - L"HKEY_LOCAL_MACHINE software\\Policies\\google_unit_tests")); - - // In case our code fails, and the call works, we need to delete the new - // link. There is no api for this, so we need to use the NT call. - HKEY key = nullptr; - LRESULT result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, - L"software\\Policies\\google_unit_tests", - REG_OPTION_OPEN_LINK, MAXIMUM_ALLOWED, &key); - - if (!result) { - HMODULE ntdll = GetModuleHandle(L"ntdll.dll"); - NtDeleteKeyFunction NtDeleteKey = reinterpret_cast<NtDeleteKeyFunction>( - GetProcAddress(ntdll, "NtDeleteKey")); - NtDeleteKey(key); - } -} - -TEST(RegistryPolicyTest, TestKeyReadOnlyHKCU) { - TestRunner runner; - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_CURRENT_USER")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_CURRENT_USER\\Software")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_USERS\\.default")); - - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_USERS\\.default\\software")); - - // Tests read access where we only have read-only access. - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest(L"Reg_OpenKey create read HKEY_CURRENT_USER software")); - - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest(L"Reg_OpenKey open read HKEY_CURRENT_USER software")); - - // Tests write access where we only have read-only acess. - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey create write HKEY_CURRENT_USER software")); - - EXPECT_EQ( - SBOX_TEST_DENIED, - runner.RunTest(L"Reg_OpenKey open write HKEY_CURRENT_USER software")); - - // Tests maximum allowed access where we only have read-only access. - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey create maximum_allowed HKEY_CURRENT_USER software")); - - EXPECT_EQ( - SBOX_TEST_SUCCEEDED, - runner.RunTest( - L"Reg_OpenKey open maximum_allowed HKEY_CURRENT_USER software")); -} - -} // namespace sandbox
diff --git a/sandbox/win/src/sandbox_policy.h b/sandbox/win/src/sandbox_policy.h index e8cbba9..5f3f1896 100644 --- a/sandbox/win/src/sandbox_policy.h +++ b/sandbox/win/src/sandbox_policy.h
@@ -29,7 +29,6 @@ SUBSYS_FILES, // Creation and opening of files and pipes. SUBSYS_NAMED_PIPES, // Creation of named pipes. SUBSYS_PROCESS, // Creation of child processes. - SUBSYS_REGISTRY, // Creation and opening of registry keys. SUBSYS_WIN32K_LOCKDOWN, // Win32K Lockdown related policy. SUBSYS_SIGNED_BINARY, // Signed binary policy. SUBSYS_SOCKET // Socket brokering policy. @@ -44,8 +43,6 @@ FILES_ALLOW_DIR_ANY, // Allows open or create with directory semantics // only. NAMEDPIPES_ALLOW_ANY, // Allows creation of a named pipe. - REG_ALLOW_READONLY, // Allows readonly access to a registry key. - REG_ALLOW_ANY, // Allows read and write access to a registry key. FAKE_USER_GDI_INIT, // Fakes user32 and gdi32 initialization. This can // be used to allow the DLLs to load and initialize // even if the process cannot access that subsystem.
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc index 3dbbb293..580968c1 100644 --- a/sandbox/win/src/sandbox_policy_base.cc +++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -27,7 +27,6 @@ #include "sandbox/win/src/process_mitigations.h" #include "sandbox/win/src/process_mitigations_win32k_policy.h" #include "sandbox/win/src/process_thread_policy.h" -#include "sandbox/win/src/registry_policy.h" #include "sandbox/win/src/restricted_token_utils.h" #include "sandbox/win/src/sandbox_policy.h" #include "sandbox/win/src/sandbox_policy_diagnostic.h" @@ -719,13 +718,6 @@ } break; } - case SUBSYS_REGISTRY: { - if (!RegistryPolicy::GenerateRules(pattern, semantics, policy_maker_)) { - NOTREACHED(); - return SBOX_ERROR_BAD_PARAMS; - } - break; - } case SUBSYS_WIN32K_LOCKDOWN: { // Win32k intercept rules only supported on Windows 8 and above. This must // match the version checks in process_mitigations.cc for consistency.
diff --git a/sandbox/win/src/sandbox_policy_diagnostic.cc b/sandbox/win/src/sandbox_policy_diagnostic.cc index b7e5cee..b5077b7b 100644 --- a/sandbox/win/src/sandbox_policy_diagnostic.cc +++ b/sandbox/win/src/sandbox_policy_diagnostic.cc
@@ -175,10 +175,6 @@ return "NtOpenProcessToken"; case IpcTag::NTOPENPROCESSTOKENEX: return "NtOpenProcessTokenEx"; - case IpcTag::NTCREATEKEY: - return "NtCreateKey"; - case IpcTag::NTOPENKEY: - return "NtOpenKey"; case IpcTag::GDI_GDIDLLINITIALIZE: return "GdiDllInitialize"; case IpcTag::GDI_GETSTOCKOBJECT:
diff --git a/sandbox/win/src/top_level_dispatcher.cc b/sandbox/win/src/top_level_dispatcher.cc index f087453..4364a1f 100644 --- a/sandbox/win/src/top_level_dispatcher.cc +++ b/sandbox/win/src/top_level_dispatcher.cc
@@ -17,7 +17,6 @@ #include "sandbox/win/src/named_pipe_dispatcher.h" #include "sandbox/win/src/process_mitigations_win32k_dispatcher.h" #include "sandbox/win/src/process_thread_dispatcher.h" -#include "sandbox/win/src/registry_dispatcher.h" #include "sandbox/win/src/sandbox_policy_base.h" #include "sandbox/win/src/signed_dispatcher.h" #include "sandbox/win/src/socket_dispatcher.h" @@ -50,11 +49,6 @@ ipc_targets_[static_cast<size_t>(IpcTag::CREATETHREAD)] = dispatcher; thread_process_dispatcher_.reset(dispatcher); - dispatcher = new RegistryDispatcher(policy_); - ipc_targets_[static_cast<size_t>(IpcTag::NTCREATEKEY)] = dispatcher; - ipc_targets_[static_cast<size_t>(IpcTag::NTOPENKEY)] = dispatcher; - registry_dispatcher_.reset(dispatcher); - dispatcher = new ProcessMitigationsWin32KDispatcher(policy_); ipc_targets_[static_cast<size_t>(IpcTag::GDI_GDIDLLINITIALIZE)] = dispatcher; ipc_targets_[static_cast<size_t>(IpcTag::GDI_GETSTOCKOBJECT)] = dispatcher;
diff --git a/sandbox/win/src/top_level_dispatcher.h b/sandbox/win/src/top_level_dispatcher.h index 2ebf5ce..a2cf6a2 100644 --- a/sandbox/win/src/top_level_dispatcher.h +++ b/sandbox/win/src/top_level_dispatcher.h
@@ -42,7 +42,6 @@ std::unique_ptr<Dispatcher> filesystem_dispatcher_; std::unique_ptr<Dispatcher> named_pipe_dispatcher_; std::unique_ptr<Dispatcher> thread_process_dispatcher_; - std::unique_ptr<Dispatcher> registry_dispatcher_; std::unique_ptr<Dispatcher> handle_dispatcher_; std::unique_ptr<Dispatcher> process_mitigations_win32k_dispatcher_; std::unique_ptr<Dispatcher> signed_dispatcher_;
diff --git a/sandbox/win/src/unload_dll_test.cc b/sandbox/win/src/unload_dll_test.cc index c983243..fc85c0c 100644 --- a/sandbox/win/src/unload_dll_test.cc +++ b/sandbox/win/src/unload_dll_test.cc
@@ -32,16 +32,13 @@ return rv; } -// Opens an HKLM registry key passed as the first parameter of argv. -SBOX_TESTS_COMMAND int SimpleOpenKey(int argc, wchar_t** argv) { - if (argc != 1) - return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - HKEY handle; - if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, argv[0], 0, KEY_ENUMERATE_SUB_KEYS, - &handle)) { +// Opens the current executable's path. +SBOX_TESTS_COMMAND int OpenExecutablePath(int argc, wchar_t** argv) { + WCHAR full_path[MAX_PATH]; + if (!::GetModuleFileName(nullptr, full_path, MAX_PATH)) + return SBOX_TEST_FIRST_ERROR; + if (::GetFileAttributes(full_path) == INVALID_FILE_ATTRIBUTES) return SBOX_TEST_FAILED; - } - ::CloseHandle(handle); return SBOX_TEST_SUCCEEDED; } @@ -57,9 +54,8 @@ runner.SetTimeout(2000); // Add a registry rule, because that ensures that the interception agent has // more than one item in its internal table. - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); + EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_FILES, + TargetPolicy::FILES_ALLOW_QUERY, L"\\??\\*.exe")); // Note for the puzzled: avicap32.dll is a 64-bit dll in 64-bit versions of // windows so this test and the others just work. @@ -87,18 +83,15 @@ // Add a couple of rules that ensures that the interception agent add EAT // patching on the client which makes sure that the unload dll record does // not interact badly with them. - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_READONLY, - L"HKEY_LOCAL_MACHINE")); - EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_REGISTRY, - TargetPolicy::REG_ALLOW_ANY, - L"HKEY_LOCAL_MACHINE\\Software\\Microsoft")); + EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_FILES, + TargetPolicy::FILES_ALLOW_QUERY, L"\\??\\*.exe")); + EXPECT_TRUE(runner.AddRule(TargetPolicy::SUBSYS_FILES, + TargetPolicy::FILES_ALLOW_QUERY, L"\\??\\*.log")); EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"UseOneDLL L avicap32.dll")); runner.SetTestState(AFTER_REVERT); - EXPECT_EQ(SBOX_TEST_SUCCEEDED, - runner.RunTest(L"SimpleOpenKey software\\microsoft")); + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"OpenExecutablePath")); } } // namespace sandbox
diff --git a/services/device/public/mojom/BUILD.gn b/services/device/public/mojom/BUILD.gn index ce11ca7..961f453c 100644 --- a/services/device/public/mojom/BUILD.gn +++ b/services/device/public/mojom/BUILD.gn
@@ -183,7 +183,6 @@ visibility_blink = [ ":*", "//ash/components/arc/mojom:mojom_blink", - "//components/arc/mojom:mojom_blink", "//third_party/blink/public/mojom/usb:usb_blink", "//third_party/blink/renderer/modules/webusb", "//chrome/browser/ui/webui/usb_internals:mojo_bindings_blink",
diff --git a/storage/browser/file_system/file_system_operation_impl.cc b/storage/browser/file_system/file_system_operation_impl.cc index 17f0d1d..14cc198 100644 --- a/storage/browser/file_system/file_system_operation_impl.cc +++ b/storage/browser/file_system/file_system_operation_impl.cc
@@ -250,7 +250,8 @@ OpenFileCallback callback) { DCHECK(SetPendingOperationType(kOperationOpenFile)); - if (file_flags & (base::File::FLAG_TEMPORARY | base::File::FLAG_WIN_HIDDEN)) { + if (file_flags & + (base::File::FLAG_WIN_TEMPORARY | base::File::FLAG_WIN_HIDDEN)) { std::move(callback).Run(base::File(base::File::FILE_ERROR_FAILED), base::OnceClosure()); return;
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 685e588..5c642443 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1626,6 +1626,42 @@ } ] }, + "chromeos-octopus-chrome": { + "additional_compile_targets": [ + "chromiumos_preflight" + ], + "gtest_tests": [ + { + "args": [ + "--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.base_unittests.filter" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "device_type": "octopus", + "os": "ChromeOS", + "pool": "chrome.tests" + } + ], + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_unittests", + "test_id_prefix": "ninja://base:base_unittests/", + "trigger_script": { + "script": "//testing/trigger_scripts/chromeos_device_trigger.py" + } + } + ] + }, "lacros-amd64-generic-chrome": { "additional_compile_targets": [ "chrome", @@ -1878,7 +1914,7 @@ "has_native_resultdb_integration": true }, "swarming": {}, - "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", + "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && \"dep:lacros_unstable\")", "test": "lacros_all_tast_tests", "test_id_prefix": "ninja://chromeos/lacros:lacros_all_tast_tests/", "timeout_sec": 10800
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 6f32970..414464b2 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -5796,7 +5796,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5884,7 +5884,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -6060,7 +6060,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -6148,7 +6148,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 754eb26..5c7eba8 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -43665,7 +43665,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43753,7 +43753,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43929,7 +43929,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44017,7 +44017,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44268,7 +44268,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44356,7 +44356,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44532,7 +44532,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44620,7 +44620,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44871,7 +44871,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -44959,7 +44959,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -45135,7 +45135,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M96", - "revision": "version:96.0.4664.80" + "revision": "version:96.0.4664.81" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -45223,7 +45223,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M97", - "revision": "version:97.0.4692.38" + "revision": "version:97.0.4692.40" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.angle.json b/testing/buildbot/chromium.angle.json index a47efcd..14a87e20 100644 --- a/testing/buildbot/chromium.angle.json +++ b/testing/buildbot/chromium.angle.json
@@ -610,8 +610,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -635,8 +635,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -658,7 +658,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -676,8 +676,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -711,8 +711,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -748,8 +748,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -785,8 +785,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -923,8 +923,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -949,8 +949,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -976,8 +976,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1002,8 +1002,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1028,8 +1028,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1054,8 +1054,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1080,8 +1080,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1106,8 +1106,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1133,8 +1133,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1160,8 +1160,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1187,8 +1187,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1214,8 +1214,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1241,8 +1241,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1268,8 +1268,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1295,8 +1295,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1321,8 +1321,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1347,8 +1347,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1373,8 +1373,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1400,8 +1400,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1425,8 +1425,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1450,8 +1450,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -2342,7 +2342,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -2360,7 +2360,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2397,7 +2397,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2434,7 +2434,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2471,7 +2471,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2508,7 +2508,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2544,7 +2544,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2682,7 +2682,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2709,7 +2709,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2735,7 +2735,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2762,7 +2762,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2788,7 +2788,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2814,7 +2814,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2840,7 +2840,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2866,7 +2866,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2892,7 +2892,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2918,7 +2918,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2945,7 +2945,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2972,7 +2972,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2999,7 +2999,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3026,7 +3026,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3053,7 +3053,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3080,7 +3080,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3107,7 +3107,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3134,7 +3134,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3161,7 +3161,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3187,7 +3187,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3213,7 +3213,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3239,7 +3239,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3265,7 +3265,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3290,7 +3290,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3315,7 +3315,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }
diff --git a/testing/buildbot/chromium.dawn.json b/testing/buildbot/chromium.dawn.json index b1c29ef4..0f899a2 100644 --- a/testing/buildbot/chromium.dawn.json +++ b/testing/buildbot/chromium.dawn.json
@@ -194,6 +194,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -227,6 +228,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -274,8 +276,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -301,8 +303,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -328,8 +330,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -355,8 +357,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -381,8 +383,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -405,8 +407,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -435,8 +437,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -448,6 +450,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -466,8 +469,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -481,6 +484,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -499,8 +503,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -702,6 +706,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -735,6 +740,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -782,8 +788,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -809,8 +815,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -836,8 +842,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -863,8 +869,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -889,8 +895,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -913,8 +919,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -943,8 +949,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -956,6 +962,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -974,8 +981,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -989,6 +996,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--no-xvfb", "--additional-driver-flag=--enable-features=UseSkiaRenderer,Vulkan" ], @@ -1007,8 +1015,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1227,6 +1235,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -1262,6 +1271,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -1484,6 +1494,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -1517,6 +1528,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -1827,6 +1839,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -1862,6 +1875,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -2084,6 +2098,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -2117,6 +2132,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--platform=mac-mac11" ], "isolate_name": "webgpu_blink_web_tests", @@ -2163,7 +2179,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2194,7 +2210,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2225,7 +2241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2255,7 +2271,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2283,7 +2299,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2318,7 +2334,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2336,6 +2352,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64", "--time-out-ms=48000" ], @@ -2354,7 +2371,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }, @@ -2558,6 +2575,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -2590,6 +2608,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -2635,7 +2654,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2661,7 +2680,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2687,7 +2706,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2713,7 +2732,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2738,7 +2757,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2761,7 +2780,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2791,7 +2810,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2804,6 +2823,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -2821,7 +2841,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2836,6 +2856,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -2853,7 +2874,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3050,6 +3071,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -3082,6 +3104,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -3127,7 +3150,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3153,7 +3176,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3179,7 +3202,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3205,7 +3228,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3230,7 +3253,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3253,7 +3276,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3283,7 +3306,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3296,6 +3319,7 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -3313,7 +3337,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3328,6 +3352,7 @@ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox", "--target=Release_x64" ], "isolate_name": "webgpu_blink_web_tests", @@ -3345,7 +3370,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3543,7 +3568,8 @@ { "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--flag-specific=webgpu" + "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -3574,7 +3600,8 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", - "--time-out-ms=30000" + "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -3619,7 +3646,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3645,7 +3672,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3671,7 +3698,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3697,7 +3724,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3722,7 +3749,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3745,7 +3772,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3775,7 +3802,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3787,7 +3814,8 @@ { "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--flag-specific=webgpu" + "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -3804,7 +3832,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3818,7 +3846,8 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", - "--time-out-ms=30000" + "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -3835,7 +3864,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4031,7 +4060,8 @@ { "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--flag-specific=webgpu" + "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -4062,7 +4092,8 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", - "--time-out-ms=30000" + "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -4107,7 +4138,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4133,7 +4164,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4159,7 +4190,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4185,7 +4216,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4210,7 +4241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4233,7 +4264,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4263,7 +4294,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4275,7 +4306,8 @@ { "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", - "--flag-specific=webgpu" + "--flag-specific=webgpu", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -4292,7 +4324,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4306,7 +4338,8 @@ "args": [ "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--flag-specific=webgpu-with-partial-backend-validation", - "--time-out-ms=30000" + "--time-out-ms=30000", + "--additional-driver-flag=--disable-gpu-sandbox" ], "isolate_name": "webgpu_blink_web_tests", "merge": { @@ -4323,7 +4356,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 94f2c789..255527b 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -454,8 +454,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -479,8 +479,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -504,8 +504,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -532,8 +532,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -557,8 +557,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -580,8 +580,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -603,7 +603,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -621,8 +621,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -656,8 +656,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -693,8 +693,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -730,8 +730,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7100,8 +7100,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7125,8 +7125,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7153,8 +7153,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7178,8 +7178,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7201,8 +7201,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7221,8 +7221,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7258,8 +7258,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7293,8 +7293,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7328,8 +7328,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7363,8 +7363,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7384,7 +7384,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -7402,8 +7402,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7446,8 +7446,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7490,8 +7490,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7526,8 +7526,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7561,8 +7561,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -7597,8 +7597,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8303,7 +8303,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8329,7 +8329,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8355,7 +8355,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8385,7 +8385,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8412,7 +8412,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8441,7 +8441,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8470,7 +8470,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8498,7 +8498,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8524,7 +8524,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8548,7 +8548,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8569,7 +8569,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8607,7 +8607,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8643,7 +8643,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8679,7 +8679,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8715,7 +8715,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8755,7 +8755,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8800,7 +8800,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8836,7 +8836,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8881,7 +8881,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8918,7 +8918,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8954,7 +8954,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -8992,7 +8992,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9030,7 +9030,7 @@ "dimension_sets": [ { "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9061,8 +9061,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9086,8 +9086,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9111,8 +9111,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9139,8 +9139,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9164,8 +9164,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9187,8 +9187,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -9207,8 +9207,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11211,8 +11211,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11236,8 +11236,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11261,8 +11261,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11289,8 +11289,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11314,8 +11314,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11337,8 +11337,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11357,8 +11357,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11394,8 +11394,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11429,8 +11429,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11464,8 +11464,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11499,8 +11499,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11520,7 +11520,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -11538,8 +11538,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11582,8 +11582,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11617,8 +11617,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11661,8 +11661,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11697,8 +11697,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11732,8 +11732,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11769,8 +11769,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -11806,8 +11806,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12429,8 +12429,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12457,8 +12457,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12494,8 +12494,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12529,8 +12529,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12564,8 +12564,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12599,8 +12599,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12643,8 +12643,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12679,8 +12679,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12715,8 +12715,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12758,8 +12758,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12795,8 +12795,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -12838,8 +12838,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -23944,8 +23944,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -23970,8 +23970,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -23994,8 +23994,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24014,8 +24014,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24037,7 +24037,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -24055,8 +24055,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24090,8 +24090,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24125,8 +24125,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24156,8 +24156,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24193,8 +24193,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -24230,8 +24230,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -26605,7 +26605,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26631,7 +26631,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26655,7 +26655,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26680,7 +26680,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26706,7 +26706,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26726,7 +26726,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26746,7 +26746,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26770,7 +26770,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26793,7 +26793,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -26811,7 +26811,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26846,7 +26846,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26878,7 +26878,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26912,7 +26912,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26943,7 +26943,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -26980,7 +26980,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27017,7 +27017,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27054,7 +27054,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27090,7 +27090,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27127,7 +27127,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27163,7 +27163,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27199,7 +27199,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27234,7 +27234,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27263,7 +27263,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27288,7 +27288,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27313,7 +27313,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27340,7 +27340,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27364,7 +27364,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27387,7 +27387,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27412,7 +27412,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27438,7 +27438,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27458,7 +27458,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27478,7 +27478,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27501,7 +27501,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27525,7 +27525,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27562,7 +27562,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27597,7 +27597,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27632,7 +27632,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27667,7 +27667,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27688,7 +27688,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -27706,7 +27706,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27750,7 +27750,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27794,7 +27794,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27830,7 +27830,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27865,7 +27865,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27901,7 +27901,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27938,7 +27938,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -27975,7 +27975,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -28011,7 +28011,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -28083,7 +28083,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -29961,6 +29961,42 @@ ] }, "Win10 FYI x64 Release (NVIDIA GeForce GTX 1660)": { + "isolated_scripts": [ + { + "args": [ + "noop_sleep", + "--show-stdout", + "--browser=release_x64", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "noop_sleep_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "10de:2184-27.21.14.5638", + "os": "Windows-10-18363", + "pool": "chromium.tests.gpu" + } + ], + "expiration": 21600, + "idempotent": false, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" + } + ] + }, + "Win10 FYI x64 Release (NVIDIA)": { "gtest_tests": [ { "args": [ @@ -29982,7 +30018,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 }, @@ -30008,7 +30043,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -30034,7 +30068,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_white_box_tests", @@ -30063,7 +30096,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "browser_tests", @@ -30090,7 +30122,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 }, @@ -30115,7 +30146,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gl_unittests", @@ -30139,7 +30169,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gles2_conform_test", @@ -30165,7 +30194,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gles2_conform_test", @@ -30192,7 +30220,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gles2_conform_test", @@ -30213,7 +30240,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -30234,7 +30260,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "swiftshader_unittests", @@ -30258,7 +30283,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vulkan_tests", @@ -30283,7 +30307,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "xr_browser_tests", @@ -30321,7 +30344,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -30357,7 +30379,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -30393,7 +30414,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -30429,7 +30449,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -30469,7 +30488,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -30514,895 +30532,6 @@ "pool": "chromium.tests.gpu" } ], - "expiration": 21600, - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "pixel_skia_gold_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "screenshot_sync_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "trace_test", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "trace_test", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=d3d11 --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_d3d11_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=d3d11 --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_d3d11_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=d3d9 --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_d3d9_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-unsafe-fast-js-calls --enable-fake-no-alloc-direct-call-for-testing --use-gl=angle --use-cmd-decoder=passthrough --force_high_performance_gpu" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_fast_call_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-angle=vulkan --use-cmd-decoder=passthrough --force_high_performance_gpu" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl_conformance_vulkan_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - } - ] - }, - "Win10 FYI x64 Release (NVIDIA)": { - "gtest_tests": [ - { - "args": [ - "angle_end2end_tests", - "--gtest_filter=-*Vulkan_SwiftShader*", - "--bot-mode" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test": "angle_end2end_tests", - "test_id_prefix": "ninja://third_party/angle/src/tests:angle_end2end_tests/", - "use_isolated_scripts_api": true - }, - { - "args": [ - "angle_unittests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "angle_unittests", - "test_id_prefix": "ninja://third_party/angle/src/tests:angle_unittests/", - "use_isolated_scripts_api": true - }, - { - "args": [ - "angle_white_box_tests", - "--bot-mode" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "angle_white_box_tests", - "test_id_prefix": "ninja://third_party/angle/src/tests:angle_white_box_tests/", - "use_isolated_scripts_api": true - }, - { - "args": [ - "--enable-gpu", - "--test-launcher-bot-mode", - "--test-launcher-jobs=1", - "--gtest_filter=TabCaptureApiPixelTest.EndToEnd*" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "tab_capture_end2end_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "browser_tests", - "test_id_prefix": "ninja://chrome/test:browser_tests/" - }, - { - "args": [ - "--use-cmd-decoder=passthrough", - "--use-gl=angle", - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gl_tests_passthrough", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test": "gl_tests", - "test_id_prefix": "ninja://gpu:gl_tests/" - }, - { - "args": [ - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gl_unittests", - "test_id_prefix": "ninja://ui/gl:gl_unittests/" - }, - { - "args": [ - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gles2_conform_test", - "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/" - }, - { - "args": [ - "--use-gpu-in-tests", - "--use-angle=d3d9" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gles2_conform_d3d9_test", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gles2_conform_test", - "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/" - }, - { - "args": [ - "--use-gpu-in-tests", - "--use-angle=gl", - "--disable-gpu-sandbox" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "gles2_conform_gl_test", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gles2_conform_test", - "test_id_prefix": "ninja://gpu/gles2_conform_support:gles2_conform_test/" - }, - { - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "gpu_unittests", - "test_id_prefix": "ninja://gpu:gpu_unittests/" - }, - { - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "swiftshader_unittests", - "test_id_prefix": "ninja://third_party/swiftshader/tests/GLESUnitTests:swiftshader_unittests/" - }, - { - "args": [ - "--use-gpu-in-tests" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "vulkan_tests", - "test_id_prefix": "ninja://gpu/vulkan:vulkan_tests/" - }, - { - "args": [ - "--ignore-runtime-requirements=*" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "name": "xr_browser_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "xr_browser_tests", - "test_id_prefix": "ninja://chrome/test:xr_browser_tests/" - } - ], - "isolated_scripts": [ - { - "args": [ - "context_lost", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "context_lost_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "gpu_process", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gpu_process_launch_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "hardware_accelerated_feature_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "info_collection", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--expected-vendor-id", - "10de", - "--expected-device-id", - "1cb3" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "info_collection_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-cmd-decoder=passthrough --use-gl=angle", - "--dont-restore-color-profile-after-test", - "--test-machine-name", - "${buildername}", - "--git-revision=${got_revision}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "maps_pixel_passthrough_test", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-27.21.14.5148", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], "idempotent": false, "service_account": "chrome-gpu-gold@chops-service-accounts.iam.gserviceaccount.com" }, @@ -31430,7 +30559,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31473,7 +30602,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31500,7 +30629,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31535,7 +30664,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31570,7 +30699,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31607,7 +30736,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31644,7 +30773,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31681,7 +30810,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31717,7 +30846,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31754,7 +30883,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31790,7 +30919,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31824,7 +30953,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31847,7 +30976,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31867,7 +30996,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31913,7 +31042,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31950,7 +31079,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -31979,7 +31108,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32004,7 +31133,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32029,7 +31158,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32057,7 +31186,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32083,7 +31212,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32107,7 +31236,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32130,7 +31259,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32155,7 +31284,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32181,7 +31310,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32201,7 +31330,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32221,7 +31350,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32244,7 +31373,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32268,7 +31397,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32305,7 +31434,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32340,7 +31469,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32375,7 +31504,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32410,7 +31539,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32431,7 +31560,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -32449,7 +31578,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32493,7 +31622,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32525,7 +31654,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32568,7 +31697,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32594,7 +31723,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32629,7 +31758,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32664,7 +31793,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32701,7 +31830,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32738,7 +31867,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32775,7 +31904,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32811,7 +31940,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32848,7 +31977,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -32884,7 +32013,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }
diff --git a/testing/buildbot/chromium.gpu.json b/testing/buildbot/chromium.gpu.json index f9ca38c..791f3da09 100644 --- a/testing/buildbot/chromium.gpu.json +++ b/testing/buildbot/chromium.gpu.json
@@ -514,8 +514,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -542,8 +542,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -567,8 +567,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -604,8 +604,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -639,8 +639,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -675,8 +675,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -710,8 +710,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -745,8 +745,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -766,7 +766,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -784,8 +784,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -828,8 +828,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -872,8 +872,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -908,8 +908,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -943,8 +943,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -979,8 +979,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1007,8 +1007,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1035,8 +1035,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1060,8 +1060,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1097,8 +1097,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1132,8 +1132,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1168,8 +1168,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1203,8 +1203,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1238,8 +1238,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1259,7 +1259,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -1277,8 +1277,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1321,8 +1321,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1365,8 +1365,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1401,8 +1401,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1436,8 +1436,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1472,8 +1472,8 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -3588,7 +3588,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3616,7 +3616,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3642,7 +3642,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3666,7 +3666,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3690,7 +3690,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3727,7 +3727,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3762,7 +3762,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3797,7 +3797,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3832,7 +3832,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3853,7 +3853,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -3871,7 +3871,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3915,7 +3915,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3959,7 +3959,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -3995,7 +3995,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4030,7 +4030,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4066,7 +4066,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4094,7 +4094,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4122,7 +4122,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4148,7 +4148,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4172,7 +4172,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4196,7 +4196,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4233,7 +4233,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4268,7 +4268,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4303,7 +4303,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4338,7 +4338,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4359,7 +4359,7 @@ "--expected-vendor-id", "10de", "--expected-device-id", - "1cb3" + "2184" ], "isolate_name": "telemetry_gpu_integration_test", "merge": { @@ -4377,7 +4377,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4421,7 +4421,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4465,7 +4465,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4492,7 +4492,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4527,7 +4527,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4562,7 +4562,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -4598,7 +4598,7 @@ "containment_type": "AUTO", "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }
diff --git a/testing/buildbot/client.v8.fyi.json b/testing/buildbot/client.v8.fyi.json index 164572a3..a7f16a5 100644 --- a/testing/buildbot/client.v8.fyi.json +++ b/testing/buildbot/client.v8.fyi.json
@@ -481,8 +481,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -515,8 +515,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -549,8 +549,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -583,8 +583,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -626,8 +626,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -669,8 +669,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -704,8 +704,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -738,8 +738,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -774,8 +774,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -810,8 +810,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -849,8 +849,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -883,8 +883,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -917,8 +917,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -951,8 +951,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -994,8 +994,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1037,8 +1037,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1072,8 +1072,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1106,8 +1106,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1142,8 +1142,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1178,8 +1178,8 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-418.56", - "os": "Ubuntu-19.04", + "gpu": "10de:2184-440.100", + "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", "pool": "chromium.tests.gpu" } ], @@ -1916,7 +1916,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -1950,7 +1950,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -1984,7 +1984,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2018,7 +2018,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2061,7 +2061,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2104,7 +2104,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2139,7 +2139,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2173,7 +2173,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2209,7 +2209,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" } @@ -2245,7 +2245,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "gpu": "10de:1cb3-27.21.14.5148", + "gpu": "10de:2184-27.21.14.5638", "os": "Windows-10-18363", "pool": "chromium.tests.gpu" }
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 274e0e7..b9f0da0 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -1189,7 +1189,7 @@ "cros_img": "kevin-release/R98-14362.0.0", "name": "lacros_all_tast_tests_KEVIN_LKGM", "swarming": {}, - "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", + "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && \"dep:lacros_unstable\")", "test": "lacros_all_tast_tests", "test_id_prefix": "ninja://chromeos/lacros:lacros_all_tast_tests/", "timeout_sec": 10800
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 04a7bf70..9c53185 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -618,19 +618,19 @@ 'swarming': { 'dimensions': { 'gpu': '10de:2184-440.100', - 'os': 'Ubuntu-18.04.5', + 'os': 'Ubuntu-18.04.5|Ubuntu-18.04.6', 'pool': 'chromium.tests.gpu', }, }, }, - 'linux_nvidia_quadro_p400_stable': { + 'linux_nvidia_gtx_1660_stable': { 'swarming': { 'dimensions': { - 'gpu': '10de:1cb3-418.56', - 'os': 'Ubuntu-19.04', + 'gpu': '10de:2184-440.100', + 'os': 'Ubuntu-18.04.5|Ubuntu-18.04.6', 'pool': 'chromium.tests.gpu', - } - } + }, + }, }, 'lollipop': { 'swarming': { @@ -1070,7 +1070,7 @@ 'win10_intel_hd_630_stable_dimension_set': { 'swarming': { # We use explicit 'dimension_sets' instead of 'dimensions' since this is - # used in conjunction with 'win10_nvidia_quadro_p400_stable_dimension_set' + # used in conjunction with 'win10_nvidia_gtx_1660_stable_dimension_set' # to trigger tests on multiple configurations. 'dimension_sets': [ { @@ -1081,7 +1081,7 @@ ], }, }, - 'win10_nvidia_geforce_gtx_1660': { + 'win10_nvidia_gtx_1660_experimental': { 'swarming': { 'dimensions': { 'gpu': '10de:2184-27.21.14.5638', @@ -1090,32 +1090,23 @@ }, }, }, - 'win10_nvidia_quadro_p400_experimental': { + 'win10_nvidia_gtx_1660_stable': { 'swarming': { 'dimensions': { - 'gpu': '10de:1cb3-27.21.14.5148', + 'gpu': '10de:2184-27.21.14.5638', 'os': 'Windows-10-18363', 'pool': 'chromium.tests.gpu', }, }, }, - 'win10_nvidia_quadro_p400_stable': { - 'swarming': { - 'dimensions': { - 'gpu': '10de:1cb3-27.21.14.5148', - 'os': 'Windows-10-18363', - 'pool': 'chromium.tests.gpu', - }, - }, - }, - # Version of win10_nvidia_quadro_p400_stable that uses 'dimension_sets' + # Version of win10_nvidia_gtx_1660_stable that uses 'dimension_sets' # instead of 'dimensions' so it can be used to trigger tests on multiple # configurations. - 'win10_nvidia_quadro_p400_stable_dimension_set': { + 'win10_nvidia_gtx_1660_stable_dimension_set': { 'swarming': { 'dimension_sets': [ { - 'gpu': '10de:1cb3-27.21.14.5148', + 'gpu': '10de:2184-27.21.14.5638', 'os': 'Windows-10-18363', 'pool': 'chromium.tests.gpu', },
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index b6ed105..00537ae 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -4048,6 +4048,9 @@ '--flag-specific=webgpu-with-backend-validation', # Increase the timeout when using backend validation layers (crbug.com/1208253) '--time-out-ms=30000', + # TODO(crbug.com/1274975): Remove this once loading on newer NVIDIA + # GPUs is fixed. + '--additional-driver-flag=--disable-gpu-sandbox', ], 'win64_args': [ '--target=Release_x64' ], 'mac_args': [ @@ -4080,6 +4083,9 @@ # crbug.com/953991 Ensure WebGPU is ready before running tests '--initialize-webgpu-adapter-at-startup-timeout-ms=60000', '--flag-specific=webgpu', + # TODO(crbug.com/1274975): Remove this once loading on newer NVIDIA + # GPUs is fixed. + '--additional-driver-flag=--disable-gpu-sandbox', ], 'win64_args': [ '--target=Release_x64' ], 'mac_args': [ @@ -4116,6 +4122,9 @@ '--flag-specific=webgpu-with-partial-backend-validation', # Increase the timeout when using backend validation layers (crbug.com/1208253) '--time-out-ms=30000', + # TODO(crbug.com/1274975): Remove this once loading on newer NVIDIA + # GPUs is fixed. + '--additional-driver-flag=--disable-gpu-sandbox', ], 'win64_args': [ '--target=Release_x64' ], 'mac_args': [ @@ -4290,14 +4299,12 @@ }, }, - # create this temporary lacros arm test suites that runs on skylab, which - # focuses on the tast tests; create this new suite instead of using - # lacros_skylab_tests which may be altered later - # TODO(crbug.com/1247425): remove it and use lacros_skylab_poc instead if - # we want to add ozone unit test + # create this temporary lacros arm test suites that runs on skylab + # TODO(crbug.com/1247425): remove it if it is the same as + # lacros_skylab_poc 'lacros_skylab_arm_tests': { 'lacros_all_tast_tests': { - 'tast_expr': '("group:mainline" && "dep:lacros" && !informational)', + 'tast_expr': '("group:mainline" && "dep:lacros" && "dep:lacros_unstable")', 'timeout_sec': 10800, }, },
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 6819440..84be8c8 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -363,7 +363,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M97', - 'revision': 'version:97.0.4692.38', + 'revision': 'version:97.0.4692.40', } ], }, @@ -387,7 +387,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M96', - 'revision': 'version:96.0.4664.80', + 'revision': 'version:96.0.4664.81', } ], }, @@ -435,7 +435,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M97', - 'revision': 'version:97.0.4692.38', + 'revision': 'version:97.0.4692.40', } ], }, @@ -459,7 +459,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M96', - 'revision': 'version:96.0.4664.80', + 'revision': 'version:96.0.4664.81', } ], }, @@ -507,7 +507,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M97', - 'revision': 'version:97.0.4692.38', + 'revision': 'version:97.0.4692.40', } ], }, @@ -531,7 +531,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M96', - 'revision': 'version:96.0.4664.80', + 'revision': 'version:96.0.4664.81', } ], },
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index f87f3c9..064f01af 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -140,6 +140,27 @@ }, 'os_type': 'chromeos' }, + 'chromeos-octopus-chrome': { + 'additional_compile_targets': [ + 'chromiumos_preflight', + ], + 'mixins': [ + 'has_native_resultdb_integration', + ], + 'test_suites': { + 'gtest_tests': 'chromeos_device_only_gtests', + }, + 'swarming': { + 'dimension_sets': [ + { + 'os': 'ChromeOS', + 'device_type': 'octopus', + 'pool': 'chrome.tests', + }, + ], + }, + 'os_type': 'chromeos' + }, 'lacros-amd64-generic-chrome': { 'additional_compile_targets': [ 'chrome', @@ -1265,7 +1286,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_common_gtests_passthrough', @@ -1284,7 +1305,7 @@ 'linux-angle-nvidia': { 'os_type': 'linux', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_angle_linux_nvidia_gtests', @@ -1330,7 +1351,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_angle_win_intel_nvidia_telemetry_tests', @@ -1348,7 +1369,7 @@ 'win10-angle-x64-nvidia': { 'os_type': 'win', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_angle_win_nvidia_gtests', @@ -2117,7 +2138,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -2139,7 +2160,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -2224,7 +2245,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable_dimension_set', + 'win10_nvidia_gtx_1660_stable_dimension_set', 'win10_intel_hd_630_stable_dimension_set', ], 'test_suites': { @@ -2249,7 +2270,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -2271,7 +2292,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -2295,7 +2316,7 @@ 'os_type': 'win', 'browser_config': 'release', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -2317,7 +2338,7 @@ 'os_type': 'win', 'browser_config': 'release', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', @@ -3805,7 +3826,7 @@ 'browser_config': 'debug', 'os_type': 'linux', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_desktop_passthrough_gtests', @@ -3816,7 +3837,7 @@ 'browser_config': 'release', 'os_type': 'linux', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_desktop_passthrough_gtests', @@ -3873,7 +3894,7 @@ 'browser_config': 'debug_x64', 'os_type': 'win', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_win_gtests', @@ -3884,7 +3905,7 @@ 'browser_config': 'release_x64', 'os_type': 'win', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_win_gtests', @@ -3932,7 +3953,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_angle_linux_gtests', @@ -4133,7 +4154,7 @@ 'browser_config': 'debug', 'os_type': 'linux', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_linux_debug_gtests', @@ -4172,7 +4193,7 @@ # need the browser_config parameter. 'os_type': 'linux', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { # This bot doesn't run any browser-based tests @@ -4222,7 +4243,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_linux_release_gtests', @@ -4256,7 +4277,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_vulkan_gtests', @@ -4466,7 +4487,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_linux_optional_gtests', @@ -4525,7 +4546,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_win_optional_gtests', @@ -4538,7 +4559,7 @@ 'os_type': 'win', 'browser_config': 'debug_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_noop_sleep_telemetry_test', @@ -4548,7 +4569,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_noop_sleep_telemetry_test', @@ -4558,7 +4579,7 @@ 'os_type': 'win', 'browser_config': 'debug_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_win_gtests', @@ -4587,7 +4608,7 @@ 'browser_config': 'release_x64', 'mixins': [ 'limited_capacity_bot', - 'win10_nvidia_quadro_p400_experimental', + 'win10_nvidia_gtx_1660_experimental', ], # When the experimental driver is identical to the stable driver, this # should be running the gpu_noop_sleep_telemetry_test. Otherwise, it @@ -4631,18 +4652,17 @@ 'browser_config': 'release_x64', 'mixins': [ 'limited_capacity_bot', - 'win10_nvidia_geforce_gtx_1660', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { - 'gtest_tests': 'gpu_fyi_win_gtests', - 'gpu_telemetry_tests': 'gpu_fyi_win_release_telemetry_tests', + 'gpu_telemetry_tests': 'gpu_noop_sleep_telemetry_test', }, }, 'Win10 FYI x64 Release (NVIDIA)': { 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_win_gtests', @@ -4654,7 +4674,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'isolated_scripts': 'win_specific_xr_perf_tests', @@ -4664,7 +4684,7 @@ 'os_type': 'win', 'browser_config': 'release_x64', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_skia_renderer_dawn_gtests', @@ -4675,7 +4695,7 @@ 'browser_config': 'release', 'os_type': 'win', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gtest_tests': 'gpu_fyi_win_gtests', @@ -6203,7 +6223,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_v8_desktop_passthrough_telemetry_tests', @@ -6213,7 +6233,7 @@ 'os_type': 'linux', 'browser_config': 'release', 'mixins': [ - 'linux_nvidia_quadro_p400_stable', + 'linux_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_v8_desktop_passthrough_telemetry_tests', @@ -6347,7 +6367,7 @@ 'os_type': 'win', 'browser_config': 'release', 'mixins': [ - 'win10_nvidia_quadro_p400_stable', + 'win10_nvidia_gtx_1660_stable', ], 'test_suites': { 'gpu_telemetry_tests': 'gpu_v8_desktop_passthrough_telemetry_tests',
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index ff3103a..b4b84c66 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2103,21 +2103,6 @@ ] } ], - "ChromeOSWallpaperMigration": [ - { - "platforms": [ - "chromeos" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "WallpaperWebUI" - ] - } - ] - } - ], "ChromeShareLongScreenshot": [ { "platforms": [ @@ -5856,6 +5841,35 @@ ] } ], + "PageContentAnnotationsDesktop": [ + { + "platforms": [ + "chromeos", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "PageContentAnnotationsWithVisibility_JourneysWithOmniboxAction_20211202", + "params": { + "annotate_title_instead_of_page_content": "true", + "bag_of_words_entities": "false", + "extract_related_searches": "true", + "min_page_topics_model_version_for_visibility": "2110051800", + "models_to_execute": "OPTIMIZATION_TARGET_PAGE_TOPICS,OPTIMIZATION_TARGET_PAGE_ENTITIES", + "write_to_history_service": "true" + }, + "enable_features": [ + "Journeys", + "JourneysOmniboxAction", + "LoadModelFileForEachExecution", + "PageContentAnnotations" + ] + } + ] + } + ], "PageInfoAboutThisSite": [ { "platforms": [ @@ -7090,11 +7104,7 @@ "SendTabToSelfV2": [ { "platforms": [ - "android", - "chromeos", - "linux", - "mac", - "windows" + "android" ], "experiments": [ {
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc index 7f7c6d8..cbd00a0 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
@@ -840,7 +840,7 @@ V8ScriptValueDeserializer(script_state, input).Deserialize(); ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As<v8::Object>()); - EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); + EXPECT_EQ(gfx::Size(2, 1), new_image_data->Size()); SkPixmap new_pm = new_image_data->GetSkPixmap(); EXPECT_EQ(8u, new_pm.computeByteSize()); EXPECT_EQ(200u, new_pm.addr32()[0]); @@ -856,7 +856,7 @@ V8ScriptValueDeserializer(script_state, input).Deserialize(); ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As<v8::Object>()); - EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); + EXPECT_EQ(gfx::Size(2, 1), new_image_data->Size()); SkPixmap new_pm = new_image_data->GetSkPixmap(); EXPECT_EQ(kRGBA_8888_SkColorType, new_pm.info().colorType()); EXPECT_EQ(8u, new_pm.computeByteSize()); @@ -875,7 +875,7 @@ V8ScriptValueDeserializer(script_state, input).Deserialize(); ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As<v8::Object>()); - EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); + EXPECT_EQ(gfx::Size(2, 1), new_image_data->Size()); ImageDataSettings* new_image_data_settings = new_image_data->getSettings(); EXPECT_EQ("display-p3", new_image_data_settings->colorSpace()); EXPECT_EQ("float32", new_image_data_settings->storageFormat()); @@ -1054,7 +1054,7 @@ ImageBitmap* new_image_bitmap = V8ImageBitmap::ToImpl(result.As<v8::Object>()); ASSERT_TRUE(new_image_bitmap->BitmapImage()); - ASSERT_EQ(IntSize(10, 7), new_image_bitmap->Size()); + ASSERT_EQ(gfx::Size(10, 7), new_image_bitmap->Size()); // Check that the pixel at (3, 3) is red. uint8_t pixel[4] = {}; @@ -1085,7 +1085,7 @@ ImageBitmap* new_image_bitmap = V8ImageBitmap::ToImpl(result.As<v8::Object>()); ASSERT_TRUE(new_image_bitmap->BitmapImage()); - ASSERT_EQ(IntSize(10, 7), new_image_bitmap->Size()); + ASSERT_EQ(gfx::Size(10, 7), new_image_bitmap->Size()); // Check the color settings. SkImageInfo bitmap_info = new_image_bitmap->GetBitmapSkImageInfo(); @@ -1139,7 +1139,7 @@ ASSERT_TRUE(V8ImageBitmap::HasInstance(result, scope.GetIsolate())); ImageBitmap* new_image_bitmap = V8ImageBitmap::ToImpl(result.As<v8::Object>()); - ASSERT_EQ(IntSize(2, 1), new_image_bitmap->Size()); + ASSERT_EQ(gfx::Size(2, 1), new_image_bitmap->Size()); // Check that the pixels are opaque red and green, respectively. uint8_t pixels[8] = {}; @@ -1165,7 +1165,7 @@ ASSERT_TRUE(V8ImageBitmap::HasInstance(result, scope.GetIsolate())); ImageBitmap* new_image_bitmap = V8ImageBitmap::ToImpl(result.As<v8::Object>()); - ASSERT_EQ(IntSize(2, 1), new_image_bitmap->Size()); + ASSERT_EQ(gfx::Size(2, 1), new_image_bitmap->Size()); // Check the color settings. SkImageInfo bitmap_info = new_image_bitmap->GetBitmapSkImageInfo(); @@ -1320,7 +1320,7 @@ ImageBitmap* new_image_bitmap = V8ImageBitmap::ToImpl(result.As<v8::Object>()); ASSERT_TRUE(new_image_bitmap->BitmapImage()); - ASSERT_EQ(IntSize(10, 7), new_image_bitmap->Size()); + ASSERT_EQ(gfx::Size(10, 7), new_image_bitmap->Size()); // Check that the pixel at (3, 3) is red. uint8_t pixel[4] = {}; @@ -1351,7 +1351,7 @@ ASSERT_TRUE(V8OffscreenCanvas::HasInstance(result, scope.GetIsolate())); OffscreenCanvas* new_canvas = V8OffscreenCanvas::ToImpl(result.As<v8::Object>()); - EXPECT_EQ(IntSize(10, 7), new_canvas->Size()); + EXPECT_EQ(gfx::Size(10, 7), new_canvas->Size()); EXPECT_EQ(519, new_canvas->PlaceholderCanvasId()); EXPECT_TRUE(canvas->IsNeutered()); EXPECT_FALSE(new_canvas->IsNeutered());
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.cc b/third_party/blink/renderer/core/animation/compositor_animations.cc index 0374def..6e90154 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations.cc
@@ -804,7 +804,7 @@ Keyframe::PropertySpecificKeyframe* keyframe, const CompositorKeyframeValue* value, const TimingFunction& keyframe_timing_function, - const FloatSize& box_size) { + const gfx::SizeF& box_size) { CompositorTransformOperations ops; ToCompositorTransformOperations( To<CompositorKeyframeTransform>(value)->GetTransformOperations(), &ops, @@ -899,9 +899,9 @@ case CSSPropertyID::kScale: case CSSPropertyID::kTranslate: case CSSPropertyID::kTransform: { - FloatSize box_size(ComputedStyleUtils::ReferenceBoxForTransform( - *target_element.GetLayoutObject()) - .size()); + gfx::SizeF box_size(ComputedStyleUtils::ReferenceBoxForTransform( + *target_element.GetLayoutObject()) + .size()); auto transform_curve = std::make_unique<CompositorTransformAnimationCurve>(); AddKeyframesToCurve(*transform_curve, values, box_size);
diff --git a/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc b/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc index 9635a4e..8e07d048 100644 --- a/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc +++ b/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc
@@ -20,7 +20,7 @@ } InterpolableAspectRatio::InterpolableAspectRatio( - const FloatSize& aspect_ratio) { + const gfx::SizeF& aspect_ratio) { // The StyleAspectRatio::IsAuto check in MaybeCreate should return true if we // have a degenerate aspect ratio. DCHECK(aspect_ratio.height() > 0 && aspect_ratio.width() > 0); @@ -29,8 +29,8 @@ log(aspect_ratio.width() / aspect_ratio.height())); } -FloatSize InterpolableAspectRatio::GetRatio() const { - return FloatSize(exp(To<InterpolableNumber>(*value_).Value()), 1); +gfx::SizeF InterpolableAspectRatio::GetRatio() const { + return gfx::SizeF(exp(To<InterpolableNumber>(*value_).Value()), 1); } void InterpolableAspectRatio::Scale(double scale) {
diff --git a/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h b/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h index 36d29a1..3f5d0077 100644 --- a/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h +++ b/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h
@@ -15,14 +15,14 @@ // interpolation. class CORE_EXPORT InterpolableAspectRatio final : public InterpolableValue { public: - explicit InterpolableAspectRatio(const FloatSize& ratio); + explicit InterpolableAspectRatio(const gfx::SizeF& ratio); explicit InterpolableAspectRatio(std::unique_ptr<InterpolableValue> value) : value_(std::move(value)) {} static std::unique_ptr<InterpolableAspectRatio> MaybeCreate( const StyleAspectRatio&); - FloatSize GetRatio() const; + gfx::SizeF GetRatio() const; // InterpolableValue implementation: void Interpolate(const InterpolableValue& to,
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.cc b/third_party/blink/renderer/core/clipboard/data_transfer.cc index bacfdfd..69c151f 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer.cc
@@ -121,20 +121,20 @@ absolute_bounding_box.Intersect(visible_rect); } - FloatRect bounding_box = - layer->GetLayoutObject() - .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box)) - .BoundingBox(); + gfx::RectF bounding_box = + ToGfxRectF(layer->GetLayoutObject() + .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box)) + .BoundingBox()); absl::optional<OverriddenCullRectScope> cull_rect_scope; if (RuntimeEnabledFeatures::CullRectUpdateEnabled()) { - FloatRect cull_rect = bounding_box; - cull_rect.Offset( - FloatSize(layer->GetLayoutObject().FirstFragment().PaintOffset())); + gfx::RectF cull_rect = bounding_box; + cull_rect.Offset(gfx::Vector2dF( + layer->GetLayoutObject().FirstFragment().PaintOffset())); cull_rect_scope.emplace(*layer, - CullRect(ToGfxRect(EnclosingIntRect(cull_rect)))); + CullRect(gfx::ToEnclosingRect(cull_rect))); } PaintLayerPaintingInfo painting_info( - layer, CullRect(ToGfxRect(EnclosingIntRect(bounding_box))), + layer, CullRect(gfx::ToEnclosingRect(bounding_box)), kGlobalPaintFlattenCompositingLayers, PhysicalOffset()); auto* builder = MakeGarbageCollected<PaintRecordBuilder>(); @@ -376,45 +376,34 @@ setDragImage(nullptr, node, loc); } -FloatRect DataTransfer::ClipByVisualViewport(const FloatRect& absolute_rect, - const LocalFrame& frame) { - IntRect viewport_in_root_frame = - EnclosingIntRect(frame.GetPage()->GetVisualViewport().VisibleRect()); - FloatRect absolute_viewport = - FloatRect(frame.View()->ConvertFromRootFrame(viewport_in_root_frame)); +gfx::RectF DataTransfer::ClipByVisualViewport(const gfx::RectF& absolute_rect, + const LocalFrame& frame) { + gfx::Rect viewport_in_root_frame = + ToEnclosingRect(frame.GetPage()->GetVisualViewport().VisibleRect()); + gfx::RectF absolute_viewport(ToGfxRect( + frame.View()->ConvertFromRootFrame(IntRect(viewport_in_root_frame)))); return IntersectRects(absolute_viewport, absolute_rect); } // static -// Converts from size in CSS space to device space based on the given frame. -FloatSize DataTransfer::DeviceSpaceSize(const FloatSize& css_size, - const LocalFrame& frame) { - float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); - float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); - FloatSize device_size(css_size); - device_size.Scale(device_scale_factor * page_scale_factor); - return device_size; -} - -// static // Returns a DragImage whose bitmap contains |contents|, positioned and scaled // in device space. std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame( LocalFrame& frame, float opacity, - const FloatSize& css_size, + const gfx::SizeF& layout_size, const gfx::Vector2dF& paint_offset, PaintRecordBuilder& builder, const PropertyTreeState& property_tree_state) { - float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); - float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); + float layout_to_device_scale = frame.GetPage()->GetVisualViewport().Scale() * + frame.GetPage()->DeviceScaleFactorDeprecated(); - FloatSize device_size = DeviceSpaceSize(css_size, frame); + gfx::SizeF device_size = gfx::ScaleSize(layout_size, layout_to_device_scale); AffineTransform transform; - FloatSize paint_offset_size = - DeviceSpaceSize(FloatSize(paint_offset.x(), paint_offset.y()), frame); - transform.Translate(-paint_offset_size.width(), -paint_offset_size.height()); - transform.Scale(device_scale_factor * page_scale_factor); + gfx::Vector2dF device_paint_offset = + gfx::ScaleVector2d(paint_offset, layout_to_device_scale); + transform.Translate(-device_paint_offset.x(), -device_paint_offset.y()); + transform.Scale(layout_to_device_scale); // Rasterize upfront, since DragImage::create() is going to do it anyway // (SkImage::asLegacyBitmap).
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.h b/third_party/blink/renderer/core/clipboard/data_transfer.h index 59b2a1c..ea4e9d6f 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.h +++ b/third_party/blink/renderer/core/clipboard/data_transfer.h
@@ -134,20 +134,16 @@ DataObject* GetDataObject() const; // Clip to the visible area of the visual viewport. - static FloatRect ClipByVisualViewport(const FloatRect& rect_in_document, - const LocalFrame&); + static gfx::RectF ClipByVisualViewport(const gfx::RectF& rect_in_document, + const LocalFrame&); - // Returns the size with device scale factor and page scale factor applied. - static FloatSize DeviceSpaceSize(const FloatSize& css_size, - const LocalFrame&); - - // |css_size| is the size of the image in CSS pixels. - // |paint_offset| is the offset from the origin of the dragged - // object of the PaintRecordBuilder. + // |layout_size| is the size of the image in layout pixels. + // |paint_offset| is the offset from the origin of the dragged object of the + // PaintRecordBuilder. static std::unique_ptr<DragImage> CreateDragImageForFrame( LocalFrame&, float, - const FloatSize& css_size, + const gfx::SizeF& layout_size, const gfx::Vector2dF& paint_offset, PaintRecordBuilder&, const PropertyTreeState&);
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_test.cc b/third_party/blink/renderer/core/clipboard/data_transfer_test.cc index 5975087..86d12bc 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_test.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer_test.cc
@@ -35,7 +35,7 @@ Element* sample = GetDocument().getElementById("sample"); const std::unique_ptr<DragImage> image = DataTransfer::NodeImage(GetFrame(), *sample); - EXPECT_EQ(IntSize(100, 100), image->Size()); + EXPECT_EQ(gfx::Size(100, 100), image->Size()); } TEST_P(DataTransferTest, NodeImageWithNestedElement) { @@ -66,7 +66,7 @@ Element* sample = GetDocument().getElementById("sample"); const std::unique_ptr<DragImage> image = DataTransfer::NodeImage(GetFrame(), *sample); - EXPECT_EQ(IntSize(200, 200), image->Size()) + EXPECT_EQ(gfx::Size(200, 200), image->Size()) << ":-webkit-drag should affect dragged image."; } @@ -122,7 +122,7 @@ )HTML"); Element& node = *GetDocument().getElementById("node"); const auto image = DataTransfer::NodeImage(GetFrame(), node); - EXPECT_EQ(IntSize(800, 600), image->Size()); + EXPECT_EQ(gfx::Size(800, 600), image->Size()); } TEST_P(DataTransferTest, NodeImageUnderScrollOffset) { @@ -145,14 +145,14 @@ Element& first = *GetDocument().getElementById("first"); const auto first_image = DataTransfer::NodeImage(GetFrame(), first); const int first_height = 500; - EXPECT_EQ(IntSize(500, first_height), first_image->Size()); + EXPECT_EQ(gfx::Size(500, first_height), first_image->Size()); // The second div should also be offset by the scroll offset. In addition, // the second div should be clipped by the viewport. Element& second = *GetDocument().getElementById("second"); const auto second_image = DataTransfer::NodeImage(GetFrame(), second); const int viewport_height = 600; - EXPECT_EQ(IntSize(800, viewport_height - (first_height - scroll_amount)), + EXPECT_EQ(gfx::Size(800, viewport_height - (first_height - scroll_amount)), second_image->Size()); } @@ -171,9 +171,9 @@ const auto image = DataTransfer::NodeImage(GetFrame(), node); const int node_width = 200; const int node_height = 141; - EXPECT_EQ( - IntSize(node_width * page_scale_factor, node_height * page_scale_factor), - image->Size()); + EXPECT_EQ(gfx::Size(node_width * page_scale_factor, + node_height * page_scale_factor), + image->Size()); // Check that a scroll offset is scaled to device coordinates which includes // page scale factor. @@ -182,9 +182,9 @@ frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_amount), mojom::blink::ScrollType::kProgrammatic); const auto image_with_offset = DataTransfer::NodeImage(GetFrame(), node); - EXPECT_EQ( - IntSize(node_width * page_scale_factor, node_height * page_scale_factor), - image_with_offset->Size()); + EXPECT_EQ(gfx::Size(node_width * page_scale_factor, + node_height * page_scale_factor), + image_with_offset->Size()); } TEST_P(DataTransferTest, NodeImageSizeWithPageScaleFactorTooLarge) { @@ -202,8 +202,8 @@ const auto image = DataTransfer::NodeImage(GetFrame(), node); const int node_width = 800; const int node_height = 601; - EXPECT_EQ(IntSize(node_width * page_scale_factor, - (node_height - 1) * page_scale_factor), + EXPECT_EQ(gfx::Size(node_width * page_scale_factor, + (node_height - 1) * page_scale_factor), image->Size()); // Check that a scroll offset is scaled to device coordinates which includes @@ -213,8 +213,8 @@ frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_amount), mojom::blink::ScrollType::kProgrammatic); const auto image_with_offset = DataTransfer::NodeImage(GetFrame(), node); - EXPECT_EQ(IntSize(node_width * page_scale_factor, - (node_height - scroll_amount) * page_scale_factor), + EXPECT_EQ(gfx::Size(node_width * page_scale_factor, + (node_height - scroll_amount) * page_scale_factor), image_with_offset->Size()); } @@ -240,8 +240,8 @@ const auto image = DataTransfer::NodeImage(GetFrame(), blue_green); const int blue_green_width = 2; const int blue_green_height = 1; - EXPECT_EQ(IntSize(blue_green_width * page_scale_factor, - blue_green_height * page_scale_factor), + EXPECT_EQ(gfx::Size(blue_green_width * page_scale_factor, + blue_green_height * page_scale_factor), image->Size()); // Even though #bluegreen is offset by a margin of 1px (which is 2px in device @@ -281,7 +281,7 @@ Element& target = *GetDocument().getElementById("target"); const auto image = DataTransfer::NodeImage(GetFrame(), target); - EXPECT_EQ(IntSize(200, 100), image->Size()); + EXPECT_EQ(gfx::Size(200, 100), image->Size()); } TEST_P(DataTransferTest, NodeImageWithScrolling) { @@ -303,7 +303,7 @@ Element& target = *GetDocument().getElementById("target"); const auto image = DataTransfer::NodeImage(GetFrame(), target); - EXPECT_EQ(IntSize(200, 100), image->Size()); + EXPECT_EQ(gfx::Size(200, 100), image->Size()); } TEST_P(DataTransferTest, NodeImageInOffsetStackingContext) { @@ -329,7 +329,7 @@ const auto image = DataTransfer::NodeImage(GetFrame(), drag); constexpr int drag_width = 5; constexpr int drag_height = 5; - EXPECT_EQ(IntSize(drag_width, drag_height), image->Size()); + EXPECT_EQ(gfx::Size(drag_width, drag_height), image->Size()); // The dragged image should be (drag_width x drag_height) and fully green. Color green = 0xFF00FF00; @@ -371,7 +371,7 @@ // The positioned #child should expand the dragged image's size. constexpr int drag_width = 1; constexpr int drag_height = 3; - EXPECT_EQ(IntSize(drag_width, drag_height), image->Size()); + EXPECT_EQ(gfx::Size(drag_width, drag_height), image->Size()); // The dragged image should be (drag_width x drag_height) and fully green // which is the color of the #child which fully covers the dragged element. @@ -392,7 +392,7 @@ auto image = DataTransfer::NodeImage(GetFrame(), *GetDocument().getElementById("drag")); - EXPECT_EQ(IntSize(100, 100), image->Size()); + EXPECT_EQ(gfx::Size(100, 100), image->Size()); Color green(0, 0x80, 0); const SkBitmap& bitmap = image->Bitmap(); for (int x = 0; x < 100; ++x) { @@ -417,7 +417,7 @@ auto image = DataTransfer::NodeImage(GetFrame(), *GetDocument().getElementById("drag")); - EXPECT_EQ(IntSize(100, 100), image->Size()); + EXPECT_EQ(gfx::Size(100, 100), image->Size()); Color green(0, 0x80, 0); Color blue(0, 0, 0xFF); const SkBitmap& bitmap = image->Bitmap();
diff --git a/third_party/blink/renderer/core/css/background_color_paint_image_generator.h b/third_party/blink/renderer/core/css/background_color_paint_image_generator.h index a654918..072c925 100644 --- a/third_party/blink/renderer/core/css/background_color_paint_image_generator.h +++ b/third_party/blink/renderer/core/css/background_color_paint_image_generator.h
@@ -31,7 +31,7 @@ BackgroundColorPaintImageGeneratorCreateFunction create_function); virtual scoped_refptr<Image> Paint( - const FloatSize& container_size, + const gfx::SizeF& container_size, const Node*, const Vector<Color>& animated_colors, const Vector<double>& offsets,
diff --git a/third_party/blink/renderer/core/css/clip_path_paint_image_generator.h b/third_party/blink/renderer/core/css/clip_path_paint_image_generator.h index a2ed92a..a1dddfcb 100644 --- a/third_party/blink/renderer/core/css/clip_path_paint_image_generator.h +++ b/third_party/blink/renderer/core/css/clip_path_paint_image_generator.h
@@ -7,14 +7,16 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/native_paint_image_generator.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" + +namespace gfx { +class RectF; +} namespace blink { class Image; class LocalFrame; class Node; -class FloatRect; class CORE_EXPORT ClipPathPaintImageGenerator : public NativePaintImageGenerator { @@ -28,7 +30,7 @@ static void Init(ClipPathPaintImageGeneratorCreateFunction* create_function); virtual scoped_refptr<Image> Paint(float zoom, - const FloatRect& reference_box, + const gfx::RectF& reference_box, const Node&) = 0; };
diff --git a/third_party/blink/renderer/core/css/css_gradient_value.cc b/third_party/blink/renderer/core/css/css_gradient_value.cc index 740c53c..41d44f96 100644 --- a/third_party/blink/renderer/core/css/css_gradient_value.cc +++ b/third_party/blink/renderer/core/css/css_gradient_value.cc
@@ -117,7 +117,7 @@ const ImageResourceObserver& client, const Document& document, const ComputedStyle& style, - const FloatSize& size) const { + const gfx::SizeF& size) const { if (size.IsEmpty()) return nullptr; @@ -686,7 +686,7 @@ static float PositionFromValue(const CSSValue* value, const CSSToLengthConversionData& conversion_data, - const FloatSize& size, + const gfx::SizeF& size, bool is_horizontal) { float origin = 0; int sign = 1; @@ -750,7 +750,7 @@ const CSSValue* horizontal, const CSSValue* vertical, const CSSToLengthConversionData& conversion_data, - const FloatSize& size) { + const gfx::SizeF& size) { gfx::PointF result; if (horizontal) @@ -880,7 +880,7 @@ // Compute the endpoints so that a gradient of the given angle covers a box of // the given size. static void EndPointsFromAngle(float angle_deg, - const FloatSize& size, + const gfx::SizeF& size, gfx::PointF& first_point, gfx::PointF& second_point, CSSGradientType type) { @@ -952,7 +952,7 @@ scoped_refptr<Gradient> CSSLinearGradientValue::CreateGradient( const CSSToLengthConversionData& conversion_data, - const FloatSize& size, + const gfx::SizeF& size, const Document& document, const ComputedStyle& style) const { DCHECK(!size.IsEmpty()); @@ -1251,10 +1251,10 @@ // Compute the radius to the closest/farthest side (depending on the compare // functor). -FloatSize RadiusToSide(const gfx::PointF& point, - const FloatSize& size, - EndShapeType shape, - bool (*compare)(float, float)) { +gfx::SizeF RadiusToSide(const gfx::PointF& point, + const gfx::SizeF& size, + EndShapeType shape, + bool (*compare)(float, float)) { float dx1 = ClampTo<float>(fabs(point.x())); float dy1 = ClampTo<float>(fabs(point.y())); float dx2 = ClampTo<float>(fabs(point.x() - size.width())); @@ -1264,20 +1264,20 @@ float dy = compare(dy1, dy2) ? dy1 : dy2; if (shape == kCircleEndShape) - return compare(dx, dy) ? FloatSize(dx, dx) : FloatSize(dy, dy); + return compare(dx, dy) ? gfx::SizeF(dx, dx) : gfx::SizeF(dy, dy); DCHECK_EQ(shape, kEllipseEndShape); - return FloatSize(dx, dy); + return gfx::SizeF(dx, dy); } // Compute the radius of an ellipse which passes through a point at // |offset_from_center|, and has width/height given by aspectRatio. -inline FloatSize EllipseRadius(const gfx::Vector2dF& offset_from_center, - float aspect_ratio) { +inline gfx::SizeF EllipseRadius(const gfx::Vector2dF& offset_from_center, + float aspect_ratio) { // If the aspectRatio is 0 or infinite, the ellipse is completely flat. // TODO(sashab): Implement Degenerate Radial Gradients, see crbug.com/635727. if (aspect_ratio == 0 || std::isinf(aspect_ratio)) - return FloatSize(0, 0); + return gfx::SizeF(0, 0); // x^2/a^2 + y^2/b^2 = 1 // a/b = aspectRatio, b = a/aspectRatio @@ -1285,16 +1285,16 @@ float a = sqrtf(offset_from_center.x() * offset_from_center.x() + offset_from_center.y() * offset_from_center.y() * aspect_ratio * aspect_ratio); - return FloatSize(ClampTo<float>(a), ClampTo<float>(a / aspect_ratio)); + return gfx::SizeF(ClampTo<float>(a), ClampTo<float>(a / aspect_ratio)); } // Compute the radius to the closest/farthest corner (depending on the compare // functor). -FloatSize RadiusToCorner(const gfx::PointF& point, - const FloatSize& size, - EndShapeType shape, - bool (*compare)(float, float)) { - const FloatRect rect(gfx::PointF(), size); +gfx::SizeF RadiusToCorner(const gfx::PointF& point, + const gfx::SizeF& size, + EndShapeType shape, + bool (*compare)(float, float)) { + const gfx::RectF rect(size); const gfx::PointF corners[] = {rect.origin(), rect.top_right(), rect.bottom_right(), rect.bottom_left()}; @@ -1310,14 +1310,14 @@ if (shape == kCircleEndShape) { distance = ClampTo<float>(distance); - return FloatSize(distance, distance); + return gfx::SizeF(distance, distance); } DCHECK_EQ(shape, kEllipseEndShape); // If the end shape is an ellipse, the gradient-shape has the same ratio of // width to height that it would if closest-side or farthest-side were // specified, as appropriate. - const FloatSize side_radius = + const gfx::SizeF side_radius = RadiusToSide(point, size, kEllipseEndShape, compare); return EllipseRadius(corners[corner_index] - point, @@ -1328,7 +1328,7 @@ scoped_refptr<Gradient> CSSRadialGradientValue::CreateGradient( const CSSToLengthConversionData& conversion_data, - const FloatSize& size, + const gfx::SizeF& size, const Document& document, const ComputedStyle& style) const { DCHECK(!size.IsEmpty()); @@ -1351,7 +1351,7 @@ if (first_radius_) first_radius = ResolveRadius(first_radius_.Get(), conversion_data); - FloatSize second_radius(0, 0); + gfx::SizeF second_radius(0, 0); if (second_radius_) { second_radius.set_width( ResolveRadius(second_radius_.Get(), conversion_data)); @@ -1518,7 +1518,7 @@ scoped_refptr<Gradient> CSSConicGradientValue::CreateGradient( const CSSToLengthConversionData& conversion_data, - const FloatSize& size, + const gfx::SizeF& size, const Document& document, const ComputedStyle& style) const { DCHECK(!size.IsEmpty());
diff --git a/third_party/blink/renderer/core/css/css_gradient_value.h b/third_party/blink/renderer/core/css/css_gradient_value.h index 20ced691a..63a80172 100644 --- a/third_party/blink/renderer/core/css/css_gradient_value.h +++ b/third_party/blink/renderer/core/css/css_gradient_value.h
@@ -96,7 +96,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize&) const; + const gfx::SizeF&) const; void AddStop(const CSSGradientColorStop& stop) { stops_.push_back(stop); @@ -170,7 +170,7 @@ // Create the gradient for a given size. scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, - const FloatSize&, + const gfx::SizeF&, const Document&, const ComputedStyle&) const; @@ -268,7 +268,7 @@ // Create the gradient for a given size. scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, - const FloatSize&, + const gfx::SizeF&, const Document&, const ComputedStyle&) const; @@ -314,7 +314,7 @@ // Create the gradient for a given size. scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, - const FloatSize&, + const gfx::SizeF&, const Document&, const ComputedStyle&) const;
diff --git a/third_party/blink/renderer/core/css/css_image_generator_value.cc b/third_party/blink/renderer/core/css/css_image_generator_value.cc index 1dd3527d..b454d27a 100644 --- a/third_party/blink/renderer/core/css/css_image_generator_value.cc +++ b/third_party/blink/renderer/core/css/css_image_generator_value.cc
@@ -36,7 +36,7 @@ using cssvalue::CSSLinearGradientValue; using cssvalue::CSSRadialGradientValue; -Image* GeneratedImageCache::GetImage(const FloatSize& size) const { +Image* GeneratedImageCache::GetImage(const gfx::SizeF& size) const { if (size.IsEmpty()) return nullptr; @@ -47,18 +47,18 @@ return image_iter->value.get(); } -void GeneratedImageCache::PutImage(const FloatSize& size, +void GeneratedImageCache::PutImage(const gfx::SizeF& size, scoped_refptr<Image> image) { DCHECK(!size.IsEmpty()); images_.insert(size, std::move(image)); } -void GeneratedImageCache::AddSize(const FloatSize& size) { +void GeneratedImageCache::AddSize(const gfx::SizeF& size) { DCHECK(!size.IsEmpty()); sizes_.insert(size); } -void GeneratedImageCache::RemoveSize(const FloatSize& size) { +void GeneratedImageCache::RemoveSize(const gfx::SizeF& size) { DCHECK(!size.IsEmpty()); SECURITY_DCHECK(sizes_.find(size) != sizes_.end()); bool fully_erased = sizes_.erase(size); @@ -93,7 +93,7 @@ SizeAndCount& size_count = it->value; if (!size_count.size.IsEmpty()) { cached_images_.RemoveSize(size_count.size); - size_count.size = FloatSize(); + size_count.size = gfx::SizeF(); } if (!--size_count.count) @@ -111,7 +111,7 @@ } Image* CSSImageGeneratorValue::GetImage(const ImageResourceObserver* client, - const FloatSize& size) const { + const gfx::SizeF& size) const { ClientSizeCountMap::iterator it = clients_.find(client); if (it != clients_.end()) { DCHECK(keep_alive_); @@ -119,7 +119,7 @@ if (size_count.size != size) { if (!size_count.size.IsEmpty()) { cached_images_.RemoveSize(size_count.size); - size_count.size = FloatSize(); + size_count.size = gfx::SizeF(); } if (!size.IsEmpty()) { @@ -131,7 +131,7 @@ return cached_images_.GetImage(size); } -void CSSImageGeneratorValue::PutImage(const FloatSize& size, +void CSSImageGeneratorValue::PutImage(const gfx::SizeF& size, scoped_refptr<Image> image) const { cached_images_.PutImage(size, std::move(image)); } @@ -140,7 +140,7 @@ const ImageResourceObserver& client, const Document& document, const ComputedStyle& style, - const FloatSize& target_size) { + const gfx::SizeF& target_size) { switch (GetClassType()) { case kLinearGradientClass: return To<CSSLinearGradientValue>(this)->GetImage(client, document, style,
diff --git a/third_party/blink/renderer/core/css/css_image_generator_value.h b/third_party/blink/renderer/core/css/css_image_generator_value.h index 723857af..80450d0 100644 --- a/third_party/blink/renderer/core/css/css_image_generator_value.h +++ b/third_party/blink/renderer/core/css/css_image_generator_value.h
@@ -29,13 +29,14 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_value.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" +#include "third_party/blink/renderer/platform/geometry/geometry_hash_traits.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h" #include "third_party/blink/renderer/platform/heap/self_keep_alive.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/hash_counted_set.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -47,18 +48,18 @@ // These maps do not contain many objects because we do not expect any // particular CSSGeneratedImageValue to have clients at many different // sizes at any given time. -using ImageSizeCountMap = HashCountedSet<FloatSize>; -using GeneratedImageMap = HashMap<FloatSize, scoped_refptr<Image>>; +using ImageSizeCountMap = HashCountedSet<gfx::SizeF>; +using GeneratedImageMap = HashMap<gfx::SizeF, scoped_refptr<Image>>; class GeneratedImageCache { DISALLOW_NEW(); public: - void AddSize(const FloatSize&); - void RemoveSize(const FloatSize&); + void AddSize(const gfx::SizeF&); + void RemoveSize(const gfx::SizeF&); - Image* GetImage(const FloatSize&) const; - void PutImage(const FloatSize&, scoped_refptr<Image>); + Image* GetImage(const gfx::SizeF&) const; + void PutImage(const gfx::SizeF&, scoped_refptr<Image>); private: // A count of how many times a given image size is in use. @@ -74,7 +75,7 @@ // The non-zero size associated with this client. A client must only // ever be present at one non-zero size, with as many zero sizes as it wants. - FloatSize size; + gfx::SizeF size; // The net number of times this client has been added. int count; @@ -95,7 +96,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size); + const gfx::SizeF& target_size); bool KnownToBeOpaque(const Document&, const ComputedStyle&) const; @@ -107,8 +108,8 @@ protected: explicit CSSImageGeneratorValue(ClassType); - Image* GetImage(const ImageResourceObserver*, const FloatSize&) const; - void PutImage(const FloatSize&, scoped_refptr<Image>) const; + Image* GetImage(const ImageResourceObserver*, const gfx::SizeF&) const; + void PutImage(const gfx::SizeF&, scoped_refptr<Image>) const; const ClientSizeCountMap& Clients() const { return clients_; } // A map from LayoutObjects (with entry count) to image sizes.
diff --git a/third_party/blink/renderer/core/css/css_paint_image_generator.h b/third_party/blink/renderer/core/css/css_paint_image_generator.h index c43970f..256a9777 100644 --- a/third_party/blink/renderer/core/css/css_paint_image_generator.h +++ b/third_party/blink/renderer/core/css/css_paint_image_generator.h
@@ -8,8 +8,8 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -51,7 +51,7 @@ // representing an invalid image if an error occurred. // The |container_size| is the container size with subpixel snapping. virtual scoped_refptr<Image> Paint(const ImageResourceObserver&, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector*, float device_scale_factor) = 0;
diff --git a/third_party/blink/renderer/core/css/css_paint_value.cc b/third_party/blink/renderer/core/css/css_paint_value.cc index 06c4ec0..9fef340 100644 --- a/third_party/blink/renderer/core/css/css_paint_value.cc +++ b/third_party/blink/renderer/core/css/css_paint_value.cc
@@ -101,7 +101,7 @@ const ImageResourceObserver& client, const Document& document, const ComputedStyle& style, - const FloatSize& target_size) { + const gfx::SizeF& target_size) { // https://crbug.com/835589: early exit when paint target is associated with // a link. if (style.InsideLink() != EInsideLink::kNotInsideLink)
diff --git a/third_party/blink/renderer/core/css/css_paint_value.h b/third_party/blink/renderer/core/css/css_paint_value.h index bf0145f3..c5ce477f 100644 --- a/third_party/blink/renderer/core/css/css_paint_value.h +++ b/third_party/blink/renderer/core/css/css_paint_value.h
@@ -33,7 +33,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size); + const gfx::SizeF& target_size); bool KnownToBeOpaque(const Document&, const ComputedStyle&) const;
diff --git a/third_party/blink/renderer/core/css/css_paint_value_test.cc b/third_party/blink/renderer/core/css/css_paint_value_test.cc index 97bd24a..46d11c2 100644 --- a/third_party/blink/renderer/core/css/css_paint_value_test.cc +++ b/third_party/blink/renderer/core/css/css_paint_value_test.cc
@@ -83,7 +83,7 @@ CSSPaintImageGenerator::GetCreateFunctionForTesting(), ProvideOverrideGenerator); - const FloatSize target_size(100, 100); + const gfx::SizeF target_size(100, 100); SetBodyInnerHTML(R"HTML(<div id="target"></div>)HTML"); LayoutObject* target = GetLayoutObjectByElementId("target"); @@ -130,7 +130,7 @@ CSSPaintImageGenerator::GetCreateFunctionForTesting(), ProvideOverrideGenerator); - const FloatSize target_size(100, 100); + const gfx::SizeF target_size(100, 100); SetBodyInnerHTML(R"HTML(<div id="target"></div>)HTML"); LayoutObject* target = GetLayoutObjectByElementId("target"); @@ -179,7 +179,7 @@ CSSPaintImageGenerator::GetCreateFunctionForTesting(), ProvideOverrideGenerator); - const FloatSize target_size(100, 100); + const gfx::SizeF target_size(100, 100); SetBodyInnerHTML(R"HTML( <div id="target"></div> @@ -214,7 +214,7 @@ // on a new document. This test simulates the situation by having two different // documents and call GetImage on different ones. TEST_P(CSSPaintValueTest, GetImageCalledOnMultipleDocuments) { - const FloatSize target_size(100, 100); + const gfx::SizeF target_size(100, 100); SetBodyInnerHTML(R"HTML(<div id="target"></div>)HTML"); LayoutObject* target = GetLayoutObjectByElementId("target"); @@ -270,7 +270,7 @@ CSSPaintImageGenerator::GetCreateFunctionForTesting(), ProvideOverrideGenerator); - const FloatSize target_size(100, 100); + const gfx::SizeF target_size(100, 100); SetBodyInnerHTML(R"HTML( <div id="target"></div> @@ -322,7 +322,7 @@ auto* ident = MakeGarbageCollected<CSSCustomIdentValue>("linkpainter"); CSSPaintValue* paint_value = MakeGarbageCollected<CSSPaintValue>(ident, true); EXPECT_FALSE(paint_value->GetImage(*target, GetDocument(), style, - FloatSize(100, 100))); + gfx::SizeF(100, 100))); } // Regression test for https://crbug.com/835589. @@ -350,7 +350,7 @@ auto* ident = MakeGarbageCollected<CSSCustomIdentValue>("linkpainter"); CSSPaintValue* paint_value = MakeGarbageCollected<CSSPaintValue>(ident, true); EXPECT_FALSE(paint_value->GetImage(*target, GetDocument(), style, - FloatSize(100, 100))); + gfx::SizeF(100, 100))); } TEST_P(CSSPaintValueTest, BuildInputArgumentValuesNotCrash) {
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index a4ceb96..9db94960 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -1243,7 +1243,7 @@ field_group: "box", field_template: "external", keywords: ["auto"], - default_value: "StyleAspectRatio(EAspectRatioType::kAuto, FloatSize())", + default_value: "StyleAspectRatio(EAspectRatioType::kAuto, gfx::SizeF())", type_name: "StyleAspectRatio", converter: "ConvertAspectRatio", include_paths: ["third_party/blink/renderer/core/style/style_aspect_ratio.h"],
diff --git a/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.cc b/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.cc index 3a4827e2..d1c870e 100644 --- a/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.cc +++ b/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.cc
@@ -10,7 +10,7 @@ CSSPaintWorkletInput::CSSPaintWorkletInput( const String& name, - const FloatSize& container_size, + const gfx::SizeF& container_size, float effective_zoom, float device_scale_factor, int worklet_id,
diff --git a/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.h b/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.h index f77d974..3e9b50a 100644 --- a/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.h +++ b/third_party/blink/renderer/core/css/cssom/css_paint_worklet_input.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/cssom/paint_worklet_input.h" #include "third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/graphics/compositor_element_id.h" namespace blink { @@ -39,7 +38,7 @@ public: CSSPaintWorkletInput( const String& name, - const FloatSize& container_size, + const gfx::SizeF& container_size, float effective_zoom, float device_scale_factor, int worklet_id,
diff --git a/third_party/blink/renderer/core/css/cssom/css_style_image_value.cc b/third_party/blink/renderer/core/css/cssom/css_style_image_value.cc index 98c2320..b1124b6 100644 --- a/third_party/blink/renderer/core/css/cssom/css_style_image_value.cc +++ b/third_party/blink/renderer/core/css/cssom/css_style_image_value.cc
@@ -7,7 +7,7 @@ namespace blink { double CSSStyleImageValue::intrinsicWidth(bool& is_null) const { - const absl::optional<IntSize> size = IntrinsicSize(); + const absl::optional<gfx::Size> size = IntrinsicSize(); if (!size) { is_null = true; return 0; @@ -16,7 +16,7 @@ } double CSSStyleImageValue::intrinsicHeight(bool& is_null) const { - const absl::optional<IntSize> size = IntrinsicSize(); + const absl::optional<gfx::Size> size = IntrinsicSize(); if (!size) { is_null = true; return 0; @@ -25,7 +25,7 @@ } double CSSStyleImageValue::intrinsicRatio(bool& is_null) const { - const absl::optional<IntSize> size = IntrinsicSize(); + const absl::optional<gfx::Size> size = IntrinsicSize(); if (!size || size.value().height() == 0) { is_null = true; return 0; @@ -33,10 +33,10 @@ return static_cast<double>(size.value().width()) / size.value().height(); } -FloatSize CSSStyleImageValue::ElementSize( - const FloatSize& default_object_size, +gfx::SizeF CSSStyleImageValue::ElementSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum) const { - return FloatSize(IntrinsicSize().value_or(IntSize())); + return gfx::SizeF(IntrinsicSize().value_or(gfx::Size())); } } // namespace blink
diff --git a/third_party/blink/renderer/core/css/cssom/css_style_image_value.h b/third_party/blink/renderer/core/css/cssom/css_style_image_value.h index e706246..b5bc24c 100644 --- a/third_party/blink/renderer/core/css/cssom/css_style_image_value.h +++ b/third_party/blink/renderer/core/css/cssom/css_style_image_value.h
@@ -31,13 +31,13 @@ // CanvasImageSource bool IsCSSImageValue() const final { return true; } bool WouldTaintOrigin() const final { return true; } - FloatSize ElementSize(const FloatSize& default_object_size, - const RespectImageOrientationEnum) const final; + gfx::SizeF ElementSize(const gfx::SizeF& default_object_size, + const RespectImageOrientationEnum) const final; protected: CSSStyleImageValue() = default; - virtual absl::optional<IntSize> IntrinsicSize() const = 0; + virtual absl::optional<gfx::Size> IntrinsicSize() const = 0; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/cssom/css_style_image_value_test.cc b/third_party/blink/renderer/core/css/cssom/css_style_image_value_test.cc index 8c47ed3..60506080 100644 --- a/third_party/blink/renderer/core/css/cssom/css_style_image_value_test.cc +++ b/third_party/blink/renderer/core/css/cssom/css_style_image_value_test.cc
@@ -13,11 +13,11 @@ class FakeCSSStyleImageValue : public CSSStyleImageValue { public: - FakeCSSStyleImageValue(bool cache_pending, IntSize size) + FakeCSSStyleImageValue(bool cache_pending, gfx::Size size) : cache_pending_(cache_pending), size_(size) {} // CSSStyleImageValue - absl::optional<IntSize> IntrinsicSize() const final { + absl::optional<gfx::Size> IntrinsicSize() const final { if (cache_pending_) return absl::nullopt; return size_; @@ -26,7 +26,7 @@ // CanvasImageSource scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) final { // Only cover premultiply alpha cases. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha); @@ -45,13 +45,13 @@ private: bool cache_pending_; - IntSize size_; + gfx::Size size_; }; } // namespace TEST(CSSStyleImageValueTest, PendingCache) { - FakeCSSStyleImageValue style_image_value(true, IntSize(100, 100)); + FakeCSSStyleImageValue style_image_value(true, gfx::Size(100, 100)); bool is_null = false; EXPECT_EQ(style_image_value.intrinsicWidth(is_null), 0); EXPECT_EQ(style_image_value.intrinsicHeight(is_null), 0); @@ -60,7 +60,7 @@ } TEST(CSSStyleImageValueTest, ValidLoadedImage) { - FakeCSSStyleImageValue style_image_value(false, IntSize(480, 120)); + FakeCSSStyleImageValue style_image_value(false, gfx::Size(480, 120)); bool is_null = false; EXPECT_EQ(style_image_value.intrinsicWidth(is_null), 480); EXPECT_EQ(style_image_value.intrinsicHeight(is_null), 120);
diff --git a/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc b/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc index 261d7159..6ca4efc 100644 --- a/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc +++ b/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc
@@ -14,7 +14,7 @@ return value_->RelativeUrl(); } -absl::optional<IntSize> CSSURLImageValue::IntrinsicSize() const { +absl::optional<gfx::Size> CSSURLImageValue::IntrinsicSize() const { if (Status() != ResourceStatus::kCached) return absl::nullopt; @@ -23,7 +23,7 @@ return resource_content ? resource_content->IntrinsicSize(kRespectImageOrientation) - : IntSize(0, 0); + : gfx::Size(0, 0); } ResourceStatus CSSURLImageValue::Status() const { @@ -34,7 +34,7 @@ scoped_refptr<Image> CSSURLImageValue::GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition) { // UnpremultiplyAlpha is not implemented yet. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha);
diff --git a/third_party/blink/renderer/core/css/cssom/css_url_image_value.h b/third_party/blink/renderer/core/css/cssom/css_url_image_value.h index 97bed82..d85d80a7 100644 --- a/third_party/blink/renderer/core/css/cssom/css_url_image_value.h +++ b/third_party/blink/renderer/core/css/cssom/css_url_image_value.h
@@ -20,13 +20,13 @@ const String& url() const; // CSSStyleImageValue - absl::optional<IntSize> IntrinsicSize() const final; + absl::optional<gfx::Size> IntrinsicSize() const final; // CanvasImageSource ResourceStatus Status() const final; scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) final; bool IsAccelerated() const final;
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.cc b/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.cc index 0eb8d709..53ad989 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.cc +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.cc
@@ -6,49 +6,50 @@ #include <utility> -#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { namespace { void DrawInternal(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options, const PaintImage& image) { canvas->drawImageRect( - image, src_rect, dest_rect, draw_options.sampling_options, &flags, + image, gfx::RectFToSkRect(src_rect), gfx::RectFToSkRect(dest_rect), + draw_options.sampling_options, &flags, WebCoreClampingModeToSkiaRectConstraint(draw_options.clamping_mode)); } } // namespace void PaintWorkletDeferredImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { DrawInternal(canvas, flags, dest_rect, src_rect, draw_options, image_); } void PaintWorkletDeferredImage::DrawTile(GraphicsContext& context, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { - DrawInternal(context.Canvas(), context.FillFlags(), FloatRect(), src_rect, + DrawInternal(context.Canvas(), context.FillFlags(), gfx::RectF(), src_rect, draw_options, image_); } sk_sp<PaintShader> PaintWorkletDeferredImage::CreateShader( - const FloatRect& tile_rect, + const gfx::RectF& tile_rect, const SkMatrix* pattern_matrix, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) { - SkRect tile = SkRect::MakeXYWH(tile_rect.x(), tile_rect.y(), - tile_rect.width(), tile_rect.height()); + SkRect tile = gfx::RectFToSkRect(tile_rect); sk_sp<PaintShader> shader = PaintShader::MakeImage( image_, SkTileMode::kRepeat, SkTileMode::kRepeat, pattern_matrix, &tile);
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.h b/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.h index 5a538b3..2a5fd83 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.h +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_deferred_image.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_PAINT_WORKLET_DEFERRED_IMAGE_H_ #include "third_party/blink/renderer/core/css/cssom/paint_worklet_input.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/generated_image.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/skia/include/core/SkRefCnt.h" @@ -25,7 +24,7 @@ public: static scoped_refptr<PaintWorkletDeferredImage> Create( scoped_refptr<PaintWorkletInput> input, - const FloatSize& size) { + const gfx::SizeF& size) { return base::AdoptRef(new PaintWorkletDeferredImage(input, size)); } ~PaintWorkletDeferredImage() override = default; @@ -33,20 +32,20 @@ protected: void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; void DrawTile(GraphicsContext&, - const FloatRect&, + const gfx::RectF&, const ImageDrawOptions&) override; - sk_sp<cc::PaintShader> CreateShader(const FloatRect& tile_rect, + sk_sp<cc::PaintShader> CreateShader(const gfx::RectF& tile_rect, const SkMatrix* pattern_matrix, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) final; private: PaintWorkletDeferredImage(scoped_refptr<PaintWorkletInput> input, - const FloatSize& size) + const gfx::SizeF& size) : GeneratedImage(size) { image_ = PaintImageBuilder::WithDefault() .set_paint_worklet_input(std::move(input))
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h b/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h index 7a3c211..e312423 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_input.h
@@ -10,8 +10,8 @@ #include "cc/paint/paint_worklet_input.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/wtf/casting.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -36,12 +36,12 @@ } // These accessors are safe on any thread. - const FloatSize& ContainerSize() const { return container_size_; } + const gfx::SizeF& ContainerSize() const { return container_size_; } virtual PaintWorkletInputType GetType() const = 0; protected: - PaintWorkletInput(const FloatSize& container_size, + PaintWorkletInput(const gfx::SizeF& container_size, int worklet_id, cc::PaintWorkletInput::PropertyKeys property_keys) : container_size_(container_size), @@ -53,7 +53,7 @@ private: bool IsCSSPaintWorkletInput() const override { return true; } - const FloatSize container_size_; + const gfx::SizeF container_size_; const int worklet_id_; // List of properties associated with this PaintWorkletInput.
diff --git a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc index 8e7eb25..dd2ef973 100644 --- a/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc +++ b/third_party/blink/renderer/core/css/cssom/paint_worklet_style_property_map_test.cc
@@ -132,7 +132,7 @@ std::vector<cc::PaintWorkletInput::PropertyKey> property_keys; scoped_refptr<CSSPaintWorkletInput> input = base::MakeRefCounted<CSSPaintWorkletInput>( - "test", FloatSize(100, 100), 1.0f, 1.0f, 1, std::move(data.value()), + "test", gfx::SizeF(100, 100), 1.0f, 1.0f, 1, std::move(data.value()), std::move(input_arguments), std::move(property_keys)); ASSERT_TRUE(input); @@ -180,7 +180,7 @@ std::vector<cc::PaintWorkletInput::PropertyKey> property_keys; scoped_refptr<CSSPaintWorkletInput> input = base::MakeRefCounted<CSSPaintWorkletInput>( - "test", FloatSize(100, 100), 1.0f, 1.0f, 1, std::move(data.value()), + "test", gfx::SizeF(100, 100), 1.0f, 1.0f, 1, std::move(data.value()), std::move(input_arguments), std::move(property_keys)); DCHECK(input);
diff --git a/third_party/blink/renderer/core/css/mock_css_paint_image_generator.h b/third_party/blink/renderer/core/css/mock_css_paint_image_generator.h index c0c16ad..e126764e 100644 --- a/third_party/blink/renderer/core/css/mock_css_paint_image_generator.h +++ b/third_party/blink/renderer/core/css/mock_css_paint_image_generator.h
@@ -28,7 +28,7 @@ MOCK_METHOD4(Paint, scoped_refptr<Image>(const ImageResourceObserver&, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector*, float device_scale_factor)); MOCK_CONST_METHOD0(NativeInvalidationProperties, Vector<CSSPropertyID>&());
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index 5483ca03..433e653 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -1942,7 +1942,7 @@ CSSFunctionValue* ComputedStyleUtils::ValueForTransformOperation( const TransformOperation& operation, float zoom, - FloatSize box_size) { + gfx::SizeF box_size) { switch (operation.GetType()) { case TransformOperation::kScaleX: case TransformOperation::kScaleY: @@ -2025,7 +2025,7 @@ // TODO(https://github.com/w3c/csswg-drafts/issues/5011): // Update this once there is consensus. TransformationMatrix matrix; - operation.Apply(matrix, FloatSize(0, 0)); + operation.Apply(matrix, gfx::SizeF(0, 0)); return ValueForTransformationMatrix(matrix, zoom, /*force_matrix3d=*/false); } @@ -2092,7 +2092,7 @@ CSSValue* ComputedStyleUtils::ValueForTransformList( const TransformOperations& transform_list, float zoom, - FloatSize box_size) { + gfx::SizeF box_size) { if (!transform_list.Operations().size()) return CSSIdentifierValue::Create(CSSValueID::kNone); @@ -2104,7 +2104,7 @@ return components; } -FloatRect ComputedStyleUtils::ReferenceBoxForTransform( +gfx::RectF ComputedStyleUtils::ReferenceBoxForTransform( const LayoutObject& layout_object, UsePixelSnappedBox pixel_snap_box) { if (layout_object.IsSVGChild()) @@ -2112,16 +2112,16 @@ if (layout_object.IsBox()) { const auto& layout_box = To<LayoutBox>(layout_object); if (pixel_snap_box == kUsePixelSnappedBox) - return FloatRect(layout_box.PixelSnappedBorderBoxRect()); - return FloatRect(layout_box.BorderBoxRect()); + return gfx::RectF(layout_box.PixelSnappedBorderBoxRect()); + return gfx::RectF(layout_box.BorderBoxRect()); } - return FloatRect(); + return gfx::RectF(); } CSSValue* ComputedStyleUtils::ComputedTransformList( const ComputedStyle& style, const LayoutObject* layout_object) { - FloatSize box_size(0, 0); + gfx::SizeF box_size(0, 0); if (layout_object) box_size = ReferenceBoxForTransform(*layout_object).size(); @@ -2135,7 +2135,7 @@ if (!layout_object || !style.HasTransformOperations()) return CSSIdentifierValue::Create(CSSValueID::kNone); - FloatRect reference_box = ReferenceBoxForTransform(*layout_object); + gfx::RectF reference_box = ReferenceBoxForTransform(*layout_object); TransformationMatrix transform; style.ApplyTransform(transform, reference_box,
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/third_party/blink/renderer/core/css/properties/computed_style_utils.h index 18905666..97425fa 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.h +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.h
@@ -171,12 +171,13 @@ static CSSFunctionValue* ValueForTransformOperation( const TransformOperation&, float zoom, - FloatSize box_size = FloatSize(0, 0)); + gfx::SizeF box_size = gfx::SizeF(0, 0)); // Serialize a transform list. static CSSValue* ValueForTransformList(const TransformOperations&, float zoom, - FloatSize box_size = FloatSize(0, 0)); - static FloatRect ReferenceBoxForTransform( + gfx::SizeF box_size = gfx::SizeF(0, + 0)); + static gfx::RectF ReferenceBoxForTransform( const LayoutObject&, UsePixelSnappedBox = kUsePixelSnappedBox); // The LayoutObject parameter is only used for converting unreperesentable
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index 2f73755..9a398f4 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -7235,13 +7235,13 @@ bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); if (layout_object) { - FloatRect reference_box = ComputedStyleUtils::ReferenceBoxForTransform( + gfx::RectF reference_box = ComputedStyleUtils::ReferenceBoxForTransform( *layout_object, ComputedStyleUtils::kDontUsePixelSnappedBox); - FloatSize resolved_origin( + gfx::PointF resolved_origin( FloatValueForLength(style.TransformOriginX(), reference_box.width()), FloatValueForLength(style.TransformOriginY(), reference_box.height())); - list->Append(*ZoomAdjustedPixelValue(resolved_origin.width(), style)); - list->Append(*ZoomAdjustedPixelValue(resolved_origin.height(), style)); + list->Append(*ZoomAdjustedPixelValue(resolved_origin.x(), style)); + list->Append(*ZoomAdjustedPixelValue(resolved_origin.y(), style)); } else { list->Append(*ComputedStyleUtils::ZoomAdjustedPixelValueForLength( style.TransformOriginX(), style));
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 23fe69a..0ee5642 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -2123,15 +2123,15 @@ } namespace { -FloatSize GetRatioFromList(const CSSValueList& list) { +gfx::SizeF GetRatioFromList(const CSSValueList& list) { auto* ratio = DynamicTo<cssvalue::CSSRatioValue>(list.Item(0)); if (!ratio) { DCHECK_EQ(list.length(), 2u); ratio = DynamicTo<cssvalue::CSSRatioValue>(list.Item(1)); } DCHECK(ratio); - return FloatSize(ratio->First().GetFloatValue(), - ratio->Second().GetFloatValue()); + return gfx::SizeF(ratio->First().GetFloatValue(), + ratio->Second().GetFloatValue()); } bool ListHasAuto(const CSSValueList& list) { @@ -2153,7 +2153,7 @@ const CSSValue& value) { auto* identifier_value = DynamicTo<CSSIdentifierValue>(value); if (identifier_value && identifier_value->GetValueID() == CSSValueID::kAuto) - return StyleAspectRatio(EAspectRatioType::kAuto, FloatSize()); + return StyleAspectRatio(EAspectRatioType::kAuto, gfx::SizeF()); // (auto, (1, 2)) or ((1, 2), auto) or ((1, 2)) const CSSValueList& list = To<CSSValueList>(value); @@ -2163,7 +2163,7 @@ bool has_auto = ListHasAuto(list); EAspectRatioType type = has_auto ? EAspectRatioType::kAutoAndRatio : EAspectRatioType::kRatio; - FloatSize ratio = GetRatioFromList(list); + gfx::SizeF ratio = GetRatioFromList(list); return StyleAspectRatio(type, ratio); }
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc b/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc index 58eda35..d4ea7cd 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver_test.cc
@@ -1573,7 +1573,7 @@ </style> )HTML"); - constexpr FloatSize initial_page_size(800, 600); + constexpr gfx::SizeF initial_page_size(800, 600); GetDocument().GetFrame()->StartPrinting(initial_page_size, initial_page_size); GetDocument().View()->UpdateLifecyclePhasesForPrinting();
diff --git a/third_party/blink/renderer/core/css/style_engine_test.cc b/third_party/blink/renderer/core/css/style_engine_test.cc index c595c0c7..c3ee35b 100644 --- a/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/third_party/blink/renderer/core/css/style_engine_test.cc
@@ -546,7 +546,7 @@ EXPECT_EQ(MakeRGB(255, 0, 0), t8->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); GetDocument().GetFrame()->StartPrinting(page_size, page_size, 1); ASSERT_TRUE(t8->GetComputedStyle()); EXPECT_EQ(MakeRGB(0, 0, 0), t8->GetComputedStyle()->VisitedDependentColor( @@ -3091,7 +3091,7 @@ EXPECT_EQ(MakeRGB(255, 0, 0), body->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); GetDocument().GetFrame()->StartPrinting(page_size, page_size, 1); EXPECT_EQ(Color::kBlack, root->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); @@ -4108,7 +4108,7 @@ EXPECT_TRUE(audio->GetComputedStyle()); EXPECT_FALSE(html_audio->GetComputedStyle()); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); GetDocument().GetFrame()->StartPrinting(page_size, page_size, 1); // Also for printing.
diff --git a/third_party/blink/renderer/core/css/threaded/text_renderer_threaded_test.cc b/third_party/blink/renderer/core/css/threaded/text_renderer_threaded_test.cc index f58ee73..8939fe9 100644 --- a/third_party/blink/renderer/core/css/threaded/text_renderer_threaded_test.cc +++ b/third_party/blink/renderer/core/css/threaded/text_renderer_threaded_test.cc
@@ -47,7 +47,7 @@ TextRun::kAllowTrailingExpansion | TextRun::kForbidLeadingExpansion, TextDirection::kLtr, false); text_run.SetNormalizeSpace(true); - FloatRect text_bounds = font.SelectionRectForText( + gfx::RectF text_bounds = font.SelectionRectForText( text_run, gfx::PointF(), font.GetFontDescription().ComputedSize(), 0, -1);
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index b52a49f..afc1b68 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -424,7 +424,7 @@ </style> <p><div><span></span></div></p> )HTML"); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); float maximum_shrink_ratio = 1.6; GetDocument().GetFrame()->StartPrinting(page_size, page_size, @@ -1073,7 +1073,7 @@ GetDocument().GetFrame()->SetPageZoomFactor(2); SetBodyInnerHTML("<style>@page { margin: 50px; size: 400px 10in; }</style>"); - constexpr FloatSize initial_page_size(800, 600); + constexpr gfx::SizeF initial_page_size(800, 600); GetDocument().GetFrame()->StartPrinting(initial_page_size, initial_page_size); GetDocument().View()->UpdateLifecyclePhasesForPrinting();
diff --git a/third_party/blink/renderer/core/dom/tree_scope.cc b/third_party/blink/renderer/core/dom/tree_scope.cc index 8551668..141a2e83 100644 --- a/third_party/blink/renderer/core/dom/tree_scope.cc +++ b/third_party/blink/renderer/core/dom/tree_scope.cc
@@ -206,9 +206,9 @@ document.UpdateStyleAndLayout(DocumentUpdateReason::kHitTest); auto* scrollable_area = frame_view->LayoutViewport(); - IntRect visible_frame_rect(gfx::Point(), - scrollable_area->VisibleContentRect().size()); - visible_frame_rect.Scale(1 / frame->PageZoomFactor()); + gfx::Rect visible_frame_rect(scrollable_area->VisibleContentRect().size()); + visible_frame_rect = + gfx::ScaleToRoundedRect(visible_frame_rect, 1 / frame->PageZoomFactor()); if (!visible_frame_rect.Contains(ToRoundedPoint(point_in_frame))) return false;
diff --git a/third_party/blink/renderer/core/editing/caret_display_item_client.cc b/third_party/blink/renderer/core/editing/caret_display_item_client.cc index bedc16a..5007f4f 100644 --- a/third_party/blink/renderer/core/editing/caret_display_item_client.cc +++ b/third_party/blink/renderer/core/editing/caret_display_item_client.cc
@@ -266,7 +266,7 @@ ToGfxRect(EnclosingIntRect(drawing_rect))); } - IntRect paint_rect = PixelSnappedIntRect(drawing_rect); + gfx::Rect paint_rect = ToPixelSnappedRect(drawing_rect); context.FillRect(paint_rect, is_visible_if_active_ ? color_ : Color(), PaintAutoDarkMode(layout_block_->StyleRef(), DarkModeFilter::ElementRole::kForeground));
diff --git a/third_party/blink/renderer/core/exported/web_image.cc b/third_party/blink/renderer/core/exported/web_image.cc index 7433b7fef..5cbccca 100644 --- a/third_party/blink/renderer/core/exported/web_image.cc +++ b/third_party/blink/renderer/core/exported/web_image.cc
@@ -58,16 +58,16 @@ // which has the highest bit depth. const wtf_size_t frame_count = decoder->FrameCount(); wtf_size_t index = 0; // Default to first frame if none are large enough. - int frame_area_at_index = 0; + uint64_t frame_area_at_index = 0; for (wtf_size_t i = 0; i < frame_count; ++i) { - const IntSize frame_size = decoder->FrameSizeAtIndex(i); - if (ToGfxSize(frame_size) == desired_size) { + const gfx::Size frame_size = decoder->FrameSizeAtIndex(i); + if (frame_size == desired_size) { index = i; break; // Perfect match. } - const int frame_area = frame_size.width() * frame_size.height(); - if (frame_area < (desired_size.width() * desired_size.height())) + uint64_t frame_area = frame_size.Area64(); + if (frame_area < desired_size.Area64()) break; // No more frames that are large enough. if (!i || (frame_area < frame_area_at_index)) { @@ -107,9 +107,9 @@ // size. This is likely what most (all?) users of this function will // expect/want. If the desired size is empty, then use the intrinsic size of // image. - FloatSize container_size(desired_size); + gfx::SizeF container_size(desired_size); if (container_size.IsEmpty()) - container_size = svg_image->ConcreteObjectSize(FloatSize()); + container_size = svg_image->ConcreteObjectSize(gfx::SizeF()); scoped_refptr<Image> svg_container = SVGImageForContainer::Create(svg_image.get(), container_size, 1, KURL()); if (PaintImage image = svg_container->PaintImageForCurrentFrame()) { @@ -134,11 +134,11 @@ // Frames are arranged by decreasing size, then decreasing bit depth. // Keep the first frame at every size, has the highest bit depth. const wtf_size_t frame_count = decoder->FrameCount(); - IntSize last_size; + gfx::Size last_size; WebVector<SkBitmap> frames; for (wtf_size_t i = 0; i < std::min(frame_count, kMaxFrameCount); ++i) { - const IntSize frame_size = decoder->FrameSizeAtIndex(i); + const gfx::Size frame_size = decoder->FrameSizeAtIndex(i); if (frame_size == last_size) continue; last_size = frame_size; @@ -165,7 +165,7 @@ return {}; const wtf_size_t frame_count = decoder->FrameCount(); - IntSize last_size = decoder->FrameSizeAtIndex(0); + gfx::Size last_size = decoder->FrameSizeAtIndex(0); WebVector<WebImage::AnimationFrame> frames; frames.reserve(frame_count);
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 762e9ca..c34eed4 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -2127,7 +2127,8 @@ MainFrameImpl()->GetFrame()->View()->GetScrollableArea(); // If the caret is offscreen, then animate. - if (!root_viewport->VisibleContentRect().Contains(caret_bounds_in_content)) + if (!root_viewport->VisibleContentRect().Contains( + ToGfxRect(caret_bounds_in_content))) need_animation = true; // If the box is partially offscreen and it's possible to bring it fully @@ -2136,7 +2137,8 @@ element_bounds_in_content.width() && visual_viewport.VisibleRect().height() >= element_bounds_in_content.height() && - !root_viewport->VisibleContentRect().Contains(element_bounds_in_content)) + !root_viewport->VisibleContentRect().Contains( + ToGfxRect(element_bounds_in_content))) need_animation = true; if (!need_animation) @@ -2267,7 +2269,7 @@ gfx::SizeF WebViewImpl::VisualViewportSize() const { DCHECK(GetPage()); - return ToGfxSizeF(GetPage()->GetVisualViewport().VisibleRect().size()); + return GetPage()->GetVisualViewport().VisibleRect().size(); } void WebViewImpl::SetPageScaleFactorAndLocation(float scale_factor,
diff --git a/third_party/blink/renderer/core/fragment_directive/css_selector_fragment_anchor_test.cc b/third_party/blink/renderer/core/fragment_directive/css_selector_fragment_anchor_test.cc index 63294489..d0ac192 100644 --- a/third_party/blink/renderer/core/fragment_directive/css_selector_fragment_anchor_test.cc +++ b/third_party/blink/renderer/core/fragment_directive/css_selector_fragment_anchor_test.cc
@@ -43,8 +43,8 @@ return GetDocument().View()->LayoutViewport(); } - IntRect ViewportRect() { - return IntRect(gfx::Point(), LayoutViewport()->VisibleContentRect().size()); + gfx::Rect ViewportRect() { + return gfx::Rect(LayoutViewport()->VisibleContentRect().size()); } IntRect BoundingRectInFrame(Node& node) { @@ -62,7 +62,7 @@ } bool IsVisibleInViewport(Element& element) { - return ViewportRect().Contains(BoundingRectInFrame(element)); + return ViewportRect().Contains(ToGfxRect(BoundingRectInFrame(element))); } };
diff --git a/third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_test.cc b/third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_test.cc index 9c8b99cf..86abba3 100644 --- a/third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_test.cc +++ b/third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_test.cc
@@ -80,12 +80,12 @@ return GetDocument().View()->LayoutViewport(); } - IntRect ViewportRect() { - return IntRect(gfx::Point(), LayoutViewport()->VisibleContentRect().size()); + gfx::Rect ViewportRect() { + return gfx::Rect(LayoutViewport()->VisibleContentRect().size()); } - IntRect BoundingRectInFrame(Node& node) { - return node.GetLayoutObject()->AbsoluteBoundingBoxRect(); + gfx::Rect BoundingRectInFrame(Node& node) { + return ToGfxRect(node.GetLayoutObject()->AbsoluteBoundingBoxRect()); } void SimulateClick(int x, int y) { @@ -1325,7 +1325,7 @@ ASSERT_NE(ScrollOffset(), first_scroll_offset); Element& p = *GetDocument().getElementById("text"); - IntRect first_bounding_rect = BoundingRectInFrame(p); + gfx::Rect first_bounding_rect = BoundingRectInFrame(p); EXPECT_TRUE(ViewportRect().Contains(first_bounding_rect)); // Load an image that pushes the target text out of view
diff --git a/third_party/blink/renderer/core/frame/frame_overlay.cc b/third_party/blink/renderer/core/frame/frame_overlay.cc index dcb3fbdf..d919f65 100644 --- a/third_party/blink/renderer/core/frame/frame_overlay.cc +++ b/third_party/blink/renderer/core/frame/frame_overlay.cc
@@ -113,24 +113,24 @@ frame_->View()->Size()); } -IntRect FrameOverlay::ComputeInterestRect(const GraphicsLayer* graphics_layer, - const IntRect&) const { +gfx::Rect FrameOverlay::ComputeInterestRect(const GraphicsLayer* graphics_layer, + const gfx::Rect&) const { DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()); DCHECK(!RuntimeEnabledFeatures::CullRectUpdateEnabled()); - return IntRect(gfx::Point(), Size()); + return gfx::Rect(gfx::Point(), ToGfxSize(Size())); } -IntRect FrameOverlay::PaintableRegion( +gfx::Rect FrameOverlay::PaintableRegion( const GraphicsLayer* graphics_layer) const { DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()); DCHECK(RuntimeEnabledFeatures::CullRectUpdateEnabled()); - return IntRect(gfx::Point(), Size()); + return gfx::Rect(gfx::Point(), ToGfxSize(Size())); } void FrameOverlay::PaintContents(const GraphicsLayer* graphics_layer, GraphicsContext& context, GraphicsLayerPaintingPhase phase, - const IntRect& interest_rect) const { + const gfx::Rect& interest_rect) const { DCHECK(!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()); DCHECK_EQ(graphics_layer, layer_); DCHECK_EQ(DefaultPropertyTreeState(), layer_->GetPropertyTreeState());
diff --git a/third_party/blink/renderer/core/frame/frame_overlay.h b/third_party/blink/renderer/core/frame/frame_overlay.h index 764dcf6..db9bf240 100644 --- a/third_party/blink/renderer/core/frame/frame_overlay.h +++ b/third_party/blink/renderer/core/frame/frame_overlay.h
@@ -92,13 +92,13 @@ // GraphicsLayerClient implementation. Not needed for CompositeAfterPaint. bool NeedsRepaint(const GraphicsLayer&) const override { return true; } - IntRect ComputeInterestRect(const GraphicsLayer*, - const IntRect&) const override; - IntRect PaintableRegion(const GraphicsLayer*) const override; + gfx::Rect ComputeInterestRect(const GraphicsLayer*, + const gfx::Rect&) const override; + gfx::Rect PaintableRegion(const GraphicsLayer*) const override; void PaintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, - const IntRect& interest_rect) const override; + const gfx::Rect& interest_rect) const override; void GraphicsLayersDidChange() override; PaintArtifactCompositor* GetPaintArtifactCompositor() override; String DebugName(const GraphicsLayer*) const override;
diff --git a/third_party/blink/renderer/core/frame/frame_overlay_test.cc b/third_party/blink/renderer/core/frame/frame_overlay_test.cc index 0225f7e3..96fb421b 100644 --- a/third_party/blink/renderer/core/frame/frame_overlay_test.cc +++ b/third_party/blink/renderer/core/frame/frame_overlay_test.cc
@@ -45,7 +45,7 @@ if (DrawingRecorder::UseCachedDrawingIfPossible( graphics_context, frame_overlay, DisplayItem::kFrameOverlay)) return; - FloatRect rect(0, 0, size.width(), size.height()); + gfx::RectF rect(0, 0, size.width(), size.height()); DrawingRecorder recorder(graphics_context, frame_overlay, DisplayItem::kFrameOverlay, gfx::Rect(ToGfxSize(size)));
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 935f407d..f5d8a18 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -1031,8 +1031,8 @@ return inspector_task_runner_; } -void LocalFrame::StartPrinting(const FloatSize& page_size, - const FloatSize& original_page_size, +void LocalFrame::StartPrinting(const gfx::SizeF& page_size, + const gfx::SizeF& original_page_size, float maximum_shrink_ratio) { DCHECK(!saved_scroll_offsets_); SetPrinting(true, page_size, original_page_size, maximum_shrink_ratio); @@ -1040,12 +1040,12 @@ void LocalFrame::EndPrinting() { RestoreScrollOffsets(); - SetPrinting(false, FloatSize(), FloatSize(), 0); + SetPrinting(false, gfx::SizeF(), gfx::SizeF(), 0); } void LocalFrame::SetPrinting(bool printing, - const FloatSize& page_size, - const FloatSize& original_page_size, + const gfx::SizeF& page_size, + const gfx::SizeF& original_page_size, float maximum_shrink_ratio) { // In setting printing, we should not validate resources already cached for // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704 @@ -1170,12 +1170,12 @@ saved_scroll_offsets_ = nullptr; } -FloatSize LocalFrame::ResizePageRectsKeepingRatio( - const FloatSize& original_size, - const FloatSize& expected_size) const { +gfx::SizeF LocalFrame::ResizePageRectsKeepingRatio( + const gfx::SizeF& original_size, + const gfx::SizeF& expected_size) const { auto* layout_object = ContentLayoutObject(); if (!layout_object) - return FloatSize(); + return gfx::SizeF(); bool is_horizontal = layout_object->StyleRef().IsHorizontalWritingMode(); float width = original_size.width(); @@ -1190,7 +1190,7 @@ float result_height = floorf(result_width * ratio); if (!is_horizontal) std::swap(result_width, result_height); - return FloatSize(result_width, result_height); + return gfx::SizeF(result_width, result_height); } void LocalFrame::SetPageZoomFactor(float factor) { @@ -2048,12 +2048,10 @@ IntSize LocalFrame::GetMainFrameViewportSize() const { LocalFrame& local_root = LocalFrameRoot(); - return local_root.IsMainFrame() - ? local_root.View() - ->GetScrollableArea() - ->VisibleContentRect() - .size() - : IntSize(local_root.intersection_state_.main_frame_viewport_size); + return IntSize( + local_root.IsMainFrame() + ? local_root.View()->GetScrollableArea()->VisibleContentRect().size() + : local_root.intersection_state_.main_frame_viewport_size); } gfx::Point LocalFrame::GetMainFrameScrollOffset() const { @@ -2347,7 +2345,7 @@ DrawingRecorder recorder(graphics_context, frame_overlay, DisplayItem::kFrameOverlay, gfx::Rect(ToGfxSize(view->Size()))); - FloatRect rect(0, 0, view->Width(), view->Height()); + gfx::RectF rect(0, 0, view->Width(), view->Height()); graphics_context.FillRect( rect, color_, PaintAutoDarkMode(view->GetLayoutView()->StyleRef(),
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index 7aeb246..aeec1f2c7 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -89,6 +89,7 @@ namespace gfx { class Point; class Range; +class SizeF; } // namespace gfx namespace blink { @@ -103,7 +104,6 @@ class Element; class EventHandler; class EventHandlerRegistry; -class FloatSize; class FrameConsole; class FrameOverlay; class FrameSelection; @@ -316,8 +316,8 @@ // The frame content will fit to the page size with specified shrink ratio. // If this frame doesn't need to fit into a page size, default values are // used. - void StartPrinting(const FloatSize& page_size = FloatSize(), - const FloatSize& original_page_size = FloatSize(), + void StartPrinting(const gfx::SizeF& page_size = gfx::SizeF(), + const gfx::SizeF& original_page_size = gfx::SizeF(), float maximum_shrink_ratio = 0); void EndPrinting(); @@ -335,8 +335,8 @@ void EnsureSaveScrollOffset(Node&); void RestoreScrollOffsets(); - FloatSize ResizePageRectsKeepingRatio(const FloatSize& original_size, - const FloatSize& expected_size) const; + gfx::SizeF ResizePageRectsKeepingRatio(const gfx::SizeF& original_size, + const gfx::SizeF& expected_size) const; bool InViewSourceMode() const; void SetInViewSourceMode(bool = true); @@ -748,8 +748,8 @@ // |page_size|, |original_page_size|, and |maximum_shrink_ratio| are only // meaningful when we should use printing layout for this frame. void SetPrinting(bool printing, - const FloatSize& page_size, - const FloatSize& original_page_size, + const gfx::SizeF& page_size, + const gfx::SizeF& original_page_size, float maximum_shrink_ratio); // FrameScheduler::Delegate overrides:
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index ede82f0..e17654e 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -1021,10 +1021,10 @@ // Report the main frame's document intersection with itself. LayoutObject* layout_object = GetLayoutView(); - IntRect main_frame_dimensions = + gfx::Rect main_frame_dimensions = To<LayoutBox>(layout_object)->PixelSnappedLayoutOverflowRect(); - GetFrame().Client()->OnMainFrameIntersectionChanged(IntRect( - 0, 0, main_frame_dimensions.width(), main_frame_dimensions.height())); + GetFrame().Client()->OnMainFrameIntersectionChanged( + IntRect(gfx::Rect(main_frame_dimensions.size()))); } TRACE_EVENT0("blink,benchmark", @@ -3427,8 +3427,8 @@ } void LocalFrameView::ForceLayoutForPagination( - const FloatSize& page_size, - const FloatSize& original_page_size, + const gfx::SizeF& page_size, + const gfx::SizeF& original_page_size, float maximum_shrink_factor) { // Dumping externalRepresentation(m_frame->layoutObject()).ascii() is a good // trick to see the state of things before and after the layout @@ -3465,14 +3465,13 @@ if (doc_logical_width > page_logical_width) { // ResizePageRectsKeepingRatio would truncate the expected page size, // while we want it rounded -- so make sure it's rounded here. - FloatSize expected_page_size( + gfx::SizeF expected_page_size( std::min<float>(document_rect.Width().Round(), page_size.width() * maximum_shrink_factor), std::min<float>(document_rect.Height().Round(), page_size.height() * maximum_shrink_factor)); - FloatSize max_page_size = frame_->ResizePageRectsKeepingRatio( - FloatSize(original_page_size.width(), original_page_size.height()), - expected_page_size); + gfx::SizeF max_page_size = frame_->ResizePageRectsKeepingRatio( + original_page_size, expected_page_size); page_logical_width = horizontal_writing_mode ? max_page_size.width() : max_page_size.height(); page_logical_height = horizontal_writing_mode ? max_page_size.height() @@ -4237,8 +4236,7 @@ } else { GraphicsLayer* graphics_layer = GetLayoutView()->Layer()->GraphicsLayerBacking(); - graphics_layer->PaintForTesting(IntRect(cull_rect.Rect()), - PaintDebugInfoEnabled()); + graphics_layer->PaintForTesting(cull_rect.Rect(), PaintDebugInfoEnabled()); } Lifecycle().AdvanceTo(DocumentLifecycle::kPaintClean); }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index df3ab02..96a38a3 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -420,14 +420,14 @@ void IncrementLayoutObjectCount() { layout_object_counter_.Increment(); } void IncrementVisuallyNonEmptyCharacterCount(unsigned); - void IncrementVisuallyNonEmptyPixelCount(const IntSize&); + void IncrementVisuallyNonEmptyPixelCount(const gfx::Size&); bool IsVisuallyNonEmpty() const { return is_visually_non_empty_; } void SetIsVisuallyNonEmpty() { is_visually_non_empty_ = true; } void EnableAutoSizeMode(const IntSize& min_size, const IntSize& max_size); void DisableAutoSizeMode(); - void ForceLayoutForPagination(const FloatSize& page_size, - const FloatSize& original_page_size, + void ForceLayoutForPagination(const gfx::SizeF& page_size, + const gfx::SizeF& original_page_size, float maximum_shrink_factor); // Updates the fragment anchor element based on URL's fragment identifier. @@ -1203,10 +1203,10 @@ } inline void LocalFrameView::IncrementVisuallyNonEmptyPixelCount( - const IntSize& size) { + const gfx::Size& size) { if (is_visually_non_empty_) return; - visually_non_empty_pixel_count_ += size.Area(); + visually_non_empty_pixel_count_ += size.Area64(); // Use a threshold value to prevent very small amounts of visible content from // triggering didMeaningfulLayout. static const unsigned kVisualPixelThreshold = 32 * 32;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view_test.cc b/third_party/blink/renderer/core/frame/local_frame_view_test.cc index 8254606..7696e24 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view_test.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view_test.cc
@@ -150,7 +150,7 @@ TEST_F(LocalFrameViewTest, NoOverflowInIncrementVisuallyNonEmptyPixelCount) { EXPECT_FALSE(GetDocument().View()->IsVisuallyNonEmpty()); GetDocument().View()->IncrementVisuallyNonEmptyPixelCount( - IntSize(65536, 65536)); + gfx::Size(65536, 65536)); EXPECT_TRUE(GetDocument().View()->IsVisuallyNonEmpty()); } @@ -182,7 +182,7 @@ SetBodyInnerHTML("<iframe style='display: none'></iframe>"); SetChildFrameHTML("A"); - ChildFrame().StartPrinting(FloatSize(200, 200), FloatSize(200, 200), 1); + ChildFrame().StartPrinting(gfx::SizeF(200, 200), gfx::SizeF(200, 200), 1); ChildDocument().View()->UpdateLifecyclePhasesForPrinting(); // The following checks that the detached frame has been walked for PrePaint. @@ -198,7 +198,7 @@ SetBodyInnerHTML("<iframe></iframe>"); SetChildFrameHTML("A"); - ChildFrame().StartPrinting(FloatSize(200, 200), FloatSize(200, 200), 1); + ChildFrame().StartPrinting(gfx::SizeF(200, 200), gfx::SizeF(200, 200), 1); ChildDocument().View()->UpdateLifecyclePhasesForPrinting(); EXPECT_EQ(DocumentLifecycle::kCompositingAssignmentsClean,
diff --git a/third_party/blink/renderer/core/frame/remote_frame.cc b/third_party/blink/renderer/core/frame/remote_frame.cc index 7854499..20b44f3 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.cc +++ b/third_party/blink/renderer/core/frame/remote_frame.cc
@@ -767,8 +767,8 @@ // C++ Blink type and use the Mojo type everywhere or typemap the // Mojo type to the pre-existing native C++ Blink type. IntrinsicSizingInfo sizing_info; - sizing_info.size = FloatSize(info->size); - sizing_info.aspect_ratio = FloatSize(info->aspect_ratio); + sizing_info.size = info->size; + sizing_info.aspect_ratio = info->aspect_ratio; sizing_info.has_width = info->has_width; sizing_info.has_height = info->has_height; View()->SetIntrinsicSizeInfo(sizing_info);
diff --git a/third_party/blink/renderer/core/frame/remote_frame_owner.cc b/third_party/blink/renderer/core/frame/remote_frame_owner.cc index 72d8960..7a358bd 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_owner.cc +++ b/third_party/blink/renderer/core/frame/remote_frame_owner.cc
@@ -76,8 +76,7 @@ DCHECK(result); auto sizing_info = mojom::blink::IntrinsicSizingInfo::New( - ToGfxSizeF(intrinsic_sizing_info.size), - ToGfxSizeF(intrinsic_sizing_info.aspect_ratio), + intrinsic_sizing_info.size, intrinsic_sizing_info.aspect_ratio, intrinsic_sizing_info.has_width, intrinsic_sizing_info.has_height); WebLocalFrameImpl::FromFrame(local_frame) ->FrameWidgetImpl()
diff --git a/third_party/blink/renderer/core/frame/root_frame_viewport.cc b/third_party/blink/renderer/core/frame/root_frame_viewport.cc index 66d854d..349a309 100644 --- a/third_party/blink/renderer/core/frame/root_frame_viewport.cc +++ b/third_party/blink/renderer/core/frame/root_frame_viewport.cc
@@ -177,9 +177,9 @@ LayoutViewport().GetScrollAnimator().CurrentOffset(); } -IntRect RootFrameViewport::VisibleContentRect( +gfx::Rect RootFrameViewport::VisibleContentRect( IncludeScrollbarsInRect scrollbar_inclusion) const { - return IntRect( + return gfx::Rect( gfx::PointAtOffsetFromOrigin(ScrollOffsetInt()), GetVisualViewport().VisibleContentRect(scrollbar_inclusion).size()); } @@ -242,7 +242,7 @@ return LayoutViewport().IsScrollCornerVisible(); } -IntRect RootFrameViewport::ScrollCornerRect() const { +gfx::Rect RootFrameViewport::ScrollCornerRect() const { return LayoutViewport().ScrollCornerRect(); } @@ -462,7 +462,7 @@ GetVisualViewport().MaximumScrollOffset(); } -IntSize RootFrameViewport::ContentsSize() const { +gfx::Size RootFrameViewport::ContentsSize() const { return LayoutViewport().ContentsSize(); }
diff --git a/third_party/blink/renderer/core/frame/root_frame_viewport.h b/third_party/blink/renderer/core/frame/root_frame_viewport.h index b5a06ad..9e12c1c 100644 --- a/third_party/blink/renderer/core/frame/root_frame_viewport.h +++ b/third_party/blink/renderer/core/frame/root_frame_viewport.h
@@ -63,7 +63,7 @@ PhysicalRect ScrollIntoView( const PhysicalRect&, const mojom::blink::ScrollIntoViewParamsPtr&) override; - IntRect VisibleContentRect( + gfx::Rect VisibleContentRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override; PhysicalRect VisibleScrollSnapportRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override; @@ -76,7 +76,7 @@ bool IsActive() const override; int ScrollSize(ScrollbarOrientation) const override; bool IsScrollCornerVisible() const override; - IntRect ScrollCornerRect() const override; + gfx::Rect ScrollCornerRect() const override; void UpdateScrollOffset(const ScrollOffset&, mojom::blink::ScrollType) override; gfx::Vector2d ScrollOffsetInt() const override; @@ -84,7 +84,7 @@ gfx::Vector2d MinimumScrollOffsetInt() const override; gfx::Vector2d MaximumScrollOffsetInt() const override; ScrollOffset MaximumScrollOffset() const override; - IntSize ContentsSize() const override; + gfx::Size ContentsSize() const override; bool UsesCompositedScrolling() const override; bool ShouldScrollOnMainThread() const override; bool ScrollbarsCanBeActive() const override;
diff --git a/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc b/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc index f43ad65f..0630ed6 100644 --- a/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc
@@ -26,7 +26,8 @@ class ScrollableAreaStub : public GarbageCollected<ScrollableAreaStub>, public ScrollableArea { public: - ScrollableAreaStub(const IntSize& viewport_size, const IntSize& contents_size) + ScrollableAreaStub(const gfx::Size& viewport_size, + const gfx::Size& contents_size) : ScrollableArea(blink::scheduler::GetSingleThreadTaskRunnerForTesting()), user_input_scrollable_x_(true), user_input_scrollable_y_(true), @@ -35,11 +36,11 @@ timer_task_runner_( blink::scheduler::GetSingleThreadTaskRunnerForTesting()) {} - void SetViewportSize(const IntSize& viewport_size) { + void SetViewportSize(const gfx::Size& viewport_size) { viewport_size_ = viewport_size; } - IntSize ViewportSize() const { return viewport_size_; } + gfx::Size ViewportSize() const { return viewport_size_; } // ScrollableArea Impl int ScrollSize(ScrollbarOrientation orientation) const override { @@ -67,15 +68,15 @@ return gfx::ToFlooredVector2d(MaximumScrollOffset()); } - IntRect VisibleContentRect( + gfx::Rect VisibleContentRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override { - return IntRect( + return gfx::Rect( gfx::ToFlooredPoint(gfx::PointAtOffsetFromOrigin(scroll_offset_)), viewport_size_); } - IntSize ContentsSize() const override { return contents_size_; } - void SetContentSize(const IntSize& contents_size) { + gfx::Size ContentsSize() const override { return contents_size_; } + void SetContentSize(const gfx::Size& contents_size) { contents_size_ = contents_size; } @@ -105,7 +106,7 @@ bool IsThrottled() const override { return false; } bool IsActive() const override { return true; } bool IsScrollCornerVisible() const override { return true; } - IntRect ScrollCornerRect() const override { return IntRect(); } + gfx::Rect ScrollCornerRect() const override { return gfx::Rect(); } bool ScrollbarsCanBeActive() const override { return true; } bool ShouldPlaceVerticalScrollbarOnLeft() const override { return true; } void ScrollControlWasSetNeedsPaintInvalidation() override {} @@ -131,19 +132,19 @@ bool user_input_scrollable_x_; bool user_input_scrollable_y_; ScrollOffset scroll_offset_; - IntSize viewport_size_; - IntSize contents_size_; + gfx::Size viewport_size_; + gfx::Size contents_size_; scoped_refptr<base::SingleThreadTaskRunner> timer_task_runner_; }; class RootLayoutViewportStub : public ScrollableAreaStub { public: - RootLayoutViewportStub(const IntSize& viewport_size, - const IntSize& contents_size) + RootLayoutViewportStub(const gfx::Size& viewport_size, + const gfx::Size& contents_size) : ScrollableAreaStub(viewport_size, contents_size) {} ScrollOffset MaximumScrollOffset() const override { - IntSize diff = ContentsSize() - ViewportSize(); + gfx::Size diff = ContentsSize() - ViewportSize(); return ScrollOffset(diff.width(), diff.height()); } @@ -160,13 +161,13 @@ class VisualViewportStub : public ScrollableAreaStub { public: - VisualViewportStub(const IntSize& viewport_size, const IntSize& contents_size) + VisualViewportStub(const gfx::Size& viewport_size, + const gfx::Size& contents_size) : ScrollableAreaStub(viewport_size, contents_size), scale_(1) {} ScrollOffset MaximumScrollOffset() const override { - IntSize viewport_size = ViewportSize(); - viewport_size.Scale(1 / scale_); - IntSize diff = ContentsSize() - viewport_size; + gfx::Size diff = + ContentsSize() - gfx::ScaleToFlooredSize(ViewportSize(), 1 / scale_); return ScrollOffset(diff.width(), diff.height()); } @@ -177,12 +178,10 @@ int VisibleHeight() const override { return viewport_size_.height() / scale_; } - IntRect VisibleContentRect(IncludeScrollbarsInRect) const override { - FloatSize size(viewport_size_); - size.Scale(1 / scale_); - return IntRect( - gfx::ToFlooredPoint(gfx::PointAtOffsetFromOrigin(GetScrollOffset())), - ExpandedIntSize(size)); + gfx::Rect VisibleContentRect(IncludeScrollbarsInRect) const override { + return gfx::Rect(gfx::ToFlooredPoint(ScrollPosition()), + gfx::ToCeiledSize(gfx::ScaleSize( + gfx::SizeF(viewport_size_), 1 / scale_))); } float scale_; @@ -200,9 +199,9 @@ // !userInputScrollable (as happens when overflow:hidden is set) works // correctly, that is, the visual viewport can scroll, but not the layout. TEST_F(RootFrameViewportTest, UserInputScrollable) { - IntSize viewport_size(100, 150); + gfx::Size viewport_size(100, 150); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -273,9 +272,9 @@ // work correctly when one of the subviewports is explicitly scrolled without // using the // RootFrameViewport interface. TEST_F(RootFrameViewportTest, TestScrollAnimatorUpdatedBeforeScroll) { - IntSize viewport_size(100, 150); + gfx::Size viewport_size(100, 150); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -325,9 +324,9 @@ // Test that the scrollIntoView correctly scrolls the main frame // and visual viewport such that the given rect is centered in the viewport. TEST_F(RootFrameViewportTest, ScrollIntoView) { - IntSize viewport_size(100, 150); + gfx::Size viewport_size(100, 150); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -337,7 +336,7 @@ // Test that the visual viewport is scrolled if the viewport has been // resized (as is the case when the ChromeOS keyboard comes up) but not // scaled. - visual_viewport->SetViewportSize(IntSize(100, 100)); + visual_viewport->SetViewportSize(gfx::Size(100, 100)); root_frame_viewport->ScrollIntoView( layout_viewport->DocumentToFrame(PhysicalRect(100, 250, 50, 50)), ScrollAlignment::CreateScrollIntoViewParams( @@ -357,7 +356,7 @@ EXPECT_EQ(ScrollOffset(0, 0), visual_viewport->GetScrollOffset()); // Reset the visual viewport's size, scale the page, and repeat the test - visual_viewport->SetViewportSize(IntSize(100, 150)); + visual_viewport->SetViewportSize(gfx::Size(100, 150)); visual_viewport->SetScale(2); root_frame_viewport->SetScrollOffset( ScrollOffset(), mojom::blink::ScrollType::kProgrammatic, @@ -382,7 +381,7 @@ EXPECT_EQ(ScrollOffset(50, 75), visual_viewport->GetScrollOffset()); // Scrolling into view the viewport rect itself should be a no-op. - visual_viewport->SetViewportSize(IntSize(100, 100)); + visual_viewport->SetViewportSize(gfx::Size(100, 100)); visual_viewport->SetScale(1.5f); visual_viewport->SetScrollOffset(ScrollOffset(0, 10), mojom::blink::ScrollType::kProgrammatic); @@ -426,9 +425,9 @@ // Tests that the setScrollOffset method works correctly with both viewports. TEST_F(RootFrameViewportTest, SetScrollOffset) { - IntSize viewport_size(500, 500); + gfx::Size viewport_size(500, 500); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(1000, 2000)); + viewport_size, gfx::Size(1000, 2000)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -471,9 +470,9 @@ // Tests that the visible rect (i.e. visual viewport rect) is correctly // calculated, taking into account both viewports and page scale. TEST_F(RootFrameViewportTest, VisibleContentRect) { - IntSize viewport_size(500, 401); + gfx::Size viewport_size(500, 401); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(1000, 2000)); + viewport_size, gfx::Size(1000, 2000)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -486,23 +485,23 @@ EXPECT_EQ(gfx::Point(100, 75), root_frame_viewport->VisibleContentRect().origin()); - EXPECT_EQ(IntSize(500, 401), + EXPECT_EQ(gfx::Size(500, 401), root_frame_viewport->VisibleContentRect().size()); visual_viewport->SetScale(2); EXPECT_EQ(gfx::Point(100, 75), root_frame_viewport->VisibleContentRect().origin()); - EXPECT_EQ(IntSize(250, 201), + EXPECT_EQ(gfx::Size(250, 201), root_frame_viewport->VisibleContentRect().size()); } // Tests that scrolls on the root frame scroll the visual viewport before // trying to scroll the layout viewport. TEST_F(RootFrameViewportTest, ViewportScrollOrder) { - IntSize viewport_size(100, 100); + gfx::Size viewport_size(100, 100); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); @@ -539,14 +538,14 @@ // Tests that setting an alternate layout viewport scrolls the alternate // instead of the original. TEST_F(RootFrameViewportTest, SetAlternateLayoutViewport) { - IntSize viewport_size(100, 100); + gfx::Size viewport_size(100, 100); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size); auto* alternate_scroller = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(600, 500)); + viewport_size, gfx::Size(600, 500)); auto* root_frame_viewport = MakeGarbageCollected<RootFrameViewport>( *visual_viewport, *layout_viewport); @@ -580,9 +579,9 @@ // trying to scroll the layout viewport when using // DistributeScrollBetweenViewports directly. TEST_F(RootFrameViewportTest, DistributeScrollOrder) { - IntSize viewport_size(100, 100); + gfx::Size viewport_size(100, 100); auto* layout_viewport = MakeGarbageCollected<RootLayoutViewportStub>( - viewport_size, IntSize(200, 300)); + viewport_size, gfx::Size(200, 300)); auto* visual_viewport = MakeGarbageCollected<VisualViewportStub>(viewport_size, viewport_size);
diff --git a/third_party/blink/renderer/core/frame/rotation_viewport_anchor.cc b/third_party/blink/renderer/core/frame/rotation_viewport_anchor.cc index 4482f6b7..1923ff6 100644 --- a/third_party/blink/renderer/core/frame/rotation_viewport_anchor.cc +++ b/third_party/blink/renderer/core/frame/rotation_viewport_anchor.cc
@@ -16,6 +16,7 @@ #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/platform/geometry/double_rect.h" #include "ui/gfx/geometry/point_conversions.h" +#include "ui/gfx/geometry/vector2d_conversions.h" namespace blink { @@ -25,7 +26,7 @@ static const int kViewportToNodeMaxRelativeArea = 2; Node* FindNonEmptyAnchorNode(const gfx::PointF& absolute_point, - const IntRect& view_rect, + const gfx::Rect& view_rect, EventHandler& event_handler) { gfx::Point point = gfx::ToFlooredPoint(absolute_point); HitTestLocation location(point); @@ -48,9 +49,10 @@ const int max_node_area = view_rect.width() * view_rect.height() * kViewportToNodeMaxRelativeArea; if (node_size.width() * node_size.height() > max_node_area) { - IntSize point_offset = view_rect.size(); - point_offset.Scale(kViewportAnchorRelativeEpsilon); - HitTestLocation alternative_location(point + ToGfxVector2d(point_offset)); + gfx::Size point_offset = gfx::ScaleToFlooredSize( + view_rect.size(), kViewportAnchorRelativeEpsilon); + HitTestLocation alternative_location( + point + gfx::Vector2d(point_offset.width(), point_offset.height())); node = event_handler .HitTestResultAtLocation( alternative_location, @@ -67,7 +69,7 @@ return node; } -void MoveToEncloseRect(IntRect& outer, const FloatRect& inner) { +void MoveToEncloseRect(gfx::Rect& outer, const gfx::RectF& inner) { gfx::Point minimum_position = gfx::ToCeiledPoint( inner.bottom_right() - gfx::Vector2dF(outer.width(), outer.height())); gfx::Point maximum_position = gfx::ToFlooredPoint(inner.origin()); @@ -79,7 +81,7 @@ outer.set_origin(outer_origin); } -void MoveIntoRect(FloatRect& inner, const IntRect& outer) { +void MoveIntoRect(gfx::RectF& inner, const gfx::Rect& outer) { gfx::PointF minimum_position = gfx::PointF(outer.origin()); gfx::PointF maximum_position = gfx::PointF(outer.bottom_right()) - gfx::Vector2dF(inner.width(), inner.height()); @@ -135,13 +137,13 @@ anchor_in_node_coords_ = gfx::PointF(); normalized_visual_viewport_offset_ = gfx::Vector2dF(); - IntRect inner_view_rect = root_frame_viewport->VisibleContentRect(); + gfx::Rect inner_view_rect = root_frame_viewport->VisibleContentRect(); // Preserve origins at the absolute screen origin. if (inner_view_rect.origin().IsOrigin() || inner_view_rect.IsEmpty()) return; - IntRect outer_view_rect = + gfx::Rect outer_view_rect = LayoutViewport().VisibleContentRect(kIncludeScrollbars); // Normalize by the size of the outer rect @@ -187,7 +189,7 @@ page_scale_constraints_set_->FinalConstraints().ClampToConstraints( new_page_scale_factor); - FloatSize visual_viewport_size(visual_viewport_->Size()); + gfx::SizeF visual_viewport_size(ToGfxSize(visual_viewport_->Size())); visual_viewport_size.Scale(1 / new_page_scale_factor); gfx::Point main_frame_origin; @@ -213,10 +215,10 @@ } void RotationViewportAnchor::ComputeOrigins( - const FloatSize& inner_size, + const gfx::SizeF& inner_size, gfx::Point& main_frame_origin, gfx::PointF& visual_viewport_origin) const { - IntSize outer_size = LayoutViewport().VisibleContentRect().size(); + gfx::Size outer_size = LayoutViewport().VisibleContentRect().size(); // Compute the viewport origins in CSS pixels relative to the document. gfx::Vector2dF abs_visual_viewport_offset = @@ -226,8 +228,8 @@ gfx::PointF inner_origin = GetInnerOrigin(inner_size); gfx::PointF outer_origin = inner_origin - abs_visual_viewport_offset; - IntRect outer_rect = IntRect(gfx::ToFlooredPoint(outer_origin), outer_size); - FloatRect inner_rect = FloatRect(inner_origin, inner_size); + gfx::Rect outer_rect(gfx::ToFlooredPoint(outer_origin), outer_size); + gfx::RectF inner_rect(inner_origin, inner_size); MoveToEncloseRect(outer_rect, inner_rect); @@ -241,7 +243,7 @@ } gfx::PointF RotationViewportAnchor::GetInnerOrigin( - const FloatSize& inner_size) const { + const gfx::SizeF& inner_size) const { if (!anchor_node_ || !anchor_node_->isConnected() || !anchor_node_->GetLayoutObject()) return visual_viewport_in_document_;
diff --git a/third_party/blink/renderer/core/frame/rotation_viewport_anchor.h b/third_party/blink/renderer/core/frame/rotation_viewport_anchor.h index 36d0f3c..00cd5063 100644 --- a/third_party/blink/renderer/core/frame/rotation_viewport_anchor.h +++ b/third_party/blink/renderer/core/frame/rotation_viewport_anchor.h
@@ -7,10 +7,10 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/geometry/vector2d_f.h" namespace blink { @@ -43,9 +43,9 @@ void SetAnchor(); void RestoreToAnchor(); - gfx::PointF GetInnerOrigin(const FloatSize& inner_size) const; + gfx::PointF GetInnerOrigin(const gfx::SizeF& inner_size) const; - void ComputeOrigins(const FloatSize& inner_size, + void ComputeOrigins(const gfx::SizeF& inner_size, gfx::Point& main_frame_origin, gfx::PointF& visual_viewport_origin) const; ScrollableArea& LayoutViewport() const;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index 5bf0f6f..e5a828a 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -223,7 +223,7 @@ { ScrollPaintPropertyNode::State state; state.container_rect = gfx::Rect(ToGfxSize(size_)); - state.contents_size = ToGfxSize(ContentsSize()); + state.contents_size = ContentsSize(); state.user_scrollable_horizontal = UserInputScrollable(kHorizontalScrollbar); @@ -431,13 +431,13 @@ // In unit tests we may not have initialized the layer tree. if (scroll_layer_) - scroll_layer_->SetBounds(ToGfxSize(ContentsSize())); + scroll_layer_->SetBounds(ContentsSize()); needs_paint_property_update_ = true; ClampToBoundaries(); } -FloatRect VisualViewport::VisibleRect( +gfx::RectF VisualViewport::VisibleRect( IncludeScrollbarsInRect scrollbar_inclusion) const { FloatSize visible_size(size_); @@ -447,8 +447,7 @@ visible_size.Enlarge(0, browser_controls_adjustment_); visible_size.Scale(1 / scale_); - return FloatRect(gfx::PointAtOffsetFromOrigin(GetScrollOffset()), - visible_size); + return gfx::RectF(ScrollPosition(), ToGfxSizeF(visible_size)); } gfx::PointF VisualViewport::ViewportCSSPixelsToRootFrame( @@ -625,7 +624,7 @@ // TODO(crbug.com/1015625): Avoid scroll_layer_. scroll_layer_ = cc::Layer::Create(); scroll_layer_->SetScrollable(ToGfxSize(size_)); - scroll_layer_->SetBounds(ToGfxSize(ContentsSize())); + scroll_layer_->SetBounds(ContentsSize()); scroll_layer_->SetElementId(GetScrollElementId()); InitializeScrollbars(); @@ -871,17 +870,17 @@ return true; } -IntSize VisualViewport::ContentsSize() const { +gfx::Size VisualViewport::ContentsSize() const { LocalFrame* frame = LocalMainFrame(); if (!frame || !frame->View()) - return IntSize(); + return gfx::Size(); - return frame->View()->Size(); + return ToGfxSize(frame->View()->Size()); } -IntRect VisualViewport::VisibleContentRect( +gfx::Rect VisualViewport::VisibleContentRect( IncludeScrollbarsInRect scrollbar_inclusion) const { - return EnclosingIntRect(VisibleRect(scrollbar_inclusion)); + return ToEnclosingRect(VisibleRect(scrollbar_inclusion)); } scoped_refptr<base::SingleThreadTaskRunner> VisualViewport::GetTimerTaskRunner() @@ -1101,7 +1100,7 @@ std::unique_ptr<TracedValue> VisualViewport::ViewportToTracedValue() const { auto value = std::make_unique<TracedValue>(); - IntRect viewport = VisibleContentRect(); + gfx::Rect viewport = VisibleContentRect(); value->SetInteger("x", ClampTo<int>(roundf(viewport.x()))); value->SetInteger("y", ClampTo<int>(roundf(viewport.y()))); value->SetInteger("width", ClampTo<int>(roundf(viewport.width())));
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.h b/third_party/blink/renderer/core/frame/visual_viewport.h index 099b87a7..2c292d59 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.h +++ b/third_party/blink/renderer/core/frame/visual_viewport.h
@@ -120,7 +120,7 @@ // relative to the layout viewport's top-left corner. i.e. As the page scale // is increased, this rect shrinks. Does not account for browser-zoom (ctrl // +/- zooming). - FloatRect VisibleRect(IncludeScrollbarsInRect = kExcludeScrollbars) const; + gfx::RectF VisibleRect(IncludeScrollbarsInRect = kExcludeScrollbars) const; // Resets the viewport to initial state. void Reset(); @@ -197,7 +197,7 @@ bool IsActive() const override { return false; } int ScrollSize(ScrollbarOrientation) const override; bool IsScrollCornerVisible() const override { return false; } - IntRect ScrollCornerRect() const override { return IntRect(); } + gfx::Rect ScrollCornerRect() const override { return gfx::Rect(); } gfx::Vector2d ScrollOffsetInt() const override { return gfx::ToFlooredVector2d(offset_); } @@ -208,7 +208,7 @@ // Note: Because scrollbars are conceptually owned by the LayoutView, // ContentsSize includes the main frame's scrollbars. This is necessary for // correct cc Layer sizing. - IntSize ContentsSize() const override; + gfx::Size ContentsSize() const override; bool ScrollbarsCanBeActive() const override { return false; } bool UserInputScrollable(ScrollbarOrientation) const override; bool ShouldPlaceVerticalScrollbarOnLeft() const override { return false; } @@ -224,7 +224,7 @@ bool UsesCompositedScrolling() const override { return true; } cc::AnimationHost* GetCompositorAnimationHost() const override; CompositorAnimationTimeline* GetCompositorAnimationTimeline() const override; - IntRect VisibleContentRect( + gfx::Rect VisibleContentRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override; scoped_refptr<base::SingleThreadTaskRunner> GetTimerTaskRunner() const override;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport_test.cc b/third_party/blink/renderer/core/frame/visual_viewport_test.cc index b4e85411..c0826d2 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport_test.cc
@@ -283,33 +283,32 @@ RegisterMockedHttpURLLoad("200-by-300.html"); NavigateTo(base_url_ + "200-by-300.html"); - IntSize size = IntSize(150, 100); + gfx::Size size(150, 100); // Vertical scrollbar width and horizontal scrollbar height. - IntSize scrollbar_size = IntSize(15, 15); + gfx::Size scrollbar_size(15, 15); WebView()->ResizeWithBrowserControls( - ToGfxSize(size), ToGfxSize(size), - WebView()->GetBrowserControls().Params()); + size, size, WebView()->GetBrowserControls().Params()); UpdateAllLifecyclePhases(); // Scroll layout viewport and verify visibleContentRect. WebView()->MainFrameImpl()->SetScrollOffset(gfx::PointF(0, 50)); VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); - EXPECT_EQ(IntRect(gfx::Point(0, 0), size - scrollbar_size), + EXPECT_EQ(gfx::Rect(gfx::Point(0, 0), size - scrollbar_size), visual_viewport.VisibleContentRect(kExcludeScrollbars)); - EXPECT_EQ(IntRect(gfx::Point(0, 0), size), + EXPECT_EQ(gfx::Rect(gfx::Point(0, 0), size), visual_viewport.VisibleContentRect(kIncludeScrollbars)); WebView()->SetPageScaleFactor(2.0); // Scroll visual viewport and verify visibleContentRect. - size.Scale(0.5); - scrollbar_size.Scale(0.5); + size = gfx::ScaleToFlooredSize(size, 0.5); + scrollbar_size = gfx::ScaleToFlooredSize(scrollbar_size, 0.5); visual_viewport.SetLocation(gfx::PointF(10, 10)); - EXPECT_EQ(IntRect(gfx::Point(10, 10), size - scrollbar_size), + EXPECT_EQ(gfx::Rect(gfx::Point(10, 10), size - scrollbar_size), visual_viewport.VisibleContentRect(kExcludeScrollbars)); - EXPECT_EQ(IntRect(gfx::Point(10, 10), size), + EXPECT_EQ(gfx::Rect(gfx::Point(10, 10), size), visual_viewport.VisibleContentRect(kIncludeScrollbars)); } @@ -926,8 +925,8 @@ gfx::ToFlooredVector2d(visual_viewport.VisibleRect().OffsetFromOrigin()); expected = gfx::ScaleToRoundedPoint(expected, visual_viewport.Scale()); - EXPECT_EQ(expected, IntRect(anchor).origin()); - EXPECT_EQ(expected, IntRect(focus).origin()); + EXPECT_EQ(expected, anchor.origin()); + EXPECT_EQ(expected, focus.origin()); // FIXME(bokan) - http://crbug.com/364154 - Figure out how to test text // selection as well rather than just carret. @@ -1340,7 +1339,7 @@ float aspect_ratio = visual_viewport.VisibleRect().width() / visual_viewport.VisibleRect().height(); float new_height = frame_view.FrameRect().width() / aspect_ratio; - IntSize contents_size = frame_view.LayoutViewport()->ContentsSize(); + gfx::Size contents_size = frame_view.LayoutViewport()->ContentsSize(); return ScrollOffset(contents_size.width() - frame_view.FrameRect().width(), contents_size.height() - new_height); } @@ -1358,14 +1357,14 @@ LocalFrameView& frame_view = *WebView()->MainFrameImpl()->GetFrameView(); visual_viewport.SetScale(1); - EXPECT_EQ(FloatSize(500, 450), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(500, 450), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, 900), frame_view.FrameRect().size()); // Simulate bringing down the browser controls by 20px. WebView()->MainFrameViewWidget()->ApplyViewportChangesForTesting( {gfx::Vector2dF(), gfx::Vector2dF(), 1, false, 1, 0, cc::BrowserControlsState::kBoth}); - EXPECT_EQ(FloatSize(500, 430), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(500, 430), visual_viewport.VisibleRect().size()); // Test that the scroll bounds are adjusted appropriately: the visual viewport // should be shrunk by 20px to 430px. The outer viewport was shrunk to @@ -1412,7 +1411,7 @@ LocalFrameView& frame_view = *WebView()->MainFrameImpl()->GetFrameView(); visual_viewport.SetScale(2); - EXPECT_EQ(FloatSize(250, 225), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(250, 225), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, 900), frame_view.FrameRect().size()); // Simulate bringing down the browser controls by 20px. Since we're zoomed in, @@ -1421,7 +1420,7 @@ WebView()->MainFrameViewWidget()->ApplyViewportChangesForTesting( {gfx::Vector2dF(), gfx::Vector2dF(), 1, false, 1, 0, cc::BrowserControlsState::kBoth}); - EXPECT_EQ(FloatSize(250, 215), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(250, 215), visual_viewport.VisibleRect().size()); // Test that the scroll bounds are adjusted appropriately. visual_viewport.Move(ScrollOffset(10000, 10000)); @@ -1453,13 +1452,13 @@ WebView()->MainFrameViewWidget()->ApplyViewportChangesForTesting( {gfx::Vector2dF(), gfx::Vector2dF(), 0.8f, false, -1, 0, cc::BrowserControlsState::kBoth}); - EXPECT_EQ(FloatSize(625, 562.5), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(625, 562.5), visual_viewport.VisibleRect().size()); // Bring out the browser controls by 11 WebView()->MainFrameViewWidget()->ApplyViewportChangesForTesting( {gfx::Vector2dF(), gfx::Vector2dF(), 1, false, 11 / 20.f, 0, cc::BrowserControlsState::kBoth}); - EXPECT_EQ(FloatSize(625, 548.75), visual_viewport.VisibleRect().size()); + EXPECT_EQ(gfx::SizeF(625, 548.75), visual_viewport.VisibleRect().size()); // Ensure max scroll offsets are updated properly. visual_viewport.Move(ScrollOffset(10000, 10000)); @@ -1506,8 +1505,8 @@ LocalFrameView& frame_view = *WebView()->MainFrameImpl()->GetFrameView(); visual_viewport.SetScale(page_scale); - EXPECT_EQ(FloatSize(250, (visual_viewport_height - browser_controls_height) / - page_scale), + EXPECT_EQ(gfx::SizeF(250, (visual_viewport_height - browser_controls_height) / + page_scale), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, layout_viewport_height - browser_controls_height / min_page_scale), @@ -1522,7 +1521,7 @@ mojom::blink::ScrollType::kUser); WebView()->GetBrowserControls().SetShownRatio(0, 0); - EXPECT_EQ(FloatSize(250, visual_viewport_height / page_scale), + EXPECT_EQ(gfx::SizeF(250, visual_viewport_height / page_scale), visual_viewport.VisibleRect().size()); ScrollOffset frame_view_expected = @@ -1546,7 +1545,7 @@ UpdateAllLifecyclePhases(); EXPECT_EQ(IntSize(500, visual_viewport_height), visual_viewport.Size()); - EXPECT_EQ(FloatSize(250, visual_viewport_height / page_scale), + EXPECT_EQ(gfx::SizeF(250, visual_viewport_height / page_scale), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, layout_viewport_height), frame_view.FrameRect().size()); @@ -1586,7 +1585,7 @@ LocalFrameView& frame_view = *WebView()->MainFrameImpl()->GetFrameView(); visual_viewport.SetScale(page_scale); - EXPECT_EQ(FloatSize(250, visual_viewport_height / page_scale), + EXPECT_EQ(gfx::SizeF(250, visual_viewport_height / page_scale), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, layout_viewport_height), frame_view.FrameRect().size()); @@ -1600,8 +1599,8 @@ frame_view.LayoutViewport()->ScrollBy(ScrollOffset(10000, 10000), mojom::blink::ScrollType::kUser); - EXPECT_EQ(FloatSize(250, (visual_viewport_height - browser_controls_height) / - page_scale), + EXPECT_EQ(gfx::SizeF(250, (visual_viewport_height - browser_controls_height) / + page_scale), visual_viewport.VisibleRect().size()); ScrollOffset frame_view_expected( @@ -1627,8 +1626,8 @@ EXPECT_EQ(IntSize(500, visual_viewport_height - browser_controls_height), visual_viewport.Size()); - EXPECT_EQ(FloatSize(250, (visual_viewport_height - browser_controls_height) / - page_scale), + EXPECT_EQ(gfx::SizeF(250, (visual_viewport_height - browser_controls_height) / + page_scale), visual_viewport.VisibleRect().size()); EXPECT_EQ(IntSize(1000, layout_viewport_height - browser_controls_height / min_page_scale),
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc index 86fa9d9..5528795d 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -12252,13 +12252,13 @@ nullptr); EXPECT_TRUE(frame_view->GetScrollableArea()->VisibleContentRect().Contains( - box1_rect)); + ToGfxRect(box1_rect))); result_rect = static_cast<FloatRect>(web_match_rects[1]); frame->EnsureTextFinder().SelectNearestFindMatch(result_rect.CenterPoint(), nullptr); - EXPECT_TRUE( - frame_view->GetScrollableArea()->VisibleContentRect().Contains(box2_rect)) + EXPECT_TRUE(frame_view->GetScrollableArea()->VisibleContentRect().Contains( + ToGfxRect(box2_rect))) << "Box [" << box2_rect.ToString() << "] is not visible in viewport [" << frame_view->GetScrollableArea()->VisibleContentRect().ToString() << "]"; @@ -12395,7 +12395,7 @@ auto* frame = To<LocalFrame>(WebView().GetPage()->MainFrame()); LocalFrameView* frame_view = frame->View(); - IntRect inputRect(200, 600, 100, 20); + gfx::Rect inputRect(200, 600, 100, 20); frame_view->GetScrollableArea()->SetScrollOffset( ScrollOffset(0, 0), mojom::blink::ScrollType::kProgrammatic); @@ -12516,7 +12516,7 @@ ScrollOffset(0, 300), mojom::blink::ScrollType::kProgrammatic); LocalFrameView* frame_view = frame->View(); - IntRect inputRect(200, 700, 100, 20); + gfx::Rect inputRect(200, 700, 100, 20); ASSERT_EQ(1, visual_viewport.Scale()); ASSERT_EQ(gfx::Point(0, 300), frame_view->GetScrollableArea()->VisibleContentRect().origin()); @@ -12616,18 +12616,18 @@ ->ScrollFocusedEditableElementIntoView(); Element* input = GetDocument().getElementById("target"); - IntRect input_rect(input->getBoundingClientRect()->top(), - input->getBoundingClientRect()->left(), - input->getBoundingClientRect()->width(), - input->getBoundingClientRect()->height()); + gfx::Rect input_rect(input->getBoundingClientRect()->top(), + input->getBoundingClientRect()->left(), + input->getBoundingClientRect()->width(), + input->getBoundingClientRect()->height()); - IntRect visible_content_rect(gfx::Point(), frame_view->Size()); + gfx::Rect visible_content_rect(ToGfxSize(frame_view->Size())); EXPECT_TRUE(visible_content_rect.Contains(input_rect)) << "Layout viewport [" << visible_content_rect.ToString() << "] does not contain input rect [" << input_rect.ToString() << "] after scroll into view."; - EXPECT_TRUE(visual_viewport.VisibleRect().Contains(input_rect)) + EXPECT_TRUE(visual_viewport.VisibleRect().Contains(gfx::RectF(input_rect))) << "Visual viewport [" << visual_viewport.VisibleRect().ToString() << "] does not contain input rect [" << input_rect.ToString() << "] after scroll into view."; @@ -12731,7 +12731,7 @@ auto* frame = To<LocalFrame>(WebView().GetPage()->MainFrame()); LocalFrameView* frame_view = frame->View(); VisualViewport& visual_viewport = frame->GetPage()->GetVisualViewport(); - IntRect target_rect_in_document(2000, 3000, 100, 100); + gfx::Rect target_rect_in_document(2000, 3000, 100, 100); ASSERT_EQ(0.5f, visual_viewport.Scale()); @@ -12944,7 +12944,7 @@ Document* iframe_doc = frame_owner_element->contentDocument(); EXPECT_FALSE(iframe_doc->documentElement()->GetLayoutObject()); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); float maximum_shrink_ratio = 1.0; iframe_doc->GetFrame()->StartPrinting(page_size, page_size, maximum_shrink_ratio); @@ -13013,7 +13013,7 @@ Compositor().BeginFrame(); ScrollableArea* area = GetDocument().View()->LayoutViewport(); ASSERT_EQ(540, area->VisibleHeight()); - ASSERT_EQ(IntSize(400, 570), area->ContentsSize()); + ASSERT_EQ(gfx::Size(400, 570), area->ContentsSize()); // Hide browser controls, growing layout viewport without affecting ICB. WebView().ResizeWithBrowserControls(gfx::Size(400, 600), 60, 0, false); @@ -13021,7 +13021,7 @@ // ContentsSize() should grow to accommodate new visible size. ASSERT_EQ(600, area->VisibleHeight()); - ASSERT_EQ(IntSize(400, 600), area->ContentsSize()); + ASSERT_EQ(gfx::Size(400, 600), area->ContentsSize()); } TEST_F(WebFrameSimTest, LayoutViewLocalVisualRect) {
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index fdb409d..58aadaa 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -292,7 +292,7 @@ } virtual float GetPageShrink(uint32_t page_number) const { - IntRect page_rect = page_rects_[page_number]; + gfx::Rect page_rect = page_rects_[page_number]; return printed_page_width_ / page_rect.width(); } @@ -309,7 +309,7 @@ // The page rect gets scaled and translated, so specify the entire // print content area here as the recording rect. - FloatRect bounds(0, 0, printed_page_height_, printed_page_width_); + gfx::RectF bounds(0, 0, printed_page_height_, printed_page_width_); auto* builder = MakeGarbageCollected<PaintRecordBuilder>(); GraphicsContext& context = builder->Context(); context.SetPrintingMetafile(canvas->GetPrintingMetafile()); @@ -322,8 +322,8 @@ void SpoolAllPagesWithBoundariesForTesting( cc::PaintCanvas* canvas, - const FloatSize& page_size_in_pixels, - const FloatSize& spool_size_in_pixels) { + const gfx::SizeF& page_size_in_pixels, + const gfx::SizeF& spool_size_in_pixels) { DispatchEventsForPrintingOnAllFrames(); if (!GetFrame()->GetDocument() || !GetFrame()->GetDocument()->GetLayoutView()) @@ -336,8 +336,7 @@ ComputePageRects(page_size_in_pixels); - FloatRect all_pages_rect(0, 0, spool_size_in_pixels.width(), - spool_size_in_pixels.height()); + gfx::RectF all_pages_rect(spool_size_in_pixels); auto* builder = MakeGarbageCollected<PaintRecordBuilder>(); GraphicsContext& context = builder->Context(); @@ -406,7 +405,7 @@ // On Linux, we don't have the problem with NativeTheme, hence we let WebKit // do the scaling and ignore the return value. virtual float SpoolPage(GraphicsContext& context, int page_number) { - IntRect page_rect = page_rects_[page_number]; + gfx::Rect page_rect = page_rects_[page_number]; float scale = printed_page_width_ / page_rect.width(); AffineTransform transform; @@ -417,7 +416,7 @@ static_cast<float>(-page_rect.y())); context.Save(); context.ConcatCTM(transform); - context.ClipRect(page_rect); + context.ClipRect(gfx::RectToSkRect(page_rect)); auto* frame_view = GetFrame()->View(); DCHECK(frame_view); @@ -429,7 +428,7 @@ builder->Context(), kGlobalPaintNormalPhase | kGlobalPaintFlattenCompositingLayers | kGlobalPaintAddUrlMetadata, - CullRect(ToGfxRect(page_rect))); + CullRect(page_rect)); { ScopedPaintChunkProperties scoped_paint_chunk_properties( builder->Context().GetPaintController(), property_tree_state, @@ -492,14 +491,14 @@ return 1.0; } - void ComputePageRects(const FloatSize& print_size) override { - IntRect rect(gfx::Point(0, 0), FlooredIntSize(print_size)); - print_params_.print_content_area = ToGfxRect(rect); + void ComputePageRects(const gfx::SizeF& print_size) override { + gfx::Rect rect(gfx::ToFlooredSize(print_size)); + print_params_.print_content_area = rect; page_rects_.Fill(rect, plugin_->PrintBegin(print_params_)); } void ComputePageRectsWithPageSize( - const FloatSize& page_size_in_pixels) override { + const gfx::SizeF& page_size_in_pixels) override { NOTREACHED(); } @@ -530,7 +529,7 @@ ~PaintPreviewContext() override = default; bool Capture(cc::PaintCanvas* canvas, - const IntRect& bounds, + const gfx::Rect& bounds, bool include_linked_destinations) { // This code is based on ChromePrintContext::SpoolSinglePage()/SpoolPage(). // It differs in that it: @@ -561,7 +560,7 @@ flags |= kGlobalPaintAddUrlMetadata; frame_view->PaintContentsOutsideOfLifecycle(builder->Context(), flags, - CullRect(ToGfxRect(bounds))); + CullRect(bounds)); if (include_linked_destinations) { // Add anchors. ScopedPaintChunkProperties scoped_paint_chunk_properties( @@ -810,7 +809,7 @@ gfx::Rect WebLocalFrameImpl::VisibleContentRect() const { if (LocalFrameView* view = GetFrameView()) - return ToGfxRect(view->LayoutViewport()->VisibleContentRect()); + return view->LayoutViewport()->VisibleContentRect(); return gfx::Rect(); } @@ -1719,7 +1718,7 @@ GetFrame(), print_params.use_printing_layout); } - FloatSize size(print_params.print_content_area.size()); + gfx::SizeF size(print_params.print_content_area.size()); print_context_->BeginPrintMode(size.width(), size.height()); print_context_->ComputePageRects(size); @@ -1772,7 +1771,7 @@ GetFrame()->StartPaintPreview(); PaintPreviewContext* paint_preview_context = MakeGarbageCollected<PaintPreviewContext>(GetFrame()); - success = paint_preview_context->Capture(canvas, IntRect(bounds), + success = paint_preview_context->Capture(canvas, bounds, include_linked_destinations); GetFrame()->EndPaintPreview(); } @@ -1818,7 +1817,8 @@ DCHECK(print_context_); print_context_->SpoolAllPagesWithBoundariesForTesting( - canvas, FloatSize(page_size_in_pixels), FloatSize(spool_size_in_pixels)); + canvas, gfx::SizeF(page_size_in_pixels), + gfx::SizeF(spool_size_in_pixels)); } gfx::Rect WebLocalFrameImpl::GetSelectionBoundsRectForTesting() const {
diff --git a/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc b/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc index 9b79beb6..a9e22357 100644 --- a/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc +++ b/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc
@@ -507,7 +507,7 @@ } matrix_.MakeIdentity(); - operations.Apply(FloatSize(0, 0), matrix_); + operations.Apply(gfx::SizeF(0, 0), matrix_); is2d_ = !operations.Has3DOperation();
diff --git a/third_party/blink/renderer/core/html/anchor_element_metrics.cc b/third_party/blink/renderer/core/html/anchor_element_metrics.cc index f597dd4..fe35fdc5 100644 --- a/third_party/blink/renderer/core/html/anchor_element_metrics.cc +++ b/third_party/blink/renderer/core/html/anchor_element_metrics.cc
@@ -187,10 +187,10 @@ if (!local_frame_view || !root_frame_view) return metrics; - IntRect viewport = root_frame_view->LayoutViewport()->VisibleContentRect(); - if (viewport.size().IsEmpty()) + gfx::Rect viewport = root_frame_view->LayoutViewport()->VisibleContentRect(); + if (viewport.IsEmpty()) return metrics; - metrics->viewport_size = ToGfxSize(viewport.size()); + metrics->viewport_size = viewport.size(); // Use the viewport size to normalize anchor element metrics. float base_height = static_cast<float>(viewport.height()); @@ -235,8 +235,8 @@ metrics->ratio_distance_root_bottom = ratio_distance_root_bottom; // Get the anchor element rect that intersects with the viewport. - IntRect target_visible(target); - target_visible.Intersect(IntRect(gfx::Point(), viewport.size())); + gfx::Rect target_visible = ToGfxRect(target); + target_visible.Intersect(gfx::Rect(viewport.size())); // It guarantees to be less or equal to 1. float ratio_visible_area = (target_visible.height() / base_height) *
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_image_source.h b/third_party/blink/renderer/core/html/canvas/canvas_image_source.h index de652ee..49ae239 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_image_source.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_image_source.h
@@ -29,11 +29,11 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/graphics/image_orientation.h" #include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -62,7 +62,7 @@ public: virtual scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) = 0; // IMPORTANT: Result must be independent of whether destinationContext is @@ -90,10 +90,10 @@ // https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvas-placeholder virtual bool IsPlaceholder() const { return false; } - virtual FloatSize ElementSize(const FloatSize& default_object_size, - const RespectImageOrientationEnum) const = 0; - virtual FloatSize DefaultDestinationSize( - const FloatSize& default_object_size, + virtual gfx::SizeF ElementSize(const gfx::SizeF& default_object_size, + const RespectImageOrientationEnum) const = 0; + virtual gfx::SizeF DefaultDestinationSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum respect_orientation) const { return ElementSize(default_object_size, respect_orientation); }
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h index 525f910..d8bbec9 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h
@@ -239,9 +239,9 @@ NOTREACHED(); return 0; } - virtual IntSize DrawingBufferSize() const { + virtual gfx::Size DrawingBufferSize() const { NOTREACHED(); - return IntSize(0, 0); + return gfx::Size(0, 0); } // OffscreenCanvas-specific methods.
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc index feddc3d..bc6343ee 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc
@@ -21,34 +21,36 @@ #include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/skia/include/core/SkSurface.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { CanvasRenderingContextHost::CanvasRenderingContextHost(HostType host_type) : host_type_(host_type) {} -void CanvasRenderingContextHost::RecordCanvasSizeToUMA(const IntSize& size) { +void CanvasRenderingContextHost::RecordCanvasSizeToUMA(const gfx::Size& size) { if (did_record_canvas_size_to_uma_) return; did_record_canvas_size_to_uma_ = true; if (host_type_ == kCanvasHost) { UMA_HISTOGRAM_CUSTOM_COUNTS("Blink.Canvas.SqrtNumberOfPixels", - std::sqrt(size.Area()), 1, 5000, 100); + std::sqrt(size.Area64()), 1, 5000, 100); } else if (host_type_ == kOffscreenCanvasHost) { UMA_HISTOGRAM_CUSTOM_COUNTS("Blink.OffscreenCanvas.SqrtNumberOfPixels", - std::sqrt(size.Area()), 1, 5000, 100); + std::sqrt(size.Area64()), 1, 5000, 100); } else { NOTREACHED(); } } scoped_refptr<StaticBitmapImage> -CanvasRenderingContextHost::CreateTransparentImage(const IntSize& size) const { +CanvasRenderingContextHost::CreateTransparentImage( + const gfx::Size& size) const { if (!IsValidImageSize(size)) return nullptr; SkImageInfo info = SkImageInfo::Make( - SkISize::Make(size.width(), size.height()), + gfx::SizeToSkISize(size), GetRenderingContextSkColorInfo().makeAlphaType(kPremul_SkAlphaType)); sk_sp<SkSurface> surface = SkSurface::MakeRaster(info, info.minRowBytes(), nullptr);
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h index 4f24f4c..b0bdb53 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h
@@ -15,10 +15,9 @@ #include "third_party/blink/renderer/core/html/canvas/ukm_parameters.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_host.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" +#include "ui/gfx/geometry/size.h" class SkColorInfo; @@ -43,7 +42,7 @@ }; explicit CanvasRenderingContextHost(HostType host_type); - void RecordCanvasSizeToUMA(const IntSize&); + void RecordCanvasSizeToUMA(const gfx::Size&); virtual void DetachContext() = 0; @@ -56,7 +55,7 @@ const SkIRect& damage_rect) = 0; virtual bool OriginClean() const = 0; virtual void SetOriginTainted() = 0; - virtual const IntSize& Size() const = 0; + virtual const gfx::Size& Size() const = 0; virtual CanvasRenderingContext* RenderingContext() const = 0; virtual CanvasResourceDispatcher* GetOrCreateResourceDispatcher() = 0; @@ -117,7 +116,8 @@ protected: ~CanvasRenderingContextHost() override = default; - scoped_refptr<StaticBitmapImage> CreateTransparentImage(const IntSize&) const; + scoped_refptr<StaticBitmapImage> CreateTransparentImage( + const gfx::Size&) const; void CreateCanvasResourceProvider2D(RasterModeHint hint); void CreateCanvasResourceProviderWebGL();
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index bd4b5c1..7206e7f 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -108,6 +108,7 @@ #include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "ui/base/resource/resource_scale_factor.h" +#include "ui/gfx/geometry/skia_conversions.h" #include "v8/include/v8.h" namespace blink { @@ -259,7 +260,7 @@ kDefaultCanvasWidth); } -void HTMLCanvasElement::SetSize(const IntSize& new_size) { +void HTMLCanvasElement::SetSize(const gfx::Size& new_size) { if (new_size == Size()) return; ignore_reset_ = true; @@ -491,11 +492,11 @@ GetLayoutObject()->SetShouldCheckForPaintInvalidation(); if (IsRenderingContext2D() && context_->ShouldAntialias() && GetPage() && GetPage()->DeviceScaleFactorDeprecated() > 1.0f) { - FloatRect inflated_rect = FloatRect(IntRect(rect)); + gfx::RectF inflated_rect(gfx::SkIRectToRect(rect)); inflated_rect.Outset(1); dirty_rect_.Union(inflated_rect); } else { - dirty_rect_.Union(FloatRect(IntRect(rect))); + dirty_rect_.Union(gfx::RectF(gfx::SkIRectToRect(rect))); } if (IsRenderingContext2D() && canvas2d_bridge_) canvas2d_bridge_->DidDraw(); @@ -526,16 +527,16 @@ const base::TimeTicks start_time = base::TimeTicks::Now(); const scoped_refptr<CanvasResource> canvas_resource = ResourceProvider()->ProduceCanvasResource(); - const FloatRect src_rect(0, 0, Size().width(), Size().height()); + const gfx::RectF src_rect((gfx::SizeF(Size()))); dirty_rect_.Intersect(src_rect); - const IntRect int_dirty = EnclosingIntRect(dirty_rect_); + const gfx::Rect int_dirty = gfx::ToEnclosingRect(dirty_rect_); const SkIRect damage_rect = SkIRect::MakeXYWH( int_dirty.x(), int_dirty.y(), int_dirty.width(), int_dirty.height()); const bool needs_vertical_flip = !RenderingContext()->IsOriginTopLeft(); frame_dispatcher_->DispatchFrame(std::move(canvas_resource), start_time, damage_rect, needs_vertical_flip, IsOpaque()); - dirty_rect_ = FloatRect(); + dirty_rect_ = gfx::RectF(); } // If the canvas is visible, notifying listeners is taken care of in @@ -580,22 +581,22 @@ } LayoutBox* layout_box = GetLayoutBox(); - FloatRect content_rect; + gfx::RectF content_rect; if (layout_box) { if (auto* replaced = DynamicTo<LayoutReplaced>(layout_box)) - content_rect = FloatRect(replaced->ReplacedContentRect()); + content_rect = gfx::RectF(replaced->ReplacedContentRect()); else - content_rect = FloatRect(layout_box->PhysicalContentBoxRect()); + content_rect = gfx::RectF(layout_box->PhysicalContentBoxRect()); } if (IsRenderingContext2D()) { - FloatRect src_rect(0, 0, Size().width(), Size().height()); + gfx::RectF src_rect(0, 0, Size().width(), Size().height()); dirty_rect_.Intersect(src_rect); - FloatRect invalidation_rect; + gfx::RectF invalidation_rect; if (layout_box) { - FloatRect mapped_dirty_rect = - MapRect(dirty_rect_, src_rect, content_rect); + gfx::RectF mapped_dirty_rect = + gfx::MapRect(dirty_rect_, src_rect, content_rect); if (context_->IsComposited()) { // Composited 2D canvases need the dirty rect to be expressed relative // to the content box, as opposed to the layout box. @@ -611,7 +612,7 @@ if (canvas2d_bridge_) { canvas2d_bridge_->DoPaintInvalidation( - EnclosingIntRect(invalidation_rect)); + gfx::ToEnclosingRect(invalidation_rect)); } } @@ -627,14 +628,14 @@ layout_box->SetShouldDoFullPaintInvalidation(); } - dirty_rect_ = FloatRect(); + dirty_rect_ = gfx::RectF(); } void HTMLCanvasElement::Reset() { if (ignore_reset_) return; - dirty_rect_ = FloatRect(); + dirty_rect_ = gfx::RectF(); bool had_resource_provider = HasResourceProvider(); @@ -657,8 +658,8 @@ origin_clean_ = true; } - IntSize old_size = Size(); - IntSize new_size(w, h); + gfx::Size old_size = Size(); + gfx::Size new_size(w, h); // If the size of an existing buffer matches, we can just clear it instead of // reallocating. This optimization is only done for 2D canvases for now. @@ -809,20 +810,22 @@ Image* broken_canvas = broken_canvas_and_image_scale_factor.first; context.Save(); context.FillRect( - FloatRect(r), Color(), + gfx::RectF(r), Color(), PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground), SkBlendMode::kClear); // Place the icon near the upper left, like the missing image icon // for image elements. Offset it a bit from the upper corner. - FloatSize icon_size(broken_canvas->Size()); - gfx::PointF upper_left = gfx::PointF(r.PixelSnappedOffset()) + - ToGfxVector2dF(icon_size.ScaledBy(0.5f)); + gfx::SizeF icon_size(broken_canvas->Size()); + icon_size.Scale(0.5f); + gfx::PointF upper_left = + gfx::PointF(r.PixelSnappedOffset()) + + gfx::Vector2dF(icon_size.width(), icon_size.height()); context.DrawImage( broken_canvas, Image::kSyncDecode, PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground), - FloatRect(upper_left, icon_size)); + gfx::RectF(upper_left, icon_size)); context.Restore(); return; } @@ -847,7 +850,7 @@ image_for_printing.get(), Image::kSyncDecode, PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground), - FloatRect(PixelSnappedIntRect(r))); + gfx::RectF(ToPixelSnappedRect(r))); return; } @@ -889,7 +892,7 @@ !context_ || context_->CreationAttributes().alpha ? SkBlendMode::kSrcOver : SkBlendMode::kSrc; - FloatRect src_rect = FloatRect(gfx::PointF(), FloatSize(Size())); + gfx::RectF src_rect((gfx::SizeF(Size()))); scoped_refptr<StaticBitmapImage> snapshot = canvas2d_bridge_ ? canvas2d_bridge_->NewImageSnapshot() @@ -902,13 +905,13 @@ snapshot.get(), Image::kSyncDecode, PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground), - FloatRect(PixelSnappedIntRect(r)), &src_rect, composite_operator); + gfx::RectF(ToPixelSnappedRect(r)), &src_rect, composite_operator); } } else { // When alpha is false, we should draw to opaque black. if (!context_->CreationAttributes().alpha) { context.FillRect( - FloatRect(r), Color(0, 0, 0), + gfx::RectF(r), Color(0, 0, 0), PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground)); } @@ -926,7 +929,7 @@ return {GetDocument().UkmRecorder(), GetDocument().UkmSourceID()}; } -void HTMLCanvasElement::SetSurfaceSize(const IntSize& size) { +void HTMLCanvasElement::SetSurfaceSize(const gfx::Size& size) { size_ = size; did_fail_to_create_resource_provider_ = false; DiscardResourceProvider(); @@ -962,7 +965,7 @@ // If the accelerated canvas is too big, there is a logic in WebGL code // path that scales down the drawing buffer to the maximum supported // size. Hence, we need to query the adjusted size of DrawingBuffer. - IntSize adjusted_size = context_->DrawingBufferSize(); + gfx::Size adjusted_size = context_->DrawingBufferSize(); SkColorInfo color_info = GetRenderingContextSkColorInfo().makeAlphaType( kUnpremul_SkAlphaType); if (color_info.colorType() == kN32_SkColorType) @@ -1189,7 +1192,7 @@ !base::FeatureList::IsEnabled( features::kWebviewAccelerateSmallCanvases)) { base::CheckedNumeric<int> checked_canvas_pixel_count = - Size().width() * Size().height(); + Size().GetCheckedArea(); if (!checked_canvas_pixel_count.IsValid()) return false; int canvas_pixel_count = checked_canvas_pixel_count.ValueOrDie(); @@ -1296,7 +1299,7 @@ void HTMLCanvasElement::SetResourceProviderForTesting( std::unique_ptr<CanvasResourceProvider> resource_provider, std::unique_ptr<Canvas2DLayerBridge> bridge, - const IntSize& size) { + const gfx::Size& size) { DiscardResourceProvider(); SetIntegralAttribute(html_names::kWidthAttr, size.width()); SetIntegralAttribute(html_names::kHeightAttr, size.height()); @@ -1307,7 +1310,7 @@ void HTMLCanvasElement::DiscardResourceProvider() { canvas2d_bridge_.reset(); CanvasResourceHost::DiscardResourceProvider(); - dirty_rect_ = FloatRect(); + dirty_rect_ = gfx::RectF(); } void HTMLCanvasElement::PageVisibilityChanged() { @@ -1391,7 +1394,7 @@ scoped_refptr<Image> HTMLCanvasElement::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition) { return GetSourceImageForCanvasInternal(status, alpha_disposition); } @@ -1459,22 +1462,22 @@ return !OriginClean(); } -FloatSize HTMLCanvasElement::ElementSize( - const FloatSize&, +gfx::SizeF HTMLCanvasElement::ElementSize( + const gfx::SizeF&, const RespectImageOrientationEnum) const { if (context_ && HasImageBitmapContext()) { scoped_refptr<Image> image = context_->GetImage(); if (image) - return FloatSize(image->width(), image->height()); - return FloatSize(0, 0); + return gfx::SizeF(image->width(), image->height()); + return gfx::SizeF(0, 0); } if (OffscreenCanvasFrame()) - return FloatSize(OffscreenCanvasFrame()->Size()); - return FloatSize(width(), height()); + return gfx::SizeF(OffscreenCanvasFrame()->Size()); + return gfx::SizeF(width(), height()); } -IntSize HTMLCanvasElement::BitmapSourceSize() const { - return IntSize(width(), height()); +gfx::Size HTMLCanvasElement::BitmapSourceSize() const { + return Size(); } ScriptPromise HTMLCanvasElement::CreateImageBitmap(
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h index d80bea1f..20b27dc 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
@@ -44,8 +44,6 @@ #include "third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h" #include "third_party/blink/renderer/core/page/page_visibility_observer.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_host.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" @@ -55,13 +53,11 @@ #include "third_party/blink/renderer/platform/graphics/surface_layer_bridge.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/prefinalizer.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/size.h" #define CanvasDefaultInterpolationQuality kInterpolationLow -namespace cc { -class Layer; -} - namespace blink { class Canvas2DLayerBridge; @@ -73,7 +69,6 @@ class GraphicsContext; class HTMLCanvasElement; class ImageBitmapOptions; -class IntSize; class StaticBitmapImageToVideoFrameCopier; class @@ -110,12 +105,12 @@ unsigned width() const { return Size().width(); } unsigned height() const { return Size().height(); } - const IntSize& Size() const override { return size_; } + const gfx::Size& Size() const override { return size_; } void setWidth(unsigned, ExceptionState&); void setHeight(unsigned, ExceptionState&); - void SetSize(const IntSize& new_size); + void SetSize(const gfx::Size& new_size); // Called by Document::getCSSCanvasContext as well as above getContext(). CanvasRenderingContext* GetCanvasRenderingContext( @@ -203,11 +198,11 @@ // CanvasImageSource implementation scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) override; bool WouldTaintOrigin() const override; - FloatSize ElementSize(const FloatSize&, - const RespectImageOrientationEnum) const override; + gfx::SizeF ElementSize(const gfx::SizeF&, + const RespectImageOrientationEnum) const override; bool IsCanvasElement() const override { return true; } bool IsOpaque() const override; bool IsAccelerated() const override; @@ -236,7 +231,7 @@ unaccelerated_bridge_used_for_testing = nullptr); // ImageBitmapSource implementation - IntSize BitmapSourceSize() const override; + gfx::Size BitmapSourceSize() const override; ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect> crop_rect, const ImageBitmapOptions*, @@ -249,7 +244,7 @@ void SetResourceProviderForTesting(std::unique_ptr<CanvasResourceProvider>, std::unique_ptr<Canvas2DLayerBridge>, - const IntSize&); + const gfx::Size&); static void RegisterRenderingContextFactory( std::unique_ptr<CanvasRenderingContextFactory>); @@ -356,7 +351,7 @@ RasterMode raster_mode); void SetCanvas2DLayerBridgeInternal(std::unique_ptr<Canvas2DLayerBridge>); - void SetSurfaceSize(const IntSize&); + void SetSurfaceSize(const gfx::Size&); bool PaintsIntoCanvasBuffer() const; @@ -381,7 +376,7 @@ HeapHashSet<WeakMember<CanvasDrawListener>> listeners_; - IntSize size_; + gfx::Size size_; Member<CanvasRenderingContext> context_; // Used only for WebGL currently. @@ -391,7 +386,7 @@ bool canvas_is_clear_ = true; bool ignore_reset_; - FloatRect dirty_rect_; + gfx::RectF dirty_rect_; bool origin_clean_; bool needs_unbuffered_input_ = false;
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.cc b/third_party/blink/renderer/core/html/canvas/image_data.cc index 645d84f5..6c4e659 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.cc +++ b/third_party/blink/renderer/core/html/canvas/image_data.cc
@@ -66,7 +66,7 @@ const ImageDataSettings* settings, ValidateAndCreateParams params, ExceptionState& exception_state) { - IntSize size; + gfx::Size size; if (params.require_canvas_color_management && !RuntimeEnabledFeatures::CanvasColorManagementEnabled()) { exception_state.ThrowTypeError("Overload resolution failed."); @@ -88,7 +88,15 @@ "The source width is zero or not a number."); return nullptr; } + if (width > static_cast<unsigned>(std::numeric_limits<int>::max())) { + // TODO(crbug.com/1273969): Should throw RangeError instead. + exception_state.ThrowDOMException( + DOMExceptionCode::kIndexSizeError, + "The requested image size exceeds the supported range."); + return nullptr; + } size.set_width(width); + if (height) { if (!*height) { exception_state.ThrowDOMException( @@ -96,6 +104,13 @@ "The source height is zero or not a number."); return nullptr; } + if (height > static_cast<unsigned>(std::numeric_limits<int>::max())) { + // TODO(crbug.com/1273969): Should throw RangeError instead. + exception_state.ThrowDOMException( + DOMExceptionCode::kIndexSizeError, + "The requested image size exceeds the supported range."); + return nullptr; + } size.set_height(*height); } @@ -109,6 +124,7 @@ size_in_elements_checked *= size.height(); if (!params.context_2d_error_mode) { if (!size_in_elements_checked.IsValid()) { + // TODO(crbug.com/1273969): Should throw RangeError instead. exception_state.ThrowDOMException( DOMExceptionCode::kIndexSizeError, "The requested image size exceeds the supported range."); @@ -258,7 +274,7 @@ // This function accepts size (0, 0) and always returns the ImageData in // "srgb" color space and "uint8" storage format. -ImageData* ImageData::CreateForTest(const IntSize& size) { +ImageData* ImageData::CreateForTest(const gfx::Size& size) { base::CheckedNumeric<unsigned> data_size = StorageFormatBytesPerPixel(kUint8ClampedArrayStorageFormat); data_size *= size.width(); @@ -279,7 +295,7 @@ // This function is called from unit tests, and all the parameters are supposed // to be validated on the call site. -ImageData* ImageData::CreateForTest(const IntSize& size, +ImageData* ImageData::CreateForTest(const gfx::Size& size, NotShared<DOMArrayBufferView> buffer_view, CanvasColorSpace color_space, ImageDataStorageFormat storage_format) { @@ -457,7 +473,7 @@ return wrapper; } -ImageData::ImageData(const IntSize& size, +ImageData::ImageData(const gfx::Size& size, NotShared<DOMArrayBufferView> data, CanvasColorSpace color_space, ImageDataStorageFormat storage_format)
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.h b/third_party/blink/renderer/core/html/canvas/image_data.h index fc9ae946..0d1415a4 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.h +++ b/third_party/blink/renderer/core/html/canvas/image_data.h
@@ -38,13 +38,12 @@ #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/canvas_color_params.h" #include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/skia/include/core/SkColorSpace.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -187,13 +186,13 @@ // TODO(https://crbug.com/1198606): Remove this. ImageDataSettings* getSettings() { return settings_; } - static ImageData* CreateForTest(const IntSize&); - static ImageData* CreateForTest(const IntSize&, + static ImageData* CreateForTest(const gfx::Size&); + static ImageData* CreateForTest(const gfx::Size&, NotShared<DOMArrayBufferView>, CanvasColorSpace, ImageDataStorageFormat); - ImageData(const IntSize&, + ImageData(const gfx::Size&, NotShared<DOMArrayBufferView>, CanvasColorSpace, ImageDataStorageFormat); @@ -203,7 +202,7 @@ static unsigned StorageFormatBytesPerPixel(const String&); static unsigned StorageFormatBytesPerPixel(ImageDataStorageFormat); - IntSize Size() const { return size_; } + gfx::Size Size() const { return size_; } int width() const { return size_.width(); } int height() const { return size_.height(); } String colorSpace() const; @@ -222,7 +221,7 @@ SkPixmap GetSkPixmap() const; // ImageBitmapSource implementation - IntSize BitmapSourceSize() const override { return size_; } + gfx::Size BitmapSourceSize() const override { return size_; } ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect> crop_rect, const ImageBitmapOptions*, @@ -236,7 +235,7 @@ v8::Local<v8::Object> wrapper) override; private: - IntSize size_; + gfx::Size size_; // TODO(https://crbug.com/1198606): Remove this. Member<ImageDataSettings> settings_; Member<V8ImageDataArray> data_;
diff --git a/third_party/blink/renderer/core/html/canvas/image_data_test.cc b/third_party/blink/renderer/core/html/canvas/image_data_test.cc index 4fac5a03..688adbf8 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data_test.cc +++ b/third_party/blink/renderer/core/html/canvas/image_data_test.cc
@@ -29,7 +29,7 @@ TEST_F(ImageDataTest, ImageDataTooBigToAllocateDoesNotCrash) { ImageData* image_data = ImageData::CreateForTest( - IntSize(1, (v8::TypedArray::kMaxLength / 4) + 1)); + gfx::Size(1, (v8::TypedArray::kMaxLength / 4) + 1)); EXPECT_EQ(image_data, nullptr); }
diff --git a/third_party/blink/renderer/core/html/canvas/image_element_base.cc b/third_party/blink/renderer/core/html/canvas/image_element_base.cc index 5b6d4ffa6..926dbce2 100644 --- a/third_party/blink/renderer/core/html/canvas/image_element_base.cc +++ b/third_party/blink/renderer/core/html/canvas/image_element_base.cc
@@ -47,7 +47,7 @@ scoped_refptr<Image> ImageElementBase::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize& default_object_size, + const gfx::SizeF& default_object_size, const AlphaDisposition alpha_disposition) { // UnpremultiplyAlpha is not implemented yet. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha); @@ -66,7 +66,7 @@ scoped_refptr<Image> source_image = image_content->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(source_image.get())) { UseCounter::Count(GetElement().GetDocument(), WebFeature::kSVGInCanvas2D); - FloatSize image_size = svg_image->ConcreteObjectSize(default_object_size); + gfx::SizeF image_size = svg_image->ConcreteObjectSize(default_object_size); source_image = SVGImageForContainer::Create( svg_image, image_size, 1, GetElement().GetDocument().CompleteURL(GetElement().ImageSourceURL())); @@ -80,20 +80,20 @@ return CachedImage() && !CachedImage()->IsAccessAllowed(); } -FloatSize ImageElementBase::ElementSize( - const FloatSize& default_object_size, +gfx::SizeF ImageElementBase::ElementSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum respect_orientation) const { ImageResourceContent* image_content = CachedImage(); if (!image_content || !image_content->HasImage()) - return FloatSize(); + return gfx::SizeF(); Image* image = image_content->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(image)) return svg_image->ConcreteObjectSize(default_object_size); - return FloatSize(image->Size(respect_orientation)); + return gfx::SizeF(image->Size(respect_orientation)); } -FloatSize ImageElementBase::DefaultDestinationSize( - const FloatSize& default_object_size, +gfx::SizeF ImageElementBase::DefaultDestinationSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum respect_orientation) const { return ElementSize(default_object_size, respect_orientation); } @@ -114,10 +114,10 @@ return image->CurrentFrameKnownToBeOpaque(); } -IntSize ImageElementBase::BitmapSourceSize() const { +gfx::Size ImageElementBase::BitmapSourceSize() const { ImageResourceContent* image = CachedImage(); if (!image) - return IntSize(); + return gfx::Size(); // This method is called by ImageBitmap when creating and cropping the image. // Return un-oriented size because the cropping must happen before // orienting. @@ -127,7 +127,7 @@ static bool HasDimensionsForImage(SVGImage* svg_image, absl::optional<gfx::Rect> crop_rect, const ImageBitmapOptions* options) { - if (!svg_image->ConcreteObjectSize(FloatSize()).IsEmpty()) + if (!svg_image->ConcreteObjectSize(gfx::SizeF()).IsEmpty()) return true; if (crop_rect) return true;
diff --git a/third_party/blink/renderer/core/html/canvas/image_element_base.h b/third_party/blink/renderer/core/html/canvas/image_element_base.h index 9b526f56..4c3279c3 100644 --- a/third_party/blink/renderer/core/html/canvas/image_element_base.h +++ b/third_party/blink/renderer/core/html/canvas/image_element_base.h
@@ -26,7 +26,7 @@ // base for both elements. static Image::ImageDecodingMode ParseImageDecodingMode(const AtomicString&); - IntSize BitmapSourceSize() const override; + gfx::Size BitmapSourceSize() const override; ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect>, const ImageBitmapOptions*, @@ -34,15 +34,15 @@ scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) override; bool WouldTaintOrigin() const override; - FloatSize ElementSize(const FloatSize& default_object_size, - const RespectImageOrientationEnum) const override; - FloatSize DefaultDestinationSize( - const FloatSize& default_object_size, + gfx::SizeF ElementSize(const gfx::SizeF& default_object_size, + const RespectImageOrientationEnum) const override; + gfx::SizeF DefaultDestinationSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum) const override; bool IsAccelerated() const override;
diff --git a/third_party/blink/renderer/core/html/html_image_element.cc b/third_party/blink/renderer/core/html/html_image_element.cc index fd269da..2553ee5 100644 --- a/third_party/blink/renderer/core/html/html_image_element.cc +++ b/third_party/blink/renderer/core/html/html_image_element.cc
@@ -742,12 +742,12 @@ return FastHasAttribute(html_names::kUsemapAttr); } -FloatSize HTMLImageElement::DefaultDestinationSize( - const FloatSize& default_object_size, +gfx::SizeF HTMLImageElement::DefaultDestinationSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum respect_orientation) const { ImageResourceContent* image_content = CachedImage(); if (!image_content || !image_content->HasImage()) - return FloatSize(); + return gfx::SizeF(); Image* image = image_content->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(image)) @@ -757,7 +757,7 @@ if (GetLayoutObject() && GetLayoutObject()->IsLayoutImage() && image->HasIntrinsicSize()) size.Scale(To<LayoutImage>(GetLayoutObject())->ImageDevicePixelRatio()); - return FloatSize(size); + return gfx::SizeF(size); } static bool SourceSizeValue(const Element* element,
diff --git a/third_party/blink/renderer/core/html/html_image_element.h b/third_party/blink/renderer/core/html/html_image_element.h index ae0c6c4..9bf413d 100644 --- a/third_party/blink/renderer/core/html/html_image_element.h +++ b/third_party/blink/renderer/core/html/html_image_element.h
@@ -139,8 +139,8 @@ bool IsCollapsed() const; // CanvasImageSource interface implementation. - FloatSize DefaultDestinationSize( - const FloatSize&, + gfx::SizeF DefaultDestinationSize( + const gfx::SizeF&, const RespectImageOrientationEnum) const override; // public so that HTMLPictureElement can call this as well.
diff --git a/third_party/blink/renderer/core/html/image_document.cc b/third_party/blink/renderer/core/html/image_document.cc index 940904a..a94ce23 100644 --- a/third_party/blink/renderer/core/html/image_document.cc +++ b/third_party/blink/renderer/core/html/image_document.cc
@@ -115,7 +115,7 @@ // -------- -static String ImageTitle(const String& filename, const IntSize& size) { +static String ImageTitle(const String& filename, const gfx::Size& size) { StringBuilder result; result.Append(filename); result.Append(" ("); @@ -215,7 +215,7 @@ return MakeGarbageCollected<ImageDocumentParser>(this); } -IntSize ImageDocument::ImageSize() const { +gfx::Size ImageDocument::ImageSize() const { DCHECK(image_element_); DCHECK(image_element_->CachedImage()); return image_element_->CachedImage()->IntrinsicSize( @@ -307,7 +307,7 @@ // Report the natural image size in the page title, regardless of zoom // level. At a zoom level of 1 the image is guaranteed to have an integer // size. - IntSize size = ImageSize(); + gfx::Size size = ImageSize(); if (!size.width()) return; // Compute the title, we use the decoded filename of the resource, falling @@ -328,7 +328,7 @@ if (!view) return 1.0f; - IntSize image_size = ImageSize(); + gfx::Size image_size = ImageSize(); if (image_size.IsEmpty()) return 1.0f; @@ -347,8 +347,7 @@ if (!image_element_ || image_element_->GetDocument() != this) return; - IntSize image_size = ImageSize(); - image_size.Scale(Scale()); + gfx::Size image_size = gfx::ScaleToFlooredSize(ImageSize(), Scale()); image_element_->setWidth(image_size.width()); image_element_->setHeight(image_size.height()); @@ -462,7 +461,7 @@ image_element_->GetDocument() != this) return; - IntSize image_size = ImageSize(); + gfx::Size image_size = ImageSize(); image_element_->setWidth(image_size.width()); image_element_->setHeight(image_size.height()); UpdateImageStyle();
diff --git a/third_party/blink/renderer/core/html/image_document.h b/third_party/blink/renderer/core/html/image_document.h index 59027e23..d77336f 100644 --- a/third_party/blink/renderer/core/html/image_document.h +++ b/third_party/blink/renderer/core/html/image_document.h
@@ -28,12 +28,15 @@ #include "base/gtest_prod_util.h" #include "third_party/blink/renderer/core/html/html_document.h" +namespace gfx { +class Size; +} + namespace blink { class HTMLDivElement; class HTMLImageElement; class ImageResourceContent; -class IntSize; class CORE_EXPORT ImageDocument final : public HTMLDocument { public: @@ -42,7 +45,7 @@ ImageResourceContent* CachedImage(); HTMLImageElement* ImageElement() const { return image_element_.Get(); } - IntSize ImageSize() const; + gfx::Size ImageSize() const; void CreateDocumentStructure(ImageResourceContent*); void WindowSizeChanged();
diff --git a/third_party/blink/renderer/core/html/media/html_video_element.cc b/third_party/blink/renderer/core/html/media/html_video_element.cc index f91746e9..9a59668 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element.cc +++ b/third_party/blink/renderer/core/html/media/html_video_element.cc
@@ -382,7 +382,7 @@ } void HTMLVideoElement::PaintCurrentFrame(cc::PaintCanvas* canvas, - const IntRect& dest_rect, + const gfx::Rect& dest_rect, const PaintFlags* flags) const { if (!GetWebMediaPlayer()) return; @@ -396,7 +396,7 @@ media_flags.setBlendMode(SkBlendMode::kSrc); } - GetWebMediaPlayer()->Paint(canvas, ToGfxRect(dest_rect), media_flags); + GetWebMediaPlayer()->Paint(canvas, dest_rect, media_flags); } bool HTMLVideoElement::HasAvailableVideoFrame() const { @@ -527,7 +527,7 @@ if (!media_video_frame || !video_renderer) return nullptr; - const auto intrinsic_size = IntSize(media_video_frame->natural_size()); + const gfx::Size intrinsic_size = media_video_frame->natural_size(); if (!resource_provider_ || allow_accelerated_images != resource_provider_->IsAccelerated() || intrinsic_size != resource_provider_->Size()) { @@ -557,7 +557,7 @@ scoped_refptr<Image> HTMLVideoElement::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition) { // UnpremultiplyAlpha is not implemented yet. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha); @@ -576,14 +576,14 @@ return !IsMediaDataCorsSameOrigin(); } -FloatSize HTMLVideoElement::ElementSize( - const FloatSize&, +gfx::SizeF HTMLVideoElement::ElementSize( + const gfx::SizeF&, const RespectImageOrientationEnum) const { - return FloatSize(videoWidth(), videoHeight()); + return gfx::SizeF(videoWidth(), videoHeight()); } -IntSize HTMLVideoElement::BitmapSourceSize() const { - return IntSize(videoWidth(), videoHeight()); +gfx::Size HTMLVideoElement::BitmapSourceSize() const { + return gfx::Size(videoWidth(), videoHeight()); } ScriptPromise HTMLVideoElement::CreateImageBitmap(
diff --git a/third_party/blink/renderer/core/html/media/html_video_element.h b/third_party/blink/renderer/core/html/media/html_video_element.h index 2fa6de0..49defa7 100644 --- a/third_party/blink/renderer/core/html/media/html_video_element.h +++ b/third_party/blink/renderer/core/html/media/html_video_element.h
@@ -90,7 +90,7 @@ // // PaintFlags is optional. If unspecified, its blend mode defaults to kSrc. void PaintCurrentFrame(cc::PaintCanvas*, - const IntRect&, + const gfx::Rect&, const cc::PaintFlags*) const; bool HasAvailableVideoFrame() const; @@ -112,12 +112,12 @@ // CanvasImageSource implementation scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) override; bool IsVideoElement() const override { return true; } bool WouldTaintOrigin() const override; - FloatSize ElementSize(const FloatSize&, - const RespectImageOrientationEnum) const override; + gfx::SizeF ElementSize(const gfx::SizeF&, + const RespectImageOrientationEnum) const override; const KURL& SourceURL() const override { return currentSrc(); } bool IsHTMLVideoElement() const override { return true; } // Video elements currently always go through RAM when used as a canvas image @@ -125,7 +125,7 @@ bool IsAccelerated() const override { return false; } // ImageBitmapSource implementation - IntSize BitmapSourceSize() const override; + gfx::Size BitmapSourceSize() const override; ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect> crop_rect, const ImageBitmapOptions*,
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc b/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc index 6a0df39..f122399 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc
@@ -55,7 +55,7 @@ ImageBitmap::ParsedOptions ParseOptions(const ImageBitmapOptions* options, absl::optional<gfx::Rect> crop_rect, - IntSize source_size) { + gfx::Size source_size) { ImageBitmap::ParsedOptions parsed_options; if (options->imageOrientation() == kImageOrientationFlipY) { parsed_options.flip_y = true; @@ -178,7 +178,7 @@ // Orient the data, and re-read the pixels. if (apply_orientation && !input->HasDefaultOrientation()) { paint_image = Image::ResizeAndOrientImage( - paint_image, input->CurrentFrameOrientation(), FloatSize(1, 1), 1, + paint_image, input->CurrentFrameOrientation(), gfx::Vector2dF(1, 1), 1, kInterpolationNone); read_pixels_successful = paint_image.readPixels(info, dst_buffer.data(), info.minRowBytes(), 0, 0); @@ -405,9 +405,9 @@ DCHECK(image); DCHECK(!image->HasData()); - IntRect img_rect(gfx::Point(), IntSize(image->width(), image->height())); - const IntRect& src_rect = IntRect(parsed_options.crop_rect); - const IntRect intersect_rect = IntersectRects(img_rect, src_rect); + gfx::Rect img_rect(image->width(), image->height()); + const gfx::Rect& src_rect = parsed_options.crop_rect; + const gfx::Rect intersect_rect = IntersectRects(img_rect, src_rect); // If cropRect doesn't intersect the source image, return a transparent black // image. @@ -437,10 +437,10 @@ } // down-scaling has higher priority than other tasks, up-scaling has lower. - bool down_scaling = - parsed_options.should_scale_input && - (parsed_options.resize_width * parsed_options.resize_height < - result->Size().Area()); + bool down_scaling = parsed_options.should_scale_input && + (static_cast<uint64_t>(parsed_options.resize_width) * + parsed_options.resize_height < + result->Size().Area64()); bool up_scaling = parsed_options.should_scale_input && !down_scaling; // resize if down-scaling @@ -594,7 +594,7 @@ const ImageBitmapOptions* options) { SourceImageStatus status; scoped_refptr<Image> image_input = - canvas->GetSourceImageForCanvas(&status, FloatSize()); + canvas->GetSourceImageForCanvas(&status, gfx::SizeF()); if (status != kNormalSourceImageStatus) return; DCHECK(IsA<StaticBitmapImage>(image_input.get())); @@ -602,7 +602,7 @@ static_cast<StaticBitmapImage*>(image_input.get()); ParsedOptions parsed_options = ParseOptions( - options, crop_rect, IntSize(input->width(), input->height())); + options, crop_rect, gfx::Size(input->width(), input->height())); if (DstBufferSizeHasOverflow(parsed_options)) return; @@ -620,7 +620,7 @@ const ImageBitmapOptions* options) { SourceImageStatus status; scoped_refptr<Image> raw_input = offscreen_canvas->GetSourceImageForCanvas( - &status, FloatSize(offscreen_canvas->Size())); + &status, gfx::SizeF(offscreen_canvas->Size())); DCHECK(IsA<StaticBitmapImage>(raw_input.get())); scoped_refptr<StaticBitmapImage> input = static_cast<StaticBitmapImage*>(raw_input.get()); @@ -630,7 +630,7 @@ return; ParsedOptions parsed_options = ParseOptions( - options, crop_rect, IntSize(input->width(), input->height())); + options, crop_rect, gfx::Size(input->width(), input->height())); if (DstBufferSizeHasOverflow(parsed_options)) return; @@ -664,9 +664,9 @@ if (DstBufferSizeHasOverflow(parsed_options)) return; - const IntRect& src_rect = IntRect(parsed_options.crop_rect); - const IntRect data_src_rect = IntRect(gfx::Point(), data->Size()); - const IntRect intersect_rect = + const gfx::Rect& src_rect = parsed_options.crop_rect; + const gfx::Rect data_src_rect(data->Size()); + const gfx::Rect intersect_rect = crop_rect ? IntersectRects(src_rect, data_src_rect) : data_src_rect; // If cropRect doesn't intersect the source image, return a transparent black @@ -700,10 +700,10 @@ return; // down-scaling has higher priority than other tasks, up-scaling has lower. - bool down_scaling = - parsed_options.should_scale_input && - (parsed_options.resize_width * parsed_options.resize_height < - image_->Size().Area()); + bool down_scaling = parsed_options.should_scale_input && + (static_cast<uint64_t>(parsed_options.resize_width) * + parsed_options.resize_height < + image_->Size().Area64()); bool up_scaling = parsed_options.should_scale_input && !down_scaling; // resize if down-scaling @@ -856,7 +856,7 @@ void ImageBitmap::RasterizeImageOnBackgroundThread( sk_sp<PaintRecord> paint_record, - const IntRect& dst_rect, + const gfx::Rect& dst_rect, scoped_refptr<base::SequencedTaskRunner> task_runner, WTF::CrossThreadOnceFunction<void(sk_sp<SkImage>, const ImageOrientationEnum)> callback) { @@ -894,12 +894,12 @@ scoped_refptr<Image> input = image->CachedImage()->GetImage(); DCHECK(input->IsSVGImage()); - IntRect input_rect(gfx::Point(), input->Size()); + gfx::Rect input_rect(input->Size()); // In the case when |crop_rect| doesn't intersect the source image, we return // a transparent black image, respecting the color_params but ignoring // premultiply_alpha. - if (!parsed_options.crop_rect.Intersects(ToGfxRect(input_rect))) { + if (!parsed_options.crop_rect.Intersects(input_rect)) { ImageBitmap* bitmap = MakeGarbageCollected<ImageBitmap>(MakeBlankImage(parsed_options)); if (bitmap->BitmapImage()) { @@ -913,19 +913,20 @@ return promise; } - IntRect draw_src_rect(parsed_options.crop_rect); - IntRect draw_dst_rect(0, 0, parsed_options.resize_width, - parsed_options.resize_height); + gfx::Rect draw_src_rect = parsed_options.crop_rect; + gfx::Rect draw_dst_rect(0, 0, parsed_options.resize_width, + parsed_options.resize_height); PaintRecorder recorder; - cc::PaintCanvas* canvas = recorder.beginRecording(draw_src_rect); + cc::PaintCanvas* canvas = + recorder.beginRecording(gfx::RectToSkRect(draw_src_rect)); if (parsed_options.flip_y) { canvas->translate(0, draw_dst_rect.height()); canvas->scale(1, -1); } SVGImageForContainer::Create(To<SVGImage>(input.get()), - FloatSize(input_rect.size()), 1, NullURL()) - ->Draw(canvas, cc::PaintFlags(), FloatRect(draw_dst_rect), - FloatRect(draw_src_rect), ImageDrawOptions()); + gfx::SizeF(input_rect.size()), 1, NullURL()) + ->Draw(canvas, cc::PaintFlags(), gfx::RectF(draw_dst_rect), + gfx::RectF(draw_src_rect), ImageDrawOptions()); sk_sp<PaintRecord> paint_record = recorder.finishRecordingAsPicture(); std::unique_ptr<ParsedOptions> passed_parsed_options = @@ -967,7 +968,7 @@ unsigned ImageBitmap::width() const { if (!image_) return 0; - IntSize size = image_->PreferredDisplaySize(); + gfx::Size size = image_->PreferredDisplaySize(); DCHECK_GT(size.width(), 0); return size.width(); } @@ -975,7 +976,7 @@ unsigned ImageBitmap::height() const { if (!image_) return 0; - IntSize size = image_->PreferredDisplaySize(); + gfx::Size size = image_->PreferredDisplaySize(); DCHECK_GT(size.height(), 0); return size.height(); } @@ -984,9 +985,9 @@ return image_ && image_->IsTextureBacked(); } -IntSize ImageBitmap::Size() const { +gfx::Size ImageBitmap::Size() const { if (!image_) - return IntSize(); + return gfx::Size(); DCHECK_GT(image_->width(), 0); DCHECK_GT(image_->height(), 0); return image_->PreferredDisplaySize(); @@ -1004,7 +1005,7 @@ scoped_refptr<Image> ImageBitmap::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition) { *status = kNormalSourceImageStatus; if (!image_) @@ -1017,10 +1018,10 @@ return GetImageWithAlphaDisposition(std::move(image), alpha_disposition); } -FloatSize ImageBitmap::ElementSize( - const FloatSize&, +gfx::SizeF ImageBitmap::ElementSize( + const gfx::SizeF&, const RespectImageOrientationEnum respect_orientation) const { - return FloatSize(image_->Size(respect_orientation)); + return gfx::SizeF(image_->Size(respect_orientation)); } } // namespace blink
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap.h b/third_party/blink/renderer/core/imagebitmap/image_bitmap.h index d40e0ab..7e27f152 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap.h +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap.h
@@ -86,7 +86,7 @@ bool apply_orientation); unsigned width() const; unsigned height() const; - IntSize Size() const; + gfx::Size Size() const; bool IsNeutered() const override { return is_neutered_; } bool OriginClean() const { return image_->OriginClean(); } @@ -99,18 +99,18 @@ // CanvasImageSource implementation scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) override; bool WouldTaintOrigin() const override { return image_ ? !image_->OriginClean() : false; } - FloatSize ElementSize(const FloatSize&, - const RespectImageOrientationEnum) const override; + gfx::SizeF ElementSize(const gfx::SizeF&, + const RespectImageOrientationEnum) const override; bool IsImageBitmap() const override { return true; } bool IsAccelerated() const override; // ImageBitmapSource implementation - IntSize BitmapSourceSize() const override { return Size(); } + gfx::Size BitmapSourceSize() const override { return Size(); } ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect>, const ImageBitmapOptions*, @@ -138,7 +138,7 @@ const ImageOrientationEnum); static void RasterizeImageOnBackgroundThread( sk_sp<PaintRecord>, - const IntRect&, + const gfx::Rect&, scoped_refptr<base::SequencedTaskRunner>, WTF::CrossThreadOnceFunction<void(sk_sp<SkImage>, const ImageOrientationEnum)> callback);
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h b/third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h index b50bdbb..50cd690 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h
@@ -10,9 +10,9 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -23,7 +23,7 @@ DISALLOW_NEW(); public: - virtual IntSize BitmapSourceSize() const { return IntSize(); } + virtual gfx::Size BitmapSourceSize() const { return gfx::Size(); } virtual ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect>, const ImageBitmapOptions*,
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap_test.cc b/third_party/blink/renderer/core/imagebitmap/image_bitmap_test.cc index bbb71362..8093fe6 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap_test.cc +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap_test.cc
@@ -328,12 +328,12 @@ TEST_F(ImageBitmapTest, MAYBE_CreateImageBitmapFromTooBigImageDataDoesNotCrash) { ImageData* image_data = - ImageData::CreateForTest(IntSize(v8::TypedArray::kMaxLength / 16, 1)); + ImageData::CreateForTest(gfx::Size(v8::TypedArray::kMaxLength / 16, 1)); DCHECK(image_data); ImageBitmapOptions* options = ImageBitmapOptions::Create(); options->setColorSpaceConversion("default"); auto* image_bitmap = MakeGarbageCollected<ImageBitmap>( - image_data, gfx::Rect(ToGfxSize(image_data->Size())), options); + image_data, gfx::Rect(image_data->Size()), options); DCHECK(image_bitmap); }
diff --git a/third_party/blink/renderer/core/input/event_handler.cc b/third_party/blink/renderer/core/input/event_handler.cc index 4b41d3e7..6f6db9f 100644 --- a/third_party/blink/renderer/core/input/event_handler.cc +++ b/third_party/blink/renderer/core/input/event_handler.cc
@@ -164,7 +164,7 @@ if (image.IsNull()) return gfx::Point(); - IntRect image_rect = image.Rect(); + gfx::Rect image_rect = image.Rect(); // Hot spot must be inside cursor rectangle. if (hot_spot_specified) { @@ -584,12 +584,12 @@ float scale = style_image->ImageScaleFactor(); bool hot_spot_specified = (*cursors)[i].HotSpotSpecified(); gfx::Point hot_spot = (*cursors)[i].HotSpot(); - IntSize size = cached_image->GetImage()->Size(); + gfx::Size size = cached_image->GetImage()->Size(); if (cached_image->ErrorOccurred()) continue; // Limit the size of cursors (in UI pixels) so that they cannot be // used to cover UI elements in chrome. - size.Scale(1 / scale); + size = gfx::ScaleToFlooredSize(size, 1 / scale); if (size.width() > kMaximumCursorSize || size.height() > kMaximumCursorSize) continue; @@ -646,11 +646,11 @@ // resolution for high DPI displays. scoped_refptr<Image> svg_image_holder; if (auto* svg_image = DynamicTo<SVGImage>(image)) { - IntSize scaled_size(svg_image->Size()); - scaled_size.Scale(device_scale_factor); + gfx::Size scaled_size = + gfx::ScaleToFlooredSize(svg_image->Size(), device_scale_factor); // TODO(fs): Should pass proper URL. Use StyleImage::GetImage. svg_image_holder = SVGImageForContainer::Create( - svg_image, FloatSize(scaled_size), device_scale_factor, NullURL()); + svg_image, gfx::SizeF(scaled_size), device_scale_factor, NullURL()); image = svg_image_holder.get(); }
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc index 6eeb325..fefedfbef 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc
@@ -1500,8 +1500,8 @@ main_frame->GetDocument()->UpdateStyleAndLayout( DocumentUpdateReason::kInspector); - IntRect visible_contents = - main_frame->View()->LayoutViewport()->VisibleContentRect(); + IntRect visible_contents( + main_frame->View()->LayoutViewport()->VisibleContentRect()); *out_layout_viewport = protocol::Page::LayoutViewport::create() .setPageX(visible_contents.x()) .setPageY(visible_contents.y()) @@ -1525,7 +1525,7 @@ LocalFrameView* frame_view = main_frame->View(); ScrollOffset page_offset = frame_view->GetScrollableArea()->GetScrollOffset(); - IntSize content_size = frame_view->GetScrollableArea()->ContentsSize(); + gfx::Size content_size = frame_view->GetScrollableArea()->ContentsSize(); *out_content_size = protocol::DOM::Rect::create() .setX(0) .setY(0) @@ -1538,7 +1538,7 @@ // pixels. Details: https://crbug.com/1181313 IntRect css_content_size = main_frame->GetPage()->GetChromeClient().ViewportToScreen( - IntRect(gfx::Point(0, 0), content_size), main_frame->View()); + IntRect(gfx::Point(), IntSize(content_size)), main_frame->View()); *out_css_content_size = protocol::DOM::Rect::create() .setX(css_content_size.x()) .setY(css_content_size.y()) @@ -1554,7 +1554,7 @@ page_zoom / main_frame->GetPage()->GetChromeClient().WindowToViewportScalar( main_frame, 1); - FloatRect visible_rect = visual_viewport.VisibleRect(); + gfx::RectF visible_rect = visual_viewport.VisibleRect(); float scale = visual_viewport.Scale(); *out_visual_viewport = protocol::Page::VisualViewport::create() .setOffsetX(AdjustForAbsoluteZoom::AdjustScroll(
diff --git a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc index 7da7a28..2230fa6 100644 --- a/third_party/blink/renderer/core/inspector/inspector_trace_events.cc +++ b/third_party/blink/renderer/core/inspector/inspector_trace_events.cc
@@ -1272,8 +1272,8 @@ void inspector_paint_image_event::Data(perfetto::TracedValue context, const LayoutImage& layout_image, - const FloatRect& src_rect, - const FloatRect& dest_rect) { + const gfx::RectF& src_rect, + const gfx::RectF& dest_rect) { auto dict = std::move(context).WriteDictionary(); SetGeneratingNodeInfo(dict, &layout_image, "nodeId"); if (const ImageResourceContent* content = layout_image.CachedImage()) @@ -1299,8 +1299,8 @@ void inspector_paint_image_event::Data(perfetto::TracedValue context, Node* node, const StyleImage& style_image, - const FloatRect& src_rect, - const FloatRect& dest_rect) { + const gfx::RectF& src_rect, + const gfx::RectF& dest_rect) { auto dict = std::move(context).WriteDictionary(); if (node) SetNodeInfo(dict, node, "nodeId", nullptr);
diff --git a/third_party/blink/renderer/core/inspector/inspector_trace_events.h b/third_party/blink/renderer/core/inspector/inspector_trace_events.h index b542ba19..2bcac832 100644 --- a/third_party/blink/renderer/core/inspector/inspector_trace_events.h +++ b/third_party/blink/renderer/core/inspector/inspector_trace_events.h
@@ -27,6 +27,10 @@ class UnguessableToken; } +namespace gfx { +class RectF; +} + namespace v8 { class Function; template <typename T> @@ -48,7 +52,6 @@ class Event; class ExecutionContext; class FloatQuad; -class FloatRect; class Frame; class HitTestLocation; class HitTestRequest; @@ -439,16 +442,16 @@ namespace inspector_paint_image_event { void Data(perfetto::TracedValue context, const LayoutImage&, - const FloatRect& src_rect, - const FloatRect& dest_rect); + const gfx::RectF& src_rect, + const gfx::RectF& dest_rect); void Data(perfetto::TracedValue context, const LayoutObject&, const StyleImage&); void Data(perfetto::TracedValue context, Node*, const StyleImage&, - const FloatRect& src_rect, - const FloatRect& dest_rect); + const gfx::RectF& src_rect, + const gfx::RectF& dest_rect); void Data(perfetto::TracedValue context, const LayoutObject*, const ImageResourceContent&);
diff --git a/third_party/blink/renderer/core/layout/custom_scrollbar.cc b/third_party/blink/renderer/core/layout/custom_scrollbar.cc index 7d3fdcc..a34a469 100644 --- a/third_party/blink/renderer/core/layout/custom_scrollbar.cc +++ b/third_party/blink/renderer/core/layout/custom_scrollbar.cc
@@ -181,9 +181,9 @@ new_thickness = it->value->ComputeThickness(); if (new_thickness != old_thickness) { - SetFrameRect( - IntRect(Location(), IntSize(is_horizontal ? Width() : new_thickness, - is_horizontal ? new_thickness : Height()))); + SetFrameRect(gfx::Rect( + Location(), gfx::Size(is_horizontal ? Width() : new_thickness, + is_horizontal ? new_thickness : Height()))); if (LayoutBox* box = GetScrollableArea()->GetLayoutBox()) { if (auto* layout_block = DynamicTo<LayoutBlock>(box)) layout_block->NotifyScrollbarThicknessChanged(); @@ -284,16 +284,16 @@ part_layout_object->SetStyle(std::move(part_style)); } -IntRect CustomScrollbar::ButtonRect(ScrollbarPart part_type) const { +gfx::Rect CustomScrollbar::ButtonRect(ScrollbarPart part_type) const { auto it = parts_.find(part_type); if (it == parts_.end()) - return IntRect(); + return gfx::Rect(); bool is_horizontal = Orientation() == kHorizontalScrollbar; int button_length = it->value->ComputeLength(); - IntRect button_rect(Location(), is_horizontal - ? IntSize(button_length, Height()) - : IntSize(Width(), button_length)); + gfx::Rect button_rect(Location(), is_horizontal + ? gfx::Size(button_length, Height()) + : gfx::Size(Width(), button_length)); switch (part_type) { case kBackButtonStartPart: @@ -303,13 +303,13 @@ is_horizontal ? 0 : Height() - button_length); break; case kForwardButtonStartPart: { - IntRect previous_button = ButtonRect(kBackButtonStartPart); + gfx::Rect previous_button = ButtonRect(kBackButtonStartPart); button_rect.Offset(is_horizontal ? previous_button.width() : 0, is_horizontal ? 0 : previous_button.height()); break; } case kBackButtonEndPart: { - IntRect next_button = ButtonRect(kForwardButtonEndPart); + gfx::Rect next_button = ButtonRect(kForwardButtonEndPart); button_rect.Offset( is_horizontal ? Width() - next_button.width() - button_length : 0, is_horizontal ? 0 : Height() - next_button.height() - button_length); @@ -321,7 +321,7 @@ return button_rect; } -IntRect CustomScrollbar::TrackRect(int start_length, int end_length) const { +gfx::Rect CustomScrollbar::TrackRect(int start_length, int end_length) const { const LayoutCustomScrollbarPart* part = GetPart(kTrackBGPart); if (Orientation() == kHorizontalScrollbar) { @@ -330,7 +330,7 @@ start_length += margin_left; end_length += margin_right; int total_length = start_length + end_length; - return IntRect(X() + start_length, Y(), Width() - total_length, Height()); + return gfx::Rect(X() + start_length, Y(), Width() - total_length, Height()); } int margin_top = part ? part->MarginTop().ToInt() : 0; @@ -339,17 +339,17 @@ end_length += margin_bottom; int total_length = start_length + end_length; - return IntRect(X(), Y() + start_length, Width(), Height() - total_length); + return gfx::Rect(X(), Y() + start_length, Width(), Height() - total_length); } -IntRect CustomScrollbar::TrackPieceRectWithMargins( +gfx::Rect CustomScrollbar::TrackPieceRectWithMargins( ScrollbarPart part_type, - const IntRect& old_rect) const { + const gfx::Rect& old_rect) const { const LayoutCustomScrollbarPart* part_layout_object = GetPart(part_type); if (!part_layout_object) return old_rect; - IntRect rect = old_rect; + gfx::Rect rect = old_rect; if (Orientation() == kHorizontalScrollbar) { rect.set_x((rect.x() + part_layout_object->MarginLeft()).ToInt()); rect.set_width((rect.width() - part_layout_object->MarginWidth()).ToInt()); @@ -378,14 +378,14 @@ DocumentLifecycle::kInPaint); // Update frame rect of parts. - IntRect track_rect = GetTheme().TrackRect(*this); - IntRect start_track_rect; - IntRect thumb_rect; - IntRect end_track_rect; + gfx::Rect track_rect = GetTheme().TrackRect(*this); + gfx::Rect start_track_rect; + gfx::Rect thumb_rect; + gfx::Rect end_track_rect; GetTheme().SplitTrack(*this, track_rect, start_track_rect, thumb_rect, end_track_rect); for (auto& part : parts_) { - IntRect part_rect; + gfx::Rect part_rect; switch (part.key) { case kBackButtonStartPart: case kForwardButtonStartPart: @@ -418,7 +418,7 @@ part.value->GetMutableForPainting().FirstFragment().SetPaintOffset( PhysicalOffset(part_rect.origin())); // The part's frame_rect is relative to the scrollbar. - part_rect.Offset(-ToIntSize(Location())); + part_rect.Offset(-Location().OffsetFromOrigin()); part.value->SetFrameRect(LayoutRect(part_rect)); } }
diff --git a/third_party/blink/renderer/core/layout/custom_scrollbar.h b/third_party/blink/renderer/core/layout/custom_scrollbar.h index e9a9f17..17db886 100644 --- a/third_party/blink/renderer/core/layout/custom_scrollbar.h +++ b/third_party/blink/renderer/core/layout/custom_scrollbar.h
@@ -52,9 +52,9 @@ ScrollbarOrientation, Element* style_source); - IntRect ButtonRect(ScrollbarPart) const; - IntRect TrackRect(int start_length, int end_length) const; - IntRect TrackPieceRectWithMargins(ScrollbarPart, const IntRect&) const; + gfx::Rect ButtonRect(ScrollbarPart) const; + gfx::Rect TrackRect(int start_length, int end_length) const; + gfx::Rect TrackPieceRectWithMargins(ScrollbarPart, const gfx::Rect&) const; int MinimumThumbLength() const;
diff --git a/third_party/blink/renderer/core/layout/geometry/logical_size.cc b/third_party/blink/renderer/core/layout/geometry/logical_size.cc index e1cc543..027987b7 100644 --- a/third_party/blink/renderer/core/layout/geometry/logical_size.cc +++ b/third_party/blink/renderer/core/layout/geometry/logical_size.cc
@@ -4,12 +4,12 @@ #include "third_party/blink/renderer/core/layout/geometry/logical_size.h" -#include "third_party/blink/renderer/core/layout/geometry/physical_size.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { // static -LogicalSize LogicalSize::AspectRatioFromFloatSize(const FloatSize& size) { +LogicalSize LogicalSize::AspectRatioFromSizeF(const gfx::SizeF& size) { // Try and preserve as much precision as possible in the LayoutUnit space. // For ratios with values smaller than 1.0f, pre-divide to reduce loss. E.g: // "0.25f/0.01f" becomes "25/1" instead of "0.25/0.015625".
diff --git a/third_party/blink/renderer/core/layout/geometry/logical_size.h b/third_party/blink/renderer/core/layout/geometry/logical_size.h index adf3f06e..dfb4c994 100644 --- a/third_party/blink/renderer/core/layout/geometry/logical_size.h +++ b/third_party/blink/renderer/core/layout/geometry/logical_size.h
@@ -11,6 +11,10 @@ #include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/text/writing_mode.h" +namespace gfx { +class SizeF; +} + namespace blink { struct LogicalOffset; @@ -44,7 +48,7 @@ return inline_size == LayoutUnit() || block_size == LayoutUnit(); } - static LogicalSize AspectRatioFromFloatSize(const FloatSize&); + static LogicalSize AspectRatioFromSizeF(const gfx::SizeF&); }; inline LogicalSize& operator-=(LogicalSize& a, const NGBoxStrut& b) {
diff --git a/third_party/blink/renderer/core/layout/geometry/logical_size_test.cc b/third_party/blink/renderer/core/layout/geometry/logical_size_test.cc index 232908d..783edce5b 100644 --- a/third_party/blink/renderer/core/layout/geometry/logical_size_test.cc +++ b/third_party/blink/renderer/core/layout/geometry/logical_size_test.cc
@@ -10,24 +10,24 @@ namespace { -TEST(LogicalSizeTest, AspectRatioFromFloatSize) { +TEST(LogicalSizeTest, AspectRatioFromSizeF) { LogicalSize logical; // Just test there is no precision loss when multiply/dividing through the // aspect-ratio. - logical = LogicalSize::AspectRatioFromFloatSize(FloatSize(0.25f, 0.1f)); + logical = LogicalSize::AspectRatioFromSizeF(gfx::SizeF(0.25f, 0.1f)); EXPECT_EQ(LayoutUnit(250), LayoutUnit(100).MulDiv(logical.inline_size, logical.block_size)); - logical = LogicalSize::AspectRatioFromFloatSize(FloatSize(0.1f, 0.25f)); + logical = LogicalSize::AspectRatioFromSizeF(gfx::SizeF(0.1f, 0.25f)); EXPECT_EQ(LayoutUnit(40), LayoutUnit(100).MulDiv(logical.inline_size, logical.block_size)); - logical = LogicalSize::AspectRatioFromFloatSize(FloatSize(2.0f, 0.01f)); + logical = LogicalSize::AspectRatioFromSizeF(gfx::SizeF(2.0f, 0.01f)); EXPECT_EQ(LayoutUnit(20000), LayoutUnit(100).MulDiv(logical.inline_size, logical.block_size)); - logical = LogicalSize::AspectRatioFromFloatSize(FloatSize(0.01f, 2.0f)); + logical = LogicalSize::AspectRatioFromSizeF(gfx::SizeF(0.01f, 2.0f)); EXPECT_EQ(LayoutUnit(0.5), LayoutUnit(100).MulDiv(logical.inline_size, logical.block_size)); }
diff --git a/third_party/blink/renderer/core/layout/geometry/physical_rect.h b/third_party/blink/renderer/core/layout/geometry/physical_rect.h index 4c8a3b85..aab9373 100644 --- a/third_party/blink/renderer/core/layout/geometry/physical_rect.h +++ b/third_party/blink/renderer/core/layout/geometry/physical_rect.h
@@ -165,7 +165,7 @@ int PixelSnappedHeight() const { return SnapSizeToPixel(size.height, offset.top); } - IntSize PixelSnappedSize() const { + gfx::Size PixelSnappedSize() const { return {PixelSnappedWidth(), PixelSnappedHeight()}; } @@ -244,7 +244,7 @@ return IntRect(location, IntSize(max_point - location)); } inline IntRect PixelSnappedIntRect(const PhysicalRect& r) { - return {r.PixelSnappedOffset(), r.PixelSnappedSize()}; + return {r.PixelSnappedOffset(), IntSize(r.PixelSnappedSize())}; } inline gfx::Rect ToEnclosingRect(const PhysicalRect& r) { gfx::Point location = ToFlooredPoint(r.offset); @@ -257,7 +257,7 @@ max_point.y() - location.y()); } inline gfx::Rect ToPixelSnappedRect(const PhysicalRect& r) { - return {r.PixelSnappedOffset(), ToGfxSize(r.PixelSnappedSize())}; + return {r.PixelSnappedOffset(), r.PixelSnappedSize()}; } // TODO(wangxianzhu): For temporary conversion from LayoutRect to PhysicalRect,
diff --git a/third_party/blink/renderer/core/layout/geometry/physical_size.h b/third_party/blink/renderer/core/layout/geometry/physical_size.h index a982d0e3..5a9132f8 100644 --- a/third_party/blink/renderer/core/layout/geometry/physical_size.h +++ b/third_party/blink/renderer/core/layout/geometry/physical_size.h
@@ -113,7 +113,7 @@ return {LayoutUnit::FromFloatRound(size.width()), LayoutUnit::FromFloatRound(size.height())}; } - static PhysicalSize FromSizeFFloor(const gfx::Size& size) { + static PhysicalSize FromSizeFFloor(const gfx::SizeF& size) { return {LayoutUnit::FromFloatFloor(size.width()), LayoutUnit::FromFloatFloor(size.height())}; }
diff --git a/third_party/blink/renderer/core/layout/hit_test_result.cc b/third_party/blink/renderer/core/layout/hit_test_result.cc index 134c7f4..c49b62688 100644 --- a/third_party/blink/renderer/core/layout/hit_test_result.cc +++ b/third_party/blink/renderer/core/layout/hit_test_result.cc
@@ -388,13 +388,13 @@ return nullptr; } -IntRect HitTestResult::ImageRect() const { +gfx::Rect HitTestResult::ImageRect() const { if (!GetImage()) - return IntRect(); - return InnerNodeOrImageMapImage() - ->GetLayoutBox() - ->AbsoluteContentQuad() - .EnclosingBoundingBox(); + return gfx::Rect(); + return ToGfxRect(InnerNodeOrImageMapImage() + ->GetLayoutBox() + ->AbsoluteContentQuad() + .EnclosingBoundingBox()); } KURL HitTestResult::AbsoluteImageURL(const Node* node) {
diff --git a/third_party/blink/renderer/core/layout/hit_test_result.h b/third_party/blink/renderer/core/layout/hit_test_result.h index e6647db..9e83ef0d 100644 --- a/third_party/blink/renderer/core/layout/hit_test_result.h +++ b/third_party/blink/renderer/core/layout/hit_test_result.h
@@ -153,7 +153,7 @@ const AtomicString& AltDisplayString() const; static Image* GetImage(const Node* node); Image* GetImage() const; - IntRect ImageRect() const; + gfx::Rect ImageRect() const; static KURL AbsoluteImageURL(const Node* node); KURL AbsoluteImageURL() const; KURL AbsoluteMediaURL() const;
diff --git a/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h b/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h index 8fcac46..30e0c5c 100644 --- a/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h +++ b/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h
@@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INTRINSIC_SIZING_INFO_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INTRINSIC_SIZING_INFO_H_ -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -18,14 +18,14 @@ // Both size and aspect_ratio use logical coordinates. // Because they are using float instead of LayoutUnit, we can't use // LogicalSize here. - FloatSize size; - FloatSize aspect_ratio; + gfx::SizeF size; + gfx::SizeF aspect_ratio; bool has_width; bool has_height; void Transpose() { - size = size.TransposedSize(); - aspect_ratio = aspect_ratio.TransposedSize(); + size.Transpose(); + aspect_ratio.Transpose(); std::swap(has_width, has_height); } };
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 8d51de6..cfaccd2 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -1511,7 +1511,7 @@ } // The Layer does not yet have the up to date subpixel accumulation // so we base the size strictly on the frame rect's location. - IntSize old_pixel_snapped_border_rect_size = + gfx::Size old_pixel_snapped_border_rect_size = PixelSnappedBorderBoxRect().size(); SetLocation(location); // TODO(crbug.com/1020913): This is problematic because this function may be @@ -5717,8 +5717,8 @@ if (LocalFrameView* frame_view = view->GetFrameView()) { // Don't use visibleContentRect since the PaintLayer's size has not been // set yet. - LayoutSize viewport_size( - frame_view->LayoutViewport()->ExcludeScrollbars(frame_view->Size())); + LayoutSize viewport_size(frame_view->LayoutViewport()->ExcludeScrollbars( + ToGfxSize(frame_view->Size()))); return LayoutUnit(containing_block->IsHorizontalWritingMode() ? viewport_size.Width() : viewport_size.Height()); @@ -5790,8 +5790,8 @@ if (LocalFrameView* frame_view = view->GetFrameView()) { // Don't use visibleContentRect since the PaintLayer's size has not been // set yet. - LayoutSize viewport_size( - frame_view->LayoutViewport()->ExcludeScrollbars(frame_view->Size())); + LayoutSize viewport_size(frame_view->LayoutViewport()->ExcludeScrollbars( + ToGfxSize(frame_view->Size()))); return containing_block->IsHorizontalWritingMode() ? viewport_size.Height() : viewport_size.Width();
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index a7a7f0fd..45d9e7a 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -396,7 +396,7 @@ return frame_rect_.Size(); } // TODO(crbug.com/962299): This is incorrect in some cases. - IntSize PixelSnappedSize() const { + gfx::Size PixelSnappedSize() const { NOT_DESTROYED(); return frame_rect_.PixelSnappedSize(); } @@ -475,18 +475,17 @@ // TODO(crbug.com/962299): This method snaps to pixels incorrectly because // Location() is not the correct paint offset. It's also incorrect in flipped // blocks writing mode. - IntRect PixelSnappedBorderBoxRect() const { + gfx::Rect PixelSnappedBorderBoxRect() const { NOT_DESTROYED(); - return IntRect(gfx::Point(), - PixelSnappedBorderBoxSize(PhysicalOffset(Location()))); + return gfx::Rect(PixelSnappedBorderBoxSize(PhysicalOffset(Location()))); } // TODO(crbug.com/962299): This method is only correct when |offset| is the // correct paint offset. - IntSize PixelSnappedBorderBoxSize(const PhysicalOffset& offset) const { + gfx::Size PixelSnappedBorderBoxSize(const PhysicalOffset& offset) const { NOT_DESTROYED(); - return PixelSnappedIntSize(Size(), offset.ToLayoutPoint()); + return ToPixelSnappedSize(Size(), offset.ToLayoutPoint()); } - IntRect BorderBoundingBox() const final { + gfx::Rect BorderBoundingBox() const final { NOT_DESTROYED(); return PixelSnappedBorderBoxRect(); } @@ -599,9 +598,9 @@ return FlipForWritingMode(LayoutOverflowRect()); } // TODO(crbug.com/962299): This is incorrect in some cases. - IntRect PixelSnappedLayoutOverflowRect() const { + gfx::Rect PixelSnappedLayoutOverflowRect() const { NOT_DESTROYED(); - return PixelSnappedIntRect(LayoutOverflowRect()); + return ToPixelSnappedRect(LayoutOverflowRect()); } LayoutSize MaxLayoutOverflow() const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/layout_box_model_object.h b/third_party/blink/renderer/core/layout/layout_box_model_object.h index 0f73490..476b806e 100644 --- a/third_party/blink/renderer/core/layout/layout_box_model_object.h +++ b/third_party/blink/renderer/core/layout/layout_box_model_object.h
@@ -185,7 +185,7 @@ // This will work on inlines to return the bounding box of all of the lines' // border boxes. - virtual IntRect BorderBoundingBox() const = 0; + virtual gfx::Rect BorderBoundingBox() const = 0; virtual PhysicalRect PhysicalVisualOverflowRect() const = 0;
diff --git a/third_party/blink/renderer/core/layout/layout_custom_scrollbar_part.cc b/third_party/blink/renderer/core/layout/layout_custom_scrollbar_part.cc index f194d96..af07fd4 100644 --- a/third_party/blink/renderer/core/layout/layout_custom_scrollbar_part.cc +++ b/third_party/blink/renderer/core/layout/layout_custom_scrollbar_part.cc
@@ -150,7 +150,7 @@ NOT_DESTROYED(); DCHECK_NE(kScrollbarBGPart, part_); - IntRect visible_content_rect = + gfx::Rect visible_content_rect = scrollbar_->GetScrollableArea()->VisibleContentRect(kIncludeScrollbars); if (scrollbar_->Orientation() == kHorizontalScrollbar) return ComputeWidth(visible_content_rect.width());
diff --git a/third_party/blink/renderer/core/layout/layout_flexible_box.cc b/third_party/blink/renderer/core/layout/layout_flexible_box.cc index 0a3c9d24..3ab8e193 100644 --- a/third_party/blink/renderer/core/layout/layout_flexible_box.cc +++ b/third_party/blink/renderer/core/layout/layout_flexible_box.cc
@@ -835,7 +835,7 @@ LayoutUnit border_and_padding; if (ar_type == EAspectRatioType::kRatio || (ar_type == EAspectRatioType::kAutoAndRatio && aspect_ratio.IsEmpty())) { - FloatSize int_ratio = child.StyleRef().AspectRatio().GetRatio(); + gfx::SizeF int_ratio = child.StyleRef().AspectRatio().GetRatio(); aspect_ratio = LayoutSize{int_ratio.width(), int_ratio.height()}; if (child.StyleRef().BoxSizingForAspectRatio() == EBoxSizing::kContentBox) { cross_size -= cross_axis_border_and_padding;
diff --git a/third_party/blink/renderer/core/layout/layout_html_canvas.cc b/third_party/blink/renderer/core/layout/layout_html_canvas.cc index 1cc1ae99..1720206 100644 --- a/third_party/blink/renderer/core/layout/layout_html_canvas.cc +++ b/third_party/blink/renderer/core/layout/layout_html_canvas.cc
@@ -53,7 +53,7 @@ void LayoutHTMLCanvas::CanvasSizeChanged() { NOT_DESTROYED(); - IntSize canvas_size = To<HTMLCanvasElement>(GetNode())->Size(); + gfx::Size canvas_size = To<HTMLCanvasElement>(GetNode())->Size(); LayoutSize zoomed_size(canvas_size.width() * StyleRef().EffectiveZoom(), canvas_size.height() * StyleRef().EffectiveZoom());
diff --git a/third_party/blink/renderer/core/layout/layout_image.cc b/third_party/blink/renderer/core/layout/layout_image.cc index d713761..69164ca 100644 --- a/third_party/blink/renderer/core/layout/layout_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image.cc
@@ -50,6 +50,7 @@ #include "third_party/blink/renderer/core/svg/graphics/svg_image.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "ui/gfx/geometry/size_conversions.h" namespace blink { @@ -148,7 +149,7 @@ if (!did_increment_visually_non_empty_pixel_count_) { // At a zoom level of 1 the image is guaranteed to have an integer size. View()->GetFrameView()->IncrementVisuallyNonEmptyPixelCount( - FlooredIntSize(ImageSizeOverriddenByIntrinsicSize(1.0f))); + gfx::ToFlooredSize(ImageSizeOverriddenByIntrinsicSize(1.0f))); did_increment_visually_non_empty_pixel_count_ = true; } @@ -323,13 +324,13 @@ return image_element && image_element->IsDefaultIntrinsicSize(); } -FloatSize LayoutImage::ImageSizeOverriddenByIntrinsicSize( +gfx::SizeF LayoutImage::ImageSizeOverriddenByIntrinsicSize( float multiplier) const { NOT_DESTROYED(); if (!HasOverriddenIntrinsicSize()) return image_resource_->ImageSize(multiplier); - FloatSize overridden_intrinsic_size(kDefaultWidth, kDefaultHeight); + gfx::SizeF overridden_intrinsic_size(kDefaultWidth, kDefaultHeight); if (multiplier != 1) { overridden_intrinsic_size.Scale(multiplier); if (overridden_intrinsic_size.width() < 1.0f) @@ -347,7 +348,7 @@ if (!HasOverriddenIntrinsicSize()) return false; - FloatSize overridden_intrinsic_size(kDefaultWidth, kDefaultHeight); + gfx::SizeF overridden_intrinsic_size(kDefaultWidth, kDefaultHeight); intrinsic_sizing_info.size = overridden_intrinsic_size; intrinsic_sizing_info.aspect_ratio = intrinsic_sizing_info.size; if (!IsHorizontalWritingMode()) @@ -418,7 +419,7 @@ // aspect ratio that a failed poster image load should not override. if (image_resource_ && image_resource_->ErrorOccurred() && !IsA<LayoutVideo>(this)) { - intrinsic_sizing_info.aspect_ratio = FloatSize(1, 1); + intrinsic_sizing_info.aspect_ratio = gfx::SizeF(1, 1); return; } }
diff --git a/third_party/blink/renderer/core/layout/layout_image.h b/third_party/blink/renderer/core/layout/layout_image.h index bccd0f19..2fe4494 100644 --- a/third_party/blink/renderer/core/layout/layout_image.h +++ b/third_party/blink/renderer/core/layout/layout_image.h
@@ -163,7 +163,7 @@ // is disabled and the element has no sizing info. bool OverrideIntrinsicSizingInfo(IntrinsicSizingInfo&) const; bool HasOverriddenIntrinsicSize() const; - FloatSize ImageSizeOverriddenByIntrinsicSize(float multiplier) const; + gfx::SizeF ImageSizeOverriddenByIntrinsicSize(float multiplier) const; // This member wraps the associated decoded image. //
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.cc b/third_party/blink/renderer/core/layout/layout_image_resource.cc index 963a625..0f20c38 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource.cc
@@ -109,15 +109,16 @@ return cached_image_->ForceOrientationIfNecessary(respect_orientation); } -FloatSize LayoutImageResource::ImageSize(float multiplier) const { +gfx::SizeF LayoutImageResource::ImageSize(float multiplier) const { if (!cached_image_) - return FloatSize(); - FloatSize size(cached_image_->IntrinsicSize( + return gfx::SizeF(); + gfx::SizeF size(cached_image_->IntrinsicSize( LayoutObject::ShouldRespectImageOrientation(layout_object_))); if (multiplier != 1 && HasIntrinsicSize()) { // Don't let images that have a width/height >= 1 shrink below 1 when // zoomed. - FloatSize minimum_size(size.width() > 0 ? 1 : 0, size.height() > 0 ? 1 : 0); + gfx::SizeF minimum_size(size.width() > 0 ? 1 : 0, + size.height() > 0 ? 1 : 0); size.Scale(multiplier); if (size.width() < minimum_size.width()) size.set_width(minimum_size.width()); @@ -130,9 +131,9 @@ return size; } -FloatSize LayoutImageResource::ImageSizeWithDefaultSize( +gfx::SizeF LayoutImageResource::ImageSizeWithDefaultSize( float multiplier, - const FloatSize&) const { + const gfx::SizeF&) const { return ImageSize(multiplier); } @@ -161,12 +162,12 @@ } scoped_refptr<Image> LayoutImageResource::GetImage( - const IntSize& container_size) const { - return GetImage(FloatSize(container_size)); + const gfx::Size& container_size) const { + return GetImage(gfx::SizeF(container_size)); } scoped_refptr<Image> LayoutImageResource::GetImage( - const FloatSize& container_size) const { + const gfx::SizeF& container_size) const { if (!cached_image_) return Image::NullImage();
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.h b/third_party/blink/renderer/core/layout/layout_image_resource.h index bdec915b..decee7c 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource.h
@@ -54,8 +54,8 @@ void ResetAnimation(); bool MaybeAnimated() const; - virtual scoped_refptr<Image> GetImage(const FloatSize&) const; - scoped_refptr<Image> GetImage(const IntSize&) const; + virtual scoped_refptr<Image> GetImage(const gfx::SizeF&) const; + scoped_refptr<Image> GetImage(const gfx::Size&) const; virtual bool ErrorOccurred() const { return cached_image_ && cached_image_->ErrorOccurred(); } @@ -66,10 +66,10 @@ virtual bool HasIntrinsicSize() const; - virtual FloatSize ImageSize(float multiplier) const; + virtual gfx::SizeF ImageSize(float multiplier) const; // Default size is effective when this is LayoutImageResourceStyleImage. - virtual FloatSize ImageSizeWithDefaultSize(float multiplier, - const FloatSize&) const; + virtual gfx::SizeF ImageSizeWithDefaultSize(float multiplier, + const gfx::SizeF&) const; virtual RespectImageOrientationEnum ImageOrientation() const; virtual WrappedImagePtr ImagePtr() const { return cached_image_.Get(); }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc index 764238f..e4a7a909 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc
@@ -60,7 +60,7 @@ } scoped_refptr<Image> LayoutImageResourceStyleImage::GetImage( - const FloatSize& size) const { + const gfx::SizeF& size) const { // Generated content may trigger calls to image() while we're still pending, // don't assert but gracefully exit. if (style_image_->IsPendingImage()) @@ -69,19 +69,19 @@ layout_object_->StyleRef(), size); } -FloatSize LayoutImageResourceStyleImage::ImageSize(float multiplier) const { +gfx::SizeF LayoutImageResourceStyleImage::ImageSize(float multiplier) const { // TODO(davve): Find out the correct default object size in this context. auto* list_marker = DynamicTo<LayoutListMarkerImage>(layout_object_.Get()); - FloatSize default_size = list_marker - ? list_marker->DefaultSize() - : FloatSize(LayoutReplaced::kDefaultWidth, - LayoutReplaced::kDefaultHeight); + gfx::SizeF default_size = list_marker + ? list_marker->DefaultSize() + : gfx::SizeF(LayoutReplaced::kDefaultWidth, + LayoutReplaced::kDefaultHeight); return ImageSizeWithDefaultSize(multiplier, default_size); } -FloatSize LayoutImageResourceStyleImage::ImageSizeWithDefaultSize( +gfx::SizeF LayoutImageResourceStyleImage::ImageSizeWithDefaultSize( float multiplier, - const FloatSize& default_size) const { + const gfx::SizeF& default_size) const { return style_image_->ImageSize( multiplier, default_size, LayoutObject::ShouldRespectImageOrientation(layout_object_));
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h index 11e8252..095e273a 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h
@@ -44,15 +44,15 @@ void Shutdown() override; bool HasImage() const override { return true; } - scoped_refptr<Image> GetImage(const FloatSize&) const override; + scoped_refptr<Image> GetImage(const gfx::SizeF&) const override; bool ErrorOccurred() const override { return style_image_->ErrorOccurred(); } bool HasIntrinsicSize() const override { return style_image_->HasIntrinsicSize(); } - FloatSize ImageSize(float multiplier) const override; - FloatSize ImageSizeWithDefaultSize(float multiplier, - const FloatSize&) const override; + gfx::SizeF ImageSize(float multiplier) const override; + gfx::SizeF ImageSizeWithDefaultSize(float multiplier, + const gfx::SizeF&) const override; RespectImageOrientationEnum ImageOrientation() const override; WrappedImagePtr ImagePtr() const override { return style_image_->Data(); }
diff --git a/third_party/blink/renderer/core/layout/layout_inline.h b/third_party/blink/renderer/core/layout/layout_inline.h index b1db4683..ccd8811 100644 --- a/third_party/blink/renderer/core/layout/layout_inline.h +++ b/third_party/blink/renderer/core/layout/layout_inline.h
@@ -402,10 +402,10 @@ PositionWithAffinity PositionForPoint(const PhysicalOffset&) const override; - IntRect BorderBoundingBox() const final { + gfx::Rect BorderBoundingBox() const final { NOT_DESTROYED(); - IntRect bounding_box = EnclosingIntRect(PhysicalLinesBoundingBox()); - return IntRect(0, 0, bounding_box.width(), bounding_box.height()); + gfx::Rect bounding_box = ToEnclosingRect(PhysicalLinesBoundingBox()); + return gfx::Rect(bounding_box.size()); } virtual InlineFlowBox* CreateInlineFlowBox(); // Subclassed by SVG and Ruby
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker.cc b/third_party/blink/renderer/core/layout/layout_list_marker.cc index 4a1d5783..9e679be5 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker.cc +++ b/third_party/blink/renderer/core/layout/layout_list_marker.cc
@@ -78,7 +78,7 @@ // marker box. float bullet_width = font_data->GetFontMetrics().Ascent() / 2.0f; return RoundedLayoutSize(image_->ImageSize( - StyleRef().EffectiveZoom(), FloatSize(bullet_width, bullet_width), + StyleRef().EffectiveZoom(), gfx::SizeF(bullet_width, bullet_width), LayoutObject::ShouldRespectImageOrientation(this))); }
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker_image.cc b/third_party/blink/renderer/core/layout/layout_list_marker_image.cc index 99155a7e..dc02b3cc 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker_image.cc +++ b/third_party/blink/renderer/core/layout/layout_list_marker_image.cc
@@ -26,14 +26,14 @@ return type == kLayoutObjectListMarkerImage || LayoutImage::IsOfType(type); } -FloatSize LayoutListMarkerImage::DefaultSize() const { +gfx::SizeF LayoutListMarkerImage::DefaultSize() const { NOT_DESTROYED(); const SimpleFontData* font_data = Style()->GetFont().PrimaryFont(); DCHECK(font_data); if (!font_data) - return FloatSize(kDefaultWidth, kDefaultHeight); + return gfx::SizeF(kDefaultWidth, kDefaultHeight); float bullet_width = font_data->GetFontMetrics().Ascent() / 2.f; - return FloatSize(bullet_width, bullet_width); + return gfx::SizeF(bullet_width, bullet_width); } // Because ImageResource() is always LayoutImageResourceStyleImage. So we could @@ -42,7 +42,7 @@ void LayoutListMarkerImage::ComputeIntrinsicSizingInfoByDefaultSize( IntrinsicSizingInfo& intrinsic_sizing_info) const { NOT_DESTROYED(); - FloatSize concrete_size = ImageResource()->ImageSizeWithDefaultSize( + gfx::SizeF concrete_size = ImageResource()->ImageSizeWithDefaultSize( Style()->EffectiveZoom(), DefaultSize()); concrete_size.Scale(ImageDevicePixelRatio()); LayoutSize image_size(RoundedLayoutSize(concrete_size));
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker_image.h b/third_party/blink/renderer/core/layout/layout_list_marker_image.h index 97ecac8a..f4843eea 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker_image.h +++ b/third_party/blink/renderer/core/layout/layout_list_marker_image.h
@@ -21,7 +21,7 @@ NOT_DESTROYED(); return IsLayoutNGObjectForListMarkerImage(); } - FloatSize DefaultSize() const; + gfx::SizeF DefaultSize() const; private: bool IsOfType(LayoutObjectType) const override;
diff --git a/third_party/blink/renderer/core/layout/layout_replaced.cc b/third_party/blink/renderer/core/layout/layout_replaced.cc index ca3a8012..3889d49 100644 --- a/third_party/blink/renderer/core/layout/layout_replaced.cc +++ b/third_party/blink/renderer/core/layout/layout_replaced.cc
@@ -179,7 +179,7 @@ // information, since the final result does not depend on it. if (ShouldApplySizeContainment()) { // Reset the size in case it was already populated. - intrinsic_sizing_info.size = FloatSize(); + intrinsic_sizing_info.size = gfx::SizeF(); const StyleAspectRatio& aspect_ratio = StyleRef().AspectRatio(); if (!aspect_ratio.IsAuto()) { @@ -213,14 +213,13 @@ // obtained for comparison against min and max widths. if (!intrinsic_sizing_info.aspect_ratio.IsEmpty() && !intrinsic_sizing_info.size.IsEmpty()) { - intrinsic_size_ = - LayoutSize(IsHorizontalWritingMode() - ? intrinsic_sizing_info.size - : intrinsic_sizing_info.size.TransposedSize()); + intrinsic_size_ = LayoutSize(intrinsic_sizing_info.size); + if (!IsHorizontalWritingMode()) + intrinsic_size_ = intrinsic_size_.TransposedSize(); } } -FloatSize LayoutReplaced::ConstrainIntrinsicSizeToMinMax( +gfx::SizeF LayoutReplaced::ConstrainIntrinsicSizeToMinMax( const IntrinsicSizingInfo& intrinsic_sizing_info) const { NOT_DESTROYED(); // Constrain the intrinsic size along each axis according to minimum and @@ -230,7 +229,7 @@ // these values independently along each axis, the final returned size may in // fact not preserve the aspect ratio. // TODO(davve): Investigate using only the intrinsic aspect ratio here. - FloatSize constrained_size = intrinsic_sizing_info.size; + gfx::SizeF constrained_size = intrinsic_sizing_info.size; if (!intrinsic_sizing_info.aspect_ratio.IsEmpty() && !intrinsic_sizing_info.size.IsEmpty() && StyleRef().LogicalWidth().IsAuto() && @@ -703,8 +702,8 @@ IntrinsicSizingInfo& intrinsic_sizing_info) const { NOT_DESTROYED(); DCHECK(!ShouldApplySizeContainment()); - intrinsic_sizing_info.size = FloatSize(IntrinsicLogicalWidth().ToFloat(), - IntrinsicLogicalHeight().ToFloat()); + intrinsic_sizing_info.size = gfx::SizeF(IntrinsicLogicalWidth().ToFloat(), + IntrinsicLogicalHeight().ToFloat()); const StyleAspectRatio& aspect_ratio = StyleRef().AspectRatio(); if (!aspect_ratio.IsAuto()) { @@ -712,10 +711,8 @@ aspect_ratio.GetRatio().width()); intrinsic_sizing_info.aspect_ratio.set_height( aspect_ratio.GetRatio().height()); - if (!IsHorizontalWritingMode()) { - intrinsic_sizing_info.aspect_ratio = - intrinsic_sizing_info.aspect_ratio.TransposedSize(); - } + if (!IsHorizontalWritingMode()) + intrinsic_sizing_info.aspect_ratio.Transpose(); } if (aspect_ratio.GetType() == EAspectRatioType::kRatio) return; @@ -769,7 +766,7 @@ IntrinsicSizingInfo intrinsic_sizing_info; ComputeIntrinsicSizingInfoForReplacedContent(intrinsic_sizing_info); - FloatSize constrained_size = + gfx::SizeF constrained_size = ConstrainIntrinsicSizeToMinMax(intrinsic_sizing_info); if (StyleRef().LogicalWidth().IsAuto()) { @@ -872,7 +869,7 @@ IntrinsicSizingInfo intrinsic_sizing_info; ComputeIntrinsicSizingInfoForReplacedContent(intrinsic_sizing_info); - FloatSize constrained_size = + gfx::SizeF constrained_size = ConstrainIntrinsicSizeToMinMax(intrinsic_sizing_info); bool width_is_auto = StyleRef().LogicalWidth().IsAuto();
diff --git a/third_party/blink/renderer/core/layout/layout_replaced.h b/third_party/blink/renderer/core/layout/layout_replaced.h index 4446fec..590253c 100644 --- a/third_party/blink/renderer/core/layout/layout_replaced.h +++ b/third_party/blink/renderer/core/layout/layout_replaced.h
@@ -177,7 +177,7 @@ MinMaxSizes PreferredLogicalWidths() const final; void ComputeIntrinsicSizingInfoForReplacedContent(IntrinsicSizingInfo&) const; - FloatSize ConstrainIntrinsicSizeToMinMax(const IntrinsicSizingInfo&) const; + gfx::SizeF ConstrainIntrinsicSizeToMinMax(const IntrinsicSizingInfo&) const; LayoutUnit ComputeConstrainedLogicalWidth(ShouldComputePreferred) const;
diff --git a/third_party/blink/renderer/core/layout/layout_shift_tracker.cc b/third_party/blink/renderer/core/layout/layout_shift_tracker.cc index a01ec5a9..67a83a3 100644 --- a/third_party/blink/renderer/core/layout/layout_shift_tracker.cc +++ b/third_party/blink/renderer/core/layout/layout_shift_tracker.cc
@@ -284,7 +284,7 @@ if (frame_view_->GetFrame().IsMainFrame()) { // Apply the visual viewport clip. clip_rect.Intersect(FloatClipRect( - ToGfxRectF(frame_view_->GetPage()->GetVisualViewport().VisibleRect()))); + frame_view_->GetPage()->GetVisualViewport().VisibleRect())); } // If the clip region is empty, then the resulting layout shift isn't visible @@ -495,12 +495,12 @@ // Intersect with the portion of the local root that overlaps the main frame. local_root.View()->MapToVisualRectInRemoteRootFrame(subframe_rect); - IntSize subframe_visible_size = subframe_rect.PixelSnappedSize(); + gfx::Size subframe_visible_size = subframe_rect.PixelSnappedSize(); IntSize main_frame_size = frame.GetPage()->GetVisualViewport().Size(); // TODO(crbug.com/940711): This comparison ignores page scale and CSS // transforms above the local root. - return static_cast<double>(subframe_visible_size.Area()) / + return static_cast<double>(subframe_visible_size.Area64()) / main_frame_size.Area(); } @@ -510,7 +510,7 @@ if (region_.IsEmpty()) return; - IntRect viewport = frame_view_->GetScrollableArea()->VisibleContentRect(); + gfx::Rect viewport = frame_view_->GetScrollableArea()->VisibleContentRect(); if (viewport.IsEmpty()) return;
diff --git a/third_party/blink/renderer/core/layout/layout_shift_tracker_test.cc b/third_party/blink/renderer/core/layout/layout_shift_tracker_test.cc index cc1aaf0..70dc59af 100644 --- a/third_party/blink/renderer/core/layout/layout_shift_tracker_test.cc +++ b/third_party/blink/renderer/core/layout/layout_shift_tracker_test.cc
@@ -1119,10 +1119,10 @@ GetDocument().GetPage()->GetVisualViewport().SetLocation(gfx::PointF(0, 100)); UpdateAllLifecyclePhasesForTest(); // The visual viewport. - EXPECT_EQ(IntRect(0, 100, 200, 500), + EXPECT_EQ(gfx::Rect(0, 100, 200, 500), GetDocument().View()->GetScrollableArea()->VisibleContentRect()); // The layout viewport . - EXPECT_EQ(IntRect(0, 0, 800, 600), + EXPECT_EQ(gfx::Rect(0, 0, 800, 600), GetDocument().View()->LayoutViewport()->VisibleContentRect()); EXPECT_FLOAT_EQ(0, GetLayoutShiftTracker().Score());
diff --git a/third_party/blink/renderer/core/layout/layout_text.cc b/third_party/blink/renderer/core/layout/layout_text.cc index 7a2dc74c0..75d811a 100644 --- a/third_party/blink/renderer/core/layout/layout_text.cc +++ b/third_party/blink/renderer/core/layout/layout_text.cc
@@ -545,15 +545,15 @@ return LayoutRect(); } -static IntRect EllipsisRectForBox(InlineTextBox* box, - unsigned start_pos, - unsigned end_pos) { +static gfx::Rect EllipsisRectForBox(InlineTextBox* box, + unsigned start_pos, + unsigned end_pos) { if (!box) - return IntRect(); + return gfx::Rect(); uint16_t truncation = box->Truncation(); if (truncation == kCNoTruncation) - return IntRect(); + return gfx::Rect(); if (EllipsisBox* ellipsis = box->Root().GetEllipsisBox()) { int ellipsis_start_position = std::max<int>(start_pos - box->Start(), 0); @@ -568,7 +568,7 @@ return ellipsis->SelectionRect(); } - return IntRect(); + return gfx::Rect(); } template <typename PhysicalRectCollector> @@ -593,9 +593,9 @@ UNLIKELY(HasFlippedBlocksWritingMode()) ? ContainingBlock() : nullptr; for (InlineTextBox* box : TextBoxes()) { LayoutRect boundaries = box->FrameRect(); - const IntRect ellipsis_rect = (option == kClipToEllipsis) - ? EllipsisRectForBox(box, 0, TextLength()) - : IntRect(); + const gfx::Rect ellipsis_rect = + (option == kClipToEllipsis) ? EllipsisRectForBox(box, 0, TextLength()) + : gfx::Rect(); if (!ellipsis_rect.IsEmpty()) { if (IsHorizontalWritingMode()) boundaries.SetWidth(ellipsis_rect.right() - boundaries.X());
diff --git a/third_party/blink/renderer/core/layout/layout_text_combine.cc b/third_party/blink/renderer/core/layout/layout_text_combine.cc index b055636..a01c68f 100644 --- a/third_party/blink/renderer/core/layout/layout_text_combine.cc +++ b/third_party/blink/renderer/core/layout/layout_text_combine.cc
@@ -150,7 +150,7 @@ } if (clip) - context.Clip(FloatRect(box_rect.X(), box_rect.Y(), width, cell_height)); + context.Clip(gfx::RectF(box_rect.X(), box_rect.Y(), width, cell_height)); } void LayoutTextCombine::UpdateIsCombined() {
diff --git a/third_party/blink/renderer/core/layout/layout_theme.h b/third_party/blink/renderer/core/layout/layout_theme.h index f5c468e..3d44e5d 100644 --- a/third_party/blink/renderer/core/layout/layout_theme.h +++ b/third_party/blink/renderer/core/layout/layout_theme.h
@@ -165,7 +165,7 @@ // Returns size of one slider tick mark for a horizontal track. // For vertical tracks we rotate it and use it. i.e. Width is always length // along the track. - virtual IntSize SliderTickSize() const = 0; + virtual gfx::Size SliderTickSize() const = 0; // Returns the distance of slider tick origin from the slider track center. virtual int SliderTickOffsetFromTrackCenter() const = 0;
diff --git a/third_party/blink/renderer/core/layout/layout_theme_default.cc b/third_party/blink/renderer/core/layout/layout_theme_default.cc index 8fd7b14..afe1aac 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_default.cc +++ b/third_party/blink/renderer/core/layout/layout_theme_default.cc
@@ -95,10 +95,10 @@ return inactive_selection_foreground_color_; } -IntSize LayoutThemeDefault::SliderTickSize() const { +gfx::Size LayoutThemeDefault::SliderTickSize() const { // The value should be synchronized with a -webkit-slider-container rule in // html.css. - return IntSize(1, 4); + return gfx::Size(1, 4); } int LayoutThemeDefault::SliderTickOffsetFromTrackCenter() const {
diff --git a/third_party/blink/renderer/core/layout/layout_theme_default.h b/third_party/blink/renderer/core/layout/layout_theme_default.h index f249604c..573a448 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_default.h +++ b/third_party/blink/renderer/core/layout/layout_theme_default.h
@@ -49,7 +49,7 @@ Color PlatformInactiveSelectionForegroundColor( mojom::blink::ColorScheme color_scheme) const override; - IntSize SliderTickSize() const override; + gfx::Size SliderTickSize() const override; int SliderTickOffsetFromTrackCenter() const override; void AdjustSliderThumbSize(ComputedStyle&) const override;
diff --git a/third_party/blink/renderer/core/layout/layout_view.cc b/third_party/blink/renderer/core/layout/layout_view.cc index 5ac6f25..d4fcd0c9 100644 --- a/third_party/blink/renderer/core/layout/layout_view.cc +++ b/third_party/blink/renderer/core/layout/layout_view.cc
@@ -770,8 +770,10 @@ IntSize result = frame_view_->GetLayoutSize(); if (scrollbar_inclusion == kExcludeScrollbars && - frame_view_->LayoutViewport()) - result = frame_view_->LayoutViewport()->ExcludeScrollbars(result); + frame_view_->LayoutViewport()) { + result = IntSize( + frame_view_->LayoutViewport()->ExcludeScrollbars(ToGfxSize(result))); + } return result; }
diff --git a/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h b/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h index 440630ba..b52dcdc 100644 --- a/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h +++ b/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h
@@ -917,7 +917,7 @@ word_measurement); } - FloatRect rect = font.SelectionRectForText(run, gfx::PointF(), 0, 0, len); + gfx::RectF rect = font.SelectionRectForText(run, gfx::PointF(), 0, 0, len); return RewindToMidWordBreak(word_measurement, end, rect.width()); }
diff --git a/third_party/blink/renderer/core/layout/line/ellipsis_box.cc b/third_party/blink/renderer/core/layout/line/ellipsis_box.cc index 1a82c176..8a85e15 100644 --- a/third_party/blink/renderer/core/layout/line/ellipsis_box.cc +++ b/third_party/blink/renderer/core/layout/line/ellipsis_box.cc
@@ -27,6 +27,7 @@ #include "third_party/blink/renderer/core/style/shadow_list.h" #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/text/text_run.h" +#include "ui/gfx/geometry/rect_conversions.h" namespace blink { @@ -38,10 +39,10 @@ line_bottom); } -IntRect EllipsisBox::SelectionRect() const { +gfx::Rect EllipsisBox::SelectionRect() const { const ComputedStyle& style = GetLineLayoutItem().StyleRef(IsFirstLineStyle()); const Font& font = style.GetFont(); - return EnclosingIntRect(font.SelectionRectForText( + return gfx::ToEnclosingRect(font.SelectionRectForText( ConstructTextRun(font, str_, style, TextRun::kAllowTrailingExpansion), gfx::PointF(LogicalLeft().ToInt(), (LogicalTop() + Root().SelectionTop()).ToInt()),
diff --git a/third_party/blink/renderer/core/layout/line/ellipsis_box.h b/third_party/blink/renderer/core/layout/line/ellipsis_box.h index 4c43d12..d4c79ba 100644 --- a/third_party/blink/renderer/core/layout/line/ellipsis_box.h +++ b/third_party/blink/renderer/core/layout/line/ellipsis_box.h
@@ -61,7 +61,7 @@ const PhysicalOffset& accumulated_offset, LayoutUnit line_top, LayoutUnit line_bottom) override; - IntRect SelectionRect() const; + gfx::Rect SelectionRect() const; LayoutUnit VirtualLogicalHeight() const override { return height_; } const AtomicString& EllipsisStr() const { return str_; }
diff --git a/third_party/blink/renderer/core/layout/line/inline_text_box.cc b/third_party/blink/renderer/core/layout/line/inline_text_box.cc index 26812262..faa7cc24 100644 --- a/third_party/blink/renderer/core/layout/line/inline_text_box.cc +++ b/third_party/blink/renderer/core/layout/line/inline_text_box.cc
@@ -273,7 +273,7 @@ LayoutPoint starting_point = LayoutPoint(LogicalLeft(), sel_top); LayoutRect r; if (s_pos || e_pos != static_cast<int>(len_)) { - r = LayoutRect(EnclosingIntRect( + r = LayoutRect(gfx::ToEnclosingRect( font.SelectionRectForText(text_run, gfx::PointF(starting_point), sel_height.ToInt(), s_pos, e_pos))); } else {
diff --git a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc index 3894ecfc..88532712 100644 --- a/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc +++ b/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc
@@ -339,11 +339,10 @@ auto* layout_view = DynamicTo<LayoutView>(container); if (layout_view && !Base::GetDocument().Printing()) { if (LocalFrameView* frame_view = layout_view->GetFrameView()) { - IntSize size = - frame_view->LayoutViewport()->ExcludeScrollbars(frame_view->Size()); - PhysicalSize physical_size(size); + PhysicalSize size(frame_view->LayoutViewport()->ExcludeScrollbars( + ToGfxSize(frame_view->Size()))); initial_containing_block_fixed_size = - physical_size.ConvertToLogical(container->Style()->GetWritingMode()); + size.ConvertToLogical(container->Style()->GetWritingMode()); } } // We really only want to lay out ourselves here, so we pass |this| to
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 95a1539..5ab6578 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -1602,10 +1602,8 @@ IntrinsicSizingInfo legacy_sizing_info; To<LayoutReplaced>(box_.Get()) ->ComputeIntrinsicSizingInfo(legacy_sizing_info); - if (!legacy_sizing_info.aspect_ratio.IsEmpty()) { - return LogicalSize::AspectRatioFromFloatSize( - legacy_sizing_info.aspect_ratio); - } + if (!legacy_sizing_info.aspect_ratio.IsEmpty()) + return LogicalSize::AspectRatioFromSizeF(legacy_sizing_info.aspect_ratio); } if (ratio.GetType() == EAspectRatioType::kAutoAndRatio) return Style().LogicalAspectRatio();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc index c096eab0..7826b921 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc
@@ -536,7 +536,7 @@ underline_position = ResolvedUnderlinePosition::kUnder; } - FloatRect accumulated_bound; + gfx::RectF accumulated_bound; for (wtf_size_t applied_decoration_index = 0; applied_decoration_index < decorations.size(); ++applied_decoration_index) {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc index 690203b..9759aad 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_length_utils_test.cc
@@ -415,7 +415,7 @@ style_ = GetDocument().GetStyleResolver().CreateComputedStyle(); style_->SetLogicalWidth(Length::Fixed(100)); style_->SetAspectRatio( - StyleAspectRatio(EAspectRatioType::kRatio, FloatSize(2, 1))); + StyleAspectRatio(EAspectRatioType::kRatio, gfx::SizeF(2, 1))); EXPECT_EQ(LayoutUnit(50), ComputeBlockSizeForFragment(ConstructConstraintSpace(200, 300), LayoutUnit(), LayoutUnit(100)));
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc index 47823eba..68a9000 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc
@@ -531,7 +531,7 @@ ScrollLayoutViewport(ScrollOffset(0, 150)); // This will trigger printing and layout. - PrintContext::NumberOfPages(GetDocument().GetFrame(), FloatSize(500, 500)); + PrintContext::NumberOfPages(GetDocument().GetFrame(), gfx::SizeF(500, 500)); EXPECT_EQ(150, viewport->ScrollOffsetInt().y()); EXPECT_EQ(nullptr, GetScrollAnchor(viewport).AnchorObject());
diff --git a/third_party/blink/renderer/core/layout/shapes/raster_shape.h b/third_party/blink/renderer/core/layout/shapes/raster_shape.h index b146a89..5a3b160 100644 --- a/third_party/blink/renderer/core/layout/shapes/raster_shape.h +++ b/third_party/blink/renderer/core/layout/shapes/raster_shape.h
@@ -81,7 +81,7 @@ class RasterShape final : public Shape { public: RasterShape(std::unique_ptr<RasterShapeIntervals> intervals, - const IntSize& margin_rect_size) + const gfx::Size& margin_rect_size) : intervals_(std::move(intervals)), margin_rect_size_(margin_rect_size) { intervals_->InitializeBounds(); } @@ -105,7 +105,7 @@ std::unique_ptr<RasterShapeIntervals> intervals_; mutable std::unique_ptr<RasterShapeIntervals> margin_intervals_; - IntSize margin_rect_size_; + gfx::Size margin_rect_size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/shapes/shape.cc b/third_party/blink/renderer/core/layout/shapes/shape.cc index 81581724..5bfd5d64 100644 --- a/third_party/blink/renderer/core/layout/shapes/shape.cc +++ b/third_party/blink/renderer/core/layout/shapes/shape.cc
@@ -202,14 +202,14 @@ std::unique_ptr<RasterShapeIntervals> intervals = std::make_unique<RasterShapeIntervals>(0, 0); std::unique_ptr<RasterShape> raster_shape = - std::make_unique<RasterShape>(std::move(intervals), IntSize()); + std::make_unique<RasterShape>(std::move(intervals), gfx::Size()); raster_shape->writing_mode_ = writing_mode; raster_shape->margin_ = margin; return std::move(raster_shape); } static bool ExtractImageData(Image* image, - const IntSize& image_size, + const gfx::Size& image_size, ArrayBufferContents& contents, RespectImageOrientationEnum respect_orientation) { if (!image) @@ -248,14 +248,14 @@ // for layout, which is not allowed. See https://crbug.com/429346 ImageObserverDisabler disabler(image); PaintFlags flags; - FloatRect image_source_rect(gfx::PointF(), FloatSize(image->Size())); - IntRect image_dest_rect(gfx::Point(), image_size); + gfx::RectF image_source_rect(gfx::SizeF(image->Size())); + gfx::Rect image_dest_rect(image_size); SkiaPaintCanvas canvas(surface->getCanvas()); canvas.clear(SK_ColorTRANSPARENT); ImageDrawOptions draw_options; draw_options.respect_orientation = respect_orientation; draw_options.clamping_mode = Image::kDoNotClampImageToSourceRect; - image->Draw(&canvas, flags, FloatRect(image_dest_rect), image_source_rect, + image->Draw(&canvas, flags, gfx::RectF(image_dest_rect), image_source_rect, draw_options); return true; } @@ -263,8 +263,8 @@ static std::unique_ptr<RasterShapeIntervals> ExtractIntervalsFromImageData( ArrayBufferContents& contents, float threshold, - const IntRect& image_rect, - const IntRect& margin_rect) { + const gfx::Rect& image_rect, + const gfx::Rect& margin_rect) { DOMArrayBuffer* array_buffer = DOMArrayBuffer::Create(contents); DOMUint8ClampedArray* pixel_array = DOMUint8ClampedArray::Create(array_buffer, 0, array_buffer->ByteLength()); @@ -272,7 +272,7 @@ unsigned pixel_array_offset = 3; // Each pixel is four bytes: RGBA. uint8_t alpha_pixel_threshold = threshold * 255; - DCHECK_EQ(image_rect.size().Area() * 4, pixel_array->length()); + DCHECK_EQ(image_rect.size().Area64() * 4, pixel_array->length()); int min_buffer_y = std::max(0, margin_rect.y() - image_rect.y()); int max_buffer_y = @@ -302,12 +302,12 @@ return intervals; } -static bool IsValidRasterShapeSize(const IntSize& size) { +static bool IsValidRasterShapeSize(const gfx::Size& size) { // Some platforms don't limit MaxDecodedImageBytes. constexpr size_t size32_max_bytes = 0xFFFFFFFF / 4; static const size_t max_image_size_bytes = std::min(size32_max_bytes, Platform::Current()->MaxDecodedImageBytes()); - return size.Area() * 4 < max_image_size_bytes; + return size.Area64() * 4 < max_image_size_bytes; } std::unique_ptr<Shape> Shape::CreateRasterShape( @@ -318,8 +318,8 @@ WritingMode writing_mode, float margin, RespectImageOrientationEnum respect_orientation) { - IntRect image_rect = PixelSnappedIntRect(image_r); - IntRect margin_rect = PixelSnappedIntRect(margin_r); + gfx::Rect image_rect = ToPixelSnappedRect(image_r); + gfx::Rect margin_rect = ToPixelSnappedRect(margin_r); if (!IsValidRasterShapeSize(margin_rect.size()) || !IsValidRasterShapeSize(image_rect.size())) {
diff --git a/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc b/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc index c04be4e..8828e95e 100644 --- a/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc +++ b/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc
@@ -190,7 +190,7 @@ const LayoutSize& image_size = RoundedLayoutSize(style_image->ImageSize( layout_box_->StyleRef().EffectiveZoom(), - FloatSize(reference_box_logical_size_), respect_orientation)); + gfx::SizeF(reference_box_logical_size_), respect_orientation)); const LayoutRect& margin_rect = GetShapeImageMarginRect(*layout_box_, reference_box_logical_size_); @@ -202,7 +202,7 @@ scoped_refptr<Image> image = style_image->GetImage(*layout_box_, layout_box_->GetDocument(), - layout_box_->StyleRef(), FloatSize(image_size)); + layout_box_->StyleRef(), gfx::SizeF(image_size)); return Shape::CreateRasterShape(image.get(), shape_image_threshold, image_rect, margin_rect, writing_mode, margin,
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc index 21f8a36..3726109 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc
@@ -120,8 +120,7 @@ RespectImageOrientationEnum respect_orientation = LayoutObject::ShouldRespectImageOrientation(this); - intrinsic_size = - ToGfxSizeF(cached_image->GetImage()->SizeAsFloat(respect_orientation)); + intrinsic_size = cached_image->GetImage()->SizeAsFloat(respect_orientation); if (auto* svg_image = DynamicTo<SVGImage>(cached_image->GetImage())) { IntrinsicSizingInfo intrinsic_sizing_info; has_intrinsic_ratio &=
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc index c3c7eb9f..d1b3d09 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc
@@ -86,7 +86,7 @@ absl::optional<float> intrinsic_width = svg->IntrinsicWidth(); absl::optional<float> intrinsic_height = svg->IntrinsicHeight(); intrinsic_sizing_info.size = - FloatSize(intrinsic_width.value_or(0), intrinsic_height.value_or(0)); + gfx::SizeF(intrinsic_width.value_or(0), intrinsic_height.value_or(0)); intrinsic_sizing_info.has_width = intrinsic_width.has_value(); intrinsic_sizing_info.has_height = intrinsic_height.has_value(); @@ -96,16 +96,14 @@ gfx::SizeF view_box_size = svg->viewBox()->CurrentValue()->Rect().size(); if (!view_box_size.IsEmpty()) { // The viewBox can only yield an intrinsic ratio, not an intrinsic size. - intrinsic_sizing_info.aspect_ratio = FloatSize(view_box_size); + intrinsic_sizing_info.aspect_ratio = view_box_size; } } EAspectRatioType ar_type = StyleRef().AspectRatio().GetType(); if (ar_type == EAspectRatioType::kRatio || (ar_type == EAspectRatioType::kAutoAndRatio && intrinsic_sizing_info.aspect_ratio.IsEmpty())) { - FloatSize aspect_ratio = StyleRef().AspectRatio().GetRatio(); - intrinsic_sizing_info.aspect_ratio.set_width(aspect_ratio.width()); - intrinsic_sizing_info.aspect_ratio.set_height(aspect_ratio.height()); + intrinsic_sizing_info.aspect_ratio = StyleRef().AspectRatio().GetRatio(); } if (!IsHorizontalWritingMode())
diff --git a/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.cc b/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.cc index f652eff..73d9a1c 100644 --- a/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.cc +++ b/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.cc
@@ -30,6 +30,7 @@ #include "third_party/blink/renderer/core/paint/svg_inline_text_box_painter.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" +#include "ui/gfx/geometry/rect_conversions.h" namespace blink { @@ -97,7 +98,7 @@ return LayoutUnit(); } -FloatRect SVGInlineTextBox::SelectionRectForTextFragment( +gfx::RectF SVGInlineTextBox::SelectionRectForTextFragment( const SVGTextFragment& fragment, int start_position, int end_position, @@ -114,7 +115,7 @@ const SimpleFontData* font_data = scaled_font.PrimaryFont(); DCHECK(font_data); if (!font_data) - return FloatRect(); + return gfx::RectF(); const FontMetrics& scaled_font_metrics = font_data->GetFontMetrics(); gfx::PointF text_origin(fragment.x, fragment.y); @@ -123,7 +124,7 @@ text_origin.Offset(0, -scaled_font_metrics.FloatAscent()); - FloatRect selection_rect = scaled_font.SelectionRectForText( + gfx::RectF selection_rect = scaled_font.SelectionRectForText( ConstructTextRun(style, fragment), text_origin, fragment.height * scaling_factor, start_position, end_position); if (scaling_factor == 1) @@ -145,7 +146,7 @@ const ComputedStyle& style = GetLineLayoutItem().StyleRef(); - FloatRect selection_rect; + gfx::RectF selection_rect; int fragment_start_position = 0; int fragment_end_position = 0; @@ -159,7 +160,7 @@ fragment, fragment_start_position, fragment_end_position)) continue; - FloatRect fragment_rect = SelectionRectForTextFragment( + gfx::RectF fragment_rect = SelectionRectForTextFragment( fragment, fragment_start_position, fragment_end_position, style); if (fragment.IsTransformed()) fragment_rect = fragment.BuildFragmentTransform().MapRect(fragment_rect); @@ -167,7 +168,7 @@ selection_rect.Union(fragment_rect); } - return LayoutRect(EnclosingIntRect(selection_rect)); + return LayoutRect(gfx::ToEnclosingRect(selection_rect)); } void SVGInlineTextBox::Paint(const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.h b/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.h index ecb9ff07..31facba 100644 --- a/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.h +++ b/third_party/blink/renderer/core/layout/svg/line/svg_inline_text_box.h
@@ -73,10 +73,10 @@ } int OffsetForPositionInFragment(const SVGTextFragment&, float position) const; - FloatRect SelectionRectForTextFragment(const SVGTextFragment&, - int fragment_start_position, - int fragment_end_position, - const ComputedStyle&) const; + gfx::RectF SelectionRectForTextFragment(const SVGTextFragment&, + int fragment_start_position, + int fragment_end_position, + const ComputedStyle&) const; TextRun ConstructTextRun(const ComputedStyle&, const SVGTextFragment&) const; private:
diff --git a/third_party/blink/renderer/core/layout/svg/transform_helper.cc b/third_party/blink/renderer/core/layout/svg/transform_helper.cc index 01be67d..789d84e 100644 --- a/third_party/blink/renderer/core/layout/svg/transform_helper.cc +++ b/third_party/blink/renderer/core/layout/svg/transform_helper.cc
@@ -40,19 +40,19 @@ return false; } -FloatRect TransformHelper::ComputeReferenceBox( +gfx::RectF TransformHelper::ComputeReferenceBox( const LayoutObject& layout_object) { const ComputedStyle& style = layout_object.StyleRef(); - FloatRect reference_box; + gfx::RectF reference_box; if (style.TransformBox() == ETransformBox::kFillBox) { - reference_box = FloatRect(layout_object.ObjectBoundingBox()); + reference_box = layout_object.ObjectBoundingBox(); } else { DCHECK_EQ(style.TransformBox(), ETransformBox::kViewBox); SVGLengthContext length_context( DynamicTo<SVGElement>(layout_object.GetNode())); gfx::SizeF viewport_size; length_context.DetermineViewport(viewport_size); - reference_box.set_size(FloatSize(viewport_size)); + reference_box.set_size(viewport_size); } const float zoom = style.EffectiveZoom(); if (zoom != 1) @@ -81,7 +81,7 @@ // clipPath. See // https://svgwg.org/svg2-draft/coords.html#ObjectBoundingBoxUnits TransformationMatrix transform; - FloatRect reference_box = ComputeReferenceBox(layout_object); + gfx::RectF reference_box = ComputeReferenceBox(layout_object); style.ApplyTransform(transform, reference_box, apply_transform_origin, ComputedStyle::kIncludeMotionPath, ComputedStyle::kIncludeIndependentTransformProperties); @@ -95,7 +95,7 @@ gfx::PointF TransformHelper::ComputeTransformOrigin( const LayoutObject& layout_object) { const auto& style = layout_object.StyleRef(); - FloatRect reference_box = ComputeReferenceBox(layout_object); + gfx::RectF reference_box = ComputeReferenceBox(layout_object); gfx::PointF origin( FloatValueForLength(style.TransformOriginX(), reference_box.width()) + reference_box.x(),
diff --git a/third_party/blink/renderer/core/layout/svg/transform_helper.h b/third_party/blink/renderer/core/layout/svg/transform_helper.h index 8c1d1c8c..813cc70 100644 --- a/third_party/blink/renderer/core/layout/svg/transform_helper.h +++ b/third_party/blink/renderer/core/layout/svg/transform_helper.h
@@ -9,9 +9,12 @@ #include "third_party/blink/renderer/platform/transforms/affine_transform.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class RectF; +} + namespace blink { -class FloatRect; class LayoutObject; class TransformHelper { @@ -24,7 +27,7 @@ // Computes the reference box for the LayoutObject based on the // 'transform-box'. Applies zoom if needed. - static FloatRect ComputeReferenceBox(const LayoutObject&); + static gfx::RectF ComputeReferenceBox(const LayoutObject&); // Compute the transform for the LayoutObject based on the various // 'transform*' properties.
diff --git a/third_party/blink/renderer/core/layout/text_autosizer_test.cc b/third_party/blink/renderer/core/layout/text_autosizer_test.cc index 0dba390..c3966fd2 100644 --- a/third_party/blink/renderer/core/layout/text_autosizer_test.cc +++ b/third_party/blink/renderer/core/layout/text_autosizer_test.cc
@@ -1041,7 +1041,7 @@ TEST_F(TextAutosizerTest, AfterPrint) { const float device_scale = 3; - FloatSize print_size(160, 240); + gfx::SizeF print_size(160, 240); set_device_scale_factor(device_scale); SetBodyInnerHTML(R"HTML( <style>
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc index c2675d66..4c29608 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc
@@ -229,10 +229,10 @@ return image_.get(); } -IntSize ImageResourceContent::IntrinsicSize( +gfx::Size ImageResourceContent::IntrinsicSize( RespectImageOrientationEnum should_respect_image_orientation) const { if (!image_) - return IntSize(); + return gfx::Size(); RespectImageOrientationEnum respect_orientation = ForceOrientationIfNecessary(should_respect_image_orientation); return image_->Size(respect_orientation); @@ -485,7 +485,7 @@ if (!image_) return true; - uint64_t pixels = image_->Size().Area(); + uint64_t pixels = image_->Size().Area64(); if (!pixels) return true;
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.h b/third_party/blink/renderer/core/loader/resource/image_resource_content.h index 2b28ed4..cade9f0 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.h +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.h
@@ -74,7 +74,7 @@ // does not quite return the intrinsic width/height, but rather a concrete // object size resolved using a default object size of 300x150. // TODO(fs): Make SVGImages return proper intrinsic width/height. - IntSize IntrinsicSize( + gfx::Size IntrinsicSize( RespectImageOrientationEnum should_respect_image_orientation) const; void AddObserver(ImageResourceObserver*);
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc index f390e15e..d45439ee 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
@@ -50,7 +50,8 @@ namespace blink { -OffscreenCanvas::OffscreenCanvas(ExecutionContext* context, const IntSize& size) +OffscreenCanvas::OffscreenCanvas(ExecutionContext* context, + const gfx::Size& size) : CanvasRenderingContextHost( CanvasRenderingContextHost::HostType::kOffscreenCanvasHost), execution_context_(context), @@ -85,7 +86,7 @@ unsigned height) { UMA_HISTOGRAM_BOOLEAN("Blink.OffscreenCanvas.NewOffscreenCanvas", true); return MakeGarbageCollected<OffscreenCanvas>( - context, IntSize(ClampTo<int>(width), ClampTo<int>(height))); + context, gfx::Size(ClampTo<int>(width), ClampTo<int>(height))); } OffscreenCanvas::~OffscreenCanvas() { @@ -148,18 +149,18 @@ } void OffscreenCanvas::setWidth(unsigned width) { - IntSize new_size = size_; + gfx::Size new_size = size_; new_size.set_width(ClampTo<int>(width)); SetSize(new_size); } void OffscreenCanvas::setHeight(unsigned height) { - IntSize new_size = size_; + gfx::Size new_size = size_; new_size.set_height(ClampTo<int>(height)); SetSize(new_size); } -void OffscreenCanvas::SetSize(const IntSize& size) { +void OffscreenCanvas::SetSize(const gfx::Size& size) { // Setting size of a canvas also resets it. if (size == size_) { if (context_ && context_->IsRenderingContext2D()) { @@ -243,7 +244,7 @@ scoped_refptr<Image> OffscreenCanvas::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize& size, + const gfx::SizeF& size, const AlphaDisposition alpha_disposition) { if (!context_) { *status = kInvalidSourceImageStatus; @@ -268,7 +269,7 @@ return GetImageWithAlphaDisposition(std::move(image), alpha_disposition); } -IntSize OffscreenCanvas::BitmapSourceSize() const { +gfx::Size OffscreenCanvas::BitmapSourceSize() const { return size_; }
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h index 421a46c..098340d0 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h
@@ -17,10 +17,10 @@ #include "third_party/blink/renderer/core/imagebitmap/image_bitmap_source.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/prefinalizer.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -45,7 +45,7 @@ unsigned width, unsigned height); - OffscreenCanvas(ExecutionContext*, const IntSize&); + OffscreenCanvas(ExecutionContext*, const gfx::Size&); ~OffscreenCanvas() override; void Dispose(); @@ -68,8 +68,8 @@ const ImageEncodeOptions* options, ExceptionState& exception_state); - const IntSize& Size() const override { return size_; } - void SetSize(const IntSize&); + const gfx::Size& Size() const override { return size_; } + void SetSize(const gfx::Size&); void RecordTransfer(); void SetPlaceholderCanvasId(DOMNodeId canvas_id); @@ -150,7 +150,7 @@ } // ImageBitmapSource implementation - IntSize BitmapSourceSize() const final; + gfx::Size BitmapSourceSize() const final; ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect>, const ImageBitmapOptions*, @@ -159,12 +159,12 @@ // CanvasImageSource implementation scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) final; bool WouldTaintOrigin() const final { return !origin_clean_; } - FloatSize ElementSize(const FloatSize& default_object_size, - const RespectImageOrientationEnum) const final { - return FloatSize(width(), height()); + gfx::SizeF ElementSize(const gfx::SizeF& default_object_size, + const RespectImageOrientationEnum) const final { + return gfx::SizeF(width(), height()); } bool IsOpaque() const final; bool IsAccelerated() const final; @@ -243,7 +243,7 @@ DOMNodeId placeholder_canvas_id_ = kInvalidDOMNodeId; - IntSize size_; + gfx::Size size_; bool disposing_ = false; bool is_neutered_ = false; bool origin_clean_ = true;
diff --git a/third_party/blink/renderer/core/page/drag_controller.cc b/third_party/blink/renderer/core/page/drag_controller.cc index cb1e92e9..86ff6e5 100644 --- a/third_party/blink/renderer/core/page/drag_controller.cc +++ b/third_party/blink/renderer/core/page/drag_controller.cc
@@ -1036,16 +1036,16 @@ drag_origin.y() + y_offset); } -FloatRect DragController::ClippedSelection(const LocalFrame& frame) { +gfx::RectF DragController::ClippedSelection(const LocalFrame& frame) { DCHECK(frame.View()); return DataTransfer::ClipByVisualViewport( - FloatRect(frame.Selection().AbsoluteUnclippedBounds()), frame); + gfx::RectF(frame.Selection().AbsoluteUnclippedBounds()), frame); } static gfx::Point DragLocationForSelectionDrag(const LocalFrame& frame) { frame.View()->UpdateLifecycleToLayoutClean(DocumentUpdateReason::kSelection); - IntRect dragging_rect = - EnclosingIntRect(DragController::ClippedSelection(frame)); + gfx::Rect dragging_rect = + gfx::ToEnclosingRect(DragController::ClippedSelection(frame)); int xpos = dragging_rect.right(); xpos = dragging_rect.x() < xpos ? dragging_rect.x() : xpos; int ypos = dragging_rect.bottom(); @@ -1053,16 +1053,14 @@ return gfx::Point(xpos, ypos); } -static const IntSize MaxDragImageSize(float device_scale_factor) { +static const gfx::Size MaxDragImageSize(float device_scale_factor) { #if defined(OS_MAC) // Match Safari's drag image size. - static const IntSize kMaxDragImageSize(400, 400); + static const gfx::Size kMaxDragImageSize(400, 400); #else - static const IntSize kMaxDragImageSize(200, 200); + static const gfx::Size kMaxDragImageSize(200, 200); #endif - IntSize max_size_in_pixels = kMaxDragImageSize; - max_size_in_pixels.Scale(device_scale_factor); - return max_size_in_pixels; + return gfx::ScaleToFlooredSize(kMaxDragImageSize, device_scale_factor); } static bool CanDragImage(const Element& element) { @@ -1086,7 +1084,7 @@ static std::unique_ptr<DragImage> DragImageForImage( const Element& element, float device_scale_factor, - const IntSize& image_element_size_in_pixels) { + const gfx::Size& image_element_size_in_pixels) { auto* layout_image = To<LayoutImage>(element.GetLayoutObject()); const LayoutImageResource& image_resource = *layout_image->ImageResource(); scoped_refptr<Image> image = @@ -1094,15 +1092,15 @@ RespectImageOrientationEnum respect_orientation = image_resource.ImageOrientation(); - IntSize image_size = image->Size(respect_orientation); - if (image_size.Area() > kMaxOriginalImageArea) + gfx::Size image_size = image->Size(respect_orientation); + if (image_size.Area64() > kMaxOriginalImageArea) return nullptr; InterpolationQuality interpolation_quality = kInterpolationDefault; if (layout_image->StyleRef().ImageRendering() == EImageRendering::kPixelated) interpolation_quality = kInterpolationNone; - FloatSize image_scale = + gfx::Vector2dF image_scale = DragImage::ClampedImageScale(image_size, image_element_size_in_pixels, MaxDragImageSize(device_scale_factor)); @@ -1115,12 +1113,12 @@ const DragImage* drag_image, const gfx::Point& drag_origin, const gfx::Point& image_element_location, - const IntSize& image_element_size_in_pixels) { + const gfx::Size& image_element_size_in_pixels) { if (!drag_image) return drag_origin; - IntSize original_size = image_element_size_in_pixels; - IntSize new_size = drag_image->Size(); + gfx::Size original_size = image_element_size_in_pixels; + gfx::Size new_size = drag_image->Size(); // Properly orient the drag image and orient it differently if it's smaller // than the original @@ -1172,14 +1170,14 @@ DocumentUpdateReason::kDragImage); DCHECK(frame.GetDocument()->IsActive()); - FloatRect painting_rect = ClippedSelection(frame); + gfx::RectF painting_rect = ClippedSelection(frame); GlobalPaintFlags paint_flags = kGlobalPaintSelectionDragImageOnly | kGlobalPaintFlattenCompositingLayers; auto* builder = MakeGarbageCollected<PaintRecordBuilder>(); frame.View()->PaintContentsOutsideOfLifecycle( builder->Context(), paint_flags, - CullRect(ToGfxRect(EnclosingIntRect(painting_rect)))); + CullRect(gfx::ToEnclosingRect(painting_rect))); auto property_tree_state = frame.View() ->GetLayoutView() @@ -1249,11 +1247,11 @@ if (image_url.IsEmpty() || !element || !CanDragImage(*element)) return false; if (!drag_image) { - const IntRect& image_rect = hit_test_result.ImageRect(); - IntSize image_size_in_pixels = image_rect.size(); + const gfx::Rect& image_rect = hit_test_result.ImageRect(); // TODO(oshima): Remove this scaling and simply pass imageRect to // dragImageForImage once all platforms are migrated to use zoom for dsf. - image_size_in_pixels.Scale(src->GetPage()->DeviceScaleFactorDeprecated() * + gfx::Size image_size_in_pixels = gfx::ScaleToFlooredSize( + image_rect.size(), src->GetPage()->DeviceScaleFactorDeprecated() * src->GetPage()->GetVisualViewport().Scale()); float screen_device_scale_factor =
diff --git a/third_party/blink/renderer/core/page/drag_controller.h b/third_party/blink/renderer/core/page/drag_controller.h index a3d6c79..a27fe39 100644 --- a/third_party/blink/renderer/core/page/drag_controller.h +++ b/third_party/blink/renderer/core/page/drag_controller.h
@@ -36,6 +36,10 @@ #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-blink-forward.h" #include "ui/gfx/geometry/point.h" +namespace gfx { +class RectF; +} + namespace blink { class DataTransfer; @@ -44,7 +48,6 @@ class DragImage; class DragState; class LocalFrame; -class FloatRect; class FrameSelection; class HTMLInputElement; class Node; @@ -89,7 +92,7 @@ // Return the selection bounds in absolute coordinates for the frame, clipped // to the visual viewport. - static FloatRect ClippedSelection(const LocalFrame&); + static gfx::RectF ClippedSelection(const LocalFrame&); // ExecutionContextLifecycleObserver. void ContextDestroyed() final;
diff --git a/third_party/blink/renderer/core/page/drag_controller_test.cc b/third_party/blink/renderer/core/page/drag_controller_test.cc index e11b7f9..67d8f02 100644 --- a/third_party/blink/renderer/core/page/drag_controller_test.cc +++ b/third_party/blink/renderer/core/page/drag_controller_test.cc
@@ -190,12 +190,12 @@ // The top of the node should be visible but the bottom should be outside the // viewport. - FloatRect expected_selection(0, node_margin_top, node_width, - viewport_height_css - node_margin_top); + gfx::RectF expected_selection(0, node_margin_top, node_width, + viewport_height_css - node_margin_top); EXPECT_EQ(expected_selection, DragController::ClippedSelection(GetFrame())); auto selection_image(DragController::DragImageForSelection(GetFrame(), 1)); - IntSize expected_image_size(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + gfx::Size expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); // Scroll 500 css px down so the top of the node is outside the viewport. @@ -206,11 +206,11 @@ LocalFrameView* frame_view = GetDocument().View(); frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 0, node_width, viewport_height_css); + expected_selection = gfx::RectF(0, 0, node_width, viewport_height_css); EXPECT_EQ(expected_selection, DragController::ClippedSelection(GetFrame())); selection_image = DragController::DragImageForSelection(GetFrame(), 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); // Scroll 800 css px down so the top of the node is outside the viewport and @@ -218,12 +218,12 @@ scroll_offset = 800; frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 0, node_width, - node_height + node_margin_top - scroll_offset); + expected_selection = gfx::RectF( + 0, 0, node_width, node_height + node_margin_top - scroll_offset); EXPECT_EQ(expected_selection, DragController::ClippedSelection(GetFrame())); selection_image = DragController::DragImageForSelection(GetFrame(), 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); } @@ -262,10 +262,10 @@ // The iframe's selection rect is in the frame's local coordinates and should // not include the iframe's margin. - FloatRect expected_selection(0, 5, 30, 20); + gfx::RectF expected_selection(0, 5, 30, 20); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); auto selection_image(DragController::DragImageForSelection(child_frame, 1)); - IntSize expected_image_size(RoundedIntSize(expected_selection.size())); + gfx::Size expected_image_size = gfx::ToRoundedSize(expected_selection.size()); EXPECT_EQ(expected_image_size, selection_image->Size()); // The iframe's selection rect is in the frame's local coordinates and should @@ -274,10 +274,10 @@ LocalFrameView* frame_view = GetDocument().View(); frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 5, 30, 20); + expected_selection = gfx::RectF(0, 5, 30, 20); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); + expected_image_size = gfx::ToRoundedSize(expected_selection.size()); EXPECT_EQ(expected_image_size, selection_image->Size()); // The parent frame's scroll offset of 210 should cause the iframe content to @@ -286,10 +286,10 @@ scroll_offset = 210; frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 10, 30, 15); + expected_selection = gfx::RectF(0, 10, 30, 15); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); + expected_image_size = gfx::ToRoundedSize(expected_selection.size()); EXPECT_EQ(expected_image_size, selection_image->Size()); // Scrolling the iframe should shift the content so it is further under the @@ -298,10 +298,10 @@ child_frame.View()->LayoutViewport()->SetScrollOffset( ScrollOffset(0, iframe_scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 10, 30, 8); + expected_selection = gfx::RectF(0, 10, 30, 8); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); + expected_image_size = gfx::ToRoundedSize(expected_selection.size()); EXPECT_EQ(expected_image_size, selection_image->Size()); } @@ -343,11 +343,11 @@ // The iframe's selection rect is in the frame's local coordinates and should // not include the iframe's margin. - FloatRect expected_selection(0, 5, 30, 20); + gfx::RectF expected_selection(0, 5, 30, 20); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); auto selection_image(DragController::DragImageForSelection(child_frame, 1)); - IntSize expected_image_size(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + gfx::Size expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); // The iframe's selection rect is in the frame's local coordinates and should @@ -356,11 +356,11 @@ LocalFrameView* frame_view = GetDocument().View(); frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 5, 30, 20); + expected_selection = gfx::RectF(0, 5, 30, 20); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); // The parent frame's scroll offset of 210 should cause the iframe content to @@ -369,11 +369,11 @@ scroll_offset = 210; frame_view->LayoutViewport()->SetScrollOffset( ScrollOffset(0, scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 10, 30, 15); + expected_selection = gfx::RectF(0, 10, 30, 15); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); // Scrolling the iframe should shift the content so it is further under the @@ -382,11 +382,11 @@ child_frame.View()->LayoutViewport()->SetScrollOffset( ScrollOffset(0, iframe_scroll_offset), mojom::blink::ScrollType::kProgrammatic); - expected_selection = FloatRect(0, 10, 30, 8); + expected_selection = gfx::RectF(0, 10, 30, 8); EXPECT_EQ(expected_selection, DragController::ClippedSelection(child_frame)); selection_image = DragController::DragImageForSelection(child_frame, 1); - expected_image_size = IntSize(RoundedIntSize(expected_selection.size())); - expected_image_size.Scale(page_scale_factor); + expected_image_size = gfx::ToRoundedSize( + gfx::ScaleSize(expected_selection.size(), page_scale_factor)); EXPECT_EQ(expected_image_size, selection_image->Size()); } @@ -423,8 +423,8 @@ GetFrame().GetPage()->GetDragController().StartDrag( &GetFrame(), drag_state, mouse_event, gfx::Point(5, 10)); - IntSize expected_image_size = IntSize(50, 40); - expected_image_size.Scale(page_scale_factor); + IntSize expected_image_size = + IntSize(50 * page_scale_factor, 40 * page_scale_factor); EXPECT_EQ(expected_image_size, IntSize(GetChromeClient().last_drag_image_size)); // The drag image has a margin of 2px which should offset the selection
diff --git a/third_party/blink/renderer/core/page/drag_image.cc b/third_party/blink/renderer/core/page/drag_image.cc index 417dbc2..8c2a530 100644 --- a/third_party/blink/renderer/core/page/drag_image.cc +++ b/third_party/blink/renderer/core/page/drag_image.cc
@@ -71,11 +71,11 @@ } // anonymous namespace -FloatSize DragImage::ClampedImageScale(const IntSize& image_size, - const IntSize& size, - const IntSize& max_size) { +gfx::Vector2dF DragImage::ClampedImageScale(const gfx::Size& image_size, + const gfx::Size& size, + const gfx::Size& max_size) { // Non-uniform scaling for size mapping. - FloatSize image_scale( + gfx::Vector2dF image_scale( static_cast<float>(size.width()) / image_size.width(), static_cast<float>(size.height()) / image_size.height()); @@ -99,7 +99,7 @@ float device_scale_factor, InterpolationQuality interpolation_quality, float opacity, - FloatSize image_scale) { + gfx::Vector2dF image_scale) { if (!image) return nullptr; @@ -168,18 +168,18 @@ // First step is drawing the link drag image width. TextRun label_run(label.Impl()); TextRun url_run(url_string.Impl()); - IntSize label_size(label_font.Width(label_run), - label_font_data->GetFontMetrics().Ascent() + - label_font_data->GetFontMetrics().Descent()); + gfx::Size label_size(label_font.Width(label_run), + label_font_data->GetFontMetrics().Ascent() + + label_font_data->GetFontMetrics().Descent()); if (label_size.width() > max_drag_label_string_width_dip) { label_size.set_width(max_drag_label_string_width_dip); clip_label_string = true; } - IntSize url_string_size; - IntSize image_size(label_size.width() + kDragLabelBorderX * 2, - label_size.height() + kDragLabelBorderY * 2); + gfx::Size url_string_size; + gfx::Size image_size(label_size.width() + kDragLabelBorderX * 2, + label_size.height() + kDragLabelBorderY * 2); if (draw_url_string) { url_string_size.set_width(url_font.Width(url_run)); @@ -198,8 +198,8 @@ // We now know how big the image needs to be, so we create and // fill the background - IntSize scaled_image_size = image_size; - scaled_image_size.Scale(device_scale_factor); + gfx::Size scaled_image_size = + gfx::ScaleToFlooredSize(image_size, device_scale_factor); // TODO(fserb): are we sure this should be software? std::unique_ptr<CanvasResourceProvider> resource_provider( CanvasResourceProvider::CreateBitmapProvider( @@ -214,7 +214,7 @@ const float kDragLabelRadius = 5; - IntRect rect(gfx::Point(), image_size); + gfx::Rect rect(image_size); PaintFlags background_paint; background_paint.setColor(SkColorSetRGB(140, 140, 140)); background_paint.setAntiAlias(true);
diff --git a/third_party/blink/renderer/core/page/drag_image.h b/third_party/blink/renderer/core/page/drag_image.h index a6b8cacf..8cc2bf3 100644 --- a/third_party/blink/renderer/core/page/drag_image.h +++ b/third_party/blink/renderer/core/page/drag_image.h
@@ -29,8 +29,6 @@ #include <memory> #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/graphics/image_orientation.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item_client.h" @@ -38,6 +36,8 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -55,7 +55,7 @@ float device_scale_factor = 1, InterpolationQuality = kInterpolationDefault, float opacity = 1, - FloatSize image_scale = FloatSize(1, 1)); + gfx::Vector2dF image_scale = gfx::Vector2dF(1, 1)); static std::unique_ptr<DragImage> Create(const KURL&, const String& label, @@ -66,13 +66,15 @@ DragImage& operator=(const DragImage&) = delete; ~DragImage(); - static FloatSize ClampedImageScale(const IntSize&, - const IntSize&, - const IntSize& max_size); + static gfx::Vector2dF ClampedImageScale(const gfx::Size&, + const gfx::Size&, + const gfx::Size& max_size); const SkBitmap& Bitmap() { return bitmap_; } float ResolutionScale() const { return resolution_scale_; } - IntSize Size() const { return IntSize(bitmap_.width(), bitmap_.height()); } + gfx::Size Size() const { + return gfx::Size(bitmap_.width(), bitmap_.height()); + } void Scale(float scale_x, float scale_y);
diff --git a/third_party/blink/renderer/core/page/drag_image_test.cc b/third_party/blink/renderer/core/page/drag_image_test.cc index 550a842..cbd2081 100644 --- a/third_party/blink/renderer/core/page/drag_image_test.cc +++ b/third_party/blink/renderer/core/page/drag_image_test.cc
@@ -54,9 +54,9 @@ return base::AdoptRef(new TestImage(size)); } - IntSize SizeWithConfig(SizeConfig) const override { + gfx::Size SizeWithConfig(SizeConfig) const override { DCHECK(image_); - return IntSize(image_->width(), image_->height()); + return gfx::Size(image_->width(), image_->height()); } bool CurrentFrameKnownToBeOpaque() override { return false; } @@ -67,8 +67,8 @@ void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override { // Image pure virtual stub. } @@ -114,7 +114,7 @@ ASSERT_TRUE(drag_image); drag_image->Scale(0.5, 0.5); - IntSize size = drag_image->Size(); + gfx::Size size = drag_image->Size(); EXPECT_EQ(1, size.width()); EXPECT_EQ(1, size.height()); }
diff --git a/third_party/blink/renderer/core/page/print_context.cc b/third_party/blink/renderer/core/page/print_context.cc index c191874e..3ed0db71 100644 --- a/third_party/blink/renderer/core/page/print_context.cc +++ b/third_party/blink/renderer/core/page/print_context.cc
@@ -30,6 +30,7 @@ #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" namespace blink { @@ -42,7 +43,7 @@ return To<LayoutBoxModelObject>(object); } -bool IsCoordinateInPage(int top, int left, const IntRect& page) { +bool IsCoordinateInPage(int top, int left, const gfx::Rect& page) { return page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom(); } @@ -59,39 +60,39 @@ DCHECK(!is_printing_); } -void PrintContext::ComputePageRects(const FloatSize& print_size) { +void PrintContext::ComputePageRects(const gfx::SizeF& print_size) { page_rects_.clear(); if (!IsFrameValid()) return; if (!use_printing_layout_) { - IntRect page_rect(0, 0, print_size.width(), print_size.height()); + gfx::Rect page_rect(0, 0, print_size.width(), print_size.height()); page_rects_.push_back(page_rect); return; } auto* view = frame_->GetDocument()->GetLayoutView(); const PhysicalRect& document_rect = view->DocumentRect(); - FloatSize page_size = frame_->ResizePageRectsKeepingRatio( - print_size, FloatSize(document_rect.Width(), document_rect.Height())); + gfx::SizeF page_size = frame_->ResizePageRectsKeepingRatio( + print_size, gfx::SizeF(document_rect.size)); ComputePageRectsWithPageSizeInternal(page_size); } void PrintContext::ComputePageRectsWithPageSize( - const FloatSize& page_size_in_pixels) { + const gfx::SizeF& page_size_in_pixels) { page_rects_.clear(); ComputePageRectsWithPageSizeInternal(page_size_in_pixels); } void PrintContext::ComputePageRectsWithPageSizeInternal( - const FloatSize& page_size_in_pixels) { + const gfx::SizeF& page_size_in_pixels) { if (!IsFrameValid()) return; auto* view = frame_->GetDocument()->GetLayoutView(); - IntRect snapped_doc_rect = PixelSnappedIntRect(view->DocumentRect()); + gfx::Rect snapped_doc_rect = ToPixelSnappedRect(view->DocumentRect()); int page_width = page_size_in_pixels.width(); // We scaled with floating point arithmetic and need to ensure results like @@ -132,10 +133,10 @@ : inline_direction_start - page_logical_width; auto* scrollable_area = GetFrame()->View()->LayoutViewport(); - IntRect page_rect(page_logical_left, page_logical_top, page_logical_width, - page_logical_height); + gfx::Rect page_rect(page_logical_left, page_logical_top, page_logical_width, + page_logical_height); if (!is_horizontal) - page_rect = page_rect.TransposedRect(); + page_rect.Transpose(); page_rect.Offset(-scrollable_area->ScrollOffsetInt()); page_rects_.push_back(page_rect); } @@ -149,10 +150,10 @@ // without going back to screen mode. is_printing_ = true; - FloatSize original_page_size = FloatSize(width, height); - FloatSize min_layout_size = frame_->ResizePageRectsKeepingRatio( - original_page_size, FloatSize(width * kPrintingMinimumShrinkFactor, - height * kPrintingMinimumShrinkFactor)); + gfx::SizeF original_page_size(width, height); + gfx::SizeF min_layout_size = frame_->ResizePageRectsKeepingRatio( + original_page_size, gfx::SizeF(width * kPrintingMinimumShrinkFactor, + height * kPrintingMinimumShrinkFactor)); // This changes layout, so callers need to make sure that they don't paint to // screen while in printing mode. @@ -178,11 +179,11 @@ // static int PrintContext::PageNumberForElement(Element* element, - const FloatSize& page_size_in_pixels) { + const gfx::SizeF& page_size_in_pixels) { element->GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kPrinting); LocalFrame* frame = element->GetDocument().GetFrame(); - FloatRect page_rect(gfx::PointF(0, 0), page_size_in_pixels); + gfx::RectF page_rect(page_size_in_pixels); ScopedPrintContext print_context(frame); print_context->BeginPrintMode(page_rect.width(), page_rect.height()); @@ -191,7 +192,7 @@ if (!box) return -1; - FloatSize scaled_page_size = page_size_in_pixels; + gfx::SizeF scaled_page_size = page_size_in_pixels; scaled_page_size.Scale( frame->View()->LayoutViewport()->ContentsSize().width() / page_rect.width()); @@ -230,7 +231,7 @@ } void PrintContext::OutputLinkedDestinations(GraphicsContext& context, - const IntRect& page_rect) { + const gfx::Rect& page_rect) { if (!linked_destinations_valid_) { // Collect anchors in the top-level frame only because our PrintContext // supports only one namespace for the anchors. @@ -313,14 +314,14 @@ // static int PrintContext::NumberOfPages(LocalFrame* frame, - const FloatSize& page_size_in_pixels) { + const gfx::SizeF& page_size_in_pixels) { frame->GetDocument()->UpdateStyleAndLayout(DocumentUpdateReason::kPrinting); - FloatRect page_rect(gfx::PointF(0, 0), page_size_in_pixels); + gfx::RectF page_rect(page_size_in_pixels); ScopedPrintContext print_context(frame); print_context->BeginPrintMode(page_rect.width(), page_rect.height()); // Account for shrink-to-fit. - FloatSize scaled_page_size = page_size_in_pixels; + gfx::SizeF scaled_page_size = page_size_in_pixels; scaled_page_size.Scale( frame->View()->LayoutViewport()->ContentsSize().width() / page_rect.width());
diff --git a/third_party/blink/renderer/core/page/print_context.h b/third_party/blink/renderer/core/page/print_context.h index c918dba..d7a3c81 100644 --- a/third_party/blink/renderer/core/page/print_context.h +++ b/third_party/blink/renderer/core/page/print_context.h
@@ -28,13 +28,16 @@ #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" +#include "ui/gfx/geometry/rect.h" + +namespace gfx { +class SizeF; +} namespace blink { class Element; -class FloatSize; class GraphicsContext; -class IntRect; class LocalFrame; class Node; @@ -63,19 +66,19 @@ // FIXME: This means that CSS page breaks won't be on page boundary if the // size is different than what was passed to BeginPrintMode(). That's probably // not always desirable. - virtual void ComputePageRects(const FloatSize& print_size); + virtual void ComputePageRects(const gfx::SizeF& print_size); // Deprecated. Page size computation is already in this class, clients // shouldn't be copying it. virtual void ComputePageRectsWithPageSize( - const FloatSize& page_size_in_pixels); + const gfx::SizeF& page_size_in_pixels); // These are only valid after page rects are computed. wtf_size_t PageCount() const { return page_rects_.size(); } - const IntRect& PageRect(wtf_size_t page_number) const { + const gfx::Rect& PageRect(wtf_size_t page_number) const { return page_rects_[page_number]; } - const Vector<IntRect>& PageRects() const { return page_rects_; } + const Vector<gfx::Rect>& PageRects() const { return page_rects_; } // Enter print mode, updating layout for new page size. // This function can be called multiple times to apply new print options @@ -89,7 +92,7 @@ // Returns -1 if page isn't found. static int PageNumberForElement(Element*, - const FloatSize& page_size_in_pixels); + const gfx::SizeF& page_size_in_pixels); static String PageProperty(LocalFrame*, const char* property_name, uint32_t page_number); @@ -102,7 +105,7 @@ int margin_right, int margin_bottom, int margin_left); - static int NumberOfPages(LocalFrame*, const FloatSize& page_size_in_pixels); + static int NumberOfPages(LocalFrame*, const gfx::SizeF& page_size_in_pixels); virtual void Trace(Visitor*) const; @@ -111,14 +114,14 @@ protected: friend class PrintContextTest; - void OutputLinkedDestinations(GraphicsContext&, const IntRect& page_rect); + void OutputLinkedDestinations(GraphicsContext&, const gfx::Rect& page_rect); Member<LocalFrame> frame_; - Vector<IntRect> page_rects_; + Vector<gfx::Rect> page_rects_; private: void ComputePageRectsWithPageSizeInternal( - const FloatSize& page_size_in_pixels); + const gfx::SizeF& page_size_in_pixels); void CollectLinkedDestinations(Node*); bool IsFrameValid() const;
diff --git a/third_party/blink/renderer/core/page/print_context_test.cc b/third_party/blink/renderer/core/page/print_context_test.cc index 1379cc0..c346f04f 100644 --- a/third_party/blink/renderer/core/page/print_context_test.cc +++ b/third_party/blink/renderer/core/page/print_context_test.cc
@@ -164,7 +164,7 @@ } void PrintSinglePage(SkCanvas& canvas) { - IntRect page_rect(0, 0, kPageWidth, kPageHeight); + gfx::Rect page_rect(0, 0, kPageWidth, kPageHeight); GetDocument().SetPrinting(Document::kBeforePrinting); Event* event = MakeGarbageCollected<BeforePrintEvent>(); GetPrintContext().GetFrame()->DomWindow()->DispatchEvent(*event); @@ -174,7 +174,7 @@ GraphicsContext& context = builder->Context(); context.SetPrinting(true); GetDocument().View()->PaintContentsOutsideOfLifecycle( - context, kGlobalPaintAddUrlMetadata, CullRect(ToGfxRect(page_rect))); + context, kGlobalPaintAddUrlMetadata, CullRect(page_rect)); { DrawingRecorder recorder( context, *GetDocument().GetLayoutView(), @@ -432,7 +432,7 @@ )HTML"); int page_count = PrintContext::NumberOfPages(GetDocument().GetFrame(), - FloatSize(500, 500)); + gfx::SizeF(500, 500)); EXPECT_EQ(2, page_count); } @@ -500,7 +500,7 @@ // This tests that we properly resize and re-layout pages for printing. TEST_P(PrintContextFrameTest, BasicPrintPageLayout) { - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); float maximum_shrink_ratio = 1.1; auto* node = GetDocument().documentElement(); @@ -856,7 +856,7 @@ <iframe id="target" src='http://b.com/' width='100%' height='100%' style='border: 0px; margin: 0px; position: absolute; top: 0px; left: 0px'></iframe>)HTML"); - FloatSize page_size(400, 400); + gfx::SizeF page_size(400, 400); float maximum_shrink_ratio = 1.1; auto* parent = GetDocument().documentElement(); // The child document element inside iframe.
diff --git a/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc index 3fd32dc6..eacb743 100644 --- a/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/element_fragment_anchor_test.cc
@@ -149,10 +149,9 @@ iframe->contentDocument()->View()->LayoutViewport(); Element* fragment = iframe->contentDocument()->getElementById("fragment"); - IntRect fragment_rect_in_frame( - fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); - IntRect viewport_rect(gfx::Point(), - child_viewport->VisibleContentRect().size()); + gfx::Rect fragment_rect_in_frame = + ToGfxRect(fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); + gfx::Rect viewport_rect(child_viewport->VisibleContentRect().size()); EXPECT_TRUE(viewport_rect.Contains(fragment_rect_in_frame)) << "Fragment element at [" << fragment_rect_in_frame.ToString() @@ -210,10 +209,9 @@ iframe->contentDocument()->View()->LayoutViewport(); Element* fragment = iframe->contentDocument()->getElementById("fragment"); - IntRect fragment_rect_in_frame( - fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); - IntRect viewport_rect(gfx::Point(), - child_viewport->VisibleContentRect().size()); + gfx::Rect fragment_rect_in_frame = + ToGfxRect(fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); + gfx::Rect viewport_rect(child_viewport->VisibleContentRect().size()); EXPECT_TRUE(viewport_rect.Contains(fragment_rect_in_frame)) << "Fragment element at [" << fragment_rect_in_frame.ToString() @@ -339,9 +337,9 @@ Element* fragment = GetDocument().getElementById(u"\u00F6"); ASSERT_NE(nullptr, fragment); - IntRect fragment_rect_in_frame( - fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); - IntRect viewport_rect(gfx::Point(), viewport->VisibleContentRect().size()); + gfx::Rect fragment_rect_in_frame = + ToGfxRect(fragment->GetLayoutObject()->AbsoluteBoundingBoxRect()); + gfx::Rect viewport_rect(viewport->VisibleContentRect().size()); EXPECT_TRUE(viewport_rect.Contains(fragment_rect_in_frame)) << "Fragment element at [" << fragment_rect_in_frame.ToString()
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc index b1e06e3c..3f01dee 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc
@@ -259,7 +259,7 @@ scrollable_area->Layer()->SubpixelAccumulation(); PhysicalSize contents_size(scrollable_area->GetLayoutBox()->ScrollWidth(), scrollable_area->GetLayoutBox()->ScrollHeight()); - IntSize scroll_contents_size = + gfx::Size scroll_contents_size = PhysicalRect(subpixel_accumulation, contents_size).PixelSnappedSize(); // The scrolling contents layer must be at least as large as its clip. @@ -267,12 +267,12 @@ // content depends on the page scale factor. Its scrollable content is // the layout viewport which is sized based on the minimum allowed page // scale so it actually can be smaller than its clip. - IntSize container_size = scrollable_area->VisibleContentRect().size(); - scroll_contents_size = scroll_contents_size.ExpandedTo(container_size); + gfx::Size container_size = scrollable_area->VisibleContentRect().size(); + scroll_contents_size.SetToMax(container_size); // This call has to go through the GraphicsLayer method to preserve // invalidation code there. - graphics_layer->SetSize(ToGfxSize(scroll_contents_size)); + graphics_layer->SetSize(scroll_contents_size); } if (cc::ScrollbarLayerBase* scrollbar_layer = GetScrollbarLayer(scrollable_area, kHorizontalScrollbar)) {
diff --git a/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.cc b/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.cc index 176739c..0f53761 100644 --- a/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.cc +++ b/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.cc
@@ -74,9 +74,9 @@ return GetScrollableArea(GlobalRootScroller()); } -IntSize TopDocumentRootScrollerController::RootScrollerVisibleArea() const { +gfx::Size TopDocumentRootScrollerController::RootScrollerVisibleArea() const { if (!TopDocument() || !TopDocument()->View()) - return IntSize(); + return gfx::Size(); float minimum_page_scale = page_->GetPageScaleConstraintsSet().FinalConstraints().minimum_scale; @@ -84,12 +84,13 @@ ceilf(page_->GetVisualViewport().BrowserControlsAdjustment() / minimum_page_scale); - return TopDocument() - ->View() - ->LayoutViewport() - ->VisibleContentRect(kExcludeScrollbars) - .size() + - IntSize(0, browser_controls_adjustment); + gfx::Size layout_size = TopDocument() + ->View() + ->LayoutViewport() + ->VisibleContentRect(kExcludeScrollbars) + .size(); + return gfx::Size(layout_size.width(), + layout_size.height() + browser_controls_adjustment); } Node* TopDocumentRootScrollerController::FindGlobalRootScroller() {
diff --git a/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h b/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h index bd1dcf6..66600ea 100644 --- a/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h +++ b/third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/page/scrolling/root_scroller_controller.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -64,7 +64,7 @@ // Returns the size we should use for the root scroller, accounting for // browser controls adjustment and using the root LocalFrameView. - IntSize RootScrollerVisibleArea() const; + gfx::Size RootScrollerVisibleArea() const; private: // Calculates the Node that should be the global root scroller. On a simple
diff --git a/third_party/blink/renderer/core/paint/background_image_geometry.cc b/third_party/blink/renderer/core/paint/background_image_geometry.cc index 3f3f32233..3b6d8966 100644 --- a/third_party/blink/renderer/core/paint/background_image_geometry.cc +++ b/third_party/blink/renderer/core/paint/background_image_geometry.cc
@@ -714,9 +714,9 @@ PhysicalSize positioning_area_size = !image->HasIntrinsicSize() ? snapped_positioning_area_size : unsnapped_positioning_area_size; - PhysicalSize image_intrinsic_size = PhysicalSize::FromFloatSizeFloor( + PhysicalSize image_intrinsic_size = PhysicalSize::FromSizeFFloor( image->ImageSize(positioning_box_->StyleRef().EffectiveZoom(), - FloatSize(positioning_area_size), + gfx::SizeF(positioning_area_size), LayoutObject::ShouldRespectImageOrientation(box_))); switch (type) { case EFillSizeType::kSizeLength: {
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.cc b/third_party/blink/renderer/core/paint/box_border_painter.cc index c478541..85cfdbb 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.cc +++ b/third_party/blink/renderer/core/paint/box_border_painter.cc
@@ -124,21 +124,36 @@ return BorderStyleHasUnmatchedColorsAtCorner(style, side, adjacent_side); } -FloatRect CalculateSideRect(const FloatRoundedRect& outer_border, - const BorderEdge& edge, - BoxSide side) { - FloatRect side_rect(outer_border.Rect()); +void SetToRightSideRect(gfx::RectF& rect, float edge_width) { + rect.set_x(rect.right() - edge_width); + rect.set_width(edge_width); +} + +void SetToBottomSideRect(gfx::RectF& rect, float edge_width) { + rect.set_y(rect.bottom() - edge_width); + rect.set_height(edge_width); +} + +gfx::RectF CalculateSideRect(const FloatRoundedRect& outer_border, + const BorderEdge& edge, + BoxSide side) { + gfx::RectF side_rect = outer_border.Rect(); float width = edge.Width(); - if (side == BoxSide::kTop) - side_rect.set_height(width); - else if (side == BoxSide::kBottom) - side_rect.ShiftYEdgeTo(side_rect.bottom() - width); - else if (side == BoxSide::kLeft) - side_rect.set_width(width); - else - side_rect.ShiftXEdgeTo(side_rect.right() - width); - + switch (side) { + case BoxSide::kTop: + side_rect.set_height(width); + break; + case BoxSide::kBottom: + SetToBottomSideRect(side_rect, width); + break; + case BoxSide::kLeft: + side_rect.set_width(width); + break; + case BoxSide::kRight: + SetToRightSideRect(side_rect, width); + break; + } return side_rect; } @@ -231,11 +246,11 @@ } void DrawSolidBorderRect(GraphicsContext& context, - const FloatRect& border_rect, + const gfx::RectF& border_rect, float border_width, const Color& color, const AutoDarkMode& auto_dark_mode) { - FloatRect stroke_rect(border_rect); + gfx::RectF stroke_rect = border_rect; border_width = floorf(border_width); stroke_rect.Outset(-border_width / 2); @@ -433,18 +448,18 @@ switch (side) { case BoxSide::kTop: case BoxSide::kBottom: - context.DrawRect(IntRect(x1, y1, length, third_of_thickness), + context.DrawRect(gfx::Rect(x1, y1, length, third_of_thickness), auto_dark_mode); context.DrawRect( - IntRect(x1, y2 - third_of_thickness, length, third_of_thickness), + gfx::Rect(x1, y2 - third_of_thickness, length, third_of_thickness), auto_dark_mode); break; case BoxSide::kLeft: case BoxSide::kRight: - context.DrawRect(IntRect(x1, y1, third_of_thickness, length), + context.DrawRect(gfx::Rect(x1, y1, third_of_thickness, length), auto_dark_mode); context.DrawRect( - IntRect(x2 - third_of_thickness, y1, third_of_thickness, length), + gfx::Rect(x2 - third_of_thickness, y1, third_of_thickness, length), auto_dark_mode); break; } @@ -632,7 +647,8 @@ bool was_antialiased = context.ShouldAntialias(); if (antialias != was_antialiased) context.SetShouldAntialias(antialias); - context.FillRect(IntRect(x1, y1, x2 - x1, y2 - y1), color, auto_dark_mode); + context.FillRect(gfx::Rect(x1, y1, x2 - x1, y2 - y1), color, + auto_dark_mode); if (antialias != was_antialiased) context.SetShouldAntialias(was_antialiased); return; @@ -816,8 +832,7 @@ if (is_uniform_width_ && !outer_.IsRounded()) { // 4-side, solid, uniform-width, rectangular border => one drawRect() DrawSolidBorderRect( - context_, FloatRect(outer_.Rect()), FirstEdge().Width(), - FirstEdge().color, + context_, outer_.Rect(), FirstEdge().Width(), FirstEdge().color, PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); } else { @@ -849,7 +864,7 @@ {BoxSide::kTop, BoxSide::kRight, BoxSide::kBottom, BoxSide::kLeft}) { const BorderEdge& curr_edge = Edge(side); if (curr_edge.ShouldRender()) - path.AddRect(ToGfxRectF(CalculateSideRect(outer_, curr_edge, side))); + path.AddRect(CalculateSideRect(outer_, curr_edge, side)); } context_.SetFillColor(FirstEdge().color); @@ -1115,7 +1130,7 @@ const Color color(edge.color.Red(), edge.color.Green(), edge.color.Blue(), alpha); - FloatRect side_rect(outer_.Rect()); + gfx::RectF side_rect = outer_.Rect(); const Path* path = nullptr; // TODO(fmalita): find a way to consolidate these without sacrificing @@ -1143,7 +1158,7 @@ if (use_path) path = &border_info.rounded_border_path; else - side_rect.ShiftYEdgeTo(side_rect.bottom() - floorf(edge.Width())); + SetToBottomSideRect(side_rect, floorf(edge.Width())); PaintOneBorderSide(side_rect, BoxSide::kBottom, BoxSide::kLeft, BoxSide::kRight, path, color, completed_edges); @@ -1171,7 +1186,7 @@ if (use_path) path = &border_info.rounded_border_path; else - side_rect.ShiftXEdgeTo(side_rect.right() - floorf(edge.Width())); + SetToRightSideRect(side_rect, floorf(edge.Width())); PaintOneBorderSide(side_rect, BoxSide::kRight, BoxSide::kTop, BoxSide::kBottom, path, color, completed_edges); @@ -1227,7 +1242,7 @@ } void BoxBorderPainter::PaintOneBorderSide( - const FloatRect& side_rect, + const gfx::RectF& side_rect, BoxSide side, BoxSide adjacent_side1, BoxSide adjacent_side2, @@ -1327,7 +1342,7 @@ context_.SetStrokeStyle(kNoStroke); context_.SetFillColor(color); context_.DrawRect( - IntRect(gfx::ToRoundedRect(outer_.Rect())), + gfx::ToRoundedRect(outer_.Rect()), PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); } @@ -1460,9 +1475,9 @@ color, s2); } -FloatRect BoxBorderPainter::CalculateSideRectIncludingInner( +gfx::RectF BoxBorderPainter::CalculateSideRectIncludingInner( BoxSide side) const { - FloatRect side_rect(outer_.Rect()); + gfx::RectF side_rect = outer_.Rect(); float width; switch (side) { @@ -1472,7 +1487,7 @@ break; case BoxSide::kBottom: width = side_rect.height() - Edge(BoxSide::kTop).Width(); - side_rect.ShiftYEdgeTo(side_rect.bottom() - width); + SetToBottomSideRect(side_rect, width); break; case BoxSide::kLeft: width = side_rect.width() - Edge(BoxSide::kRight).Width(); @@ -1480,7 +1495,7 @@ break; case BoxSide::kRight: width = side_rect.width() - Edge(BoxSide::kLeft).Width(); - side_rect.ShiftXEdgeTo(side_rect.right() - width); + SetToRightSideRect(side_rect, width); break; }
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.h b/third_party/blink/renderer/core/paint/box_border_painter.h index 2a45860..3058ea5d 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.h +++ b/third_party/blink/renderer/core/paint/box_border_painter.h
@@ -106,7 +106,7 @@ BoxSide, unsigned alpha, BorderEdgeFlags) const; - void PaintOneBorderSide(const FloatRect& side_rect, + void PaintOneBorderSide(const gfx::RectF& side_rect, BoxSide, BoxSide adjacent_side1, BoxSide adjacent_side2, @@ -139,7 +139,7 @@ Color, EBorderStyle) const; void ClipBorderSidePolygon(BoxSide, MiterType miter1, MiterType miter2) const; - FloatRect CalculateSideRectIncludingInner(BoxSide) const; + gfx::RectF CalculateSideRectIncludingInner(BoxSide) const; void ClipBorderSideForComplexInnerPath(BoxSide) const; MiterType ComputeMiter(BoxSide, BoxSide adjacent_side, BorderEdgeFlags) const;
diff --git a/third_party/blink/renderer/core/paint/box_model_object_painter.cc b/third_party/blink/renderer/core/paint/box_model_object_painter.cc index 47ddd437be..6254ef2c 100644 --- a/third_party/blink/renderer/core/paint/box_model_object_painter.cc +++ b/third_party/blink/renderer/core/paint/box_model_object_painter.cc
@@ -59,10 +59,10 @@ void BoxModelObjectPainter::PaintTextClipMask( const PaintInfo& paint_info, - const IntRect& mask_rect, + const gfx::Rect& mask_rect, const PhysicalOffset& paint_offset, bool object_has_multiple_boxes) { - PaintInfo mask_paint_info(paint_info.context, CullRect(ToGfxRect(mask_rect)), + PaintInfo mask_paint_info(paint_info.context, CullRect(mask_rect), PaintPhase::kTextClip, kGlobalPaintNormalPhase, 0); mask_paint_info.SetFragmentID(paint_info.FragmentID()); if (flow_box_) { @@ -103,7 +103,7 @@ GraphicsContext& context = paint_info.context; // Clip to the overflow area. // TODO(chrishtr): this should be pixel-snapped. - context.Clip(FloatRect(this_box.OverflowClipRect(rect.offset))); + context.Clip(gfx::RectF(this_box.OverflowClipRect(rect.offset))); // Adjust the paint rect to reflect a scrolled content box with borders at // the ends.
diff --git a/third_party/blink/renderer/core/paint/box_model_object_painter.h b/third_party/blink/renderer/core/paint/box_model_object_painter.h index 88250da..450f1cf 100644 --- a/third_party/blink/renderer/core/paint/box_model_object_painter.h +++ b/third_party/blink/renderer/core/paint/box_model_object_painter.h
@@ -38,7 +38,7 @@ bool IsPaintingBackgroundInContentsSpace(const PaintInfo&) const override; void PaintTextClipMask(const PaintInfo&, - const IntRect& mask_rect, + const gfx::Rect& mask_rect, const PhysicalOffset& paint_offset, bool object_has_multiple_boxes) override; PhysicalRect AdjustRectForScrolledContent(
diff --git a/third_party/blink/renderer/core/paint/box_painter.cc b/third_party/blink/renderer/core/paint/box_painter.cc index 8fb94f34..319a366 100644 --- a/third_party/blink/renderer/core/paint/box_painter.cc +++ b/third_party/blink/renderer/core/paint/box_painter.cc
@@ -83,9 +83,9 @@ background_client = &layout_box_.GetScrollableArea() ->GetScrollingBackgroundDisplayItemClient(); - visual_rect = ToGfxRect( + visual_rect = layout_box_.GetScrollableArea()->ScrollingBackgroundVisualRect( - paint_offset)); + paint_offset); } else { paint_rect = layout_box_.PhysicalBorderBoxRect(); paint_rect.Move(paint_offset); @@ -184,7 +184,7 @@ // If we have a native theme appearance, paint that before painting our // background. The theme will tell us whether or not we should also paint the // CSS background. - IntRect snapped_paint_rect(PixelSnappedIntRect(paint_rect)); + gfx::Rect snapped_paint_rect = ToPixelSnappedRect(paint_rect); ThemePainter& theme_painter = LayoutTheme::GetTheme().Painter(); bool theme_painted = box_decoration_data.HasAppearance() &&
diff --git a/third_party/blink/renderer/core/paint/box_painter_base.cc b/third_party/blink/renderer/core/paint/box_painter_base.cc index 8e7aa52..19b97f52 100644 --- a/third_party/blink/renderer/core/paint/box_painter_base.cc +++ b/third_party/blink/renderer/core/paint/box_painter_base.cc
@@ -149,7 +149,7 @@ rect_to_clip_out.Inset(1); if (!rect_to_clip_out.IsEmpty()) - context.ClipOut(FloatRect(rect_to_clip_out)); + context.ClipOut(rect_to_clip_out); } } @@ -170,7 +170,7 @@ PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } else { context.FillRect( - FloatRect(fill_rect), Color::kBlack, + fill_rect, Color::kBlack, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } } @@ -274,7 +274,7 @@ context.ClipRoundedRect(bounds); ApplySpreadToShadowShape(inner_rounded_rect, -shadow.Spread()); } else { - context.Clip(FloatRect(bounds.Rect())); + context.Clip(bounds.Rect()); } DrawLooperBuilder draw_looper_builder; @@ -287,8 +287,8 @@ Color fill_color(shadow_color.Red(), shadow_color.Green(), shadow_color.Blue()); gfx::RectF outer_rect = AreaCastingShadowInHole(bounds.Rect(), shadow); - context.FillRectWithRoundedHole(FloatRect(outer_rect), inner_rounded_rect, - fill_color, auto_dark_mode); + context.FillRectWithRoundedHole(outer_rect, inner_rounded_rect, fill_color, + auto_dark_mode); } } @@ -403,7 +403,7 @@ namespace { -FloatRect SnapSourceRectIfNearIntegral(const FloatRect src_rect) { +gfx::RectF SnapSourceRectIfNearIntegral(const gfx::RectF src_rect) { // Round to avoid filtering pulling in neighboring pixels, for the // common case of sprite maps, but only if we're close to an integral size. // "Close" in this context means we will allow floating point inaccuracy, @@ -417,16 +417,16 @@ LayoutUnit::Epsilon() && std::abs(std::round(src_rect.bottom()) - src_rect.bottom()) <= LayoutUnit::Epsilon()) { - IntRect rounded_src_rect = RoundedIntRect(src_rect); + gfx::Rect rounded_src_rect = gfx::ToRoundedRect(src_rect); // If we have snapped the image size to 0, revert the rounding. if (rounded_src_rect.IsEmpty()) return src_rect; - return FloatRect(rounded_src_rect); + return gfx::RectF(rounded_src_rect); } return src_rect; } -absl::optional<FloatRect> OptimizeToSingleTileDraw( +absl::optional<gfx::RectF> OptimizeToSingleTileDraw( const BackgroundImageGeometry& geometry, const PhysicalRect& dest_rect, Image* image, @@ -448,7 +448,7 @@ // the snapped dest rect directly. const PhysicalRect offset_tile(offset_in_tile, geometry.SnappedDestRect().size); - return FloatRect(offset_tile); + return gfx::RectF(offset_tile); } // Compute the image subset, in intrinsic image coordinates, that gets mapped @@ -463,7 +463,8 @@ // // image-resolution information is baked into the given parameters, but we // need oriented size. - const FloatSize intrinsic_tile_size = image->SizeAsFloat(respect_orientation); + const gfx::SizeF intrinsic_tile_size = + image->SizeAsFloat(respect_orientation); // Subset computation needs the same location as was used above, but needs the // unsnapped destination size to correctly calculate sprite subsets in the @@ -471,10 +472,10 @@ // TODO(schenney): Re-enable this after determining why it fails for // CAP, and maybe other cases. // DCHECK(one_tile_rect.Contains(dest_rect_for_subset)); - const FloatSize scale( + const gfx::SizeF scale( geometry.TileSize().width / intrinsic_tile_size.width(), geometry.TileSize().height / intrinsic_tile_size.height()); - FloatRect visible_src_rect( + gfx::RectF visible_src_rect( offset_in_tile.left / scale.width(), offset_in_tile.top / scale.height(), geometry.UnsnappedDestRect().Width() / scale.width(), geometry.UnsnappedDestRect().Height() / scale.height()); @@ -519,10 +520,10 @@ // location in the presence of border snapping and zoom. const PhysicalRect dest_rect_for_subset(geometry.SnappedDestRect().offset, geometry.UnsnappedDestRect().size); - if (absl::optional<FloatRect> single_tile_src = OptimizeToSingleTileDraw( + if (absl::optional<gfx::RectF> single_tile_src = OptimizeToSingleTileDraw( geometry, dest_rect_for_subset, image, respect_orientation)) { context.DrawImage(image, Image::kSyncDecode, auto_dark_mode, - FloatRect(geometry.SnappedDestRect()), &*single_tile_src, + gfx::RectF(geometry.SnappedDestRect()), &*single_tile_src, op, respect_orientation); return; } @@ -535,14 +536,14 @@ // need oriented size. That requires explicitly applying orientation here. Image::SizeConfig size_config; size_config.apply_orientation = respect_orientation; - const FloatSize intrinsic_tile_size = + const gfx::SizeF intrinsic_tile_size = image->SizeWithConfigAsFloat(size_config); // Note that this tile rect uses the image's pre-scaled size. ImageTilingInfo tiling_info; tiling_info.image_rect.set_size(intrinsic_tile_size); tiling_info.phase = gfx::PointF(geometry.ComputeDestPhase()); - tiling_info.spacing = FloatSize(geometry.SpaceSize()); + tiling_info.spacing = gfx::SizeF(geometry.SpaceSize()); // Farther down the pipeline we will use the scaled tile size to determine // which dimensions to clamp or repeat in. We do not want to repeat when the @@ -566,7 +567,7 @@ // This call takes the unscaled image, applies the given scale, and paints // it into the snapped_dest_rect using phase from one_tile_rect and the // given repeat spacing. Note the phase is already scaled. - context.DrawImageTiled(image, FloatRect(geometry.SnappedDestRect()), + context.DrawImageTiled(image, gfx::RectF(geometry.SnappedDestRect()), tiling_info, auto_dark_mode, op, respect_orientation); } @@ -588,8 +589,7 @@ &progress)) { return nullptr; } - return generator->Paint(FloatSize(image_size), node, animated_colors, offsets, - progress); + return generator->Paint(image_size, node, animated_colors, offsets, progress); } // Returns true if the background color was painted by the paint worklet. @@ -609,7 +609,7 @@ context.DrawImageRRect( paint_worklet_image.get(), Image::kSyncDecode, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground), - dest_rect, FloatRect(src_rect)); + dest_rect, src_rect); return true; } @@ -663,7 +663,7 @@ // tile. The border for painting images may not be the same as the color due // to optimizations for the image painting destination that avoid painting // under the border. - FloatRect src_rect; + gfx::RectF src_rect; FloatRoundedRect image_border; if (info.should_paint_image && image) { // Avoid image shaders when printing (poorly supported in PDF). @@ -689,7 +689,7 @@ const PhysicalRect dest_rect = PhysicalRect::FastAndLossyFromRectF(image_rect); - absl::optional<FloatRect> single_tile_src = OptimizeToSingleTileDraw( + absl::optional<gfx::RectF> single_tile_src = OptimizeToSingleTileDraw( geometry, dest_rect, image, info.respect_image_orientation); if (!single_tile_src) return false; @@ -731,7 +731,7 @@ DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES( TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, node, *info.image, - FloatRect(image->Rect()), FloatRect(image_border.Rect())); + gfx::RectF(image->Rect()), gfx::RectF(image_border.Rect())); // Since there is no way for the developer to specify decode behavior, use // kSync by default. @@ -853,7 +853,7 @@ FloatRoundedRect(background_rect), context)) { context.FillRect( - IntRect(background_rect), info.color, + background_rect, info.color, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } } @@ -866,7 +866,7 @@ DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES( TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, node, *info.image, - FloatRect(image->Rect()), FloatRect(scrolled_paint_rect)); + gfx::RectF(image->Rect()), gfx::RectF(scrolled_paint_rect)); DrawTiledBackground( context, image, geometry, composite_op, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground), @@ -946,7 +946,7 @@ scrolled_paint_rect); image = fill_layer_info.image->GetImage( geometry.ImageClient(), geometry.ImageDocument(), - geometry.ImageStyle(style_), FloatSize(geometry.TileSize())); + geometry.ImageStyle(style_), gfx::SizeF(geometry.TileSize())); interpolation_quality_context.emplace(context, geometry.ImageInterpolationQuality()); @@ -1007,7 +1007,7 @@ AdjustOutsetsForEdgeInclusion(padding, fill_layer_info)); } background_clip_state_saver.Save(); - context.Clip(PixelSnappedIntRect(clip_rect)); + context.Clip(ToPixelSnappedRect(clip_rect)); break; } case EFillBox::kBorder: @@ -1035,7 +1035,7 @@ // First figure out how big the mask has to be. It should be no bigger // than what we need to actually render, so we should intersect the dirty // rect with the border box of the background. - IntRect mask_rect = PixelSnappedIntRect(rect); + gfx::Rect mask_rect = ToPixelSnappedRect(rect); GraphicsContext& context = paint_info.context;
diff --git a/third_party/blink/renderer/core/paint/box_painter_base.h b/third_party/blink/renderer/core/paint/box_painter_base.h index 4a13660..0dc32940 100644 --- a/third_party/blink/renderer/core/paint/box_painter_base.h +++ b/third_party/blink/renderer/core/paint/box_painter_base.h
@@ -15,6 +15,10 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/skia/include/core/SkBlendMode.h" +namespace gfx { +class Rect; +} + namespace blink { class BackgroundImageGeometry; @@ -23,7 +27,6 @@ class FillLayer; class FloatRoundedRect; class ImageResourceObserver; -class IntRect; class LayoutBox; class Node; struct PaintInfo; @@ -153,7 +156,7 @@ const PhysicalRect& scrolled_paint_rect, bool object_has_multiple_boxes); virtual void PaintTextClipMask(const PaintInfo&, - const IntRect& mask_rect, + const gfx::Rect& mask_rect, const PhysicalOffset& paint_offset, bool object_has_multiple_boxes) = 0;
diff --git a/third_party/blink/renderer/core/paint/clip_path_clipper.cc b/third_party/blink/renderer/core/paint/clip_path_clipper.cc index f5f65fd1..27834ef 100644 --- a/third_party/blink/renderer/core/paint/clip_path_clipper.cc +++ b/third_party/blink/renderer/core/paint/clip_path_clipper.cc
@@ -94,15 +94,15 @@ ClipPathPaintImageGenerator* generator = clip_path_owner.GetFrame()->GetClipPathPaintImageGenerator(); - scoped_refptr<Image> paint_worklet_image = generator->Paint( - zoom, FloatRect(reference_box), *clip_path_owner.GetNode()); + scoped_refptr<Image> paint_worklet_image = + generator->Paint(zoom, reference_box, *clip_path_owner.GetNode()); // TODO(crbug.com/1248610): Fix bounding box. It should enclose affected area // of the animation. absl::optional<gfx::RectF> bounding_box = ClipPathClipper::LocalClipPathBoundingBox(clip_path_owner); DCHECK(bounding_box); - FloatRect src_rect(bounding_box.value()); + gfx::RectF src_rect = bounding_box.value(); context.DrawImage(paint_worklet_image.get(), Image::kSyncDecode, PaintAutoDarkMode(clip_path_owner.StyleRef(), DarkModeFilter::ElementRole::kBackground),
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc index 3a36e6514..a2fc970 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
@@ -470,7 +470,7 @@ void CompositedLayerMapping::ComputeBoundsOfOwningLayer( const PaintLayer* composited_ancestor, - IntRect& local_bounds, + gfx::Rect& local_bounds, gfx::Point& snapped_offset_from_composited_ancestor) { // HACK(chrishtr): adjust for position of inlines. PhysicalOffset local_representative_point_for_fragmentation; @@ -522,19 +522,17 @@ // the compositor implementation requires mask layer bound to match its // host layer. if (mask_bounding_box) { - local_bounds = IntRect(*mask_bounding_box); - if (clip_path_bounding_box) { - local_bounds.Intersect( - IntRect(gfx::ToEnclosingRect(*clip_path_bounding_box))); - } + local_bounds = *mask_bounding_box; + if (clip_path_bounding_box) + local_bounds.Intersect(gfx::ToEnclosingRect(*clip_path_bounding_box)); } else if (clip_path_bounding_box) { - local_bounds = IntRect(gfx::ToEnclosingRect(*clip_path_bounding_box)); + local_bounds = gfx::ToEnclosingRect(*clip_path_bounding_box); } else { // Move the bounds by the subpixel accumulation so that it pixel-snaps // relative to absolute pixels instead of local coordinates. PhysicalRect local_raw_compositing_bounds = CompositedBounds(); local_raw_compositing_bounds.Move(subpixel_accumulation); - local_bounds = PixelSnappedIntRect(local_raw_compositing_bounds); + local_bounds = ToPixelSnappedRect(local_raw_compositing_bounds); } } @@ -601,7 +599,7 @@ // compositingContainerOffsetFromParentGraphicsLayer. total_squash_bounds.Move( compositing_container_offset_from_parent_graphics_layer); - const IntRect squash_layer_bounds = EnclosingIntRect(total_squash_bounds); + const gfx::Rect squash_layer_bounds = ToEnclosingRect(total_squash_bounds); const gfx::Point squash_layer_origin = squash_layer_bounds.origin(); const PhysicalOffset squash_layer_origin_in_compositing_container_space = PhysicalOffset(squash_layer_origin) - @@ -627,8 +625,8 @@ compositing_container_offset_from_transformed_ancestor) - squash_layer_origin_in_compositing_container_space; - IntSize new_offset_from_layout_object = - -ToIntSize(ToRoundedPoint(offset_from_squash_layer_origin)); + gfx::Vector2d new_offset_from_layout_object = + -ToRoundedVector2d(offset_from_squash_layer_origin); PhysicalOffset subpixel_accumulation = offset_from_squash_layer_origin + PhysicalOffset(new_offset_from_layout_object); @@ -641,15 +639,14 @@ layer->paint_layer->SetSubpixelAccumulation(subpixel_accumulation); } - non_scrolling_squashing_layer_->SetSize( - ToGfxSize(squash_layer_bounds.size())); + non_scrolling_squashing_layer_->SetSize(squash_layer_bounds.size()); // We can't non_scrolling_squashing_layer_->SetOffsetFromLayoutObject(). // Squashing layer has special paint and invalidation logic that already // compensated for compositing bounds, setting it here would end up // double adjustment. - auto new_offset = IntSize(squash_layer_bounds.origin() - - snapped_offset_from_composited_ancestor + - graphics_layer_parent_location.OffsetFromOrigin()); + auto new_offset = squash_layer_bounds.origin() - + snapped_offset_from_composited_ancestor + + graphics_layer_parent_location.OffsetFromOrigin(); if (new_offset != non_scrolling_squashing_layer_offset_from_layout_object_) { non_scrolling_squashing_layer_offset_from_layout_object_ = new_offset; // Need to update squashing LayerState according to the new offset. @@ -667,7 +664,7 @@ DCHECK_EQ(owning_layer_->Compositor()->Lifecycle().GetState(), DocumentLifecycle::kInCompositingAssignmentsUpdate); - IntRect local_compositing_bounds; + gfx::Rect local_compositing_bounds; gfx::Point snapped_offset_from_composited_ancestor; ComputeBoundsOfOwningLayer(compositing_container, local_compositing_bounds, snapped_offset_from_composited_ancestor); @@ -694,10 +691,10 @@ } void CompositedLayerMapping::UpdateMainGraphicsLayerGeometry( - const IntRect& local_compositing_bounds) { + const gfx::Rect& local_compositing_bounds) { graphics_layer_->SetOffsetFromLayoutObject( - ToIntSize(local_compositing_bounds.origin())); - graphics_layer_->SetSize(ToGfxSize(local_compositing_bounds.size())); + local_compositing_bounds.OffsetFromOrigin()); + graphics_layer_->SetSize(local_compositing_bounds.size()); // m_graphicsLayer is the corresponding GraphicsLayer for this PaintLayer // and its non-compositing descendants. So, the visibility flag for @@ -717,10 +714,10 @@ const PaintLayer* compositing_container, gfx::Point& graphics_layer_parent_location) { if (compositing_container) { - graphics_layer_parent_location = - ToGfxPoint(compositing_container->GetCompositedLayerMapping() - ->ParentForSublayers() - ->OffsetFromLayoutObject()); + graphics_layer_parent_location = gfx::PointAtOffsetFromOrigin( + compositing_container->GetCompositedLayerMapping() + ->ParentForSublayers() + ->OffsetFromLayoutObject()); } else if (!GetLayoutObject().GetFrame()->IsLocalRoot()) { // TODO(oopif) DCHECK(!compositing_container); graphics_layer_parent_location = gfx::Point(); @@ -759,7 +756,7 @@ DCHECK(scrolling_contents_layer_); auto& layout_box = To<LayoutBox>(GetLayoutObject()); - IntRect overflow_clip_rect = PixelSnappedIntRect( + gfx::Rect overflow_clip_rect = ToPixelSnappedRect( layout_box.OverflowClipRect(owning_layer_->SubpixelAccumulation())); bool scroll_container_size_changed = @@ -769,25 +766,25 @@ PaintLayerScrollableArea* scrollable_area = owning_layer_->GetScrollableArea(); - IntSize scroll_size = scrollable_area->PixelSnappedContentsSize( + gfx::Size scroll_size = scrollable_area->PixelSnappedContentsSize( owning_layer_->SubpixelAccumulation()); // Ensure scrolling contents are at least as large as the scroll clip - scroll_size = scroll_size.ExpandedTo(overflow_clip_rect.size()); + scroll_size.SetToMin(overflow_clip_rect.size()); auto* scrolling_coordinator = owning_layer_->GetScrollingCoordinator(); scrolling_coordinator->UpdateCompositorScrollOffset(*layout_box.GetFrame(), *scrollable_area); - if (ToGfxSize(scroll_size) != scrolling_contents_layer_->Size() || + if (scroll_size != scrolling_contents_layer_->Size() || scroll_container_size_changed) { scrolling_coordinator->ScrollableAreaScrollLayerDidChange(scrollable_area); } - scrolling_contents_layer_->SetSize(ToGfxSize(scroll_size)); + scrolling_contents_layer_->SetSize(scroll_size); scrolling_contents_layer_->SetOffsetFromLayoutObject( - IntSize(overflow_clip_rect.origin() - scrollable_area->ScrollOrigin())); + overflow_clip_rect.origin() - scrollable_area->ScrollOrigin()); for (auto& layer : squashed_layers_in_scrolling_contents_) { layer->composited_bounds = layer->paint_layer->BoundingBoxForCompositing(); @@ -795,8 +792,8 @@ layer->paint_layer->ComputeOffsetFromAncestor(*owning_layer_) + owning_layer_->SubpixelAccumulation() - PhysicalOffset(scrolling_contents_layer_->OffsetFromLayoutObject()); - IntSize new_offset_from_layout_object = - -ToIntSize(ToRoundedPoint(offset_from_scrolling_contents_layer)); + gfx::Vector2d new_offset_from_layout_object = + -ToRoundedVector2d(offset_from_scrolling_contents_layer); PhysicalOffset subpixel_accumulation = offset_from_scrolling_contents_layer + PhysicalOffset(new_offset_from_layout_object); @@ -837,28 +834,28 @@ return; // Should be equivalent to local_compositing_bounds. - IntRect compositing_bounds( - ToGfxPoint(graphics_layer_->OffsetFromLayoutObject()), - IntSize(graphics_layer_->Size())); + gfx::Rect compositing_bounds( + gfx::PointAtOffsetFromOrigin(graphics_layer_->OffsetFromLayoutObject()), + graphics_layer_->Size()); if (scrolling_contents_layer_) { // Override compositing bounds to include full overflow if composited // scrolling is used. compositing_bounds = - IntRect(ToGfxPoint(scrolling_contents_layer_->OffsetFromLayoutObject()), - IntSize(scrolling_contents_layer_->Size())); + gfx::Rect(gfx::PointAtOffsetFromOrigin( + scrolling_contents_layer_->OffsetFromLayoutObject()), + scrolling_contents_layer_->Size()); } foreground_layer_->SetOffsetFromLayoutObject( - ToIntSize(compositing_bounds.origin())); - foreground_layer_->SetSize(ToGfxSize(compositing_bounds.size())); + compositing_bounds.OffsetFromOrigin()); + foreground_layer_->SetSize(compositing_bounds.size()); } void CompositedLayerMapping::UpdateDecorationOutlineLayerGeometry( - const IntSize& relative_compositing_bounds_size) { + const gfx::Size& relative_compositing_bounds_size) { if (!decoration_outline_layer_) return; - decoration_outline_layer_->SetSize( - ToGfxSize(relative_compositing_bounds_size)); + decoration_outline_layer_->SetSize(relative_compositing_bounds_size); decoration_outline_layer_->SetOffsetFromLayoutObject( graphics_layer_->OffsetFromLayoutObject()); } @@ -914,7 +911,7 @@ } void CompositedLayerMapping::UpdateContentsRect() { - graphics_layer_->SetContentsRect(PixelSnappedIntRect(ContentsBox())); + graphics_layer_->SetContentsRect(ToPixelSnappedRect(ContentsBox())); } void CompositedLayerMapping::UpdateDrawsContentAndPaintsHitTest() { @@ -1057,11 +1054,11 @@ Scrollbar* h_bar = owning_layer_->GetScrollableArea()->HorizontalScrollbar(); if (h_bar) { - IntRect frame_rect = h_bar->FrameRect(); - layer->SetOffsetFromLayoutObject(ToIntSize(frame_rect.origin())); - layer->SetSize(ToGfxSize(frame_rect.size())); + gfx::Rect frame_rect = h_bar->FrameRect(); + layer->SetOffsetFromLayoutObject(frame_rect.OffsetFromOrigin()); + layer->SetSize(frame_rect.size()); if (layer->HasContentsLayer()) - layer->SetContentsRect(IntRect(gfx::Point(), frame_rect.size())); + layer->SetContentsRect(gfx::Rect(frame_rect.size())); } bool h_bar_visible = h_bar && !layer->HasContentsLayer(); layer->SetDrawsContent(h_bar_visible); @@ -1071,11 +1068,11 @@ if (GraphicsLayer* layer = LayerForVerticalScrollbar()) { Scrollbar* v_bar = owning_layer_->GetScrollableArea()->VerticalScrollbar(); if (v_bar) { - IntRect frame_rect = v_bar->FrameRect(); - layer->SetOffsetFromLayoutObject(ToIntSize(frame_rect.origin())); - layer->SetSize(ToGfxSize(frame_rect.size())); + gfx::Rect frame_rect = v_bar->FrameRect(); + layer->SetOffsetFromLayoutObject(frame_rect.OffsetFromOrigin()); + layer->SetSize(frame_rect.size()); if (layer->HasContentsLayer()) - layer->SetContentsRect(IntRect(gfx::Point(), frame_rect.size())); + layer->SetContentsRect(gfx::Rect(frame_rect.size())); } bool v_bar_visible = v_bar && !layer->HasContentsLayer(); layer->SetDrawsContent(v_bar_visible); @@ -1083,11 +1080,11 @@ } if (GraphicsLayer* layer = LayerForScrollCorner()) { - const IntRect& scroll_corner_and_resizer = + const gfx::Rect& scroll_corner_and_resizer = owning_layer_->GetScrollableArea()->ScrollCornerAndResizerRect(); layer->SetOffsetFromLayoutObject( - ToIntSize(scroll_corner_and_resizer.origin())); - layer->SetSize(ToGfxSize(scroll_corner_and_resizer.size())); + scroll_corner_and_resizer.OffsetFromOrigin()); + layer->SetSize(scroll_corner_and_resizer.size()); layer->SetDrawsContent(!scroll_corner_and_resizer.IsEmpty()); layer->SetHitTestable(!scroll_corner_and_resizer.IsEmpty()); } @@ -1511,7 +1508,7 @@ .CalculateBackgroundClipRect(clip_rects_context, parent_clip_rect); // Convert from ancestor to local coordinates. - IntSize ancestor_to_local_offset = + gfx::Vector2d ancestor_to_local_offset = paint_info.offset_from_layout_object - ancestor_paint_info->offset_from_layout_object; parent_clip_rect.Move(PhysicalOffset(ancestor_to_local_offset)); @@ -1526,21 +1523,21 @@ const GraphicsLayer& graphics_layer, PaintLayerFlags paint_layer_flags, GraphicsContext& context, - const IntRect& clip /* In the coords of rootLayer */) const { + const gfx::Rect& clip /* In the coords of rootLayer */) const { FontCachePurgePreventer font_cache_purge_preventer; - IntSize offset = paint_info.offset_from_layout_object; + gfx::Vector2d offset = paint_info.offset_from_layout_object; // The dirtyRect is in the coords of the painting root. - IntRect dirty_rect(clip); + gfx::Rect dirty_rect(clip); dirty_rect.Offset(offset); if (paint_layer_flags & (kPaintLayerPaintingOverflowContents)) { - dirty_rect.MoveBy( - ToRoundedPoint(paint_info.paint_layer->SubpixelAccumulation())); + dirty_rect.Offset( + ToRoundedVector2d(paint_info.paint_layer->SubpixelAccumulation())); } else { PhysicalRect bounds = paint_info.composited_bounds; bounds.Move(paint_info.paint_layer->SubpixelAccumulation()); - dirty_rect.Intersect(PixelSnappedIntRect(bounds)); + dirty_rect.Intersect(ToPixelSnappedRect(bounds)); } #if DCHECK_IS_ON() @@ -1581,15 +1578,13 @@ kPaintsIntoGroupedBacking) { // FIXME: GraphicsLayers need a way to split for multicol. PaintLayerPaintingInfo painting_info( - paint_info.paint_layer, CullRect(ToGfxRect(dirty_rect)), - kGlobalPaintNormalPhase, + paint_info.paint_layer, CullRect(dirty_rect), kGlobalPaintNormalPhase, paint_info.paint_layer->SubpixelAccumulation()); PaintLayerPainter(*paint_info.paint_layer) .PaintLayerContents(context, painting_info, paint_layer_flags); } else { PaintLayerPaintingInfo painting_info( - paint_info.paint_layer, CullRect(ToGfxRect(dirty_rect)), - kGlobalPaintNormalPhase, + paint_info.paint_layer, CullRect(dirty_rect), kGlobalPaintNormalPhase, paint_info.paint_layer->SubpixelAccumulation()); PaintLayerPainter(*paint_info.paint_layer) .Paint(context, painting_info, paint_layer_flags); @@ -1600,13 +1595,13 @@ // headless, where we would like to record an exact area. static const int kPixelDistanceToRecord = 4000; -IntRect CompositedLayerMapping::RecomputeInterestRect( +gfx::Rect CompositedLayerMapping::RecomputeInterestRect( const GraphicsLayer* graphics_layer) const { DCHECK(!RuntimeEnabledFeatures::CullRectUpdateEnabled()); - IntRect graphics_layer_bounds(gfx::Point(), IntSize(graphics_layer->Size())); + gfx::Rect graphics_layer_bounds(graphics_layer->Size()); - FloatClipRect mapping_rect(ToGfxRectF(FloatRect(graphics_layer_bounds))); + FloatClipRect mapping_rect((gfx::RectF(graphics_layer_bounds))); auto source_state = graphics_layer->GetPropertyTreeState(); @@ -1623,10 +1618,10 @@ GeometryMapper::LocalToAncestorVisualRect(source_state, root_view_state, mapping_rect); - FloatRect visible_content_rect( - gfx::RectF(gfx::ToEnclosingRect(mapping_rect.Rect()))); + gfx::RectF visible_content_rect = + gfx::RectF(gfx::ToEnclosingRect(mapping_rect.Rect())); - FloatRect local_interest_rect; + gfx::RectF local_interest_rect; // If the visible content rect is empty, then it makes no sense to map it // back since there is nothing to map. if (!visible_content_rect.IsEmpty()) { @@ -1670,7 +1665,7 @@ unpadded_intersection.y()); } - unpadded_intersection.Intersect(FloatRect(graphics_layer_bounds)); + unpadded_intersection.Intersect(gfx::RectF(graphics_layer_bounds)); // If our unpadded intersection is not empty, then use that before // padding, since it can produce more stable results, and it would not // produce any smaller area than if we used the original local interest @@ -1701,16 +1696,16 @@ // Expand by interest rect padding amount. local_interest_rect.Outset(kPixelDistanceToRecord); } - return IntersectRects(EnclosingIntRect(local_interest_rect), - graphics_layer_bounds); + return gfx::IntersectRects(gfx::ToEnclosingRect(local_interest_rect), + graphics_layer_bounds); } static const int kMinimumDistanceBeforeRepaint = 512; bool CompositedLayerMapping::InterestRectChangedEnoughToRepaint( - const IntRect& previous_interest_rect, - const IntRect& new_interest_rect, - const IntSize& layer_size) { + const gfx::Rect& previous_interest_rect, + const gfx::Rect& new_interest_rect, + const gfx::Size& layer_size) { DCHECK(!RuntimeEnabledFeatures::CullRectUpdateEnabled()); if (previous_interest_rect.IsEmpty() && new_interest_rect.IsEmpty()) @@ -1723,7 +1718,7 @@ // Repaint if the new interest rect includes area outside of a skirt around // the existing interest rect. - IntRect expanded_previous_interest_rect(previous_interest_rect); + gfx::Rect expanded_previous_interest_rect(previous_interest_rect); expanded_previous_interest_rect.Outset(kMinimumDistanceBeforeRepaint); if (!expanded_previous_interest_rect.Contains(new_interest_rect)) return true; @@ -1747,14 +1742,13 @@ return false; } -IntRect CompositedLayerMapping::ComputeInterestRect( +gfx::Rect CompositedLayerMapping::ComputeInterestRect( const GraphicsLayer* graphics_layer, - const IntRect& previous_interest_rect) const { + const gfx::Rect& previous_interest_rect) const { DCHECK(!RuntimeEnabledFeatures::CullRectUpdateEnabled()); // Use the previous interest rect if it covers the whole layer. - IntRect whole_layer_rect = - IntRect(gfx::Point(), IntSize(graphics_layer->Size())); + gfx::Rect whole_layer_rect(graphics_layer->Size()); if (!NeedsRepaint(*graphics_layer) && previous_interest_rect == whole_layer_rect) return previous_interest_rect; @@ -1764,16 +1758,15 @@ graphics_layer != scrolling_contents_layer_) return whole_layer_rect; - IntRect new_interest_rect = RecomputeInterestRect(graphics_layer); + gfx::Rect new_interest_rect = RecomputeInterestRect(graphics_layer); if (NeedsRepaint(*graphics_layer) || - InterestRectChangedEnoughToRepaint(previous_interest_rect, - new_interest_rect, - IntSize(graphics_layer->Size()))) + InterestRectChangedEnoughToRepaint( + previous_interest_rect, new_interest_rect, graphics_layer->Size())) return new_interest_rect; return previous_interest_rect; } -IntRect CompositedLayerMapping::PaintableRegion( +gfx::Rect CompositedLayerMapping::PaintableRegion( const GraphicsLayer* graphics_layer) const { DCHECK(RuntimeEnabledFeatures::CullRectUpdateEnabled()); const auto& fragment = @@ -1783,11 +1776,11 @@ (graphics_layer == foreground_layer_ && scrolling_contents_layer_) ? fragment.GetContentsCullRect() : fragment.GetCullRect(); - IntRect layer_rect(gfx::Point(), IntSize(graphics_layer->Size())); + gfx::Rect layer_rect(graphics_layer->Size()); if (cull_rect.IsInfinite()) return layer_rect; cull_rect.Move(-graphics_layer->GetOffsetFromTransformNode()); - return IntersectRects(IntRect(cull_rect.Rect()), layer_rect); + return IntersectRects(cull_rect.Rect(), layer_rect); } LayoutSize CompositedLayerMapping::SubpixelAccumulation() const { @@ -1802,7 +1795,7 @@ bool CompositedLayerMapping::AdjustForCompositedScrolling( const GraphicsLayer* graphics_layer, - IntSize& offset) const { + gfx::Vector2d& offset) const { if (graphics_layer == scrolling_contents_layer_ || graphics_layer == foreground_layer_) { if (PaintLayerScrollableArea* scrollable_area = @@ -1813,7 +1806,7 @@ // offsetFromLayoutObject adds the origin offset from top/left to the // beginning of flow. ScrollOffset scroll_offset = scrollable_area->GetScrollOffset(); - offset.Enlarge(-scroll_offset.x(), -scroll_offset.y()); + offset -= gfx::ToFlooredVector2d(scroll_offset); return true; } } @@ -1850,10 +1843,10 @@ const GraphicsLayer* graphics_layer, GraphicsContext& context, GraphicsLayerPaintingPhase graphics_layer_painting_phase, - const IntRect& interest_rect_arg) const { - IntRect interest_rect = RuntimeEnabledFeatures::CullRectUpdateEnabled() - ? PaintableRegion(graphics_layer) - : interest_rect_arg; + const gfx::Rect& interest_rect_arg) const { + gfx::Rect interest_rect = RuntimeEnabledFeatures::CullRectUpdateEnabled() + ? PaintableRegion(graphics_layer) + : interest_rect_arg; FramePaintTiming frame_paint_timing(context, GetLayoutObject().GetFrame()); @@ -1937,14 +1930,14 @@ void CompositedLayerMapping::PaintScrollableArea( const GraphicsLayer* graphics_layer, GraphicsContext& context, - const IntRect& interest_rect) const { + const gfx::Rect& interest_rect) const { if (GetLayoutObject().StyleRef().Visibility() != EVisibility::kVisible) return; // cull_rect is in the space of the containing scrollable area in which // Scrollbar::Paint() will paint the scrollbar. - CullRect cull_rect(ToGfxRect(interest_rect)); - cull_rect.Move(ToGfxVector2d(graphics_layer->OffsetFromLayoutObject())); + CullRect cull_rect(interest_rect); + cull_rect.Move(graphics_layer->OffsetFromLayoutObject()); PaintLayerScrollableArea* scrollable_area = owning_layer_->GetScrollableArea(); ScrollableAreaPainter painter(*scrollable_area);
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h index 727475b..bf7c535 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h
@@ -62,7 +62,7 @@ // Offset describing where this squashed Layer paints into the shared // GraphicsLayer backing. - IntSize offset_from_layout_object; + gfx::Vector2d offset_from_layout_object; bool offset_from_layout_object_set = false; GraphicsLayerPaintInfo() = default; @@ -139,7 +139,8 @@ GraphicsLayer* NonScrollingSquashingLayer() const { return non_scrolling_squashing_layer_; } - const IntSize& NonScrollingSquashingLayerOffsetFromLayoutObject() const { + const gfx::Vector2d& NonScrollingSquashingLayerOffsetFromLayoutObject() + const { return non_scrolling_squashing_layer_offset_from_layout_object_; } @@ -174,16 +175,16 @@ void UpdateElementId(); // GraphicsLayerClient interface - IntRect ComputeInterestRect( + gfx::Rect ComputeInterestRect( const GraphicsLayer*, - const IntRect& previous_interest_rect) const override; - IntRect PaintableRegion(const GraphicsLayer*) const override; + const gfx::Rect& previous_interest_rect) const override; + gfx::Rect PaintableRegion(const GraphicsLayer*) const override; LayoutSize SubpixelAccumulation() const final; bool NeedsRepaint(const GraphicsLayer&) const override; void PaintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, - const IntRect& interest_rect) const override; + const gfx::Rect& interest_rect) const override; bool ShouldSkipPaintingSubtree() const override; bool IsTrackingRasterInvalidations() const override; void GraphicsLayersDidChange() override; @@ -256,7 +257,7 @@ // Returns whether an adjustment happend. bool AdjustForCompositedScrolling(const GraphicsLayer*, - IntSize& offset) const; + gfx::Vector2d& offset) const; private: // Returns true for layers with scrollable overflow which have a background @@ -277,11 +278,11 @@ kBackgroundPaintInBorderBoxSpace; } - IntRect RecomputeInterestRect(const GraphicsLayer*) const; + gfx::Rect RecomputeInterestRect(const GraphicsLayer*) const; static bool InterestRectChangedEnoughToRepaint( - const IntRect& previous_interest_rect, - const IntRect& new_interest_rect, - const IntSize& layer_size); + const gfx::Rect& previous_interest_rect, + const gfx::Rect& new_interest_rect, + const gfx::Size& layer_size); static const GraphicsLayerPaintInfo* ContainingSquashedLayer( const LayoutObject*, @@ -292,7 +293,7 @@ // given context. void PaintScrollableArea(const GraphicsLayer*, GraphicsContext&, - const IntRect& interest_rect) const; + const gfx::Rect& interest_rect) const; // Returns whether the given layer is part of the scrollable area, if any, // associated with this mapping. bool IsScrollableAreaLayer(const GraphicsLayer*) const; @@ -310,11 +311,12 @@ const gfx::Point& snapped_offset_from_composited_ancestor, HeapVector<Member<GraphicsLayerPaintInfo>>& layers, HeapVector<Member<PaintLayer>>& layers_needing_paint_invalidation); - void UpdateMainGraphicsLayerGeometry(const IntRect& local_compositing_bounds); + void UpdateMainGraphicsLayerGeometry( + const gfx::Rect& local_compositing_bounds); void UpdateMaskLayerGeometry(); void UpdateForegroundLayerGeometry(); void UpdateDecorationOutlineLayerGeometry( - const IntSize& relative_compositing_bounds_size); + const gfx::Size& relative_compositing_bounds_size); void UpdateScrollingContentsLayerGeometry( HeapVector<Member<PaintLayer>>& layers_needing_paint_invalidation); @@ -354,7 +356,7 @@ // Also sets subpixelAccumulation on the layer. void ComputeBoundsOfOwningLayer( const PaintLayer* composited_ancestor, - IntRect& local_compositing_bounds, + gfx::Rect& local_compositing_bounds, gfx::Point& snapped_offset_from_composited_ancestor); GraphicsLayerPaintingPhase PaintingPhaseForPrimaryLayer() const; @@ -374,7 +376,7 @@ const GraphicsLayer&, PaintLayerFlags, GraphicsContext&, - const IntRect& clip) const; + const gfx::Rect& clip) const; // Computes the background clip rect for the given squashed layer, up to any // containing layer that is squashed into the same squashing layer and @@ -424,7 +426,7 @@ // Only used if the layer is using composited scrolling. Member<GraphicsLayer> scrolling_contents_layer_; - IntSize previous_scroll_container_size_; + gfx::Size previous_scroll_container_size_; // Only used if we have a mask. Member<GraphicsLayer> mask_layer_; @@ -451,7 +453,7 @@ // Only used when |non_scrolling_squashed_layers_| is not empty. This is // the backing that |non_scrolling_squashed_layers_| paint into. Member<GraphicsLayer> non_scrolling_squashing_layer_; - IntSize non_scrolling_squashing_layer_offset_from_layout_object_; + gfx::Vector2d non_scrolling_squashing_layer_offset_from_layout_object_; // Layers that are squashed into |non_scrolling_squashing_layer_|. HeapVector<Member<GraphicsLayerPaintInfo>> non_scrolling_squashed_layers_;
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_layer_property_updater.cc b/third_party/blink/renderer/core/paint/compositing/compositing_layer_property_updater.cc index aae3e06..8ad7ce7 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_layer_property_updater.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_layer_property_updater.cc
@@ -74,8 +74,7 @@ container_layer_state = fragment_data.LocalBorderBoxProperties(); graphics_layer->SetLayerState( *container_layer_state, - snapped_paint_offset + - ToGfxVector2d(graphics_layer->OffsetFromLayoutObject())); + snapped_paint_offset + graphics_layer->OffsetFromLayoutObject()); } }; SetContainerLayerState(mapping->MainGraphicsLayer()); @@ -126,8 +125,7 @@ graphics_layer->SetLayerState( scrollbar_layer_state, - snapped_paint_offset + - ToGfxVector2d(graphics_layer->OffsetFromLayoutObject())); + snapped_paint_offset + graphics_layer->OffsetFromLayoutObject()); }; SetContainerLayerStateForScrollbars(mapping->LayerForHorizontalScrollbar(), @@ -149,8 +147,7 @@ if (graphics_layer) { graphics_layer->SetLayerState( fragment_data.ContentsProperties(), - contents_paint_offset + - ToGfxVector2d(graphics_layer->OffsetFromLayoutObject())); + contents_paint_offset + graphics_layer->OffsetFromLayoutObject()); } }; SetScrollingContentsLayerState(mapping->ScrollingContentsLayer()); @@ -185,10 +182,8 @@ ? clipping_container->FirstFragment().ContentsProperties().Clip() : ClipPaintPropertyNode::Root()); squashing_layer->SetLayerState( - state, - snapped_paint_offset + - ToGfxVector2d( - mapping->NonScrollingSquashingLayerOffsetFromLayoutObject())); + state, snapped_paint_offset + + mapping->NonScrollingSquashingLayerOffsetFromLayoutObject()); } if (auto* mask_layer = mapping->MaskLayer()) { @@ -202,8 +197,7 @@ state.SetClip(*properties->MaskClip()); mask_layer->SetLayerState( - state, snapped_paint_offset + - ToGfxVector2d(mask_layer->OffsetFromLayoutObject())); + state, snapped_paint_offset + mask_layer->OffsetFromLayoutObject()); } if (object.IsSVGRoot()) {
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater.cc b/third_party/blink/renderer/core/paint/cull_rect_updater.cc index 6aadb3b2..066016d 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater.cc +++ b/third_party/blink/renderer/core/paint/cull_rect_updater.cc
@@ -89,12 +89,12 @@ bool should_proactively_update = ShouldProactivelyUpdate(layer); bool force_update_children = should_proactively_update || layer.ForcesChildrenCullRectUpdate() || + !layer.GetLayoutObject().IsStackingContext() || // |force_update_self| is true if the contents cull rect of the containing // block of |layer| changed, so we need to propagate the flag to // non-contained absolute-position descendants whose cull rects are also // affected by the containing block. - (force_update_self && layer.HasNonContainedAbsolutePositionDescendant() && - layer.GetLayoutObject().IsStackingContext()); + (force_update_self && layer.HasNonContainedAbsolutePositionDescendant()); // This defines the scope of force_proactive_update_ (which may be set by // ComputeFragmentCullRect() and ComputeFragmentContentsCullRect()) to the @@ -120,8 +120,12 @@ } } - if (force_update_children || layer.DescendantNeedsCullRectUpdate()) + if (force_update_children || layer.DescendantNeedsCullRectUpdate() || + // A change of non-stacking-context layer may affect cull rect of + // descendants even if the contents cull rect doesn't change. + !layer.GetLayoutObject().IsStackingContext()) { UpdateForDescendants(layer, force_update_children); + } layer.ClearNeedsCullRectUpdate(); } @@ -161,9 +165,9 @@ // <div id="stacked-child" style="position: relative"></div> // </div> // </div> - // If |child|'s contents cull rect changes, we need to update - // |stacked-child|'s cull rect because it's clipped by |child|. The is done in - // the following order: + // If |child| needs cull rect update, we also need to update |stacked-child|'s + // cull rect because it's clipped by |child|. The is done in the following + // order: // UpdateForDescendants(|layer|) // UpdateRecursively(|child|) (in the following loop) // |stacked-child|->SetNeedsCullRectUpdate() @@ -178,8 +182,7 @@ // In the above example, during UpdateForDescendants(child), this // forces cull rect update of |stacked-child| which will be updated in // the next loop during UpdateForDescendants(layer). - if (force_update_children) - child->SetNeedsCullRectUpdate(); + child->SetNeedsCullRectUpdate(); continue; } UpdateRecursively(*child, layer, force_update_children);
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc b/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc index 7e13cd02..6f3c856 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc +++ b/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc
@@ -21,6 +21,12 @@ CullRect GetCullRect(const char* id) { return GetLayoutObjectByElementId(id)->FirstFragment().GetCullRect(); } + + CullRect GetContentsCullRect(const char* id) { + return GetLayoutObjectByElementId(id) + ->FirstFragment() + .GetContentsCullRect(); + } }; // TODO(wangxianzhu): Move other cull rect tests from PaintLayerPainterTest @@ -75,7 +81,7 @@ TEST_F(CullRectUpdaterTest, AbsolutePositionUnderNonContainingStackingContext) { GetDocument().GetSettings()->SetPreferCompositingToLCDTextEnabled(false); SetBodyInnerHTML(R"HTML( - <div id="scroller" style="width:200px; height: 200px; overflow: auto; + <div id="scroller" style="width: 200px; height: 200px; overflow: auto; position: relative"> <div style="height: 0; overflow: hidden; opacity: 0.5; margin: 250px"> <div id="absolute" @@ -95,4 +101,45 @@ GetCullRect("absolute").Rect()); } +TEST_F(CullRectUpdaterTest, StackedChildOfNonStackingContextScroller) { + SetBodyInnerHTML(R"HTML( + <div id="scroller" style="width: 200px; height: 200px; overflow: auto; + background: white"> + <div id="child" style="height: 7000px; position: relative"></div> + </div> + )HTML"); + + auto* scroller = GetDocument().getElementById("scroller"); + + EXPECT_EQ(gfx::Rect(0, 0, 200, 4200), GetContentsCullRect("scroller").Rect()); + EXPECT_EQ(gfx::Rect(0, 0, 200, 4200), GetCullRect("child").Rect()); + + for (int i = 1000; i < 7000; i += 1000) { + scroller->scrollTo(0, i); + UpdateAllLifecyclePhasesForTest(); + } + // When scrolled to 3800, the cull rect covers the whole scrolling contents. + // Then we use this full cull rect on further scroll to avoid repaint. + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetContentsCullRect("scroller").Rect()); + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetCullRect("child").Rect()); + + // The full cull rect still applies when the scroller scrolls to the top. + scroller->scrollTo(0, 0); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetContentsCullRect("scroller").Rect()); + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetCullRect("child").Rect()); + + // When child needs repaint, it will recalculate its cull rect. + GetPaintLayerByElementId("child")->SetNeedsRepaint(); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetContentsCullRect("scroller").Rect()); + EXPECT_EQ(gfx::Rect(0, 0, 200, 4200), GetCullRect("child").Rect()); + + // Then scroll to the bottom, child should recalculate it cull rect again. + scroller->scrollTo(0, 7000); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetContentsCullRect("scroller").Rect()); + EXPECT_EQ(gfx::Rect(0, 2800, 200, 4200), GetCullRect("child").Rect()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc index 7e916d8..0e63a6e 100644 --- a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc +++ b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc
@@ -58,10 +58,10 @@ void CustomScrollbarTheme::ButtonSizesAlongTrackAxis(const Scrollbar& scrollbar, int& before_size, int& after_size) { - IntRect first_button = ButtonRect(scrollbar, kBackButtonStartPart); - IntRect second_button = ButtonRect(scrollbar, kForwardButtonStartPart); - IntRect third_button = ButtonRect(scrollbar, kBackButtonEndPart); - IntRect fourth_button = ButtonRect(scrollbar, kForwardButtonEndPart); + gfx::Rect first_button = ButtonRect(scrollbar, kBackButtonStartPart); + gfx::Rect second_button = ButtonRect(scrollbar, kForwardButtonStartPart); + gfx::Rect third_button = ButtonRect(scrollbar, kBackButtonEndPart); + gfx::Rect fourth_button = ButtonRect(scrollbar, kForwardButtonEndPart); if (scrollbar.Orientation() == kHorizontalScrollbar) { before_size = first_button.width() + second_button.width(); after_size = third_button.width() + fourth_button.width(); @@ -88,20 +88,20 @@ return To<CustomScrollbar>(scrollbar).MinimumThumbLength(); } -IntRect CustomScrollbarTheme::ButtonRect(const Scrollbar& scrollbar, - ScrollbarPart part_type) { +gfx::Rect CustomScrollbarTheme::ButtonRect(const Scrollbar& scrollbar, + ScrollbarPart part_type) { return To<CustomScrollbar>(scrollbar).ButtonRect(part_type); } -IntRect CustomScrollbarTheme::BackButtonRect(const Scrollbar& scrollbar) { +gfx::Rect CustomScrollbarTheme::BackButtonRect(const Scrollbar& scrollbar) { return ButtonRect(scrollbar, kBackButtonStartPart); } -IntRect CustomScrollbarTheme::ForwardButtonRect(const Scrollbar& scrollbar) { +gfx::Rect CustomScrollbarTheme::ForwardButtonRect(const Scrollbar& scrollbar) { return ButtonRect(scrollbar, kForwardButtonEndPart); } -IntRect CustomScrollbarTheme::TrackRect(const Scrollbar& scrollbar) { +gfx::Rect CustomScrollbarTheme::TrackRect(const Scrollbar& scrollbar) { if (!HasButtons(scrollbar)) return scrollbar.FrameRect(); @@ -112,15 +112,16 @@ return To<CustomScrollbar>(scrollbar).TrackRect(start_length, end_length); } -IntRect CustomScrollbarTheme::ConstrainTrackRectToTrackPieces( +gfx::Rect CustomScrollbarTheme::ConstrainTrackRectToTrackPieces( const Scrollbar& scrollbar, - const IntRect& rect) { - IntRect back_rect = To<CustomScrollbar>(scrollbar).TrackPieceRectWithMargins( - kBackTrackPart, rect); - IntRect forward_rect = + const gfx::Rect& rect) { + gfx::Rect back_rect = + To<CustomScrollbar>(scrollbar).TrackPieceRectWithMargins(kBackTrackPart, + rect); + gfx::Rect forward_rect = To<CustomScrollbar>(scrollbar).TrackPieceRectWithMargins( kForwardTrackPart, rect); - IntRect result = rect; + gfx::Rect result = rect; if (scrollbar.Orientation() == kHorizontalScrollbar) { result.set_x(back_rect.x()); result.set_width(forward_rect.right() - back_rect.x()); @@ -135,14 +136,14 @@ GraphicsContext& context, const Scrollbar* vertical_scrollbar, const DisplayItemClient& display_item_client, - const IntRect& corner_rect, + const gfx::Rect& corner_rect, mojom::blink::ColorScheme color_scheme) { if (DrawingRecorder::UseCachedDrawingIfPossible(context, display_item_client, DisplayItem::kScrollCorner)) return; DrawingRecorder recorder(context, display_item_client, - DisplayItem::kScrollCorner, ToGfxRect(corner_rect)); + DisplayItem::kScrollCorner, corner_rect); // FIXME: Implement. context.FillRect(corner_rect, Color::kWhite, AutoDarkMode::Disabled()); } @@ -170,13 +171,13 @@ kForwardButtonEndPart); } - IntRect track_rect = TrackRect(scrollbar); + gfx::Rect track_rect = TrackRect(scrollbar); PaintPart(context, scrollbar, track_rect, kTrackBGPart); if (HasThumb(scrollbar)) { - IntRect start_track_rect; - IntRect thumb_rect; - IntRect end_track_rect; + gfx::Rect start_track_rect; + gfx::Rect thumb_rect; + gfx::Rect end_track_rect; SplitTrack(scrollbar, track_rect, start_track_rect, thumb_rect, end_track_rect); PaintPart(context, scrollbar, start_track_rect, kBackTrackPart); @@ -186,20 +187,20 @@ void CustomScrollbarTheme::PaintButton(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect, + const gfx::Rect& rect, ScrollbarPart part) { PaintPart(context, scrollbar, rect, part); } void CustomScrollbarTheme::PaintThumb(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { PaintPart(context, scrollbar, rect, kThumbPart); } void CustomScrollbarTheme::PaintTickmarks(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { GetTheme().PaintTickmarks(context, scrollbar, rect); } @@ -207,16 +208,16 @@ const LayoutCustomScrollbarPart& layout_custom_scrollbar_part, GraphicsContext& graphics_context, const PhysicalRect& rect) { - PaintInfo paint_info( - graphics_context, CullRect(ToGfxRect(PixelSnappedIntRect(rect))), - PaintPhase::kForeground, kGlobalPaintNormalPhase, kPaintLayerNoFlag); + PaintInfo paint_info(graphics_context, CullRect(ToPixelSnappedRect(rect)), + PaintPhase::kForeground, kGlobalPaintNormalPhase, + kPaintLayerNoFlag); ObjectPainter(layout_custom_scrollbar_part) .PaintAllPhasesAtomically(paint_info); } void CustomScrollbarTheme::PaintPart(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect, + const gfx::Rect& rect, ScrollbarPart part) { const auto& custom_scrollbar = To<CustomScrollbar>(scrollbar); const auto* part_layout_object = custom_scrollbar.GetPart(part);
diff --git a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.h b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.h index f718602..d2b014b 100644 --- a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.h +++ b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.h
@@ -50,7 +50,7 @@ void PaintScrollCorner(GraphicsContext&, const Scrollbar* vertical_scrollbar, const DisplayItemClient&, - const IntRect& corner_rect, + const gfx::Rect& corner_rect, mojom::blink::ColorScheme color_scheme) override; bool ShouldCenterOnThumb(const Scrollbar& scrollbar, @@ -91,36 +91,40 @@ bool HasButtons(const Scrollbar&) override; bool HasThumb(const Scrollbar&) override; - IntRect BackButtonRect(const Scrollbar&) override; - IntRect ForwardButtonRect(const Scrollbar&) override; - IntRect TrackRect(const Scrollbar&) override; + gfx::Rect BackButtonRect(const Scrollbar&) override; + gfx::Rect ForwardButtonRect(const Scrollbar&) override; + gfx::Rect TrackRect(const Scrollbar&) override; void PaintTrackAndButtons(GraphicsContext&, const Scrollbar&, const gfx::Vector2d&) override; void PaintButton(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, ScrollbarPart) override; - void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintThumb(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; void PaintTickmarks(GraphicsContext&, const Scrollbar&, - const IntRect&) override; + const gfx::Rect&) override; - IntRect ConstrainTrackRectToTrackPieces(const Scrollbar&, - const IntRect&) override; + gfx::Rect ConstrainTrackRectToTrackPieces(const Scrollbar&, + const gfx::Rect&) override; private: - IntRect ButtonRect(const Scrollbar&, ScrollbarPart); + gfx::Rect ButtonRect(const Scrollbar&, ScrollbarPart); void PaintScrollbarBackground(GraphicsContext&, const Scrollbar&); - void PaintTrackBackground(GraphicsContext&, const Scrollbar&, const IntRect&); + void PaintTrackBackground(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&); void PaintTrackPiece(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, ScrollbarPart); void PaintPart(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, ScrollbarPart); };
diff --git a/third_party/blink/renderer/core/paint/document_marker_painter.cc b/third_party/blink/renderer/core/paint/document_marker_painter.cc index 30623b2..78f3f9f 100644 --- a/third_party/blink/renderer/core/paint/document_marker_painter.cc +++ b/third_party/blink/renderer/core/paint/document_marker_painter.cc
@@ -139,7 +139,7 @@ const StyleableMarker& marker, const ComputedStyle& style, const Document& document, - const FloatRect& marker_rect, + const gfx::RectF& marker_rect, LayoutUnit logical_height, bool in_dark_mode) { // start of line to draw, relative to box_origin.X()
diff --git a/third_party/blink/renderer/core/paint/document_marker_painter.h b/third_party/blink/renderer/core/paint/document_marker_painter.h index 264b2a0..f3b8365 100644 --- a/third_party/blink/renderer/core/paint/document_marker_painter.h +++ b/third_party/blink/renderer/core/paint/document_marker_painter.h
@@ -9,11 +9,14 @@ #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class RectF; +} + namespace blink { class ComputedStyle; class Document; -class FloatRect; class GraphicsContext; class LayoutUnit; class Node; @@ -35,7 +38,7 @@ const StyleableMarker& marker, const ComputedStyle& style, const Document& document, - const FloatRect& marker_rect, + const gfx::RectF& marker_rect, LayoutUnit logical_height, bool in_dark_mode); static void PaintDocumentMarker(
diff --git a/third_party/blink/renderer/core/paint/fieldset_painter.cc b/third_party/blink/renderer/core/paint/fieldset_painter.cc index 23d6667e..cc2fad2 100644 --- a/third_party/blink/renderer/core/paint/fieldset_painter.cc +++ b/third_party/blink/renderer/core/paint/fieldset_painter.cc
@@ -83,7 +83,7 @@ PhysicalRect legend_cutout_rect = fieldset_paint_info.legend_cutout_rect; legend_cutout_rect.Move(paint_offset); - graphics_context.ClipOut(PixelSnappedIntRect(legend_cutout_rect)); + graphics_context.ClipOut(ToPixelSnappedRect(legend_cutout_rect)); Node* node = nullptr; const LayoutObject* layout_object = &layout_fieldset_;
diff --git a/third_party/blink/renderer/core/paint/frame_set_painter.cc b/third_party/blink/renderer/core/paint/frame_set_painter.cc index 72870802..1415cfc 100644 --- a/third_party/blink/renderer/core/paint/frame_set_painter.cc +++ b/third_party/blink/renderer/core/paint/frame_set_painter.cc
@@ -28,8 +28,8 @@ } void FrameSetPainter::PaintColumnBorder(const PaintInfo& paint_info, - const IntRect& border_rect) { - if (!paint_info.GetCullRect().Intersects(ToGfxRect(border_rect))) + const gfx::Rect& border_rect) { + if (!paint_info.GetCullRect().Intersects(border_rect)) return; // FIXME: We should do something clever when borders from distinct framesets @@ -51,17 +51,17 @@ // with a little bit of the fill color showing through. if (border_rect.width() >= 3) { context.FillRect( - IntRect(border_rect.origin(), IntSize(1, border_rect.height())), + gfx::Rect(border_rect.origin(), gfx::Size(1, border_rect.height())), BorderStartEdgeColor(), auto_dark_mode); context.FillRect( - IntRect(gfx::Point(border_rect.right() - 1, border_rect.y()), - IntSize(1, border_rect.height())), + gfx::Rect(gfx::Point(border_rect.right() - 1, border_rect.y()), + gfx::Size(1, border_rect.height())), BorderEndEdgeColor(), auto_dark_mode); } } void FrameSetPainter::PaintRowBorder(const PaintInfo& paint_info, - const IntRect& border_rect) { + const gfx::Rect& border_rect) { // FIXME: We should do something clever when borders from distinct framesets // meet at a join. @@ -81,11 +81,11 @@ // with a little bit of the fill color showing through. if (border_rect.height() >= 3) { context.FillRect( - IntRect(border_rect.origin(), IntSize(border_rect.width(), 1)), + gfx::Rect(border_rect.origin(), gfx::Size(border_rect.width(), 1)), BorderStartEdgeColor(), auto_dark_mode); context.FillRect( - IntRect(gfx::Point(border_rect.x(), border_rect.bottom() - 1), - IntSize(border_rect.width(), 1)), + gfx::Rect(gfx::Point(border_rect.x(), border_rect.bottom() - 1), + gfx::Size(border_rect.width(), 1)), BorderEndEdgeColor(), auto_dark_mode); } } @@ -120,7 +120,7 @@ if (ShouldPaintBorderAfter(layout_frame_set_.Columns(), c)) { PaintColumnBorder( paint_info, - PixelSnappedIntRect(PhysicalRect( + ToPixelSnappedRect(PhysicalRect( paint_offset.left + x_pos, paint_offset.top + y_pos, border_thickness, layout_frame_set_.Size().Height() - y_pos))); x_pos += border_thickness; @@ -132,7 +132,7 @@ y_pos += layout_frame_set_.Rows().sizes_[r]; if (ShouldPaintBorderAfter(layout_frame_set_.Rows(), r)) { PaintRowBorder(paint_info, - PixelSnappedIntRect(PhysicalRect( + ToPixelSnappedRect(PhysicalRect( paint_offset.left, paint_offset.top + y_pos, layout_frame_set_.Size().Width(), border_thickness))); y_pos += border_thickness;
diff --git a/third_party/blink/renderer/core/paint/frame_set_painter.h b/third_party/blink/renderer/core/paint/frame_set_painter.h index 051a1992..e45dfe6 100644 --- a/third_party/blink/renderer/core/paint/frame_set_painter.h +++ b/third_party/blink/renderer/core/paint/frame_set_painter.h
@@ -7,9 +7,12 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class Rect; +} + namespace blink { -class IntRect; class LayoutFrameSet; struct PaintInfo; struct PhysicalOffset; @@ -26,8 +29,8 @@ private: void PaintBorders(const PaintInfo&, const PhysicalOffset& paint_offset); void PaintChildren(const PaintInfo&); - void PaintRowBorder(const PaintInfo&, const IntRect&); - void PaintColumnBorder(const PaintInfo&, const IntRect&); + void PaintRowBorder(const PaintInfo&, const gfx::Rect&); + void PaintColumnBorder(const PaintInfo&, const gfx::Rect&); const LayoutFrameSet& layout_frame_set_; };
diff --git a/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc b/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc index 3f66f8ce..c91cb74 100644 --- a/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc +++ b/third_party/blink/renderer/core/paint/html_canvas_painter_test.cc
@@ -52,7 +52,7 @@ } std::unique_ptr<Canvas2DLayerBridge> MakeCanvas2DLayerBridge( - const IntSize& size) { + const gfx::Size& size) { return std::make_unique<Canvas2DLayerBridge>(size, RasterMode::kGPU, kNonOpaque); } @@ -71,7 +71,7 @@ attributes.alpha = true; CanvasRenderingContext* context = element->GetCanvasRenderingContext("2d", attributes); - IntSize size(300, 200); + gfx::Size size(300, 200); std::unique_ptr<Canvas2DLayerBridge> bridge = MakeCanvas2DLayerBridge(size); element->SetResourceProviderForTesting(nullptr, std::move(bridge), size); ASSERT_EQ(context, element->RenderingContext());
diff --git a/third_party/blink/renderer/core/paint/image_element_timing.cc b/third_party/blink/renderer/core/paint/image_element_timing.cc index c5331d31..048fb7d5c2 100644 --- a/third_party/blink/renderer/core/paint/image_element_timing.cc +++ b/third_party/blink/renderer/core/paint/image_element_timing.cc
@@ -163,8 +163,7 @@ performance->AddElementTiming( ImagePaintString(), url.GetString(), intersection_rect, base::TimeTicks(), load_time, attr, - ToGfxSize(cached_image.IntrinsicSize(respect_orientation)), id, - element); + cached_image.IntrinsicSize(respect_orientation), id, element); } return; } @@ -179,7 +178,7 @@ : url.GetString(); element_timings_.emplace_back(MakeGarbageCollected<ElementTimingInfo>( image_url, intersection_rect, load_time, attr, - ToGfxSize(cached_image.IntrinsicSize(respect_orientation)), id, element)); + cached_image.IntrinsicSize(respect_orientation), id, element)); // Only queue a presentation promise when |element_timings_| was empty. All of // the records in |element_timings_| will be processed when the promise // succeeds or fails, and at that time the vector is cleared.
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc index 7084754..5a18e1e 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc
@@ -374,10 +374,10 @@ // (aka the main frame viewport) for all frames, including iframes. This // prevents us from discarding images with size equal to the size of its // embedding iframe. - gfx::Rect viewport_int_rect = ToGfxRect( + gfx::Rect viewport_int_rect = uses_page_viewport_ ? frame_view_->GetPage()->GetVisualViewport().VisibleContentRect() - : frame_view_->GetScrollableArea()->VisibleContentRect()); + : frame_view_->GetScrollableArea()->VisibleContentRect(); gfx::RectF viewport = frame_view_->GetPaintTimingDetector().BlinkSpaceToDIPs( gfx::RectF(viewport_int_rect));
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc index 1097185..22f8fe7 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc
@@ -98,7 +98,7 @@ return *performance; } - IntRect GetViewportRect(LocalFrameView& view) { + gfx::Rect GetViewportRect(LocalFrameView& view) { ScrollableArea* scrollable_area = view.GetScrollableArea(); DCHECK(scrollable_area); return scrollable_area->VisibleContentRect();
diff --git a/third_party/blink/renderer/core/paint/image_painter.cc b/third_party/blink/renderer/core/paint/image_painter.cc index bb9c0901c..4421afcf 100644 --- a/third_party/blink/renderer/core/paint/image_painter.cc +++ b/third_party/blink/renderer/core/paint/image_painter.cc
@@ -49,7 +49,7 @@ return false; DoubleSize layout_size(layout_image.ContentSize()); - IntSize image_size = image->Size(); + gfx::Size image_size = image->Size(); if (layout_size.IsEmpty() || image_size.IsEmpty()) return false; @@ -129,7 +129,7 @@ paint_info.context.Save(); PhysicalRect focus_rect = layout_image_.PhysicalContentBoxRect(); focus_rect.Move(paint_offset); - paint_info.context.Clip(PixelSnappedIntRect(focus_rect)); + paint_info.context.Clip(ToPixelSnappedRect(focus_rect)); OutlinePainter::PaintFocusRingPath(paint_info.context, path, *area_element_style); paint_info.context.Restore(); @@ -169,7 +169,7 @@ if (!has_image) { // Draw an outline rect where the image should be. - IntRect paint_rect = PixelSnappedIntRect(content_rect); + gfx::Rect paint_rect = ToPixelSnappedRect(content_rect); BoxDrawingRecorder recorder(context, layout_image_, paint_info.phase, paint_offset); context.SetStrokeStyle(kSolidStroke); @@ -198,12 +198,12 @@ return; // FIXME: should we just ASSERT these conditions? (audit all // callers). - IntRect pixel_snapped_dest_rect = PixelSnappedIntRect(dest_rect); + gfx::Rect pixel_snapped_dest_rect = ToPixelSnappedRect(dest_rect); if (pixel_snapped_dest_rect.IsEmpty()) return; scoped_refptr<Image> image = - image_resource.GetImage(FloatSize(dest_rect.size)); + image_resource.GetImage(gfx::SizeF(dest_rect.size)); if (!image || image->IsNull()) return; @@ -212,17 +212,17 @@ auto respect_orientation = image->HasDefaultOrientation() ? kDoNotRespectImageOrientation : image_resource.ImageOrientation(); - FloatRect src_rect(gfx::PointF(), image->SizeAsFloat(respect_orientation)); + gfx::RectF src_rect(image->SizeAsFloat(respect_orientation)); // If the content rect requires clipping, adjust |srcRect| and // |pixelSnappedDestRect| over using a clip. if (!content_rect.Contains(dest_rect)) { - IntRect pixel_snapped_content_rect = PixelSnappedIntRect(content_rect); + gfx::Rect pixel_snapped_content_rect = ToPixelSnappedRect(content_rect); pixel_snapped_content_rect.Intersect(pixel_snapped_dest_rect); if (pixel_snapped_content_rect.IsEmpty()) return; - src_rect = MapRect(FloatRect(pixel_snapped_content_rect), - FloatRect(pixel_snapped_dest_rect), src_rect); + src_rect = gfx::MapRect(gfx::RectF(pixel_snapped_content_rect), + gfx::RectF(pixel_snapped_dest_rect), src_rect); pixel_snapped_dest_rect = pixel_snapped_content_rect; } @@ -236,7 +236,7 @@ DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES( TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, layout_image_, src_rect, - FloatRect(dest_rect)); + gfx::RectF(dest_rect)); ScopedInterpolationQuality interpolation_quality_scope( context, layout_image_.StyleRef().GetInterpolationQuality()); @@ -266,7 +266,7 @@ context.DrawImage(image.get(), decode_mode, PaintAutoDarkMode(layout_image_.StyleRef(), DarkModeFilter::ElementRole::kBackground), - FloatRect(pixel_snapped_dest_rect), &src_rect, + gfx::RectF(pixel_snapped_dest_rect), &src_rect, SkBlendMode::kSrcOver, respect_orientation); if (ImageResourceContent* image_content = image_resource.CachedImage()) { @@ -277,12 +277,12 @@ ImageElementTiming::From(*window).NotifyImagePainted( layout_image_, *image_content, context.GetPaintController().CurrentPaintChunkProperties(), - ToGfxRect(pixel_snapped_dest_rect)); + pixel_snapped_dest_rect); } PaintTimingDetector::NotifyImagePaint( - layout_image_, ToGfxSize(image->Size()), *image_content, + layout_image_, image->Size(), *image_content, context.GetPaintController().CurrentPaintChunkProperties(), - ToGfxRect(pixel_snapped_dest_rect)); + pixel_snapped_dest_rect); } }
diff --git a/third_party/blink/renderer/core/paint/inline_box_painter_base.cc b/third_party/blink/renderer/core/paint/inline_box_painter_base.cc index f389fe7..62f08c6 100644 --- a/third_party/blink/renderer/core/paint/inline_box_painter_base.cc +++ b/third_party/blink/renderer/core/paint/inline_box_painter_base.cc
@@ -55,7 +55,7 @@ PaintInsetBoxShadow(paint_info, line_style_, adjusted_frame_rect); - IntRect adjusted_clip_rect; + gfx::Rect adjusted_clip_rect; BorderPaintingType border_painting_type = GetBorderPaintType( adjusted_frame_rect, adjusted_clip_rect, object_has_multiple_boxes); switch (border_painting_type) { @@ -122,7 +122,7 @@ multi_line ? PaintRectForImageStrip(paint_rect, style_.Direction()) : paint_rect; GraphicsContextStateSaver state_saver(paint_info.context); - paint_info.context.Clip(PixelSnappedIntRect(paint_rect)); + paint_info.context.Clip(ToPixelSnappedRect(paint_rect)); box_painter.PaintFillLayer(paint_info, c, fill_layer, rect, kBackgroundBleedNone, geometry, multi_line, paint_rect.size); @@ -158,7 +158,7 @@ // obviously not right, but it isn't even clear how this should work at all. mask_image_paint_rect = PaintRectForImageStrip(paint_rect, TextDirection::kLtr); - FloatRect clip_rect(ClipRectForNinePieceImageStrip( + gfx::RectF clip_rect(ClipRectForNinePieceImageStrip( style_, sides_to_include, mask_nine_piece_image, paint_rect)); // TODO(chrishtr): this should be pixel-snapped. paint_info.context.Clip(clip_rect);
diff --git a/third_party/blink/renderer/core/paint/inline_box_painter_base.h b/third_party/blink/renderer/core/paint/inline_box_painter_base.h index c8df0ca..d413ba56 100644 --- a/third_party/blink/renderer/core/paint/inline_box_painter_base.h +++ b/third_party/blink/renderer/core/paint/inline_box_painter_base.h
@@ -12,12 +12,15 @@ #include "third_party/blink/renderer/platform/text/text_direction.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class Rect; +} + namespace blink { class Color; class ComputedStyle; class FillLayer; -class IntRect; class NinePieceImage; struct PaintInfo; struct PhysicalOffset; @@ -92,7 +95,7 @@ }; virtual BorderPaintingType GetBorderPaintType( const PhysicalRect& adjusted_frame_rect, - IntRect& adjusted_clip_rect, + gfx::Rect& adjusted_clip_rect, bool object_has_multiple_boxes) const = 0; const ImageResourceObserver& image_observer_;
diff --git a/third_party/blink/renderer/core/paint/inline_flow_box_painter.cc b/third_party/blink/renderer/core/paint/inline_flow_box_painter.cc index 001cdeb..b3440e91 100644 --- a/third_party/blink/renderer/core/paint/inline_flow_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_flow_box_painter.cc
@@ -121,9 +121,9 @@ InlineBoxPainterBase::BorderPaintingType InlineFlowBoxPainter::GetBorderPaintType( const PhysicalRect& adjusted_frame_rect, - IntRect& adjusted_clip_rect, + gfx::Rect& adjusted_clip_rect, bool object_has_multiple_boxes) const { - adjusted_clip_rect = PixelSnappedIntRect(adjusted_frame_rect); + adjusted_clip_rect = ToPixelSnappedRect(adjusted_frame_rect); if (!inline_flow_box_.Parent() || !style_.HasBorderDecoration()) return kDontPaintBorders; const NinePieceImage& border_image = style_.BorderImage(); @@ -140,7 +140,7 @@ return kPaintBordersWithoutClip; // We have a border image that spans multiple lines. - adjusted_clip_rect = PixelSnappedIntRect( + adjusted_clip_rect = ToPixelSnappedRect( ClipRectForNinePieceImageStrip(style_, inline_flow_box_.SidesToInclude(), border_image, adjusted_frame_rect)); return kPaintBordersWithClip;
diff --git a/third_party/blink/renderer/core/paint/inline_flow_box_painter.h b/third_party/blink/renderer/core/paint/inline_flow_box_painter.h index 34db50f..e262f1b6 100644 --- a/third_party/blink/renderer/core/paint/inline_flow_box_painter.h +++ b/third_party/blink/renderer/core/paint/inline_flow_box_painter.h
@@ -49,7 +49,7 @@ const PhysicalRect& rect) override; BorderPaintingType GetBorderPaintType( const PhysicalRect& adjusted_frame_rect, - IntRect& adjusted_clip_rect, + gfx::Rect& adjusted_clip_rect, bool object_has_multiple_boxes) const override; void PaintBackgroundBorderShadow(const PaintInfo&,
diff --git a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc index fe5f251..a6492b3d 100644 --- a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc
@@ -476,7 +476,7 @@ // the original style. { GraphicsContextStateSaver inner_state_saver(context); - context.ClipOut(FloatRect(selection_rect)); + context.ClipOut(gfx::RectF(selection_rect)); text_painter.Paint(selection_start, selection_end, length, text_style, node_id, auto_dark_mode); } @@ -484,7 +484,7 @@ // the selection style. { GraphicsContextStateSaver inner_state_saver(context); - context.Clip(FloatRect(selection_rect)); + context.Clip(gfx::RectF(selection_rect)); text_painter.Paint(selection_start, selection_end, length, selection_style, node_id, auto_dark_mode); } @@ -727,7 +727,7 @@ TextRun run = inline_text_box_.ConstructTextRun(style); // FIXME: Convert the document markers to float rects. - IntRect marker_rect = EnclosingIntRect( + gfx::Rect marker_rect = gfx::ToEnclosingRect( font.SelectionRectForText(run, gfx::PointF(start_point), sel_height, marker_offsets.start, marker_offsets.end)); start = marker_rect.x() - start_point.left; @@ -862,7 +862,7 @@ GraphicsContextStateSaver state_saver(context); context.FillRect( - FloatRect(selection_rect), c, + gfx::RectF(selection_rect), c, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kForeground)); return selection_rect; } @@ -890,7 +890,7 @@ const PaintOffsets marker_offsets = MarkerPaintStartAndEnd(marker); const TextRun& run = inline_text_box_.ConstructTextRun(style); // Pass 0 for height since we only care about the width - const FloatRect& marker_rect = font.SelectionRectForText( + const gfx::RectF& marker_rect = font.SelectionRectForText( run, gfx::PointF(), 0, marker_offsets.start, marker_offsets.end); DocumentMarkerPainter::PaintStyleableMarkerUnderline( context, box_origin, marker, style, @@ -986,7 +986,7 @@ PhysicalRect box_rect(box_origin, PhysicalSize(inline_text_box_.LogicalWidth(), inline_text_box_.LogicalHeight())); - context.Clip(FloatRect(box_rect)); + context.Clip(gfx::RectF(box_rect)); context.DrawHighlightForText( font, run, gfx::PointF(box_origin), box_rect.Height().ToInt(), color, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kForeground),
diff --git a/third_party/blink/renderer/core/paint/line_box_list_painter.cc b/third_party/blink/renderer/core/paint/line_box_list_painter.cc index 8ea7812..a9834098 100644 --- a/third_party/blink/renderer/core/paint/line_box_list_painter.cc +++ b/third_party/blink/renderer/core/paint/line_box_list_painter.cc
@@ -173,7 +173,7 @@ layout_object.GetDocument().GetStyleEngine().ForcedBackgroundColor(); for (const auto backplate : backplates) { paint_info.context.FillRect( - FloatRect(backplate), backplate_color, + gfx::RectF(backplate), backplate_color, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } }
diff --git a/third_party/blink/renderer/core/paint/list_marker_painter.cc b/third_party/blink/renderer/core/paint/list_marker_painter.cc index d325794..6694c61 100644 --- a/third_party/blink/renderer/core/paint/list_marker_painter.cc +++ b/third_party/blink/renderer/core/paint/list_marker_painter.cc
@@ -98,14 +98,14 @@ context.SetStrokeColor(color); context.SetStrokeStyle(kSolidStroke); context.SetStrokeThickness(1.0f); - IntRect snapped_rect = PixelSnappedIntRect(marker); + gfx::Rect snapped_rect = ToPixelSnappedRect(marker); const AtomicString& type = style.ListStyleType()->GetCounterStyleName(); AutoDarkMode auto_dark_mode( PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kListSymbol)); if (type == "disc") { - context.FillEllipse(FloatRect(snapped_rect), auto_dark_mode); + context.FillEllipse(gfx::RectF(snapped_rect), auto_dark_mode); } else if (type == "circle") { - context.StrokeEllipse(FloatRect(snapped_rect), auto_dark_mode); + context.StrokeEllipse(gfx::RectF(snapped_rect), auto_dark_mode); } else if (type == "square") { context.FillRect(snapped_rect, color, auto_dark_mode); } else if (type == "disclosure-open" || type == "disclosure-closed") { @@ -158,9 +158,10 @@ context.DrawImage( layout_list_marker_.GetImage() ->GetImage(layout_list_marker_, layout_list_marker_.GetDocument(), - layout_list_marker_.StyleRef(), FloatSize(marker.Size())) + layout_list_marker_.StyleRef(), + gfx::SizeF(marker.Size())) .get(), - Image::kSyncDecode, auto_dark_mode, FloatRect(marker)); + Image::kSyncDecode, auto_dark_mode, gfx::RectF(marker)); return; }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 6a2b393..70e81e0 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -1018,9 +1018,8 @@ background_client = &layout_box.GetScrollableArea() ->GetScrollingBackgroundDisplayItemClient(); - visual_rect = - ToGfxRect(layout_box.GetScrollableArea()->ScrollingBackgroundVisualRect( - paint_offset)); + visual_rect = layout_box.GetScrollableArea()->ScrollingBackgroundVisualRect( + paint_offset); } else { paint_rect.offset = paint_offset; paint_rect.size = box_fragment_.Size(); @@ -1036,7 +1035,7 @@ PaintBoxDecorationBackgroundWithRect( contents_paint_state ? contents_paint_state->GetPaintInfo() : paint_info, - IntRect(visual_rect), paint_rect, *background_client); + visual_rect, paint_rect, *background_client); } if (ShouldRecordHitTestData(paint_info)) { @@ -1077,7 +1076,7 @@ void NGBoxFragmentPainter::PaintBoxDecorationBackgroundWithRect( const PaintInfo& paint_info, - const IntRect& visual_rect, + const gfx::Rect& visual_rect, const PhysicalRect& paint_rect, const DisplayItemClient& background_client) { BoxDecorationData box_decoration_data(paint_info, box_fragment_); @@ -1100,8 +1099,7 @@ return; DrawingRecorder recorder(paint_info.context, background_client, - DisplayItem::kBoxDecorationBackground, - ToGfxRect(visual_rect)); + DisplayItem::kBoxDecorationBackground, visual_rect); if (PhysicalFragment().IsFieldsetContainer()) { NGFieldsetPainter(box_fragment_) @@ -1164,7 +1162,7 @@ PhysicalRect clip_rect = paint_rect; clip_rect.Expand(layout_box.BorderInsets()); state_saver.Save(); - paint_info.context.Clip(PixelSnappedIntRect(clip_rect)); + paint_info.context.Clip(ToPixelSnappedRect(clip_rect)); } else if (BleedAvoidanceIsClipping( box_decoration_data.GetBackgroundBleedAvoidance())) { state_saver.Save(); @@ -1181,7 +1179,7 @@ } } - IntRect snapped_paint_rect(PixelSnappedIntRect(paint_rect)); + gfx::Rect snapped_paint_rect = ToPixelSnappedRect(paint_rect); ThemePainter& theme_painter = LayoutTheme::GetTheme().Painter(); bool theme_painted = box_decoration_data.HasAppearance() && @@ -1634,10 +1632,10 @@ const auto& backplates = BuildBackplate(line_boxes, paint_offset); DrawingRecorder recorder(paint_info.context, GetDisplayItemClient(), DisplayItem::kForcedColorsModeBackplate, - ToGfxRect(EnclosingIntRect(UnionRect(backplates)))); + ToEnclosingRect(UnionRect(backplates))); for (const auto backplate : backplates) { paint_info.context.FillRect( - FloatRect(backplate), backplate_color, + gfx::RectF(backplate), backplate_color, PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } } @@ -1778,10 +1776,10 @@ } void NGBoxFragmentPainter::PaintTextClipMask(const PaintInfo& paint_info, - const IntRect& mask_rect, + const gfx::Rect& mask_rect, const PhysicalOffset& paint_offset, bool object_has_multiple_boxes) { - PaintInfo mask_paint_info(paint_info.context, CullRect(ToGfxRect(mask_rect)), + PaintInfo mask_paint_info(paint_info.context, CullRect(mask_rect), PaintPhase::kTextClip, kGlobalPaintNormalPhase, 0); mask_paint_info.SetFragmentID(paint_info.FragmentID()); if (!object_has_multiple_boxes) { @@ -1827,7 +1825,7 @@ // Clip to the overflow area. if (info.is_clipped_with_local_scrolling && !IsPaintingBackgroundInContentsSpace(paint_info)) { - context.Clip(FloatRect(physical.OverflowClipRect(rect.offset))); + context.Clip(gfx::RectF(physical.OverflowClipRect(rect.offset))); // Adjust the paint rect to reflect a scrolled content box with borders at // the ends.
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h index 0a32869..6bdfef76 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h
@@ -83,7 +83,7 @@ bool IsPaintingBackgroundInContentsSpace(const PaintInfo&) const override; void PaintTextClipMask(const PaintInfo&, - const IntRect& mask_rect, + const gfx::Rect& mask_rect, const PhysicalOffset& paint_offset, bool object_has_multiple_boxes) override; void PaintTextClipMask(const PaintInfo& paint_info, @@ -111,7 +111,7 @@ // shadows and border image outsets. |paint_rect| is the border box rect in // paint coordinates. void PaintBoxDecorationBackgroundWithRect(const PaintInfo&, - const IntRect& visual_rect, + const gfx::Rect& visual_rect, const PhysicalRect& paint_rect, const DisplayItemClient&);
diff --git a/third_party/blink/renderer/core/paint/ng/ng_fieldset_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_fieldset_painter.cc index 3fa39ac..a3fccb6a 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_fieldset_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_fieldset_painter.cc
@@ -118,7 +118,7 @@ // normal. PhysicalRect legend_cutout_rect = fieldset_paint_info.legend_cutout_rect; legend_cutout_rect.Move(paint_rect.offset); - graphics_context.ClipOut(PixelSnappedIntRect(legend_cutout_rect)); + graphics_context.ClipOut(ToPixelSnappedRect(legend_cutout_rect)); const LayoutObject* layout_object = fieldset_.GetLayoutObject(); Node* node = layout_object->GeneratingNode();
diff --git a/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc index ee323eec..9082726 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc
@@ -51,7 +51,7 @@ auto outline_rects = fragment.GetLayoutObject()->OutlineRects( paint_offset, NGOutlineType::kIncludeBlockVisualOverflow); - IntRect rect = PixelSnappedIntRect(UnionRect(outline_rects)); + gfx::Rect rect = ToPixelSnappedRect(UnionRect(outline_rects)); if (rect.IsEmpty()) return;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc index e80720a..5b91fb2 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc
@@ -93,7 +93,7 @@ return; if (rect.size.IsEmpty()) return; - const IntRect pixel_snapped_rect = PixelSnappedIntRect(rect); + const gfx::Rect pixel_snapped_rect = ToPixelSnappedRect(rect); if (!pixel_snapped_rect.IsEmpty()) context.FillRect(pixel_snapped_rect, color, auto_dark_mode); } @@ -385,7 +385,7 @@ DocumentMarkerPainter::PaintStyleableMarkerUnderline( paint_info_.context, box_origin_, styleable_marker, style_, node_->GetDocument(), - FloatRect(MarkerRectForForeground( + gfx::RectF(MarkerRectForForeground( fragment_item_, text, paint_start_offset, paint_end_offset)), LayoutUnit(font_data->GetFontMetrics().Height()), fragment_item_.GetNode()->GetDocument().InDarkMode());
diff --git a/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.cc index bdd233b..0aebb9d 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.cc
@@ -240,7 +240,7 @@ InlineBoxPainterBase::BorderPaintingType NGInlineBoxFragmentPainterBase::GetBorderPaintType( const PhysicalRect& adjusted_frame_rect, - IntRect& adjusted_clip_rect, + gfx::Rect& adjusted_clip_rect, bool object_has_multiple_boxes) const { const ComputedStyle& style = inline_box_fragment_.Style(); if (!style.HasBorderDecoration()) @@ -257,12 +257,12 @@ // only box for this object. In those cases only a single call to draw is // required. if (!has_border_image || !object_has_multiple_boxes) { - adjusted_clip_rect = PixelSnappedIntRect(adjusted_frame_rect); + adjusted_clip_rect = ToPixelSnappedRect(adjusted_frame_rect); return kPaintBordersWithoutClip; } // We have a border image that spans multiple lines. - adjusted_clip_rect = PixelSnappedIntRect(ClipRectForNinePieceImageStrip( + adjusted_clip_rect = ToPixelSnappedRect(ClipRectForNinePieceImageStrip( style, SidesToInclude(), border_image, adjusted_frame_rect)); return kPaintBordersWithClip; }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.h b/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.h index 65d55d5c..e40bf3c 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_inline_box_fragment_painter.h
@@ -80,7 +80,7 @@ BorderPaintingType GetBorderPaintType( const PhysicalRect& adjusted_frame_rect, - IntRect& adjusted_clip_rect, + gfx::Rect& adjusted_clip_rect, bool object_has_multiple_boxes) const override; void PaintNormalBoxShadow(const PaintInfo&, const ComputedStyle&,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc index 4f8f3d05..60c538a 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc
@@ -333,7 +333,7 @@ PhysicalRect clip_rect = cell_rect; clip_rect.Expand(table_cell.BorderInsets()); context.Save(); - context.Clip(PixelSnappedIntRect(clip_rect)); + context.Clip(ToPixelSnappedRect(clip_rect)); } ~TableCellBackgroundClipper() {
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_decoration_painter.h b/third_party/blink/renderer/core/paint/ng/ng_text_decoration_painter.h index 300c369..88e48c7 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_decoration_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_text_decoration_painter.h
@@ -66,7 +66,7 @@ Phase phase_; bool has_line_through_decoration_; absl::optional<TextDecorationInfo> decoration_info_; - absl::optional<FloatRect> clip_rect_; + absl::optional<gfx::RectF> clip_rect_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc index d5c643d..ed5197c5 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc
@@ -237,7 +237,7 @@ // Because only a part of the text glyph can be selected, we need to draw // the selection twice. First, draw the glyphs outside the selection area, // with the original style. - FloatRect float_selection_rect(selection_rect); + gfx::RectF float_selection_rect(selection_rect); { GraphicsContextStateSaver state_saver(graphics_context_); graphics_context_.ClipOut(float_selection_rect);
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_grid.cc b/third_party/blink/renderer/core/paint/nine_piece_image_grid.cc index 18d2322..7107c4f5 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_grid.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_grid.cc
@@ -5,8 +5,7 @@ #include "third_party/blink/renderer/core/paint/nine_piece_image_grid.h" #include "base/numerics/clamped_math.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" +#include "third_party/blink/renderer/platform/geometry/int_rect_outsets.h" #include "third_party/blink/renderer/platform/geometry/length_functions.h" namespace blink { @@ -57,10 +56,10 @@ } NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& nine_piece_image, - FloatSize image_size, - const FloatSize& slice_scale, + const gfx::SizeF& image_size, + const gfx::Vector2dF& slice_scale, float zoom, - IntRect border_image_area, + const gfx::Rect& border_image_area, const IntRectOutsets& border_widths, PhysicalBoxSides sides_to_include) : border_image_area_(border_image_area), @@ -69,13 +68,13 @@ vertical_tile_rule_(nine_piece_image.VerticalRule()), fill_(nine_piece_image.Fill()) { const LengthBox& image_slices = nine_piece_image.ImageSlices(); - top_.slice = ComputeEdgeSlice(image_slices.Top(), slice_scale.height(), + top_.slice = ComputeEdgeSlice(image_slices.Top(), slice_scale.y(), image_size.height()); - right_.slice = ComputeEdgeSlice(image_slices.Right(), slice_scale.width(), + right_.slice = ComputeEdgeSlice(image_slices.Right(), slice_scale.x(), image_size.width()); - bottom_.slice = ComputeEdgeSlice(image_slices.Bottom(), slice_scale.height(), + bottom_.slice = ComputeEdgeSlice(image_slices.Bottom(), slice_scale.y(), image_size.height()); - left_.slice = ComputeEdgeSlice(image_slices.Left(), slice_scale.width(), + left_.slice = ComputeEdgeSlice(image_slices.Left(), slice_scale.x(), image_size.width()); // TODO(fs): Compute edge widths to LayoutUnit, and then only round to @@ -84,31 +83,30 @@ // |Edge::slice| is in image-local units (physical pixels for raster images), // but when using it to resolve 'auto' for border-image-widths we want it to // be in zoomed CSS pixels, so divide by |slice_scale| and multiply by zoom. - const FloatSize auto_slice_adjustment(zoom / slice_scale.width(), - zoom / slice_scale.height()); + const gfx::Vector2dF auto_slice_adjustment(zoom / slice_scale.x(), + zoom / slice_scale.y()); const BorderImageLengthBox& border_slices = nine_piece_image.BorderSlices(); - top_.width = - sides_to_include.top - ? ComputeEdgeWidth(border_slices.Top(), border_widths.Top(), - top_.slice * auto_slice_adjustment.height(), - border_image_area.height()) - : 0; + top_.width = sides_to_include.top + ? ComputeEdgeWidth(border_slices.Top(), border_widths.Top(), + top_.slice * auto_slice_adjustment.y(), + border_image_area.height()) + : 0; right_.width = sides_to_include.right ? ComputeEdgeWidth(border_slices.Right(), border_widths.Right(), - right_.slice * auto_slice_adjustment.width(), + right_.slice * auto_slice_adjustment.x(), border_image_area.width()) : 0; bottom_.width = sides_to_include.bottom ? ComputeEdgeWidth(border_slices.Bottom(), border_widths.Bottom(), - bottom_.slice * auto_slice_adjustment.height(), + bottom_.slice * auto_slice_adjustment.y(), border_image_area.height()) : 0; left_.width = sides_to_include.left ? ComputeEdgeWidth(border_slices.Left(), border_widths.Left(), - left_.slice * auto_slice_adjustment.width(), + left_.slice * auto_slice_adjustment.x(), border_image_area.width()) : 0; @@ -131,11 +129,11 @@ // Given a rectangle, construct a subrectangle using offset, width and height. // Negative offsets are relative to the extent of the given rectangle. -static FloatRect Subrect(FloatRect rect, - float offset_x, - float offset_y, - float width, - float height) { +static gfx::RectF Subrect(const gfx::RectF& rect, + float offset_x, + float offset_y, + float width, + float height) { float base_x = rect.x(); if (offset_x < 0) base_x = rect.right(); @@ -144,31 +142,30 @@ if (offset_y < 0) base_y = rect.bottom(); - return FloatRect(base_x + offset_x, base_y + offset_y, width, height); + return gfx::RectF(base_x + offset_x, base_y + offset_y, width, height); } -static FloatRect Subrect(IntRect rect, - float offset_x, - float offset_y, - float width, - float height) { - return Subrect(FloatRect(rect), offset_x, offset_y, width, height); +static gfx::RectF Subrect(const gfx::Rect& rect, + float offset_x, + float offset_y, + float width, + float height) { + return Subrect(gfx::RectF(rect), offset_x, offset_y, width, height); } -static FloatRect Subrect(FloatSize size, - float offset_x, - float offset_y, - float width, - float height) { - return Subrect(FloatRect(gfx::PointF(), size), offset_x, offset_y, width, - height); +static gfx::RectF Subrect(const gfx::SizeF& size, + float offset_x, + float offset_y, + float width, + float height) { + return Subrect(gfx::RectF(size), offset_x, offset_y, width, height); } static inline void SetCornerPiece( NinePieceImageGrid::NinePieceDrawInfo& draw_info, bool is_drawable, - const FloatRect& source, - const FloatRect& destination) { + const gfx::RectF& source, + const gfx::RectF& destination) { draw_info.is_drawable = is_drawable; if (draw_info.is_drawable) { draw_info.source = source; @@ -215,15 +212,15 @@ static inline void SetHorizontalEdge( NinePieceImageGrid::NinePieceDrawInfo& draw_info, const NinePieceImageGrid::Edge& edge, - const FloatRect& source, - const FloatRect& destination, + const gfx::RectF& source, + const gfx::RectF& destination, ENinePieceImageRule tile_rule) { draw_info.is_drawable = edge.IsDrawable() && source.width() > 0 && destination.width() > 0; if (draw_info.is_drawable) { draw_info.source = source; draw_info.destination = destination; - draw_info.tile_scale = FloatSize(edge.Scale(), edge.Scale()); + draw_info.tile_scale = gfx::Vector2dF(edge.Scale(), edge.Scale()); draw_info.tile_rule = {tile_rule, kStretchImageRule}; } } @@ -231,27 +228,27 @@ static inline void SetVerticalEdge( NinePieceImageGrid::NinePieceDrawInfo& draw_info, const NinePieceImageGrid::Edge& edge, - const FloatRect& source, - const FloatRect& destination, + const gfx::RectF& source, + const gfx::RectF& destination, ENinePieceImageRule tile_rule) { draw_info.is_drawable = edge.IsDrawable() && source.height() > 0 && destination.height() > 0; if (draw_info.is_drawable) { draw_info.source = source; draw_info.destination = destination; - draw_info.tile_scale = FloatSize(edge.Scale(), edge.Scale()); + draw_info.tile_scale = gfx::Vector2dF(edge.Scale(), edge.Scale()); draw_info.tile_rule = {kStretchImageRule, tile_rule}; } } void NinePieceImageGrid::SetDrawInfoEdge(NinePieceDrawInfo& draw_info, NinePiece piece) const { - FloatSize edge_source_size = + gfx::SizeF edge_source_size = image_size_ - - FloatSize(left_.slice + right_.slice, top_.slice + bottom_.slice); - IntSize edge_destination_size = + gfx::SizeF(left_.slice + right_.slice, top_.slice + bottom_.slice); + gfx::Size edge_destination_size = border_image_area_.size() - - IntSize(left_.width + right_.width, top_.width + bottom_.width); + gfx::Size(left_.width + right_.width, top_.width + bottom_.width); switch (piece) { case kLeftPiece: @@ -293,11 +290,11 @@ } void NinePieceImageGrid::SetDrawInfoMiddle(NinePieceDrawInfo& draw_info) const { - FloatSize source_size = image_size_ - FloatSize(left_.slice + right_.slice, - top_.slice + bottom_.slice); - IntSize destination_size = + gfx::SizeF source_size = image_size_ - gfx::SizeF(left_.slice + right_.slice, + top_.slice + bottom_.slice); + gfx::Size destination_size = border_image_area_.size() - - IntSize(left_.width + right_.width, top_.width + bottom_.width); + gfx::Size(left_.width + right_.width, top_.width + bottom_.width); draw_info.is_drawable = fill_ && !source_size.IsEmpty() && !destination_size.IsEmpty(); @@ -310,17 +307,17 @@ Subrect(border_image_area_, left_.width, top_.width, destination_size.width(), destination_size.height()); - FloatSize middle_scale_factor(1, 1); + gfx::Vector2dF middle_scale_factor(1, 1); if (top_.IsDrawable()) - middle_scale_factor.set_width(top_.Scale()); + middle_scale_factor.set_x(top_.Scale()); else if (bottom_.IsDrawable()) - middle_scale_factor.set_width(bottom_.Scale()); + middle_scale_factor.set_x(bottom_.Scale()); if (left_.IsDrawable()) - middle_scale_factor.set_height(left_.Scale()); + middle_scale_factor.set_y(left_.Scale()); else if (right_.IsDrawable()) - middle_scale_factor.set_height(right_.Scale()); + middle_scale_factor.set_y(right_.Scale()); if (!source_size.IsEmpty()) { // For "stretch" rules, just override the scale factor and replace. We only @@ -329,12 +326,11 @@ // can have "stretch" specified in one axis but not the other, so we have to // correct the scale here. if (horizontal_tile_rule_ == kStretchImageRule) { - middle_scale_factor.set_width(destination_size.width() / - source_size.width()); + middle_scale_factor.set_x(destination_size.width() / source_size.width()); } if (vertical_tile_rule_ == kStretchImageRule) { - middle_scale_factor.set_height(destination_size.height() / - source_size.height()); + middle_scale_factor.set_y(destination_size.height() / + source_size.height()); } }
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_grid.h b/third_party/blink/renderer/core/paint/nine_piece_image_grid.h index e1064d8..9f119c2 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_grid.h +++ b/third_party/blink/renderer/core/paint/nine_piece_image_grid.h
@@ -8,11 +8,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/geometry/box_sides.h" #include "third_party/blink/renderer/core/style/nine_piece_image.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" -#include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -63,10 +63,10 @@ public: NinePieceImageGrid(const NinePieceImage&, - FloatSize image_size, - const FloatSize& slice_scale, + const gfx::SizeF& image_size, + const gfx::Vector2dF& slice_scale, float zoom, - IntRect border_image_area, + const gfx::Rect& border_image_area, const IntRectOutsets& border_widths, PhysicalBoxSides sides_to_include = PhysicalBoxSides()); @@ -76,12 +76,12 @@ public: bool is_drawable; bool is_corner_piece; - FloatRect destination; - FloatRect source; + gfx::RectF destination; + gfx::RectF source; // tileScale and tileRule are only useful for non-corners, i.e. edge and // center pieces. - FloatSize tile_scale; + gfx::Vector2dF tile_scale; struct { ENinePieceImageRule horizontal; ENinePieceImageRule vertical; @@ -102,8 +102,8 @@ void SetDrawInfoEdge(NinePieceDrawInfo&, NinePiece) const; void SetDrawInfoMiddle(NinePieceDrawInfo&) const; - IntRect border_image_area_; - FloatSize image_size_; + gfx::Rect border_image_area_; + gfx::SizeF image_size_; ENinePieceImageRule horizontal_tile_rule_; ENinePieceImageRule vertical_tile_rule_; bool fill_;
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc b/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc index 5a6722a..e26da4d 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_grid_test.cc
@@ -30,12 +30,12 @@ NinePieceImage nine_piece; nine_piece.SetImage(GeneratedImage()); - FloatSize image_size(100, 100); - IntRect border_image_area(0, 0, 100, 100); + gfx::SizeF image_size(100, 100); + gfx::Rect border_image_area(0, 0, 100, 100); IntRectOutsets border_widths(0, 0, 0, 0); NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = @@ -50,12 +50,12 @@ nine_piece.SetImageSlices(LengthBox(10, 10, 10, 10)); nine_piece.SetFill(true); - FloatSize image_size(100, 100); - IntRect border_image_area(0, 0, 100, 100); + gfx::SizeF image_size(100, 100); + gfx::Rect border_image_area(0, 0, 100, 100); IntRectOutsets border_widths(10, 10, 10, 10); NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = @@ -70,12 +70,12 @@ nine_piece.SetImageSlices(LengthBox(10, 10, 10, 10)); nine_piece.SetFill(false); // default - FloatSize image_size(100, 100); - IntRect border_image_area(0, 0, 100, 100); + gfx::SizeF image_size(100, 100); + gfx::Rect border_image_area(0, 0, 100, 100); IntRectOutsets border_widths(10, 10, 10, 10); NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = @@ -94,11 +94,11 @@ Length::Percent(49), Length::Percent(49))); - FloatSize image_size(6, 6); - IntRect border_image_area(0, 0, 6, 6); + gfx::SizeF image_size(6, 6); + gfx::Rect border_image_area(0, 0, 6, 6); IntRectOutsets border_widths(3, 3, 3, 3); - NinePieceImageGrid grid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid grid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { auto draw_info = grid.GetNinePieceDrawInfo(piece); @@ -115,8 +115,8 @@ nine_piece.SetImage(GeneratedImage()); nine_piece.SetImageSlices(LengthBox(10, 10, 10, 10)); - FloatSize image_size(100, 100); - IntRect border_image_area(0, 0, 100, 100); + gfx::SizeF image_size(100, 100); + gfx::Rect border_image_area(0, 0, 100, 100); const struct { IntRectOutsets border_widths; @@ -130,7 +130,7 @@ for (const auto& test_case : test_cases) { NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, test_case.border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = @@ -146,8 +146,8 @@ nine_piece.SetImage(GeneratedImage()); nine_piece.SetImageSlices(LengthBox(10, 10, 10, 10)); - FloatSize image_size(100, 100); - IntRect border_image_area(0, 0, 100, 100); + gfx::SizeF image_size(100, 100); + gfx::Rect border_image_area(0, 0, 100, 100); IntRectOutsets border_widths(10, 10, 10, 10); // Set border slices wide enough so that the widths are scaled @@ -155,13 +155,13 @@ nine_piece.SetBorderSlices(BorderImageLengthBox(6)); NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = grid.GetNinePieceDrawInfo(piece); if (draw_info.is_corner_piece) - EXPECT_EQ(draw_info.destination.size(), FloatSize(50, 50)); + EXPECT_EQ(draw_info.destination.size(), gfx::SizeF(50, 50)); else EXPECT_TRUE(draw_info.destination.size().IsEmpty()); } @@ -172,17 +172,17 @@ BorderImageLength bottom_right(20); nine_piece.SetBorderSlices( BorderImageLengthBox(top_left, bottom_right, bottom_right, top_left)); - grid = NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + grid = NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); NinePieceImageGrid::NinePieceDrawInfo draw_info = grid.GetNinePieceDrawInfo(kTopLeftPiece); - EXPECT_EQ(draw_info.destination.size(), FloatSize(33, 33)); + EXPECT_EQ(draw_info.destination.size(), gfx::SizeF(33, 33)); draw_info = grid.GetNinePieceDrawInfo(kTopRightPiece); - EXPECT_EQ(draw_info.destination.size(), FloatSize(67, 33)); + EXPECT_EQ(draw_info.destination.size(), gfx::SizeF(67, 33)); draw_info = grid.GetNinePieceDrawInfo(kBottomLeftPiece); - EXPECT_EQ(draw_info.destination.size(), FloatSize(33, 67)); + EXPECT_EQ(draw_info.destination.size(), gfx::SizeF(33, 67)); draw_info = grid.GetNinePieceDrawInfo(kBottomRightPiece); - EXPECT_EQ(draw_info.destination.size(), FloatSize(67, 67)); + EXPECT_EQ(draw_info.destination.size(), gfx::SizeF(67, 67)); // Set border slices that overlap in one dimension but not in the other, and // where the resulting width in the non-overlapping dimension will round to a @@ -191,11 +191,11 @@ BorderImageLength left_right(Length::Fixed(11)); nine_piece.SetBorderSlices( BorderImageLengthBox(top_bottom, left_right, top_bottom, left_right)); - grid = NinePieceImageGrid(nine_piece, image_size, FloatSize(1, 1), 1, + grid = NinePieceImageGrid(nine_piece, image_size, gfx::Vector2dF(1, 1), 1, border_image_area, border_widths); NinePieceImageGrid::NinePieceDrawInfo tl_info = grid.GetNinePieceDrawInfo(kTopLeftPiece); - EXPECT_EQ(tl_info.destination.size(), FloatSize(6, 50)); + EXPECT_EQ(tl_info.destination.size(), gfx::SizeF(6, 50)); // The top-right, bottom-left and bottom-right pieces are the same size as // the top-left piece. draw_info = grid.GetNinePieceDrawInfo(kTopRightPiece); @@ -208,8 +208,8 @@ TEST_F(NinePieceImageGridTest, NinePieceImagePainting) { const struct { - FloatSize image_size; - IntRect border_image_area; + gfx::SizeF image_size; + gfx::Rect border_image_area; IntRectOutsets border_widths; bool fill; LengthBox image_slices; @@ -218,8 +218,8 @@ struct { bool is_drawable; bool is_corner_piece; - FloatRect destination; - FloatRect source; + gfx::RectF destination; + gfx::RectF source; float tile_scale_horizontal; float tile_scale_vertical; ENinePieceImageRule horizontal_rule; @@ -227,8 +227,8 @@ } pieces[9]; } test_cases[] = { {// Empty border and slices but with fill - FloatSize(100, 100), - IntRect(0, 0, 100, 100), + gfx::SizeF(100, 100), + gfx::Rect(0, 0, 100, 100), IntRectOutsets(0, 0, 0, 0), true, LengthBox(Length::Fixed(0), Length::Fixed(0), Length::Fixed(0), @@ -236,28 +236,28 @@ kStretchImageRule, kStretchImageRule, { - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 0, 100, 100), FloatRect(0, 0, 100, 100), + {true, false, gfx::RectF(0, 0, 100, 100), gfx::RectF(0, 0, 100, 100), 1, 1, kStretchImageRule, kStretchImageRule}, }}, {// Single border and fill - FloatSize(100, 100), - IntRect(0, 0, 100, 100), + gfx::SizeF(100, 100), + gfx::Rect(0, 0, 100, 100), IntRectOutsets(0, 0, 10, 0), true, LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), @@ -265,28 +265,28 @@ kStretchImageRule, kStretchImageRule, { - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 90, 100, 10), FloatRect(20, 80, 60, 20), + {true, false, gfx::RectF(0, 90, 100, 10), gfx::RectF(20, 80, 60, 20), 0.5, 0.5, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 0, 100, 90), FloatRect(20, 20, 60, 60), + {true, false, gfx::RectF(0, 0, 100, 90), gfx::RectF(20, 20, 60, 60), 1.666667, 1.5, kStretchImageRule, kStretchImageRule}, }}, {// All borders, no fill - FloatSize(100, 100), - IntRect(0, 0, 100, 100), + gfx::SizeF(100, 100), + gfx::Rect(0, 0, 100, 100), IntRectOutsets(10, 10, 10, 10), false, LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), @@ -294,28 +294,28 @@ kStretchImageRule, kStretchImageRule, { - {true, true, FloatRect(0, 0, 10, 10), FloatRect(0, 0, 20, 20), 1, 1, - kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(0, 90, 10, 10), FloatRect(0, 80, 20, 20), 1, + {true, true, gfx::RectF(0, 0, 10, 10), gfx::RectF(0, 0, 20, 20), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 10, 10, 80), FloatRect(0, 20, 20, 60), - 0.5, 0.5, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(90, 0, 10, 10), FloatRect(80, 0, 20, 20), 1, + {true, true, gfx::RectF(0, 90, 10, 10), gfx::RectF(0, 80, 20, 20), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(90, 90, 10, 10), FloatRect(80, 80, 20, 20), 1, + {true, false, gfx::RectF(0, 10, 10, 80), gfx::RectF(0, 20, 20, 60), + 0.5, 0.5, kStretchImageRule, kStretchImageRule}, + {true, true, gfx::RectF(90, 0, 10, 10), gfx::RectF(80, 0, 20, 20), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(90, 10, 10, 80), FloatRect(80, 20, 20, 60), + {true, true, gfx::RectF(90, 90, 10, 10), gfx::RectF(80, 80, 20, 20), + 1, 1, kStretchImageRule, kStretchImageRule}, + {true, false, gfx::RectF(90, 10, 10, 80), gfx::RectF(80, 20, 20, 60), 0.5, 0.5, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(10, 0, 80, 10), FloatRect(20, 0, 60, 20), + {true, false, gfx::RectF(10, 0, 80, 10), gfx::RectF(20, 0, 60, 20), 0.5, 0.5, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(10, 90, 80, 10), FloatRect(20, 80, 60, 20), + {true, false, gfx::RectF(10, 90, 80, 10), gfx::RectF(20, 80, 60, 20), 0.5, 0.5, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kStretchImageRule}, }}, {// Single border, no fill - FloatSize(100, 100), - IntRect(0, 0, 100, 100), + gfx::SizeF(100, 100), + gfx::Rect(0, 0, 100, 100), IntRectOutsets(0, 0, 0, 10), false, LengthBox(Length::Percent(20), Length::Percent(20), Length::Percent(20), @@ -323,29 +323,29 @@ kStretchImageRule, kRoundImageRule, { - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 0, 10, 100), FloatRect(0, 20, 20, 60), + {true, false, gfx::RectF(0, 0, 10, 100), gfx::RectF(0, 20, 20, 60), 0.5, 0.5, kStretchImageRule, kRoundImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kRoundImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kRoundImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kRoundImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kRoundImageRule}, }}, {// All borders but no slices, with fill (stretch horizontally, space // vertically) - FloatSize(100, 100), - IntRect(0, 0, 100, 100), + gfx::SizeF(100, 100), + gfx::Rect(0, 0, 100, 100), IntRectOutsets(10, 10, 10, 10), true, LengthBox(Length::Fixed(0), Length::Fixed(0), Length::Fixed(0), @@ -353,23 +353,23 @@ kStretchImageRule, kSpaceImageRule, { - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kSpaceImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, true, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 1, 1, + {false, true, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 1, 1, kStretchImageRule, kStretchImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kSpaceImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kSpaceImageRule}, - {false, false, FloatRect(0, 0, 0, 0), FloatRect(0, 0, 0, 0), 0, 0, + {false, false, gfx::RectF(0, 0, 0, 0), gfx::RectF(0, 0, 0, 0), 0, 0, kStretchImageRule, kSpaceImageRule}, - {true, false, FloatRect(10, 10, 80, 80), FloatRect(0, 0, 100, 100), + {true, false, gfx::RectF(10, 10, 80, 80), gfx::RectF(0, 0, 100, 100), 0.800000, 1, kStretchImageRule, kSpaceImageRule}, }}, }; @@ -384,7 +384,7 @@ nine_piece.SetVerticalRule((ENinePieceImageRule)test_case.vertical_rule); NinePieceImageGrid grid = NinePieceImageGrid( - nine_piece, test_case.image_size, FloatSize(1, 1), 1, + nine_piece, test_case.image_size, gfx::Vector2dF(1, 1), 1, test_case.border_image_area, test_case.border_widths); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { NinePieceImageGrid::NinePieceDrawInfo draw_info = @@ -412,9 +412,9 @@ continue; EXPECT_FLOAT_EQ(test_case.pieces[piece].tile_scale_horizontal, - draw_info.tile_scale.width()); + draw_info.tile_scale.x()); EXPECT_FLOAT_EQ(test_case.pieces[piece].tile_scale_vertical, - draw_info.tile_scale.height()); + draw_info.tile_scale.y()); EXPECT_EQ(test_case.pieces[piece].horizontal_rule, draw_info.tile_rule.horizontal); EXPECT_EQ(test_case.pieces[piece].vertical_rule, @@ -430,41 +430,40 @@ nine_piece.SetImageSlices(LengthBox(10, 10, 10, 10)); nine_piece.SetFill(true); - FloatSize image_size(50, 50); - IntRect border_image_area(0, 0, 200, 200); + gfx::SizeF image_size(50, 50); + gfx::Rect border_image_area(0, 0, 200, 200); IntRectOutsets border_widths(20, 20, 20, 20); - NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(2, 2), 2, - border_image_area, border_widths); + NinePieceImageGrid grid(nine_piece, image_size, gfx::Vector2dF(2, 2), 2, + border_image_area, border_widths); struct { bool is_drawable; bool is_corner_piece; - FloatRect destination; - FloatRect source; + gfx::RectF destination; + gfx::RectF source; float tile_scale_horizontal; float tile_scale_vertical; ENinePieceImageRule horizontal_rule; ENinePieceImageRule vertical_rule; } expected_pieces[kMaxPiece] = { - {true, true, FloatRect(0, 0, 20, 20), FloatRect(0, 0, 20, 20), 0, 0, + {true, true, gfx::RectF(0, 0, 20, 20), gfx::RectF(0, 0, 20, 20), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(0, 180, 20, 20), FloatRect(0, 30, 20, 20), 0, 0, + {true, true, gfx::RectF(0, 180, 20, 20), gfx::RectF(0, 30, 20, 20), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 20, 20, 160), FloatRect(0, 20, 20, 10), 1, 1, + {true, false, gfx::RectF(0, 20, 20, 160), gfx::RectF(0, 20, 20, 10), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(180, 0, 20, 20), FloatRect(30, 0, 20, 20), 0, 0, + {true, true, gfx::RectF(180, 0, 20, 20), gfx::RectF(30, 0, 20, 20), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(180, 180, 20, 20), FloatRect(30, 30, 20, 20), 0, 0, - kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(180, 20, 20, 160), FloatRect(30, 20, 20, 10), 1, + {true, true, gfx::RectF(180, 180, 20, 20), gfx::RectF(30, 30, 20, 20), 0, + 0, kStretchImageRule, kStretchImageRule}, + {true, false, gfx::RectF(180, 20, 20, 160), gfx::RectF(30, 20, 20, 10), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(20, 0, 160, 20), FloatRect(20, 0, 10, 20), 1, 1, + {true, false, gfx::RectF(20, 0, 160, 20), gfx::RectF(20, 0, 10, 20), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(20, 180, 160, 20), FloatRect(20, 30, 10, 20), 1, + {true, false, gfx::RectF(20, 180, 160, 20), gfx::RectF(20, 30, 10, 20), 1, 1, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(20, 20, 160, 160), FloatRect(20, 20, 10, 10), 16, - 16, kStretchImageRule, kStretchImageRule}, + {true, false, gfx::RectF(20, 20, 160, 160), gfx::RectF(20, 20, 10, 10), + 16, 16, kStretchImageRule, kStretchImageRule}, }; for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { @@ -479,10 +478,8 @@ if (expected.is_corner_piece) continue; - EXPECT_FLOAT_EQ(draw_info.tile_scale.width(), - expected.tile_scale_horizontal); - EXPECT_FLOAT_EQ(draw_info.tile_scale.height(), - expected.tile_scale_vertical); + EXPECT_FLOAT_EQ(draw_info.tile_scale.x(), expected.tile_scale_horizontal); + EXPECT_FLOAT_EQ(draw_info.tile_scale.y(), expected.tile_scale_vertical); EXPECT_EQ(draw_info.tile_rule.vertical, expected.vertical_rule); EXPECT_EQ(draw_info.tile_rule.horizontal, expected.horizontal_rule); } @@ -496,44 +493,43 @@ nine_piece.SetFill(true); constexpr float zoom = 2.2f; - FloatSize image_size(3 * zoom, 3 * zoom); - IntRect border_image_area(0, 0, 220, 220); + gfx::SizeF image_size(3 * zoom, 3 * zoom); + gfx::Rect border_image_area(0, 0, 220, 220); IntRectOutsets border_widths(33, 33, 33, 33); - NinePieceImageGrid grid = - NinePieceImageGrid(nine_piece, image_size, FloatSize(zoom, zoom), zoom, - border_image_area, border_widths); + NinePieceImageGrid grid(nine_piece, image_size, gfx::Vector2dF(zoom, zoom), + zoom, border_image_area, border_widths); struct { bool is_drawable; bool is_corner_piece; - FloatRect destination; - FloatRect source; + gfx::RectF destination; + gfx::RectF source; float tile_scale_horizontal; float tile_scale_vertical; ENinePieceImageRule horizontal_rule; ENinePieceImageRule vertical_rule; } expected_pieces[kMaxPiece] = { - {true, true, FloatRect(0, 0, 33, 33), FloatRect(0, 0, 2.2f, 2.2f), 0, 0, + {true, true, gfx::RectF(0, 0, 33, 33), gfx::RectF(0, 0, 2.2f, 2.2f), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(0, 187, 33, 33), FloatRect(0, 4.4f, 2.2f, 2.2f), 0, - 0, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(0, 33, 33, 154), FloatRect(0, 2.2f, 2.2f, 2.2f), + {true, true, gfx::RectF(0, 187, 33, 33), gfx::RectF(0, 4.4f, 2.2f, 2.2f), + 0, 0, kStretchImageRule, kStretchImageRule}, + {true, false, gfx::RectF(0, 33, 33, 154), gfx::RectF(0, 2.2f, 2.2f, 2.2f), 15, 15, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(187, 0, 33, 33), FloatRect(4.4f, 0, 2.2f, 2.2f), 0, - 0, kStretchImageRule, kStretchImageRule}, - {true, true, FloatRect(187, 187, 33, 33), - FloatRect(4.4f, 4.4f, 2.2f, 2.2f), 0, 0, kStretchImageRule, + {true, true, gfx::RectF(187, 0, 33, 33), gfx::RectF(4.4f, 0, 2.2f, 2.2f), + 0, 0, kStretchImageRule, kStretchImageRule}, + {true, true, gfx::RectF(187, 187, 33, 33), + gfx::RectF(4.4f, 4.4f, 2.2f, 2.2f), 0, 0, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(187, 33, 33, 154), - FloatRect(4.4f, 2.2f, 2.2f, 2.2f), 15, 15, kStretchImageRule, + {true, false, gfx::RectF(187, 33, 33, 154), + gfx::RectF(4.4f, 2.2f, 2.2f, 2.2f), 15, 15, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(33, 0, 154, 33), FloatRect(2.2f, 0, 2.2f, 2.2f), + {true, false, gfx::RectF(33, 0, 154, 33), gfx::RectF(2.2f, 0, 2.2f, 2.2f), 15, 15, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(33, 187, 154, 33), - FloatRect(2.2f, 4.4f, 2.2f, 2.2f), 15, 15, kStretchImageRule, + {true, false, gfx::RectF(33, 187, 154, 33), + gfx::RectF(2.2f, 4.4f, 2.2f, 2.2f), 15, 15, kStretchImageRule, kStretchImageRule}, - {true, false, FloatRect(33, 33, 154, 154), - FloatRect(2.2f, 2.2f, 2.2f, 2.2f), 70, 70, kStretchImageRule, + {true, false, gfx::RectF(33, 33, 154, 154), + gfx::RectF(2.2f, 2.2f, 2.2f, 2.2f), 70, 70, kStretchImageRule, kStretchImageRule}, }; @@ -557,10 +553,8 @@ if (expected.is_corner_piece) continue; - EXPECT_FLOAT_EQ(draw_info.tile_scale.width(), - expected.tile_scale_horizontal); - EXPECT_FLOAT_EQ(draw_info.tile_scale.height(), - expected.tile_scale_vertical); + EXPECT_FLOAT_EQ(draw_info.tile_scale.x(), expected.tile_scale_horizontal); + EXPECT_FLOAT_EQ(draw_info.tile_scale.y(), expected.tile_scale_vertical); EXPECT_EQ(draw_info.tile_rule.vertical, expected.vertical_rule); EXPECT_EQ(draw_info.tile_rule.horizontal, expected.horizontal_rule); }
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc index 25f6f48..5dbbdfa 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc
@@ -91,25 +91,26 @@ const Document& document, const NinePieceImage& nine_piece_image, Image* image, - const FloatSize& unzoomed_image_size, + const gfx::SizeF& unzoomed_image_size, PhysicalBoxSides sides_to_include) { // |image_size| is in the image's native resolution and |slice_scale| defines // the effective size of a CSS pixel in the image. - FloatSize image_size = image->SizeAsFloat(kRespectImageOrientation); + gfx::SizeF image_size = image->SizeAsFloat(kRespectImageOrientation); // Compute the scale factor to apply to the slice values by relating the // zoomed size to the "unzoomed" (CSS pixel) size. For raster images this // should match any DPR scale while for generated images it should match the // effective zoom. (Modulo imprecisions introduced by the computation.) This // scale should in theory be uniform. - FloatSize slice_scale(image_size.width() / unzoomed_image_size.width(), - image_size.height() / unzoomed_image_size.height()); + gfx::Vector2dF slice_scale( + image_size.width() / unzoomed_image_size.width(), + image_size.height() / unzoomed_image_size.height()); IntRectOutsets border_widths( style.BorderTopWidth().ToInt(), style.BorderRightWidth().ToInt(), style.BorderBottomWidth().ToInt(), style.BorderLeftWidth().ToInt()); NinePieceImageGrid grid( nine_piece_image, image_size, slice_scale, style.EffectiveZoom(), - PixelSnappedIntRect(border_image_rect), border_widths, sides_to_include); + ToPixelSnappedRect(border_image_rect), border_widths, sides_to_include); AutoDarkMode auto_dark_mode( PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); @@ -133,10 +134,10 @@ // TODO(cavalcantii): see crbug.com/662513. absl::optional<TileParameters> h_tile = ComputeTileParameters( draw_info.tile_rule.horizontal, draw_info.destination.width(), - draw_info.source.width(), draw_info.tile_scale.width()); + draw_info.source.width(), draw_info.tile_scale.x()); absl::optional<TileParameters> v_tile = ComputeTileParameters( draw_info.tile_rule.vertical, draw_info.destination.height(), - draw_info.source.height(), draw_info.tile_scale.height()); + draw_info.source.height(), draw_info.tile_scale.y()); if (!h_tile || !v_tile) continue; @@ -148,17 +149,18 @@ ImageTilingInfo tiling_info; tiling_info.image_rect = draw_info.source; - tiling_info.scale = FloatSize(h_tile->scale_factor, v_tile->scale_factor); + tiling_info.scale = + gfx::Vector2dF(h_tile->scale_factor, v_tile->scale_factor); // The phase defines the origin of the whole image - not the image // rect (see ImageTilingInfo) - so we need to adjust it to account // for that. gfx::PointF tile_origin_in_dest_space = draw_info.source.origin(); - tile_origin_in_dest_space.Scale(tiling_info.scale.width(), - tiling_info.scale.height()); + tile_origin_in_dest_space.Scale(tiling_info.scale.x(), + tiling_info.scale.y()); tiling_info.phase = draw_info.destination.origin() + (gfx::PointF(h_tile->phase, v_tile->phase) - tile_origin_in_dest_space); - tiling_info.spacing = FloatSize(h_tile->spacing, v_tile->spacing); + tiling_info.spacing = gfx::SizeF(h_tile->spacing, v_tile->spacing); context.DrawImageTiled(image, draw_info.destination, tiling_info, auto_dark_mode); @@ -197,8 +199,8 @@ // generated or SVG), then get an image using that size. This will yield an // image with either "native" size (raster images) or size scaled by effective // zoom. - const FloatSize default_object_size(border_image_rect.size); - FloatSize image_size = style_image->ImageSize( + const gfx::SizeF default_object_size(border_image_rect.size); + gfx::SizeF image_size = style_image->ImageSize( style.EffectiveZoom(), default_object_size, kRespectImageOrientation); scoped_refptr<Image> image = style_image->GetImage(observer, document, style, image_size); @@ -208,14 +210,14 @@ // Resolve the image size again, this time with a size-multiplier of one, to // yield the size in CSS pixels. This is the unit/scale we expect the // 'border-image-slice' values to be in. - FloatSize unzoomed_image_size = style_image->ImageSize( - 1, default_object_size.ScaledBy(1 / style.EffectiveZoom()), + gfx::SizeF unzoomed_image_size = style_image->ImageSize( + 1, gfx::ScaleSize(default_object_size, 1 / style.EffectiveZoom()), kRespectImageOrientation); DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES( TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, node, *style_image, - FloatRect(image->Rect()), FloatRect(border_image_rect)); + gfx::RectF(image->Rect()), gfx::RectF(border_image_rect)); PaintPieces(graphics_context, border_image_rect, style, document, nine_piece_image, image.get(), unzoomed_image_size, sides_to_include);
diff --git a/third_party/blink/renderer/core/paint/object_painter.cc b/third_party/blink/renderer/core/paint/object_painter.cc index 0576c175..295bc5d1 100644 --- a/third_party/blink/renderer/core/paint/object_painter.cc +++ b/third_party/blink/renderer/core/paint/object_painter.cc
@@ -88,10 +88,10 @@ layout_object_.GetDocument().BaseURL())) { String fragment_name = url.FragmentIdentifier(); if (layout_object_.GetDocument().FindAnchor(fragment_name)) - paint_info.context.SetURLFragmentForRect(fragment_name, IntRect(rect)); + paint_info.context.SetURLFragmentForRect(fragment_name, rect); return; } - paint_info.context.SetURLForRect(url, IntRect(rect)); + paint_info.context.SetURLForRect(url, rect); } void ObjectPainter::PaintAllPhasesAtomically(const PaintInfo& paint_info) {
diff --git a/third_party/blink/renderer/core/paint/outline_painter.cc b/third_party/blink/renderer/core/paint/outline_painter.cc index 52bf074..a5177b4 100644 --- a/third_party/blink/renderer/core/paint/outline_painter.cc +++ b/third_party/blink/renderer/core/paint/outline_painter.cc
@@ -489,7 +489,7 @@ switch (outline_style_) { case EBorderStyle::kSolid: context_.FillRect( - outer_path.getBounds(), + gfx::SkRectToRectF(outer_path.getBounds()), PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); break; @@ -537,7 +537,8 @@ context_.FillPath(inner_third_path, auto_dark_mode); MakeClipOutPath(outer_third_path); context_.ClipPath(outer_third_path, kAntiAliased); - context_.FillRect(right_angle_outer_path_.getBounds(), auto_dark_mode); + context_.FillRect(gfx::SkRectToRectF(right_angle_outer_path_.getBounds()), + auto_dark_mode); } void PaintDottedOrDashedOutline() {
diff --git a/third_party/blink/renderer/core/paint/paint_layer.cc b/third_party/blink/renderer/core/paint/paint_layer.cc index fe5de3f..573c68c4 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.cc +++ b/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -2726,7 +2726,7 @@ } gfx::RectF PaintLayer::BackdropFilterReferenceBox() const { - return gfx::RectF(ToGfxRect(GetLayoutObject().BorderBoundingBox())); + return gfx::RectF(GetLayoutObject().BorderBoundingBox()); } gfx::RRectF PaintLayer::BackdropFilterBounds() const {
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index 801f64c..40b4c678 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -398,7 +398,7 @@ return max_x - thickness - box.StyleRef().BorderRightWidth().ToFloat(); } -IntRect PaintLayerScrollableArea::CornerRect() const { +gfx::Rect PaintLayerScrollableArea::CornerRect() const { int horizontal_thickness; int vertical_thickness; if (!VerticalScrollbar() && !HorizontalScrollbar()) { @@ -417,15 +417,15 @@ horizontal_thickness = VerticalScrollbar()->ScrollbarThickness(); vertical_thickness = HorizontalScrollbar()->ScrollbarThickness(); } - IntSize border_box_size = PixelSnappedBorderBoxSize(); - return IntRect(CornerStart(*GetLayoutBox(), 0, border_box_size.width(), - horizontal_thickness), - border_box_size.height() - vertical_thickness - - GetLayoutBox()->StyleRef().BorderBottomWidth().ToFloat(), - horizontal_thickness, vertical_thickness); + gfx::Size border_box_size = PixelSnappedBorderBoxSize(); + return gfx::Rect(CornerStart(*GetLayoutBox(), 0, border_box_size.width(), + horizontal_thickness), + border_box_size.height() - vertical_thickness - + GetLayoutBox()->StyleRef().BorderBottomWidth().ToFloat(), + horizontal_thickness, vertical_thickness); } -IntRect PaintLayerScrollableArea::ScrollCornerRect() const { +gfx::Rect PaintLayerScrollableArea::ScrollCornerRect() const { // We have a scrollbar corner when a scrollbar is visible and not filling the // entire length of the box. // This happens when: @@ -438,7 +438,7 @@ (has_resizer && (has_horizontal_bar || has_vertical_bar))) { return CornerRect(); } - return IntRect(); + return gfx::Rect(); } void PaintLayerScrollableArea::SetScrollbarNeedsPaintInvalidation( @@ -455,17 +455,17 @@ ScrollableArea::SetScrollCornerNeedsPaintInvalidation(); } -IntRect +gfx::Rect PaintLayerScrollableArea::ConvertFromScrollbarToContainingEmbeddedContentView( const Scrollbar& scrollbar, - const IntRect& scrollbar_rect) const { + const gfx::Rect& scrollbar_rect) const { LayoutView* view = GetLayoutBox()->View(); if (!view) return scrollbar_rect; - IntRect rect = scrollbar_rect; + gfx::Rect rect = scrollbar_rect; rect.Offset(ScrollbarOffset(scrollbar)); - return PixelSnappedIntRect( + return ToPixelSnappedRect( GetLayoutBox()->LocalToAbsoluteRect(PhysicalRect(rect))); } @@ -477,8 +477,7 @@ if (!view) return scrollbar_point; - gfx::Point point = - scrollbar_point + ToGfxVector2d(ScrollbarOffset(scrollbar)); + gfx::Point point = scrollbar_point + ScrollbarOffset(scrollbar); return ToRoundedPoint( GetLayoutBox()->LocalToAbsolutePoint(PhysicalOffset(point))); } @@ -493,7 +492,7 @@ gfx::Point point = ToRoundedPoint( GetLayoutBox()->AbsoluteToLocalPoint(PhysicalOffset(parent_point))); - point -= ToGfxVector2d(ScrollbarOffset(scrollbar)); + point -= ScrollbarOffset(scrollbar); return point; } @@ -724,7 +723,7 @@ if (!GetLayoutBox() || !GetLayoutBox()->IsScrollContainer()) return -ScrollOrigin().OffsetFromOrigin(); - IntSize content_size = ContentsSize(); + gfx::Size content_size = ContentsSize(); Page* page = GetLayoutBox()->GetDocument().GetPage(); DCHECK(page); @@ -734,20 +733,20 @@ // The global root scroller should be clipped by the top LocalFrameView rather // than it's overflow clipping box. This is to ensure that content exposed by // hiding the URL bar at the bottom of the screen is visible. - IntSize visible_size; + gfx::Size visible_size; if (this == controller.RootScrollerArea()) { visible_size = controller.RootScrollerVisibleArea(); } else { - visible_size = PixelSnappedIntRect(GetLayoutBox()->OverflowClipRect( - GetLayoutBox()->Location(), - kIgnoreOverlayScrollbarSize)) + visible_size = ToPixelSnappedRect(GetLayoutBox()->OverflowClipRect( + GetLayoutBox()->Location(), + kIgnoreOverlayScrollbarSize)) .size(); } // TODO(skobes): We should really ASSERT that contentSize >= visibleSize // when we are not the root layer, but we can't because contentSize is // based on stale layout overflow data (http://crbug.com/576933). - content_size = content_size.ExpandedTo(visible_size); + content_size.SetToMax(visible_size); return -ScrollOrigin().OffsetFromOrigin() + gfx::Vector2d(content_size.width() - visible_size.width(), @@ -776,14 +775,14 @@ return PhysicalRect(PhysicalOffset::FromPointFRound(ScrollPosition()), size); } -IntRect PaintLayerScrollableArea::VisibleContentRect( +gfx::Rect PaintLayerScrollableArea::VisibleContentRect( IncludeScrollbarsInRect scrollbar_inclusion) const { PhysicalRect layout_content_rect(LayoutContentRect(scrollbar_inclusion)); // TODO(szager): It's not clear that Floor() is the right thing to do here; // what is the correct behavior for fractional scroll offsets? - return IntRect(ToFlooredPoint(layout_content_rect.offset), - PixelSnappedIntSize(layout_content_rect.size.ToLayoutSize(), - GetLayoutBox()->Location())); + return gfx::Rect(ToFlooredPoint(layout_content_rect.offset), + ToPixelSnappedSize(layout_content_rect.size.ToLayoutSize(), + GetLayoutBox()->Location())); } PhysicalRect PaintLayerScrollableArea::VisibleScrollSnapportRect( @@ -803,7 +802,7 @@ return layout_content_rect; } -IntSize PaintLayerScrollableArea::ContentsSize() const { +gfx::Size PaintLayerScrollableArea::ContentsSize() const { PhysicalOffset offset( GetLayoutBox()->ClientLeft() + GetLayoutBox()->Location().X(), GetLayoutBox()->ClientTop() + GetLayoutBox()->Location().Y()); @@ -811,9 +810,9 @@ return PixelSnappedContentsSize(offset); } -IntSize PaintLayerScrollableArea::PixelSnappedContentsSize( +gfx::Size PaintLayerScrollableArea::PixelSnappedContentsSize( const PhysicalOffset& paint_offset) const { - return PixelSnappedIntRect(PhysicalRect(paint_offset, overflow_rect_.size)) + return ToPixelSnappedRect(PhysicalRect(paint_offset, overflow_rect_.size)) .size(); } @@ -942,7 +941,7 @@ // use the snapport rect to calculate the page step instead of the visible // rect. // [1] https://drafts.csswg.org/css-scroll-snap/#scroll-padding - IntSize snapport_size = VisibleScrollSnapportRect().PixelSnappedSize(); + gfx::Size snapport_size = VisibleScrollSnapportRect().PixelSnappedSize(); int length = (orientation == kHorizontalScrollbar) ? snapport_size.width() : snapport_size.height(); int min_page_step = static_cast<float>(length) * @@ -1428,13 +1427,13 @@ UpdateScrollableAreaSet(); } -IntRect PaintLayerScrollableArea::RectForHorizontalScrollbar() const { +gfx::Rect PaintLayerScrollableArea::RectForHorizontalScrollbar() const { if (!HasHorizontalScrollbar()) - return IntRect(); + return gfx::Rect(); - const IntRect& scroll_corner = ScrollCornerRect(); - IntSize border_box_size = PixelSnappedBorderBoxSize(); - return IntRect( + const gfx::Rect& scroll_corner = ScrollCornerRect(); + gfx::Size border_box_size = PixelSnappedBorderBoxSize(); + return gfx::Rect( HorizontalScrollbarStart(), border_box_size.height() - GetLayoutBox()->BorderBottom().ToInt() - HorizontalScrollbar()->ScrollbarThickness(), @@ -1445,12 +1444,12 @@ HorizontalScrollbar()->ScrollbarThickness()); } -IntRect PaintLayerScrollableArea::RectForVerticalScrollbar() const { +gfx::Rect PaintLayerScrollableArea::RectForVerticalScrollbar() const { if (!HasVerticalScrollbar()) - return IntRect(); + return gfx::Rect(); - const IntRect& scroll_corner = ScrollCornerRect(); - return IntRect( + const gfx::Rect& scroll_corner = ScrollCornerRect(); + return gfx::Rect( VerticalScrollbarStart(), GetLayoutBox()->BorderTop().ToInt(), VerticalScrollbar()->ScrollbarThickness(), PixelSnappedBorderBoxSize().height() - @@ -1476,24 +1475,24 @@ return x; } -IntSize PaintLayerScrollableArea::ScrollbarOffset( +gfx::Vector2d PaintLayerScrollableArea::ScrollbarOffset( const Scrollbar& scrollbar) const { // TODO(szager): Factor out vertical offset calculation into other methods, // for symmetry with *ScrollbarStart methods for horizontal offset. if (&scrollbar == VerticalScrollbar()) { - return IntSize(VerticalScrollbarStart(), - GetLayoutBox()->BorderTop().ToInt()); + return gfx::Vector2d(VerticalScrollbarStart(), + GetLayoutBox()->BorderTop().ToInt()); } if (&scrollbar == HorizontalScrollbar()) { - return IntSize(HorizontalScrollbarStart(), - GetLayoutBox()->BorderTop().ToInt() + - VisibleContentRect(kIncludeScrollbars).height() - - HorizontalScrollbar()->ScrollbarThickness()); + return gfx::Vector2d(HorizontalScrollbarStart(), + GetLayoutBox()->BorderTop().ToInt() + + VisibleContentRect(kIncludeScrollbars).height() - + HorizontalScrollbar()->ScrollbarThickness()); } NOTREACHED(); - return IntSize(); + return gfx::Vector2d(); } static inline const LayoutObject& ScrollbarStyleSource( @@ -1714,7 +1713,7 @@ v_mode != mojom::blink::ScrollbarMode::kAuto) return false; - IntSize visible_size_with_scrollbars = + gfx::Size visible_size_with_scrollbars = VisibleContentRect(kIncludeScrollbars).size(); if (ScrollWidth() <= visible_size_with_scrollbars.width() && ScrollHeight() <= visible_size_with_scrollbars.height()) { @@ -2055,7 +2054,7 @@ if (!HasOverflowControls()) return false; - IntRect resize_control_rect; + gfx::Rect resize_control_rect; if (GetLayoutBox()->CanResize()) { resize_control_rect = ResizerCornerRect(kResizerForPointer); if (resize_control_rect.Contains(local_point)) @@ -2063,7 +2062,7 @@ } int resize_control_size = max(resize_control_rect.height(), 0); - IntRect visible_rect = VisibleContentRect(kIncludeScrollbars); + gfx::Rect visible_rect = VisibleContentRect(kIncludeScrollbars); if (HasVerticalScrollbar() && VerticalScrollbar()->ShouldParticipateInHitTesting()) { @@ -2105,29 +2104,29 @@ return false; } -IntRect PaintLayerScrollableArea::ResizerCornerRect( +gfx::Rect PaintLayerScrollableArea::ResizerCornerRect( ResizerHitTestType resizer_hit_test_type) const { if (!GetLayoutBox()->CanResize()) - return IntRect(); - IntRect corner = CornerRect(); + return gfx::Rect(); + gfx::Rect corner = CornerRect(); if (resizer_hit_test_type == kResizerForTouch) { // We make the resizer virtually larger for touch hit testing. With the // expanding ratio k = ResizerControlExpandRatioForTouch, we first move // the resizer rect (of width w & height h), by (-w * (k-1), -h * (k-1)), // then expand the rect by new_w/h = w/h * k. - int expand_ratio = kResizerControlExpandRatioForTouch - 1; - corner.Offset(-corner.width() * expand_ratio, - -corner.height() * expand_ratio); - corner.Expand(corner.width() * expand_ratio, - corner.height() * expand_ratio); + corner.Offset(-corner.width() * (kResizerControlExpandRatioForTouch - 1), + -corner.height() * (kResizerControlExpandRatioForTouch - 1)); + corner.set_size( + gfx::Size(corner.width() * kResizerControlExpandRatioForTouch, + corner.height() * kResizerControlExpandRatioForTouch)); } return corner; } -IntRect PaintLayerScrollableArea::ScrollCornerAndResizerRect() const { - IntRect scroll_corner_and_resizer = ScrollCornerRect(); +gfx::Rect PaintLayerScrollableArea::ScrollCornerAndResizerRect() const { + gfx::Rect scroll_corner_and_resizer = ScrollCornerRect(); if (scroll_corner_and_resizer.IsEmpty()) return ResizerCornerRect(kResizerForPointer); return scroll_corner_and_resizer; @@ -2158,8 +2157,9 @@ for (int i = layer_fragments.size() - 1; i >= 0; --i) { const PaintLayerFragment& fragment = layer_fragments.at(i); if (fragment.background_rect.Intersects(hit_test_location)) { - IntRect resizer_corner_rect = ResizerCornerRect(kResizerForPointer); - resizer_corner_rect.MoveBy(ToRoundedPoint(fragment.layer_bounds.offset)); + gfx::Rect resizer_corner_rect = ResizerCornerRect(kResizerForPointer); + resizer_corner_rect.Offset( + ToRoundedVector2d(fragment.layer_bounds.offset)); if (resizer_corner_rect.Contains(hit_test_location.RoundedPoint())) return true; } @@ -2237,19 +2237,19 @@ } } -IntSize PaintLayerScrollableArea::OffsetFromResizeCorner( +gfx::Vector2d PaintLayerScrollableArea::OffsetFromResizeCorner( const gfx::Point& absolute_point) const { // Currently the resize corner is either the bottom right corner or the bottom // left corner. // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be // the case? - IntSize element_size = PixelSnappedBorderBoxSize(); + gfx::Size element_size = PixelSnappedBorderBoxSize(); if (GetLayoutBox()->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) element_size.set_width(0); - gfx::Point resizer_point = ToGfxPoint(element_size); gfx::Point local_point = ToRoundedPoint( GetLayoutBox()->AbsoluteToLocalPoint(PhysicalOffset(absolute_point))); - return IntSize(local_point - resizer_point); + return gfx::Vector2d(local_point.x() - element_size.width(), + local_point.y() - element_size.height()); } LayoutSize PaintLayerScrollableArea::MinimumSizeForResizing(float zoom_factor) { @@ -2280,10 +2280,10 @@ float zoom_factor = GetLayoutBox()->StyleRef().EffectiveZoom(); - IntSize new_offset = + gfx::Vector2d new_offset = OffsetFromResizeCorner(document.View()->ConvertFromRootFrame(pos)); - new_offset.set_width(new_offset.width() / zoom_factor); - new_offset.set_height(new_offset.height() / zoom_factor); + new_offset.set_x(new_offset.x() / zoom_factor); + new_offset.set_y(new_offset.y() / zoom_factor); LayoutSize current_size = GetLayoutBox()->Size(); current_size.Scale(1 / zoom_factor); @@ -2291,13 +2291,14 @@ LayoutSize adjusted_old_offset = LayoutSize( old_offset.Width() / zoom_factor, old_offset.Height() / zoom_factor); if (GetLayoutBox()->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { - new_offset.set_width(-new_offset.width()); + new_offset.set_x(-new_offset.x()); adjusted_old_offset.SetWidth(-adjusted_old_offset.Width()); } - LayoutSize difference((current_size + new_offset - adjusted_old_offset) - .ExpandedTo(MinimumSizeForResizing(zoom_factor)) - - current_size); + LayoutSize difference( + (current_size + LayoutSize(new_offset) - adjusted_old_offset) + .ExpandedTo(MinimumSizeForResizing(zoom_factor)) - + current_size); bool is_box_sizing_border = GetLayoutBox()->StyleRef().BoxSizing() == EBoxSizing::kBorderBox; @@ -3037,8 +3038,8 @@ // Returns true if the scroll control is invalidated. static bool ScrollControlNeedsPaintInvalidation( - const IntRect& new_visual_rect, - const IntRect& previous_visual_rect, + const gfx::Rect& new_visual_rect, + const gfx::Rect& previous_visual_rect, bool needs_paint_invalidation) { if (new_visual_rect != previous_visual_rect) return true; @@ -3084,16 +3085,16 @@ GraphicsLayer* graphics_layer, bool& previously_was_overlay, bool& previously_was_directly_composited, - IntRect& visual_rect) { + gfx::Rect& visual_rect) { bool is_overlay = scrollbar && scrollbar->IsOverlayScrollbar(); - IntRect new_visual_rect; + gfx::Rect new_visual_rect; if (scrollbar) { new_visual_rect = scrollbar->FrameRect(); // TODO(crbug.com/1020913): We should not round paint_offset but should // consider subpixel accumulation when painting scrollbars. - new_visual_rect.MoveBy( - ToRoundedPoint(context.fragment_data->PaintOffset())); + new_visual_rect.Offset( + ToRoundedVector2d(context.fragment_data->PaintOffset())); } // Invalidate the box's display item client if the box's padding box size is @@ -3102,10 +3103,10 @@ // false-positives (e.g. the scrollbar changed length but not width) but won't // invalidate more than expected because in the false-positive case the box // must have changed size and have been invalidated. - IntSize new_scrollbar_used_space_in_box; + gfx::Size new_scrollbar_used_space_in_box; if (!is_overlay) new_scrollbar_used_space_in_box = new_visual_rect.size(); - IntSize previous_scrollbar_used_space_in_box; + gfx::Size previous_scrollbar_used_space_in_box; if (!previously_was_overlay) previous_scrollbar_used_space_in_box = visual_rect.size(); @@ -3167,12 +3168,12 @@ vertical_scrollbar_previously_was_directly_composited_, vertical_scrollbar_visual_rect_); - IntRect new_scroll_corner_and_resizer_visual_rect = + gfx::Rect new_scroll_corner_and_resizer_visual_rect = ScrollCornerAndResizerRect(); // TODO(crbug.com/1020913): We should not round paint_offset but should // consider subpixel accumulation when painting scrollbars. - new_scroll_corner_and_resizer_visual_rect.MoveBy( - ToRoundedPoint(context.fragment_data->PaintOffset())); + new_scroll_corner_and_resizer_visual_rect.Offset( + ToRoundedVector2d(context.fragment_data->PaintOffset())); if (ScrollControlNeedsPaintInvalidation( new_scroll_corner_and_resizer_visual_rect, scroll_corner_and_resizer_visual_rect_, @@ -3260,7 +3261,7 @@ GetLayoutBox()->UniqueId(), CompositorElementIdNamespace::kScroll); } -IntSize PaintLayerScrollableArea::PixelSnappedBorderBoxSize() const { +gfx::Size PaintLayerScrollableArea::PixelSnappedBorderBoxSize() const { // TODO(crbug.com/1020913): We use this method during // PositionOverflowControls() even before the paint offset is updated. // This can be fixed only after we support subpixels in overflow control @@ -3270,15 +3271,15 @@ GetLayoutBox()->FirstFragment().PaintOffset()); } -IntRect PaintLayerScrollableArea::ScrollingBackgroundVisualRect( +gfx::Rect PaintLayerScrollableArea::ScrollingBackgroundVisualRect( const PhysicalOffset& paint_offset) const { const auto* box = GetLayoutBox(); auto overflow_clip_rect = - PixelSnappedIntRect(box->OverflowClipRect(paint_offset)); + ToPixelSnappedRect(box->OverflowClipRect(paint_offset)); auto scroll_size = PixelSnappedContentsSize(paint_offset); // Ensure scrolling contents are at least as large as the scroll clip - scroll_size = scroll_size.ExpandedTo(overflow_clip_rect.size()); - IntRect result(overflow_clip_rect.origin(), scroll_size); + scroll_size.SetToMax(overflow_clip_rect.size()); + gfx::Rect result(overflow_clip_rect.origin(), scroll_size); // The HTML element of a document is special, in that it can have a transform, // but the bounds of the painted area of the element still extends beyond @@ -3298,7 +3299,7 @@ document_element_object->FirstFragment().LocalBorderBoxProperties(); const auto& view_contents_state = box->FirstFragment().ContentsProperties(); - IntRect result_in_view = result; + gfx::Rect result_in_view = result; GeometryMapper::SourceToDestinationRect( view_contents_state.Transform(), document_element_state.Transform(), result_in_view);
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h index a7661ee..e437351a 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h
@@ -319,12 +319,12 @@ bool ShouldScrollOnMainThread() const override; bool IsActive() const override; bool IsScrollCornerVisible() const override; - IntRect ScrollCornerRect() const override; + gfx::Rect ScrollCornerRect() const override; void SetScrollbarNeedsPaintInvalidation(ScrollbarOrientation) override; void SetScrollCornerNeedsPaintInvalidation() override; - IntRect ConvertFromScrollbarToContainingEmbeddedContentView( + gfx::Rect ConvertFromScrollbarToContainingEmbeddedContentView( const Scrollbar&, - const IntRect&) const override; + const gfx::Rect&) const override; gfx::Point ConvertFromScrollbarToContainingEmbeddedContentView( const Scrollbar&, const gfx::Point&) const override; @@ -350,15 +350,15 @@ void EnqueueScrollEventIfNeeded(); gfx::Vector2d MinimumScrollOffsetInt() const override; gfx::Vector2d MaximumScrollOffsetInt() const override; - IntRect VisibleContentRect( + gfx::Rect VisibleContentRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override; PhysicalRect VisibleScrollSnapportRect( IncludeScrollbarsInRect = kExcludeScrollbars) const override; - IntSize ContentsSize() const override; + gfx::Size ContentsSize() const override; // Similar to |ContentsSize| but snapped considering |paint_offset| which can // have subpixel accumulation. - IntSize PixelSnappedContentsSize(const PhysicalOffset& paint_offset) const; + gfx::Size PixelSnappedContentsSize(const PhysicalOffset& paint_offset) const; void ContentsResized() override; gfx::Point LastKnownMousePosition() const override; @@ -432,7 +432,7 @@ LayoutCustomScrollbarPart* ScrollCorner() const { return scroll_corner_; } void Resize(const gfx::Point& pos, const LayoutSize& old_offset); - IntSize OffsetFromResizeCorner(const gfx::Point& absolute_point) const; + gfx::Vector2d OffsetFromResizeCorner(const gfx::Point& absolute_point) const; bool InResizeMode() const { return in_resize_mode_; } void SetInResizeMode(bool in_resize_mode) { @@ -472,7 +472,7 @@ bool ScrollsOverflow() const { return scrolls_overflow_; } // Rectangle encompassing the scroll corner and resizer rect. - IntRect ScrollCornerAndResizerRect() const; + gfx::Rect ScrollCornerAndResizerRect() const; // The difference between this function and NeedsCompositedScrolling() is // that this function returns the composited scrolling status based on paint @@ -491,14 +491,14 @@ } #endif - IntRect ResizerCornerRect(ResizerHitTestType) const; + gfx::Rect ResizerCornerRect(ResizerHitTestType) const; PaintLayer* Layer() const override; LayoutCustomScrollbarPart* Resizer() const { return resizer_; } - IntRect RectForHorizontalScrollbar() const; - IntRect RectForVerticalScrollbar() const; + gfx::Rect RectForHorizontalScrollbar() const; + gfx::Rect RectForVerticalScrollbar() const; bool ScheduleAnimation() override; bool ShouldPerformScrollAnchoring() const override; @@ -593,7 +593,7 @@ void Trace(Visitor*) const override; - IntRect ScrollingBackgroundVisualRect( + gfx::Rect ScrollingBackgroundVisualRect( const PhysicalOffset& paint_offset) const; const DisplayItemClient& GetScrollingBackgroundDisplayItemClient() const { return *scrolling_background_display_item_client_; @@ -669,7 +669,7 @@ int VerticalScrollbarStart() const; int HorizontalScrollbarStart() const; - IntSize ScrollbarOffset(const Scrollbar&) const; + gfx::Vector2d ScrollbarOffset(const Scrollbar&) const; // If OverflowIndependent is specified, will only change current scrollbar // existence if the new style doesn't depend on overflow which requires @@ -723,11 +723,11 @@ return *rare_data_; } - IntRect CornerRect() const; + gfx::Rect CornerRect() const; void ScrollControlWasSetNeedsPaintInvalidation() override; - IntSize PixelSnappedBorderBoxSize() const; + gfx::Size PixelSnappedBorderBoxSize() const; using BackgroundPaintLocation = uint8_t; bool ComputeNeedsCompositedScrollingInternal( @@ -741,7 +741,7 @@ GraphicsLayer* graphics_layer, bool& previously_was_overlay, bool& previously_was_directly_composited, - IntRect& visual_rect); + gfx::Rect& visual_rect); // PaintLayer is destructed before PaintLayerScrollable area, during this // time before PaintLayerScrollableArea has been collected layer_ will @@ -828,9 +828,9 @@ bool vertical_scrollbar_previously_was_overlay_ = false; bool horizontal_scrollbar_previously_was_directly_composited_ = false; bool vertical_scrollbar_previously_was_directly_composited_ = false; - IntRect horizontal_scrollbar_visual_rect_; - IntRect vertical_scrollbar_visual_rect_; - IntRect scroll_corner_and_resizer_visual_rect_; + gfx::Rect horizontal_scrollbar_visual_rect_; + gfx::Rect vertical_scrollbar_visual_rect_; + gfx::Rect scroll_corner_and_resizer_visual_rect_; class ScrollingBackgroundDisplayItemClient final : public GarbageCollected<ScrollingBackgroundDisplayItemClient>,
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc index 19e8354a..28105c2 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc
@@ -1161,7 +1161,7 @@ </div> )HTML"); - EXPECT_EQ(IntRect(2, 3, 101, 200), + EXPECT_EQ(gfx::Rect(2, 3, 101, 200), GetLayoutBoxByElementId("scroller") ->GetScrollableArea() ->ScrollingBackgroundVisualRect(PhysicalOffset()));
diff --git a/third_party/blink/renderer/core/paint/paint_layer_test.cc b/third_party/blink/renderer/core/paint/paint_layer_test.cc index 2835eb6..4a1b66cc 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_test.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_test.cc
@@ -108,9 +108,9 @@ EXPECT_EQ(ScrollOffset(200 + scrollbarThickness, 400 + scrollbarThickness), plsa->MaximumScrollOffset()); - EXPECT_EQ(IntRect(0, 0, 800 - scrollbarThickness, 600 - scrollbarThickness), + EXPECT_EQ(gfx::Rect(0, 0, 800 - scrollbarThickness, 600 - scrollbarThickness), plsa->VisibleContentRect()); - EXPECT_EQ(IntRect(0, 0, 800, 600), + EXPECT_EQ(gfx::Rect(0, 0, 800, 600), plsa->VisibleContentRect(kIncludeScrollbars)); }
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc index c14f0bbd..10821bf6 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
@@ -1835,13 +1835,13 @@ const auto& box = To<LayoutBox>(object_); const auto* scrollable_area = box.GetScrollableArea(); - IntRect scroll_controls_bounds = + gfx::Rect scroll_controls_bounds = scrollable_area->ScrollCornerAndResizerRect(); if (const auto* scrollbar = scrollable_area->HorizontalScrollbar()) scroll_controls_bounds.Union(scrollbar->FrameRect()); if (const auto* scrollbar = scrollable_area->VerticalScrollbar()) scroll_controls_bounds.Union(scrollbar->FrameRect()); - IntRect pixel_snapped_border_box_rect( + gfx::Rect pixel_snapped_border_box_rect( gfx::Point(), box.PixelSnappedBorderBoxSize(context_.current.paint_offset)); return !pixel_snapped_border_box_rect.Contains(scroll_controls_bounds); @@ -2142,8 +2142,8 @@ // integer offsets used in CompositedLayerMapping. state.container_rect = ToPixelSnappedRect( box.OverflowClipRect(context_.current.paint_offset)); - state.contents_size = ToGfxSize(scrollable_area->PixelSnappedContentsSize( - context_.current.paint_offset)); + state.contents_size = scrollable_area->PixelSnappedContentsSize( + context_.current.paint_offset); state.user_scrollable_horizontal = scrollable_area->UserInputScrollable(kHorizontalScrollbar);
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc index 654fb1a..4cbefa92 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
@@ -5647,7 +5647,7 @@ EXPECT_CLIP_RECT(gfx::RectF(0, 0, 300, 150), DocContentClip(child_frame_doc)); // When the main frame is printing, it should not have content clip. - FloatSize page_size(100, 100); + gfx::SizeF page_size(100, 100); GetFrame().StartPrinting(page_size, page_size, 1); GetDocument().View()->UpdateLifecyclePhasesForPrinting(); EXPECT_EQ(nullptr, DocContentClip(main_frame_doc)); @@ -6009,7 +6009,7 @@ EXPECT_FALSE(normal->IsFixedPositionObjectInPagedMedia()); EXPECT_EQ(1u, NumFragments(normal)); - FloatSize page_size(300, 400); + gfx::SizeF page_size(300, 400); GetFrame().StartPrinting(page_size, page_size, 1); GetDocument().View()->UpdateLifecyclePhasesForPrinting(); fixed = GetLayoutObjectByElementId("fixed"); @@ -6082,7 +6082,7 @@ EXPECT_FALSE(fixed_child->IsFixedPositionObjectInPagedMedia()); EXPECT_EQ(1u, NumFragments(fixed_child)); - FloatSize page_size(300, 400); + gfx::SizeF page_size(300, 400); GetFrame().StartPrinting(page_size, page_size, 1); GetDocument().View()->UpdateLifecyclePhasesForPrinting(); fixed = GetLayoutObjectByElementId("fixed"); @@ -6159,7 +6159,7 @@ EXPECT_EQ(1u, NumFragments(foot->FirstRow())); EXPECT_EQ(1u, NumFragments(foot->FirstRow()->FirstCell())); - FloatSize page_size(300, 400); + gfx::SizeF page_size(300, 400); GetFrame().StartPrinting(page_size, page_size, 1); GetDocument().View()->UpdateLifecyclePhasesForPrinting(); // In LayoutNG, these may be different objects
diff --git a/third_party/blink/renderer/core/paint/paint_timing_detector.cc b/third_party/blink/renderer/core/paint/paint_timing_detector.cc index a5ff432..e28555c 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/paint_timing_detector.cc
@@ -138,7 +138,7 @@ // TODO(yoav): |image| and |cached_image.GetImage()| are not the same here in // the case of SVGs. Figure out why and if we can remove this footgun. - detector->RecordImage(*object, ToGfxSize(image.Size()), *cached_image, + detector->RecordImage(*object, image.Size(), *cached_image, current_paint_chunk_properties, &style_image, image_border); }
diff --git a/third_party/blink/renderer/core/paint/paint_timing_visualizer.cc b/third_party/blink/renderer/core/paint/paint_timing_visualizer.cc index 7364357..259df0fa 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_visualizer.cc +++ b/third_party/blink/renderer/core/paint/paint_timing_visualizer.cc
@@ -87,7 +87,7 @@ return; ScrollableArea* scrollable_area = frame_view.GetScrollableArea(); DCHECK(scrollable_area); - gfx::Rect viewport_rect = ToGfxRect(scrollable_area->VisibleContentRect()); + gfx::Rect viewport_rect = scrollable_area->VisibleContentRect(); FloatClipRect float_clip_visual_rect((gfx::RectF(viewport_rect))); gfx::RectF float_visual_rect =
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.cc b/third_party/blink/renderer/core/paint/replaced_painter.cc index ae500f1..2c038f66 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.cc +++ b/third_party/blink/renderer/core/paint/replaced_painter.cc
@@ -209,12 +209,12 @@ PhysicalRect selection_painting_rect = layout_replaced_.LocalSelectionVisualRect(); selection_painting_rect.Move(paint_offset); - IntRect selection_painting_int_rect = - PixelSnappedIntRect(selection_painting_rect); + gfx::Rect selection_painting_int_rect = + ToPixelSnappedRect(selection_painting_rect); DrawingRecorder recorder(local_paint_info.context, layout_replaced_, DisplayItem::kSelectionTint, - ToGfxRect(selection_painting_int_rect)); + selection_painting_int_rect); Color selection_bg = HighlightPaintingUtils::HighlightBackgroundColor( layout_replaced_.GetDocument(), layout_replaced_.StyleRef(), layout_replaced_.GetNode(), kPseudoIdSelection);
diff --git a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc index 35d75db..1029006a 100644 --- a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc +++ b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc
@@ -35,7 +35,7 @@ return; gfx::Rect visual_rect = - ToGfxRect(GetScrollableArea().ResizerCornerRect(kResizerForPointer)); + GetScrollableArea().ResizerCornerRect(kResizerForPointer); visual_rect.Offset(paint_offset); if (!cull_rect.Intersects(visual_rect)) return; @@ -59,7 +59,7 @@ // present. Clipping will exclude the right and bottom edges of this frame. if (GetScrollableArea().NeedsScrollCorner()) { GraphicsContextStateSaver state_saver(context); - context.Clip(IntRect(visual_rect)); + context.Clip(visual_rect); gfx::Rect larger_corner = visual_rect; larger_corner.set_size( gfx::Size(larger_corner.width() + 1, larger_corner.height() + 1)); @@ -68,7 +68,7 @@ context.SetFillColor(Color::kTransparent); AutoDarkMode auto_dark_mode(PaintAutoDarkMode( box->StyleRef(), DarkModeFilter::ElementRole::kBackground)); - context.DrawRect(IntRect(larger_corner), auto_dark_mode); + context.DrawRect(larger_corner, auto_dark_mode); } } @@ -80,8 +80,7 @@ if (!box->CanResize()) return; - gfx::Rect touch_rect = - ToGfxRect(scrollable_area_->ResizerCornerRect(kResizerForTouch)); + gfx::Rect touch_rect = scrollable_area_->ResizerCornerRect(kResizerForTouch); touch_rect.Offset(ToRoundedVector2d(paint_offset)); context.GetPaintController().RecordScrollHitTestData( DisplayItemClientForCorner(), DisplayItem::kResizerScrollHitTest, nullptr, @@ -235,7 +234,7 @@ const CullRect& cull_rect) { // TODO(crbug.com/1020913): We should not round paint_offset but should // consider subpixel accumulation when painting scrollbars. - gfx::Rect visual_rect = ToGfxRect(scrollbar.FrameRect()); + gfx::Rect visual_rect = scrollbar.FrameRect(); visual_rect.Offset(paint_offset); if (!cull_rect.Intersects(visual_rect)) return; @@ -284,9 +283,9 @@ void ScrollableAreaPainter::PaintScrollCorner(GraphicsContext& context, const gfx::Vector2d& paint_offset, const CullRect& cull_rect) { - IntRect visual_rect = GetScrollableArea().ScrollCornerRect(); + gfx::Rect visual_rect = GetScrollableArea().ScrollCornerRect(); visual_rect.Offset(paint_offset); - if (!cull_rect.Intersects(ToGfxRect(visual_rect))) + if (!cull_rect.Intersects(visual_rect)) return; if (const auto* scroll_corner = GetScrollableArea().ScrollCorner()) {
diff --git a/third_party/blink/renderer/core/paint/svg_image_painter.cc b/third_party/blink/renderer/core/paint/svg_image_painter.cc index 460ade8..deae67b 100644 --- a/third_party/blink/renderer/core/paint/svg_image_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_image_painter.cc
@@ -59,21 +59,21 @@ void SVGImagePainter::PaintForeground(const PaintInfo& paint_info) { const LayoutImageResource& image_resource = *layout_svg_image_.ImageResource(); - FloatSize image_viewport_size = ComputeImageViewportSize(); + gfx::SizeF image_viewport_size = ComputeImageViewportSize(); image_viewport_size.Scale(layout_svg_image_.StyleRef().EffectiveZoom()); if (image_viewport_size.IsEmpty()) return; scoped_refptr<Image> image = image_resource.GetImage(image_viewport_size); - FloatRect dest_rect(layout_svg_image_.ObjectBoundingBox()); + gfx::RectF dest_rect = layout_svg_image_.ObjectBoundingBox(); auto* image_element = To<SVGImageElement>(layout_svg_image_.GetElement()); RespectImageOrientationEnum respect_orientation = image_resource.ImageOrientation(); - FloatRect src_rect(gfx::PointF(), image->SizeAsFloat(respect_orientation)); + gfx::RectF src_rect(image->SizeAsFloat(respect_orientation)); if (respect_orientation && !image->HasDefaultOrientation()) { // We need the oriented source rect for adjusting the aspect ratio - FloatSize unadjusted_size(src_rect.size()); + gfx::SizeF unadjusted_size = src_rect.size(); image_element->preserveAspectRatio()->CurrentValue()->TransformRect( dest_rect, src_rect); @@ -104,24 +104,24 @@ ImageElementTiming::From(*window).NotifyImagePainted( layout_svg_image_, *image_content, paint_info.context.GetPaintController().CurrentPaintChunkProperties(), - ToGfxRect(EnclosingIntRect(dest_rect))); + gfx::ToEnclosingRect(dest_rect)); } PaintTimingDetector::NotifyImagePaint( - layout_svg_image_, ToGfxSize(image->Size()), *image_content, + layout_svg_image_, image->Size(), *image_content, paint_info.context.GetPaintController().CurrentPaintChunkProperties(), - ToGfxRect(EnclosingIntRect(dest_rect))); + gfx::ToEnclosingRect(dest_rect)); PaintTiming& timing = PaintTiming::From(layout_svg_image_.GetDocument()); timing.MarkFirstContentfulPaint(); } -FloatSize SVGImagePainter::ComputeImageViewportSize() const { +gfx::SizeF SVGImagePainter::ComputeImageViewportSize() const { DCHECK(layout_svg_image_.ImageResource()->HasImage()); if (To<SVGImageElement>(layout_svg_image_.GetElement()) ->preserveAspectRatio() ->CurrentValue() ->Align() != SVGPreserveAspectRatio::kSvgPreserveaspectratioNone) - return FloatSize(layout_svg_image_.ObjectBoundingBox().size()); + return layout_svg_image_.ObjectBoundingBox().size(); ImageResourceContent* cached_image = layout_svg_image_.ImageResource()->CachedImage(); @@ -134,11 +134,11 @@ // Avoid returning the size of the broken image. if (cached_image->ErrorOccurred()) - return FloatSize(); + return gfx::SizeF(); Image* image = cached_image->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(image)) { return svg_image->ConcreteObjectSize( - FloatSize(layout_svg_image_.ObjectBoundingBox().size())); + layout_svg_image_.ObjectBoundingBox().size()); } // The orientation here does not matter. Just use kRespectImageOrientation. return image->SizeAsFloat(kRespectImageOrientation);
diff --git a/third_party/blink/renderer/core/paint/svg_image_painter.h b/third_party/blink/renderer/core/paint/svg_image_painter.h index f7177fa..f65521fb 100644 --- a/third_party/blink/renderer/core/paint/svg_image_painter.h +++ b/third_party/blink/renderer/core/paint/svg_image_painter.h
@@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_SVG_IMAGE_PAINTER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_SVG_IMAGE_PAINTER_H_ -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -25,7 +25,7 @@ private: // Assumes the PaintInfo context has had all local transforms applied. void PaintForeground(const PaintInfo&); - FloatSize ComputeImageViewportSize() const; + gfx::SizeF ComputeImageViewportSize() const; const LayoutSVGImage& layout_svg_image_; };
diff --git a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc index 4ca5281..94839a2 100644 --- a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc
@@ -756,9 +756,10 @@ state_saver.Save(); paint_info.context.ConcatCTM(fragment.BuildFragmentTransform()); } - FloatRect fragment_rect = svg_inline_text_box_.SelectionRectForTextFragment( - fragment, text_match_info.start_position, text_match_info.end_position, - style); + gfx::RectF fragment_rect = + svg_inline_text_box_.SelectionRectForTextFragment( + fragment, text_match_info.start_position, + text_match_info.end_position, style); paint_info.context.SetFillColor(color); paint_info.context.FillRect( fragment_rect,
diff --git a/third_party/blink/renderer/core/paint/table_cell_painter.cc b/third_party/blink/renderer/core/paint/table_cell_painter.cc index 37074a5..5e15045 100644 --- a/third_party/blink/renderer/core/paint/table_cell_painter.cc +++ b/third_party/blink/renderer/core/paint/table_cell_painter.cc
@@ -59,7 +59,7 @@ if (should_clip) { PhysicalRect clip_rect(paint_rect.offset, layout_table_cell_.Size()); clip_rect.Expand(layout_table_cell_.BorderInsets()); - paint_info.context.Clip(PixelSnappedIntRect(clip_rect)); + paint_info.context.Clip(ToPixelSnappedRect(clip_rect)); } BackgroundImageGeometry geometry(layout_table_cell_, &background_object); BoxModelObjectPainter(layout_table_cell_)
diff --git a/third_party/blink/renderer/core/paint/text_control_single_line_painter.cc b/third_party/blink/renderer/core/paint/text_control_single_line_painter.cc index 350d7733..f97a7fb 100644 --- a/third_party/blink/renderer/core/paint/text_control_single_line_painter.cc +++ b/third_party/blink/renderer/core/paint/text_control_single_line_painter.cc
@@ -41,7 +41,7 @@ // Convert the rect into the coords used for painting the content. ScopedPaintState paint_state(text_control_, paint_info); contents_rect.Move(paint_state.PaintOffset()); - IntRect snapped_rect = PixelSnappedIntRect(contents_rect); + gfx::Rect snapped_rect = ToPixelSnappedRect(contents_rect); BoxDrawingRecorder recorder(paint_info.context, text_control_, DisplayItem::kCapsLockIndicator,
diff --git a/third_party/blink/renderer/core/paint/text_decoration_info.cc b/third_party/blink/renderer/core/paint/text_decoration_info.cc index 13ec551..2925ede 100644 --- a/third_party/blink/renderer/core/paint/text_decoration_info.cc +++ b/third_party/blink/renderer/core/paint/text_decoration_info.cc
@@ -287,7 +287,7 @@ return thickness; } -FloatRect TextDecorationInfo::Bounds() const { +gfx::RectF TextDecorationInfo::Bounds() const { gfx::PointF start_point = StartPoint(); switch (DecorationStyle()) { case ETextDecorationStyle::kDotted: @@ -297,34 +297,32 @@ return BoundsForWavy(); case ETextDecorationStyle::kDouble: if (DoubleOffset() > 0) { - return FloatRect(start_point.x(), start_point.y(), width_, - DoubleOffset() + ResolvedThickness()); + return gfx::RectF(start_point.x(), start_point.y(), width_, + DoubleOffset() + ResolvedThickness()); } - return FloatRect(start_point.x(), start_point.y() + DoubleOffset(), - width_, -DoubleOffset() + ResolvedThickness()); + return gfx::RectF(start_point.x(), start_point.y() + DoubleOffset(), + width_, -DoubleOffset() + ResolvedThickness()); case ETextDecorationStyle::kSolid: - return FloatRect(start_point.x(), start_point.y(), width_, - ResolvedThickness()); + return gfx::RectF(start_point.x(), start_point.y(), width_, + ResolvedThickness()); default: break; } NOTREACHED(); - return FloatRect(); + return gfx::RectF(); } -FloatRect TextDecorationInfo::BoundsForDottedOrDashed() const { +gfx::RectF TextDecorationInfo::BoundsForDottedOrDashed() const { StrokeData stroke_data; stroke_data.SetThickness(roundf(ResolvedThickness())); stroke_data.SetStyle(TextDecorationStyleToStrokeStyle(DecorationStyle())); - return FloatRect( - line_data_.stroke_path.value().StrokeBoundingRect(stroke_data)); + return line_data_.stroke_path.value().StrokeBoundingRect(stroke_data); } -FloatRect TextDecorationInfo::BoundsForWavy() const { +gfx::RectF TextDecorationInfo::BoundsForWavy() const { StrokeData stroke_data; stroke_data.SetThickness(ResolvedThickness()); - auto bounding_rect = - FloatRect(line_data_.stroke_path->StrokeBoundingRect(stroke_data)); + auto bounding_rect = line_data_.stroke_path->StrokeBoundingRect(stroke_data); bounding_rect.set_x(StartPoint().x()); bounding_rect.set_width(width_);
diff --git a/third_party/blink/renderer/core/paint/text_decoration_info.h b/third_party/blink/renderer/core/paint/text_decoration_info.h index a1c025be..f3ded68 100644 --- a/third_party/blink/renderer/core/paint/text_decoration_info.h +++ b/third_party/blink/renderer/core/paint/text_decoration_info.h
@@ -97,7 +97,7 @@ float DoubleOffset() const; // Compute bounds for the given line and the current decoration. - FloatRect Bounds() const; + gfx::RectF Bounds() const; // Return a path for current decoration. absl::optional<Path> StrokePath() const; @@ -107,8 +107,8 @@ const TextDecorationThickness& applied_decoration_thickness, const ComputedStyle* decorating_box_style); - FloatRect BoundsForDottedOrDashed() const; - FloatRect BoundsForWavy() const; + gfx::RectF BoundsForDottedOrDashed() const; + gfx::RectF BoundsForWavy() const; float WavyDecorationSizing() const; float ControlPointDistanceFromResolvedThickness() const; float StepFromResolvedThickness() const;
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc index 864a0f01..2e216913 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector_test.cc
@@ -50,7 +50,7 @@ } Document& GetDocument() { return *GetFrame()->GetDocument(); } - IntRect GetViewportRect(LocalFrameView& view) { + gfx::Rect GetViewportRect(LocalFrameView& view) { ScrollableArea* scrollable_area = view.GetScrollableArea(); DCHECK(scrollable_area); return scrollable_area->VisibleContentRect();
diff --git a/third_party/blink/renderer/core/paint/text_painter_base.cc b/third_party/blink/renderer/core/paint/text_painter_base.cc index 55fb7ede..6d14ed7e 100644 --- a/third_party/blink/renderer/core/paint/text_painter_base.cc +++ b/third_party/blink/renderer/core/paint/text_painter_base.cc
@@ -204,10 +204,9 @@ const Vector<Font::TextIntercept>& text_intercepts) { for (auto intercept : text_intercepts) { gfx::PointF clip_origin(text_origin_); - FloatRect clip_rect( + gfx::RectF clip_rect( clip_origin + gfx::Vector2dF(intercept.begin_, upper), - FloatSize(intercept.end_ - intercept.begin_, stripe_width)); - clip_rect.OutsetX(dilation); + gfx::SizeF(intercept.end_ - intercept.begin_, stripe_width)); // We need to ensure the clip rectangle is covering the full underline // extent. For horizontal drawing, using enclosingIntRect would be // sufficient, since we can clamp to full device pixels that way. However, @@ -215,9 +214,9 @@ // integers-equal-device pixels assumption, so vertically inflating by 1 // pixel makes sure we're always covering. This should only be done on the // clipping rectangle, not when computing the glyph intersects. - clip_rect.OutsetY(1.0); + clip_rect.Outset(dilation, 1.0); - if (!clip_rect.IsFinite()) + if (!gfx::RectFToSkRect(clip_rect).isFinite()) continue; graphics_context_.ClipOut(clip_rect); } @@ -370,8 +369,8 @@ if (decoration_info.Style().TextDecorationSkipInk() == ETextDecorationSkipInk::kAuto) { // In order to ignore intersects less than 0.5px, inflate by -0.5. - FloatRect decoration_bounds = decoration_info.Bounds(); - decoration_bounds.OutsetY(-0.5); + gfx::RectF decoration_bounds = decoration_info.Bounds(); + decoration_bounds.Inset(0, 0.5); ClipDecorationsStripe( decoration_info.InkSkipClipUpper(decoration_bounds.y()), decoration_bounds.height(),
diff --git a/third_party/blink/renderer/core/paint/text_painter_test.cc b/third_party/blink/renderer/core/paint/text_painter_test.cc index 2ad04d6..be60d51 100644 --- a/third_party/blink/renderer/core/paint/text_painter_test.cc +++ b/third_party/blink/renderer/core/paint/text_painter_test.cc
@@ -138,7 +138,7 @@ GetDocument().body()->SetInlineStyleProperty( CSSPropertyID::kWebkitPrintColorAdjust, CSSValueID::kEconomy); GetDocument().GetSettings()->SetShouldPrintBackgrounds(false); - FloatSize page_size(500, 800); + gfx::SizeF page_size(500, 800); GetFrame().StartPrinting(page_size, page_size, 1); UpdateAllLifecyclePhasesForTest(); // In LayoutNG, printing currently forces layout tree reattachment, @@ -163,7 +163,7 @@ GetDocument().body()->SetInlineStyleProperty( CSSPropertyID::kWebkitPrintColorAdjust, CSSValueID::kEconomy); GetDocument().GetSettings()->SetShouldPrintBackgrounds(false); - FloatSize page_size(500, 800); + gfx::SizeF page_size(500, 800); GetFrame().StartPrinting(page_size, page_size, 1); GetDocument().View()->UpdateLifecyclePhasesForPrinting(); // In LayoutNG, printing currently forces layout tree reattachment,
diff --git a/third_party/blink/renderer/core/paint/theme_painter.cc b/third_party/blink/renderer/core/paint/theme_painter.cc index 2b01d71a..2a24472 100644 --- a/third_party/blink/renderer/core/paint/theme_painter.cc +++ b/third_party/blink/renderer/core/paint/theme_painter.cc
@@ -88,7 +88,7 @@ // Returns true; Needs CSS painting and/or PaintBorderOnly(). bool ThemePainter::Paint(const LayoutObject& o, const PaintInfo& paint_info, - const IntRect& r) { + const gfx::Rect& r) { Document& doc = o.GetDocument(); const ComputedStyle& style = o.StyleRef(); ControlPart part = o.StyleRef().EffectiveAppearance(); @@ -200,7 +200,7 @@ bool ThemePainter::PaintBorderOnly(const Node* node, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& r) { + const gfx::Rect& r) { DCHECK(style.HasEffectiveAppearance()); DCHECK(node); const Element& element = *To<Element>(node); @@ -242,7 +242,7 @@ const Document& document, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& r) { + const gfx::Rect& r) { DCHECK(node); // Call the appropriate paint method based off the appearance value. switch (style.EffectiveAppearance()) { @@ -277,7 +277,7 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { auto* input = DynamicTo<HTMLInputElement>(o.GetNode()); if (!input) return; @@ -298,28 +298,28 @@ return; bool is_horizontal = part == kSliderHorizontalPart; - IntSize thumb_size; + gfx::Size thumb_size; LayoutObject* thumb_layout_object = input->UserAgentShadowRoot() ->getElementById(shadow_element_names::kIdSliderThumb) ->GetLayoutObject(); if (thumb_layout_object && thumb_layout_object->IsBox()) - thumb_size = FlooredIntSize(To<LayoutBox>(thumb_layout_object)->Size()); + thumb_size = ToFlooredSize(To<LayoutBox>(thumb_layout_object)->Size()); - IntSize tick_size = LayoutTheme::GetTheme().SliderTickSize(); + gfx::Size tick_size = LayoutTheme::GetTheme().SliderTickSize(); float zoom_factor = o.StyleRef().EffectiveZoom(); - FloatRect tick_rect; + gfx::RectF tick_rect; int tick_region_side_margin = 0; int tick_region_width = 0; - IntRect track_bounds; + gfx::Rect track_bounds; LayoutObject* track_layout_object = input->UserAgentShadowRoot() ->getElementById(shadow_element_names::kIdSliderTrack) ->GetLayoutObject(); if (track_layout_object && track_layout_object->IsBox()) { - track_bounds = IntRect( + track_bounds = gfx::Rect( ToCeiledPoint(track_layout_object->FirstFragment().PaintOffset()), - FlooredIntSize(To<LayoutBox>(track_layout_object)->Size())); + ToFlooredSize(To<LayoutBox>(track_layout_object)->Size())); } if (is_horizontal) {
diff --git a/third_party/blink/renderer/core/paint/theme_painter.h b/third_party/blink/renderer/core/paint/theme_painter.h index 5dcc4140..9908a38 100644 --- a/third_party/blink/renderer/core/paint/theme_painter.h +++ b/third_party/blink/renderer/core/paint/theme_painter.h
@@ -26,12 +26,15 @@ #include "third_party/blink/renderer/platform/theme_types.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class Rect; +} + namespace blink { class ComputedStyle; class Document; class Element; -class IntRect; class LayoutObject; class Node; struct PaintInfo; @@ -46,107 +49,109 @@ // LayoutObject. A widget's foreground, e.g., the text of a button, is always // rendered by the engine itself. The boolean return value indicates whether // the CSS border/background should also be painted. - bool Paint(const LayoutObject&, const PaintInfo&, const IntRect&); + bool Paint(const LayoutObject&, const PaintInfo&, const gfx::Rect&); bool PaintBorderOnly(const Node*, const ComputedStyle&, const PaintInfo&, - const IntRect&); + const gfx::Rect&); bool PaintDecorations(const Node*, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&); + const gfx::Rect&); virtual bool PaintCapsLockIndicator(const LayoutObject&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return 0; } - void PaintSliderTicks(const LayoutObject&, const PaintInfo&, const IntRect&); + void PaintSliderTicks(const LayoutObject&, + const PaintInfo&, + const gfx::Rect&); protected: virtual bool PaintCheckbox(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintRadio(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintButton(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintInnerSpinButton(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintTextField(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintTextArea(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintMenuList(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintMenuListButton(const Element& element, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintProgressBar(const Element& element, const LayoutObject&, const PaintInfo&, - const IntRect&, + const gfx::Rect&, const ComputedStyle&) { return true; } virtual bool PaintSliderTrack(const Element& element, const LayoutObject&, const PaintInfo&, - const IntRect&, + const gfx::Rect&, const ComputedStyle&) { return true; } virtual bool PaintSliderThumb(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintSearchField(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } virtual bool PaintSearchFieldCancelButton(const LayoutObject&, const PaintInfo&, - const IntRect&) { + const gfx::Rect&) { return true; } };
diff --git a/third_party/blink/renderer/core/paint/theme_painter_default.cc b/third_party/blink/renderer/core/paint/theme_painter_default.cc index c2ed59888..7f808e4 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_default.cc +++ b/third_party/blink/renderer/core/paint/theme_painter_default.cc
@@ -78,7 +78,9 @@ STACK_ALLOCATED(); public: - DirectionFlippingScope(const LayoutObject&, const PaintInfo&, const IntRect&); + DirectionFlippingScope(const LayoutObject&, + const PaintInfo&, + const gfx::Rect&); ~DirectionFlippingScope(); private: @@ -89,7 +91,7 @@ DirectionFlippingScope::DirectionFlippingScope( const LayoutObject& layout_object, const PaintInfo& paint_info, - const IntRect& rect) + const gfx::Rect& rect) : needs_flipping_(!layout_object.StyleRef().IsLeftToRightDirection()), paint_info_(paint_info) { if (!needs_flipping_) @@ -105,42 +107,43 @@ paint_info_.context.Restore(); } -IntRect DeterminateProgressValueRectFor(const LayoutProgress& layout_progress, - const IntRect& rect) { +gfx::Rect DeterminateProgressValueRectFor(const LayoutProgress& layout_progress, + const gfx::Rect& rect) { int dx = rect.width() * layout_progress.GetPosition(); - return IntRect(rect.x(), rect.y(), dx, rect.height()); + return gfx::Rect(rect.x(), rect.y(), dx, rect.height()); } -IntRect IndeterminateProgressValueRectFor(const LayoutProgress& layout_progress, - const IntRect& rect) { +gfx::Rect IndeterminateProgressValueRectFor( + const LayoutProgress& layout_progress, + const gfx::Rect& rect) { // Value comes from default of GTK+. static const int kProgressActivityBlocks = 5; int value_width = rect.width() / kProgressActivityBlocks; int movable_width = rect.width() - value_width; if (movable_width <= 0) - return IntRect(); + return gfx::Rect(); double progress = layout_progress.AnimationProgress(); if (progress < 0.5) { - return IntRect(rect.x() + progress * 2 * movable_width, rect.y(), - value_width, rect.height()); + return gfx::Rect(rect.x() + progress * 2 * movable_width, rect.y(), + value_width, rect.height()); } - return IntRect(rect.x() + (1.0 - progress) * 2 * movable_width, rect.y(), - value_width, rect.height()); + return gfx::Rect(rect.x() + (1.0 - progress) * 2 * movable_width, rect.y(), + value_width, rect.height()); } -IntRect ProgressValueRectFor(const LayoutProgress& layout_progress, - const IntRect& rect) { +gfx::Rect ProgressValueRectFor(const LayoutProgress& layout_progress, + const gfx::Rect& rect) { return layout_progress.IsDeterminate() ? DeterminateProgressValueRectFor(layout_progress, rect) : IndeterminateProgressValueRectFor(layout_progress, rect); } -IntRect ConvertToPaintingRect(const LayoutObject& input_layout_object, - const LayoutObject& part_layout_object, - PhysicalRect part_rect, - const IntRect& local_offset) { +gfx::Rect ConvertToPaintingRect(const LayoutObject& input_layout_object, + const LayoutObject& part_layout_object, + PhysicalRect part_rect, + const gfx::Rect& local_offset) { // Compute an offset between the partLayoutObject and the inputLayoutObject. PhysicalOffset offset_from_input_layout_object = -part_layout_object.OffsetFromAncestor(&input_layout_object); @@ -149,7 +152,7 @@ // Account for the local drawing offset. part_rect.Move(PhysicalOffset(local_offset.origin())); - return PixelSnappedIntRect(part_rect); + return ToPixelSnappedRect(part_rect); } absl::optional<SkColor> GetAccentColor(const ComputedStyle& style) { @@ -178,7 +181,7 @@ const Document&, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; extra_params.button = WebThemeEngine::ButtonExtraParams(); extra_params.button.checked = IsChecked(element); @@ -201,7 +204,7 @@ const Document&, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; extra_params.button = WebThemeEngine::ButtonExtraParams(); extra_params.button.checked = IsChecked(element); @@ -223,7 +226,7 @@ const Document&, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; extra_params.button = WebThemeEngine::ButtonExtraParams(); extra_params.button.has_border = true; @@ -236,15 +239,15 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartButton, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } bool ThemePainterDefault::PaintTextField(const Element& element, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { // WebThemeEngine does not handle border rounded corner and background image // so return true to draw CSS border and background. if (style.HasBorderRadius() || style.HasBackgroundImage()) @@ -266,8 +269,8 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartTextField, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } @@ -275,7 +278,7 @@ const Document& document, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; // Match Chromium Win behaviour of showing all borders if any are shown. extra_params.menu_list.has_border = style.HasBorder(); @@ -301,8 +304,8 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartMenuList, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } @@ -310,7 +313,7 @@ const Document& document, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; extra_params.menu_list.has_border = false; extra_params.menu_list.has_border_radius = style.HasBorderRadius(); @@ -320,15 +323,15 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartMenuList, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } void ThemePainterDefault::SetupMenuListArrow( const Document& document, const ComputedStyle& style, - const IntRect& rect, + const gfx::Rect& rect, WebThemeEngine::ExtraParams& extra_params) { const int left = rect.x() + floorf(style.BorderLeftWidth()); const int right = rect.x() + rect.width() - floorf(style.BorderRightWidth()); @@ -356,7 +359,7 @@ bool ThemePainterDefault::PaintSliderTrack(const Element& element, const LayoutObject& layout_object, const PaintInfo& paint_info, - const IntRect& rect, + const gfx::Rect& rect, const ComputedStyle& style) { WebThemeEngine::ExtraParams extra_params; extra_params.slider.vertical = @@ -377,7 +380,7 @@ LayoutBox* thumb = thumb_element ? thumb_element->GetLayoutBox() : nullptr; LayoutBox* input_box = input->GetLayoutBox(); if (thumb) { - IntRect thumb_rect = PixelSnappedIntRect(thumb->FrameRect()); + gfx::Rect thumb_rect = ToPixelSnappedRect(thumb->FrameRect()); extra_params.slider.thumb_x = thumb_rect.x() + input_box->PaddingLeft().ToInt() + input_box->BorderLeft().ToInt(); @@ -389,15 +392,15 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartSliderTrack, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } bool ThemePainterDefault::PaintSliderThumb(const Element& element, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; extra_params.slider.vertical = style.EffectiveAppearance() == kSliderThumbVerticalPart; @@ -416,15 +419,15 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartSliderThumb, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), accent_color); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + accent_color); return false; } bool ThemePainterDefault::PaintInnerSpinButton(const Element& element, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { WebThemeEngine::ExtraParams extra_params; bool spin_up = false; @@ -442,21 +445,21 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartInnerSpinButton, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } bool ThemePainterDefault::PaintProgressBar(const Element& element, const LayoutObject& layout_object, const PaintInfo& paint_info, - const IntRect& rect, + const gfx::Rect& rect, const ComputedStyle& style) { const auto* layout_progress = DynamicTo<LayoutProgress>(layout_object); if (!layout_progress) return true; - IntRect value_rect = ProgressValueRectFor(*layout_progress, rect); + gfx::Rect value_rect = ProgressValueRectFor(*layout_progress, rect); WebThemeEngine::ExtraParams extra_params; extra_params.progress_bar.determinate = layout_progress->IsDeterminate(); @@ -469,29 +472,29 @@ DirectionFlippingScope scope(layout_object, paint_info, rect); Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartProgressBar, - GetWebThemeState(element), ToGfxRect(rect), &extra_params, - style.UsedColorScheme(), GetAccentColor(style)); + GetWebThemeState(element), rect, &extra_params, style.UsedColorScheme(), + GetAccentColor(style)); return false; } bool ThemePainterDefault::PaintTextArea(const Element& element, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { return PaintTextField(element, style, paint_info, rect); } bool ThemePainterDefault::PaintSearchField(const Element& element, const ComputedStyle& style, const PaintInfo& paint_info, - const IntRect& rect) { + const gfx::Rect& rect) { return PaintTextField(element, style, paint_info, rect); } bool ThemePainterDefault::PaintSearchFieldCancelButton( const LayoutObject& cancel_button_object, const PaintInfo& paint_info, - const IntRect& r) { + const gfx::Rect& r) { // Get the layoutObject of <input> element. Node* input = cancel_button_object.GetNode()->OwnerShadowHost(); const LayoutObject& base_layout_object = input && input->GetLayoutObject() @@ -515,7 +518,7 @@ input_content_box.Y() + (input_content_box.Height() - cancel_button_size + 1) / 2, cancel_button_size, cancel_button_size); - IntRect painting_rect = ConvertToPaintingRect( + gfx::Rect painting_rect = ConvertToPaintingRect( input_layout_box, cancel_button_object, cancel_button_rect, r); mojom::blink::ColorScheme color_scheme = cancel_button_object.StyleRef().UsedColorScheme(); @@ -569,16 +572,16 @@ Image::kSyncDecode, PaintAutoDarkMode(cancel_button_object.StyleRef(), DarkModeFilter::ElementRole::kBackground), - FloatRect(painting_rect)); + gfx::RectF(painting_rect)); return false; } gfx::Rect ThemePainterDefault::ApplyZoomToRect( - const IntRect& rect, + const gfx::Rect& rect, const PaintInfo& paint_info, GraphicsContextStateSaver& state_saver, float zoom_level) { - gfx::Rect unzoomed_rect = ToGfxRect(rect); + gfx::Rect unzoomed_rect = rect; if (zoom_level != 1) { state_saver.Save(); unzoomed_rect.set_width(unzoomed_rect.width() / zoom_level);
diff --git a/third_party/blink/renderer/core/paint/theme_painter_default.h b/third_party/blink/renderer/core/paint/theme_painter_default.h index e7ed507..703215d 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_default.h +++ b/third_party/blink/renderer/core/paint/theme_painter_default.h
@@ -46,67 +46,67 @@ const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintRadio(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintButton(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintTextField(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintMenuList(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintMenuListButton(const Element&, const Document&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintSliderTrack(const Element& element, const LayoutObject&, const PaintInfo&, - const IntRect&, + const gfx::Rect&, const ComputedStyle&) override; bool PaintSliderThumb(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintInnerSpinButton(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintProgressBar(const Element& element, const LayoutObject&, const PaintInfo&, - const IntRect&, + const gfx::Rect&, const ComputedStyle&) override; bool PaintTextArea(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintSearchField(const Element&, const ComputedStyle&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; bool PaintSearchFieldCancelButton(const LayoutObject&, const PaintInfo&, - const IntRect&) override; + const gfx::Rect&) override; void SetupMenuListArrow(const Document&, const ComputedStyle&, - const IntRect&, + const gfx::Rect&, WebThemeEngine::ExtraParams&); - gfx::Rect ApplyZoomToRect(const IntRect&, + gfx::Rect ApplyZoomToRect(const gfx::Rect&, const PaintInfo&, GraphicsContextStateSaver&, float zoom_level);
diff --git a/third_party/blink/renderer/core/paint/video_painter.cc b/third_party/blink/renderer/core/paint/video_painter.cc index 92ff3de..b2d963f 100644 --- a/third_party/blink/renderer/core/paint/video_painter.cc +++ b/third_party/blink/renderer/core/paint/video_painter.cc
@@ -37,7 +37,7 @@ PhysicalRect replaced_rect = layout_video_.ReplacedContentRect(); replaced_rect.Move(paint_offset); - IntRect snapped_replaced_rect = PixelSnappedIntRect(replaced_rect); + gfx::Rect snapped_replaced_rect = ToPixelSnappedRect(replaced_rect); if (snapped_replaced_rect.IsEmpty()) return; @@ -80,7 +80,7 @@ !force_software_video_paint; if (paint_with_foreign_layer) { if (cc::Layer* layer = layout_video_.MediaElement()->CcLayer()) { - layer->SetBounds(ToGfxSize(snapped_replaced_rect.size())); + layer->SetBounds(snapped_replaced_rect.size()); layer->SetIsDrawable(true); layer->SetHitTestable(true); RecordForeignLayer(context, layout_video_,
diff --git a/third_party/blink/renderer/core/paint/view_painter.cc b/third_party/blink/renderer/core/paint/view_painter.cc index dc68a8e..00c9198 100644 --- a/third_party/blink/renderer/core/paint/view_painter.cc +++ b/third_party/blink/renderer/core/paint/view_painter.cc
@@ -41,7 +41,7 @@ // BaseBackgroundColor on the LocalFrameView. // https://drafts.fxtf.org/compositing/#rootgroup void ViewPainter::PaintRootGroup(const PaintInfo& paint_info, - const IntRect& pixel_snapped_background_rect, + const gfx::Rect& pixel_snapped_background_rect, const Document& document, const DisplayItemClient& client, const PropertyTreeStateOrAlias& state) { @@ -62,7 +62,7 @@ context, client, DisplayItem::kDocumentRootBackdrop)) { DrawingRecorder recorder(context, client, DisplayItem::kDocumentRootBackdrop, - ToGfxRect(pixel_snapped_background_rect)); + pixel_snapped_background_rect); context.FillRect( pixel_snapped_background_rect, base_background_color, PaintAutoDarkMode(layout_view_.StyleRef(), @@ -132,7 +132,7 @@ ->GetScrollingBackgroundDisplayItemClient(); } - IntRect pixel_snapped_background_rect(PixelSnappedIntRect(background_rect)); + gfx::Rect pixel_snapped_background_rect = ToPixelSnappedRect(background_rect); auto root_element_background_painting_state = layout_view_.FirstFragment().ContentsProperties(); @@ -241,7 +241,7 @@ // possible. void ViewPainter::PaintRootElementGroup( const PaintInfo& paint_info, - const IntRect& pixel_snapped_background_rect, + const gfx::Rect& pixel_snapped_background_rect, const PropertyTreeStateOrAlias& background_paint_state, const DisplayItemClient& background_client, bool painted_separate_backdrop, @@ -253,7 +253,7 @@ } DrawingRecorder recorder(context, background_client, DisplayItem::kDocumentBackground, - ToGfxRect(pixel_snapped_background_rect)); + pixel_snapped_background_rect); const Document& document = layout_view_.GetDocument(); const LocalFrameView& frame_view = *layout_view_.GetFrameView(); @@ -293,7 +293,7 @@ // transforms apply. The strategy is to issue draw commands in the root // element's local space, which requires mapping the document background rect. bool background_renderable = true; - IntRect paint_rect = pixel_snapped_background_rect; + gfx::Rect paint_rect = pixel_snapped_background_rect; // Offset for BackgroundImageGeometry to offset the image's origin. This makes // background tiling start at the root element's origin instead of the view. // This is different from the offset for painting, which is in |paint_rect|. @@ -338,7 +338,7 @@ return; } - recorder.UniteVisualRect(ToGfxRect(paint_rect)); + recorder.UniteVisualRect(paint_rect); BoxPainterBase::FillLayerOcclusionOutputList reversed_paint_list; bool should_draw_background_in_separate_buffer =
diff --git a/third_party/blink/renderer/core/paint/view_painter.h b/third_party/blink/renderer/core/paint/view_painter.h index 991c1cf6..63abe9f 100644 --- a/third_party/blink/renderer/core/paint/view_painter.h +++ b/third_party/blink/renderer/core/paint/view_painter.h
@@ -7,12 +7,15 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class Rect; +} + namespace blink { struct PaintInfo; class DisplayItemClient; class Document; -class IntRect; class LayoutView; class PropertyTreeStateOrAlias; @@ -30,14 +33,14 @@ void PaintRootElementGroup( const PaintInfo&, - const IntRect& pixel_snapped_background_rect, + const gfx::Rect& pixel_snapped_background_rect, const PropertyTreeStateOrAlias& background_paint_state, const DisplayItemClient& background_client, bool painted_separate_backdrop, bool painted_separate_effect); void PaintRootGroup(const PaintInfo& paint_info, - const IntRect& pixel_snapped_background_rect, + const gfx::Rect& pixel_snapped_background_rect, const Document&, const DisplayItemClient& background_client, const PropertyTreeStateOrAlias& state);
diff --git a/third_party/blink/renderer/core/scroll/scroll_animator_test.cc b/third_party/blink/renderer/core/scroll/scroll_animator_test.cc index 423c5d8..c92db9a5 100644 --- a/third_party/blink/renderer/core/scroll/scroll_animator_test.cc +++ b/third_party/blink/renderer/core/scroll/scroll_animator_test.cc
@@ -75,13 +75,13 @@ MOCK_CONST_METHOD0(IsThrottled, bool()); MOCK_CONST_METHOD1(ScrollSize, int(ScrollbarOrientation)); MOCK_CONST_METHOD0(IsScrollCornerVisible, bool()); - MOCK_CONST_METHOD0(ScrollCornerRect, IntRect()); + MOCK_CONST_METHOD0(ScrollCornerRect, gfx::Rect()); MOCK_METHOD2(UpdateScrollOffset, void(const ScrollOffset&, mojom::blink::ScrollType)); MOCK_METHOD0(ScrollControlWasSetNeedsPaintInvalidation, void()); MOCK_CONST_METHOD0(EnclosingScrollableArea, ScrollableArea*()); - MOCK_CONST_METHOD1(VisibleContentRect, IntRect(IncludeScrollbarsInRect)); - MOCK_CONST_METHOD0(ContentsSize, IntSize()); + MOCK_CONST_METHOD1(VisibleContentRect, gfx::Rect(IncludeScrollbarsInRect)); + MOCK_CONST_METHOD0(ContentsSize, gfx::Size()); MOCK_CONST_METHOD0(ScrollbarsCanBeActive, bool()); MOCK_METHOD0(RegisterForAnimation, void()); MOCK_METHOD0(ScheduleAnimation, bool());
diff --git a/third_party/blink/renderer/core/scroll/scrollable_area.cc b/third_party/blink/renderer/core/scroll/scrollable_area.cc index 70b2169..b146a86 100644 --- a/third_party/blink/renderer/core/scroll/scrollable_area.cc +++ b/third_party/blink/renderer/core/scroll/scrollable_area.cc
@@ -871,7 +871,7 @@ // use the snapport rect to calculate the page step instead of the visible // rect. // [1] https://drafts.csswg.org/css-scroll-snap/#scroll-padding - IntSize snapport_size = + gfx::Size snapport_size = VisibleScrollSnapportRect(kExcludeScrollbars).PixelSnappedSize(); int length = (orientation == kHorizontalScrollbar) ? snapport_size.width() : snapport_size.height(); @@ -922,9 +922,9 @@ return result; } -IntSize ScrollableArea::ExcludeScrollbars(const IntSize& size) const { - return IntSize(std::max(0, size.width() - VerticalScrollbarWidth()), - std::max(0, size.height() - HorizontalScrollbarHeight())); +gfx::Size ScrollableArea::ExcludeScrollbars(const gfx::Size& size) const { + return gfx::Size(std::max(0, size.width() - VerticalScrollbarWidth()), + std::max(0, size.height() - HorizontalScrollbarHeight())); } void ScrollableArea::DidCompositorScroll(const gfx::PointF& position) {
diff --git a/third_party/blink/renderer/core/scroll/scrollable_area.h b/third_party/blink/renderer/core/scroll/scrollable_area.h index 623e658..ee218af 100644 --- a/third_party/blink/renderer/core/scroll/scrollable_area.h +++ b/third_party/blink/renderer/core/scroll/scrollable_area.h
@@ -273,7 +273,7 @@ virtual bool IsThrottled() const = 0; virtual int ScrollSize(ScrollbarOrientation) const = 0; virtual bool IsScrollCornerVisible() const = 0; - virtual IntRect ScrollCornerRect() const = 0; + virtual gfx::Rect ScrollCornerRect() const = 0; virtual bool HasTickmarks() const { return false; } virtual Vector<IntRect> GetTickmarks() const { return Vector<IntRect>(); } @@ -292,11 +292,11 @@ // Convert points and rects between the scrollbar and its containing // EmbeddedContentView. The client needs to implement these in order to be // aware of layout effects like CSS transforms. - virtual IntRect ConvertFromScrollbarToContainingEmbeddedContentView( + virtual gfx::Rect ConvertFromScrollbarToContainingEmbeddedContentView( const Scrollbar& scrollbar, - const IntRect& scrollbar_rect) const { - IntRect local_rect = scrollbar_rect; - local_rect.MoveBy(scrollbar.Location()); + const gfx::Rect& scrollbar_rect) const { + gfx::Rect local_rect = scrollbar_rect; + local_rect.Offset(scrollbar.Location().OffsetFromOrigin()); return local_rect; } virtual gfx::Point ConvertFromContainingEmbeddedContentViewToScrollbar( @@ -362,11 +362,11 @@ return ScrollOffset(MaximumScrollOffsetInt()); } - virtual IntRect VisibleContentRect( + virtual gfx::Rect VisibleContentRect( IncludeScrollbarsInRect = kExcludeScrollbars) const = 0; virtual int VisibleHeight() const { return VisibleContentRect().height(); } virtual int VisibleWidth() const { return VisibleContentRect().width(); } - virtual IntSize ContentsSize() const = 0; + virtual gfx::Size ContentsSize() const = 0; // scroll snapport is the area of the scrollport that is used as the alignment // container for the scroll snap areas when calculating snap positions. It's @@ -487,7 +487,7 @@ // Subtracts space occupied by this ScrollableArea's scrollbars. // Does nothing if overlay scrollbars are enabled. - IntSize ExcludeScrollbars(const IntSize&) const; + gfx::Size ExcludeScrollbars(const gfx::Size&) const; virtual int VerticalScrollbarWidth( OverlayScrollbarClipBehavior = kIgnoreOverlayScrollbarSize) const;
diff --git a/third_party/blink/renderer/core/scroll/scrollbar.cc b/third_party/blink/renderer/core/scroll/scrollbar.cc index 199243e..98013c7 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar.cc
@@ -74,7 +74,7 @@ theme_.RegisterScrollbar(*this); int thickness = theme_.ScrollbarThickness(ScaleFromDIP(), CSSScrollbarWidth()); - frame_rect_ = IntRect(0, 0, thickness, thickness); + frame_rect_ = gfx::Rect(0, 0, thickness, thickness); current_pos_ = ScrollableAreaCurrentPos(); } @@ -87,7 +87,7 @@ DisplayItemClient::Trace(visitor); } -void Scrollbar::SetFrameRect(const IntRect& frame_rect) { +void Scrollbar::SetFrameRect(const gfx::Rect& frame_rect) { if (frame_rect == frame_rect_) return; @@ -747,8 +747,8 @@ return point_in_root_frame; } -IntRect Scrollbar::ConvertToContainingEmbeddedContentView( - const IntRect& local_rect) const { +gfx::Rect Scrollbar::ConvertToContainingEmbeddedContentView( + const gfx::Rect& local_rect) const { if (scrollable_area_) { return scrollable_area_ ->ConvertFromScrollbarToContainingEmbeddedContentView(*this,
diff --git a/third_party/blink/renderer/core/scroll/scrollbar.h b/third_party/blink/renderer/core/scroll/scrollbar.h index 2a01ec6..4849f6e3 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar.h +++ b/third_party/blink/renderer/core/scroll/scrollbar.h
@@ -68,11 +68,11 @@ int Y() const { return frame_rect_.y(); } int Width() const { return frame_rect_.width(); } int Height() const { return frame_rect_.height(); } - IntSize Size() const { return frame_rect_.size(); } + gfx::Size Size() const { return frame_rect_.size(); } gfx::Point Location() const { return frame_rect_.origin(); } - void SetFrameRect(const IntRect&); - const IntRect& FrameRect() const { return frame_rect_; } + void SetFrameRect(const gfx::Rect&); + const gfx::Rect& FrameRect() const { return frame_rect_; } ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const; bool HasTickmarks() const; @@ -150,7 +150,7 @@ ScrollbarTheme& GetTheme() const { return theme_; } - IntRect ConvertToContainingEmbeddedContentView(const IntRect&) const; + gfx::Rect ConvertToContainingEmbeddedContentView(const gfx::Rect&) const; gfx::Point ConvertFromContainingEmbeddedContentView(const gfx::Point&) const; void MoveThumb(int pos, bool dragging_document = false); @@ -261,7 +261,7 @@ // additional state is necessary. bool scrollbar_manipulation_in_progress_on_cc_thread_; - IntRect frame_rect_; + gfx::Rect frame_rect_; Member<Element> style_source_; // Tracks scroll delta that has been injected into the compositor thread as a
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.cc b/third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.cc index 8ae9f8d..72d778fd 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.cc
@@ -75,15 +75,15 @@ } gfx::Rect ScrollbarLayerDelegate::ThumbRect() const { - IntRect track_rect = scrollbar_->GetTheme().ThumbRect(*scrollbar_); - track_rect.Offset(-ToIntSize(scrollbar_->Location())); - return ToGfxRect(track_rect); + gfx::Rect track_rect = scrollbar_->GetTheme().ThumbRect(*scrollbar_); + track_rect.Offset(-scrollbar_->Location().OffsetFromOrigin()); + return track_rect; } gfx::Rect ScrollbarLayerDelegate::TrackRect() const { - IntRect track_rect = scrollbar_->GetTheme().TrackRect(*scrollbar_); - track_rect.Offset(-ToIntSize(scrollbar_->Location())); - return ToGfxRect(track_rect); + gfx::Rect track_rect = scrollbar_->GetTheme().TrackRect(*scrollbar_); + track_rect.Offset(-scrollbar_->Location().OffsetFromOrigin()); + return track_rect; } bool ScrollbarLayerDelegate::SupportsDragSnapBack() const { @@ -95,18 +95,19 @@ } gfx::Rect ScrollbarLayerDelegate::BackButtonRect() const { - IntRect back_button_rect = scrollbar_->GetTheme().BackButtonRect(*scrollbar_); + gfx::Rect back_button_rect = + scrollbar_->GetTheme().BackButtonRect(*scrollbar_); if (!back_button_rect.IsEmpty()) - back_button_rect.Offset(-ToIntSize(scrollbar_->Location())); - return ToGfxRect(back_button_rect); + back_button_rect.Offset(-scrollbar_->Location().OffsetFromOrigin()); + return back_button_rect; } gfx::Rect ScrollbarLayerDelegate::ForwardButtonRect() const { - IntRect forward_button_rect = + gfx::Rect forward_button_rect = scrollbar_->GetTheme().ForwardButtonRect(*scrollbar_); if (!forward_button_rect.IsEmpty()) - forward_button_rect.Offset(-ToIntSize(scrollbar_->Location())); - return ToGfxRect(forward_button_rect); + forward_button_rect.Offset(-scrollbar_->Location().OffsetFromOrigin()); + return forward_button_rect; } float ScrollbarLayerDelegate::Opacity() const { @@ -125,13 +126,12 @@ gfx::Size ScrollbarLayerDelegate::NinePatchThumbCanvasSize() const { DCHECK(scrollbar_->GetTheme().UsesNinePatchThumbResource()); - return ToGfxSize( - scrollbar_->GetTheme().NinePatchThumbCanvasSize(*scrollbar_)); + return scrollbar_->GetTheme().NinePatchThumbCanvasSize(*scrollbar_); } gfx::Rect ScrollbarLayerDelegate::NinePatchThumbAperture() const { DCHECK(scrollbar_->GetTheme().UsesNinePatchThumbResource()); - return ToGfxRect(scrollbar_->GetTheme().NinePatchThumbAperture(*scrollbar_)); + return scrollbar_->GetTheme().NinePatchThumbAperture(*scrollbar_); } bool ScrollbarLayerDelegate::ShouldPaint() const { @@ -164,11 +164,11 @@ // The canvas coordinate space is relative to the part's origin. switch (part) { case cc::ScrollbarPart::THUMB: - theme.PaintThumb(painter.Context(), *scrollbar_, IntRect(rect)); + theme.PaintThumb(painter.Context(), *scrollbar_, gfx::Rect(rect)); scrollbar_->ClearThumbNeedsRepaint(); break; case cc::ScrollbarPart::TRACK_BUTTONS_TICKMARKS: { - DCHECK_EQ(IntSize(rect.size()), scrollbar_->FrameRect().size()); + DCHECK_EQ(rect.size(), scrollbar_->FrameRect().size()); gfx::Vector2d offset = rect.origin() - scrollbar_->FrameRect().origin(); theme.PaintTrackButtonsTickmarks(painter.Context(), *scrollbar_, offset); scrollbar_->ClearTrackNeedsRepaint();
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_test_suite.h b/third_party/blink/renderer/core/scroll/scrollbar_test_suite.h index 0fb755f..d66981f 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_test_suite.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_test_suite.h
@@ -63,10 +63,10 @@ MOCK_CONST_METHOD0(IsThrottled, bool()); MOCK_CONST_METHOD1(ScrollSize, int(ScrollbarOrientation)); MOCK_CONST_METHOD0(IsScrollCornerVisible, bool()); - MOCK_CONST_METHOD0(ScrollCornerRect, IntRect()); + MOCK_CONST_METHOD0(ScrollCornerRect, gfx::Rect()); MOCK_CONST_METHOD0(EnclosingScrollableArea, ScrollableArea*()); - MOCK_CONST_METHOD1(VisibleContentRect, IntRect(IncludeScrollbarsInRect)); - MOCK_CONST_METHOD0(ContentsSize, IntSize()); + MOCK_CONST_METHOD1(VisibleContentRect, gfx::Rect(IncludeScrollbarsInRect)); + MOCK_CONST_METHOD0(ContentsSize, gfx::Size()); MOCK_CONST_METHOD0(LayerForHorizontalScrollbar, cc::Layer*()); MOCK_CONST_METHOD0(LayerForVerticalScrollbar, cc::Layer*()); MOCK_CONST_METHOD0(HorizontalScrollbar, Scrollbar*());
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme.cc index dd7422c..8f57d3a7 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme.cc
@@ -52,7 +52,7 @@ PaintTrackButtonsTickmarks(graphics_context, scrollbar, paint_offset); if (HasThumb(scrollbar)) { - IntRect thumb_rect = ThumbRect(scrollbar); + gfx::Rect thumb_rect = ThumbRect(scrollbar); thumb_rect.Offset(paint_offset); PaintThumbWithOpacity(graphics_context, scrollbar, thumb_rect); } @@ -78,11 +78,11 @@ if (!scrollbar.FrameRect().Contains(test_position)) return kNoPart; - IntRect track = TrackRect(scrollbar); + gfx::Rect track = TrackRect(scrollbar); if (track.Contains(test_position)) { - IntRect before_thumb_rect; - IntRect thumb_rect; - IntRect after_thumb_rect; + gfx::Rect before_thumb_rect; + gfx::Rect thumb_rect; + gfx::Rect after_thumb_rect; SplitTrack(scrollbar, track, before_thumb_rect, thumb_rect, after_thumb_rect); if (thumb_rect.Contains(test_position)) @@ -106,7 +106,7 @@ GraphicsContext& context, const Scrollbar* vertical_scrollbar, const DisplayItemClient& display_item_client, - const IntRect& corner_rect, + const gfx::Rect& corner_rect, mojom::blink::ColorScheme color_scheme) { if (corner_rect.IsEmpty()) return; @@ -116,20 +116,19 @@ return; DrawingRecorder recorder(context, display_item_client, - DisplayItem::kScrollCorner, ToGfxRect(corner_rect)); + DisplayItem::kScrollCorner, corner_rect); #if defined(OS_MAC) context.FillRect(corner_rect, Color::kWhite, AutoDarkMode::Disabled()); #else Platform::Current()->ThemeEngine()->Paint( context.Canvas(), WebThemeEngine::kPartScrollbarCorner, - WebThemeEngine::kStateNormal, ToGfxRect(corner_rect), nullptr, - color_scheme); + WebThemeEngine::kStateNormal, corner_rect, nullptr, color_scheme); #endif } void ScrollbarTheme::PaintTickmarks(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { // Android paints tickmarks in the browser at FindResultBar.java. #if !defined(OS_ANDROID) if (scrollbar.Orientation() != kVerticalScrollbar) @@ -147,7 +146,7 @@ return; DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarTickmarks, - ToGfxRect(rect)); + rect); GraphicsContextStateSaver state_saver(context); context.SetShouldAntialias(false); @@ -159,12 +158,12 @@ // Calculate how far down (in pixels) the tick-mark should appear. const int y_pos = rect.y() + (rect.height() * percent); - FloatRect tick_rect(rect.x(), y_pos, rect.width(), 3); + gfx::RectF tick_rect(rect.x(), y_pos, rect.width(), 3); context.FillRect(tick_rect, Color(0xB0, 0x60, 0x00, 0xFF), AutoDarkMode::Disabled()); - FloatRect tick_stroke(rect.x() + TickmarkBorderWidth(), y_pos + 1, - rect.width() - 2 * TickmarkBorderWidth(), 1); + gfx::RectF tick_stroke(rect.x() + TickmarkBorderWidth(), y_pos + 1, + rect.width() - 2 * TickmarkBorderWidth(), 1); context.FillRect(tick_stroke, Color(0xFF, 0xDD, 0x00, 0xFF), AutoDarkMode::Disabled()); } @@ -216,7 +215,7 @@ } int ScrollbarTheme::TrackPosition(const Scrollbar& scrollbar) { - IntRect constrained_track_rect = + gfx::Rect constrained_track_rect = ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar)); return (scrollbar.Orientation() == kHorizontalScrollbar) ? constrained_track_rect.x() - scrollbar.X() @@ -224,52 +223,52 @@ } int ScrollbarTheme::TrackLength(const Scrollbar& scrollbar) { - IntRect constrained_track_rect = + gfx::Rect constrained_track_rect = ConstrainTrackRectToTrackPieces(scrollbar, TrackRect(scrollbar)); return (scrollbar.Orientation() == kHorizontalScrollbar) ? constrained_track_rect.width() : constrained_track_rect.height(); } -IntRect ScrollbarTheme::ThumbRect(const Scrollbar& scrollbar) { +gfx::Rect ScrollbarTheme::ThumbRect(const Scrollbar& scrollbar) { if (!HasThumb(scrollbar)) - return IntRect(); + return gfx::Rect(); - IntRect track = TrackRect(scrollbar); - IntRect start_track_rect; - IntRect thumb_rect; - IntRect end_track_rect; + gfx::Rect track = TrackRect(scrollbar); + gfx::Rect start_track_rect; + gfx::Rect thumb_rect; + gfx::Rect end_track_rect; SplitTrack(scrollbar, track, start_track_rect, thumb_rect, end_track_rect); return thumb_rect; } void ScrollbarTheme::SplitTrack(const Scrollbar& scrollbar, - const IntRect& unconstrained_track_rect, - IntRect& before_thumb_rect, - IntRect& thumb_rect, - IntRect& after_thumb_rect) { + const gfx::Rect& unconstrained_track_rect, + gfx::Rect& before_thumb_rect, + gfx::Rect& thumb_rect, + gfx::Rect& after_thumb_rect) { // This function won't even get called unless we're big enough to have some // combination of these three rects where at least one of them is non-empty. - IntRect track_rect = + gfx::Rect track_rect = ConstrainTrackRectToTrackPieces(scrollbar, unconstrained_track_rect); int thumb_pos = ThumbPosition(scrollbar); if (scrollbar.Orientation() == kHorizontalScrollbar) { - thumb_rect = IntRect(track_rect.x() + thumb_pos, track_rect.y(), - ThumbLength(scrollbar), scrollbar.Height()); + thumb_rect = gfx::Rect(track_rect.x() + thumb_pos, track_rect.y(), + ThumbLength(scrollbar), scrollbar.Height()); before_thumb_rect = - IntRect(track_rect.x(), track_rect.y(), - thumb_pos + thumb_rect.width() / 2, track_rect.height()); - after_thumb_rect = IntRect( + gfx::Rect(track_rect.x(), track_rect.y(), + thumb_pos + thumb_rect.width() / 2, track_rect.height()); + after_thumb_rect = gfx::Rect( track_rect.x() + before_thumb_rect.width(), track_rect.y(), track_rect.right() - before_thumb_rect.right(), track_rect.height()); } else { - thumb_rect = IntRect(track_rect.x(), track_rect.y() + thumb_pos, - scrollbar.Width(), ThumbLength(scrollbar)); + thumb_rect = gfx::Rect(track_rect.x(), track_rect.y() + thumb_pos, + scrollbar.Width(), ThumbLength(scrollbar)); before_thumb_rect = - IntRect(track_rect.x(), track_rect.y(), track_rect.width(), - thumb_pos + thumb_rect.height() / 2); - after_thumb_rect = IntRect( + gfx::Rect(track_rect.x(), track_rect.y(), track_rect.width(), + thumb_pos + thumb_rect.height() / 2); + after_thumb_rect = gfx::Rect( track_rect.x(), track_rect.y() + before_thumb_rect.height(), track_rect.width(), track_rect.bottom() - before_thumb_rect.bottom()); } @@ -302,23 +301,22 @@ if (DrawingRecorder::UseCachedDrawingIfPossible( context, scrollbar, DisplayItem::kScrollbarTrackAndButtons)) return; - IntRect visual_rect = scrollbar.FrameRect(); + gfx::Rect visual_rect = scrollbar.FrameRect(); visual_rect.Offset(offset); DrawingRecorder recorder(context, scrollbar, - DisplayItem::kScrollbarTrackAndButtons, - ToGfxRect(visual_rect)); + DisplayItem::kScrollbarTrackAndButtons, visual_rect); if (HasButtons(scrollbar)) { - IntRect back_button_rect = BackButtonRect(scrollbar); + gfx::Rect back_button_rect = BackButtonRect(scrollbar); back_button_rect.Offset(offset); PaintButton(context, scrollbar, back_button_rect, kBackButtonStartPart); - IntRect forward_button_rect = ForwardButtonRect(scrollbar); + gfx::Rect forward_button_rect = ForwardButtonRect(scrollbar); forward_button_rect.Offset(offset); PaintButton(context, scrollbar, forward_button_rect, kForwardButtonEndPart); } - IntRect track_rect = TrackRect(scrollbar); + gfx::Rect track_rect = TrackRect(scrollbar); track_rect.Offset(offset); PaintTrack(context, scrollbar, track_rect); } @@ -328,7 +326,7 @@ const gfx::Vector2d& offset) { PaintTrackAndButtons(context, scrollbar, offset); if (scrollbar.HasTickmarks()) { - IntRect track_rect = TrackRect(scrollbar); + gfx::Rect track_rect = TrackRect(scrollbar); track_rect.Offset(offset); PaintTickmarks(context, scrollbar, track_rect); }
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme.h b/third_party/blink/renderer/core/scroll/scrollbar_theme.h index 1e3c4cf..3dbcf381 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme.h
@@ -29,9 +29,9 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/core/scroll/scrollbar.h" -#include "third_party/blink/renderer/platform/geometry/int_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item.h" #include "third_party/blink/renderer/platform/graphics/scrollbar_theme_settings.h" +#include "ui/gfx/geometry/rect.h" namespace blink { @@ -102,11 +102,11 @@ virtual void PaintScrollCorner(GraphicsContext&, const Scrollbar* vertical_scrollbar, const DisplayItemClient&, - const IntRect& corner_rect, + const gfx::Rect& corner_rect, mojom::blink::ColorScheme color_scheme); virtual void PaintTickmarks(GraphicsContext&, const Scrollbar&, - const IntRect&); + const gfx::Rect&); virtual bool ShouldCenterOnThumb(const Scrollbar&, const WebMouseEvent&) { return false; @@ -152,20 +152,22 @@ // All these rects are in the same coordinate space as the scrollbar's // FrameRect. - virtual IntRect BackButtonRect(const Scrollbar&) = 0; - virtual IntRect ForwardButtonRect(const Scrollbar&) = 0; - virtual IntRect TrackRect(const Scrollbar&) = 0; - virtual IntRect ThumbRect(const Scrollbar&); + virtual gfx::Rect BackButtonRect(const Scrollbar&) = 0; + virtual gfx::Rect ForwardButtonRect(const Scrollbar&) = 0; + virtual gfx::Rect TrackRect(const Scrollbar&) = 0; + virtual gfx::Rect ThumbRect(const Scrollbar&); virtual int MinimumThumbLength(const Scrollbar&) = 0; virtual void SplitTrack(const Scrollbar&, - const IntRect& track, - IntRect& start_track, - IntRect& thumb, - IntRect& end_track); + const gfx::Rect& track, + gfx::Rect& start_track, + gfx::Rect& thumb, + gfx::Rect& end_track); - virtual void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) {} + virtual void PaintThumb(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) {} // |offset| is from the space of the scrollbar's FrameRect() to |context|'s // current space. @@ -180,8 +182,8 @@ virtual base::TimeDelta InitialAutoscrollTimerDelay(); virtual base::TimeDelta AutoscrollTimerDelay(); - virtual IntRect ConstrainTrackRectToTrackPieces(const Scrollbar&, - const IntRect& rect) { + virtual gfx::Rect ConstrainTrackRectToTrackPieces(const Scrollbar&, + const gfx::Rect& rect) { return rect; } @@ -195,16 +197,16 @@ // painting code will use to paint the scrollbar into. The actual scrollbar // dimensions will be ignored for purposes of painting since the resource can // be then resized without a repaint. - virtual IntSize NinePatchThumbCanvasSize(const Scrollbar&) const { + virtual gfx::Size NinePatchThumbCanvasSize(const Scrollbar&) const { NOTREACHED(); - return IntSize(); + return gfx::Size(); } // For a nine-patch resource, the aperture defines the center patch that will // be stretched out. - virtual IntRect NinePatchThumbAperture(const Scrollbar&) const { + virtual gfx::Rect NinePatchThumbAperture(const Scrollbar&) const { NOTREACHED(); - return IntRect(); + return gfx::Rect(); } virtual bool AllowsHitTest() const { return true; } @@ -214,10 +216,12 @@ virtual ScrollbarPart HitTest(const Scrollbar&, const gfx::Point&); virtual int TickmarkBorderWidth() { return 0; } - virtual void PaintTrack(GraphicsContext&, const Scrollbar&, const IntRect&) {} + virtual void PaintTrack(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) {} virtual void PaintButton(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, ScrollbarPart) {} // |offset| is the offset of the |context|'s current space to the space of @@ -229,7 +233,7 @@ // Paint the thumb with Opacity() applied. virtual void PaintThumbWithOpacity(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { // By default this method just calls PaintThumb(). A theme with custom // Opacity() should override this method to apply the opacity. DCHECK_EQ(1.0f, Opacity(scrollbar));
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc index 4a44489..4c98c2e0 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
@@ -170,8 +170,8 @@ } // Horiz and Vert scrollbars are the same thickness. - IntSize scrollbar_size = IntSize(Platform::Current()->ThemeEngine()->GetSize( - WebThemeEngine::kPartScrollbarVerticalTrack)); + gfx::Size scrollbar_size = Platform::Current()->ThemeEngine()->GetSize( + WebThemeEngine::kPartScrollbarVerticalTrack); return scrollbar_size.width() * Proportion(scrollbar_width) * scale_from_dip; } @@ -182,13 +182,13 @@ return ThumbLength(scrollbar) > 0; } -IntRect ScrollbarThemeAura::BackButtonRect(const Scrollbar& scrollbar) { - IntSize size = ButtonSize(scrollbar); - return IntRect(scrollbar.X(), scrollbar.Y(), size.width(), size.height()); +gfx::Rect ScrollbarThemeAura::BackButtonRect(const Scrollbar& scrollbar) { + gfx::Size size = ButtonSize(scrollbar); + return gfx::Rect(scrollbar.X(), scrollbar.Y(), size.width(), size.height()); } -IntRect ScrollbarThemeAura::ForwardButtonRect(const Scrollbar& scrollbar) { - IntSize size = ButtonSize(scrollbar); +gfx::Rect ScrollbarThemeAura::ForwardButtonRect(const Scrollbar& scrollbar) { + gfx::Size size = ButtonSize(scrollbar); int x, y; if (scrollbar.Orientation() == kHorizontalScrollbar) { x = scrollbar.X() + scrollbar.Width() - size.width(); @@ -197,22 +197,22 @@ x = scrollbar.X(); y = scrollbar.Y() + scrollbar.Height() - size.height(); } - return IntRect(x, y, size.width(), size.height()); + return gfx::Rect(x, y, size.width(), size.height()); } -IntRect ScrollbarThemeAura::TrackRect(const Scrollbar& scrollbar) { +gfx::Rect ScrollbarThemeAura::TrackRect(const Scrollbar& scrollbar) { // The track occupies all space between the two buttons. - IntSize bs = ButtonSize(scrollbar); + gfx::Size bs = ButtonSize(scrollbar); if (scrollbar.Orientation() == kHorizontalScrollbar) { if (scrollbar.Width() <= 2 * bs.width()) - return IntRect(); - return IntRect(scrollbar.X() + bs.width(), scrollbar.Y(), - scrollbar.Width() - 2 * bs.width(), scrollbar.Height()); + return gfx::Rect(); + return gfx::Rect(scrollbar.X() + bs.width(), scrollbar.Y(), + scrollbar.Width() - 2 * bs.width(), scrollbar.Height()); } if (scrollbar.Height() <= 2 * bs.height()) - return IntRect(); - return IntRect(scrollbar.X(), scrollbar.Y() + bs.height(), scrollbar.Width(), - scrollbar.Height() - 2 * bs.height()); + return gfx::Rect(); + return gfx::Rect(scrollbar.X(), scrollbar.Y() + bs.height(), + scrollbar.Width(), scrollbar.Height() - 2 * bs.height()); } int ScrollbarThemeAura::MinimumThumbLength(const Scrollbar& scrollbar) { @@ -233,7 +233,7 @@ void ScrollbarThemeAura::PaintTrack(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { if (rect.IsEmpty()) return; @@ -243,7 +243,7 @@ // TODO(wangxianzhu): The extra params for scrollbar track were for painting // back and forward tracks separately, which we don't support. Remove them. - IntRect align_rect = TrackRect(scrollbar); + gfx::Rect align_rect = TrackRect(scrollbar); WebThemeEngine::ExtraParams extra_params; extra_params.scrollbar_track.is_back = false; extra_params.scrollbar_track.track_x = align_rect.x(); @@ -256,12 +256,12 @@ scrollbar.Orientation() == kHorizontalScrollbar ? WebThemeEngine::kPartScrollbarHorizontalTrack : WebThemeEngine::kPartScrollbarVerticalTrack, - state, ToGfxRect(rect), &extra_params, scrollbar.UsedColorScheme()); + state, rect, &extra_params, scrollbar.UsedColorScheme()); } void ScrollbarThemeAura::PaintButton(GraphicsContext& gc, const Scrollbar& scrollbar, - const IntRect& rect, + const gfx::Rect& rect, ScrollbarPart part) { PartPaintingParams params = ButtonPartPaintingParams(scrollbar, scrollbar.CurrentPos(), part); @@ -272,20 +272,19 @@ extra_params.scrollbar_button.zoom = scrollbar.EffectiveZoom(); extra_params.scrollbar_button.right_to_left = scrollbar.ContainerIsRightToLeft(); - Platform::Current()->ThemeEngine()->Paint( - gc.Canvas(), params.part, params.state, ToGfxRect(rect), &extra_params, - scrollbar.UsedColorScheme()); + Platform::Current()->ThemeEngine()->Paint(gc.Canvas(), params.part, + params.state, rect, &extra_params, + scrollbar.UsedColorScheme()); } void ScrollbarThemeAura::PaintThumb(GraphicsContext& gc, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { if (DrawingRecorder::UseCachedDrawingIfPossible(gc, scrollbar, DisplayItem::kScrollbarThumb)) return; - DrawingRecorder recorder(gc, scrollbar, DisplayItem::kScrollbarThumb, - ToGfxRect(rect)); + DrawingRecorder recorder(gc, scrollbar, DisplayItem::kScrollbarThumb, rect); WebThemeEngine::State state; cc::PaintCanvas* canvas = gc.Canvas(); @@ -301,7 +300,7 @@ scrollbar.Orientation() == kHorizontalScrollbar ? WebThemeEngine::kPartScrollbarHorizontalThumb : WebThemeEngine::kPartScrollbarVerticalThumb, - state, ToGfxRect(rect), nullptr, scrollbar.UsedColorScheme()); + state, rect, nullptr, scrollbar.UsedColorScheme()); } bool ScrollbarThemeAura::ShouldRepaintAllPartsOnInvalidation() const { @@ -382,20 +381,20 @@ .IsEmpty(); } -IntSize ScrollbarThemeAura::ButtonSize(const Scrollbar& scrollbar) { +gfx::Size ScrollbarThemeAura::ButtonSize(const Scrollbar& scrollbar) { if (!HasScrollbarButtons(scrollbar.Orientation())) - return IntSize(0, 0); + return gfx::Size(0, 0); if (scrollbar.Orientation() == kVerticalScrollbar) { int square_size = scrollbar.Width(); - return IntSize(square_size, scrollbar.Height() < 2 * square_size - ? scrollbar.Height() / 2 - : square_size); + return gfx::Size(square_size, scrollbar.Height() < 2 * square_size + ? scrollbar.Height() / 2 + : square_size); } // HorizontalScrollbar int square_size = scrollbar.Height(); - return IntSize( + return gfx::Size( scrollbar.Width() < 2 * square_size ? scrollbar.Width() / 2 : square_size, square_size); }
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.h b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.h index abdc172..0e739ad 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura.h
@@ -45,17 +45,21 @@ bool NativeThemeHasButtons() override { return true; } bool HasThumb(const Scrollbar&) override; - IntRect BackButtonRect(const Scrollbar&) override; - IntRect ForwardButtonRect(const Scrollbar&) override; - IntRect TrackRect(const Scrollbar&) override; + gfx::Rect BackButtonRect(const Scrollbar&) override; + gfx::Rect ForwardButtonRect(const Scrollbar&) override; + gfx::Rect TrackRect(const Scrollbar&) override; int MinimumThumbLength(const Scrollbar&) override; - void PaintTrack(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintTrack(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; void PaintButton(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, ScrollbarPart) override; - void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintThumb(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; bool ShouldRepaintAllPartsOnInvalidation() const override; ScrollbarPart PartsToInvalidateOnThumbPositionChange( @@ -78,7 +82,7 @@ FRIEND_TEST_ALL_PREFIXES(ScrollbarThemeAuraTest, NoButtonsReturnsSize0); virtual bool HasScrollbarButtons(ScrollbarOrientation) const; - IntSize ButtonSize(const Scrollbar&); + gfx::Size ButtonSize(const Scrollbar&); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura_test.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura_test.cc index 45c5ee6..31edbff7 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_aura_test.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_aura_test.cc
@@ -76,15 +76,15 @@ Scrollbar* scrollbar = Scrollbar::CreateForTesting( mock_scrollable_area, kHorizontalScrollbar, &theme); - IntRect scrollbar_size_normal_dimensions(11, 22, 444, 66); + gfx::Rect scrollbar_size_normal_dimensions(11, 22, 444, 66); scrollbar->SetFrameRect(scrollbar_size_normal_dimensions); - IntSize size1 = theme.ButtonSize(*scrollbar); + gfx::Size size1 = theme.ButtonSize(*scrollbar); EXPECT_EQ(66, size1.width()); EXPECT_EQ(66, size1.height()); - IntRect scrollbar_size_squashed_dimensions(11, 22, 444, 666); + gfx::Rect scrollbar_size_squashed_dimensions(11, 22, 444, 666); scrollbar->SetFrameRect(scrollbar_size_squashed_dimensions); - IntSize size2 = theme.ButtonSize(*scrollbar); + gfx::Size size2 = theme.ButtonSize(*scrollbar); EXPECT_EQ(222, size2.width()); EXPECT_EQ(666, size2.height()); @@ -100,15 +100,15 @@ Scrollbar* scrollbar = Scrollbar::CreateForTesting( mock_scrollable_area, kVerticalScrollbar, &theme); - IntRect scrollbar_size_normal_dimensions(11, 22, 44, 666); + gfx::Rect scrollbar_size_normal_dimensions(11, 22, 44, 666); scrollbar->SetFrameRect(scrollbar_size_normal_dimensions); - IntSize size1 = theme.ButtonSize(*scrollbar); + gfx::Size size1 = theme.ButtonSize(*scrollbar); EXPECT_EQ(44, size1.width()); EXPECT_EQ(44, size1.height()); - IntRect scrollbar_size_squashed_dimensions(11, 22, 444, 666); + gfx::Rect scrollbar_size_squashed_dimensions(11, 22, 444, 666); scrollbar->SetFrameRect(scrollbar_size_squashed_dimensions); - IntSize size2 = theme.ButtonSize(*scrollbar); + gfx::Size size2 = theme.ButtonSize(*scrollbar); EXPECT_EQ(444, size2.width()); EXPECT_EQ(333, size2.height()); @@ -125,8 +125,8 @@ mock_scrollable_area, kVerticalScrollbar, &theme); theme.SetHasScrollbarButtons(false); - scrollbar->SetFrameRect(IntRect(1, 2, 3, 4)); - IntSize size = theme.ButtonSize(*scrollbar); + scrollbar->SetFrameRect(gfx::Rect(1, 2, 3, 4)); + gfx::Size size = theme.ButtonSize(*scrollbar); EXPECT_EQ(0, size.width()); EXPECT_EQ(0, size.height()); @@ -145,7 +145,7 @@ ON_CALL(*mock_scrollable_area, VerticalScrollbar()) .WillByDefault(Return(scrollbar)); - IntRect vertical_rect(1010, 0, 14, 768); + gfx::Rect vertical_rect(1010, 0, 14, 768); scrollbar->SetFrameRect(vertical_rect); scrollbar->ClearThumbNeedsRepaint(); scrollbar->ClearTrackNeedsRepaint();
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.cc index 17cc3cf..10cb6fa 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.cc
@@ -104,8 +104,8 @@ void ScrollbarThemeMac::PaintTickmarks(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { - IntRect tickmark_track_rect = rect; + const gfx::Rect& rect) { + gfx::Rect tickmark_track_rect = rect; tickmark_track_rect.set_x(tickmark_track_rect.x() + 1); tickmark_track_rect.set_width(tickmark_track_rect.width() - 1); ScrollbarTheme::PaintTickmarks(context, scrollbar, tickmark_track_rect); @@ -191,7 +191,7 @@ void ScrollbarThemeMac::PaintTrack(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { GraphicsContextStateSaver state_saver(context); context.Translate(rect.x(), rect.y()); @@ -208,16 +208,16 @@ context.BeginLayer(opacity); WebThemeEngine::ExtraParams params = GetPaintParams(scrollbar, UsesOverlayScrollbars()); - IntRect bounds(0, 0, scrollbar.FrameRect().width(), - scrollbar.FrameRect().height()); + gfx::Rect bounds(0, 0, scrollbar.FrameRect().width(), + scrollbar.FrameRect().height()); WebThemeEngine::Part track_part = params.scrollbar_extra.orientation == WebThemeEngine::ScrollbarOrientation::kHorizontal ? WebThemeEngine::Part::kPartScrollbarHorizontalTrack : WebThemeEngine::Part::kPartScrollbarVerticalTrack; Platform::Current()->ThemeEngine()->Paint( - context.Canvas(), track_part, WebThemeEngine::State::kStateNormal, - ToGfxRect(bounds), ¶ms, params.scrollbar_extra.scrollbar_theme); + context.Canvas(), track_part, WebThemeEngine::State::kStateNormal, bounds, + ¶ms, params.scrollbar_extra.scrollbar_theme); if (opacity != 1) context.EndLayer(); } @@ -226,7 +226,7 @@ GraphicsContext& context, const Scrollbar* vertical_scrollbar, const DisplayItemClient& item, - const IntRect& rect, + const gfx::Rect& rect, mojom::blink::ColorScheme color_scheme) { if (!vertical_scrollbar) { ScrollbarTheme::PaintScrollCorner(context, vertical_scrollbar, item, rect, @@ -237,34 +237,33 @@ DisplayItem::kScrollCorner)) { return; } - DrawingRecorder recorder(context, item, DisplayItem::kScrollCorner, - ToGfxRect(rect)); + DrawingRecorder recorder(context, item, DisplayItem::kScrollCorner, rect); GraphicsContextStateSaver state_saver(context); context.Translate(rect.x(), rect.y()); - IntRect bounds(0, 0, rect.width(), rect.height()); + gfx::Rect bounds(0, 0, rect.width(), rect.height()); WebThemeEngine::ExtraParams params = GetPaintParams(*vertical_scrollbar, UsesOverlayScrollbars()); Platform::Current()->ThemeEngine()->Paint( context.Canvas(), WebThemeEngine::Part::kPartScrollbarCorner, - WebThemeEngine::State::kStateNormal, ToGfxRect(bounds), ¶ms, + WebThemeEngine::State::kStateNormal, bounds, ¶ms, params.scrollbar_extra.scrollbar_theme); } void ScrollbarThemeMac::PaintThumbInternal(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect, + const gfx::Rect& rect, float opacity) { if (DrawingRecorder::UseCachedDrawingIfPossible( context, scrollbar, DisplayItem::kScrollbarThumb)) { return; } DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb, - ToGfxRect(rect)); + rect); GraphicsContextStateSaver state_saver(context); context.Translate(rect.x(), rect.y()); - IntRect local_rect(gfx::Point(), rect.size()); + gfx::Rect local_rect(rect.size()); if (!scrollbar.Enabled()) return; @@ -281,21 +280,23 @@ GetPaintParams(scrollbar, UsesOverlayScrollbars()); // Compute the bounds for the thumb, accounting for lack of engorgement. - IntRect bounds; + gfx::Rect bounds; switch (params.scrollbar_extra.orientation) { case WebThemeEngine::ScrollbarOrientation::kVerticalOnRight: - bounds = IntRect(rect.width() - thumb_size, 0, thumb_size, rect.height()); + bounds = + gfx::Rect(rect.width() - thumb_size, 0, thumb_size, rect.height()); break; case WebThemeEngine::ScrollbarOrientation::kVerticalOnLeft: - bounds = IntRect(0, 0, thumb_size, rect.height()); + bounds = gfx::Rect(0, 0, thumb_size, rect.height()); break; case WebThemeEngine::ScrollbarOrientation::kHorizontal: - bounds = IntRect(0, rect.height() - thumb_size, rect.width(), thumb_size); + bounds = + gfx::Rect(0, rect.height() - thumb_size, rect.width(), thumb_size); break; } if (opacity != 1.0f) { - FloatRect float_local_rect(local_rect); + gfx::RectF float_local_rect(local_rect); context.BeginLayer(opacity, SkBlendMode::kSrcOver, &float_local_rect); } @@ -305,8 +306,8 @@ ? WebThemeEngine::Part::kPartScrollbarHorizontalThumb : WebThemeEngine::Part::kPartScrollbarVerticalThumb; Platform::Current()->ThemeEngine()->Paint( - context.Canvas(), thumb_part, WebThemeEngine::State::kStateNormal, - ToGfxRect(bounds), ¶ms, params.scrollbar_extra.scrollbar_theme); + context.Canvas(), thumb_part, WebThemeEngine::State::kStateNormal, bounds, + ¶ms, params.scrollbar_extra.scrollbar_theme); if (opacity != 1.0f) context.EndLayer(); } @@ -344,15 +345,15 @@ : scrollbar.Height()) >= min_length_for_thumb; } -IntRect ScrollbarThemeMac::BackButtonRect(const Scrollbar& scrollbar) { - return IntRect(); +gfx::Rect ScrollbarThemeMac::BackButtonRect(const Scrollbar& scrollbar) { + return gfx::Rect(); } -IntRect ScrollbarThemeMac::ForwardButtonRect(const Scrollbar& scrollbar) { - return IntRect(); +gfx::Rect ScrollbarThemeMac::ForwardButtonRect(const Scrollbar& scrollbar) { + return gfx::Rect(); } -IntRect ScrollbarThemeMac::TrackRect(const Scrollbar& scrollbar) { +gfx::Rect ScrollbarThemeMac::TrackRect(const Scrollbar& scrollbar) { return scrollbar.FrameRect(); }
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h index de3385f..7c05bb6 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h
@@ -56,7 +56,7 @@ void PaintTickmarks(GraphicsContext&, const Scrollbar&, - const IntRect&) override; + const gfx::Rect&) override; bool ShouldCenterOnThumb(const Scrollbar&, const WebMouseEvent&) override; bool JumpOnTrackClick() const override; @@ -76,12 +76,12 @@ void PaintThumb(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) override { + const gfx::Rect& rect) override { PaintThumbInternal(context, scrollbar, rect, 1.0f); } void PaintThumbWithOpacity(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) override { + const gfx::Rect& rect) override { PaintThumbInternal(context, scrollbar, rect, Opacity(scrollbar)); } @@ -103,9 +103,9 @@ bool ShouldDragDocumentInsteadOfThumb(const Scrollbar&, const WebMouseEvent&) override; - IntRect TrackRect(const Scrollbar&) override; - IntRect BackButtonRect(const Scrollbar&) override; - IntRect ForwardButtonRect(const Scrollbar&) override; + gfx::Rect TrackRect(const Scrollbar&) override; + gfx::Rect BackButtonRect(const Scrollbar&) override; + gfx::Rect ForwardButtonRect(const Scrollbar&) override; bool NativeThemeHasButtons() override { return false; } bool HasThumb(const Scrollbar&) override; @@ -114,15 +114,17 @@ int TickmarkBorderWidth() override { return 1; } - void PaintTrack(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintTrack(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; void PaintScrollCorner(GraphicsContext&, const Scrollbar* vertical_scrollbar, const DisplayItemClient&, - const IntRect& corner_rect, + const gfx::Rect& corner_rect, mojom::blink::ColorScheme color_scheme) override; void PaintThumbInternal(GraphicsContext&, const Scrollbar&, - const IntRect&, + const gfx::Rect&, float opacity); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.cc index 3852a4c..9a1fe9ba 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.cc
@@ -137,26 +137,26 @@ return true; } -IntRect ScrollbarThemeOverlay::BackButtonRect(const Scrollbar&) { - return IntRect(); +gfx::Rect ScrollbarThemeOverlay::BackButtonRect(const Scrollbar&) { + return gfx::Rect(); } -IntRect ScrollbarThemeOverlay::ForwardButtonRect(const Scrollbar&) { - return IntRect(); +gfx::Rect ScrollbarThemeOverlay::ForwardButtonRect(const Scrollbar&) { + return gfx::Rect(); } -IntRect ScrollbarThemeOverlay::TrackRect(const Scrollbar& scrollbar) { - IntRect rect = scrollbar.FrameRect(); +gfx::Rect ScrollbarThemeOverlay::TrackRect(const Scrollbar& scrollbar) { + gfx::Rect rect = scrollbar.FrameRect(); EScrollbarWidth scrollbar_width = scrollbar.CSSScrollbarWidth(); if (scrollbar.Orientation() == kHorizontalScrollbar) - rect.OutsetX(-ScrollbarMargin(scrollbar.ScaleFromDIP(), scrollbar_width)); + rect.Inset(ScrollbarMargin(scrollbar.ScaleFromDIP(), scrollbar_width), 0); else - rect.OutsetY(-ScrollbarMargin(scrollbar.ScaleFromDIP(), scrollbar_width)); + rect.Inset(0, ScrollbarMargin(scrollbar.ScaleFromDIP(), scrollbar_width)); return rect; } -IntRect ScrollbarThemeOverlay::ThumbRect(const Scrollbar& scrollbar) { - IntRect rect = ScrollbarTheme::ThumbRect(scrollbar); +gfx::Rect ScrollbarThemeOverlay::ThumbRect(const Scrollbar& scrollbar) { + gfx::Rect rect = ScrollbarTheme::ThumbRect(scrollbar); EScrollbarWidth scrollbar_width = scrollbar.CSSScrollbarWidth(); if (scrollbar.Orientation() == kHorizontalScrollbar) { rect.set_height(ThumbThickness(scrollbar.ScaleFromDIP(), scrollbar_width)); @@ -172,13 +172,13 @@ void ScrollbarThemeOverlay::PaintThumb(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { if (DrawingRecorder::UseCachedDrawingIfPossible(context, scrollbar, DisplayItem::kScrollbarThumb)) return; DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb, - ToGfxRect(rect)); + rect); WebThemeEngine::State state = WebThemeEngine::kStateNormal; @@ -207,8 +207,7 @@ canvas->scale(-1, 1); } - Platform::Current()->ThemeEngine()->Paint(canvas, part, state, - ToGfxRect(rect), ¶ms, + Platform::Current()->ThemeEngine()->Paint(canvas, part, state, rect, ¶ms, scrollbar.UsedColorScheme()); if (scrollbar.IsLeftSideVerticalScrollbar()) @@ -231,7 +230,7 @@ WebThemeEngine::kPartScrollbarVerticalThumb); } -IntSize ScrollbarThemeOverlay::NinePatchThumbCanvasSize( +gfx::Size ScrollbarThemeOverlay::NinePatchThumbCanvasSize( const Scrollbar& scrollbar) const { DCHECK(UsesNinePatchThumbResource()); @@ -241,10 +240,10 @@ : WebThemeEngine::kPartScrollbarHorizontalThumb; DCHECK(Platform::Current()->ThemeEngine()); - return IntSize(Platform::Current()->ThemeEngine()->NinePatchCanvasSize(part)); + return Platform::Current()->ThemeEngine()->NinePatchCanvasSize(part); } -IntRect ScrollbarThemeOverlay::NinePatchThumbAperture( +gfx::Rect ScrollbarThemeOverlay::NinePatchThumbAperture( const Scrollbar& scrollbar) const { DCHECK(UsesNinePatchThumbResource()); @@ -253,7 +252,7 @@ part = WebThemeEngine::kPartScrollbarVerticalThumb; DCHECK(Platform::Current()->ThemeEngine()); - return IntRect(Platform::Current()->ThemeEngine()->NinePatchAperture(part)); + return Platform::Current()->ThemeEngine()->NinePatchAperture(part); } int ScrollbarThemeOverlay::MinimumThumbLength(const Scrollbar& scrollbar) {
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h index ca4914e..021be14 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay.h
@@ -61,16 +61,18 @@ bool NativeThemeHasButtons() override { return false; } bool HasThumb(const Scrollbar&) override; - IntRect BackButtonRect(const Scrollbar&) override; - IntRect ForwardButtonRect(const Scrollbar&) override; - IntRect TrackRect(const Scrollbar&) override; - IntRect ThumbRect(const Scrollbar&) override; + gfx::Rect BackButtonRect(const Scrollbar&) override; + gfx::Rect ForwardButtonRect(const Scrollbar&) override; + gfx::Rect TrackRect(const Scrollbar&) override; + gfx::Rect ThumbRect(const Scrollbar&) override; - void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintThumb(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; bool UsesNinePatchThumbResource() const override; - IntSize NinePatchThumbCanvasSize(const Scrollbar&) const override; - IntRect NinePatchThumbAperture(const Scrollbar&) const override; + gfx::Size NinePatchThumbCanvasSize(const Scrollbar&) const override; + gfx::Rect NinePatchThumbAperture(const Scrollbar&) const override; int MinimumThumbLength(const Scrollbar&) override;
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc index 3c53ca8..c76fbe5 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc
@@ -61,7 +61,7 @@ void ScrollbarThemeOverlayMobile::PaintThumb(GraphicsContext& context, const Scrollbar& scrollbar, - const IntRect& rect) { + const gfx::Rect& rect) { if (!scrollbar.Enabled()) return; @@ -70,7 +70,7 @@ return; DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb, - ToGfxRect(rect)); + rect); const auto* box = scrollbar.GetScrollableArea()->GetLayoutBox(); AutoDarkMode auto_dark_mode(PaintAutoDarkMode(
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h index 5c1fd13..6b569cb 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.h
@@ -14,7 +14,9 @@ public: static ScrollbarThemeOverlayMobile& GetInstance(); - void PaintThumb(GraphicsContext&, const Scrollbar&, const IntRect&) override; + void PaintThumb(GraphicsContext&, + const Scrollbar&, + const gfx::Rect&) override; bool AllowsHitTest() const override { return false; } bool IsSolidColor() const override { return true; } bool UsesNinePatchThumbResource() const override { return false; }
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_test.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_test.cc index 7160034..f27b963 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_test.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_test.cc
@@ -34,8 +34,8 @@ ON_CALL(*mock_scrollable_area, HorizontalScrollbar()) .WillByDefault(Return(horizontal_scrollbar)); - IntRect vertical_rect(1010, 0, 14, 768); - IntRect horizontal_rect(0, 754, 1024, 14); + gfx::Rect vertical_rect(1010, 0, 14, 768); + gfx::Rect horizontal_rect(0, 754, 1024, 14); vertical_scrollbar->SetFrameRect(vertical_rect); horizontal_scrollbar->SetFrameRect(horizontal_rect);
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index b1cceea..d67f080 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -1280,14 +1280,13 @@ ApplyMotionPath apply_motion_path, ApplyIndependentTransformProperties apply_independent_transform_properties) const { - ApplyTransform(result, FloatRect(gfx::PointF(), FloatSize(border_box_size)), - apply_origin, apply_motion_path, - apply_independent_transform_properties); + ApplyTransform(result, gfx::RectF(gfx::SizeF(border_box_size)), apply_origin, + apply_motion_path, apply_independent_transform_properties); } void ComputedStyle::ApplyTransform( TransformationMatrix& result, - const FloatRect& bounding_box, + const gfx::RectF& bounding_box, ApplyTransformOrigin apply_origin, ApplyMotionPath apply_motion_path, ApplyIndependentTransformProperties apply_independent_transform_properties) @@ -1301,7 +1300,7 @@ float origin_y = 0; float origin_z = 0; - const FloatSize& box_size = bounding_box.size(); + const gfx::SizeF& box_size = bounding_box.size(); if (apply_transform_origin || // We need to calculate originX and originY for applying motion path. apply_motion_path == kIncludeMotionPath) { @@ -1345,7 +1344,7 @@ void ComputedStyle::ApplyMotionPathTransform( float origin_x, float origin_y, - const FloatRect& bounding_box, + const gfx::RectF& bounding_box, TransformationMatrix& transform) const { // TODO(ericwilligers): crbug.com/638055 Apply offset-position. if (!OffsetPath()) { @@ -1397,7 +1396,7 @@ // they will have the default value, auto. gfx::PointF anchor_point(origin_x, origin_y); if (!position.X().IsAuto() || !anchor.X().IsAuto()) { - anchor_point = PointForLengthPoint(anchor, ToGfxSizeF(bounding_box.size())); + anchor_point = PointForLengthPoint(anchor, bounding_box.size()); anchor_point += bounding_box.OffsetFromOrigin(); // Shift the origin from transform-origin to offset-anchor.
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 4fc7ba13..963061d 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -2367,7 +2367,7 @@ ApplyMotionPath, ApplyIndependentTransformProperties) const; void ApplyTransform(TransformationMatrix&, - const FloatRect& bounding_box, + const gfx::RectF& bounding_box, ApplyTransformOrigin, ApplyMotionPath, ApplyIndependentTransformProperties) const; @@ -2688,10 +2688,10 @@ LogicalSize LogicalAspectRatio() const { DCHECK_NE(AspectRatio().GetType(), EAspectRatioType::kAuto); - FloatSize ratio = AspectRatio().GetRatio(); + gfx::SizeF ratio = AspectRatio().GetRatio(); if (!IsHorizontalWritingMode()) - ratio = ratio.TransposedSize(); - return LogicalSize::AspectRatioFromFloatSize(ratio); + ratio.Transpose(); + return LogicalSize::AspectRatioFromSizeF(ratio); } EBoxSizing BoxSizingForAspectRatio() const { @@ -2948,7 +2948,7 @@ void OverrideTextDecorationColors(Color propagated_color); void ApplyMotionPathTransform(float origin_x, float origin_y, - const FloatRect& bounding_box, + const gfx::RectF& bounding_box, TransformationMatrix&) const; bool ScrollAnchorDisablingPropertyChanged(const ComputedStyle& other,
diff --git a/third_party/blink/renderer/core/style/fill_layer.cc b/third_party/blink/renderer/core/style/fill_layer.cc index 7097e99..bd260e5 100644 --- a/third_party/blink/renderer/core/style/fill_layer.cc +++ b/third_party/blink/renderer/core/style/fill_layer.cc
@@ -395,7 +395,7 @@ // checking for IsEmpty. return image_->KnownToBeOpaque(document, style) && !image_ - ->ImageSize(style.EffectiveZoom(), FloatSize(), + ->ImageSize(style.EffectiveZoom(), gfx::SizeF(), kRespectImageOrientation) .IsEmpty(); }
diff --git a/third_party/blink/renderer/core/style/style_aspect_ratio.h b/third_party/blink/renderer/core/style/style_aspect_ratio.h index c6195660..0c88a9f9 100644 --- a/third_party/blink/renderer/core/style/style_aspect_ratio.h +++ b/third_party/blink/renderer/core/style/style_aspect_ratio.h
@@ -5,10 +5,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_ASPECT_RATIO_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_ASPECT_RATIO_H_ -#include "third_party/blink/renderer/platform/geometry/float_size.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -19,7 +18,7 @@ public: // Style data for aspect-ratio: auto || <ratio> - StyleAspectRatio(EAspectRatioType type, FloatSize ratio) + StyleAspectRatio(EAspectRatioType type, gfx::SizeF ratio) : type_(static_cast<unsigned>(type)), ratio_(ratio) {} // 0/x and x/0 are valid (and computed style needs to serialize them @@ -42,7 +41,7 @@ bool IsAuto() const { return GetType() == EAspectRatioType::kAuto; } - FloatSize GetRatio() const { return ratio_; } + gfx::SizeF GetRatio() const { return ratio_; } bool operator==(const StyleAspectRatio& o) const { return type_ == o.type_ && ratio_ == o.ratio_; @@ -52,7 +51,7 @@ private: unsigned type_ : 2; // EAspectRatioType - FloatSize ratio_; + gfx::SizeF ratio_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/style/style_crossfade_image.cc b/third_party/blink/renderer/core/style/style_crossfade_image.cc index b498439..e86454b 100644 --- a/third_party/blink/renderer/core/style/style_crossfade_image.cc +++ b/third_party/blink/renderer/core/style/style_crossfade_image.cc
@@ -64,16 +64,16 @@ (!to_image_ || to_image_->IsAccessAllowed(failing_url)); } -FloatSize StyleCrossfadeImage::ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const { +gfx::SizeF StyleCrossfadeImage::ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const { if (!from_image_ || !to_image_) - return FloatSize(); + return gfx::SizeF(); // TODO(fs): Consider |respect_orientation|? - FloatSize from_image_size = from_image_->ImageSize( + gfx::SizeF from_image_size = from_image_->ImageSize( multiplier, default_object_size, kRespectImageOrientation); - FloatSize to_image_size = to_image_->ImageSize( + gfx::SizeF to_image_size = to_image_->ImageSize( multiplier, default_object_size, kRespectImageOrientation); // Rounding issues can cause transitions between images of equal size to @@ -84,10 +84,10 @@ float percentage = original_value_->Percentage().GetFloatValue(); float inverse_percentage = 1 - percentage; - return FloatSize(from_image_size.width() * inverse_percentage + - to_image_size.width() * percentage, - from_image_size.height() * inverse_percentage + - to_image_size.height() * percentage); + return gfx::SizeF(from_image_size.width() * inverse_percentage + + to_image_size.width() * percentage, + from_image_size.height() * inverse_percentage + + to_image_size.height() * percentage); } bool StyleCrossfadeImage::HasIntrinsicSize() const { @@ -122,12 +122,12 @@ const ImageResourceObserver& observer, const Document& document, const ComputedStyle& style, - const FloatSize& target_size) const { + const gfx::SizeF& target_size) const { if (target_size.IsEmpty()) return nullptr; if (!from_image_ || !to_image_) return Image::NullImage(); - const FloatSize resolved_size = + const gfx::SizeF resolved_size = ImageSize(style.EffectiveZoom(), target_size, kRespectImageOrientation); const ImageResourceObserver* proxy_observer = original_value_->GetObserverProxy();
diff --git a/third_party/blink/renderer/core/style/style_crossfade_image.h b/third_party/blink/renderer/core/style/style_crossfade_image.h index dad4122..09c2f14c 100644 --- a/third_party/blink/renderer/core/style/style_crossfade_image.h +++ b/third_party/blink/renderer/core/style/style_crossfade_image.h
@@ -31,9 +31,9 @@ bool ErrorOccurred() const override; bool IsAccessAllowed(String&) const override; - FloatSize ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const override; + gfx::SizeF ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override; @@ -43,7 +43,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size) const override; + const gfx::SizeF& target_size) const override; WrappedImagePtr Data() const override; bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override;
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.cc b/third_party/blink/renderer/core/style/style_fetched_image.cc index 17cc34af..3a3912c 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image.cc +++ b/third_party/blink/renderer/core/style/style_fetched_image.cc
@@ -110,9 +110,9 @@ return false; } -FloatSize StyleFetchedImage::ImageSize( +gfx::SizeF StyleFetchedImage::ImageSize( float multiplier, - const FloatSize& default_object_size, + const gfx::SizeF& default_object_size, RespectImageOrientationEnum respect_orientation) const { Image* image = image_->GetImage(); if (image_->HasDevicePixelRatioHeaderValue()) { @@ -122,7 +122,7 @@ return ImageSizeForSVGImage(svg_image, multiplier, default_object_size); } respect_orientation = ForceOrientationIfNecessary(respect_orientation); - FloatSize size(image->Size(respect_orientation)); + gfx::SizeF size(image->Size(respect_orientation)); return ApplyZoom(size, multiplier); } @@ -168,7 +168,7 @@ const ImageResourceObserver&, const Document&, const ComputedStyle& style, - const FloatSize& target_size) const { + const gfx::SizeF& target_size) const { Image* image = image_->GetImage(); if (image->IsPlaceholderImage()) { static_cast<PlaceholderImage*>(image)->SetIconAndTextScaleFactor(
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.h b/third_party/blink/renderer/core/style/style_fetched_image.h index b4dfb78..20547c2 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image.h +++ b/third_party/blink/renderer/core/style/style_fetched_image.h
@@ -58,9 +58,9 @@ bool ErrorOccurred() const override; bool IsAccessAllowed(String&) const override; - FloatSize ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const override; + gfx::SizeF ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override; void AddClient(ImageResourceObserver*) override; void RemoveClient(ImageResourceObserver*) override; @@ -68,7 +68,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size) const override; + const gfx::SizeF& target_size) const override; bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override; ImageResourceContent* CachedImage() const override;
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.cc b/third_party/blink/renderer/core/style/style_fetched_image_set.cc index 2f309b0..f2b0373 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image_set.cc +++ b/third_party/blink/renderer/core/style/style_fetched_image_set.cc
@@ -96,19 +96,18 @@ return false; } -FloatSize StyleFetchedImageSet::ImageSize( +gfx::SizeF StyleFetchedImageSet::ImageSize( float multiplier, - const FloatSize& default_object_size, + const gfx::SizeF& default_object_size, RespectImageOrientationEnum respect_orientation) const { Image* image = best_fit_image_->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(image)) { return ImageSizeForSVGImage(svg_image, multiplier, default_object_size); } respect_orientation = ForceOrientationIfNecessary(respect_orientation); - FloatSize natural_size(image->Size(respect_orientation)); - FloatSize scaled_image_size(ApplyZoom(natural_size, multiplier)); - scaled_image_size.Scale(1 / image_scale_factor_); - return scaled_image_size; + gfx::SizeF natural_size(image->Size(respect_orientation)); + gfx::SizeF scaled_image_size(ApplyZoom(natural_size, multiplier)); + return gfx::ScaleSize(scaled_image_size, 1 / image_scale_factor_); } bool StyleFetchedImageSet::HasIntrinsicSize() const { @@ -127,7 +126,7 @@ const ImageResourceObserver&, const Document&, const ComputedStyle& style, - const FloatSize& target_size) const { + const gfx::SizeF& target_size) const { Image* image = best_fit_image_->GetImage(); if (image->IsPlaceholderImage()) { static_cast<PlaceholderImage*>(image)->SetIconAndTextScaleFactor(
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.h b/third_party/blink/renderer/core/style/style_fetched_image_set.h index 8db12d4..7f3921d0 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image_set.h +++ b/third_party/blink/renderer/core/style/style_fetched_image_set.h
@@ -66,16 +66,16 @@ bool ErrorOccurred() const override; bool IsAccessAllowed(String&) const override; - FloatSize ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const override; + gfx::SizeF ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override; void AddClient(ImageResourceObserver*) override; void RemoveClient(ImageResourceObserver*) override; scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size) const override; + const gfx::SizeF& target_size) const override; float ImageScaleFactor() const override { return image_scale_factor_; } bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override; ImageResourceContent* CachedImage() const override;
diff --git a/third_party/blink/renderer/core/style/style_generated_image.cc b/third_party/blink/renderer/core/style/style_generated_image.cc index c409c5c..2d2d7058 100644 --- a/third_party/blink/renderer/core/style/style_generated_image.cc +++ b/third_party/blink/renderer/core/style/style_generated_image.cc
@@ -61,9 +61,9 @@ return image_generator_value_; } -FloatSize StyleGeneratedImage::ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const { +gfx::SizeF StyleGeneratedImage::ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const { return default_object_size; } @@ -86,7 +86,7 @@ const ImageResourceObserver& observer, const Document& document, const ComputedStyle& style, - const FloatSize& target_size) const { + const gfx::SizeF& target_size) const { return image_generator_value_->GetImage(observer, document, style, target_size); }
diff --git a/third_party/blink/renderer/core/style/style_generated_image.h b/third_party/blink/renderer/core/style/style_generated_image.h index b1e8080..847e0fb670 100644 --- a/third_party/blink/renderer/core/style/style_generated_image.h +++ b/third_party/blink/renderer/core/style/style_generated_image.h
@@ -49,9 +49,9 @@ bool IsAccessAllowed(String&) const override { return true; } - FloatSize ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const override; + gfx::SizeF ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override { return false; } void AddClient(ImageResourceObserver*) override; void RemoveClient(ImageResourceObserver*) override; @@ -59,7 +59,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size) const override; + const gfx::SizeF& target_size) const override; bool KnownToBeOpaque(const Document&, const ComputedStyle&) const override; bool IsUsingCustomProperty(const AtomicString& custom_property_name,
diff --git a/third_party/blink/renderer/core/style/style_image.cc b/third_party/blink/renderer/core/style/style_image.cc index e885ddc..bbb8d91 100644 --- a/third_party/blink/renderer/core/style/style_image.cc +++ b/third_party/blink/renderer/core/style/style_image.cc
@@ -10,7 +10,8 @@ namespace blink { -FloatSize StyleImage::ApplyZoom(const FloatSize& size, float multiplier) const { +gfx::SizeF StyleImage::ApplyZoom(const gfx::SizeF& size, + float multiplier) const { if (multiplier == 1.0f || !HasIntrinsicSize()) return size; @@ -24,15 +25,15 @@ if (size.height() > 0) height = std::max(1.0f, height); - return FloatSize(width, height); + return gfx::SizeF(width, height); } -FloatSize StyleImage::ImageSizeForSVGImage( +gfx::SizeF StyleImage::ImageSizeForSVGImage( SVGImage* svg_image, float multiplier, - const FloatSize& default_object_size) const { - FloatSize unzoomed_default_object_size = default_object_size; - unzoomed_default_object_size.Scale(1 / multiplier); + const gfx::SizeF& default_object_size) const { + gfx::SizeF unzoomed_default_object_size = + gfx::ScaleSize(default_object_size, 1 / multiplier); return ApplyZoom(svg_image->ConcreteObjectSize(unzoomed_default_object_size), multiplier); }
diff --git a/third_party/blink/renderer/core/style/style_image.h b/third_party/blink/renderer/core/style/style_image.h index d161f6b2..7b0447f 100644 --- a/third_party/blink/renderer/core/style/style_image.h +++ b/third_party/blink/renderer/core/style/style_image.h
@@ -29,10 +29,13 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +namespace gfx { +class SizeF; +} + namespace blink { class CSSValue; -class FloatSize; class Image; class ImageResourceContent; class SVGImage; @@ -78,7 +81,7 @@ virtual bool IsAccessAllowed(String& failing_url) const = 0; // Determine the concrete object size of this <image>, scaled by multiplier, - // using the specified default object size. Return value as a FloatSize + // using the specified default object size. Return value as a gfx::SizeF // because we want integer sizes to remain integers when zoomed and then // unzoomed. That is, (size * multiplier) / multiplier == size. // @@ -94,9 +97,9 @@ // // The size will respect the image orientation if requested and if the image // supports it. - virtual FloatSize ImageSize(float multiplier, - const FloatSize& default_object_size, - RespectImageOrientationEnum) const = 0; + virtual gfx::SizeF ImageSize(float multiplier, + const gfx::SizeF& default_object_size, + RespectImageOrientationEnum) const = 0; // The <image> has intrinsic dimensions. // @@ -117,10 +120,11 @@ // Note that the |target_size| is in the effective zoom level of the // computed style, i.e if the style has an effective zoom level of 1.0 the // |target_size| is not zoomed. - virtual scoped_refptr<Image> GetImage(const ImageResourceObserver&, - const Document&, - const ComputedStyle&, - const FloatSize& target_size) const = 0; + virtual scoped_refptr<Image> GetImage( + const ImageResourceObserver&, + const Document&, + const ComputedStyle&, + const gfx::SizeF& target_size) const = 0; // Opaque handle representing the underlying value of this <image>. virtual WrappedImagePtr Data() const = 0; @@ -178,10 +182,10 @@ virtual bool IsEqual(const StyleImage&) const = 0; - FloatSize ApplyZoom(const FloatSize&, float multiplier) const; - FloatSize ImageSizeForSVGImage(SVGImage*, - float multiplier, - const FloatSize& default_object_size) const; + gfx::SizeF ApplyZoom(const gfx::SizeF&, float multiplier) const; + gfx::SizeF ImageSizeForSVGImage(SVGImage*, + float multiplier, + const gfx::SizeF& default_object_size) const; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/style/style_pending_image.h b/third_party/blink/renderer/core/style/style_pending_image.h index e424743..fe38a188 100644 --- a/third_party/blink/renderer/core/style/style_pending_image.h +++ b/third_party/blink/renderer/core/style/style_pending_image.h
@@ -55,10 +55,10 @@ bool allow_visited_style) const override; bool IsAccessAllowed(String&) const override { return true; } - FloatSize ImageSize(float, - const FloatSize&, - RespectImageOrientationEnum) const override { - return FloatSize(); + gfx::SizeF ImageSize(float, + const gfx::SizeF&, + RespectImageOrientationEnum) const override { + return gfx::SizeF(); } bool HasIntrinsicSize() const override { return true; } void AddClient(ImageResourceObserver*) override {} @@ -66,7 +66,7 @@ scoped_refptr<Image> GetImage(const ImageResourceObserver&, const Document&, const ComputedStyle&, - const FloatSize& target_size) const override { + const gfx::SizeF& target_size) const override { NOTREACHED(); return nullptr; }
diff --git a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc index 7b609d2..b68aec9 100644 --- a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc +++ b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc
@@ -95,27 +95,26 @@ } gfx::RectF FEImage::MapInputs(const gfx::RectF&) const { - FloatRect dest_rect( - GetFilter()->MapLocalRectToAbsoluteRect(FilterPrimitiveSubregion())); + gfx::RectF dest_rect = + GetFilter()->MapLocalRectToAbsoluteRect(FilterPrimitiveSubregion()); if (const LayoutObject* layout_object = ReferencedLayoutObject()) { - FloatRect src_rect(GetLayoutObjectRepaintRect(*layout_object)); + gfx::RectF src_rect = GetLayoutObjectRepaintRect(*layout_object); if (element_->HasRelativeLengths()) { auto viewport_transform = - ComputeViewportAdjustmentTransform(element_, ToGfxRectF(dest_rect)); + ComputeViewportAdjustmentTransform(element_, dest_rect); if (viewport_transform) src_rect = viewport_transform->MapRect(src_rect); } else { - src_rect = FloatRect( - GetFilter()->MapLocalRectToAbsoluteRect(ToGfxRectF(src_rect))); + src_rect = GetFilter()->MapLocalRectToAbsoluteRect(src_rect); src_rect.Offset(dest_rect.x(), dest_rect.y()); } dest_rect.Intersect(src_rect); - return ToGfxRectF(dest_rect); + return dest_rect; } if (image_) { - FloatRect src_rect = FloatRect(gfx::PointF(), FloatSize(image_->Size())); + gfx::RectF src_rect(gfx::SizeF(image_->Size())); preserve_aspect_ratio_->TransformRect(dest_rect, src_rect); - return ToGfxRectF(dest_rect); + return dest_rect; } return gfx::RectF(); } @@ -130,7 +129,7 @@ int indent) const { gfx::Size image_size; if (image_) { - image_size = ToGfxSize(image_->Size()); + image_size = image_->Size(); } else if (const LayoutObject* layout_object = ReferencedLayoutObject()) { image_size = gfx::ToEnclosingRect(GetLayoutObjectRepaintRect(*layout_object)).size(); @@ -202,18 +201,18 @@ if (PaintImage image = image_ ? image_->PaintImageForCurrentFrame() : PaintImage()) { - FloatRect src_rect = FloatRect(gfx::PointF(), FloatSize(image_->Size())); - FloatRect dst_rect( - GetFilter()->MapLocalRectToAbsoluteRect(FilterPrimitiveSubregion())); + gfx::RectF src_rect(gfx::SizeF(image_->Size())); + gfx::RectF dst_rect = + GetFilter()->MapLocalRectToAbsoluteRect(FilterPrimitiveSubregion()); preserve_aspect_ratio_->TransformRect(dst_rect, src_rect); // Clip the filter primitive rect by the filter region and adjust the source // rectangle if needed. - FloatRect crop_rect( - IntersectWithFilterRegion(GetFilter(), ToGfxRectF(dst_rect))); + gfx::RectF crop_rect = IntersectWithFilterRegion(GetFilter(), dst_rect); if (crop_rect != dst_rect) - src_rect = blink::MapRect(crop_rect, dst_rect, src_rect); - return sk_make_sp<ImagePaintFilter>(std::move(image), src_rect, crop_rect, - cc::PaintFlags::FilterQuality::kHigh); + src_rect = gfx::MapRect(crop_rect, dst_rect, src_rect); + return sk_make_sp<ImagePaintFilter>( + std::move(image), gfx::RectFToSkRect(src_rect), + gfx::RectFToSkRect(crop_rect), cc::PaintFlags::FilterQuality::kHigh); } // "A href reference that is an empty image (zero width or zero height), // that fails to download, is non-existent, or that cannot be displayed
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.cc b/third_party/blink/renderer/core/svg/graphics/svg_image.cc index 28f7f1b6..a4fdca4 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image.cc
@@ -76,6 +76,8 @@ #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" +#include "ui/gfx/geometry/size_conversions.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { @@ -285,17 +287,17 @@ return true; } -IntSize SVGImage::SizeWithConfig(SizeConfig) const { - return RoundedIntSize(intrinsic_size_); +gfx::Size SVGImage::SizeWithConfig(SizeConfig) const { + return ToRoundedSize(intrinsic_size_); } static float ResolveWidthForRatio(float height, - const FloatSize& intrinsic_ratio) { + const gfx::SizeF& intrinsic_ratio) { return height * intrinsic_ratio.width() / intrinsic_ratio.height(); } static float ResolveHeightForRatio(float width, - const FloatSize& intrinsic_ratio) { + const gfx::SizeF& intrinsic_ratio) { return width * intrinsic_ratio.height() / intrinsic_ratio.width(); } @@ -312,11 +314,11 @@ return true; } -FloatSize SVGImage::ConcreteObjectSize( - const FloatSize& default_object_size) const { +gfx::SizeF SVGImage::ConcreteObjectSize( + const gfx::SizeF& default_object_size) const { IntrinsicSizingInfo intrinsic_sizing_info; if (!GetIntrinsicSizingInfo(intrinsic_sizing_info)) - return FloatSize(); + return gfx::SizeF(); // https://www.w3.org/TR/css3-images/#default-sizing if (intrinsic_sizing_info.has_width && intrinsic_sizing_info.has_height) @@ -332,22 +334,23 @@ if (intrinsic_sizing_info.has_width) { if (intrinsic_sizing_info.aspect_ratio.IsEmpty()) { - return FloatSize(intrinsic_sizing_info.size.width(), - default_object_size.height()); + return gfx::SizeF(intrinsic_sizing_info.size.width(), + default_object_size.height()); } - return FloatSize(intrinsic_sizing_info.size.width(), - ResolveHeightForRatio(intrinsic_sizing_info.size.width(), - intrinsic_sizing_info.aspect_ratio)); + return gfx::SizeF( + intrinsic_sizing_info.size.width(), + ResolveHeightForRatio(intrinsic_sizing_info.size.width(), + intrinsic_sizing_info.aspect_ratio)); } if (intrinsic_sizing_info.has_height) { if (intrinsic_sizing_info.aspect_ratio.IsEmpty()) { - return FloatSize(default_object_size.width(), - intrinsic_sizing_info.size.height()); + return gfx::SizeF(default_object_size.width(), + intrinsic_sizing_info.size.height()); } - return FloatSize(ResolveWidthForRatio(intrinsic_sizing_info.size.height(), - intrinsic_sizing_info.aspect_ratio), - intrinsic_sizing_info.size.height()); + return gfx::SizeF(ResolveWidthForRatio(intrinsic_sizing_info.size.height(), + intrinsic_sizing_info.aspect_ratio), + intrinsic_sizing_info.size.height()); } if (!intrinsic_sizing_info.aspect_ratio.IsEmpty()) { @@ -358,49 +361,50 @@ float solution_width = ResolveWidthForRatio( default_object_size.height(), intrinsic_sizing_info.aspect_ratio); if (solution_width <= default_object_size.width()) - return FloatSize(solution_width, default_object_size.height()); + return gfx::SizeF(solution_width, default_object_size.height()); float solution_height = ResolveHeightForRatio( default_object_size.width(), intrinsic_sizing_info.aspect_ratio); - return FloatSize(default_object_size.width(), solution_height); + return gfx::SizeF(default_object_size.width(), solution_height); } return default_object_size; } -SVGImage::DrawInfo::DrawInfo(const FloatSize& container_size, +SVGImage::DrawInfo::DrawInfo(const gfx::SizeF& container_size, float zoom, const KURL& url, bool is_dark_mode_enabled) : container_size_(container_size), - rounded_container_size_(RoundedIntSize(container_size)), + rounded_container_size_(gfx::ToRoundedSize(container_size)), zoom_(zoom), url_(url), is_dark_mode_enabled_(is_dark_mode_enabled) {} -FloatSize SVGImage::DrawInfo::CalculateResidualScale() const { - return FloatSize(rounded_container_size_.width() / container_size_.width(), - rounded_container_size_.height() / container_size_.height()); +gfx::SizeF SVGImage::DrawInfo::CalculateResidualScale() const { + return gfx::SizeF( + rounded_container_size_.width() / container_size_.width(), + rounded_container_size_.height() / container_size_.height()); } void SVGImage::DrawForContainer(const DrawInfo& draw_info, cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect) { - FloatRect unzoomed_src = src_rect; + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect) { + gfx::RectF unzoomed_src = src_rect; unzoomed_src.Scale(1 / draw_info.Zoom()); // Compensate for the container size rounding by adjusting the source rect. - FloatSize residual_scale = draw_info.CalculateResidualScale(); - unzoomed_src.set_size(unzoomed_src.size().ScaledBy(residual_scale.width(), - residual_scale.height())); + gfx::SizeF residual_scale = draw_info.CalculateResidualScale(); + unzoomed_src.set_size(gfx::ScaleSize( + unzoomed_src.size(), residual_scale.width(), residual_scale.height())); DrawInternal(draw_info, canvas, flags, dst_rect, unzoomed_src); } PaintImage SVGImage::PaintImageForCurrentFrame() { - const DrawInfo draw_info(FloatSize(intrinsic_size_), 1, NullURL(), false); + const DrawInfo draw_info(gfx::SizeF(intrinsic_size_), 1, NullURL(), false); auto builder = CreatePaintImageBuilder(); PopulatePaintRecordForCurrentFrameForContainer(draw_info, builder); return builder.TakePaintImage(); @@ -409,15 +413,14 @@ void SVGImage::DrawPatternForContainer(const DrawInfo& draw_info, GraphicsContext& context, const cc::PaintFlags& base_flags, - const FloatRect& dst_rect, + const gfx::RectF& dst_rect, const ImageTilingInfo& tiling_info) { // Tile adjusted for scaling/stretch. - FloatRect tile(tiling_info.image_rect); - tile.Scale(tiling_info.scale.width(), tiling_info.scale.height()); + gfx::RectF tile = tiling_info.image_rect; + tile.Scale(tiling_info.scale.x(), tiling_info.scale.y()); // Expand the tile to account for repeat spacing. - FloatRect spaced_tile(tile); - spaced_tile.Expand(tiling_info.spacing); + gfx::RectF spaced_tile(tile.origin(), tile.size() + tiling_info.spacing); SkMatrix pattern_transform; pattern_transform.setTranslate(tiling_info.phase.x() + spaced_tile.x(), @@ -436,8 +439,8 @@ } sk_sp<PaintShader> tile_shader = PaintShader::MakePaintRecord( - builder->EndRecording(), spaced_tile, SkTileMode::kRepeat, - SkTileMode::kRepeat, &pattern_transform); + builder->EndRecording(), gfx::RectFToSkRect(spaced_tile), + SkTileMode::kRepeat, SkTileMode::kRepeat, &pattern_transform); // If the shader could not be instantiated (e.g. non-invertible matrix), // draw transparent. @@ -448,7 +451,7 @@ // Reset filter quality. flags.setFilterQuality(cc::PaintFlags::FilterQuality::kNone); - context.DrawRect(dst_rect, flags, + context.DrawRect(gfx::RectFToSkRect(dst_rect), flags, PaintAutoDarkMode(DarkModeFilter::ElementRole::kSVG, draw_info.IsDarkModeEnabled())); @@ -459,13 +462,14 @@ const DrawInfo& draw_info, PaintImageBuilder& builder) { PaintRecorder recorder; - const FloatSize size(draw_info.ContainerSize().ScaledBy(draw_info.Zoom())); - const IntRect dest_rect(gfx::Point(), RoundedIntSize(size)); - cc::PaintCanvas* canvas = recorder.beginRecording(dest_rect); - DrawForContainer(draw_info, canvas, PaintFlags(), FloatRect(dest_rect), - FloatRect(gfx::PointF(), size)); - builder.set_paint_record(recorder.finishRecordingAsPicture(), - ToGfxRect(dest_rect), + const gfx::SizeF size = + gfx::ScaleSize(draw_info.ContainerSize(), draw_info.Zoom()); + const gfx::Rect dest_rect(gfx::ToRoundedSize(size)); + cc::PaintCanvas* canvas = + recorder.beginRecording(gfx::RectToSkRect(dest_rect)); + DrawForContainer(draw_info, canvas, PaintFlags(), gfx::RectF(dest_rect), + gfx::RectF(size)); + builder.set_paint_record(recorder.finishRecordingAsPicture(), dest_rect, PaintImage::GetNextContentId()); builder.set_completion_state( @@ -483,7 +487,8 @@ if (!record) return false; - const FloatRect bounds(gfx::PointF(), draw_info.ContainerSize()); + const SkRect bounds = + SkRect::MakeSize(gfx::SizeFToSkSize(draw_info.ContainerSize())); flags.setShader(PaintShader::MakePaintRecord( std::move(record), bounds, SkTileMode::kClamp, SkTileMode::kClamp, &local_matrix)); @@ -496,10 +501,10 @@ bool SVGImage::ApplyShader(PaintFlags& flags, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { - const DrawInfo draw_info(FloatSize(intrinsic_size_), 1, NullURL(), + const DrawInfo draw_info(gfx::SizeF(intrinsic_size_), 1, NullURL(), draw_options.apply_dark_mode); return ApplyShaderInternal(draw_info, flags, local_matrix); } @@ -508,8 +513,8 @@ PaintFlags& flags, const SkMatrix& local_matrix) { // Compensate for the container size rounding. - FloatSize residual_scale = - draw_info.CalculateResidualScale().ScaledBy(draw_info.Zoom()); + gfx::SizeF residual_scale = + gfx::ScaleSize(draw_info.CalculateResidualScale(), draw_info.Zoom()); auto adjusted_local_matrix = local_matrix; adjusted_local_matrix.preScale(residual_scale.width(), residual_scale.height()); @@ -518,10 +523,10 @@ void SVGImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { - const DrawInfo draw_info(FloatSize(intrinsic_size_), 1, NullURL(), + const DrawInfo draw_info(gfx::SizeF(intrinsic_size_), 1, NullURL(), draw_options.apply_dark_mode); DrawInternal(draw_info, canvas, flags, dst_rect, src_rect); } @@ -537,9 +542,9 @@ if (LayoutSVGRoot* layout_root = LayoutRoot()) layout_root->SetContainerSize(RoundedLayoutSize(draw_info.ContainerSize())); LocalFrameView* view = GetFrame()->View(); - const IntSize rounded_container_size = draw_info.RoundedContainerSize(); - view->Resize(rounded_container_size); - page_->GetVisualViewport().SetSize(rounded_container_size); + const gfx::Size rounded_container_size = draw_info.RoundedContainerSize(); + view->Resize(IntSize(rounded_container_size)); + page_->GetVisualViewport().SetSize(IntSize(rounded_container_size)); // Always call processUrlFragment, even if the url is empty, because // there may have been a previous url/fragment that needs to be reset. @@ -588,8 +593,8 @@ void SVGImage::DrawInternal(const DrawInfo& draw_info, cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& unzoomed_src_rect) { + const gfx::RectF& dst_rect, + const gfx::RectF& unzoomed_src_rect) { sk_sp<PaintRecord> record = PaintRecordForCurrentFrame(draw_info); if (!record) return; @@ -597,15 +602,16 @@ { PaintCanvasAutoRestore ar(canvas, false); if (DrawNeedsLayer(flags)) { - SkRect layer_rect = dst_rect; + SkRect layer_rect = gfx::RectFToSkRect(dst_rect); canvas->saveLayer(&layer_rect, &flags); } // We can only draw the entire frame, clipped to the rect we want. So // compute where the top left of the image would be if we were drawing // without clipping, and translate accordingly. canvas->save(); - canvas->clipRect(EnclosingIntRect(dst_rect)); - canvas->concat(SkMatrix::RectToRect(unzoomed_src_rect, dst_rect)); + canvas->clipRect(gfx::RectToSkRect(gfx::ToEnclosingRect(dst_rect))); + canvas->concat(SkMatrix::RectToRect(gfx::RectFToSkRect(unzoomed_src_rect), + gfx::RectFToSkRect(dst_rect))); canvas->drawPicture(std::move(record)); canvas->restore(); } @@ -895,7 +901,7 @@ return kSizeUnavailable; // Set the concrete object size before a container size is available. - intrinsic_size_ = RoundedLayoutSize(ConcreteObjectSize(FloatSize( + intrinsic_size_ = RoundedLayoutSize(ConcreteObjectSize(gfx::SizeF( LayoutReplaced::kDefaultWidth, LayoutReplaced::kDefaultHeight))); if (load_state_ == kWaitingForAsyncLoadCompletion)
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.h b/third_party/blink/renderer/core/svg/graphics/svg_image.h index 267d91b..05d33dc 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image.h +++ b/third_party/blink/renderer/core/svg/graphics/svg_image.h
@@ -38,6 +38,8 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/skia/include/core/SkRefCnt.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -73,7 +75,7 @@ static bool IsInSVGImage(const Node*); bool IsSVGImage() const override { return true; } - IntSize SizeWithConfig(SizeConfig) const override; + gfx::Size SizeWithConfig(SizeConfig) const override; void CheckLoaded() const; bool CurrentFrameHasSingleSecurityOrigin() const override; @@ -90,8 +92,8 @@ void AdvanceAnimationForTesting() override; SVGImageChromeClient& ChromeClientForTesting(); - static gfx::PointF OffsetForCurrentFrame(const FloatRect& dst_rect, - const FloatRect& src_rect); + static gfx::PointF OffsetForCurrentFrame(const gfx::RectF& dst_rect, + const gfx::RectF& src_rect); // Service CSS and SMIL animations. void ServiceAnimations(base::TimeTicks monotonic_animation_start_time); @@ -101,7 +103,7 @@ // The defaultObjectSize is assumed to be unzoomed, i.e. it should // not have the effective zoom level applied. The returned size is // thus also independent of current zoom level. - FloatSize ConcreteObjectSize(const FloatSize& default_object_size) const; + gfx::SizeF ConcreteObjectSize(const gfx::SizeF& default_object_size) const; // Get the intrinsic dimensions (width, height and aspect ratio) from this // SVGImage. Returns true if successful. @@ -142,23 +144,23 @@ STACK_ALLOCATED(); public: - DrawInfo(const FloatSize& container_size, + DrawInfo(const gfx::SizeF& container_size, float zoom, const KURL& url, bool is_dark_mode_enabled); - FloatSize CalculateResidualScale() const; + gfx::SizeF CalculateResidualScale() const; float Zoom() const { return zoom_; } - const FloatSize& ContainerSize() const { return container_size_; } - const IntSize& RoundedContainerSize() const { + const gfx::SizeF& ContainerSize() const { return container_size_; } + const gfx::Size& RoundedContainerSize() const { return rounded_container_size_; } const KURL& Url() const { return url_; } bool IsDarkModeEnabled() const { return is_dark_mode_enabled_; } private: - const FloatSize container_size_; - const IntSize rounded_container_size_; + const gfx::SizeF container_size_; + const gfx::Size rounded_container_size_; const float zoom_; const KURL& url_; const bool is_dark_mode_enabled_; @@ -166,18 +168,18 @@ void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; void DrawForContainer(const DrawInfo&, cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect); + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect); void DrawPatternForContainer(const DrawInfo&, GraphicsContext&, const cc::PaintFlags&, - const FloatRect& dst_rect, + const gfx::RectF& dst_rect, const ImageTilingInfo&); void PopulatePaintRecordForCurrentFrameForContainer(const DrawInfo&, PaintImageBuilder&); @@ -188,12 +190,12 @@ void DrawInternal(const DrawInfo&, cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& unzoomed_src_rect); + const gfx::RectF& dst_rect, + const gfx::RectF& unzoomed_src_rect); bool ApplyShader(cc::PaintFlags&, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; bool ApplyShaderForContainer(const DrawInfo&, cc::PaintFlags&,
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.cc b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.cc index 3fdee5f..cdb24cc 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.cc
@@ -19,21 +19,22 @@ #include "third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" +#include "ui/gfx/geometry/size_conversions.h" namespace blink { -IntSize SVGImageForContainer::SizeWithConfig(SizeConfig config) const { - return RoundedIntSize(SizeWithConfigAsFloat(config)); +gfx::Size SVGImageForContainer::SizeWithConfig(SizeConfig config) const { + return gfx::ToRoundedSize(SizeWithConfigAsFloat(config)); } -FloatSize SVGImageForContainer::SizeWithConfigAsFloat(SizeConfig) const { - return container_size_.ScaledBy(zoom_); +gfx::SizeF SVGImageForContainer::SizeWithConfigAsFloat(SizeConfig) const { + return gfx::ScaleSize(container_size_, zoom_); } void SVGImageForContainer::Draw(cc::PaintCanvas* canvas, const cc::PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { const SVGImage::DrawInfo draw_info(container_size_, zoom_, url_, draw_options.apply_dark_mode); @@ -42,7 +43,7 @@ void SVGImageForContainer::DrawPattern(GraphicsContext& context, const cc::PaintFlags& flags, - const FloatRect& dst_rect, + const gfx::RectF& dst_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options) { const SVGImage::DrawInfo draw_info(container_size_, zoom_, url_, @@ -53,8 +54,8 @@ bool SVGImageForContainer::ApplyShader(cc::PaintFlags& flags, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { const SVGImage::DrawInfo draw_info(container_size_, zoom_, url_, draw_options.apply_dark_mode);
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h index 54e5a8e..c5e3b06 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h +++ b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h
@@ -60,30 +60,30 @@ public: static scoped_refptr<SVGImageForContainer> Create( SVGImage* image, - const FloatSize& target_size, + const gfx::SizeF& target_size, float zoom, const KURL& url) { - FloatSize container_size_without_zoom(target_size); - container_size_without_zoom.Scale(1 / zoom); + gfx::SizeF container_size_without_zoom = + gfx::ScaleSize(target_size, 1 / zoom); return base::AdoptRef(new SVGImageForContainer( image, container_size_without_zoom, zoom, url)); } - IntSize SizeWithConfig(SizeConfig) const override; - FloatSize SizeWithConfigAsFloat(SizeConfig) const override; + gfx::Size SizeWithConfig(SizeConfig) const override; + gfx::SizeF SizeWithConfigAsFloat(SizeConfig) const override; bool HasIntrinsicSize() const override { return image_->HasIntrinsicSize(); } bool ApplyShader(cc::PaintFlags&, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) override; void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; // FIXME: Implement this to be less conservative. @@ -96,13 +96,13 @@ protected: void DrawPattern(GraphicsContext&, const cc::PaintFlags&, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo&, const ImageDrawOptions& draw_options) override; private: SVGImageForContainer(SVGImage* image, - const FloatSize& container_size, + const gfx::SizeF& container_size, float zoom, const KURL& url) : image_(image), @@ -113,7 +113,7 @@ void DestroyDecodedData() override {} SVGImage* image_; - const FloatSize container_size_; + const gfx::SizeF container_size_; const float zoom_; const KURL url_; };
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc index 30346245..2966984 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc
@@ -59,7 +59,7 @@ std::unique_ptr<SkCanvas> null_canvas = SkMakeNullCanvas(); SkiaPaintCanvas canvas(null_canvas.get()); PaintFlags flags; - FloatRect dummy_rect(0, 0, 100, 100); + gfx::RectF dummy_rect(0, 0, 100, 100); image->Draw(&canvas, flags, dummy_rect, dummy_rect, ImageDrawOptions()); } @@ -246,7 +246,7 @@ kShouldPause); scoped_refptr<SVGImageForContainer> container = SVGImageForContainer::Create( - &GetImage(), FloatSize(100, 100), 2, NullURL()); + &GetImage(), gfx::SizeF(100, 100), 2, NullURL()); SkBitmap bitmap = container->AsSkBitmapForCurrentFrame(kDoNotRespectImageOrientation); ASSERT_EQ(bitmap.width(), 100);
diff --git a/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.cc b/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.cc index e336ae4b..61b98bf 100644 --- a/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.cc +++ b/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.cc
@@ -181,12 +181,12 @@ return ParseInternal(ptr, end, validate) == SVGParseStatus::kNoError; } -void SVGPreserveAspectRatio::TransformRect(FloatRect& dest_rect, - FloatRect& src_rect) const { +void SVGPreserveAspectRatio::TransformRect(gfx::RectF& dest_rect, + gfx::RectF& src_rect) const { if (align_ == kSvgPreserveaspectratioNone) return; - FloatSize image_size = src_rect.size(); + gfx::SizeF image_size = src_rect.size(); float orig_dest_width = dest_rect.width(); float orig_dest_height = dest_rect.height(); switch (meet_or_slice_) {
diff --git a/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.h b/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.h index 970d00f25..23512ad 100644 --- a/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.h +++ b/third_party/blink/renderer/core/svg/svg_preserve_aspect_ratio.h
@@ -32,7 +32,6 @@ namespace blink { class AffineTransform; -class FloatRect; class SVGPreserveAspectRatioTearOff; class SVGPreserveAspectRatio final @@ -77,7 +76,7 @@ } SVGMeetOrSliceType MeetOrSlice() const { return meet_or_slice_; } - void TransformRect(FloatRect& dest_rect, FloatRect& src_rect) const; + void TransformRect(gfx::RectF& dest_rect, gfx::RectF& src_rect) const; AffineTransform ComputeTransform(const gfx::RectF& view_box, const gfx::SizeF& viewport_size) const;
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index 27fb3ce..4d095b8 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -2587,8 +2587,8 @@ return 0; } - return PrintContext::PageNumberForElement(element, - FloatSize(page_width, page_height)); + return PrintContext::PageNumberForElement( + element, gfx::SizeF(page_width, page_height)); } Vector<String> Internals::IconURLs(Document* document, @@ -2630,7 +2630,7 @@ } return PrintContext::NumberOfPages(GetFrame(), - FloatSize(page_width, page_height)); + gfx::SizeF(page_width, page_height)); } String Internals::pageProperty(String property_name,
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index 3ef74bbd..8aecfc4 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -1000,7 +1000,7 @@ return; SkPath sk_path = path.GetSkPath(); - FloatRect bounds(path.BoundingRect()); + gfx::RectF bounds(path.BoundingRect()); if (std::isnan(bounds.x()) || std::isnan(bounds.y()) || std::isnan(bounds.width()) || std::isnan(bounds.height())) return; @@ -1018,7 +1018,7 @@ { c->drawPath(sk_path, *flags, use_paint_cache); }, [](const SkIRect& rect) // overdraw test lambda { return false; }, - bounds, paint_type, + gfx::RectFToSkRect(bounds), paint_type, GetState().HasPattern(paint_type) ? CanvasRenderingContext2DState::kNonOpaqueImage : CanvasRenderingContext2DState::kNoImage, @@ -1116,7 +1116,10 @@ [rect](cc::PaintCanvas* c, const PaintFlags* flags) // draw lambda { c->drawRect(rect, *flags); }, [rect, this](const SkIRect& clip_bounds) // overdraw test lambda - { return RectContainsTransformedRect(rect, clip_bounds); }, + { + return RectContainsTransformedRect(gfx::SkRectToRectF(rect), + clip_bounds); + }, rect, CanvasRenderingContext2DState::kFillPaintType, GetState().HasPattern(CanvasRenderingContext2DState::kFillPaintType) ? CanvasRenderingContext2DState::kNonOpaqueImage @@ -1124,7 +1127,7 @@ CanvasPerformanceMonitor::DrawType::kRectangle); } -static void StrokeRectOnCanvas(const FloatRect& rect, +static void StrokeRectOnCanvas(const gfx::RectF& rect, cc::PaintCanvas* canvas, const PaintFlags* flags) { DCHECK_EQ(flags->getStyle(), PaintFlags::kStroke_Style); @@ -1137,7 +1140,7 @@ canvas->drawPath(path, *flags); return; } - canvas->drawRect(rect, *flags); + canvas->drawRect(gfx::RectFToSkRect(rect), *flags); } void BaseRenderingContext2D::strokeRect(double x, @@ -1161,8 +1164,8 @@ float fwidth = ClampTo<float>(width); float fheight = ClampTo<float>(height); - SkRect rect = SkRect::MakeXYWH(fx, fy, fwidth, fheight); - FloatRect bounds = rect; + gfx::RectF rect(fx, fy, fwidth, fheight); + gfx::RectF bounds = rect; InflateStrokeRect(bounds); if (!ValidateRectForCanvas(bounds.x(), bounds.y(), bounds.width(), @@ -1172,7 +1175,8 @@ Draw<OverdrawOp::kNone>( [rect](cc::PaintCanvas* c, const PaintFlags* flags) // draw lambda { StrokeRectOnCanvas(rect, c, flags); }, - kNoOverdraw, bounds, CanvasRenderingContext2DState::kStrokePaintType, + kNoOverdraw, gfx::RectFToSkRect(bounds), + CanvasRenderingContext2DState::kStrokePaintType, GetState().HasPattern(CanvasRenderingContext2DState::kStrokePaintType) ? CanvasRenderingContext2DState::kNonOpaqueImage : CanvasRenderingContext2DState::kNoImage, @@ -1321,46 +1325,41 @@ float fwidth = ClampTo<float>(width); float fheight = ClampTo<float>(height); - FloatRect rect(fx, fy, fwidth, fheight); + gfx::RectF rect(fx, fy, fwidth, fheight); if (RectContainsTransformedRect(rect, clip_bounds)) { if (for_reset) { // In the reset case, we can use kUntransformedUnclippedFill because we // know the state state was reset. - CheckOverdraw(rect, &clear_flags, CanvasRenderingContext2DState::kNoImage, + CheckOverdraw(gfx::RectFToSkRect(rect), &clear_flags, + CanvasRenderingContext2DState::kNoImage, OverdrawOp::kContextReset); } else { - CheckOverdraw(rect, &clear_flags, CanvasRenderingContext2DState::kNoImage, + CheckOverdraw(gfx::RectFToSkRect(rect), &clear_flags, + CanvasRenderingContext2DState::kNoImage, OverdrawOp::kClearRect); } GetPaintCanvasForDraw(clip_bounds, CanvasPerformanceMonitor::DrawType::kOther) - ->drawRect(rect, clear_flags); + ->drawRect(gfx::RectFToSkRect(rect), clear_flags); } else { SkIRect dirty_rect; if (ComputeDirtyRect(rect, clip_bounds, &dirty_rect)) { GetPaintCanvasForDraw(clip_bounds, CanvasPerformanceMonitor::DrawType::kOther) - ->drawRect(rect, clear_flags); + ->drawRect(gfx::RectFToSkRect(rect), clear_flags); } } } -static inline FloatRect NormalizeRect(const FloatRect& rect) { - return FloatRect(std::min(rect.x(), rect.right()), - std::min(rect.y(), rect.bottom()), - std::max(rect.width(), -rect.width()), - std::max(rect.height(), -rect.height())); -} - -static inline void ClipRectsToImageRect(const FloatRect& image_rect, - FloatRect* src_rect, - FloatRect* dst_rect) { +static inline void ClipRectsToImageRect(const gfx::RectF& image_rect, + gfx::RectF* src_rect, + gfx::RectF* dst_rect) { if (image_rect.Contains(*src_rect)) return; // Compute the src to dst transform - FloatSize scale(dst_rect->size().width() / src_rect->size().width(), - dst_rect->size().height() / src_rect->size().height()); + gfx::SizeF scale(dst_rect->size().width() / src_rect->size().width(), + dst_rect->size().height() / src_rect->size().height()); gfx::PointF scaled_src_location = src_rect->origin(); scaled_src_location.Scale(scale.width(), scale.height()); gfx::Vector2dF offset = dst_rect->origin() - scaled_src_location; @@ -1384,10 +1383,10 @@ return; RespectImageOrientationEnum respect_orientation = RespectImageOrientationInternal(image_source_internal); - FloatSize default_object_size(Width(), Height()); - FloatSize source_rect_size = image_source_internal->ElementSize( + gfx::SizeF default_object_size(Width(), Height()); + gfx::SizeF source_rect_size = image_source_internal->ElementSize( default_object_size, respect_orientation); - FloatSize dest_rect_size = image_source_internal->DefaultDestinationSize( + gfx::SizeF dest_rect_size = image_source_internal->DefaultDestinationSize( default_object_size, respect_orientation); drawImage(image_source_internal, 0, 0, source_rect_size.width(), source_rect_size.height(), x, y, dest_rect_size.width(), @@ -1404,8 +1403,8 @@ ToCanvasImageSource(image_source, exception_state); if (!image_source_internal) return; - FloatSize default_object_size(Width(), Height()); - FloatSize source_rect_size = image_source_internal->ElementSize( + gfx::SizeF default_object_size(Width(), Height()); + gfx::SizeF source_rect_size = image_source_internal->ElementSize( default_object_size, RespectImageOrientationInternal(image_source_internal)); drawImage(image_source_internal, 0, 0, source_rect_size.width(), @@ -1431,7 +1430,7 @@ } bool BaseRenderingContext2D::ShouldDrawImageAntialiased( - const FloatRect& dest_rect) const { + const gfx::RectF& dest_rect) const { if (!GetState().ShouldAntialias()) return false; cc::PaintCanvas* c = GetPaintCanvas(); @@ -1506,8 +1505,8 @@ cc::PaintCanvas* c, CanvasImageSource* image_source, Image* image, - const FloatRect& src_rect, - const FloatRect& dst_rect, + const gfx::RectF& src_rect, + const gfx::RectF& dst_rect, const SkSamplingOptions& sampling, const PaintFlags* flags) { cc::RecordPaintCanvas::DisableFlushCheckScope disable_flush_check_scope( @@ -1525,7 +1524,7 @@ // crbug.com/504687 return; } - SkRect bounds = dst_rect; + SkRect bounds = gfx::RectFToSkRect(dst_rect); ctm.mapRect(&bounds); if (!bounds.isFinite()) { // There is an earlier check for the correctness of the bounds, but it is @@ -1550,35 +1549,32 @@ if (image_source->IsVideoElement()) { c->save(); - c->clipRect(dst_rect); + c->clipRect(gfx::RectFToSkRect(dst_rect)); c->translate(dst_rect.x(), dst_rect.y()); c->scale(dst_rect.width() / src_rect.width(), dst_rect.height() / src_rect.height()); c->translate(-src_rect.x(), -src_rect.y()); HTMLVideoElement* video = static_cast<HTMLVideoElement*>(image_source); video->PaintCurrentFrame( - c, - IntRect(gfx::Point(), - IntSize(video->videoWidth(), video->videoHeight())), - &image_flags); + c, gfx::Rect(video->videoWidth(), video->videoHeight()), &image_flags); } else if (image_source->IsVideoFrame()) { VideoFrame* frame = static_cast<VideoFrame*>(image_source); auto media_frame = frame->frame(); bool ignore_transformation = RespectImageOrientationInternal(image_source) == kDoNotRespectImageOrientation; - FloatRect corrected_src_rect = src_rect; + gfx::RectF corrected_src_rect = src_rect; if (!ignore_transformation) { auto orientation_enum = VideoTransformationToImageOrientation( media_frame->metadata().transformation.value_or( media::kNoTransformation)); if (ImageOrientation(orientation_enum).UsesWidthAsHeight()) - corrected_src_rect = src_rect.TransposedRect(); + corrected_src_rect = gfx::TransposeRect(src_rect); } c->save(); - c->clipRect(dst_rect); + c->clipRect(gfx::RectFToSkRect(dst_rect)); c->translate(dst_rect.x(), dst_rect.y()); c->scale(dst_rect.width() / corrected_src_rect.width(), dst_rect.height() / corrected_src_rect.height()); @@ -1591,7 +1587,7 @@ // the source of the image. RespectImageOrientationEnum respect_orientation = RespectImageOrientationInternal(image_source); - FloatRect corrected_src_rect = src_rect; + gfx::RectF corrected_src_rect = src_rect; if (respect_orientation == kRespectImageOrientation && !image->HasDefaultOrientation()) { corrected_src_rect = image->CorrectSrcRectForImageOrientation( @@ -1629,7 +1625,7 @@ return; scoped_refptr<Image> image; - FloatSize default_object_size(Width(), Height()); + gfx::SizeF default_object_size(Width(), Height()); SourceImageStatus source_image_status = kInvalidSourceImageStatus; if (!image_source->IsVideoElement()) { image = image_source->GetSourceImageForCanvas(&source_image_status, @@ -1652,6 +1648,8 @@ return; // clamp to float to avoid float cast overflow when used as SkScalar + AdjustRectForCanvas(sx, sy, sw, sh); + AdjustRectForCanvas(dx, dy, dw, dh); float fsx = ClampTo<float>(sx); float fsy = ClampTo<float>(sy); float fsw = ClampTo<float>(sw); @@ -1661,13 +1659,12 @@ float fdw = ClampTo<float>(dw); float fdh = ClampTo<float>(dh); - FloatRect src_rect = NormalizeRect(FloatRect(fsx, fsy, fsw, fsh)); - FloatRect dst_rect = NormalizeRect(FloatRect(fdx, fdy, fdw, fdh)); - FloatSize image_size = image_source->ElementSize( + gfx::RectF src_rect(fsx, fsy, fsw, fsh); + gfx::RectF dst_rect(fdx, fdy, fdw, fdh); + gfx::SizeF image_size = image_source->ElementSize( default_object_size, RespectImageOrientationInternal(image_source)); - ClipRectsToImageRect(FloatRect(gfx::PointF(), image_size), &src_rect, - &dst_rect); + ClipRectsToImageRect(gfx::RectF(image_size), &src_rect, &dst_rect); if (src_rect.IsEmpty()) return; @@ -1698,26 +1695,26 @@ }, [this, dst_rect](const SkIRect& clip_bounds) // overdraw test lambda { return RectContainsTransformedRect(dst_rect, clip_bounds); }, - dst_rect, CanvasRenderingContext2DState::kImagePaintType, + gfx::RectFToSkRect(dst_rect), + CanvasRenderingContext2DState::kImagePaintType, image_source->IsOpaque() ? CanvasRenderingContext2DState::kOpaqueImage : CanvasRenderingContext2DState::kNonOpaqueImage, CanvasPerformanceMonitor::DrawType::kImage); } void BaseRenderingContext2D::ClearCanvasForSrcCompositeOp() { - FloatRect canvas_rect(0, 0, Width(), Height()); cc::PaintCanvas* c = GetOrCreatePaintCanvas(); if (c) c->clear(HasAlpha() ? SK_ColorTRANSPARENT : SK_ColorBLACK); } bool BaseRenderingContext2D::RectContainsTransformedRect( - const FloatRect& rect, + const gfx::RectF& rect, const SkIRect& transformed_rect) const { FloatQuad quad(rect); FloatQuad transformed_quad( - FloatRect(transformed_rect.x(), transformed_rect.y(), - transformed_rect.width(), transformed_rect.height())); + gfx::RectF(transformed_rect.x(), transformed_rect.y(), + transformed_rect.width(), transformed_rect.height())); return GetState().GetTransform().MapQuad(quad).ContainsQuad(transformed_quad); } @@ -1833,7 +1830,7 @@ SourceImageStatus status; - FloatSize default_object_size(Width(), Height()); + gfx::SizeF default_object_size(Width(), Height()); scoped_refptr<Image> image_for_rendering = image_source->GetSourceImageForCanvas(&status, default_object_size); @@ -1879,7 +1876,7 @@ return pattern; } -bool BaseRenderingContext2D::ComputeDirtyRect(const FloatRect& local_rect, +bool BaseRenderingContext2D::ComputeDirtyRect(const gfx::RectF& local_rect, SkIRect* dirty_rect) { SkIRect clip_bounds; cc::PaintCanvas* paint_canvas = GetOrCreatePaintCanvas(); @@ -2212,7 +2209,7 @@ source.rowBytes(), dest_x, dest_y); } -void BaseRenderingContext2D::InflateStrokeRect(FloatRect& rect) const { +void BaseRenderingContext2D::InflateStrokeRect(gfx::RectF& rect) const { // Fast approximation of the stroke's bounding rect. // This yields a slightly oversized rect but is very fast // compared to Path::strokeBoundingRect().
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h index 632eba4..0fcad4d 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h
@@ -19,6 +19,7 @@ #include "third_party/blink/renderer/modules/canvas/canvas2d/identifiability_study_helper.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/graphics/image_orientation.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { @@ -401,8 +402,8 @@ return *state_stack_.back(); } - bool ComputeDirtyRect(const FloatRect& local_bounds, SkIRect*); - bool ComputeDirtyRect(const FloatRect& local_bounds, + bool ComputeDirtyRect(const gfx::RectF& local_bounds, SkIRect*); + bool ComputeDirtyRect(const gfx::RectF& local_bounds, const SkIRect& transformed_clip_bounds, SkIRect*); @@ -416,7 +417,7 @@ CanvasRenderingContext2DState::ImageType, CanvasPerformanceMonitor::DrawType); - void InflateStrokeRect(FloatRect&) const; + void InflateStrokeRect(gfx::RectF&) const; void UnwindStateStack(); @@ -499,7 +500,7 @@ // EndLayer. void PopAndRestore(); - bool ShouldDrawImageAntialiased(const FloatRect& dest_rect) const; + bool ShouldDrawImageAntialiased(const gfx::RectF& dest_rect) const; void SetTransform(const TransformationMatrix&); @@ -538,8 +539,8 @@ void DrawImageInternal(cc::PaintCanvas*, CanvasImageSource*, Image*, - const FloatRect& src_rect, - const FloatRect& dst_rect, + const gfx::RectF& src_rect, + const gfx::RectF& dst_rect, const SkSamplingOptions&, const PaintFlags*); void ClipInternal(const Path&, @@ -567,7 +568,7 @@ void AdjustRectForCanvas(T& x, T& y, T& width, T& height); void ClearCanvasForSrcCompositeOp(); - bool RectContainsTransformedRect(const FloatRect&, const SkIRect&) const; + bool RectContainsTransformedRect(const gfx::RectF&, const SkIRect&) const; // Sets the origin to be tainted by the content of the canvas, such // as a cross-origin image. This is as opposed to some other reason // such as tainting from a filter applied to the canvas. @@ -661,7 +662,8 @@ draw_func(GetPaintCanvasForDraw(clip_bounds, draw_type), flags); } else { SkIRect dirty_rect; - if (ComputeDirtyRect(bounds, clip_bounds, &dirty_rect)) { + if (ComputeDirtyRect(gfx::SkRectToRectF(bounds), clip_bounds, + &dirty_rect)) { const PaintFlags* flags = state.GetFlags(paint_type, kDrawShadowAndForeground, image_type); if (paint_type != CanvasRenderingContext2DState::kStrokePaintType && @@ -838,21 +840,21 @@ } ALWAYS_INLINE bool BaseRenderingContext2D::ComputeDirtyRect( - const FloatRect& local_rect, + const gfx::RectF& local_rect, const SkIRect& transformed_clip_bounds, SkIRect* dirty_rect) { DCHECK(dirty_rect); const CanvasRenderingContext2DState& state = GetState(); - FloatRect canvas_rect = state.GetTransform().MapRect(local_rect); + gfx::RectF canvas_rect = state.GetTransform().MapRect(local_rect); if (UNLIKELY(AlphaChannel(state.ShadowColor()))) { - FloatRect shadow_rect(canvas_rect); + gfx::RectF shadow_rect(canvas_rect); shadow_rect.Offset(state.ShadowOffset()); shadow_rect.Outset(ClampTo<float>(state.ShadowBlur())); canvas_rect.Union(shadow_rect); } - static_cast<SkRect>(canvas_rect).roundOut(dirty_rect); + gfx::RectFToSkRect(canvas_rect).roundOut(dirty_rect); if (UNLIKELY(!dirty_rect->intersect(transformed_clip_bounds))) return false;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc index 9025622..4418840 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
@@ -1031,7 +1031,7 @@ break; } - FloatRect bounds( + gfx::RectF bounds( location.x() - font_metrics.Height() / 2, location.y() - font_metrics.Ascent() - font_metrics.LineGap(), ClampTo<float>(width + font_metrics.Height()), @@ -1064,7 +1064,8 @@ }, [](const SkIRect& rect) // overdraw test lambda { return false; }, - bounds, paint_type, CanvasRenderingContext2DState::kNoImage, + gfx::RectFToSkRect(bounds), paint_type, + CanvasRenderingContext2DState::kNoImage, CanvasPerformanceMonitor::DrawType::kText); } @@ -1174,8 +1175,7 @@ stroke_data.SetThickness(kFocusRingWidth); SkIRect dirty_rect; - if (!ComputeDirtyRect(FloatRect(path.StrokeBoundingRect(stroke_data)), - &dirty_rect)) + if (!ComputeDirtyRect(path.StrokeBoundingRect(stroke_data), &dirty_rect)) return; DidDraw(dirty_rect, CanvasPerformanceMonitor::DrawType::kPath);
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc index a9a5620..c554518 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.cc
@@ -410,7 +410,7 @@ } sk_sp<PaintFilter> CanvasRenderingContext2DState::GetFilterForOffscreenCanvas( - IntSize canvas_size, + gfx::Size canvas_size, BaseRenderingContext2D* context) { ValidateFilterState(); if (filter_state_ != FilterState::kUnresolved) @@ -434,7 +434,7 @@ stroke_flags_for_filter.setColor(stroke_style_->PaintColor()); FilterEffectBuilder filter_effect_builder( - gfx::RectF(gfx::SizeF(ToGfxSize(canvas_size))), + gfx::RectF(gfx::SizeF(canvas_size)), 1.0f, // Deliberately ignore zoom on the canvas element. &fill_flags_for_filter, &stroke_flags_for_filter); @@ -454,7 +454,7 @@ sk_sp<PaintFilter> CanvasRenderingContext2DState::GetFilter( Element* style_resolution_host, - IntSize canvas_size, + gfx::Size canvas_size, CanvasRenderingContext2D* context) { // TODO(1189879): Investigate refactoring all filter logic into the // CanvasFilterOperationResolver class @@ -506,7 +506,7 @@ stroke_flags_for_filter.setColor(stroke_style_->PaintColor()); FilterEffectBuilder filter_effect_builder( - gfx::RectF(gfx::SizeF(ToGfxSize(canvas_size))), + gfx::RectF(gfx::SizeF(canvas_size)), 1.0f, // Deliberately ignore zoom on the canvas element. &fill_flags_for_filter, &stroke_flags_for_filter);
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.h b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.h index a7b4e78..acf8dc7 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.h +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_state.h
@@ -117,9 +117,9 @@ void SetCanvasFilter(CanvasFilter* filter_value); CanvasFilter* GetCanvasFilter() const { return canvas_filter_; } sk_sp<PaintFilter> GetFilter(Element*, - IntSize canvas_size, + gfx::Size canvas_size, CanvasRenderingContext2D*); - sk_sp<PaintFilter> GetFilterForOffscreenCanvas(IntSize canvas_size, + sk_sp<PaintFilter> GetFilterForOffscreenCanvas(gfx::Size canvas_size, BaseRenderingContext2D*); ALWAYS_INLINE bool IsFilterUnresolved() const { return filter_state_ == FilterState::kUnresolved;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc index 2e812f55..9fd25911 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc
@@ -69,16 +69,16 @@ class FakeImageSource : public CanvasImageSource { public: - FakeImageSource(IntSize, BitmapOpacity); + FakeImageSource(gfx::Size, BitmapOpacity); scoped_refptr<Image> GetSourceImageForCanvas(SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition) override; bool WouldTaintOrigin() const override { return false; } - FloatSize ElementSize(const FloatSize&, - const RespectImageOrientationEnum) const override { - return FloatSize(size_); + gfx::SizeF ElementSize(const gfx::SizeF&, + const RespectImageOrientationEnum) const override { + return gfx::SizeF(size_); } bool IsOpaque() const override { return is_opaque_; } bool IsAccelerated() const override { return false; } @@ -86,12 +86,12 @@ ~FakeImageSource() override = default; private: - IntSize size_; + gfx::Size size_; scoped_refptr<Image> image_; bool is_opaque_; }; -FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) +FakeImageSource::FakeImageSource(gfx::Size size, BitmapOpacity opacity) : size_(size), is_opaque_(opacity == kOpaqueBitmap) { sk_sp<SkSurface> surface( SkSurface::MakeRasterN32Premul(size_.width(), size_.height())); @@ -102,7 +102,7 @@ scoped_refptr<Image> FakeImageSource::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) { // Only cover premultiply alpha cases. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha); @@ -163,7 +163,7 @@ void TearDown() override; void UnrefCanvas(); - std::unique_ptr<Canvas2DLayerBridge> MakeBridge(const IntSize&, RasterMode); + std::unique_ptr<Canvas2DLayerBridge> MakeBridge(const gfx::Size&, RasterMode); Document& GetDocument() const { return *web_view_helper_->GetWebView() @@ -223,8 +223,8 @@ CanvasRenderingContext2DTest::CanvasRenderingContext2DTest() : wrap_gradients_(MakeGarbageCollected<WrapGradients>()), - opaque_bitmap_(IntSize(10, 10), kOpaqueBitmap), - alpha_bitmap_(IntSize(10, 10), kTransparentBitmap) {} + opaque_bitmap_(gfx::Size(10, 10), kOpaqueBitmap), + alpha_bitmap_(gfx::Size(10, 10), kTransparentBitmap) {} void CanvasRenderingContext2DTest::CreateContext( OpacityMode opacity_mode, @@ -311,7 +311,7 @@ } std::unique_ptr<Canvas2DLayerBridge> CanvasRenderingContext2DTest::MakeBridge( - const IntSize& size, + const gfx::Size& size, RasterMode raster_mode) { std::unique_ptr<Canvas2DLayerBridge> bridge = std::make_unique<Canvas2DLayerBridge>(size, raster_mode, kNonOpaque); @@ -323,7 +323,7 @@ class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge { public: - FakeCanvas2DLayerBridge(const IntSize& size, + FakeCanvas2DLayerBridge(const gfx::Size& size, OpacityMode opacity_mode, RasterModeHint hint) : Canvas2DLayerBridge(size, RasterMode::kCPU, opacity_mode), @@ -376,7 +376,7 @@ class MockImageBufferSurfaceForOverwriteTesting : public Canvas2DLayerBridge { public: - MockImageBufferSurfaceForOverwriteTesting(const IntSize& size, + MockImageBufferSurfaceForOverwriteTesting(const gfx::Size& size, OpacityMode opacity_mode) : Canvas2DLayerBridge(size, RasterMode::kCPU, opacity_mode) {} ~MockImageBufferSurfaceForOverwriteTesting() override = default; @@ -410,7 +410,7 @@ CanvasRenderingContext2DTest::SetUp(); histogram_tester_ = std::make_unique<base::HistogramTester>(); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); std::unique_ptr<MockImageBufferSurfaceForOverwriteTesting> mock_surface = std::make_unique<MockImageBufferSurfaceForOverwriteTesting>(size, kNonOpaque); @@ -754,7 +754,7 @@ TEST_P(CanvasRenderingContext2DTest, ImageResourceLifetime) { auto* canvas = To<HTMLCanvasElement>( GetDocument().CreateRawElement(html_names::kCanvasTag)); - canvas->SetSize(IntSize(40, 40)); + canvas->SetSize(gfx::Size(40, 40)); ImageBitmap* image_bitmap_derived = nullptr; { const ImageBitmapOptions* default_options = ImageBitmapOptions::Create(); @@ -781,7 +781,7 @@ TEST_P(CanvasRenderingContext2DTest, GPUMemoryUpdateForAcceleratedCanvas) { CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); std::unique_ptr<FakeCanvasResourceProvider> fake_resource_provider = std::make_unique<FakeCanvasResourceProvider>( SkImageInfo::MakeN32Premul(size.width(), size.height()), @@ -810,7 +810,7 @@ To<HTMLCanvasElement>(GetDocument().getElementById("d")); CanvasContextCreationAttributesCore attributes; anotherCanvas->GetCanvasRenderingContext("2d", attributes); - IntSize size2(10, 5); + gfx::Size size2(10, 5); std::unique_ptr<FakeCanvas2DLayerBridge> fake_2d_layer_bridge2 = std::make_unique<FakeCanvas2DLayerBridge>(size2, kNonOpaque, RasterModeHint::kPreferGPU); @@ -823,11 +823,11 @@ size2); // Tear down the first image buffer that resides in current canvas element - CanvasElement().SetSize(IntSize(20, 20)); + CanvasElement().SetSize(gfx::Size(20, 20)); Mock::VerifyAndClearExpectations(fake_2d_layer_bridge_ptr); // Tear down the second image buffer - anotherCanvas->SetSize(IntSize(20, 20)); + anotherCanvas->SetSize(gfx::Size(20, 20)); } TEST_P(CanvasRenderingContext2DTest, CanvasDisposedBeforeContext) { @@ -860,7 +860,7 @@ // certain code paths in canvas 2d (that depend on the existence of // CanvasResourceProvider) will be changed too, causing bad regressions. CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -874,7 +874,7 @@ DISABLED_DisableAcceleration_UpdateGPUMemoryUsage) { CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -900,7 +900,7 @@ InSequence s; CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1143,7 +1143,7 @@ NOTREACHED(); } - image_data = ImageData::CreateForTest(IntSize(2, 2), data_array, + image_data = ImageData::CreateForTest(gfx::Size(2, 2), data_array, image_data_color_spaces[i], image_data_storage_formats[j]); unsigned k = static_cast<unsigned>(canvas_colorspace_setting); @@ -1257,7 +1257,7 @@ TEST_P(CanvasRenderingContext2DTest, RemainAcceleratedAfterGetImageData) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1273,7 +1273,7 @@ TEST_P(CanvasRenderingContext2DTest, AutoFlush) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1298,7 +1298,7 @@ TEST_P(CanvasRenderingContext2DTest, AutoFlushPinnedImages) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1318,7 +1318,7 @@ size_t expected_op_count = initial_op_count; for (size_t pinned_bytes = 0; pinned_bytes <= kMaxPinnedImageBytes; pinned_bytes += kBytesPerImage) { - FakeImageSource unique_image(IntSize(kImageSize, kImageSize), + FakeImageSource unique_image(gfx::Size(kImageSize, kImageSize), kOpaqueBitmap); NonThrowableExceptionState exception_state; Context2D()->drawImage(&unique_image, 0, 0, 1, 1, 0, 0, 1, 1, @@ -1337,7 +1337,7 @@ TEST_P(CanvasRenderingContext2DTest, OverdrawResetsPinnedImageBytes) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1346,7 +1346,8 @@ constexpr unsigned int kImageSize = 10; constexpr unsigned int kBytesPerImage = 400; - FakeImageSource unique_image(IntSize(kImageSize, kImageSize), kOpaqueBitmap); + FakeImageSource unique_image(gfx::Size(kImageSize, kImageSize), + kOpaqueBitmap); NonThrowableExceptionState exception_state; Context2D()->drawImage(&unique_image, 0, 0, 10, 10, 0, 0, 10, 10, exception_state); @@ -1363,7 +1364,7 @@ TEST_P(CanvasRenderingContext2DTest, AutoFlushSameImage) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1375,7 +1376,7 @@ constexpr unsigned int kImageSize = 10; constexpr unsigned int kBytesPerImage = 400; - FakeImageSource image(IntSize(kImageSize, kImageSize), kOpaqueBitmap); + FakeImageSource image(gfx::Size(kImageSize, kImageSize), kOpaqueBitmap); for (size_t pinned_bytes = 0; pinned_bytes <= 2 * kMaxPinnedImageBytes; pinned_bytes += kBytesPerImage) { @@ -1391,7 +1392,7 @@ TEST_P(CanvasRenderingContext2DTest, AutoFlushDelayedByLayer) { ScopedNewCanvas2DAPIForTest new_api(true); CreateContext(kNonOpaque); - IntSize size(10, 10); + gfx::Size size(10, 10); auto fake_accelerate_surface = std::make_unique<FakeCanvas2DLayerBridge>( size, kNonOpaque, RasterModeHint::kPreferGPU); CanvasElement().SetResourceProviderForTesting( @@ -1426,7 +1427,7 @@ TEST_P(CanvasRenderingContext2DTestAccelerated, ElementRequestsCompositingUpdateOnHibernateAndWakeUp) { CreateContext(kNonOpaque); - IntSize size(300, 300); + gfx::Size size(300, 300); std::unique_ptr<Canvas2DLayerBridge> bridge = std::make_unique<Canvas2DLayerBridge>(size, RasterMode::kGPU, kNonOpaque); // Force hibernatation to occur in an immediate task. @@ -1486,7 +1487,7 @@ TEST_P(CanvasRenderingContext2DTestAccelerated, NoHibernationIfNoResourceProvider) { CreateContext(kNonOpaque); - IntSize size(300, 300); + gfx::Size size(300, 300); std::unique_ptr<Canvas2DLayerBridge> bridge = std::make_unique<Canvas2DLayerBridge>(size, RasterMode::kGPU, kNonOpaque); // Force hibernatation to occur in an immediate task.
diff --git a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc index bb21278..d8e256a 100644 --- a/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
@@ -703,7 +703,7 @@ break; } - FloatRect bounds( + gfx::RectF bounds( location.x() - font_metrics.Height() / 2, location.y() - font_metrics.Ascent() - font_metrics.LineGap(), width + font_metrics.Height(), font_metrics.LineSpacing()); @@ -734,7 +734,8 @@ }, [](const SkIRect& rect) // overdraw test lambda { return false; }, - bounds, paint_type, CanvasRenderingContext2DState::kNoImage, + gfx::RectFToSkRect(bounds), paint_type, + CanvasRenderingContext2DState::kNoImage, CanvasPerformanceMonitor::DrawType::kText); // |paint_canvas| maybe rese during Draw. If that happens,
diff --git a/third_party/blink/renderer/modules/csspaint/css_paint_definition.cc b/third_party/blink/renderer/modules/csspaint/css_paint_definition.cc index d7626c79..79720bc 100644 --- a/third_party/blink/renderer/modules/csspaint/css_paint_definition.cc +++ b/third_party/blink/renderer/modules/csspaint/css_paint_definition.cc
@@ -26,12 +26,12 @@ namespace { -FloatSize GetSpecifiedSize(const FloatSize& size, float zoom) { +gfx::SizeF GetSpecifiedSize(const gfx::SizeF& size, float zoom) { float un_zoom_factor = 1 / zoom; auto un_zoom_fn = [un_zoom_factor](float a) -> float { return a * un_zoom_factor; }; - return FloatSize(un_zoom_fn(size.width()), un_zoom_fn(size.height())); + return gfx::SizeF(un_zoom_fn(size.width()), un_zoom_fn(size.height())); } } // namespace @@ -75,7 +75,7 @@ ApplyAnimatedPropertyOverrides(style_map, animated_property_values); sk_sp<PaintRecord> result = - Paint(FloatSize(input->GetSize()), input->EffectiveZoom(), style_map, + Paint(input->GetSize(), input->EffectiveZoom(), style_map, &paint_arguments, input->DeviceScaleFactor()); // Return empty record if paint fails. @@ -85,12 +85,12 @@ } sk_sp<PaintRecord> CSSPaintDefinition::Paint( - const FloatSize& container_size, + const gfx::SizeF& container_size, float zoom, StylePropertyMapReadOnly* style_map, const CSSStyleValueVector* paint_arguments, float device_scale_factor) { - const FloatSize specified_size = GetSpecifiedSize(container_size, zoom); + const gfx::SizeF specified_size = GetSpecifiedSize(container_size, zoom); ScriptState::Scope scope(script_state_); MaybeCreatePaintInstance(); @@ -103,7 +103,7 @@ // Do subpixel snapping for the |container_size|. auto* rendering_context = MakeGarbageCollected<PaintRenderingContext2D>( - RoundedIntSize(container_size), context_settings_, zoom, + ToRoundedSize(container_size), context_settings_, zoom, device_scale_factor, global_scope_); PaintSize* paint_size = MakeGarbageCollected<PaintSize>(specified_size);
diff --git a/third_party/blink/renderer/modules/csspaint/css_paint_definition.h b/third_party/blink/renderer/modules/csspaint/css_paint_definition.h index 5a62d6c..47cff4ff 100644 --- a/third_party/blink/renderer/modules/csspaint/css_paint_definition.h +++ b/third_party/blink/renderer/modules/csspaint/css_paint_definition.h
@@ -61,7 +61,7 @@ // throws an error. // // The |container_size| is without subpixel snapping. - sk_sp<PaintRecord> Paint(const FloatSize& container_size, + sk_sp<PaintRecord> Paint(const gfx::SizeF& container_size, float zoom, StylePropertyMapReadOnly*, const CSSStyleValueVector*,
diff --git a/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.cc b/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.cc index 92217c0..4effb96c 100644 --- a/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.cc +++ b/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.cc
@@ -53,7 +53,7 @@ scoped_refptr<Image> CSSPaintImageGeneratorImpl::Paint( const ImageResourceObserver& observer, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector* data, float device_scale_factor) { return paint_worklet_->Paint(name_, observer, container_size, data,
diff --git a/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.h b/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.h index 45d3aa2..8d03983 100644 --- a/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.h +++ b/third_party/blink/renderer/modules/csspaint/css_paint_image_generator_impl.h
@@ -34,7 +34,7 @@ // The |container_size| is without subpixel snapping. scoped_refptr<Image> Paint(const ImageResourceObserver&, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector*, float device_scale_factor) final; const Vector<CSSPropertyID>& NativeInvalidationProperties() const final;
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.cc b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.cc index e688e91..645de99 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.cc +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.cc
@@ -40,7 +40,7 @@ class BackgroundColorPaintWorkletInput : public PaintWorkletInput { public: BackgroundColorPaintWorkletInput( - const FloatSize& container_size, + const gfx::SizeF& container_size, int worklet_id, const Vector<Color>& animated_colors, const Vector<double>& offsets, @@ -178,7 +178,7 @@ animated_property_values) { const BackgroundColorPaintWorkletInput* input = static_cast<const BackgroundColorPaintWorkletInput*>(compositor_input); - FloatSize container_size = input->ContainerSize(); + gfx::SizeF container_size = input->ContainerSize(); Vector<Color> animated_colors = input->AnimatedColors(); Vector<double> offsets = input->Offsets(); DCHECK_GT(animated_colors.size(), 1u); @@ -230,7 +230,7 @@ // When render this element, we always do pixel snapping to its nearest pixel, // therefore we use rounded |container_size| to create the rendering context. - IntSize rounded_size = RoundedIntSize(container_size); + gfx::Size rounded_size = gfx::ToRoundedSize(container_size); if (!context_ || context_->Width() != rounded_size.width() || context_->Height() != rounded_size.height()) { PaintRenderingContext2DSettings* context_settings = @@ -243,7 +243,7 @@ } scoped_refptr<Image> BackgroundColorPaintDefinition::Paint( - const FloatSize& container_size, + const gfx::SizeF& container_size, const Node* node, const Vector<Color>& animated_colors, const Vector<double>& offsets, @@ -282,7 +282,7 @@ const Vector<double>& offsets, const CompositorPaintWorkletJob::AnimatedPropertyValues& animated_property_values) { - FloatSize container_size(100, 100); + gfx::SizeF container_size(100, 100); absl::optional<double> progress = 0; CompositorPaintWorkletInput::PropertyKeys property_keys; scoped_refptr<BackgroundColorPaintWorkletInput> input =
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.h b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.h index 436bdab..e119688 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.h +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_definition.h
@@ -37,7 +37,7 @@ const CompositorPaintWorkletJob::AnimatedPropertyValues&) override; // The |container_size| is without subpixel snapping. - scoped_refptr<Image> Paint(const FloatSize& container_size, + scoped_refptr<Image> Paint(const gfx::SizeF& container_size, const Node*, const Vector<Color>& animated_colors, const Vector<double>& offsets,
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.cc b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.cc index 1bc4d9a..13e5993 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.cc +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.cc
@@ -29,7 +29,7 @@ : background_color_paint_definition_(background_color_paint_definition) {} scoped_refptr<Image> BackgroundColorPaintImageGeneratorImpl::Paint( - const FloatSize& container_size, + const gfx::SizeF& container_size, const Node* node, const Vector<Color>& animated_colors, const Vector<double>& offsets,
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.h b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.h index 51f653b..0246d00 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.h +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/background_color_paint_image_generator_impl.h
@@ -25,7 +25,7 @@ ~BackgroundColorPaintImageGeneratorImpl() override = default; // The |container_size| is without subpixel snapping. - scoped_refptr<Image> Paint(const FloatSize& container_size, + scoped_refptr<Image> Paint(const gfx::SizeF& container_size, const Node*, const Vector<Color>& animated_colors, const Vector<double>& offsets,
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.cc b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.cc index 3181e08..a3179ba3 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.cc +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.cc
@@ -31,7 +31,7 @@ class ClipPathPaintWorkletInput : public PaintWorkletInput { public: ClipPathPaintWorkletInput( - const FloatRect& container_rect, + const gfx::RectF& container_rect, int worklet_id, float zoom, const Vector<scoped_refptr<BasicShape>>& animated_shapes, @@ -201,7 +201,7 @@ animated_property_values) { const ClipPathPaintWorkletInput* input = To<ClipPathPaintWorkletInput>(compositor_input); - FloatSize container_size = input->ContainerSize(); + gfx::SizeF container_size = input->ContainerSize(); const Vector<InterpolationValue>& interpolation_values = input->InterpolationValues(); @@ -269,12 +269,11 @@ scoped_refptr<ShapeClipPathOperation> current_shape = ShapeClipPathOperation::Create(result_shape); - Path path = current_shape->GetPath(gfx::RectF(ToGfxSizeF(container_size)), - input->Zoom()); + Path path = current_shape->GetPath(gfx::RectF(container_size), input->Zoom()); PaintRenderingContext2DSettings* context_settings = PaintRenderingContext2DSettings::Create(); auto* rendering_context = MakeGarbageCollected<PaintRenderingContext2D>( - RoundedIntSize(container_size), context_settings, 1, 1); + gfx::ToRoundedSize(container_size), context_settings, 1, 1); PaintFlags flags; flags.setAntiAlias(true); @@ -285,7 +284,7 @@ scoped_refptr<Image> ClipPathPaintDefinition::Paint( float zoom, - const FloatRect& reference_box, + const gfx::RectF& reference_box, const Node& node) { DCHECK(node.IsElementNode()); const Element* element = static_cast<Element*>(const_cast<Node*>(&node));
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.h b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.h index a63bae1b..8e223052 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.h +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.h
@@ -8,10 +8,13 @@ #include "third_party/blink/renderer/modules/csspaint/nativepaint/native_css_paint_definition.h" #include "third_party/blink/renderer/modules/modules_export.h" +namespace gfx { +class RectF; +} + namespace blink { class Animation; -class FloatRect; class Image; class LocalFrame; class Node; @@ -33,7 +36,7 @@ const CompositorPaintWorkletJob::AnimatedPropertyValues&) override; scoped_refptr<Image> Paint(float zoom, - const FloatRect& reference_box, + const gfx::RectF& reference_box, const Node&); static Animation* GetAnimationIfCompositable(const Element* element); void Trace(Visitor* visitor) const override;
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.cc b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.cc index f62b6cb..288567b8 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.cc +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.cc
@@ -28,7 +28,7 @@ scoped_refptr<Image> ClipPathPaintImageGeneratorImpl::Paint( float zoom, - const FloatRect& reference_box, + const gfx::RectF& reference_box, const Node& node) { return clip_path_paint_definition_->Paint(zoom, reference_box, node); }
diff --git a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.h b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.h index 04461af..25602dd 100644 --- a/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.h +++ b/third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_image_generator_impl.h
@@ -23,7 +23,7 @@ ~ClipPathPaintImageGeneratorImpl() override = default; scoped_refptr<Image> Paint(float zoom, - const FloatRect& reference_box, + const gfx::RectF& reference_box, const Node&) final; Animation* GetAnimationIfCompositable(const Element* element) final;
diff --git a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.cc b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.cc index c9e64ed..d74efc40 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.cc
@@ -10,7 +10,7 @@ namespace blink { PaintRenderingContext2D::PaintRenderingContext2D( - const IntSize& container_size, + const gfx::Size& container_size, const PaintRenderingContext2DSettings* context_settings, float zoom, float device_scale_factor, @@ -120,8 +120,7 @@ } sk_sp<PaintFilter> PaintRenderingContext2D::StateGetFilter() { - return GetState().GetFilterForOffscreenCanvas(IntSize(Width(), Height()), - this); + return GetState().GetFilterForOffscreenCanvas(container_size_, this); } CanvasColorParams PaintRenderingContext2D::GetCanvas2DColorParams() const {
diff --git a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.h b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.h index f29a3cc..aa167f80 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.h +++ b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d.h
@@ -31,7 +31,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - PaintRenderingContext2D(const IntSize& container_size, + PaintRenderingContext2D(const gfx::Size& container_size, const PaintRenderingContext2DSettings*, float zoom, float device_scale_factor, @@ -115,7 +115,7 @@ std::unique_ptr<PaintRecorder> paint_recorder_; sk_sp<PaintRecord> previous_frame_; - IntSize container_size_; + gfx::Size container_size_; Member<const PaintRenderingContext2DSettings> context_settings_; bool did_record_draw_commands_in_paint_recorder_; // The paint worklet canvas operates on CSS pixels, and that's different than
diff --git a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d_test.cc b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d_test.cc index dc65425..bed031c 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_rendering_context_2d_test.cc
@@ -33,7 +33,7 @@ PaintRenderingContext2DSettings::Create(); context_settings->setAlpha(false); PaintRenderingContext2D* ctx = MakeGarbageCollected<PaintRenderingContext2D>( - IntSize(kWidth, kHeight), context_settings, kZoom, + gfx::Size(kWidth, kHeight), context_settings, kZoom, 1.0 /* device_scale_factor */); TrySettingStrokeStyle(ctx, "#0000ff", "blue"); TrySettingStrokeStyle(ctx, "#000000", "currentColor"); @@ -43,7 +43,7 @@ PaintRenderingContext2DSettings* context_settings = PaintRenderingContext2DSettings::Create(); PaintRenderingContext2D* ctx = MakeGarbageCollected<PaintRenderingContext2D>( - IntSize(kWidth, kHeight), context_settings, kZoom, + gfx::Size(kWidth, kHeight), context_settings, kZoom, 1.0 /* device_scale_factor */); EXPECT_EQ(kWidth, ctx->Width()); EXPECT_EQ(kHeight, ctx->Height()); @@ -53,7 +53,7 @@ PaintRenderingContext2DSettings* context_settings = PaintRenderingContext2DSettings::Create(); PaintRenderingContext2D* ctx = MakeGarbageCollected<PaintRenderingContext2D>( - IntSize(kWidth, kHeight), context_settings, kZoom, + gfx::Size(kWidth, kHeight), context_settings, kZoom, 1.0 /* device_scale_factor */); const double kShadowBlurBefore = 2; @@ -85,7 +85,7 @@ PaintRenderingContext2DSettings::Create(); float device_scale_factor = 1.23; PaintRenderingContext2D* ctx = MakeGarbageCollected<PaintRenderingContext2D>( - IntSize(kWidth, kHeight), context_settings, kZoom, device_scale_factor); + gfx::Size(kWidth, kHeight), context_settings, kZoom, device_scale_factor); DOMMatrix* matrix = ctx->getTransform(); EXPECT_TRUE(matrix->isIdentity()); ctx->setTransform(2.1, 2.5, 1.4, 2.3, 20, 50); @@ -102,7 +102,7 @@ PaintRenderingContext2DSettings* context_settings = PaintRenderingContext2DSettings::Create(); PaintRenderingContext2D* ctx = MakeGarbageCollected<PaintRenderingContext2D>( - IntSize(kWidth, kHeight), context_settings, kZoom, + gfx::Size(kWidth, kHeight), context_settings, kZoom, 1.0 /* device_scale_factor */); DOMMatrix* matrix = ctx->getTransform(); EXPECT_TRUE(matrix->isIdentity());
diff --git a/third_party/blink/renderer/modules/csspaint/paint_size.h b/third_party/blink/renderer/modules/csspaint/paint_size.h index f36c7a8c..268d819 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_size.h +++ b/third_party/blink/renderer/modules/csspaint/paint_size.h
@@ -6,8 +6,8 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_CSSPAINT_PAINT_SIZE_H_ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -15,7 +15,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - explicit PaintSize(FloatSize size) : size_(size) {} + explicit PaintSize(gfx::SizeF size) : size_(size) {} PaintSize(const PaintSize&) = delete; PaintSize& operator=(const PaintSize&) = delete; @@ -26,7 +26,7 @@ float height() const { return size_.height(); } private: - FloatSize size_; + gfx::SizeF size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet.cc index e6e0c5b..6d201f2c63 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet.cc
@@ -99,7 +99,7 @@ scoped_refptr<Image> PaintWorklet::Paint(const String& name, const ImageResourceObserver& observer, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector* data, float device_scale_factor) { if (!document_definition_map_.Contains(name))
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet.h b/third_party/blink/renderer/modules/csspaint/paint_worklet.h index bd9e895..bba57e6 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet.h +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet.h
@@ -42,7 +42,7 @@ // The |container_size| is without subpixel snapping. scoped_refptr<Image> Paint(const String& name, const ImageResourceObserver&, - const FloatSize& container_size, + const gfx::SizeF& container_size, const CSSStyleValueVector*, float device_scale_factor);
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc index ee66d12b..4cacbdd 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_proxy_client_test.cc
@@ -219,7 +219,7 @@ std::vector<cc::PaintWorkletInput::PropertyKey> property_keys; scoped_refptr<CSSPaintWorkletInput> input = base::MakeRefCounted<CSSPaintWorkletInput>( - "foo", FloatSize(100, 100), 1.0f, 1.0f, 1, std::move(data), + "foo", gfx::SizeF(100, 100), 1.0f, 1.0f, 1, std::move(data), std::move(input_arguments), std::move(property_keys)); sk_sp<PaintRecord> record = proxy_client->Paint(input.get(), {}); EXPECT_NE(record, nullptr);
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc index 0d734c2..ff4d9ac 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
@@ -129,7 +129,7 @@ ImageResourceObserver* observer = GetImageResourceObserver(); ASSERT_TRUE(observer); - const FloatSize container_size(100, 100); + const gfx::SizeF container_size(100, 100); const LayoutObject& layout_object = static_cast<const LayoutObject&>(*observer); float zoom = layout_object.StyleRef().EffectiveZoom();
diff --git a/third_party/blink/renderer/modules/shapedetection/shape_detector.cc b/third_party/blink/renderer/modules/shapedetection/shape_detector.cc index b068529..e5eba444 100644 --- a/third_party/blink/renderer/modules/shapedetection/shape_detector.cc +++ b/third_party/blink/renderer/modules/shapedetection/shape_detector.cc
@@ -85,8 +85,8 @@ // there is a local WebCam associated, there might be sophisticated ways to // detect faces on it. Until then, treat as a normal <video> element. - const FloatSize size( - canvas_image_source->ElementSize(FloatSize(), kRespectImageOrientation)); + const gfx::SizeF size = + canvas_image_source->ElementSize(gfx::SizeF(), kRespectImageOrientation); SourceImageStatus source_image_status = kInvalidSourceImageStatus; scoped_refptr<Image> image =
diff --git a/third_party/blink/renderer/modules/webcodecs/image_decoder_core.cc b/third_party/blink/renderer/modules/webcodecs/image_decoder_core.cc index 4f4fb80..3363a90 100644 --- a/third_party/blink/renderer/modules/webcodecs/image_decoder_core.cc +++ b/third_party/blink/renderer/modules/webcodecs/image_decoder_core.cc
@@ -316,8 +316,7 @@ // not populated with image data. To avoid thrashing as bytes come in, only // create the frame once. if (!yuv_frame_) { - const auto coded_size = - ToGfxSize(decoder_->DecodedYUVSize(cc::YUVIndex::kY)); + const auto coded_size = decoder_->DecodedYUVSize(cc::YUVIndex::kY); // Plane sizes are guaranteed to fit in an int32_t by // ImageDecoder::SetSize(); since YUV is 1 byte-per-channel, we can just
diff --git a/third_party/blink/renderer/modules/webcodecs/video_frame.cc b/third_party/blink/renderer/modules/webcodecs/video_frame.cc index a369380..b49f0272 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_frame.cc +++ b/third_party/blink/renderer/modules/webcodecs/video_frame.cc
@@ -42,6 +42,7 @@ #include "third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.h" #include "third_party/blink/renderer/modules/webcodecs/video_color_space.h" #include "third_party/blink/renderer/modules/webcodecs/video_frame_init_util.h" +#include "third_party/blink/renderer/platform/geometry/geometry_hash_traits.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h" #include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" #include "third_party/blink/renderer/platform/graphics/image.h" @@ -202,13 +203,13 @@ delete; CanvasResourceProviderCache(const CanvasResourceProviderCache&) = delete; - CanvasResourceProvider* CreateProvider(IntSize size) { + CanvasResourceProvider* CreateProvider(gfx::Size size) { if (size_to_provider_.IsEmpty()) PostMonitoringTask(); last_access_time_ = base::TimeTicks::Now(); - FloatSize key(size); + gfx::SizeF key(size); auto iter = size_to_provider_.find(key); if (iter != size_to_provider_.end()) { auto* result = iter->value.get(); @@ -252,7 +253,8 @@ } scoped_refptr<base::SequencedTaskRunner> task_runner_; - HashMap<FloatSize, std::unique_ptr<CanvasResourceProvider>> size_to_provider_; + HashMap<gfx::SizeF, std::unique_ptr<CanvasResourceProvider>> + size_to_provider_; base::TimeTicks last_access_time_; TaskHandle task_handle_; }; @@ -487,7 +489,7 @@ // Some elements like OffscreenCanvas won't choose a default size, so we must // ask them what size they think they are first. auto source_size = - image_source->ElementSize(FloatSize(), kRespectImageOrientation); + image_source->ElementSize(gfx::SizeF(), kRespectImageOrientation); SourceImageStatus status = kInvalidSourceImageStatus; auto image = image_source->GetSourceImageForCanvas(&status, source_size); @@ -974,7 +976,7 @@ scoped_refptr<Image> VideoFrame::GetSourceImageForCanvas( SourceImageStatus* status, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition) { // UnpremultiplyAlpha is not implemented yet. DCHECK_EQ(alpha_disposition, kPremultiplyAlpha); @@ -998,8 +1000,8 @@ auto* execution_context = ExecutionContext::From(v8::Isolate::GetCurrent()->GetCurrentContext()); auto& provider_cache = CanvasResourceProviderCache::From(*execution_context); - auto* resource_provider = provider_cache.CreateProvider( - IntSize(local_handle->frame()->natural_size())); + auto* resource_provider = + provider_cache.CreateProvider(local_handle->frame()->natural_size()); const auto dest_rect = gfx::Rect(local_handle->frame()->natural_size()); auto image = CreateImageFromVideoFrame(local_handle->frame(), @@ -1022,24 +1024,24 @@ return false; } -FloatSize VideoFrame::ElementSize( - const FloatSize& default_object_size, +gfx::SizeF VideoFrame::ElementSize( + const gfx::SizeF& default_object_size, const RespectImageOrientationEnum respect_orientation) const { // BitmapSourceSize() will always ignore orientation. if (respect_orientation == kRespectImageOrientation) { auto local_frame = handle_->frame(); if (!local_frame) - return FloatSize(); + return gfx::SizeF(); const auto orientation_enum = VideoTransformationToImageOrientation( local_frame->metadata().transformation.value_or( media::kNoTransformation)); - auto orientation_adjusted_size = FloatSize(local_frame->natural_size()); + auto orientation_adjusted_size = gfx::SizeF(local_frame->natural_size()); if (ImageOrientation(orientation_enum).UsesWidthAsHeight()) - return orientation_adjusted_size.TransposedSize(); + orientation_adjusted_size.Transpose(); return orientation_adjusted_size; } - return FloatSize(BitmapSourceSize()); + return gfx::SizeF(BitmapSourceSize()); } bool VideoFrame::IsVideoFrame() const { @@ -1061,13 +1063,13 @@ return false; } -IntSize VideoFrame::BitmapSourceSize() const { +gfx::Size VideoFrame::BitmapSourceSize() const { auto local_frame = handle_->frame(); if (!local_frame) - return IntSize(); + return gfx::Size(); // ImageBitmaps should always return the size w/o respecting orientation. - return IntSize(local_frame->natural_size()); + return local_frame->natural_size(); } ScriptPromise VideoFrame::CreateImageBitmap(ScriptState* script_state, @@ -1097,8 +1099,8 @@ auto* execution_context = ExecutionContext::From(v8::Isolate::GetCurrent()->GetCurrentContext()); auto& provider_cache = CanvasResourceProviderCache::From(*execution_context); - auto* resource_provider = provider_cache.CreateProvider( - IntSize(local_handle->frame()->natural_size())); + auto* resource_provider = + provider_cache.CreateProvider(local_handle->frame()->natural_size()); const auto dest_rect = gfx::Rect(local_handle->frame()->natural_size()); auto image = CreateImageFromVideoFrame(local_handle->frame(),
diff --git a/third_party/blink/renderer/modules/webcodecs/video_frame.h b/third_party/blink/renderer/modules/webcodecs/video_frame.h index c8cec399c..7190258 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_frame.h +++ b/third_party/blink/renderer/modules/webcodecs/video_frame.h
@@ -115,18 +115,18 @@ // CanvasImageSource implementation scoped_refptr<Image> GetSourceImageForCanvas( SourceImageStatus*, - const FloatSize&, + const gfx::SizeF&, const AlphaDisposition alpha_disposition = kPremultiplyAlpha) override; - FloatSize ElementSize(const FloatSize&, - const RespectImageOrientationEnum) const override; + gfx::SizeF ElementSize(const gfx::SizeF&, + const RespectImageOrientationEnum) const override; bool IsVideoFrame() const override; bool IsOpaque() const override; bool IsAccelerated() const override; // ImageBitmapSource implementation static constexpr uint64_t kCpuEfficientFrameSize = 320u * 240u; - IntSize BitmapSourceSize() const override; + gfx::Size BitmapSourceSize() const override; ScriptPromise CreateImageBitmap(ScriptState*, absl::optional<gfx::Rect> crop_rect, const ImageBitmapOptions*,
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc index 0208539..2108a26 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc
@@ -662,10 +662,10 @@ return true; } -IntRect WebGL2RenderingContextBase::GetTextureSourceSubRectangle( +gfx::Rect WebGL2RenderingContextBase::GetTextureSourceSubRectangle( GLsizei width, GLsizei height) { - return IntRect(unpack_skip_pixels_, unpack_skip_rows_, width, height); + return gfx::Rect(unpack_skip_pixels_, unpack_skip_rows_, width, height); } void WebGL2RenderingContextBase::invalidateFramebuffer( @@ -1873,10 +1873,8 @@ GLenum type, ImageData* pixels) { DCHECK(pixels); - IntRect source_image_rect; - source_image_rect.set_origin( - gfx::Point(unpack_skip_pixels_, unpack_skip_rows_)); - source_image_rect.set_size(IntSize(width, height)); + gfx::Rect source_image_rect(unpack_skip_pixels_, unpack_skip_rows_, width, + height); TexImageHelperImageData(kTexImage3D, target, level, internalformat, 0, format, type, depth, 0, 0, 0, pixels, source_image_rect, unpack_image_height_);
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h index b16c3f21..e76c624 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h
@@ -1096,7 +1096,7 @@ GLenum, Vector<GLenum>&); - IntRect GetTextureSourceSubRectangle(GLsizei width, GLsizei height); + gfx::Rect GetTextureSourceSubRectangle(GLsizei width, GLsizei height); enum ClearBufferCaller { kClearBufferiv,
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index 03056c2..eb28114c 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -325,8 +325,8 @@ continue; } - IntSize desired_size = DrawingBuffer::AdjustSize( - evicted_context->ClampedCanvasSize(), IntSize(), + gfx::Size desired_size = DrawingBuffer::AdjustSize( + evicted_context->ClampedCanvasSize(), gfx::Size(), evicted_context->max_texture_size_); // If there's room in the pixel budget for this context, restore it. @@ -638,7 +638,7 @@ // sizing is consistent. The forced downsizing logic in Reshape() can lead to // the drawing buffer being smaller than the canvas size. // See https://crbug.com/845742. - IntSize size = GetDrawingBuffer()->Size(); + gfx::Size size = GetDrawingBuffer()->Size(); // We are grabbing a snapshot that is generally not for compositing, so use a // custom resource provider. This avoids consuming compositing-specific // resources (e.g. GpuMemoryBuffer). We tag the SharedImage with display usage @@ -1729,7 +1729,7 @@ return GetDrawingBuffer()->CopyToPlatformMailbox( raster_interface, mailbox, texture_target, flip_y, gfx::Point(0, 0), - IntRect(gfx::Point(0, 0), drawing_buffer_->Size()), source_buffer); + gfx::Rect(drawing_buffer_->Size()), source_buffer); } // As the resource provider is not accelerated, we don't need an accelerated @@ -1740,16 +1740,16 @@ if (!image || !image->PaintImageForCurrentFrame()) return false; - IntRect src_rect(gfx::Point(), image->Size()); - IntRect dest_rect(gfx::Point(), resource_provider->Size()); + gfx::Rect src_rect(image->Size()); + gfx::Rect dest_rect(resource_provider->Size()); PaintFlags flags; flags.setBlendMode(SkBlendMode::kSrc); // We use this draw helper as we need to take into account the // ImageOrientation of the UnacceleratedStaticBitmapImage. ImageDrawOptions draw_options; draw_options.clamping_mode = Image::kDoNotClampImageToSourceRect; - image->Draw(resource_provider->Canvas(), flags, FloatRect(dest_rect), - FloatRect(src_rect), draw_options); + image->Draw(resource_provider->Canvas(), flags, gfx::RectF(dest_rect), + gfx::RectF(src_rect), draw_options); return true; } @@ -1773,9 +1773,9 @@ dst_color_space, callback); } -IntSize WebGLRenderingContextBase::DrawingBufferSize() const { +gfx::Size WebGLRenderingContextBase::DrawingBufferSize() const { if (isContextLost()) - return IntSize(0, 0); + return gfx::Size(0, 0); return GetDrawingBuffer()->Size(); } @@ -1833,7 +1833,7 @@ // We don't have to mark the canvas as dirty, since the newly created image // buffer will also start off clear (and this matches what reshape will do). GetDrawingBuffer()->set_low_latency_enabled(Host()->LowLatencyEnabled()); - GetDrawingBuffer()->Resize(IntSize(width, height)); + GetDrawingBuffer()->Resize(gfx::Size(width, height)); if (buffer) { ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, @@ -4999,7 +4999,7 @@ WebGLImageConversion::ImageHtmlDomSource dom_source, bool flip_y, bool premultiply_alpha, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height) { const char* func_name = GetTexImageFunctionName(function_id); @@ -5011,11 +5011,9 @@ } Vector<uint8_t> data; - IntRect sub_rect = source_image_rect; - if (sub_rect.IsValid() && sub_rect == SentinelEmptyRect()) { - // Recalculate based on the size of the Image. - sub_rect = SafeGetImageSize(image); - } + gfx::Rect sub_rect = source_image_rect.value_or( + // Fall back to the rect based on the size of the Image. + SafeGetImageSize(image)); bool selecting_sub_rectangle = false; if (!ValidateTexImageSubRectangle(func_name, function_id, image, sub_rect, @@ -5025,7 +5023,7 @@ } // Adjust the source image rectangle if doing a y-flip. - IntRect adjusted_source_image_rect = sub_rect; + gfx::Rect adjusted_source_image_rect = sub_rect; if (flip_y) { adjusted_source_image_rect.set_y(image->height() - adjusted_source_image_rect.bottom()); @@ -5162,7 +5160,7 @@ scoped_refptr<Image> image(std::move(pass_image)); DCHECK(image); - IntSize size(width, height); + gfx::Size size(width, height); CanvasResourceProvider* resource_provider = generated_image_cache_.GetCanvasResourceProvider(size); if (!resource_provider) { @@ -5173,15 +5171,15 @@ if (!image->CurrentFrameKnownToBeOpaque()) resource_provider->Canvas()->clear(SK_ColorTRANSPARENT); - IntRect src_rect(gfx::Point(), image->Size()); - IntRect dest_rect(0, 0, size.width(), size.height()); + gfx::Rect src_rect(image->Size()); + gfx::Rect dest_rect(size); PaintFlags flags; // TODO(ccameron): WebGL should produce sRGB images. // https://crbug.com/672299 ImageDrawOptions draw_options; draw_options.clamping_mode = Image::kDoNotClampImageToSourceRect; - image->Draw(resource_provider->Canvas(), flags, FloatRect(dest_rect), - FloatRect(src_rect), draw_options); + image->Draw(resource_provider->Canvas(), flags, gfx::RectF(dest_rect), + gfx::RectF(src_rect), draw_options); return resource_provider->Snapshot(); } @@ -5208,22 +5206,14 @@ } } -IntRect WebGLRenderingContextBase::SentinelEmptyRect() { - // Return a rectangle with -1 width and height so we can recognize - // it later and recalculate it based on the Image whose data we'll - // upload. It's important that there be no possible differences in - // the logic which computes the image's size. - return IntRect(0, 0, -1, -1); -} - -IntRect WebGLRenderingContextBase::SafeGetImageSize(Image* image) { +gfx::Rect WebGLRenderingContextBase::SafeGetImageSize(Image* image) { if (!image) - return IntRect(); + return gfx::Rect(); return GetTextureSourceSize(image); } -IntRect WebGLRenderingContextBase::GetImageDataSize(ImageData* pixels) { +gfx::Rect WebGLRenderingContextBase::GetImageDataSize(ImageData* pixels) { DCHECK(pixels); return GetTextureSourceSize(pixels); } @@ -5350,7 +5340,7 @@ GLint yoffset, GLint zoffset, ImageData* pixels, - const IntRect& source_image_rect, + const gfx::Rect& source_image_rect, GLint unpack_image_height) { const char* func_name = GetTexImageFunctionName(function_id); if (isContextLost()) @@ -5382,7 +5372,7 @@ return; } // Adjust the source image rectangle if doing a y-flip. - IntRect adjusted_source_image_rect = source_image_rect; + gfx::Rect adjusted_source_image_rect = source_image_rect; if (unpack_flip_y_) { adjusted_source_image_rect.set_y(pixels->height() - adjusted_source_image_rect.bottom()); @@ -5481,7 +5471,7 @@ GLint yoffset, GLint zoffset, HTMLImageElement* image, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { @@ -5539,8 +5529,8 @@ ExceptionState& exception_state) { TexImageHelperHTMLImageElement(execution_context->GetSecurityOrigin(), kTexImage2D, target, level, internalformat, - format, type, 0, 0, 0, image, - SentinelEmptyRect(), 1, 0, exception_state); + format, type, 0, 0, 0, image, absl::nullopt, 1, + 0, exception_state); } bool WebGLRenderingContextBase::CanUseTexImageViaGPU(GLenum format, @@ -5589,7 +5579,7 @@ GLint zoffset, AcceleratedStaticBitmapImage* source_image, WebGLRenderingContextBase* source_canvas_webgl_context, - const IntRect& source_sub_rectangle, + const gfx::Rect& source_sub_rectangle, bool premultiply_alpha, bool flip_y) { bool have_source_image = source_image; @@ -5682,7 +5672,7 @@ GLint yoffset, GLint zoffset, CanvasRenderingContextHost* context_host, - const IntRect& source_sub_rectangle, + const gfx::Rect& source_sub_rectangle, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { @@ -5739,8 +5729,7 @@ To<WebGLRenderingContextBase>(context_host->RenderingContext()); } else { image = context_host->GetSourceImageForCanvas( - &source_image_status, - FloatSize(source_sub_rectangle.width(), source_sub_rectangle.height())); + &source_image_status, gfx::SizeF(source_sub_rectangle.size())); if (source_image_status != kNormalSourceImageStatus) return; } @@ -5760,7 +5749,7 @@ } // The GPU-GPU copy path uses the Y-up coordinate system. - IntRect adjusted_source_sub_rectangle = source_sub_rectangle; + gfx::Rect adjusted_source_sub_rectangle = source_sub_rectangle; bool should_adjust_source_sub_rectangle = !unpack_flip_y_; if (is_origin_top_left_ && source_canvas_webgl_context) @@ -5834,7 +5823,7 @@ GLint yoffset, GLint zoffset, HTMLVideoElement* video, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { @@ -5897,7 +5886,7 @@ GLint yoffset, GLint zoffset, VideoFrame* frame, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { @@ -5934,13 +5923,6 @@ return; } - if (!source_image_rect.IsValid()) { - SynthesizeGLError(GL_INVALID_OPERATION, func_name, - "source sub-rectangle specified via pixel unpack " - "parameters is invalid"); - return; - } - // Some blink::VideoFrame objects reference a SkImage which can be used // directly instead of making a copy through the VideoFrame. if (auto sk_img = local_handle->sk_image()) { @@ -5982,7 +5964,7 @@ GLint xoffset, GLint yoffset, GLint zoffset, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height, WebGLTexture* texture, @@ -5991,7 +5973,6 @@ DCHECK(!isContextLost()); DCHECK(texture); DCHECK(media_video_frame); - DCHECK(source_image_rect.IsValid()); auto metadata = WebGLVideoTexture::CreateVideoFrameUploadMetadata( media_video_frame.get(), texture->GetLastUploadedVideoFrameId()); @@ -6008,10 +5989,8 @@ const GLint adjusted_internalformat = ConvertTexInternalFormat(internalformat, type); const bool source_image_rect_is_default = - source_image_rect == SentinelEmptyRect() || - source_image_rect == IntRect(0, 0, - media_video_frame->natural_size().width(), - media_video_frame->natural_size().height()); + !source_image_rect || + *source_image_rect == gfx::Rect(media_video_frame->natural_size()); const auto& caps = GetDrawingBuffer()->ContextProvider()->GetCapabilities(); const bool may_need_image_external_essl3 = caps.egl_image_external && @@ -6156,7 +6135,7 @@ // Orient the destination rect based on the frame's transform. const auto& visible_rect = media_video_frame->visible_rect(); - auto dest_rect = gfx::Rect(0, 0, visible_rect.width(), visible_rect.height()); + auto dest_rect = gfx::Rect(visible_rect.size()); if (transform.rotation == media::VIDEO_ROTATION_90 || transform.rotation == media::VIDEO_ROTATION_270) { dest_rect.Transpose(); @@ -6166,15 +6145,14 @@ // orientation, we set |prefer_tagged_orientation| to false. scoped_refptr<Image> image = CreateImageFromVideoFrame( std::move(media_video_frame), kAllowZeroCopyImages, - image_cache.GetCanvasResourceProvider(IntSize(dest_rect.size())), - video_renderer, dest_rect, /*prefer_tagged_orientation=*/false); + image_cache.GetCanvasResourceProvider(dest_rect.size()), video_renderer, + dest_rect, /*prefer_tagged_orientation=*/false); if (!image) return; if (can_upload_via_gpu && image->IsTextureBacked()) { - auto adjusted_source_image_rect = source_image_rect; - if (adjusted_source_image_rect == SentinelEmptyRect()) - adjusted_source_image_rect = GetTextureSourceSize(image.get()); + auto adjusted_source_image_rect = + source_image_rect.value_or(GetTextureSourceSize(image.get())); auto* accel_image = static_cast<AcceleratedStaticBitmapImage*>(image.get()); if (function_id == kTexImage2D) { @@ -6211,8 +6189,8 @@ ExceptionState& exception_state) { TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexImage2D, target, level, internalformat, - format, type, 0, 0, 0, video, - SentinelEmptyRect(), 1, 0, exception_state); + format, type, 0, 0, 0, video, absl::nullopt, 1, + 0, exception_state); } void WebGLRenderingContextBase::texImage2D(ExecutionContext* execution_context, @@ -6225,7 +6203,7 @@ ExceptionState& exception_state) { TexImageHelperVideoFrame(execution_context->GetSecurityOrigin(), kTexImage2D, target, level, internalformat, format, type, 0, 0, 0, - frame, SentinelEmptyRect(), 1, 0, exception_state); + frame, absl::nullopt, 1, 0, exception_state); } void WebGLRenderingContextBase::TexImageHelperImageBitmap( @@ -6239,7 +6217,7 @@ GLint yoffset, GLint zoffset, ImageBitmap* bitmap, - const IntRect& source_sub_rect, + const gfx::Rect& source_sub_rect, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { @@ -6307,7 +6285,7 @@ PaintImage paint_image = bitmap->BitmapImage()->PaintImageForCurrentFrame(); if (!image->HasDefaultOrientation()) { paint_image = Image::ResizeAndOrientImage( - paint_image, image->CurrentFrameOrientation(), FloatSize(1, 1), 1, + paint_image, image->CurrentFrameOrientation(), gfx::Vector2dF(1, 1), 1, kInterpolationNone); } @@ -6544,8 +6522,8 @@ ExceptionState& exception_state) { TexImageHelperHTMLImageElement(execution_context->GetSecurityOrigin(), kTexSubImage2D, target, level, 0, format, type, - xoffset, yoffset, 0, image, - SentinelEmptyRect(), 1, 0, exception_state); + xoffset, yoffset, 0, image, absl::nullopt, 1, + 0, exception_state); } void WebGLRenderingContextBase::texSubImage2D( @@ -6576,8 +6554,8 @@ ExceptionState& exception_state) { TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexSubImage2D, target, level, 0, format, type, - xoffset, yoffset, 0, video, - SentinelEmptyRect(), 1, 0, exception_state); + xoffset, yoffset, 0, video, absl::nullopt, 1, + 0, exception_state); } void WebGLRenderingContextBase::texSubImage2D( @@ -6592,8 +6570,8 @@ ExceptionState& exception_state) { TexImageHelperVideoFrame(execution_context->GetSecurityOrigin(), kTexSubImage2D, target, level, 0, format, type, - xoffset, yoffset, 0, frame, SentinelEmptyRect(), 1, - 0, exception_state); + xoffset, yoffset, 0, frame, absl::nullopt, 1, 0, + exception_state); } void WebGLRenderingContextBase::texSubImage2D(GLenum target, @@ -8707,7 +8685,7 @@ CanvasResourceProvider* WebGLRenderingContextBase:: LRUCanvasResourceProviderCache::GetCanvasResourceProvider( - const IntSize& size) { + const gfx::Size& size) { wtf_size_t i; for (i = 0; i < resource_providers_.size(); ++i) { CanvasResourceProvider* resource_provider = resource_providers_[i].get(); @@ -8828,11 +8806,11 @@ ContextGL()->Disable(capability); } -IntSize WebGLRenderingContextBase::ClampedCanvasSize() const { +gfx::Size WebGLRenderingContextBase::ClampedCanvasSize() const { int width = Host()->Size().width(); int height = Host()->Size().height(); - return IntSize(Clamp(width, 1, max_viewport_dims_[0]), - Clamp(height, 1, max_viewport_dims_[1])); + return gfx::Size(Clamp(width, 1, max_viewport_dims_[0]), + Clamp(height, 1, max_viewport_dims_[1])); } GLint WebGLRenderingContextBase::MaxDrawBuffers() {
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h index 45a5c1a..648cf25 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h
@@ -87,7 +87,6 @@ class HTMLVideoElement; class ImageBitmap; class ImageData; -class IntSize; class OESVertexArrayObject; class V8UnionHTMLCanvasElementOrOffscreenCanvas; class VideoFrame; @@ -617,7 +616,7 @@ // Returns the drawing buffer size after it is, probably, has scaled down // to the maximum supported canvas size. - IntSize DrawingBufferSize() const override; + gfx::Size DrawingBufferSize() const override; DrawingBuffer* GetDrawingBuffer() const; class TextureUnitState { @@ -856,7 +855,7 @@ enum class CacheType { kImage, kVideo }; LRUCanvasResourceProviderCache(wtf_size_t capacity, CacheType type); // The pointer returned is owned by the image buffer map. - CanvasResourceProvider* GetCanvasResourceProvider(const IntSize&); + CanvasResourceProvider* GetCanvasResourceProvider(const gfx::Size&); private: void BubbleToFront(wtf_size_t idx); @@ -1161,19 +1160,19 @@ WebGLImageConversion::ImageHtmlDomSource, bool flip_y, bool premultiply_alpha, - const IntRect&, + const absl::optional<gfx::Rect>&, GLsizei depth, GLint unpack_image_height); template <typename T> - IntRect GetTextureSourceSize(T* texture_source) { - return IntRect(0, 0, texture_source->width(), texture_source->height()); + gfx::Rect GetTextureSourceSize(T* texture_source) { + return gfx::Rect(0, 0, texture_source->width(), texture_source->height()); } template <typename T> bool ValidateTexImageSubRectangle(const char* function_name, TexImageFunctionID function_id, T* image, - const IntRect& sub_rect, + const gfx::Rect& sub_rect, GLsizei depth, GLint unpack_image_height, bool* selecting_sub_rectangle) { @@ -1200,7 +1199,7 @@ << ") @ (" << sub_rect.x() << ", " << sub_rect.y() << "), image = (" << image_width << " x " << image_height << ")"; - if (!sub_rect.IsValid() || sub_rect.x() < 0 || sub_rect.y() < 0 || + if (sub_rect.x() < 0 || sub_rect.y() < 0 || sub_rect.right() > image_width || sub_rect.bottom() > image_height || sub_rect.width() < 0 || sub_rect.height() < 0) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, @@ -1660,7 +1659,7 @@ void EnableOrDisable(GLenum capability, bool enable); // Clamp the width and height to GL_MAX_VIEWPORT_DIMS. - IntSize ClampedCanvasSize() const; + gfx::Size ClampedCanvasSize() const; // First time called, if EXT_draw_buffers is supported, query the value; // otherwise return 0. Later, return the cached value. @@ -1732,7 +1731,7 @@ GLint, GLint, ImageData*, - const IntRect&, + const gfx::Rect&, GLint); void TexImageHelperHTMLImageElement(const SecurityOrigin*, @@ -1746,7 +1745,7 @@ GLint, GLint, HTMLImageElement*, - const IntRect&, + const absl::optional<gfx::Rect>&, GLsizei, GLint, ExceptionState&); @@ -1762,7 +1761,7 @@ GLint, GLint, CanvasRenderingContextHost*, - const IntRect&, + const gfx::Rect&, GLsizei, GLint, ExceptionState&); @@ -1778,7 +1777,7 @@ GLint, GLint, HTMLVideoElement*, - const IntRect&, + const absl::optional<gfx::Rect>&, GLsizei, GLint, ExceptionState&); @@ -1794,7 +1793,7 @@ GLint, GLint, VideoFrame*, - const IntRect&, + const absl::optional<gfx::Rect>&, GLsizei, GLint, ExceptionState&); @@ -1809,14 +1808,13 @@ GLint, GLint, ImageBitmap*, - const IntRect&, + const gfx::Rect&, GLsizei, GLint, ExceptionState&); static const char* GetTexImageFunctionName(TexImageFunctionID); - IntRect SentinelEmptyRect(); - IntRect SafeGetImageSize(Image*); - IntRect GetImageDataSize(ImageData*); + gfx::Rect SafeGetImageSize(Image*); + gfx::Rect GetImageDataSize(ImageData*); // Helper implementing readPixels for WebGL 1.0 and 2.0. void ReadPixelsHelper(GLint x, @@ -1856,7 +1854,7 @@ GLint xoffset, GLint yoffset, GLint zoffset, - const IntRect& source_image_rect, + const absl::optional<gfx::Rect>& source_image_rect, GLsizei depth, GLint unpack_image_height, WebGLTexture* texture, @@ -1875,7 +1873,7 @@ GLint, AcceleratedStaticBitmapImage*, WebGLRenderingContextBase*, - const IntRect& source_sub_rectangle, + const gfx::Rect& source_sub_rectangle, bool premultiply_alpha, bool flip_y); bool CanUseTexImageViaGPU(GLenum format, GLenum type);
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc index 0efa6bb0..5fec833 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc
@@ -86,7 +86,7 @@ return false; if (Host()->ResourceProvider() && - Host()->ResourceProvider()->Size() != IntSize(swapchain_->Size())) { + Host()->ResourceProvider()->Size() != swapchain_->Size()) { Host()->DiscardResourceProvider(); } @@ -186,10 +186,10 @@ } // Set the default size. - IntSize size; + gfx::Size size; if (descriptor->hasSize()) { WGPUExtent3D dawn_extent = AsDawnType(descriptor->size()); - size = IntSize(dawn_extent.width, dawn_extent.height); + size = gfx::Size(dawn_extent.width, dawn_extent.height); if (dawn_extent.depthOrArrayLayers != 1) { configured_device_->InjectError(
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_queue.cc b/third_party/blink/renderer/modules/webgpu/gpu_queue.cc index bd46157..60165e84 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_queue.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_queue.cc
@@ -217,8 +217,8 @@ // HTMLCanvasElement and OffscreenCanvas won't care image orientation. But for // ImageBitmap, use kRespectImageOrientation will make ElementSize() behave // as Size(). - FloatSize image_size = source->ElementSize( - FloatSize(), // It will be ignored and won't affect size. + gfx::SizeF image_size = source->ElementSize( + gfx::SizeF(), // It will be ignored and won't affect size. kRespectImageOrientation); // TODO(crbug.com/1197369): Ensure kUnpremultiplyAlpha impl will also make
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.cc b/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.cc index b91acc3..345585e 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.cc
@@ -24,7 +24,7 @@ WGPUTextureUsage usage, WGPUTextureFormat format, cc::PaintFlags::FilterQuality filter_quality, - IntSize size) + gfx::Size size) : DawnObjectBase(device->GetDawnControlClient()), device_(device), context_(context), @@ -185,7 +185,7 @@ const gfx::Size& size, CanvasResourceProvider* resource_provider) const { DCHECK(resource_provider); - DCHECK_EQ(resource_provider->Size(), IntSize(size)); + DCHECK_EQ(resource_provider->Size(), size); DCHECK(resource_provider->GetSharedImageUsageFlags() & gpu::SHARED_IMAGE_USAGE_WEBGPU); DCHECK(resource_provider->IsOriginTopLeft());
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.h b/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.h index 53f82bb..81dad2f 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_swap_chain.h
@@ -30,7 +30,7 @@ WGPUTextureUsage, WGPUTextureFormat, cc::PaintFlags::FilterQuality, - IntSize); + gfx::Size); GPUSwapChain(const GPUSwapChain&) = delete; GPUSwapChain& operator=(const GPUSwapChain&) = delete; @@ -79,7 +79,7 @@ Member<GPUCanvasContext> context_; WGPUTextureUsage usage_; WGPUTextureFormat format_; - const IntSize size_; + const gfx::Size size_; Member<GPUTexture> texture_;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture.cc b/third_party/blink/renderer/modules/webgpu/gpu_texture.cc index 361cc38..66dc2cc1 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture.cc
@@ -200,7 +200,7 @@ // Fallback to static bitmap image. SourceImageStatus source_image_status = kInvalidSourceImageStatus; auto image = canvas->GetSourceImageForCanvas(&source_image_status, - FloatSize(canvas->Size())); + gfx::SizeF(canvas->Size())); if (source_image_status != kNormalSourceImageStatus) { exception_state.ThrowDOMException(DOMExceptionCode::kOperationError, "Failed to get image from canvas");
diff --git a/third_party/blink/renderer/modules/xr/xr_system.cc b/third_party/blink/renderer/modules/xr/xr_system.cc index 37b06740..7474adf 100644 --- a/third_party/blink/renderer/modules/xr/xr_system.cc +++ b/third_party/blink/renderer/modules/xr/xr_system.cc
@@ -1312,9 +1312,8 @@ image->image()->BitmapImage(); SkBitmap sk_bitmap = static_bitmap_image->AsSkBitmapForCurrentFrame( kRespectImageOrientation); - IntSize int_size = static_bitmap_image->Size(); - gfx::Size size(int_size.width(), int_size.height()); - images.emplace_back(sk_bitmap, size, image->widthInMeters()); + images.emplace_back(sk_bitmap, static_bitmap_image->Size(), + image->widthInMeters()); ++index; } query->SetTrackedImages(images);
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 8e45ed0..8c71569 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -766,6 +766,7 @@ "geometry/float_size.cc", "geometry/float_size.h", "geometry/geometry_as_json.h", + "geometry/geometry_hash_traits.h", "geometry/int_rect.cc", "geometry/int_rect.h", "geometry/int_rect_outsets.h",
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util.cc b/third_party/blink/renderer/platform/animation/animation_translation_util.cc index ffb34f4..a2fc4bd 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util.cc +++ b/third_party/blink/renderer/platform/animation/animation_translation_util.cc
@@ -42,7 +42,7 @@ void ToCompositorTransformOperations( const TransformOperations& transform_operations, CompositorTransformOperations* out_transform_operations, - const FloatSize& box_size) { + const gfx::SizeF& box_size) { // We need to do a deep copy the transformOperations may contain ref pointers // to TransformOperation objects. for (const auto& operation : transform_operations.Operations()) {
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util.h b/third_party/blink/renderer/platform/animation/animation_translation_util.h index 620b5dd..bbc5fe09e 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util.h +++ b/third_party/blink/renderer/platform/animation/animation_translation_util.h
@@ -33,16 +33,19 @@ #include "third_party/blink/renderer/platform/platform_export.h" +namespace gfx { +class SizeF; +} + namespace blink { class CompositorTransformOperations; class TransformOperations; -class FloatSize; PLATFORM_EXPORT void ToCompositorTransformOperations( const TransformOperations& in_operations, CompositorTransformOperations* out_operations, - const FloatSize& box_size); + const gfx::SizeF& box_size); } // namespace blink
diff --git a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc index ad71669..e421734 100644 --- a/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc +++ b/third_party/blink/renderer/platform/animation/animation_translation_util_test.cc
@@ -47,7 +47,7 @@ 0.1, 0.2, 0.3, 200000.4, TransformOperation::kRotate3D)); ops.Operations().push_back(ScaleTransformOperation::Create( 50.2, 100, -4, TransformOperation::kScale3D)); - ToCompositorTransformOperations(ops, &out_ops, FloatSize()); + ToCompositorTransformOperations(ops, &out_ops, gfx::SizeF()); EXPECT_EQ(3UL, out_ops.AsGfxTransformOperations().size()); const float kErr = 0.0001; @@ -81,7 +81,7 @@ TransformOperation::kTranslate)); CompositorTransformOperations out_ops; - ToCompositorTransformOperations(ops, &out_ops, FloatSize(200, 100)); + ToCompositorTransformOperations(ops, &out_ops, gfx::SizeF(200, 100)); ASSERT_EQ(out_ops.AsGfxTransformOperations().size(), 1u); auto& op0 = out_ops.AsGfxTransformOperations().at(0); @@ -103,7 +103,7 @@ TransformOperations ops_c = ops_b.Blend(ops_a, 0.5); CompositorTransformOperations out_ops; - ToCompositorTransformOperations(ops_c, &out_ops, FloatSize(100, 100)); + ToCompositorTransformOperations(ops_c, &out_ops, gfx::SizeF(100, 100)); ASSERT_EQ(out_ops.AsGfxTransformOperations().size(), 1u); auto& op0 = out_ops.AsGfxTransformOperations().at(0);
diff --git a/third_party/blink/renderer/platform/exported/web_font.cc b/third_party/blink/renderer/platform/exported/web_font.cc index 8565d13..49fa09b6 100644 --- a/third_party/blink/renderer/platform/exported/web_font.cc +++ b/third_party/blink/renderer/platform/exported/web_font.cc
@@ -113,8 +113,8 @@ int height, int from, int to) const { - return ToGfxRectF(private_->GetFont().SelectionRectForText(run, left_baseline, - height, from, to)); + return private_->GetFont().SelectionRectForText(run, left_baseline, height, + from, to); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/cursor_position_test.cc b/third_party/blink/renderer/platform/fonts/cursor_position_test.cc index 61a017d4..661ec9a3 100644 --- a/third_party/blink/renderer/platform/fonts/cursor_position_test.cc +++ b/third_party/blink/renderer/platform/fonts/cursor_position_test.cc
@@ -45,7 +45,7 @@ DCHECK_LE(start, static_cast<int>(text_run.length())); DCHECK_GE(end, -1); DCHECK_LE(end, static_cast<int>(text_run.length())); - FloatRect rect = + gfx::RectF rect = font.SelectionRectForText(text_run, gfx::PointF(), 12, start, end); return rect.width(); }
diff --git a/third_party/blink/renderer/platform/fonts/font.cc b/third_party/blink/renderer/platform/fonts/font.cc index 480ddc4..0c26217 100644 --- a/third_party/blink/renderer/platform/fonts/font.cc +++ b/third_party/blink/renderer/platform/fonts/font.cc
@@ -470,19 +470,19 @@ GetTextInterceptsInternal(bloberizer.Blobs(), flags, bounds, intercepts); } -static inline FloatRect PixelSnappedSelectionRect(FloatRect rect) { +static inline gfx::RectF PixelSnappedSelectionRect(const gfx::RectF& rect) { // Using roundf() rather than ceilf() for the right edge as a compromise to // ensure correct caret positioning. float rounded_x = roundf(rect.x()); - return FloatRect(rounded_x, rect.y(), roundf(rect.right() - rounded_x), - rect.height()); + return gfx::RectF(rounded_x, rect.y(), roundf(rect.right() - rounded_x), + rect.height()); } -FloatRect Font::SelectionRectForText(const TextRun& run, - const gfx::PointF& point, - float height, - int from, - int to) const { +gfx::RectF Font::SelectionRectForText(const TextRun& run, + const gfx::PointF& point, + float height, + int from, + int to) const { to = (to == -1 ? run.length() : to); FontCachePurgePreventer purge_preventer; @@ -491,7 +491,7 @@ CharacterRange range = shaper.GetCharacterRange(run, from, to); return PixelSnappedSelectionRect( - FloatRect(point.x() + range.start, point.y(), range.Width(), height)); + gfx::RectF(point.x() + range.start, point.y(), range.Width(), height)); } int Font::OffsetForPosition(const TextRun& run,
diff --git a/third_party/blink/renderer/platform/fonts/font.h b/third_party/blink/renderer/platform/fonts/font.h index 6a005c2..cc1e549 100644 --- a/third_party/blink/renderer/platform/fonts/font.h +++ b/third_party/blink/renderer/platform/fonts/font.h
@@ -166,11 +166,11 @@ float position, IncludePartialGlyphsOption, BreakGlyphsOption) const; - FloatRect SelectionRectForText(const TextRun&, - const gfx::PointF&, - float height, - int from = 0, - int to = -1) const; + gfx::RectF SelectionRectForText(const TextRun&, + const gfx::PointF&, + float height, + int from = 0, + int to = -1) const; CharacterRange GetCharacterRange(const TextRun&, unsigned from, unsigned to) const;
diff --git a/third_party/blink/renderer/platform/geometry/geometry_hash_traits.h b/third_party/blink/renderer/platform/geometry/geometry_hash_traits.h new file mode 100644 index 0000000..57f1fc6 --- /dev/null +++ b/third_party/blink/renderer/platform/geometry/geometry_hash_traits.h
@@ -0,0 +1,53 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_GEOMETRY_HASH_TRAITS_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_GEOMETRY_HASH_TRAITS_H_ + +#include "third_party/blink/renderer/platform/wtf/hash_traits.h" +#include "ui/gfx/geometry/size_f.h" + +namespace WTF { + +template <> +struct DefaultHash<gfx::SizeF> { + STATIC_ONLY(DefaultHash); + struct Hash { + STATIC_ONLY(Hash); + typedef typename IntTypes<sizeof(float)>::UnsignedType Bits; + static unsigned GetHash(const gfx::SizeF& key) { + return HashInts(DefaultHash<float>::Hash::GetHash(key.width()), + DefaultHash<float>::Hash::GetHash(key.height())); + } + static bool Equal(const gfx::SizeF& a, const gfx::SizeF& b) { + return DefaultHash<float>::Hash::Equal(a.width(), b.width()) && + DefaultHash<float>::Hash::Equal(a.height(), b.height()); + } + static const bool safe_to_compare_to_empty_or_deleted = true; + }; +}; + +template <> +struct HashTraits<gfx::SizeF> : GenericHashTraits<gfx::SizeF> { + STATIC_ONLY(HashTraits); + static const bool kEmptyValueIsZero = false; + static gfx::SizeF EmptyValue() { + return gfx::SizeF(std::numeric_limits<float>::infinity(), 0); + } + static void ConstructDeletedValue(gfx::SizeF& slot, bool) { + slot = DeletedValue(); + } + static bool IsDeletedValue(const gfx::SizeF& value) { + return value == DeletedValue(); + } + + private: + static constexpr gfx::SizeF DeletedValue() { + return gfx::SizeF(0, std::numeric_limits<float>::infinity()); + } +}; + +} // namespace WTF + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_GEOMETRY_HASH_TRAITS_H_
diff --git a/third_party/blink/renderer/platform/geometry/layout_point.h b/third_party/blink/renderer/platform/geometry/layout_point.h index fc5c26d0e..54d8871b 100644 --- a/third_party/blink/renderer/platform/geometry/layout_point.h +++ b/third_party/blink/renderer/platform/geometry/layout_point.h
@@ -37,6 +37,7 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -203,6 +204,10 @@ return IntSize(SnapSizeToPixel(s.Width(), p.X()), SnapSizeToPixel(s.Height(), p.Y())); } +inline gfx::Size ToPixelSnappedSize(const LayoutSize& s, const LayoutPoint& p) { + return gfx::Size(SnapSizeToPixel(s.Width(), p.X()), + SnapSizeToPixel(s.Height(), p.Y())); +} inline gfx::Vector2d ToRoundedVector2d(const LayoutPoint& p) { return gfx::Vector2d(p.X().Round(), p.Y().Round());
diff --git a/third_party/blink/renderer/platform/geometry/layout_rect.h b/third_party/blink/renderer/platform/geometry/layout_rect.h index 2e21d3bd..990108da 100644 --- a/third_party/blink/renderer/platform/geometry/layout_rect.h +++ b/third_party/blink/renderer/platform/geometry/layout_rect.h
@@ -90,9 +90,9 @@ constexpr LayoutSize Size() const { return size_; } gfx::Point PixelSnappedLocation() const { return ToRoundedPoint(location_); } - IntSize PixelSnappedSize() const { - return IntSize(SnapSizeToPixel(size_.Width(), location_.X()), - SnapSizeToPixel(size_.Height(), location_.Y())); + gfx::Size PixelSnappedSize() const { + return gfx::Size(SnapSizeToPixel(size_.Width(), location_.X()), + SnapSizeToPixel(size_.Height(), location_.Y())); } void SetLocation(const LayoutPoint& location) { location_ = location; }
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc index 3fe7ba9a..359a9bd 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.cc
@@ -99,8 +99,8 @@ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } -IntSize AcceleratedStaticBitmapImage::SizeInternal() const { - return IntSize(sk_image_info_.width(), sk_image_info_.height()); +gfx::Size AcceleratedStaticBitmapImage::SizeInternal() const { + return gfx::Size(sk_image_info_.width(), sk_image_info_.height()); } scoped_refptr<StaticBitmapImage> @@ -118,7 +118,7 @@ bool unpack_premultiply_alpha, bool unpack_flip_y, const gfx::Point& dest_point, - const IntRect& source_sub_rectangle) { + const gfx::Rect& source_sub_rectangle) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!IsValid()) return false; @@ -209,8 +209,8 @@ void AcceleratedStaticBitmapImage::Draw(cc::PaintCanvas* canvas, const cc::PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); auto paint_image = PaintImageForCurrentFrame();
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h index 8bdb361..7e9d393 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h
@@ -73,8 +73,8 @@ void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; bool IsValid() const final; @@ -90,7 +90,7 @@ bool unpack_premultiply_alpha, bool unpack_flip_y, const gfx::Point& dest_point, - const IntRect& source_sub_rectangle) override; + const gfx::Rect& source_sub_rectangle) override; bool CopyToResourceProvider( CanvasResourceProvider* resource_provider) override; @@ -145,7 +145,7 @@ void CreateImageFromMailboxIfNeeded(); void InitializeTextureBacking(GLuint shared_image_texture_id); - IntSize SizeInternal() const override; + gfx::Size SizeInternal() const override; const gpu::Mailbox mailbox_; const SkImageInfo sk_image_info_;
diff --git a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc index c789ed7..b75c9c2 100644 --- a/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image_test.cc
@@ -109,7 +109,7 @@ sync_token2.GetConstData() + sizeof(gpu::SyncToken))); gfx::Point dest_point(0, 0); - IntRect source_sub_rectangle(0, 0, 10, 10); + gfx::Rect source_sub_rectangle(0, 0, 10, 10); ASSERT_TRUE(bitmap->CopyToTexture( &destination_gl, GL_TEXTURE_2D, 1 /*dest_texture_id*/, 0 /*dest_texture_level*/, false /*unpack_premultiply_alpha*/,
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image.cc b/third_party/blink/renderer/platform/graphics/bitmap_image.cc index 8643365b..ce2410e 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/bitmap_image.cc
@@ -112,7 +112,7 @@ size_t BitmapImage::TotalFrameBytes() { if (cached_frame_) - return static_cast<size_t>(Size().Area()) * sizeof(ImageFrame::PixelData); + return ClampTo<size_t>(Size().Area64() * sizeof(ImageFrame::PixelData)); return 0u; } @@ -151,13 +151,13 @@ have_size_ = true; } -IntSize BitmapImage::SizeWithConfig(SizeConfig config) const { +gfx::Size BitmapImage::SizeWithConfig(SizeConfig config) const { UpdateSize(); - IntSize size = size_; + gfx::Size size = size_; if (config.apply_density && !density_corrected_size_.IsEmpty()) size = density_corrected_size_; if (config.apply_orientation && preferred_size_is_transposed_) - return size.TransposedSize(); + return gfx::TransposeSize(size); return size; } @@ -210,9 +210,9 @@ // Return the image density in 0.01 "bits per pixel" rounded to the nearest // integer. -static inline uint64_t ImageDensityInCentiBpp(IntSize size, +static inline uint64_t ImageDensityInCentiBpp(gfx::Size size, size_t image_size_bytes) { - uint64_t image_area = static_cast<uint64_t>(size.width()) * size.height(); + uint64_t image_area = size.Area64(); return (static_cast<uint64_t>(image_size_bytes) * 100 * 8 + image_area / 2) / image_area; } @@ -253,8 +253,8 @@ void BitmapImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { TRACE_EVENT0("skia", "BitmapImage::draw"); @@ -270,7 +270,7 @@ .TakePaintImage(); } - FloatRect adjusted_src_rect = src_rect; + gfx::RectF adjusted_src_rect = src_rect; if (!density_corrected_size_.IsEmpty()) { FloatSize src_size(size_); adjusted_src_rect.Scale( @@ -278,7 +278,7 @@ src_size.height() / density_corrected_size_.height()); } - adjusted_src_rect.Intersect(SkRect::MakeWH(image.width(), image.height())); + adjusted_src_rect.Intersect(gfx::RectF(image.width(), image.height())); if (adjusted_src_rect.IsEmpty() || dst_rect.IsEmpty()) return; // Nothing to draw. @@ -288,7 +288,7 @@ orientation = CurrentFrameOrientation(); PaintCanvasAutoRestore auto_restore(canvas, false); - FloatRect adjusted_dst_rect = dst_rect; + gfx::RectF adjusted_dst_rect = dst_rect; if (orientation != ImageOrientationEnum::kDefault) { canvas->save(); @@ -303,9 +303,7 @@ // The destination rect will have its width and height already reversed // for the orientation of the image, as it was needed for page layout, so // we need to reverse it back here. - adjusted_dst_rect = - FloatRect(adjusted_dst_rect.x(), adjusted_dst_rect.y(), - adjusted_dst_rect.height(), adjusted_dst_rect.width()); + adjusted_dst_rect.set_size(gfx::TransposeSize(adjusted_dst_rect.size())); } } @@ -316,11 +314,13 @@ if (draw_options.apply_dark_mode) { DarkModeFilter* dark_mode_filter = draw_options.dark_mode_filter; DarkModeFilterHelper::ApplyToImageIfNeeded( - *dark_mode_filter, this, &image_flags, src_rect, dst_rect); + *dark_mode_filter, this, &image_flags, gfx::RectFToSkRect(src_rect), + gfx::RectFToSkRect(dst_rect)); } canvas->drawImageRect( - std::move(image), adjusted_src_rect, adjusted_dst_rect, - draw_options.sampling_options, &image_flags, + std::move(image), gfx::RectFToSkRect(adjusted_src_rect), + gfx::RectFToSkRect(adjusted_dst_rect), draw_options.sampling_options, + &image_flags, WebCoreClampingModeToSkiaRectConstraint(draw_options.clamping_mode)); if (is_lazy_generated) { @@ -340,7 +340,7 @@ return frame_count_; } -static inline bool HasVisibleImageSize(IntSize size) { +static inline bool HasVisibleImageSize(gfx::Size size) { return (size.width() > 1 || size.height() > 1); }
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image.h b/third_party/blink/renderer/platform/graphics/bitmap_image.h index fdc6ac60..0444faa 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/bitmap_image.h
@@ -64,7 +64,7 @@ bool CurrentFrameHasSingleSecurityOrigin() const override; - IntSize SizeWithConfig(SizeConfig) const override; + gfx::Size SizeWithConfig(SizeConfig) const override; bool GetHotSpot(gfx::Point&) const override; String FilenameExtension() const override; @@ -128,8 +128,8 @@ void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; PaintImage CreatePaintImage(); @@ -154,9 +154,9 @@ bool ShouldReportByteSizeUMAs(bool data_now_completely_received); std::unique_ptr<DeferredImageDecoder> decoder_; - mutable IntSize size_; // The size to use for the overall image (will just - // be the size of the first image). - mutable IntSize density_corrected_size_; + mutable gfx::Size size_; // The size to use for the overall image (will just + // be the size of the first image). + mutable gfx::Size density_corrected_size_; // This caches the PaintImage created with the last updated encoded data to // ensure re-use of generated decodes. This is cleared each time the encoded
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.cc b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.cc index 842d179..131dabe4 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.cc +++ b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.cc
@@ -195,7 +195,7 @@ image_size_kib); } -void BitmapImageMetrics::CountJpegArea(const IntSize& size) { +void BitmapImageMetrics::CountJpegArea(const gfx::Size& size) { DEFINE_THREAD_SAFE_STATIC_LOCAL( CustomCountHistogram, image_area_histogram, ("Blink.ImageDecoders.Jpeg.Area", kImageAreaHistogramMin, @@ -203,7 +203,7 @@ // A base::HistogramBase::Sample may not fit |size.Area()|. Hence the use of // saturated_cast. image_area_histogram.Count( - base::saturated_cast<base::HistogramBase::Sample>(size.Area())); + base::saturated_cast<base::HistogramBase::Sample>(size.Area64())); } void BitmapImageMetrics::CountJpegColorSpace(JpegColorSpace color_space) {
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h index 0593a2e..1e069d8 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h +++ b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h
@@ -11,9 +11,12 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +namespace gfx { +class Size; +} + namespace blink { -class IntSize; class UseCounter; class PLATFORM_EXPORT BitmapImageMetrics { @@ -81,7 +84,7 @@ int image_min_side, uint64_t density_centi_bpp, size_t image_size_bytes); - static void CountJpegArea(const IntSize& size); + static void CountJpegArea(const gfx::Size& size); static void CountJpegColorSpace(JpegColorSpace color_space); };
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc b/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc index 89ac12d..341eb96 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc
@@ -319,7 +319,7 @@ LoadImage("anim_none.gif"); image_->PaintImageForCurrentFrame(); int frame_size = - static_cast<int>(image_->Size().Area() * sizeof(ImageFrame::PixelData)); + static_cast<int>(image_->Size().Area64() * sizeof(ImageFrame::PixelData)); EXPECT_EQ(frame_size, LastDecodedSizeChange()); }
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc index 6aba65ec..854d651 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc
@@ -55,7 +55,7 @@ namespace blink { -Canvas2DLayerBridge::Canvas2DLayerBridge(const IntSize& size, +Canvas2DLayerBridge::Canvas2DLayerBridge(const gfx::Size& size, RasterMode raster_mode, OpacityMode opacity_mode) : logger_(std::make_unique<Logger>()), @@ -662,9 +662,9 @@ rate_limiter_->Tick(); } -void Canvas2DLayerBridge::DoPaintInvalidation(const IntRect& dirty_rect) { +void Canvas2DLayerBridge::DoPaintInvalidation(const gfx::Rect& dirty_rect) { if (layer_ && raster_mode_ == RasterMode::kGPU) - layer_->SetNeedsDisplayRect(ToGfxRect(dirty_rect)); + layer_->SetNeedsDisplayRect(dirty_rect); } scoped_refptr<StaticBitmapImage> Canvas2DLayerBridge::NewImageSnapshot() {
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h index 3b3a882..9a9ff3a4 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h
@@ -39,7 +39,6 @@ #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/raster_interface.h" #include "third_party/blink/renderer/platform/geometry/float_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_host.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/platform_export.h" @@ -49,6 +48,7 @@ #include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "ui/gfx/color_space.h" +#include "ui/gfx/geometry/size.h" struct SkImageInfo; @@ -73,7 +73,7 @@ class PLATFORM_EXPORT Canvas2DLayerBridge : public cc::TextureLayerClient { public: - Canvas2DLayerBridge(const IntSize&, RasterMode, OpacityMode opacity_mode); + Canvas2DLayerBridge(const gfx::Size&, RasterMode, OpacityMode opacity_mode); Canvas2DLayerBridge(const Canvas2DLayerBridge&) = delete; Canvas2DLayerBridge& operator=(const Canvas2DLayerBridge&) = delete; @@ -90,7 +90,7 @@ void SetIsBeingDisplayed(bool); void SetFilterQuality(cc::PaintFlags::FilterQuality filter_quality); void DidDraw(); - void DoPaintInvalidation(const IntRect& dirty_rect); + void DoPaintInvalidation(const gfx::Rect& dirty_rect); cc::Layer* Layer(); bool Restore(); @@ -193,7 +193,7 @@ const RasterMode raster_mode_; const OpacityMode opacity_mode_; - const IntSize size_; + const gfx::Size size_; enum SnapshotState { kInitialSnapshotState,
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc index e61ff0f..095a07e 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge_test.cc
@@ -126,7 +126,7 @@ class Canvas2DLayerBridgeTest : public Test { public: std::unique_ptr<Canvas2DLayerBridge> MakeBridge( - const IntSize& size, + const gfx::Size& size, RasterMode raster_mode, OpacityMode opacity_mode, std::unique_ptr<FakeCanvasResourceHost> custom_host = nullptr) { @@ -167,7 +167,7 @@ TEST_F(Canvas2DLayerBridgeTest, DisableAcceleration) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kCPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kCPU, kNonOpaque); bool has_backend_texture = bridge->NewImageSnapshot()->PaintImageForCurrentFrame().IsTextureBacked(); @@ -177,7 +177,7 @@ TEST_F(Canvas2DLayerBridgeTest, NoDrawOnContextLost) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsValid()); PaintFlags flags; uint32_t gen_id = bridge->GetOrCreateResourceProvider()->ContentUniqueID(); @@ -191,7 +191,7 @@ TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhenContextIsLost) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsAccelerated()); bridge->FinalizeFrame(); // Trigger the creation of a backing store @@ -208,7 +208,7 @@ TEST_F(Canvas2DLayerBridgeTest, PrepareMailboxWhenContextIsLostWithFailedRestore) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->GetOrCreateResourceProvider(); EXPECT_TRUE(bridge->IsValid()); @@ -234,7 +234,7 @@ // This test passes by not crashing and not triggering assertions. { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->FinalizeFrame(); viz::TransferableResource resource; viz::ReleaseCallback release_callback; @@ -252,7 +252,7 @@ { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->FinalizeFrame(); bridge->PrepareTransferableResource(nullptr, &resource, &release_callback); @@ -275,7 +275,7 @@ { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->FinalizeFrame(); EXPECT_TRUE(bridge->PrepareTransferableResource(nullptr, &resource, &release_callback)); @@ -293,7 +293,7 @@ TEST_F(Canvas2DLayerBridgeTest, RasterModeHint) { { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); PaintFlags flags; bridge->GetPaintCanvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), flags); scoped_refptr<StaticBitmapImage> image = bridge->NewImageSnapshot(); @@ -303,7 +303,7 @@ { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); PaintFlags flags; bridge->GetPaintCanvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), flags); scoped_refptr<StaticBitmapImage> image = bridge->NewImageSnapshot(); @@ -313,7 +313,7 @@ { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kCPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kCPU, kNonOpaque); PaintFlags flags; bridge->GetPaintCanvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), flags); scoped_refptr<StaticBitmapImage> image = bridge->NewImageSnapshot(); @@ -323,7 +323,7 @@ { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kCPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kCPU, kNonOpaque); PaintFlags flags; bridge->GetPaintCanvas()->drawRect(SkRect::MakeXYWH(0, 0, 1, 1), flags); scoped_refptr<StaticBitmapImage> image = bridge->NewImageSnapshot(); @@ -335,7 +335,7 @@ TEST_F(Canvas2DLayerBridgeTest, FallbackToSoftwareIfContextLost) { test_context_provider_->TestContextGL()->set_context_lost(true); std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsValid()); EXPECT_FALSE(bridge->IsAccelerated()); } @@ -351,7 +351,7 @@ { // No fallback case. std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsValid()); EXPECT_TRUE(bridge->IsAccelerated()); scoped_refptr<StaticBitmapImage> snapshot = bridge->NewImageSnapshot(); @@ -365,7 +365,7 @@ ->ContextProvider() ->GetGrContext(); std::unique_ptr<Canvas2DLayerBridge> bridge = - std::make_unique<Canvas2DLayerBridge>(IntSize(300, 150), + std::make_unique<Canvas2DLayerBridge>(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); EXPECT_TRUE(bridge->IsValid()); @@ -374,7 +374,7 @@ // This will cause SkSurface_Gpu creation to fail without // Canvas2DLayerBridge otherwise detecting that anything was disabled. gr->abandonContext(); - host_ = std::make_unique<FakeCanvasResourceHost>(IntSize(300, 150)); + host_ = std::make_unique<FakeCanvasResourceHost>(gfx::Size(300, 150)); bridge->SetCanvasResourceHost(host_.get()); DrawSomething(bridge.get()); scoped_refptr<StaticBitmapImage> snapshot = bridge->NewImageSnapshot(); @@ -399,7 +399,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); EXPECT_TRUE(bridge->IsAccelerated()); @@ -444,7 +444,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -491,7 +491,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -528,7 +528,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -575,7 +575,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -608,7 +608,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -643,7 +643,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -677,7 +677,7 @@ { ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform> platform; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kNonOpaque); bridge->DontUseIdleSchedulingForTesting(); DrawSomething(bridge.get()); @@ -723,7 +723,7 @@ PaintFlags flags; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->GetPaintCanvas()->drawLine(0, 0, 2, 2, flags); DrawSomething(bridge.get()); ASSERT_TRUE(bridge->PrepareTransferableResource(nullptr, &resources[0], @@ -762,7 +762,7 @@ PaintFlags flags; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); bridge->GetPaintCanvas()->drawLine(0, 0, 2, 2, flags); DrawSomething(bridge.get()); ASSERT_TRUE(bridge->PrepareTransferableResource(nullptr, &resources[0], @@ -799,7 +799,7 @@ viz::ReleaseCallback release_callback; std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); DrawSomething(bridge.get()); bridge->PrepareTransferableResource(nullptr, &resource, &release_callback); @@ -813,7 +813,7 @@ TEST_F(Canvas2DLayerBridgeTest, EnsureCCImageCacheUse) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kOpaque); gfx::ColorSpace expected_color_space = gfx::ColorSpace::CreateSRGB(); Vector<cc::DrawImage> images = { cc::DrawImage(cc::CreateDiscardablePaintImage(gfx::Size(10, 10)), false, @@ -835,7 +835,7 @@ TEST_F(Canvas2DLayerBridgeTest, EnsureCCImageCacheUseWithColorConversion) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kOpaque); const auto color_space = gfx::ColorSpace::CreateSRGB(); Vector<cc::DrawImage> images = { cc::DrawImage(cc::CreateDiscardablePaintImage(gfx::Size(10, 10)), false, @@ -858,7 +858,7 @@ TEST_F(Canvas2DLayerBridgeTest, ImagesLockedUntilCacheLimit) { const auto color_space = gfx::ColorSpace::CreateSRGB(); std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kOpaque); Vector<cc::DrawImage> images = { cc::DrawImage(cc::CreateDiscardablePaintImage(gfx::Size(10, 10)), false, @@ -893,7 +893,7 @@ TEST_F(Canvas2DLayerBridgeTest, QueuesCleanupTaskForLockedImages) { const auto color_space = gfx::ColorSpace::CreateSRGB(); std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kOpaque); auto image = cc::DrawImage(cc::CreateDiscardablePaintImage(gfx::Size(10, 10)), false, SkIRect::MakeWH(10, 10), @@ -911,7 +911,7 @@ TEST_F(Canvas2DLayerBridgeTest, ImageCacheOnContextLost) { const auto color_space = gfx::ColorSpace::CreateSRGB(); std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 300), RasterMode::kGPU, kOpaque); + MakeBridge(gfx::Size(300, 300), RasterMode::kGPU, kOpaque); Vector<cc::DrawImage> images = { cc::DrawImage(cc::CreateDiscardablePaintImage(gfx::Size(10, 10)), false, SkIRect::MakeWH(10, 10), @@ -932,7 +932,7 @@ TEST_F(Canvas2DLayerBridgeTest, PrepareTransferableResourceTracksCanvasChanges) { - IntSize size = IntSize(300, 300); + gfx::Size size(300, 300); std::unique_ptr<Canvas2DLayerBridge> bridge = MakeBridge(size, RasterMode::kGPU, kNonOpaque); @@ -954,7 +954,7 @@ } class CustomFakeCanvasResourceHost : public FakeCanvasResourceHost { public: - explicit CustomFakeCanvasResourceHost(const IntSize& size) + explicit CustomFakeCanvasResourceHost(const gfx::Size& size) : FakeCanvasResourceHost(size) {} void RestoreCanvasMatrixClipStack(cc::PaintCanvas* canvas) const override { // Alter canvas' matrix to emulate a restore @@ -963,7 +963,7 @@ }; TEST_F(Canvas2DLayerBridgeTest, WritePixelsRestoresClipStack) { - IntSize size = IntSize(300, 300); + gfx::Size size(300, 300); auto host = std::make_unique<CustomFakeCanvasResourceHost>(size); std::unique_ptr<Canvas2DLayerBridge> bridge = MakeBridge(size, RasterMode::kGPU, kOpaque, std::move(host)); @@ -993,7 +993,7 @@ TEST_F(Canvas2DLayerBridgeTest, DisplayedCanvasIsRateLimited) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsValid()); bridge->SetIsBeingDisplayed(true); EXPECT_FALSE(bridge->HasRateLimiterForTesting()); @@ -1004,7 +1004,7 @@ TEST_F(Canvas2DLayerBridgeTest, NonDisplayedCanvasIsNotRateLimited) { std::unique_ptr<Canvas2DLayerBridge> bridge = - MakeBridge(IntSize(300, 150), RasterMode::kGPU, kNonOpaque); + MakeBridge(gfx::Size(300, 150), RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsValid()); bridge->SetIsBeingDisplayed(true); bridge->FinalizeFrame();
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.cc b/third_party/blink/renderer/platform/graphics/canvas_resource.cc index de93ff9e..e7483281 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
@@ -150,7 +150,7 @@ return false; *out_resource = viz::TransferableResource::MakeGL( - mailbox, GLFilter(), TextureTarget(), GetSyncToken(), ToGfxSize(Size()), + mailbox, GLFilter(), TextureTarget(), GetSyncToken(), Size(), IsOverlayCandidate()); out_resource->color_space = GetColorSpace(); @@ -172,8 +172,8 @@ // the resource type and completely ignores the format set on the // TransferableResource. Clients are expected to render in N32 format but use // RGBA as the tagged format on resources. - *out_resource = viz::TransferableResource::MakeSoftware( - mailbox, ToGfxSize(Size()), viz::RGBA_8888); + *out_resource = + viz::TransferableResource::MakeSoftware(mailbox, Size(), viz::RGBA_8888); out_resource->color_space = GetColorSpace(); @@ -221,8 +221,8 @@ size_(info.width(), info.height()) { // Software compositing lazily uses RGBA_8888 as the resource format // everywhere but the content is expected to be rendered in N32 format. - base::MappedReadOnlyRegion shm = viz::bitmap_allocation::AllocateSharedBitmap( - ToGfxSize(Size()), viz::RGBA_8888); + base::MappedReadOnlyRegion shm = + viz::bitmap_allocation::AllocateSharedBitmap(Size(), viz::RGBA_8888); if (!shm.IsValid()) return; @@ -246,7 +246,7 @@ return shared_mapping_.IsValid(); } -IntSize CanvasResourceSharedBitmap::Size() const { +gfx::Size CanvasResourceSharedBitmap::Size() const { return size_; } @@ -375,9 +375,8 @@ DCHECK(shared_image_usage_flags & gpu::SHARED_IMAGE_USAGE_DISPLAY); gpu_memory_buffer_ = gpu_memory_buffer_manager->CreateGpuMemoryBuffer( - ToGfxSize(Size()), GetBufferFormat(), - gfx::BufferUsage::SCANOUT_CPU_READ_WRITE, gpu::kNullSurfaceHandle, - nullptr); + Size(), GetBufferFormat(), gfx::BufferUsage::SCANOUT_CPU_READ_WRITE, + gpu::kNullSurfaceHandle, nullptr); if (!gpu_memory_buffer_) return; @@ -415,7 +414,7 @@ surface_origin, surface_alpha_type, shared_image_usage_flags); } else { shared_image_mailbox = shared_image_interface->CreateSharedImage( - GetResourceFormat(), ToGfxSize(Size()), GetColorSpace(), surface_origin, + GetResourceFormat(), Size(), GetColorSpace(), surface_origin, surface_alpha_type, shared_image_usage_flags, gpu::kNullSurfaceHandle); } @@ -762,7 +761,7 @@ gpu::Mailbox shared_image_mailbox; shared_image_mailbox = shared_image_interface->CreateSharedImage( - GetResourceFormat(), ToGfxSize(size_), GetColorSpace(), surface_origin, + GetResourceFormat(), size_, GetColorSpace(), surface_origin, GetSkColorInfo().alphaType(), shared_image_usage_flags, gpu::kNullSurfaceHandle); @@ -1323,9 +1322,9 @@ context_provider_wrapper_->ContextProvider()->SharedImageInterface(); DCHECK(sii); gpu::SharedImageInterface::SwapChainMailboxes mailboxes = - sii->CreateSwapChain(GetResourceFormat(), ToGfxSize(Size()), - GetColorSpace(), kTopLeft_GrSurfaceOrigin, - kPremul_SkAlphaType, usage); + sii->CreateSwapChain(GetResourceFormat(), Size(), GetColorSpace(), + kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, + usage); back_buffer_mailbox_ = mailboxes.back_buffer; front_buffer_mailbox_ = mailboxes.front_buffer; sync_token_ = sii->GenVerifiedSyncToken();
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.h b/third_party/blink/renderer/platform/graphics/canvas_resource.h index 8310e86..c18f2cd 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource.h
@@ -92,7 +92,7 @@ virtual bool NeedsReadLockFences() const { return false; } // The bounds for this resource. - virtual IntSize Size() const = 0; + virtual gfx::Size Size() const = 0; // The mailbox which can be used to reference this resource in GPU commands. // The sync mode indicates how the sync token for the resource should be @@ -240,7 +240,7 @@ bool SupportsAcceleratedCompositing() const final { return false; } bool NeedsReadLockFences() const final { return false; } void Abandon() final; - IntSize Size() const final; + gfx::Size Size() const final; void TakeSkImage(sk_sp<SkImage> image) final; scoped_refptr<StaticBitmapImage> Bitmap() final; bool OriginClean() const final { return is_origin_clean_; } @@ -258,7 +258,7 @@ viz::SharedBitmapId shared_bitmap_id_; base::WritableSharedMemoryMapping shared_mapping_; - IntSize size_; + gfx::Size size_; bool is_origin_clean_ = true; }; @@ -299,7 +299,7 @@ bool IsAccelerated() const final { return is_accelerated_; } bool SupportsAcceleratedCompositing() const override { return true; } bool IsValid() const final; - IntSize Size() const final { return size_; } + gfx::Size Size() const final { return size_; } scoped_refptr<StaticBitmapImage> Bitmap() final; void Transfer() final; @@ -413,7 +413,7 @@ std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; // Accessed on any thread. - const IntSize size_; + const gfx::Size size_; const bool is_origin_top_left_; const bool is_accelerated_; const bool is_overlay_candidate_; @@ -441,7 +441,7 @@ bool IsAccelerated() const final { return true; } bool SupportsAcceleratedCompositing() const override { return true; } bool IsValid() const final; - IntSize Size() const final { return size_; } + gfx::Size Size() const final { return size_; } const gpu::Mailbox& GetOrCreateGpuMailbox(MailboxSyncMode) override; scoped_refptr<StaticBitmapImage> Bitmap() final; void Transfer() final; @@ -543,7 +543,7 @@ std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; // Accessed on any thread. - const IntSize size_; + const gfx::Size size_; const scoped_refptr<base::SingleThreadTaskRunner> owning_thread_task_runner_; OwningThreadData owning_thread_data_; @@ -579,7 +579,7 @@ bool OriginClean() const final { return is_origin_clean_; } void SetOriginClean(bool value) final { is_origin_clean_ = value; } void Abandon() final; - IntSize Size() const final { return size_; } + gfx::Size Size() const final { return size_; } void TakeSkImage(sk_sp<SkImage> image) final; void NotifyResourceLost() override { resource_is_lost_ = true; } @@ -608,7 +608,7 @@ const base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_; - const IntSize size_; + const gfx::Size size_; const gpu::Mailbox mailbox_; const GLenum texture_target_; viz::ReleaseCallback release_callback_; @@ -636,7 +636,7 @@ bool OriginClean() const final { return is_origin_clean_; } void SetOriginClean(bool value) final { is_origin_clean_ = value; } void Abandon() final; - IntSize Size() const final { return size_; } + gfx::Size Size() const final { return size_; } void TakeSkImage(sk_sp<SkImage> image) final; void NotifyResourceLost() override { // Used for single buffering mode which doesn't need to care about sync @@ -668,7 +668,7 @@ const base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_; - const IntSize size_; + const gfx::Size size_; gpu::Mailbox front_buffer_mailbox_; gpu::Mailbox back_buffer_mailbox_; GLuint back_buffer_texture_id_ = 0u;
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc index 2585d09..c2a8bd45 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc
@@ -59,7 +59,7 @@ uint32_t client_id, uint32_t sink_id, int canvas_id, - const IntSize& size) + const gfx::Size& size) : frame_sink_id_(viz::FrameSinkId(client_id, sink_id)), size_(size), change_size_for_next_commit_(false), @@ -267,7 +267,7 @@ resources_.insert(resource_id, std::move(frame_resource)); // TODO(crbug.com/869913): add unit testing for this. - const gfx::Size canvas_resource_size = ToGfxSize(canvas_resource->Size()); + const gfx::Size canvas_resource_size = canvas_resource->Size(); PostImageToPlaceholderIfNotBlocked(std::move(canvas_resource), resource_id); @@ -423,11 +423,11 @@ } } -bool CanvasResourceDispatcher::VerifyImageSize(const IntSize image_size) { +bool CanvasResourceDispatcher::VerifyImageSize(const gfx::Size& image_size) { return image_size == size_; } -void CanvasResourceDispatcher::Reshape(const IntSize& size) { +void CanvasResourceDispatcher::Reshape(const gfx::Size& size) { if (size_ != size) { size_ = size; change_size_for_next_commit_ = true;
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h index f32723d..7eb66a0c 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h
@@ -49,7 +49,7 @@ uint32_t client_id, uint32_t sink_id, int placeholder_canvas_id, - const IntSize&); + const gfx::Size&); ~CanvasResourceDispatcher() override; void SetNeedsBeginFrame(bool); @@ -72,7 +72,7 @@ } bool HasTooManyPendingFrames() const; - void Reshape(const IntSize&); + void Reshape(const gfx::Size&); // viz::mojom::blink::CompositorFrameSinkClient implementation. void DidReceiveCompositorFrameAck( @@ -110,7 +110,7 @@ viz::ParentLocalSurfaceIdAllocator parent_local_surface_id_allocator_; const viz::FrameSinkId frame_sink_id_; - IntSize size_; + gfx::Size size_; bool change_size_for_next_commit_; bool suspend_animation_ = false; bool needs_begin_frame_ = false; @@ -118,7 +118,7 @@ void SetNeedsBeginFrameInternal(); - bool VerifyImageSize(const IntSize); + bool VerifyImageSize(const gfx::Size&); void PostImageToPlaceholderIfNotBlocked(scoped_refptr<CanvasResource>, viz::ResourceId resource_id); // virtual for testing
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher_test.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher_test.cc index 6b88cc9..ff04ec33 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher_test.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher_test.cc
@@ -86,7 +86,7 @@ return dispatcher_->id_generator_.PeekNextValueForTesting(); } - const IntSize& GetSize() const { return dispatcher_->size_; } + const gfx::Size& GetSize() const { return dispatcher_->size_; } protected: CanvasResourceDispatcherTest() = default;
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_provider.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_provider.cc index 507d7b9..5c16fca 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_provider.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_provider.cc
@@ -1358,8 +1358,8 @@ return FlushCanvasInternal(IsPrinting() && clear_frame_); } -IntSize CanvasResourceProvider::Size() const { - return IntSize(info_.width(), info_.height()); +gfx::Size CanvasResourceProvider::Size() const { + return gfx::Size(info_.width(), info_.height()); } SkSurfaceProps CanvasResourceProvider::GetSkSurfaceProps() const {
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_provider.h b/third_party/blink/renderer/platform/graphics/canvas_resource_provider.h index dc23c2d..423a6407 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_provider.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_provider.h
@@ -178,7 +178,7 @@ void SetFilterQuality(cc::PaintFlags::FilterQuality quality) { filter_quality_ = quality; } - IntSize Size() const; + gfx::Size Size() const; bool IsOriginTopLeft() const { return is_origin_top_left_; } virtual bool IsValid() const = 0; virtual bool IsAccelerated() const = 0;
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc b/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc index 24bd9ba8..65044e85 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_provider_test.cc
@@ -72,7 +72,7 @@ }; TEST_F(CanvasResourceProviderTest, CanvasResourceProviderAcceleratedOverlay) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); const uint32_t shared_image_usage_flags = @@ -106,7 +106,7 @@ } TEST_F(CanvasResourceProviderTest, CanvasResourceProviderTexture) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); auto provider = CanvasResourceProvider::CreateSharedImageProvider( @@ -129,7 +129,7 @@ } TEST_F(CanvasResourceProviderTest, CanvasResourceProviderUnacceleratedOverlay) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); const uint32_t shared_image_usage_flags = @@ -156,7 +156,7 @@ TEST_F(CanvasResourceProviderTest, CanvasResourceProviderSharedImageResourceRecycling) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); const uint32_t shared_image_usage_flags = @@ -280,7 +280,7 @@ } TEST_F(CanvasResourceProviderTest, CanvasResourceProviderBitmap) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); auto provider = CanvasResourceProvider::CreateBitmapProvider( @@ -298,7 +298,7 @@ } TEST_F(CanvasResourceProviderTest, CanvasResourceProviderSharedBitmap) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); MockCanvasResourceDispatcherClient client; @@ -325,7 +325,7 @@ TEST_F(CanvasResourceProviderTest, CanvasResourceProviderDirect2DGpuMemoryBuffer) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); const uint32_t shared_image_usage_flags = @@ -360,7 +360,7 @@ TEST_F(CanvasResourceProviderTest, CanvasResourceProviderDirect3DGpuMemoryBuffer) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); auto provider = CanvasResourceProvider::CreatePassThroughProvider( @@ -485,7 +485,7 @@ } TEST_F(CanvasResourceProviderTest, CanvasResourceProviderDirect2DSwapChain) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); const SkImageInfo kInfo = SkImageInfo::MakeN32Premul(10, 10); auto provider = CanvasResourceProvider::CreateSwapChainProvider(
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc index e154572..f6a2b2b 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor_test.cc
@@ -276,7 +276,7 @@ const cc::Layer* child = LayerAt(0); EXPECT_THAT( child->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kWhite))); EXPECT_EQ(Translation(50, -50), child->ScreenSpaceTransform()); EXPECT_EQ(gfx::Size(100, 100), child->bounds()); EXPECT_FALSE(GetTransformNode(child).transform_changed); @@ -303,9 +303,9 @@ Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(100, 0, 100, 100), Color::kBlack)); + RectWithColor(gfx::RectF(100, 0, 100, 100), Color::kBlack)); EXPECT_THAT(layer->GetPicture(), Pointee(DrawsRectangles(rects_with_color))); @@ -318,7 +318,7 @@ EXPECT_FALSE(GetTransformNode(layer).transform_changed); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kGray))); EXPECT_EQ(gfx::Transform(), layer->ScreenSpaceTransform()); } } @@ -345,9 +345,9 @@ Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(100, 0, 100, 100), Color::kBlack)); + RectWithColor(gfx::RectF(100, 0, 100, 100), Color::kBlack)); EXPECT_THAT(layer->GetPicture(), Pointee(DrawsRectangles(rects_with_color))); @@ -360,7 +360,7 @@ EXPECT_FALSE(GetTransformNode(layer).transform_changed); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kGray))); EXPECT_EQ(gfx::Transform(), layer->ScreenSpaceTransform()); } } @@ -387,7 +387,7 @@ EXPECT_TRUE(GetTransformNode(layer).transform_changed); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kWhite))); gfx::RectF mapped_rect(0, 0, 300, 200); layer->ScreenSpaceTransform().TransformRect(&mapped_rect); EXPECT_EQ(gfx::RectF(-10, -10, 600, 400), mapped_rect); @@ -397,7 +397,7 @@ EXPECT_TRUE(GetTransformNode(layer).transform_changed); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kBlack))); gfx::RectF mapped_rect(0, 0, 300, 200); layer->ScreenSpaceTransform().TransformRect(&mapped_rect); EXPECT_EQ(gfx::RectF(0, 0, 600, 400), mapped_rect); @@ -435,11 +435,11 @@ EXPECT_THAT( LayerAt(0)->GetPicture(), Pointee(DrawsRectangles(Vector<RectWithColor>{ - RectWithColor(FloatRect(0, 0, 300, 200), Color::kWhite), - RectWithColor(FloatRect(100, 100, 100, 100), Color::kBlack)}))); + RectWithColor(gfx::RectF(0, 0, 300, 200), Color::kWhite), + RectWithColor(gfx::RectF(100, 100, 100, 100), Color::kBlack)}))); EXPECT_THAT( LayerAt(1)->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kDarkGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kDarkGray))); } TEST_P(PaintArtifactCompositorTest, FlattensInheritedTransform) { @@ -469,7 +469,7 @@ const cc::Layer* layer = LayerAt(0); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kWhite))); // The leaf transform node should flatten its inherited transform node // if and only if the intermediate rotation transform in the Blink tree @@ -524,7 +524,7 @@ const cc::Layer* layer = LayerAt(0); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kWhite))); // The leaf transform node should flatten its inherited transform node // if and only if the intermediate rotation transform in the Blink tree @@ -590,7 +590,7 @@ const cc::Layer* white_layer = LayerAt(0); EXPECT_THAT( white_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kWhite))); int white_sorting_context_id = GetTransformNode(white_layer).sorting_context_id; EXPECT_EQ(0, white_sorting_context_id); @@ -599,7 +599,7 @@ const cc::Layer* light_gray_layer = LayerAt(1); EXPECT_THAT( light_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kLightGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kLightGray))); int light_gray_sorting_context_id = GetTransformNode(light_gray_layer).sorting_context_id; EXPECT_NE(0, light_gray_sorting_context_id); @@ -609,7 +609,7 @@ const cc::Layer* dark_gray_layer = LayerAt(2); EXPECT_THAT( dark_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kDarkGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kDarkGray))); int dark_gray_sorting_context_id = GetTransformNode(dark_gray_layer).sorting_context_id; EXPECT_EQ(light_gray_sorting_context_id, dark_gray_sorting_context_id); @@ -621,7 +621,7 @@ const cc::Layer* black_layer = LayerAt(3); EXPECT_THAT( black_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 200), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 200), Color::kBlack))); int black_sorting_context_id = GetTransformNode(black_layer).sorting_context_id; EXPECT_NE(0, black_sorting_context_id); @@ -643,7 +643,7 @@ EXPECT_EQ(gfx::Vector2dF(220, 100), layer->offset_to_transform_parent()); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 180), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 180), Color::kBlack))); EXPECT_EQ(Translation(220, 100), layer->ScreenSpaceTransform()); const cc::ClipNode* clip_node = @@ -668,7 +668,7 @@ EXPECT_EQ(gfx::Vector2dF(220, 100), layer->offset_to_transform_parent()); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 300, 180), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 300, 180), Color::kBlack))); EXPECT_EQ(Translation(220, 100), layer->ScreenSpaceTransform()); const cc::ClipNode* clip_node = @@ -706,25 +706,25 @@ const cc::Layer* white_layer = LayerAt(0); EXPECT_THAT( white_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kWhite))); EXPECT_EQ(Translation(300, 350), white_layer->ScreenSpaceTransform()); const cc::Layer* light_gray_layer = LayerAt(1); EXPECT_THAT( light_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kLightGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kLightGray))); EXPECT_EQ(Translation(300, 350), light_gray_layer->ScreenSpaceTransform()); const cc::Layer* dark_gray_layer = LayerAt(2); EXPECT_THAT( dark_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kDarkGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kDarkGray))); EXPECT_EQ(Translation(300, 350), dark_gray_layer->ScreenSpaceTransform()); const cc::Layer* black_layer = LayerAt(3); EXPECT_THAT( black_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kBlack))); EXPECT_EQ(Translation(300, 350), black_layer->ScreenSpaceTransform()); EXPECT_EQ(white_layer->clip_tree_index(), dark_gray_layer->clip_tree_index()); @@ -772,25 +772,25 @@ const cc::Layer* white_layer = LayerAt(0); EXPECT_THAT( white_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kWhite))); EXPECT_EQ(Translation(300, 350), white_layer->ScreenSpaceTransform()); const cc::Layer* light_gray_layer = LayerAt(1); EXPECT_THAT( light_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kLightGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kLightGray))); EXPECT_EQ(Translation(300, 350), light_gray_layer->ScreenSpaceTransform()); const cc::Layer* dark_gray_layer = LayerAt(2); EXPECT_THAT( dark_gray_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kDarkGray))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kDarkGray))); EXPECT_EQ(Translation(300, 350), dark_gray_layer->ScreenSpaceTransform()); const cc::Layer* black_layer = LayerAt(3); EXPECT_THAT( black_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 100, 100), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 100, 100), Color::kBlack))); EXPECT_EQ(Translation(300, 350), black_layer->ScreenSpaceTransform()); EXPECT_EQ(white_layer->clip_tree_index(), dark_gray_layer->clip_tree_index()); @@ -827,7 +827,7 @@ EXPECT_EQ(gfx::Vector2dF(50, 0), drawing_layer->offset_to_transform_parent()); EXPECT_THAT( drawing_layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 150, 200), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 150, 200), Color::kWhite))); EXPECT_EQ(Translation(50, 0), drawing_layer->ScreenSpaceTransform()); // Check the clip nodes. @@ -865,9 +865,9 @@ EXPECT_THAT(layer->GetPicture(), Pointee(DrawsRectangles(Vector<RectWithColor>{ // This is the first RectDrawing with real_clip1 applied. - RectWithColor(FloatRect(0, 0, 11, 20), Color::kWhite), + RectWithColor(gfx::RectF(0, 0, 11, 20), Color::kWhite), // This is the second RectDrawing with real_clip2 applied. - RectWithColor(FloatRect(40, 44, 40, 16), Color::kBlack)}))); + RectWithColor(gfx::RectF(40, 44, 40, 16), Color::kBlack)}))); EXPECT_EQ(gfx::Transform(), layer->ScreenSpaceTransform()); const cc::ClipNode* clip_node = GetPropertyTrees().clip_tree.Node(layer->clip_tree_index()); @@ -916,10 +916,11 @@ // The two chunks are merged together. ASSERT_EQ(1u, LayerCount()); const cc::Layer* layer = LayerAt(0); - EXPECT_THAT(layer->GetPicture(), - Pointee(DrawsRectangles(Vector<RectWithColor>{ - RectWithColor(FloatRect(0, 0, 222, 444), Color::kWhite), - RectWithColor(FloatRect(0, 0, 166.5, 222), Color::kBlack)}))); + EXPECT_THAT( + layer->GetPicture(), + Pointee(DrawsRectangles(Vector<RectWithColor>{ + RectWithColor(gfx::RectF(0, 0, 222, 444), Color::kWhite), + RectWithColor(gfx::RectF(0, 0, 166.5, 222), Color::kBlack)}))); gfx::Transform expected_transform; expected_transform.Translate(5, 6); EXPECT_EQ(expected_transform, layer->ScreenSpaceTransform()); @@ -1102,7 +1103,7 @@ EXPECT_EQ(gfx::Size(27, 19), layer->bounds()); EXPECT_EQ(gfx::Vector2dF(3, 12), layer->offset_to_transform_parent()); EXPECT_THAT(layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 57, 19), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 57, 19), Color::kWhite))); auto* scroll_layer = ScrollableLayerAt(0); // The scroll layer should be sized to the container bounds. @@ -1174,13 +1175,13 @@ EXPECT_EQ(gfx::Vector2dF(3, 5), layer0->offset_to_transform_parent()); EXPECT_EQ(gfx::Size(27, 7), layer0->bounds()); EXPECT_THAT(layer0->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 37, 7), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 37, 7), Color::kBlack))); // The layer under the transform without a scroll node is not clipped. EXPECT_EQ(gfx::Vector2dF(1, -30), layer1->offset_to_transform_parent()); EXPECT_EQ(gfx::Size(5, 70), layer1->bounds()); EXPECT_THAT(layer1->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 5, 70), Color::kWhite))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 5, 70), Color::kWhite))); const cc::TransformTree& transform_tree = GetPropertyTrees().transform_tree; const cc::TransformNode& scroll_transform_node = @@ -1393,9 +1394,9 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1420,12 +1421,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Clip is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(10, 20, 50, 60), Color::kBlack)); + RectWithColor(gfx::RectF(10, 20, 50, 60), Color::kBlack)); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 300, 400), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 300, 400), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1452,12 +1453,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(50, 50, 100, 100), Color::kBlack)); + RectWithColor(gfx::RectF(50, 50, 100, 100), Color::kBlack)); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1487,10 +1488,10 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(50, 50, 100, 100), Color::kBlack)); + RectWithColor(gfx::RectF(50, 50, 100, 100), Color::kBlack)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1515,12 +1516,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 42, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 42, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back(RectWithColor( - FloatRect(29.2893, 0.578644, 141.421, 141.421), Color::kBlack)); + gfx::RectF(29.2893, 0.578644, 141.421, 141.421), Color::kBlack)); rects_with_color.push_back( - RectWithColor(FloatRect(0, 42, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 42, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1545,13 +1546,13 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), + RectWithColor(gfx::RectF(0, 0, 100, 100), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1577,13 +1578,13 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), + RectWithColor(gfx::RectF(0, 0, 100, 100), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1618,13 +1619,13 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // Transform is applied to this PaintChunk. rects_with_color.push_back( - RectWithColor(FloatRect(60, 70, 50, 60), + RectWithColor(gfx::RectF(60, 70, 50, 60), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1657,13 +1658,13 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // The two transforms (combined translation of (40, 50)) are applied here, // before clipping. rects_with_color.push_back( - RectWithColor(FloatRect(50, 70, 50, 60), Color(Color::kBlack))); + RectWithColor(gfx::RectF(50, 70, 50, 60), Color(Color::kBlack))); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1700,12 +1701,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 300, 400), + RectWithColor(gfx::RectF(0, 0, 300, 400), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1741,14 +1742,14 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // The clip is under |transform| but not |transform2|, so only an adjustment // of (20, 25) occurs. rects_with_color.push_back( - RectWithColor(FloatRect(30, 45, 50, 60), + RectWithColor(gfx::RectF(30, 45, 50, 60), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1776,12 +1777,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(10, 20, 50, 60), + RectWithColor(gfx::RectF(10, 20, 50, 60), Color(Color::kBlack).CombineWithAlpha(opacity).Rgb())); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1808,12 +1809,12 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); // The interesction of the two clips is (20, 30, 10, 20). rects_with_color.push_back( - RectWithColor(FloatRect(20, 30, 10, 20), Color(Color::kBlack))); + RectWithColor(gfx::RectF(20, 30, 10, 20), Color(Color::kBlack))); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), @@ -1842,11 +1843,11 @@ { Vector<RectWithColor> rects_with_color; rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 100, 100), Color::kWhite)); + RectWithColor(gfx::RectF(0, 0, 100, 100), Color::kWhite)); rects_with_color.push_back( - RectWithColor(FloatRect(40, 50, 10, 10), Color(Color::kBlack))); + RectWithColor(gfx::RectF(40, 50, 10, 10), Color(Color::kBlack))); rects_with_color.push_back( - RectWithColor(FloatRect(0, 0, 200, 300), Color::kGray)); + RectWithColor(gfx::RectF(0, 0, 200, 300), Color::kGray)); const cc::Layer* layer = LayerAt(0); EXPECT_THAT(layer->GetPicture(), Pointee(DrawsRectangles(rects_with_color))); @@ -1971,8 +1972,8 @@ const cc::Layer* layer = LayerAt(0); EXPECT_THAT(*layer->GetPicture(), DrawsRectangles(Vector<RectWithColor>{ - RectWithColor(FloatRect(0, 0, 200, 200), Color::kGray), - RectWithColor(FloatRect(50, 50, 100, 100), Color::kWhite)})); + RectWithColor(gfx::RectF(0, 0, 200, 200), Color::kGray), + RectWithColor(gfx::RectF(50, 50, 100, 100), Color::kWhite)})); EXPECT_EQ(Translation(100, 100), layer->ScreenSpaceTransform()); EXPECT_EQ(gfx::Size(200, 200), layer->bounds()); const cc::EffectNode* masked_group = @@ -2514,7 +2515,7 @@ EXPECT_TRUE(LayerAt(0)->DrawsContent()); EXPECT_THAT(LayerAt(0)->GetPicture(), Pointee(DrawsRectangles( - {RectWithColor(FloatRect(0, 0, 10, 10), Color::kBlack)}))); + {RectWithColor(gfx::RectF(0, 0, 10, 10), Color::kBlack)}))); } TEST_P(PaintArtifactCompositorTest, @@ -2525,7 +2526,7 @@ EXPECT_TRUE(LayerAt(0)->DrawsContent()); EXPECT_THAT(LayerAt(0)->GetPicture(), Pointee(DrawsRectangles( - {RectWithColor(FloatRect(0, 10, 10, 10), Color::kWhite)}))); + {RectWithColor(gfx::RectF(0, 10, 10, 10), Color::kWhite)}))); } TEST_P(PaintArtifactCompositorTest, @@ -2536,8 +2537,8 @@ EXPECT_TRUE(LayerAt(0)->DrawsContent()); EXPECT_THAT(LayerAt(0)->GetPicture(), Pointee(DrawsRectangles( - {RectWithColor(FloatRect(0, 0, 10, 10), Color::kBlack), - RectWithColor(FloatRect(0, 10, 10, 10), Color::kWhite)}))); + {RectWithColor(gfx::RectF(0, 0, 10, 10), Color::kBlack), + RectWithColor(gfx::RectF(0, 10, 10, 10), Color::kWhite)}))); } TEST_P(PaintArtifactCompositorTest, UpdateManagesLayerElementIds) { @@ -3699,7 +3700,7 @@ EXPECT_EQ(gfx::Size(200, 200), layer->bounds()); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 200, 200), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 200, 200), Color::kBlack))); // The layer's painting overflows the left, top, right edges of the clip. auto artifact2 = TestPaintArtifact() @@ -3727,7 +3728,7 @@ EXPECT_EQ(gfx::Size(300, 180), layer->bounds()); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 390, 180), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 390, 180), Color::kBlack))); // The layer's painting overflows all edges of the clip. auto artifact3 = @@ -3753,7 +3754,7 @@ EXPECT_EQ(gfx::Size(300, 400), layer->bounds()); EXPECT_THAT( layer->GetPicture(), - Pointee(DrawsRectangle(FloatRect(0, 0, 390, 580), Color::kBlack))); + Pointee(DrawsRectangle(gfx::RectF(0, 0, 390, 580), Color::kBlack))); } // Test that PaintArtifactCompositor creates the correct nodes for the visual
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc index 5ef7e7b..0d88424f 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer_test.cc
@@ -25,6 +25,7 @@ #include "third_party/blink/renderer/platform/testing/paint_property_test_helpers.h" #include "third_party/blink/renderer/platform/testing/paint_test_configurations.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" +#include "ui/gfx/geometry/skia_conversions.h" void PrintTo(const Vector<cc::PaintOpType>& ops, std::ostream* os) { *os << "["; @@ -48,7 +49,7 @@ void PrintTo(const SkRect& rect, std::ostream* os) { *os << (cc::PaintOp::IsUnsetRect(rect) ? "(unset)" - : blink::FloatRect(rect).ToString()); + : gfx::SkRectToRectF(rect).ToString()); } namespace blink { @@ -1257,15 +1258,15 @@ EXPECT_EFFECT_BOUNDS(0, 0, 0, 0, *output, 0); } -static sk_sp<cc::PaintFilter> MakeFilter(FloatRect bounds) { - PaintFilter::CropRect rect(bounds); +static sk_sp<cc::PaintFilter> MakeFilter(gfx::RectF bounds) { + PaintFilter::CropRect rect(gfx::RectFToSkRect(bounds)); return sk_make_sp<ColorFilterPaintFilter>( SkColorFilters::Blend(SK_ColorBLUE, SkBlendMode::kSrc), nullptr, &rect); } TEST_P(PaintChunksToCcLayerTest, ReferenceFilterOnEmptyChunk) { CompositorFilterOperations filter; - filter.AppendReferenceFilter(MakeFilter(FloatRect(12, 26, 93, 84))); + filter.AppendReferenceFilter(MakeFilter(gfx::RectF(12, 26, 93, 84))); filter.SetReferenceBox(gfx::RectF(11, 22, 33, 44)); ASSERT_TRUE(filter.HasReferenceFilter()); auto e1 = CreateFilterEffect(e0(), t0(), &c0(), filter); @@ -1296,7 +1297,7 @@ TEST_P(PaintChunksToCcLayerTest, ReferenceFilterOnChunkWithDrawingDisplayItem) { CompositorFilterOperations filter; - filter.AppendReferenceFilter(MakeFilter(FloatRect(7, 16, 93, 84))); + filter.AppendReferenceFilter(MakeFilter(gfx::RectF(7, 16, 93, 84))); filter.SetReferenceBox(gfx::RectF(11, 22, 33, 44)); ASSERT_TRUE(filter.HasReferenceFilter()); auto e1 = CreateFilterEffect(e0(), t0(), &c0(), filter);
diff --git a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.cc b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.cc index 921e40c..66178fa7 100644 --- a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.cc
@@ -25,10 +25,10 @@ #include "third_party/blink/renderer/platform/graphics/crossfade_generated_image.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/dark_mode_filter_helper.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" +#include "ui/gfx/geometry/rect_f.h" namespace blink { @@ -36,7 +36,7 @@ scoped_refptr<Image> from_image, scoped_refptr<Image> to_image, float percentage, - const FloatSize& size) + const gfx::SizeF& size) : GeneratedImage(size), from_image_(std::move(from_image)), to_image_(std::move(to_image)), @@ -46,9 +46,9 @@ cc::PaintCanvas* canvas, const PaintFlags& flags, const ImageDrawOptions& draw_options) { - FloatRect from_image_rect(gfx::PointF(), FloatSize(from_image_->Size())); - FloatRect to_image_rect(gfx::PointF(), FloatSize(to_image_->Size())); - FloatRect dest_rect((gfx::PointF()), size_); + gfx::RectF from_image_rect(gfx::SizeF(from_image_->Size())); + gfx::RectF to_image_rect(gfx::SizeF(to_image_->Size())); + gfx::RectF dest_rect(size_); // TODO(junov): The various effects encoded into paint should probably be // applied here instead of inside the layer. This probably faulty behavior @@ -77,28 +77,30 @@ void CrossfadeGeneratedImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { // Draw nothing if either of the images hasn't loaded yet. if (from_image_ == Image::NullImage() || to_image_ == Image::NullImage()) return; PaintCanvasAutoRestore ar(canvas, true); - canvas->clipRect(dst_rect); - canvas->concat(SkMatrix::RectToRect(src_rect, dst_rect)); + SkRect src_sk_rect = gfx::RectFToSkRect(src_rect); + SkRect dst_sk_rect = gfx::RectFToSkRect(dst_rect); + canvas->clipRect(dst_sk_rect); + canvas->concat(SkMatrix::RectToRect(src_sk_rect, dst_sk_rect)); DrawCrossfade(canvas, flags, draw_options); } void CrossfadeGeneratedImage::DrawTile(GraphicsContext& context, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& options) { // Draw nothing if either of the images hasn't loaded yet. if (from_image_ == Image::NullImage() || to_image_ == Image::NullImage()) return; PaintFlags flags = context.FillFlags(); flags.setBlendMode(SkBlendMode::kSrcOver); - FloatRect dest_rect((gfx::PointF()), size_); + gfx::RectF dest_rect(size_); ImageDrawOptions draw_options(options); draw_options.sampling_options = context.ComputeSamplingOptions(this, dest_rect, src_rect);
diff --git a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h index 8675d898..f4c4d04 100644 --- a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h +++ b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h
@@ -27,9 +27,10 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CROSSFADE_GENERATED_IMAGE_H_ #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/generated_image.h" #include "third_party/blink/renderer/platform/graphics/image.h" +#include "ui/gfx/geometry/size_conversions.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -39,31 +40,31 @@ scoped_refptr<Image> from_image, scoped_refptr<Image> to_image, float percentage, - const FloatSize& size) { + const gfx::SizeF& size) { return base::AdoptRef(new CrossfadeGeneratedImage( std::move(from_image), std::move(to_image), percentage, size)); } bool HasIntrinsicSize() const override { return true; } - IntSize SizeWithConfig(SizeConfig) const override { - return FlooredIntSize(size_); + gfx::Size SizeWithConfig(SizeConfig) const override { + return gfx::ToFlooredSize(size_); } protected: void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect&, - const FloatRect&, + const gfx::RectF&, + const gfx::RectF&, const ImageDrawOptions& draw_options) override; void DrawTile(GraphicsContext&, - const FloatRect&, + const gfx::RectF&, const ImageDrawOptions&) final; CrossfadeGeneratedImage(scoped_refptr<Image> from_image, scoped_refptr<Image> to_image, float percentage, - const FloatSize&); + const gfx::SizeF&); private: void DrawCrossfade(cc::PaintCanvas*,
diff --git a/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc b/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc index 46eae9fa..cf403f84 100644 --- a/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc +++ b/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc
@@ -70,7 +70,7 @@ if (!decoder || !decoder->IsSizeAvailable()) return nullptr; - const IntSize size = decoder->Size(); + const gfx::Size size = decoder->Size(); const SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType, decoder->ColorSpaceForSkImages());
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc index ab10321..5e8da9b2 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc
@@ -127,7 +127,7 @@ DeferredFrameData& operator=(const DeferredFrameData&) = delete; ImageOrientation orientation_; - IntSize density_corrected_size_; + gfx::Size density_corrected_size_; base::TimeDelta duration_; bool is_received_; }; @@ -300,11 +300,11 @@ : has_embedded_color_profile_; } -IntSize DeferredImageDecoder::Size() const { +gfx::Size DeferredImageDecoder::Size() const { return metadata_decoder_ ? metadata_decoder_->Size() : size_; } -IntSize DeferredImageDecoder::FrameSizeAtIndex(wtf_size_t index) const { +gfx::Size DeferredImageDecoder::FrameSizeAtIndex(wtf_size_t index) const { // FIXME: LocalFrame size is assumed to be uniform. This might not be true for // future supported codecs. return metadata_decoder_ ? metadata_decoder_->FrameSizeAtIndex(index) : size_; @@ -369,7 +369,7 @@ return ImageOrientationEnum::kDefault; } -IntSize DeferredImageDecoder::DensityCorrectedSizeAtIndex( +gfx::Size DeferredImageDecoder::DensityCorrectedSizeAtIndex( wtf_size_t index) const { if (metadata_decoder_) return metadata_decoder_->DensityCorrectedSize();
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h index f47952c..2ceecc1 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h
@@ -29,17 +29,16 @@ #include <memory> #include "third_party/abseil-cpp/absl/types/optional.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_image.h" +#include "third_party/blink/renderer/platform/graphics/parkable_image.h" #include "third_party/blink/renderer/platform/graphics/rw_buffer.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" - -#include "third_party/blink/renderer/platform/graphics/parkable_image.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/skia/include/core/SkRefCnt.h" +#include "ui/gfx/geometry/size.h" namespace blink { @@ -74,15 +73,15 @@ bool IsSizeAvailable(); bool HasEmbeddedColorProfile() const; - IntSize Size() const; - IntSize FrameSizeAtIndex(wtf_size_t index) const; + gfx::Size Size() const; + gfx::Size FrameSizeAtIndex(wtf_size_t index) const; wtf_size_t FrameCount(); bool ImageIsHighBitDepth() const { return image_is_high_bit_depth_; } int RepetitionCount() const; bool FrameIsReceivedAtIndex(wtf_size_t index) const; base::TimeDelta FrameDurationAtIndex(wtf_size_t index) const; ImageOrientation OrientationAtIndex(wtf_size_t index) const; - IntSize DensityCorrectedSizeAtIndex(wtf_size_t index) const; + gfx::Size DensityCorrectedSizeAtIndex(wtf_size_t index) const; bool HotSpot(gfx::Point&) const; SkAlphaType AlphaType() const; @@ -113,7 +112,7 @@ std::unique_ptr<ImageDecoder> metadata_decoder_; String filename_extension_; - IntSize size_; + gfx::Size size_; int repetition_count_; bool has_embedded_color_profile_ = false; bool all_data_received_;
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc index f0905fd..3f02b912 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc
@@ -113,7 +113,7 @@ base::TimeDelta FrameDuration() const override { return frame_duration_; } - IntSize DecodedSize() const override { return decoded_size_; } + gfx::Size DecodedSize() const override { return decoded_size_; } PaintImage CreatePaintImage( PaintImage::CompletionState state = PaintImage::CompletionState::DONE) { @@ -153,7 +153,7 @@ int repetition_count_; ImageFrame::Status status_; base::TimeDelta frame_duration_; - IntSize decoded_size_; + gfx::Size decoded_size_; }; TEST_F(DeferredImageDecoderTest, drawIntoPaintRecord) { @@ -341,7 +341,7 @@ } TEST_F(DeferredImageDecoderTest, decodedSize) { - decoded_size_ = IntSize(22, 33); + decoded_size_ = gfx::Size(22, 33); lazy_decoder_->SetData(data_, true /* all_data_received */); PaintImage image = CreatePaintImage(); ASSERT_TRUE(image);
diff --git a/third_party/blink/renderer/platform/graphics/generated_image.cc b/third_party/blink/renderer/platform/graphics/generated_image.cc index 94a4e7757..4c32d83 100644 --- a/third_party/blink/renderer/platform/graphics/generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/generated_image.cc
@@ -30,26 +30,27 @@ #include "third_party/blink/renderer/platform/graphics/generated_image.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_image.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { void GeneratedImage::DrawPattern(GraphicsContext& dest_context, const cc::PaintFlags& base_flags, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options) { - FloatRect tile_rect(tiling_info.image_rect); - tile_rect.Expand(tiling_info.spacing); + gfx::RectF tile_rect = tiling_info.image_rect; + tile_rect.Outset(0, 0, tiling_info.spacing.width(), + tiling_info.spacing.height()); SkMatrix pattern_matrix = SkMatrix::Translate(tiling_info.phase.x(), tiling_info.phase.y()); - pattern_matrix.preScale(tiling_info.scale.width(), - tiling_info.scale.height()); + pattern_matrix.preScale(tiling_info.scale.x(), tiling_info.scale.y()); pattern_matrix.preTranslate(tile_rect.x(), tile_rect.y()); sk_sp<PaintShader> tile_shader = CreateShader( @@ -59,13 +60,14 @@ fill_flags.setShader(std::move(tile_shader)); fill_flags.setColor(SK_ColorBLACK); - dest_context.DrawRect(dest_rect, fill_flags, AutoDarkMode(draw_options)); + dest_context.DrawRect(gfx::RectFToSkRect(dest_rect), fill_flags, + AutoDarkMode(draw_options)); } sk_sp<PaintShader> GeneratedImage::CreateShader( - const FloatRect& tile_rect, + const gfx::RectF& tile_rect, const SkMatrix* pattern_matrix, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { auto paint_controller = std::make_unique<PaintController>(PaintController::kTransient); @@ -74,9 +76,9 @@ DrawTile(context, src_rect, draw_options); sk_sp<PaintRecord> record = context.EndRecording(); - return PaintShader::MakePaintRecord(std::move(record), tile_rect, - SkTileMode::kRepeat, SkTileMode::kRepeat, - pattern_matrix); + return PaintShader::MakePaintRecord( + std::move(record), gfx::RectFToSkRect(tile_rect), SkTileMode::kRepeat, + SkTileMode::kRepeat, pattern_matrix); } PaintImage GeneratedImage::PaintImageForCurrentFrame() {
diff --git a/third_party/blink/renderer/platform/graphics/generated_image.h b/third_party/blink/renderer/platform/graphics/generated_image.h index 691bb1b..2dbb9089 100644 --- a/third_party/blink/renderer/platform/graphics/generated_image.h +++ b/third_party/blink/renderer/platform/graphics/generated_image.h
@@ -26,9 +26,10 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GENERATED_IMAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GENERATED_IMAGE_H_ -#include "third_party/blink/renderer/platform/geometry/layout_size.h" #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/skia/include/core/SkRefCnt.h" +#include "ui/gfx/geometry/size_conversions.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -38,10 +39,10 @@ bool HasIntrinsicSize() const override { return false; } - IntSize SizeWithConfig(SizeConfig) const override { - return RoundedIntSize(size_); + gfx::Size SizeWithConfig(SizeConfig) const override { + return gfx::ToRoundedSize(size_); } - FloatSize SizeWithConfigAsFloat(SizeConfig) const override { return size_; } + gfx::SizeF SizeWithConfigAsFloat(SizeConfig) const override { return size_; } // Assume that generated content has no decoded data we need to worry about void DestroyDecodedData() override {} @@ -51,25 +52,25 @@ protected: void DrawPattern(GraphicsContext&, const cc::PaintFlags&, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo&, const ImageDrawOptions& draw_options) final; virtual sk_sp<cc::PaintShader> CreateShader( - const FloatRect& tile_rect, + const gfx::RectF& tile_rect, const SkMatrix* pattern_matrix, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options); // FIXME: Implement this to be less conservative. bool CurrentFrameKnownToBeOpaque() override { return false; } - GeneratedImage(const FloatSize& size) : size_(size) {} + GeneratedImage(const gfx::SizeF& size) : size_(size) {} virtual void DrawTile(GraphicsContext&, - const FloatRect&, + const gfx::RectF&, const ImageDrawOptions&) = 0; - FloatSize size_; + gfx::SizeF size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc index cd107ffff..cc345448 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
@@ -137,7 +137,7 @@ const Platform::GraphicsInfo& graphics_info, bool using_swap_chain, Client* client, - const IntSize& size, + const gfx::Size& size, bool premultiplied_alpha, bool want_alpha_channel, bool want_depth_buffer, @@ -346,27 +346,26 @@ cc::SharedBitmapIdRegistrar* bitmap_registrar) { // When searching for a hit in SharedBitmap, we don't consider the bitmap // format (RGBA 8888 vs F16) since the allocated bitmap is always RGBA_8888. - auto* it = - std::remove_if(recycled_bitmaps_.begin(), recycled_bitmaps_.end(), - [this](const RegisteredBitmap& registered) { - return registered.bitmap->size() != ToGfxSize(size_); - }); + auto* it = std::remove_if(recycled_bitmaps_.begin(), recycled_bitmaps_.end(), + [this](const RegisteredBitmap& registered) { + return registered.bitmap->size() != size_; + }); recycled_bitmaps_.Shrink( static_cast<wtf_size_t>(it - recycled_bitmaps_.begin())); if (!recycled_bitmaps_.IsEmpty()) { RegisteredBitmap recycled = std::move(recycled_bitmaps_.back()); recycled_bitmaps_.pop_back(); - DCHECK(recycled.bitmap->size() == ToGfxSize(size_)); + DCHECK(recycled.bitmap->size() == size_); return recycled; } const viz::SharedBitmapId id = viz::SharedBitmap::GenerateId(); const viz::ResourceFormat format = viz::RGBA_8888; base::MappedReadOnlyRegion shm = - viz::bitmap_allocation::AllocateSharedBitmap(ToGfxSize(size_), format); + viz::bitmap_allocation::AllocateSharedBitmap(size_, format); auto bitmap = base::MakeRefCounted<cc::CrossThreadSharedBitmap>( - id, std::move(shm), ToGfxSize(size_), format); + id, std::move(shm), size_, format); RegisteredBitmap registered = { bitmap, bitmap_registrar->RegisterSharedBitmapId(id, bitmap)}; return registered; @@ -467,8 +466,8 @@ gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); // Readback in Skia native byte order (RGBA or BGRA) with kN32_SkColorType. - const size_t buffer_size = viz::ResourceSizes::CheckedSizeInBytes<size_t>( - ToGfxSize(size_), viz::RGBA_8888); + const size_t buffer_size = + viz::ResourceSizes::CheckedSizeInBytes<size_t>(size_, viz::RGBA_8888); ReadBackFramebuffer(base::span<uint8_t>(pixels, buffer_size), kN32_SkColorType, op); } @@ -484,7 +483,7 @@ static_cast<uint8_t*>(registered.bitmap->memory())); *out_resource = viz::TransferableResource::MakeSoftware( - registered.bitmap->id(), ToGfxSize(size_), viz::RGBA_8888); + registered.bitmap->id(), size_, viz::RGBA_8888); out_resource->color_space = storage_color_space_; // This holds a ref on the DrawingBuffer that will keep it alive until the @@ -587,7 +586,7 @@ bool is_overlay_candidate = !!color_buffer_for_mailbox->gpu_memory_buffer; *out_resource = viz::TransferableResource::MakeGL( color_buffer_for_mailbox->mailbox, GL_LINEAR, texture_target_, - color_buffer_for_mailbox->produce_sync_token, ToGfxSize(size_), + color_buffer_for_mailbox->produce_sync_token, size_, is_overlay_candidate); out_resource->color_space = storage_color_space_; out_resource->format = color_buffer_for_mailbox->format; @@ -651,7 +650,7 @@ bool lost_resource) { DCHECK(!sync_token.HasData()); // No sync tokens for software resources. if (destruction_in_progress_ || lost_resource || is_hidden_ || - registered.bitmap->size() != ToGfxSize(size_)) { + registered.bitmap->size() != size_) { // Just delete the RegisteredBitmap, which will free the memory and // unregister it with the compositor. return; @@ -819,7 +818,7 @@ DrawingBuffer::ColorBuffer::ColorBuffer( base::WeakPtr<DrawingBuffer> drawing_buffer, - const IntSize& size, + const gfx::Size& size, viz::ResourceFormat format, GLuint texture_id, std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer, @@ -856,7 +855,7 @@ gl->DeleteTextures(1u, &rgb_workaround_texture_id); } -bool DrawingBuffer::Initialize(const IntSize& size, bool use_multisampling) { +bool DrawingBuffer::Initialize(const gfx::Size& size, bool use_multisampling) { ScopedStateRestorer scoped_state_restorer(this); if (gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { @@ -1030,7 +1029,7 @@ mailbox = front_color_buffer_->mailbox; produce_sync_token = front_color_buffer_->produce_sync_token; format = front_color_buffer_->format; - size = ToGfxSize(front_color_buffer_->size); + size = front_color_buffer_->size; } else { GLuint texture_id = 0; if (premultiplied_alpha_false_texture_) { @@ -1042,7 +1041,7 @@ texture_id = back_color_buffer_->texture_id; } format = back_color_buffer_->format; - size = ToGfxSize(back_color_buffer_->size); + size = back_color_buffer_->size; src_gl->EndSharedImageAccessDirectCHROMIUM(texture_id); src_gl->GenUnverifiedSyncTokenCHROMIUM(produce_sync_token.GetData()); texture_id_to_restore_access = texture_id; @@ -1078,7 +1077,7 @@ bool premultiply_alpha, bool flip_y, const gfx::Point& dst_texture_offset, - const IntRect& src_sub_rectangle, + const gfx::Rect& src_sub_rectangle, SourceDrawingBuffer src_buffer) { if (!Extensions3DUtil::CanUseCopyTextureCHROMIUM(dst_texture_target)) return false; @@ -1107,13 +1106,14 @@ }; return CopyToPlatformInternal(dst_gl, src_buffer, copy_function); } + bool DrawingBuffer::CopyToPlatformMailbox( gpu::raster::RasterInterface* dst_raster_interface, gpu::Mailbox dst_mailbox, GLenum dst_texture_target, bool flip_y, const gfx::Point& dst_texture_offset, - const IntRect& src_sub_rectangle, + const gfx::Rect& src_sub_rectangle, SourceDrawingBuffer src_buffer) { GLboolean unpack_premultiply_alpha_needed = GL_FALSE; if (want_alpha_channel_ && !premultiplied_alpha_) @@ -1225,7 +1225,7 @@ premultiplied_alpha_false_mailbox_.SetZero(); } - size_ = IntSize(); + size_ = gfx::Size(); back_color_buffer_ = nullptr; front_color_buffer_ = nullptr; @@ -1238,7 +1238,7 @@ client_ = nullptr; } -bool DrawingBuffer::ResizeDefaultFramebuffer(const IntSize& size) { +bool DrawingBuffer::ResizeDefaultFramebuffer(const gfx::Size& size) { DCHECK(state_restorer_); // Recreate m_backColorBuffer. back_color_buffer_ = CreateColorBuffer(size); @@ -1268,8 +1268,8 @@ ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; premultiplied_alpha_false_mailbox_ = sii->CreateSharedImage( - back_color_buffer_->format, ToGfxSize(size), storage_color_space_, - origin, kUnpremul_SkAlphaType, + back_color_buffer_->format, size, storage_color_space_, origin, + kUnpremul_SkAlphaType, gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT | gpu::SHARED_IMAGE_USAGE_RASTER, @@ -1387,10 +1387,10 @@ ClearFramebuffersInternal(clear_mask, clear_option); } -IntSize DrawingBuffer::AdjustSize(const IntSize& desired_size, - const IntSize& cur_size, - int max_texture_size) { - IntSize adjusted_size = desired_size; +gfx::Size DrawingBuffer::AdjustSize(const gfx::Size& desired_size, + const gfx::Size& cur_size, + int max_texture_size) { + gfx::Size adjusted_size = desired_size; // Clamp if the desired size is greater than the maximum texture size for the // device. @@ -1403,22 +1403,23 @@ return adjusted_size; } -bool DrawingBuffer::Resize(const IntSize& new_size) { +bool DrawingBuffer::Resize(const gfx::Size& new_size) { ScopedStateRestorer scoped_state_restorer(this); return ResizeFramebufferInternal(new_size); } -bool DrawingBuffer::ResizeFramebufferInternal(const IntSize& new_size) { +bool DrawingBuffer::ResizeFramebufferInternal(const gfx::Size& new_size) { DCHECK(state_restorer_); DCHECK(!new_size.IsEmpty()); - IntSize adjusted_size = AdjustSize(new_size, size_, max_texture_size_); + gfx::Size adjusted_size = AdjustSize(new_size, size_, max_texture_size_); if (adjusted_size.IsEmpty()) return false; if (adjusted_size != size_) { do { if (!ResizeDefaultFramebuffer(adjusted_size)) { - adjusted_size.Scale(kResourceAdjustedRatio); + adjusted_size = + gfx::ScaleToFlooredSize(adjusted_size, kResourceAdjustedRatio); continue; } break; @@ -1559,7 +1560,7 @@ } } -bool DrawingBuffer::ReallocateMultisampleRenderbuffer(const IntSize& size) { +bool DrawingBuffer::ReallocateMultisampleRenderbuffer(const gfx::Size& size) { state_restorer_->SetFramebufferBindingDirty(); state_restorer_->SetRenderbufferBindingDirty(); gl_->BindFramebuffer(GL_FRAMEBUFFER, multisample_fbo_); @@ -1768,7 +1769,7 @@ } scoped_refptr<DrawingBuffer::ColorBuffer> DrawingBuffer::CreateColorBuffer( - const IntSize& size) { + const gfx::Size& size) { if (size.IsEmpty()) { // Context is likely lost. return nullptr; @@ -1804,8 +1805,8 @@ if (UsingSwapChain()) { gpu::SharedImageInterface::SwapChainMailboxes mailboxes = - sii->CreateSwapChain(format, ToGfxSize(size), storage_color_space_, - origin, kPremul_SkAlphaType, + sii->CreateSwapChain(format, size, storage_color_space_, origin, + kPremul_SkAlphaType, usage | gpu::SHARED_IMAGE_USAGE_SCANOUT); back_buffer_mailbox = mailboxes.back_buffer; front_buffer_mailbox = mailboxes.front_buffer; @@ -1836,8 +1837,7 @@ } gpu_memory_buffer = gpu_memory_buffer_manager->CreateGpuMemoryBuffer( - ToGfxSize(size), buffer_format, buffer_usage, gpu::kNullSurfaceHandle, - nullptr); + size, buffer_format, buffer_usage, gpu::kNullSurfaceHandle, nullptr); if (gpu_memory_buffer) { back_buffer_mailbox = sii->CreateSharedImage( @@ -1858,9 +1858,9 @@ if (!ShouldUseChromiumImage() && !premultiplied_alpha_) alpha_type = kUnpremul_SkAlphaType; - back_buffer_mailbox = sii->CreateSharedImage( - format, ToGfxSize(size), storage_color_space_, origin, alpha_type, - usage, gpu::kNullSurfaceHandle); + back_buffer_mailbox = + sii->CreateSharedImage(format, size, storage_color_space_, origin, + alpha_type, usage, gpu::kNullSurfaceHandle); } }
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h index a6696c0..2b03f5bba 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
@@ -31,6 +31,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GPU_DRAWING_BUFFER_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_GPU_DRAWING_BUFFER_H_ +#include <limits> #include <memory> #include "base/containers/span.h" @@ -130,7 +131,7 @@ const Platform::GraphicsInfo& graphics_info, bool using_swap_chain, Client*, - const IntSize&, + const gfx::Size&, bool premultiplied_alpha, bool want_alpha_channel, bool want_depth_buffer, @@ -172,18 +173,18 @@ // Given the desired buffer size, provides the largest dimensions that will // fit in the pixel budget. - static IntSize AdjustSize(const IntSize& desired_size, - const IntSize& cur_size, - int max_texture_size); + static gfx::Size AdjustSize(const gfx::Size& desired_size, + const gfx::Size& cur_size, + int max_texture_size); // Resizes (or allocates if necessary) all buffers attached to the default // framebuffer. Returns whether the operation was successful. - bool Resize(const IntSize&); + bool Resize(const gfx::Size&); // Bind the default framebuffer to |target|. |target| must be // GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_DRAW_FRAMEBUFFER. void Bind(GLenum target); - IntSize Size() const { return size_; } + gfx::Size Size() const { return size_; } GLenum StorageFormat() const; // Resolves the multisample color buffer to the normal color buffer and leaves @@ -268,7 +269,7 @@ bool premultiply_alpha, bool flip_y, const gfx::Point& dst_texture_offset, - const IntRect& src_sub_rectangle, + const gfx::Rect& src_sub_rectangle, SourceDrawingBuffer); bool CopyToPlatformMailbox(gpu::raster::RasterInterface*, @@ -276,7 +277,7 @@ GLenum dst_texture_target, bool flip_y, const gfx::Point& dst_texture_offset, - const IntRect& src_sub_rectangle, + const gfx::Rect& src_sub_rectangle, SourceDrawingBuffer src_buffer); void CopyToVideoFrame( @@ -348,7 +349,7 @@ const CanvasColorParams&, gl::GpuPreference gpu_preference); - bool Initialize(const IntSize&, bool use_multisampling); + bool Initialize(const gfx::Size&, bool use_multisampling); struct RegisteredBitmap { scoped_refptr<cc::CrossThreadSharedBitmap> bitmap; @@ -404,7 +405,7 @@ struct ColorBuffer : public base::RefCountedThreadSafe<ColorBuffer> { ColorBuffer(base::WeakPtr<DrawingBuffer> drawing_buffer, - const IntSize&, + const gfx::Size&, viz::ResourceFormat, GLuint texture_id, std::unique_ptr<gfx::GpuMemoryBuffer>, @@ -421,7 +422,7 @@ // by the beginDestruction method, which will eventually drain all of its // ColorBuffers. base::WeakPtr<DrawingBuffer> drawing_buffer; - const IntSize size; + const gfx::Size size; const viz::ResourceFormat format; const GLuint texture_id = 0; std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; @@ -462,7 +463,7 @@ ClearOption clear_option); // The same as reset(), but leaves GL state dirty. - bool ResizeFramebufferInternal(const IntSize&); + bool ResizeFramebufferInternal(const gfx::Size&); // The same as resolveAndBindForReadAndDraw(), but leaves GL state dirty. void ResolveMultisampleFramebufferInternal(); @@ -512,7 +513,7 @@ // Attempts to allocator storage for, or resize all buffers. Returns whether // the operation was successful. - bool ResizeDefaultFramebuffer(const IntSize&); + bool ResizeDefaultFramebuffer(const gfx::Size&); void ClearCcLayer(); @@ -521,7 +522,7 @@ // Updates the current size of the buffer, ensuring that // s_currentResourceUsePixels is updated. - void SetSize(const IntSize&); + void SetSize(const gfx::Size&); // Read the content of the FrameBuffer into the bitmap. void ReadFramebufferIntoBitmapPixels(uint8_t* pixels); @@ -541,7 +542,7 @@ // RuntimeEnabledFeatures::WebGLImageChromiumEnabled() is true. On failure, // or if the flag is false, creates a default texture. Always returns a valid // ColorBuffer. - scoped_refptr<ColorBuffer> CreateColorBuffer(const IntSize&); + scoped_refptr<ColorBuffer> CreateColorBuffer(const gfx::Size&); // Creates or recycles a ColorBuffer of size |m_size|. scoped_refptr<ColorBuffer> CreateOrRecycleColorBuffer(); @@ -565,7 +566,7 @@ // Reallocate Multisampled renderbuffer, used by explicit resolve when resize // and GPU switch - bool ReallocateMultisampleRenderbuffer(const IntSize&); + bool ReallocateMultisampleRenderbuffer(const gfx::Size&); // Presents swap chain if swap chain is being used and contents have changed. void ResolveAndPresentSwapChainIfNeeded(); @@ -580,7 +581,7 @@ // Lifetime is tied to the m_contextProvider. gpu::gles2::GLES2Interface* gl_; std::unique_ptr<Extensions3DUtil> extensions_util_; - IntSize size_ = {-1, -1}; + gfx::Size size_; const bool discard_framebuffer_supported_; // Did the user request an alpha channel be allocated. const bool want_alpha_channel_;
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_software_rendering_test.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_software_rendering_test.cc index 34393773..f57d4d39 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_software_rendering_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_software_rendering_test.cc
@@ -31,7 +31,7 @@ class DrawingBufferSoftwareCompositingTest : public testing::Test { protected: void SetUp() override { - IntSize initial_size(kInitialWidth, kInitialHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); auto gl = std::make_unique<GLES2InterfaceForTests>(); auto provider = std::make_unique<WebGraphicsContext3DProviderForTests>(std::move(gl)); @@ -54,8 +54,8 @@ viz::ReleaseCallback release_callback1; viz::ReleaseCallback release_callback2; viz::ReleaseCallback release_callback3; - IntSize initial_size(kInitialWidth, kInitialHeight); - IntSize alternate_size(kInitialWidth, kAlternateHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); + gfx::Size alternate_size(kInitialWidth, kAlternateHeight); drawing_buffer_->Resize(initial_size); drawing_buffer_->MarkContentsChanged(); @@ -93,7 +93,7 @@ GLES2InterfaceForTests* gl_ = drawing_buffer_->ContextGLForTests(); viz::TransferableResource resource; viz::ReleaseCallback release_callback; - IntSize initial_size(kInitialWidth, kInitialHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); GLint drawBinding = 0, readBinding = 0; GLuint draw_framebuffer_binding = 0xbeef3;
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc index bf276a5..2ba2e9f 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc
@@ -63,7 +63,7 @@ void SetUp() override { Init(kDisableMultisampling); } void Init(UseMultisampling use_multisampling) { - IntSize initial_size(kInitialWidth, kInitialHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); auto gl = std::make_unique<GLES2InterfaceForTests>(); auto provider = std::make_unique<WebGraphicsContext3DProviderForTests>(std::move(gl)); @@ -156,15 +156,15 @@ viz::TransferableResource resource; viz::ReleaseCallback release_callback; - IntSize initial_size(kInitialWidth, kInitialHeight); - IntSize alternate_size(kInitialWidth, kAlternateHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); + gfx::Size alternate_size(kInitialWidth, kAlternateHeight); // Produce one resource at size 100x100. EXPECT_FALSE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); VerifyStateWasRestored(); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); // Resize to 100x50. drawing_buffer_->Resize(alternate_size); @@ -176,7 +176,7 @@ EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(alternate_size), sii->MostRecentSize()); + EXPECT_EQ(alternate_size, sii->MostRecentSize()); VerifyStateWasRestored(); // Reset to initial size. @@ -190,7 +190,7 @@ EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); VerifyStateWasRestored(); // Prepare one final resource and verify that it's the correct size. @@ -199,7 +199,7 @@ EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); VerifyStateWasRestored(); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); std::move(release_callback).Run(gpu::SyncToken(), false /* lostResource */); drawing_buffer_->BeginDestruction(); } @@ -356,7 +356,7 @@ platform_ = std::make_unique< ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform>>(); - IntSize initial_size(kInitialWidth, kInitialHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); auto gl = std::make_unique<GLES2InterfaceForTests>(); auto provider = std::make_unique<WebGraphicsContext3DProviderForTests>(std::move(gl)); @@ -390,8 +390,8 @@ viz::TransferableResource resource; viz::ReleaseCallback release_callback; - IntSize initial_size(kInitialWidth, kInitialHeight); - IntSize alternate_size(kInitialWidth, kAlternateHeight); + gfx::Size initial_size(kInitialWidth, kInitialHeight); + gfx::Size alternate_size(kInitialWidth, kAlternateHeight); // There should be currently one back buffer and therefore one SharedImage. gpu::Mailbox mailbox1; @@ -405,9 +405,9 @@ EXPECT_FALSE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); EXPECT_TRUE(resource.is_overlay_candidate); - EXPECT_EQ(ToGfxSize(initial_size), resource.size); + EXPECT_EQ(initial_size, resource.size); testing::Mock::VerifyAndClearExpectations(gl_); VerifyStateWasRestored(); gpu::Mailbox mailbox2; @@ -443,9 +443,9 @@ EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(alternate_size), sii->MostRecentSize()); + EXPECT_EQ(alternate_size, sii->MostRecentSize()); EXPECT_TRUE(resource.is_overlay_candidate); - EXPECT_EQ(ToGfxSize(alternate_size), resource.size); + EXPECT_EQ(alternate_size, resource.size); gpu::Mailbox mailbox4; mailbox4.SetName(gl_->last_imported_shared_image()->name); EXPECT_EQ(2u, sii->shared_image_count()); @@ -481,9 +481,9 @@ EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); EXPECT_TRUE(resource.is_overlay_candidate); - EXPECT_EQ(ToGfxSize(initial_size), resource.size); + EXPECT_EQ(initial_size, resource.size); testing::Mock::VerifyAndClearExpectations(gl_); gpu::Mailbox mailbox6; mailbox6.SetName(gl_->last_imported_shared_image()->name); @@ -498,9 +498,9 @@ EXPECT_TRUE(drawing_buffer_->MarkContentsChanged()); EXPECT_TRUE(drawing_buffer_->PrepareTransferableResource(nullptr, &resource, &release_callback)); - EXPECT_EQ(ToGfxSize(initial_size), sii->MostRecentSize()); + EXPECT_EQ(initial_size, sii->MostRecentSize()); EXPECT_TRUE(resource.is_overlay_candidate); - EXPECT_EQ(ToGfxSize(initial_size), resource.size); + EXPECT_EQ(initial_size, resource.size); std::move(release_callback).Run(gpu::SyncToken(), false /* lostResource */); EXPECT_EQ(2u, sii->shared_image_count()); EXPECT_TRUE(sii->CheckSharedImageExists(mailbox5)); @@ -684,7 +684,7 @@ bool using_swap_chain = false; scoped_refptr<DrawingBuffer> drawing_buffer = DrawingBuffer::Create( std::move(provider), graphics_info, using_swap_chain, nullptr, - IntSize(10, 10), premultiplied_alpha, want_alpha_channel, + gfx::Size(10, 10), premultiplied_alpha, want_alpha_channel, want_depth_buffer, want_stencil_buffer, want_antialiasing, preserve, DrawingBuffer::kWebGL1, DrawingBuffer::kAllowChromiumImage, cc::PaintFlags::FilterQuality::kLow, CanvasColorParams(), @@ -707,7 +707,7 @@ EXPECT_EQ(0u, tracking_gl->StencilAttachment()); } - drawing_buffer->Resize(IntSize(10, 20)); + drawing_buffer->Resize(gfx::Size(10, 20)); EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, drawing_buffer->HasDepthBuffer()); EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, @@ -752,7 +752,7 @@ TEST_F(DrawingBufferTest, VerifyTooBigDrawingBufferExceedingV8MaxSizeFailsToCreate) { - IntSize too_big_size(1, (v8::TypedArray::kMaxLength / 4) + 1); + gfx::Size too_big_size(1, (v8::TypedArray::kMaxLength / 4) + 1); Platform::GraphicsInfo graphics_info; graphics_info.using_gpu_compositing = true; scoped_refptr<DrawingBuffer> too_big_drawing_buffer = DrawingBuffer::Create(
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h index ae9ce51..248ed6d 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h
@@ -446,7 +446,7 @@ std::unique_ptr<WebGraphicsContext3DProvider> context_provider, const Platform::GraphicsInfo& graphics_info, DrawingBuffer::Client* client, - const IntSize& size, + const gfx::Size& size, PreserveDrawingBuffer preserve, UseMultisampling use_multisampling) { std::unique_ptr<Extensions3DUtil> extensions_util =
diff --git a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context_test.cc b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context_test.cc index 1736bcd..5b264b5 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context_test.cc
@@ -165,7 +165,7 @@ // Canvas2DLayerBridge will restore the context and succeed. gl_.SetIsContextLost(true); EXPECT_FALSE(SharedGpuContext::IsValidWithoutRestoring()); - IntSize size(10, 10); + gfx::Size size(10, 10); std::unique_ptr<Canvas2DLayerBridge> bridge = std::make_unique<Canvas2DLayerBridge>(size, RasterMode::kGPU, kNonOpaque); EXPECT_TRUE(bridge->IsAccelerated());
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc b/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc index 5b5f704..76a005a 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.cc
@@ -3208,7 +3208,7 @@ STACK_ALLOCATED(); public: - FormatConverter(const IntRect& source_data_sub_rectangle, + FormatConverter(const gfx::Rect& source_data_sub_rectangle, int depth, int unpack_image_height, const void* src_start, @@ -3252,7 +3252,7 @@ WebGLImageConversion::AlphaOp alphaOp> void Convert(); - const IntRect& src_sub_rectangle_; + const gfx::Rect& src_sub_rectangle_; const int depth_; const int unpack_image_height_; const void* const src_start_; @@ -3908,7 +3908,7 @@ DataFormat source_format, unsigned source_image_width, unsigned source_image_height, - const IntRect& source_image_sub_rectangle, + const gfx::Rect& source_image_sub_rectangle, int depth, unsigned source_unpack_alignment, int unpack_image_height, @@ -3937,8 +3937,8 @@ bool WebGLImageConversion::ExtractImageData( const void* image_data, DataFormat source_data_format, - const IntSize& image_data_size, - const IntRect& source_image_sub_rectangle, + const gfx::Size& image_data_size, + const gfx::Rect& source_image_sub_rectangle, int depth, int unpack_image_height, GLenum format, @@ -4005,7 +4005,7 @@ if (!PackPixels(src_data, source_data_format, unpack_params.row_length ? unpack_params.row_length : width, - height, IntRect(0, 0, width, height), 1, + height, gfx::Rect(0, 0, width, height), 1, unpack_params.alignment, 0, format, type, (premultiply_alpha ? kAlphaDoPremultiply : kAlphaDoNothing), data.data(), flip_y)) @@ -4014,19 +4014,20 @@ return true; } -bool WebGLImageConversion::PackPixels(const void* source_data, - DataFormat source_data_format, - unsigned source_data_width, - unsigned source_data_height, - const IntRect& source_data_sub_rectangle, - int depth, - unsigned source_unpack_alignment, - int unpack_image_height, - unsigned destination_format, - unsigned destination_type, - AlphaOp alpha_op, - void* destination_data, - bool flip_y) { +bool WebGLImageConversion::PackPixels( + const void* source_data, + DataFormat source_data_format, + unsigned source_data_width, + unsigned source_data_height, + const gfx::Rect& source_data_sub_rectangle, + int depth, + unsigned source_unpack_alignment, + int unpack_image_height, + unsigned destination_format, + unsigned destination_type, + AlphaOp alpha_op, + void* destination_data, + bool flip_y) { DCHECK_GE(depth, 1); if (unpack_image_height == 0) { unpack_image_height = source_data_sub_rectangle.height();
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.h b/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.h index d02babf..ef574ea3 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.h +++ b/third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.h
@@ -16,9 +16,12 @@ #include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/khronos/GLES3/gl3.h" +namespace gfx { +class Size; +} + namespace blink { class Image; -class IntSize; // Helper functions for texture uploading and pixel readback. class PLATFORM_EXPORT WebGLImageConversion final { @@ -221,7 +224,7 @@ DataFormat source_format, unsigned source_image_width, unsigned source_image_height, - const IntRect& source_image_sub_rectangle, + const gfx::Rect& source_image_sub_rectangle, int depth, unsigned source_unpack_alignment, int unpack_image_height, @@ -233,8 +236,8 @@ // upon success. static bool ExtractImageData(const void* image_data, DataFormat source_data_format, - const IntSize& image_data_size, - const IntRect& source_image_sub_rectangle, + const gfx::Size& image_data_size, + const gfx::Rect& source_image_sub_rectangle, int depth, int unpack_image_height, GLenum format, @@ -272,7 +275,7 @@ DataFormat source_data_format, unsigned source_data_width, unsigned source_data_height, - const IntRect& source_data_sub_rectangle, + const gfx::Rect& source_data_sub_rectangle, int depth, unsigned source_unpack_alignment, int unpack_image_height,
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc index 0e57d98..4f1d914 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.cc
@@ -151,7 +151,7 @@ unused_swap_buffers_.push_back(std::move(swap_buffer)); } -WGPUTexture WebGPUSwapBufferProvider::GetNewTexture(const IntSize& size) { +WGPUTexture WebGPUSwapBufferProvider::GetNewTexture(const gfx::Size& size) { DCHECK(!current_swap_buffer_); auto context_provider = GetContextProviderWeakPtr(); if (!context_provider) { @@ -164,7 +164,7 @@ // Create a new swap buffer. current_swap_buffer_ = NewOrRecycledSwapBuffer( context_provider->ContextProvider()->SharedImageInterface(), - context_provider, ToGfxSize(size)); + context_provider, size); // Ensure the shared image is allocated and not in use service-side before // working with it
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h index 25ee8c0..675882a 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider.h
@@ -46,7 +46,7 @@ cc::Layer* CcLayer(); void SetFilterQuality(cc::PaintFlags::FilterQuality); void Neuter(); - WGPUTexture GetNewTexture(const IntSize& size); + WGPUTexture GetNewTexture(const gfx::Size& size); struct WebGPUMailboxTextureAndSize { scoped_refptr<WebGPUMailboxTexture> mailbox_texture;
diff --git a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc index 0d128d92..28e0297b 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/webgpu_swap_buffer_provider_test.cc
@@ -84,7 +84,7 @@ client_(client) {} ~WebGPUSwapBufferProviderForTests() override { *alive_ = false; } - WGPUTexture GetNewTexture(const IntSize& size) { + WGPUTexture GetNewTexture(const gfx::Size& size) { client_->texture = WebGPUSwapBufferProvider::GetNewTexture(size); return client_->texture; } @@ -130,7 +130,7 @@ TEST_F(WebGPUSwapBufferProviderTest, VerifyDestructionCompleteAfterAllResourceReleased) { - const IntSize kSize(10, 10); + const gfx::Size kSize(10, 10); viz::TransferableResource resource1; gpu::webgpu::ReservedTexture reservation1 = { @@ -191,7 +191,7 @@ // Produce one resource of size kSize. EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE(provider_->PrepareTransferableResource(nullptr, &resource, &release_callback)); EXPECT_EQ(kSize, resource.size); @@ -200,7 +200,7 @@ // Produce one resource of size kOtherSize. EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kOtherSize)); + provider_->GetNewTexture(kOtherSize); EXPECT_TRUE(provider_->PrepareTransferableResource(nullptr, &resource, &release_callback)); EXPECT_EQ(kOtherSize, resource.size); @@ -209,7 +209,7 @@ // Produce one resource of size kSize again. EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE(provider_->PrepareTransferableResource(nullptr, &resource, &release_callback)); EXPECT_EQ(kSize, resource.size); @@ -228,7 +228,7 @@ // the shared image EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_EQ(sii_->MostRecentGeneratedToken(), webgpu_->most_recent_waited_token); @@ -266,7 +266,7 @@ viz::ReleaseCallback release_callback_0; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -277,7 +277,7 @@ viz::ReleaseCallback release_callback_1; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -288,7 +288,7 @@ viz::ReleaseCallback release_callback_2; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -304,7 +304,7 @@ // Produce two swap buffers EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(static_cast<IntSize>(kSize)); + provider_->GetNewTexture(kSize); EXPECT_FALSE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -314,7 +314,7 @@ EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(static_cast<IntSize>(kSize)); + provider_->GetNewTexture(kSize); EXPECT_FALSE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -339,7 +339,7 @@ viz::ReleaseCallback release_callback_1; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -350,7 +350,7 @@ viz::ReleaseCallback release_callback_2; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kSize)); + provider_->GetNewTexture(kSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -363,12 +363,12 @@ std::move(release_callback_2).Run(gpu::SyncToken(), false /* lostResource */); // Create swap buffers again with different size. - const IntSize kOtherSize(20, 20); + const gfx::Size kOtherSize(20, 20); viz::ReleaseCallback release_callback_3; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kOtherSize)); + provider_->GetNewTexture(kOtherSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -379,7 +379,7 @@ viz::ReleaseCallback release_callback_4; EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(kOtherSize)); + provider_->GetNewTexture(kOtherSize); EXPECT_TRUE( shared_images.insert(provider_->GetCurrentMailboxForTesting()).second); @@ -399,7 +399,7 @@ EXPECT_CALL(*webgpu_, ReserveTexture(fake_device_)) .WillOnce(Return(reservation)); - provider_->GetNewTexture(IntSize(10, 10)); + provider_->GetNewTexture(gfx::Size(10, 10)); dawn_control_client_->Destroy();
diff --git a/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc b/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc index 20663d6..35132cc7 100644 --- a/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc
@@ -25,23 +25,23 @@ #include "third_party/blink/renderer/platform/graphics/gradient_generated_image.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { void GradientGeneratedImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { - SkRect visible_src_rect = src_rect; + SkRect visible_src_rect = gfx::RectFToSkRect(src_rect); if (!visible_src_rect.intersect( SkRect::MakeWH(size_.width(), size_.height()))) return; - const SkMatrix transform = SkMatrix::RectToRect(src_rect, dest_rect); + const SkMatrix transform = SkMatrix::RectToRect( + gfx::RectFToSkRect(src_rect), gfx::RectFToSkRect(dest_rect)); SkRect visible_dest_rect; transform.mapRect(&visible_dest_rect, visible_src_rect); @@ -51,20 +51,21 @@ } void GradientGeneratedImage::DrawTile(GraphicsContext& context, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { // TODO(ccameron): This function should not ignore |context|'s color behavior. // https://crbug.com/672306 PaintFlags gradient_flags(context.FillFlags()); gradient_->ApplyToFlags(gradient_flags, SkMatrix::I(), draw_options); - context.DrawRect(src_rect, gradient_flags, AutoDarkMode::Disabled()); + context.DrawRect(gfx::RectFToSkRect(src_rect), gradient_flags, + AutoDarkMode::Disabled()); } bool GradientGeneratedImage::ApplyShader(PaintFlags& flags, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { DCHECK(gradient_); gradient_->ApplyToFlags(flags, local_matrix, draw_options);
diff --git a/third_party/blink/renderer/platform/graphics/gradient_generated_image.h b/third_party/blink/renderer/platform/graphics/gradient_generated_image.h index ebb0e32..445607e 100644 --- a/third_party/blink/renderer/platform/graphics/gradient_generated_image.h +++ b/third_party/blink/renderer/platform/graphics/gradient_generated_image.h
@@ -36,7 +36,7 @@ public: static scoped_refptr<GradientGeneratedImage> Create( scoped_refptr<Gradient> generator, - const FloatSize& size) { + const gfx::SizeF& size) { return base::AdoptRef( new GradientGeneratedImage(std::move(generator), size)); } @@ -45,22 +45,22 @@ bool ApplyShader(PaintFlags&, const SkMatrix&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; protected: void Draw(cc::PaintCanvas*, const PaintFlags&, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; void DrawTile(GraphicsContext&, - const FloatRect&, + const gfx::RectF&, const ImageDrawOptions& draw_options) override; GradientGeneratedImage(scoped_refptr<Gradient> generator, - const FloatSize& size) + const gfx::SizeF& size) : GeneratedImage(size), gradient_(std::move(generator)) {} scoped_refptr<Gradient> gradient_;
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.cc b/third_party/blink/renderer/platform/graphics/graphics_context.cc index 7f937f74..68cc2fd 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context.cc
@@ -60,6 +60,7 @@ #include "third_party/skia/include/pathops/SkPathOps.h" #include "third_party/skia/include/utils/SkNullCanvas.h" #include "ui/base/ui_base_features.h" +#include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/skia_conversions.h" // To avoid conflicts with the DrawText macro from the Windows SDK... @@ -264,7 +265,7 @@ void GraphicsContext::BeginLayer(float opacity, SkBlendMode xfermode, - const FloatRect* bounds, + const gfx::RectF* bounds, ColorFilter color_filter, sk_sp<PaintFilter> image_filter) { PaintFlags layer_flags; @@ -274,7 +275,7 @@ layer_flags.setImageFilter(std::move(image_filter)); if (bounds) { - SkRect sk_bounds = *bounds; + SkRect sk_bounds = gfx::RectFToSkRect(*bounds); SaveLayer(&sk_bounds, &layer_flags); } else { SaveLayer(nullptr, &layer_flags); @@ -293,9 +294,9 @@ #endif } -void GraphicsContext::BeginRecording(const FloatRect& bounds) { +void GraphicsContext::BeginRecording(const gfx::RectF& bounds) { DCHECK(!canvas_); - canvas_ = paint_recorder_.beginRecording(bounds); + canvas_ = paint_recorder_.beginRecording(gfx::RectFToSkRect(bounds)); if (printing_metafile_) canvas_->SetPrintingMetafile(printing_metafile_); if (paint_preview_tracker_) @@ -318,8 +319,8 @@ } void GraphicsContext::CompositeRecord(sk_sp<PaintRecord> record, - const FloatRect& dest, - const FloatRect& src, + const gfx::RectF& dest, + const gfx::RectF& src, SkBlendMode op) { if (!record) return; @@ -331,14 +332,14 @@ SkSamplingOptions sampling(cc::PaintFlags::FilterQualityToSkSamplingOptions( static_cast<cc::PaintFlags::FilterQuality>(ImageInterpolationQuality()))); canvas_->save(); - canvas_->concat(SkMatrix::RectToRect(src, dest)); - canvas_->drawImage( - PaintImageBuilder::WithDefault() - .set_paint_record(record, ToGfxRect(RoundedIntRect(src)), - PaintImage::GetNextContentId()) - .set_id(PaintImage::GetNextId()) - .TakePaintImage(), - 0, 0, sampling, &flags); + canvas_->concat( + SkMatrix::RectToRect(gfx::RectFToSkRect(src), gfx::RectFToSkRect(dest))); + canvas_->drawImage(PaintImageBuilder::WithDefault() + .set_paint_record(record, gfx::ToRoundedRect(src), + PaintImage::GetNextContentId()) + .set_id(PaintImage::GetNextId()) + .TakePaintImage(), + 0, 0, sampling, &flags); canvas_->restore(); } @@ -549,12 +550,12 @@ } // Draws a filled rectangle with a stroked border. -void GraphicsContext::DrawRect(const IntRect& rect, +void GraphicsContext::DrawRect(const gfx::Rect& rect, const AutoDarkMode& auto_dark_mode) { if (rect.IsEmpty()) return; - SkRect sk_rect = rect; + SkRect sk_rect = gfx::RectToSkRect(rect); if (ImmutableState()->FillColor().Alpha()) DrawRect(sk_rect, ImmutableState()->FillFlags(), auto_dark_mode); @@ -737,14 +738,14 @@ Image* image, Image::ImageDecodingMode decode_mode, const AutoDarkMode& auto_dark_mode, - const FloatRect& dest, - const FloatRect* src_ptr, + const gfx::RectF& dest, + const gfx::RectF* src_ptr, SkBlendMode op, RespectImageOrientationEnum should_respect_image_orientation) { if (!image) return; - const FloatRect src = src_ptr ? *src_ptr : FloatRect(image->Rect()); + const gfx::RectF src = src_ptr ? *src_ptr : gfx::RectF(image->Rect()); PaintFlags image_flags = ImmutableState()->FillFlags(); image_flags.setBlendMode(op); @@ -765,27 +766,27 @@ Image::ImageDecodingMode decode_mode, const AutoDarkMode& auto_dark_mode, const FloatRoundedRect& dest, - const FloatRect& src_rect, + const gfx::RectF& src_rect, SkBlendMode op, RespectImageOrientationEnum respect_orientation) { if (!image) return; if (!dest.IsRounded()) { - DrawImage(image, decode_mode, auto_dark_mode, FloatRect(dest.Rect()), - &src_rect, op, respect_orientation); + DrawImage(image, decode_mode, auto_dark_mode, dest.Rect(), &src_rect, op, + respect_orientation); return; } DCHECK(dest.IsRenderable()); - const FloatRect visible_src = - IntersectRects(src_rect, FloatRect(image->Rect())); + const gfx::RectF visible_src = + IntersectRects(src_rect, gfx::RectF(image->Rect())); if (dest.IsEmpty() || visible_src.IsEmpty()) return; SkSamplingOptions sampling = - ComputeSamplingOptions(image, FloatRect(dest.Rect()), src_rect); + ComputeSamplingOptions(image, dest.Rect(), src_rect); PaintFlags image_flags = ImmutableState()->FillFlags(); image_flags.setBlendMode(op); image_flags.setColor(SK_ColorBLACK); @@ -799,11 +800,10 @@ (respect_orientation == kDoNotRespectImageOrientation || image->HasDefaultOrientation()); if (use_shader) { - const SkMatrix local_matrix = - SkMatrix::RectToRect(visible_src, FloatRect(dest.Rect())); - use_shader = - image->ApplyShader(image_flags, local_matrix, FloatRect(dest.Rect()), - src_rect, draw_options); + const SkMatrix local_matrix = SkMatrix::RectToRect( + gfx::RectFToSkRect(visible_src), gfx::RectFToSkRect(dest.Rect())); + use_shader = image->ApplyShader(image_flags, local_matrix, dest.Rect(), + src_rect, draw_options); } if (use_shader) { @@ -811,15 +811,14 @@ // Should be replaced with explicit sampling parameter passed to // ApplyShader() image_flags.setFilterQuality( - ComputeFilterQuality(image, FloatRect(dest.Rect()), src_rect)); + ComputeFilterQuality(image, dest.Rect(), src_rect)); // Shader-based fast path. canvas_->drawRRect(SkRRect(dest), image_flags); } else { // Clip-based fallback. PaintCanvasAutoRestore auto_restore(canvas_, true); canvas_->clipRRect(SkRRect(dest), image_flags.isAntiAlias()); - image->Draw(canvas_, image_flags, FloatRect(dest.Rect()), src_rect, - draw_options); + image->Draw(canvas_, image_flags, dest.Rect(), src_rect, draw_options); } paint_controller_.SetImagePainted(); @@ -827,8 +826,8 @@ cc::PaintFlags::FilterQuality GraphicsContext::ComputeFilterQuality( Image* image, - const FloatRect& dest, - const FloatRect& src) const { + const gfx::RectF& dest, + const gfx::RectF& src) const { InterpolationQuality resampling; if (printing_) { resampling = kInterpolationNone; @@ -853,7 +852,7 @@ void GraphicsContext::DrawImageTiled( Image* image, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const AutoDarkMode& auto_dark_mode, SkBlendMode op, @@ -910,24 +909,25 @@ auto_dark_mode); } -void GraphicsContext::FillRect(const IntRect& rect, +void GraphicsContext::FillRect(const gfx::Rect& rect, const AutoDarkMode& auto_dark_mode) { - FillRect(FloatRect(rect), auto_dark_mode); + FillRect(gfx::RectF(rect), auto_dark_mode); } -void GraphicsContext::FillRect(const IntRect& rect, +void GraphicsContext::FillRect(const gfx::Rect& rect, const Color& color, const AutoDarkMode& auto_dark_mode, SkBlendMode xfer_mode) { - FillRect(FloatRect(rect), color, auto_dark_mode, xfer_mode); + FillRect(gfx::RectF(rect), color, auto_dark_mode, xfer_mode); } -void GraphicsContext::FillRect(const FloatRect& rect, +void GraphicsContext::FillRect(const gfx::RectF& rect, const AutoDarkMode& auto_dark_mode) { - DrawRect(rect, ImmutableState()->FillFlags(), auto_dark_mode); + DrawRect(gfx::RectFToSkRect(rect), ImmutableState()->FillFlags(), + auto_dark_mode); } -void GraphicsContext::FillRect(const FloatRect& rect, +void GraphicsContext::FillRect(const gfx::RectF& rect, const Color& color, const AutoDarkMode& auto_dark_mode, SkBlendMode xfer_mode) { @@ -935,14 +935,14 @@ flags.setColor(color.Rgb()); flags.setBlendMode(xfer_mode); - DrawRect(rect, flags, auto_dark_mode); + DrawRect(gfx::RectFToSkRect(rect), flags, auto_dark_mode); } void GraphicsContext::FillRoundedRect(const FloatRoundedRect& rrect, const Color& color, const AutoDarkMode& auto_dark_mode) { if (!rrect.IsRounded() || !rrect.IsRenderable()) { - FillRect(FloatRect(rrect.Rect()), color, auto_dark_mode); + FillRect(rrect.Rect(), color, auto_dark_mode); return; } @@ -1036,19 +1036,21 @@ } void GraphicsContext::FillRectWithRoundedHole( - const FloatRect& rect, + const gfx::RectF& rect, const FloatRoundedRect& rounded_hole_rect, const Color& color, const AutoDarkMode& auto_dark_mode) { PaintFlags flags(ImmutableState()->FillFlags()); flags.setColor(color.Rgb()); - canvas_->drawDRRect(SkRRect::MakeRect(rect), SkRRect(rounded_hole_rect), + canvas_->drawDRRect(SkRRect::MakeRect(gfx::RectFToSkRect(rect)), + SkRRect(rounded_hole_rect), DarkModeFlags(this, auto_dark_mode, flags)); } -void GraphicsContext::FillEllipse(const FloatRect& ellipse, +void GraphicsContext::FillEllipse(const gfx::RectF& ellipse, const AutoDarkMode& auto_dark_mode) { - DrawOval(ellipse, ImmutableState()->FillFlags(), auto_dark_mode); + DrawOval(gfx::RectFToSkRect(ellipse), ImmutableState()->FillFlags(), + auto_dark_mode); } void GraphicsContext::StrokePath(const Path& path_to_stroke, @@ -1063,7 +1065,7 @@ auto_dark_mode); } -void GraphicsContext::StrokeRect(const FloatRect& rect, +void GraphicsContext::StrokeRect(const gfx::RectF& rect, float line_width, const AutoDarkMode& auto_dark_mode) { PaintFlags flags(ImmutableState()->StrokeFlags()); @@ -1073,7 +1075,7 @@ // strokerect has special rules for CSS when the rect is degenerate: // if width==0 && height==0, do nothing // if width==0 || height==0, then just draw line for the other dimension - SkRect r(rect); + SkRect r = gfx::RectFToSkRect(rect); bool valid_w = r.width() > 0; bool valid_h = r.height() > 0; if (valid_w && valid_h) { @@ -1089,16 +1091,17 @@ } } -void GraphicsContext::StrokeEllipse(const FloatRect& ellipse, +void GraphicsContext::StrokeEllipse(const gfx::RectF& ellipse, const AutoDarkMode& auto_dark_mode) { - DrawOval(ellipse, ImmutableState()->StrokeFlags(), auto_dark_mode); + DrawOval(gfx::RectFToSkRect(ellipse), ImmutableState()->StrokeFlags(), + auto_dark_mode); } void GraphicsContext::ClipRoundedRect(const FloatRoundedRect& rrect, SkClipOp clip_op, AntiAliasingMode should_antialias) { if (!rrect.IsRounded()) { - ClipRect(FloatRect(rrect.Rect()), should_antialias, clip_op); + ClipRect(gfx::RectFToSkRect(rrect.Rect()), should_antialias, clip_op); return; } @@ -1160,21 +1163,21 @@ } void GraphicsContext::SetURLForRect(const KURL& link, - const IntRect& dest_rect) { + const gfx::Rect& dest_rect) { DCHECK(canvas_); sk_sp<SkData> url(SkData::MakeWithCString(link.GetString().Utf8().c_str())); - canvas_->Annotate(cc::PaintCanvas::AnnotationType::URL, dest_rect, - std::move(url)); + canvas_->Annotate(cc::PaintCanvas::AnnotationType::URL, + gfx::RectToSkRect(dest_rect), std::move(url)); } void GraphicsContext::SetURLFragmentForRect(const String& dest_name, - const IntRect& rect) { + const gfx::Rect& rect) { DCHECK(canvas_); sk_sp<SkData> sk_dest_name(SkData::MakeWithCString(dest_name.Utf8().c_str())); - canvas_->Annotate(cc::PaintCanvas::AnnotationType::LINK_TO_DESTINATION, rect, - std::move(sk_dest_name)); + canvas_->Annotate(cc::PaintCanvas::AnnotationType::LINK_TO_DESTINATION, + gfx::RectToSkRect(rect), std::move(sk_dest_name)); } void GraphicsContext::SetURLDestinationLocation(const String& name,
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.h b/third_party/blink/renderer/platform/graphics/graphics_context.h index ad294420d..be6cb7e 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.h +++ b/third_party/blink/renderer/platform/graphics/graphics_context.h
@@ -49,6 +49,9 @@ #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/skia/include/core/SkClipOp.h" #include "third_party/skia/include/core/SkRefCnt.h" +#include "ui/gfx/geometry/rect_f.h" +#include "ui/gfx/geometry/skia_conversions.h" +#include "ui/gfx/geometry/vector2d_f.h" class SkPath; class SkRRect; @@ -60,7 +63,6 @@ namespace blink { -class FloatRect; class FloatRoundedRect; class KURL; class PaintController; @@ -71,17 +73,17 @@ struct ImageTilingInfo { // The part of the Image (the |image| argument to the method) to tile. It's in // the space of the image. - FloatRect image_rect; + gfx::RectF image_rect; // Scale factor from image space to destination space. Will include // image-resolution information. - FloatSize scale{1.0f, 1.0f}; + gfx::Vector2dF scale{1.0f, 1.0f}; // Origin of the full image in destination space. gfx::PointF phase; // Additional spacing between tiles in destination space. - FloatSize spacing; + gfx::SizeF spacing; }; struct ImageDrawOptions { @@ -233,7 +235,7 @@ // DrawRect() fills and always strokes using a 1-pixel stroke inset from // the rect borders (of the pre-set stroke color). - void DrawRect(const IntRect&, const AutoDarkMode& auto_dark_mode); + void DrawRect(const gfx::Rect&, const AutoDarkMode& auto_dark_mode); // DrawLine() only operates on horizontal or vertical lines and uses the // current stroke settings. For dotted or dashed stroke, the line need to be @@ -258,16 +260,16 @@ const int length = 0, const int dash_thickness = 0); - void FillEllipse(const FloatRect&, const AutoDarkMode& auto_dark_mode); - void StrokeEllipse(const FloatRect&, const AutoDarkMode& auto_dark_mode); + void FillEllipse(const gfx::RectF&, const AutoDarkMode& auto_dark_mode); + void StrokeEllipse(const gfx::RectF&, const AutoDarkMode& auto_dark_mode); - void FillRect(const IntRect&, const AutoDarkMode& auto_dark_mode); - void FillRect(const IntRect&, + void FillRect(const gfx::Rect&, const AutoDarkMode& auto_dark_mode); + void FillRect(const gfx::Rect&, const Color&, const AutoDarkMode& auto_dark_mode, SkBlendMode = SkBlendMode::kSrcOver); - void FillRect(const FloatRect&, const AutoDarkMode& auto_dark_mode); - void FillRect(const FloatRect&, + void FillRect(const gfx::RectF&, const AutoDarkMode& auto_dark_mode); + void FillRect(const gfx::RectF&, const Color&, const AutoDarkMode& auto_dark_mode, SkBlendMode = SkBlendMode::kSrcOver); @@ -278,37 +280,37 @@ const FloatRoundedRect&, const Color&, const AutoDarkMode& auto_dark_mode); - void FillRectWithRoundedHole(const FloatRect&, + void FillRectWithRoundedHole(const gfx::RectF&, const FloatRoundedRect& rounded_hole_rect, const Color&, const AutoDarkMode& auto_dark_mode); - void StrokeRect(const FloatRect&, + void StrokeRect(const gfx::RectF&, float line_width, const AutoDarkMode& auto_dark_mode); void DrawRecord(sk_sp<const PaintRecord>); void CompositeRecord(sk_sp<PaintRecord>, - const FloatRect& dest, - const FloatRect& src, + const gfx::RectF& dest, + const gfx::RectF& src, SkBlendMode); void DrawImage(Image*, Image::ImageDecodingMode, const AutoDarkMode& auto_dark_mode, - const FloatRect& dest_rect, - const FloatRect* src_rect = nullptr, + const gfx::RectF& dest_rect, + const gfx::RectF* src_rect = nullptr, SkBlendMode = SkBlendMode::kSrcOver, RespectImageOrientationEnum = kRespectImageOrientation); void DrawImageRRect(Image*, Image::ImageDecodingMode, const AutoDarkMode& auto_dark_mode, const FloatRoundedRect& dest, - const FloatRect& src_rect, + const gfx::RectF& src_rect, SkBlendMode = SkBlendMode::kSrcOver, RespectImageOrientationEnum = kRespectImageOrientation); void DrawImageTiled(Image* image, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const AutoDarkMode& auto_dark_mode, SkBlendMode = SkBlendMode::kSrcOver, @@ -330,16 +332,16 @@ const PaintFlags&, const AutoDarkMode& auto_dark_mode); - void Clip(const IntRect& rect) { ClipRect(rect); } - void Clip(const FloatRect& rect) { ClipRect(rect); } + void Clip(const gfx::Rect& rect) { ClipRect(gfx::RectToSkRect(rect)); } + void Clip(const gfx::RectF& rect) { ClipRect(gfx::RectFToSkRect(rect)); } void ClipRoundedRect(const FloatRoundedRect&, SkClipOp = SkClipOp::kIntersect, AntiAliasingMode = kAntiAliased); - void ClipOut(const IntRect& rect) { - ClipRect(rect, kNotAntiAliased, SkClipOp::kDifference); + void ClipOut(const gfx::Rect& rect) { + ClipRect(gfx::RectToSkRect(rect), kNotAntiAliased, SkClipOp::kDifference); } - void ClipOut(const FloatRect& rect) { - ClipRect(rect, kNotAntiAliased, SkClipOp::kDifference); + void ClipOut(const gfx::RectF& rect) { + ClipRect(gfx::RectFToSkRect(rect), kNotAntiAliased, SkClipOp::kDifference); } void ClipOut(const Path&); void ClipOutRoundedRect(const FloatRoundedRect&); @@ -415,7 +417,7 @@ // (i.e. endLayer()). void BeginLayer(float opacity = 1.0f, SkBlendMode = SkBlendMode::kSrcOver, - const FloatRect* = nullptr, + const gfx::RectF* = nullptr, ColorFilter = kColorFilterNone, sk_sp<PaintFilter> = nullptr); void EndLayer(); @@ -423,7 +425,7 @@ // Instead of being dispatched to the active canvas, draw commands following // beginRecording() are stored in a display list that can be replayed at a // later time. Pass in the bounding rectangle for the content in the list. - void BeginRecording(const FloatRect&); + void BeginRecording(const gfx::RectF&); // Returns a record with any recorded draw commands since the prerequisite // call to beginRecording(). The record is guaranteed to be non-null (but @@ -461,24 +463,24 @@ // ---------- End transformation methods ----------------- PaintFlags::FilterQuality ComputeFilterQuality(Image*, - const FloatRect& dest, - const FloatRect& src) const; + const gfx::RectF& dest, + const gfx::RectF& src) const; SkSamplingOptions ComputeSamplingOptions(Image* image, - const FloatRect& dest, - const FloatRect& src) const { + const gfx::RectF& dest, + const gfx::RectF& src) const { return PaintFlags::FilterQualityToSkSamplingOptions( ComputeFilterQuality(image, dest, src)); } // Sets target URL of a clickable area. - void SetURLForRect(const KURL&, const IntRect&); + void SetURLForRect(const KURL&, const gfx::Rect&); // Sets the destination of a clickable area of a URL fragment (in a URL // pointing to the same web page). When the area is clicked, the page should // be scrolled to the location set by setURLDestinationLocation() for the // destination whose name is |name|. - void SetURLFragmentForRect(const String& name, const IntRect&); + void SetURLFragmentForRect(const String& name, const gfx::Rect&); // Sets location of a URL destination (a.k.a. anchor) in the page. void SetURLDestinationLocation(const String& name, const gfx::Point&);
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context_test.cc b/third_party/blink/renderer/platform/graphics/graphics_context_test.cc index f624aa6..671c724 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context_test.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context_test.cc
@@ -83,23 +83,23 @@ GraphicsContext context(*paint_controller); Color opaque(1.0f, 0.0f, 0.0f, 1.0f); - FloatRect bounds(0, 0, 100, 100); + gfx::RectF bounds(0, 0, 100, 100); context.BeginRecording(bounds); - context.FillRect(FloatRect(0, 0, 50, 50), opaque, AutoDarkModeDisabled(), + context.FillRect(gfx::RectF(0, 0, 50, 50), opaque, AutoDarkModeDisabled(), SkBlendMode::kSrcOver); canvas.drawPicture(context.EndRecording()); - EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(0, 0, 50, 50)) + EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, gfx::Rect(0, 0, 50, 50)) context.BeginRecording(bounds); - context.FillRect(FloatRect(0, 0, 100, 100), opaque, AutoDarkModeDisabled(), + context.FillRect(gfx::RectF(0, 0, 100, 100), opaque, AutoDarkModeDisabled(), SkBlendMode::kSrcOver); // Make sure the opaque region was unaffected by the rect drawn during // recording. - EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(0, 0, 50, 50)) + EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, gfx::Rect(0, 0, 50, 50)) canvas.drawPicture(context.EndRecording()); - EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(0, 0, 100, 100)) + EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, gfx::Rect(0, 0, 100, 100)) } TEST(GraphicsContextTest, UnboundedDrawsAreClipped) { @@ -110,7 +110,7 @@ Color opaque(1.0f, 0.0f, 0.0f, 1.0f); Color transparent(0.0f, 0.0f, 0.0f, 0.0f); - FloatRect bounds(0, 0, 100, 100); + gfx::RectF bounds(0, 0, 100, 100); auto paint_controller = std::make_unique<PaintController>(); GraphicsContext context(*paint_controller); @@ -129,14 +129,14 @@ context.SetLineDash(dash_array, 0); // Make the device opaque in 10,10 40x40. - context.FillRect(FloatRect(10, 10, 40, 40), opaque, AutoDarkModeDisabled(), + context.FillRect(gfx::RectF(10, 10, 40, 40), opaque, AutoDarkModeDisabled(), SkBlendMode::kSrcOver); canvas.drawPicture(context.EndRecording()); - EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(10, 10, 40, 40)); + EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, gfx::Rect(10, 10, 40, 40)); context.BeginRecording(bounds); // Clip to the left edge of the opaque area. - context.Clip(IntRect(10, 10, 10, 40)); + context.Clip(gfx::Rect(10, 10, 10, 40)); // Draw a path that gets clipped. This should destroy the opaque area, but // only inside the clip. @@ -149,7 +149,7 @@ context.DrawPath(path.GetSkPath(), flags, AutoDarkModeDisabled()); canvas.drawPicture(context.EndRecording()); - EXPECT_OPAQUE_PIXELS_IN_RECT(bitmap, IntRect(20, 10, 30, 40)); + EXPECT_OPAQUE_PIXELS_IN_RECT(bitmap, gfx::Rect(20, 10, 30, 40)); } class GraphicsContextDarkModeTest : public testing::Test { @@ -166,17 +166,17 @@ GraphicsContext context(*paint_controller_); if (is_dark_mode_on) context.UpdateDarkModeSettingsForTest(settings); - context.BeginRecording(FloatRect(0, 0, 4, 1)); - context.FillRect(FloatRect(0, 0, 1, 1), Color(SK_ColorBLACK), + context.BeginRecording(gfx::RectF(0, 0, 4, 1)); + context.FillRect(gfx::RectF(0, 0, 1, 1), Color(SK_ColorBLACK), AutoDarkMode(DarkModeFilter::ElementRole::kBackground, is_dark_mode_on)); - context.FillRect(FloatRect(1, 0, 1, 1), Color(SK_ColorWHITE), + context.FillRect(gfx::RectF(1, 0, 1, 1), Color(SK_ColorWHITE), AutoDarkMode(DarkModeFilter::ElementRole::kBackground, is_dark_mode_on)); - context.FillRect(FloatRect(2, 0, 1, 1), Color(SK_ColorRED), + context.FillRect(gfx::RectF(2, 0, 1, 1), Color(SK_ColorRED), AutoDarkMode(DarkModeFilter::ElementRole::kBackground, is_dark_mode_on)); - context.FillRect(FloatRect(3, 0, 1, 1), Color(SK_ColorGRAY), + context.FillRect(gfx::RectF(3, 0, 1, 1), Color(SK_ColorGRAY), AutoDarkMode(DarkModeFilter::ElementRole::kBackground, is_dark_mode_on)); // Capture the result in the bitmap.
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc index aa7ba490..fd31e38 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -265,7 +265,7 @@ client_->GraphicsLayersDidChange(); } -void GraphicsLayer::SetOffsetFromLayoutObject(const IntSize& offset) { +void GraphicsLayer::SetOffsetFromLayoutObject(const gfx::Vector2d& offset) { if (offset == offset_from_layout_object_) return; @@ -324,7 +324,7 @@ return repainted; } -void GraphicsLayer::PaintForTesting(const IntRect& interest_rect, +void GraphicsLayer::PaintForTesting(const gfx::Rect& interest_rect, bool record_debug_info) { HeapVector<PreCompositedLayerInfo> pre_composited_layers; PaintController::CycleScope cycle_scope(record_debug_info); @@ -336,7 +336,7 @@ HeapVector<PreCompositedLayerInfo>& pre_composited_layers, PaintBenchmarkMode benchmark_mode, PaintController::CycleScope* cycle_scope, - const IntRect* interest_rect) { + const gfx::Rect* interest_rect) { repainted_ = false; DCHECK(!client_->ShouldSkipPaintingSubtree()); @@ -361,7 +361,7 @@ #endif DCHECK(layer_state_) << "No layer state for GraphicsLayer: " << DebugName(); - IntRect new_interest_rect; + gfx::Rect new_interest_rect; if (!RuntimeEnabledFeatures::CullRectUpdateEnabled()) { new_interest_rect = interest_rect ? *interest_rect : client_->ComputeInterestRect( @@ -494,8 +494,7 @@ if (!contents_layer_) return; - IntSize contents_size = contents_rect_.size(); - contents_layer_->SetBounds(ToGfxSize(contents_size)); + contents_layer_->SetBounds(contents_rect_.size()); } void GraphicsLayer::SetContentsToCcLayer( @@ -563,7 +562,7 @@ } void GraphicsLayer::TrackRasterInvalidation(const DisplayItemClient& client, - const IntRect& rect, + const gfx::Rect& rect, PaintInvalidationReason reason) { if (RasterInvalidationTracking::ShouldAlwaysTrack()) EnsureRasterInvalidator().EnsureTracking(); @@ -572,8 +571,7 @@ // directly, e.g. from SetContentsNeedsDisplay(), etc. Other raster // invalidations are tracked in RasterInvalidator. if (auto* tracking = GetRasterInvalidationTracking()) { - tracking->AddInvalidation(client.Id(), client.DebugName(), ToGfxRect(rect), - reason); + tracking->AddInvalidation(client.Id(), client.DebugName(), rect, reason); } } @@ -670,7 +668,7 @@ CcLayer().SetNeedsDisplayRect(rect); } -void GraphicsLayer::SetContentsRect(const IntRect& rect) { +void GraphicsLayer::SetContentsRect(const gfx::Rect& rect) { if (rect == contents_rect_) return; @@ -735,9 +733,9 @@ } gfx::Rect GraphicsLayer::PaintableRegion() const { - return ToGfxRect(RuntimeEnabledFeatures::CullRectUpdateEnabled() - ? client_->PaintableRegion(this) - : previous_interest_rect_); + return RuntimeEnabledFeatures::CullRectUpdateEnabled() + ? client_->PaintableRegion(this) + : previous_interest_rect_; } scoped_refptr<cc::DisplayItemList> GraphicsLayer::PaintContentsToDisplayList() {
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.h b/third_party/blink/renderer/platform/graphics/graphics_layer.h index a970a2e6..16ccd368 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.h +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.h
@@ -120,8 +120,10 @@ // The offset is the origin of the layoutObject minus the origin of the // graphics layer (so either zero or negative). - IntSize OffsetFromLayoutObject() const { return offset_from_layout_object_; } - void SetOffsetFromLayoutObject(const IntSize&); + gfx::Vector2d OffsetFromLayoutObject() const { + return offset_from_layout_object_; + } + void SetOffsetFromLayoutObject(const gfx::Vector2d&); // The size of the layer. const gfx::Size& Size() const; @@ -153,13 +155,13 @@ void InvalidateContents(); // Set that the position/size of the contents (image or video). - void SetContentsRect(const IntRect&); + void SetContentsRect(const gfx::Rect&); void SetContentsToCcLayer(scoped_refptr<cc::Layer> contents_layer); bool HasContentsLayer() const { return ContentsLayer(); } cc::Layer* ContentsLayer() const { return contents_layer_.get(); } - const IntRect& ContentsRect() const { return contents_rect_; } + const gfx::Rect& ContentsRect() const { return contents_rect_; } // For hosting this GraphicsLayer in a native layer hierarchy. cc::PictureLayer& CcLayer() const { return *layer_; } @@ -170,7 +172,7 @@ bool HasTrackedRasterInvalidations() const; RasterInvalidationTracking* GetRasterInvalidationTracking() const; void TrackRasterInvalidation(const DisplayItemClient&, - const IntRect&, + const gfx::Rect&, PaintInvalidationReason); // Returns true if any layer is repainted. @@ -218,7 +220,7 @@ needs_check_raster_invalidation_ = true; } - void PaintForTesting(const IntRect& interest_rect, bool record_debug_info); + void PaintForTesting(const gfx::Rect& interest_rect, bool record_debug_info); void SetShouldCreateLayersAfterPaint(bool); bool ShouldCreateLayersAfterPaint() const { @@ -248,7 +250,7 @@ void Paint(HeapVector<PreCompositedLayerInfo>&, PaintBenchmarkMode, PaintController::CycleScope*, - const IntRect* interest_rect = nullptr); + const gfx::Rect* interest_rect = nullptr); // Adds a child without calling NotifyChildListChange(), so that adding // children can be batched before updating. @@ -271,7 +273,7 @@ Member<GraphicsLayerClient> client_; // Offset from the owning layoutObject - IntSize offset_from_layout_object_; + gfx::Vector2d offset_from_layout_object_; TransformationMatrix transform_; @@ -292,7 +294,7 @@ HeapVector<Member<GraphicsLayer>> children_; Member<GraphicsLayer> parent_; - IntRect contents_rect_; + gfx::Rect contents_rect_; scoped_refptr<cc::PictureLayer> layer_; scoped_refptr<cc::Layer> contents_layer_; @@ -304,7 +306,7 @@ mutable std::unique_ptr<PaintController> paint_controller_; // Used only when CullRectUpdate is not enabled. - IntRect previous_interest_rect_; + gfx::Rect previous_interest_rect_; struct LayerState { // In theory, it's unnecessary to use RefCountedPropertyTreeState because
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer_client.h b/third_party/blink/renderer/platform/graphics/graphics_layer_client.h index 0af4f543..ca20056 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer_client.h +++ b/third_party/blink/renderer/platform/graphics/graphics_layer_client.h
@@ -32,11 +32,14 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +namespace gfx { +class Rect; +} + namespace blink { class GraphicsContext; class GraphicsLayer; -class IntRect; class ScrollableArea; class PaintArtifactCompositor; @@ -58,11 +61,11 @@ virtual ~GraphicsLayerClient() = default; // Used only when CullRectUpdate is not enabled. - virtual IntRect ComputeInterestRect( + virtual gfx::Rect ComputeInterestRect( const GraphicsLayer*, - const IntRect& previous_interest_rect) const = 0; + const gfx::Rect& previous_interest_rect) const = 0; // Used when CullRectUpdate is enabled. - virtual IntRect PaintableRegion(const GraphicsLayer*) const = 0; + virtual gfx::Rect PaintableRegion(const GraphicsLayer*) const = 0; virtual LayoutSize SubpixelAccumulation() const { return LayoutSize(); } // Returns whether the client needs to be repainted with respect to the given @@ -71,7 +74,7 @@ virtual void PaintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, - const IntRect& interest_rect) const = 0; + const gfx::Rect& interest_rect) const = 0; virtual bool ShouldSkipPaintingSubtree() const { return false; }
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer_tree_as_text.cc b/third_party/blink/renderer/platform/graphics/graphics_layer_tree_as_text.cc index acdfb73..cc7f3372 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer_tree_as_text.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer_tree_as_text.cc
@@ -30,9 +30,9 @@ } if (flags & kLayerTreeIncludesDebugInfo && - layer->OffsetFromLayoutObject() != IntSize()) { + !layer->OffsetFromLayoutObject().IsZero()) { json->SetArray("offsetFromLayoutObject", - SizeAsJSONArray(ToGfxSize(layer->OffsetFromLayoutObject()))); + VectorAsJSONArray(layer->OffsetFromLayoutObject())); } if (!layer->ContentsAreVisible())
diff --git a/third_party/blink/renderer/platform/graphics/image.cc b/third_party/blink/renderer/platform/graphics/image.cc index 4fd5aa8..50ab148c 100644 --- a/third_party/blink/renderer/platform/graphics/image.cc +++ b/third_party/blink/renderer/platform/graphics/image.cc
@@ -59,6 +59,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { @@ -114,18 +115,18 @@ PaintImage Image::ResizeAndOrientImage( const PaintImage& image, ImageOrientation orientation, - FloatSize image_scale, + gfx::Vector2dF image_scale, float opacity, InterpolationQuality interpolation_quality) { - IntSize size(image.width(), image.height()); - size.Scale(image_scale.width(), image_scale.height()); + gfx::Size size(image.width(), image.height()); + size = gfx::ScaleToFlooredSize(size, image_scale.x(), image_scale.y()); AffineTransform transform; if (orientation != ImageOrientationEnum::kDefault) { if (orientation.UsesWidthAsHeight()) - size = size.TransposedSize(); - transform *= orientation.TransformFromDefault(FloatSize(size)); + size.Transpose(); + transform *= orientation.TransformFromDefault(gfx::SizeF(size)); } - transform.ScaleNonUniform(image_scale.width(), image_scale.height()); + transform.ScaleNonUniform(image_scale.x(), image_scale.y()); if (size.IsEmpty()) return PaintImage(); @@ -184,12 +185,12 @@ const SkMatrix& shader_matrix, const SkSamplingOptions& sampling, bool should_antialias, - const FloatSize& spacing, + const gfx::SizeF& spacing, SkTileMode tmx, SkTileMode tmy, - const IntRect& subset_rect) { + const gfx::Rect& subset_rect) { if (spacing.IsZero() && - subset_rect == IntRect(0, 0, image.width(), image.height())) { + subset_rect == gfx::Rect(image.width(), image.height())) { return PaintShader::MakeImage(image, tmx, tmy, &shader_matrix); } @@ -204,7 +205,7 @@ PaintFlags flags; flags.setAntiAlias(should_antialias); canvas->drawImageRect( - image, subset_rect, + image, gfx::RectToSkRect(subset_rect), SkRect::MakeWH(subset_rect.width(), subset_rect.height()), sampling, &flags, SkCanvas::kStrict_SrcRectConstraint); @@ -221,7 +222,7 @@ void Image::DrawPattern(GraphicsContext& context, const cc::PaintFlags& base_flags, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options) { TRACE_EVENT0("skia", "Image::drawPattern"); @@ -242,11 +243,11 @@ // image-resolution information is baked into |tiling_info.scale|, // so we do not want to use it in computing the subset. That requires // explicitly applying orientation here. - IntRect subset_rect = EnclosingIntRect(tiling_info.image_rect); - IntSize oriented_image_size(image.width(), image.height()); + gfx::Rect subset_rect = gfx::ToEnclosingRect(tiling_info.image_rect); + gfx::Size oriented_image_size(image.width(), image.height()); if (orientation.UsesWidthAsHeight()) - oriented_image_size = oriented_image_size.TransposedSize(); - subset_rect.Intersect(IntRect(gfx::Point(), oriented_image_size)); + oriented_image_size.Transpose(); + subset_rect.Intersect(gfx::Rect(oriented_image_size)); if (subset_rect.IsEmpty()) return; // nothing to draw @@ -258,15 +259,16 @@ // origin of the destination rect, which is what Blink expects. Skia uses // the coordinate system origin as the base for the pattern. If Blink wants // a shifted image, it will shift it from there using the localMatrix. - FloatRect tile_rect(subset_rect); - tile_rect.Scale(tiling_info.scale.width(), tiling_info.scale.height()); - tile_rect.MoveBy(tiling_info.phase); - tile_rect.Expand(tiling_info.spacing); + gfx::RectF tile_rect(subset_rect); + tile_rect.Scale(tiling_info.scale.x(), tiling_info.scale.y()); + tile_rect.Offset(tiling_info.phase.OffsetFromOrigin()); + tile_rect.Outset(0, 0, tiling_info.spacing.width(), + tiling_info.spacing.height()); SkMatrix local_matrix; local_matrix.setTranslate(tile_rect.x(), tile_rect.y()); // Apply the scale to have the subset correctly fill the destination. - local_matrix.preScale(tiling_info.scale.width(), tiling_info.scale.height()); + local_matrix.preScale(tiling_info.scale.x(), tiling_info.scale.y()); const auto tmx = ComputeTileMode(dest_rect.x(), dest_rect.right(), tile_rect.x(), tile_rect.right()); @@ -277,11 +279,11 @@ auto image_id = image.stable_id(); SkSamplingOptions sampling_to_use = - context.ComputeSamplingOptions(this, dest_rect, FloatRect(subset_rect)); + context.ComputeSamplingOptions(this, dest_rect, gfx::RectF(subset_rect)); sk_sp<PaintShader> tile_shader = CreatePatternShader( image, local_matrix, sampling_to_use, context.ShouldAntialias(), - FloatSize(tiling_info.spacing.width() / tiling_info.scale.width(), - tiling_info.spacing.height() / tiling_info.scale.height()), + gfx::SizeF(tiling_info.spacing.width() / tiling_info.scale.x(), + tiling_info.spacing.height() / tiling_info.scale.y()), tmx, tmy, subset_rect); // If the shader could not be instantiated (e.g. non-invertible matrix), @@ -292,11 +294,13 @@ flags.setShader(std::move(tile_shader)); if (draw_options.apply_dark_mode) { DarkModeFilter* dark_mode_filter = draw_options.dark_mode_filter; - DarkModeFilterHelper::ApplyToImageIfNeeded( - *dark_mode_filter, this, &flags, FloatRect(subset_rect), dest_rect); + DarkModeFilterHelper::ApplyToImageIfNeeded(*dark_mode_filter, this, &flags, + gfx::RectToSkRect(subset_rect), + gfx::RectFToSkRect(dest_rect)); } - context.DrawRect(dest_rect, flags, AutoDarkMode::Disabled()); + context.DrawRect(gfx::RectFToSkRect(dest_rect), flags, + AutoDarkMode::Disabled()); StartAnimation(); @@ -328,8 +332,8 @@ bool Image::ApplyShader(PaintFlags& flags, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { // Default shader impl: attempt to build a shader based on the current frame // SkImage. @@ -340,7 +344,8 @@ if (draw_options.apply_dark_mode) { DarkModeFilter* dark_mode_filter = draw_options.dark_mode_filter; DarkModeFilterHelper::ApplyToImageIfNeeded(*dark_mode_filter, this, &flags, - src_rect, dst_rect); + gfx::RectFToSkRect(src_rect), + gfx::RectFToSkRect(dst_rect)); } flags.setShader(PaintShader::MakeImage(image, SkTileMode::kClamp, SkTileMode::kClamp, &local_matrix)); @@ -361,16 +366,17 @@ return {}; if (auto* bitmap_image = DynamicTo<BitmapImage>(this)) { - const IntSize paint_image_size(paint_image.width(), paint_image.height()); - const IntSize density_corrected_size = bitmap_image->DensityCorrectedSize(); + const gfx::Size paint_image_size(paint_image.width(), paint_image.height()); + const gfx::Size density_corrected_size = + bitmap_image->DensityCorrectedSize(); ImageOrientation orientation = ImageOrientationEnum::kDefault; if (respect_image_orientation == kRespectImageOrientation) orientation = bitmap_image->CurrentFrameOrientation(); - FloatSize image_scale(1, 1); + gfx::Vector2dF image_scale(1, 1); if (density_corrected_size != paint_image_size) { - image_scale = FloatSize( + image_scale = gfx::Vector2dF( density_corrected_size.width() / paint_image_size.width(), density_corrected_size.height() / paint_image_size.height()); } @@ -396,8 +402,8 @@ return dark_mode_image_cache_.get(); } -FloatRect Image::CorrectSrcRectForImageOrientation(FloatSize image_size, - FloatRect src_rect) const { +gfx::RectF Image::CorrectSrcRectForImageOrientation(gfx::SizeF image_size, + gfx::RectF src_rect) const { ImageOrientation orientation = CurrentFrameOrientation(); DCHECK(orientation != ImageOrientationEnum::kDefault); AffineTransform forward_map = orientation.TransformFromDefault(image_size);
diff --git a/third_party/blink/renderer/platform/graphics/image.h b/third_party/blink/renderer/platform/graphics/image.h index 12dae0b..0e572ca 100644 --- a/third_party/blink/renderer/platform/graphics/image.h +++ b/third_party/blink/renderer/platform/graphics/image.h
@@ -44,6 +44,7 @@ #include "third_party/skia/include/core/SkRefCnt.h" #include "ui/base/resource/resource_scale_factor.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/rect_f.h" class SkMatrix; @@ -55,7 +56,6 @@ namespace blink { -class FloatRect; class GraphicsContext; class Image; class WebGraphicsContext3DProvider; @@ -85,7 +85,7 @@ static PaintImage ResizeAndOrientImage( const PaintImage&, ImageOrientation, - FloatSize image_scale = FloatSize(1, 1), + gfx::Vector2dF image_scale = gfx::Vector2dF(1, 1), float opacity = 1.0, InterpolationQuality = kInterpolationNone); @@ -120,16 +120,16 @@ }; // Size of the Image optionally modified per the provided SizeConfig. - virtual IntSize SizeWithConfig(SizeConfig) const = 0; - virtual FloatSize SizeWithConfigAsFloat(SizeConfig config) const { - return FloatSize(SizeWithConfig(config)); + virtual gfx::Size SizeWithConfig(SizeConfig) const = 0; + virtual gfx::SizeF SizeWithConfigAsFloat(SizeConfig config) const { + return gfx::SizeF(SizeWithConfig(config)); } // Size of the Image. - IntSize Size() const { return SizeWithConfig({}); } + gfx::Size Size() const { return SizeWithConfig({}); } // Size of the Image with density correction applied. - IntSize DensityCorrectedSize() const { + gfx::Size DensityCorrectedSize() const { SizeConfig config; config.apply_density = true; return SizeWithConfig(config); @@ -137,7 +137,7 @@ // Size of the Image with density correction and orientation applied // regardless of any settings or style affecting orientation. - IntSize PreferredDisplaySize() const { + gfx::Size PreferredDisplaySize() const { SizeConfig config; config.apply_density = true; config.apply_orientation = true; @@ -146,7 +146,7 @@ // Size of the Image with density correction applied. If the argument is // kRespectImageOrientation orientation is applied as well. - IntSize Size(RespectImageOrientationEnum respect_orientation) const { + gfx::Size Size(RespectImageOrientationEnum respect_orientation) const { SizeConfig config; config.apply_density = true; config.apply_orientation = respect_orientation == kRespectImageOrientation; @@ -156,14 +156,15 @@ // Same as Size(RespectImageOrientationEnum) above, but returns a floating // point representation of the size. For subclasses of Image that can have a // fractional size this will return the unrounded size. - FloatSize SizeAsFloat(RespectImageOrientationEnum respect_orientation) const { + gfx::SizeF SizeAsFloat( + RespectImageOrientationEnum respect_orientation) const { SizeConfig config; config.apply_density = true; config.apply_orientation = respect_orientation == kRespectImageOrientation; return SizeWithConfigAsFloat(config); } - IntRect Rect() const { return IntRect(gfx::Point(), Size()); } + gfx::Rect Rect() const { return gfx::Rect(Size()); } int width() const { return Size().width(); } int height() const { return Size().height(); } @@ -283,8 +284,8 @@ // to call this method. The image_size is the oriented size of the image (i.e. // after orientation has been applied). src_rect may be a subset of the image, // also oriented. - FloatRect CorrectSrcRectForImageOrientation(FloatSize image_size, - FloatRect src_rect) const; + gfx::RectF CorrectSrcRectForImageOrientation(gfx::SizeF image_size, + gfx::RectF src_rect) const; enum ImageClampingMode { kClampImageToSourceRect, @@ -293,8 +294,8 @@ virtual void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) = 0; // Apply this Image as a shader to the passed PaintFlags. This is currently @@ -302,8 +303,8 @@ // of that function the shader should use a clamping tile mode if possible. virtual bool ApplyShader(cc::PaintFlags&, const SkMatrix& local_matrix, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options); // Use ContextProvider() for immediate use only, use @@ -329,7 +330,7 @@ virtual void DrawPattern(GraphicsContext&, const cc::PaintFlags&, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options);
diff --git a/third_party/blink/renderer/platform/graphics/image_orientation.cc b/third_party/blink/renderer/platform/graphics/image_orientation.cc index f0e38e5..e1024b5 100644 --- a/third_party/blink/renderer/platform/graphics/image_orientation.cc +++ b/third_party/blink/renderer/platform/graphics/image_orientation.cc
@@ -26,13 +26,14 @@ #include "third_party/blink/renderer/platform/graphics/image_orientation.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" +#include "base/notreached.h" #include "third_party/blink/renderer/platform/transforms/affine_transform.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { AffineTransform ImageOrientation::TransformFromDefault( - const FloatSize& drawn_size) const { + const gfx::SizeF& drawn_size) const { float w = drawn_size.width(); float h = drawn_size.height();
diff --git a/third_party/blink/renderer/platform/graphics/image_orientation.h b/third_party/blink/renderer/platform/graphics/image_orientation.h index b999611..f9c83e5 100644 --- a/third_party/blink/renderer/platform/graphics/image_orientation.h +++ b/third_party/blink/renderer/platform/graphics/image_orientation.h
@@ -31,10 +31,13 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +namespace gfx { +class SizeF; +} + namespace blink { class AffineTransform; -class FloatSize; // This enum intentionally matches the orientation values from the EXIF spec. // See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF @@ -87,7 +90,7 @@ // This transform can be used for drawing an image according to the // orientation. It should be used in a right-handed coordinate system. - AffineTransform TransformFromDefault(const FloatSize& drawn_size) const; + AffineTransform TransformFromDefault(const gfx::SizeF& drawn_size) const; inline bool operator==(const ImageOrientation& other) const { return other.orientation_ == orientation_;
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_recorder.cc b/third_party/blink/renderer/platform/graphics/paint/drawing_recorder.cc index c674d3d..67b8b90 100644 --- a/third_party/blink/renderer/platform/graphics/paint/drawing_recorder.cc +++ b/third_party/blink/renderer/platform/graphics/paint/drawing_recorder.cc
@@ -29,7 +29,7 @@ DCHECK(DisplayItem::IsDrawingType(display_item_type)); context.SetInDrawingRecorder(true); - context.BeginRecording(FloatRect()); + context.BeginRecording(gfx::RectF()); if (context.NeedsDOMNodeId()) { DOMNodeId dom_node_id = display_item_client.OwnerNodeId();
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h index eb0ee3b..e11ac16 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
@@ -45,7 +45,7 @@ if (DrawingRecorder::UseCachedDrawingIfPossible(context, client, type)) return; DrawingRecorder recorder(context, client, type, bounds); - context.DrawRect(IntRect(bounds), AutoDarkMode::Disabled()); + context.DrawRect(bounds, AutoDarkMode::Disabled()); } protected:
diff --git a/third_party/blink/renderer/platform/graphics/paint_generated_image.cc b/third_party/blink/renderer/platform/graphics/paint_generated_image.cc index 74c1ccc..75ccf1a1 100644 --- a/third_party/blink/renderer/platform/graphics/paint_generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/paint_generated_image.cc
@@ -13,19 +13,20 @@ void PaintGeneratedImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) { PaintCanvasAutoRestore ar(canvas, true); - canvas->clipRect(dest_rect); - canvas->concat(SkMatrix::RectToRect(src_rect, dest_rect)); - SkRect bounds = src_rect; - canvas->saveLayer(&bounds, &flags); + SkRect sk_dest_rect = gfx::RectFToSkRect(dest_rect); + SkRect sk_src_rect = gfx::RectFToSkRect(src_rect); + canvas->clipRect(sk_dest_rect); + canvas->concat(SkMatrix::RectToRect(sk_src_rect, sk_dest_rect)); + canvas->saveLayer(&sk_src_rect, &flags); canvas->drawPicture(record_); } void PaintGeneratedImage::DrawTile(GraphicsContext& context, - const FloatRect& src_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) { context.DrawRecord(record_); }
diff --git a/third_party/blink/renderer/platform/graphics/paint_generated_image.h b/third_party/blink/renderer/platform/graphics/paint_generated_image.h index b09477cd..f6b1a84 100644 --- a/third_party/blink/renderer/platform/graphics/paint_generated_image.h +++ b/third_party/blink/renderer/platform/graphics/paint_generated_image.h
@@ -5,7 +5,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_GENERATED_IMAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_PAINT_GENERATED_IMAGE_H_ -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/generated_image.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/skia/include/core/SkRefCnt.h" @@ -15,7 +14,7 @@ class PLATFORM_EXPORT PaintGeneratedImage : public GeneratedImage { public: static scoped_refptr<PaintGeneratedImage> Create(sk_sp<PaintRecord> record, - const FloatSize& size) { + const gfx::SizeF& size) { return base::AdoptRef(new PaintGeneratedImage(std::move(record), size)); } ~PaintGeneratedImage() override = default; @@ -23,14 +22,14 @@ protected: void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect&, - const FloatRect&, + const gfx::RectF&, + const gfx::RectF&, const ImageDrawOptions& draw_options) override; void DrawTile(GraphicsContext&, - const FloatRect&, + const gfx::RectF&, const ImageDrawOptions&) final; - PaintGeneratedImage(sk_sp<PaintRecord> record, const FloatSize& size) + PaintGeneratedImage(sk_sp<PaintRecord> record, const gfx::SizeF& size) : GeneratedImage(size), record_(std::move(record)) {} sk_sp<PaintRecord> record_;
diff --git a/third_party/blink/renderer/platform/graphics/placeholder_image.cc b/third_party/blink/renderer/platform/graphics/placeholder_image.cc index 0535942e..408e91b 100644 --- a/third_party/blink/renderer/platform/graphics/placeholder_image.cc +++ b/third_party/blink/renderer/platform/graphics/placeholder_image.cc
@@ -67,14 +67,15 @@ // area) and so that all placeholder images on the same page look consistent. canvas->drawImageRect( icon_image->PaintImageForCurrentFrame(), - IntRect(gfx::Point(), icon_image->Size()), - FloatRect(x, y, scale_factor * kIconWidth, scale_factor * kIconHeight), + SkRect::MakeWH(icon_image->width(), icon_image->height()), + SkRect::MakeXYWH(x, y, scale_factor * kIconWidth, + scale_factor * kIconHeight), sampling, &flags, SkCanvas::kFast_SrcRectConstraint); } void DrawCenteredIcon(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const SkSamplingOptions& sampling, float scale_factor) { DrawIcon( @@ -209,7 +210,7 @@ nullptr; PlaceholderImage::PlaceholderImage(ImageObserver* observer, - const IntSize& size, + const gfx::Size& size, int64_t original_resource_size) : Image(observer), size_(size), @@ -220,7 +221,7 @@ PlaceholderImage::~PlaceholderImage() = default; -IntSize PlaceholderImage::SizeWithConfig(SizeConfig) const { +gfx::Size PlaceholderImage::SizeWithConfig(SizeConfig) const { return size_; } @@ -241,7 +242,7 @@ auto builder = CreatePaintImageBuilder().set_completion_state( PaintImage::CompletionState::DONE); - const gfx::Rect dest_rect(0, 0, size_.width(), size_.height()); + const gfx::Rect dest_rect(size_); if (paint_record_for_current_frame_) { return builder .set_paint_record(paint_record_for_current_frame_, dest_rect, @@ -250,9 +251,9 @@ } PaintRecorder paint_recorder; - SkRect sk_dest_rect = gfx::RectToSkRect(dest_rect); - Draw(paint_recorder.beginRecording(sk_dest_rect), PaintFlags(), sk_dest_rect, - sk_dest_rect, ImageDrawOptions()); + Draw(paint_recorder.beginRecording(gfx::RectToSkRect(dest_rect)), + PaintFlags(), gfx::RectF(dest_rect), gfx::RectF(dest_rect), + ImageDrawOptions()); paint_record_for_current_frame_ = paint_recorder.finishRecordingAsPicture(); paint_record_content_id_ = PaintImage::GetNextContentId(); @@ -273,19 +274,19 @@ void PlaceholderImage::Draw(cc::PaintCanvas* canvas, const PaintFlags& base_flags, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { - if (!src_rect.Intersects(FloatRect(0.0f, 0.0f, - static_cast<float>(size_.width()), - static_cast<float>(size_.height())))) { + if (!src_rect.Intersects(gfx::RectF(0.0f, 0.0f, + static_cast<float>(size_.width()), + static_cast<float>(size_.height())))) { return; } PaintFlags flags(base_flags); flags.setStyle(PaintFlags::kFill_Style); flags.setColor(SkColorSetARGB(0x80, 0xD9, 0xD9, 0xD9)); - canvas->drawRect(dest_rect, flags); + canvas->drawRect(gfx::RectFToSkRect(dest_rect), flags); if (dest_rect.width() < icon_and_text_scale_factor_ * (kIconWidth + 2 * kFeaturePaddingX) || @@ -356,7 +357,7 @@ void PlaceholderImage::DrawPattern(GraphicsContext& context, const PaintFlags& base_flags, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options) { DCHECK(context.Canvas());
diff --git a/third_party/blink/renderer/platform/graphics/placeholder_image.h b/third_party/blink/renderer/platform/graphics/placeholder_image.h index e6e62ee..78ef183 100644 --- a/third_party/blink/renderer/platform/graphics/placeholder_image.h +++ b/third_party/blink/renderer/platform/graphics/placeholder_image.h
@@ -9,17 +9,20 @@ #include "base/memory/scoped_refptr.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/blink/renderer/platform/graphics/image_orientation.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkRefCnt.h" +#include "ui/gfx/geometry/size.h" + +namespace gfx { +class RectF; +} namespace blink { -class FloatRect; class Font; class GraphicsContext; class ImageObserver; @@ -30,7 +33,7 @@ public: static scoped_refptr<PlaceholderImage> Create( ImageObserver* observer, - const IntSize& size, + const gfx::Size& size, int64_t original_resource_size) { return base::AdoptRef( new PlaceholderImage(observer, size, original_resource_size)); @@ -38,12 +41,12 @@ ~PlaceholderImage() override; - IntSize SizeWithConfig(SizeConfig) const override; + gfx::Size SizeWithConfig(SizeConfig) const override; void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dest_rect, - const FloatRect& src_rect, + const gfx::RectF& dest_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; void DestroyDecodedData() override; @@ -59,7 +62,7 @@ private: PlaceholderImage(ImageObserver*, - const IntSize&, + const gfx::Size&, int64_t original_resource_size); bool CurrentFrameHasSingleSecurityOrigin() const override; @@ -68,14 +71,14 @@ void DrawPattern(GraphicsContext&, const cc::PaintFlags&, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, const ImageTilingInfo& tiling_info, const ImageDrawOptions& draw_options) override; // SetData does nothing, and the passed in buffer is ignored. SizeAvailability SetData(scoped_refptr<SharedBuffer>, bool) override; - const IntSize size_; + const gfx::Size size_; const String text_; float icon_and_text_scale_factor_ = 1.0f;
diff --git a/third_party/blink/renderer/platform/graphics/placeholder_image_test.cc b/third_party/blink/renderer/platform/graphics/placeholder_image_test.cc index f04dddd9..a51a7db 100644 --- a/third_party/blink/renderer/platform/graphics/placeholder_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/placeholder_image_test.cc
@@ -54,7 +54,7 @@ kBaseIconPaddingY + kBaseIconHeight + kBaseIconPaddingY; void ExpectDrawGrayBox(MockPaintCanvas& canvas, - const FloatRect& expected_rect) { + const gfx::RectF& expected_rect) { EXPECT_CALL( canvas, drawRect(AllOf(Property(&SkRect::x, FloatNear(expected_rect.x(), 0.01)), @@ -70,18 +70,18 @@ } void DrawImageExpectingGrayBoxOnly(PlaceholderImage& image, - const FloatRect& dest_rect) { + const gfx::RectF& dest_rect) { MockPaintCanvas canvas; ExpectDrawGrayBox(canvas, dest_rect); EXPECT_CALL(canvas, drawImageRect(_, _, _, _, _, _)).Times(0); EXPECT_CALL(canvas, drawTextBlob(_, _, _, _)).Times(0); image.Draw(&canvas, PaintFlags(), dest_rect, - FloatRect(0.0f, 0.0f, 100.0f, 100.0f), ImageDrawOptions()); + gfx::RectF(0.0f, 0.0f, 100.0f, 100.0f), ImageDrawOptions()); } void DrawImageExpectingIconOnly(PlaceholderImage& image, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, float scale_factor) { MockPaintCanvas canvas; ExpectDrawGrayBox(canvas, dest_rect); @@ -110,7 +110,7 @@ ImageDrawOptions draw_options; draw_options.respect_orientation = kDoNotRespectImageOrientation; image.Draw(&canvas, PaintFlags(), dest_rect, - FloatRect(0.0f, 0.0f, 100.0f, 100.0f), draw_options); + gfx::RectF(0.0f, 0.0f, 100.0f, 100.0f), draw_options); } float GetExpectedPlaceholderTextWidth(const StringView& text, @@ -138,7 +138,7 @@ } void DrawImageExpectingIconAndTextLTR(PlaceholderImage& image, - const FloatRect& dest_rect, + const gfx::RectF& dest_rect, float scale_factor) { EXPECT_FALSE(Locale::DefaultLocale().IsRTL()); @@ -200,7 +200,7 @@ ImageDrawOptions draw_options; draw_options.respect_orientation = kDoNotRespectImageOrientation; image.Draw(&canvas, PaintFlags(), dest_rect, - FloatRect(0.0f, 0.0f, 100.0f, 100.0f), draw_options); + gfx::RectF(0.0f, 0.0f, 100.0f, 100.0f), draw_options); } class TestingUnitsPlatform : public TestingPlatformSupport { @@ -277,7 +277,7 @@ expected.Ensure16Bit(); EXPECT_EQ(expected, - PlaceholderImage::Create(nullptr, IntSize(400, 300), test.bytes) + PlaceholderImage::Create(nullptr, gfx::Size(400, 300), test.bytes) ->GetTextForTesting()); } } @@ -290,44 +290,44 @@ ImageDrawOptions draw_options; draw_options.respect_orientation = kDoNotRespectImageOrientation; - PlaceholderImage::Create(nullptr, IntSize(800, 600), 0) - ->Draw(&canvas, PaintFlags(), FloatRect(0.0f, 0.0f, 800.0f, 600.0f), + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 0) + ->Draw(&canvas, PaintFlags(), gfx::RectF(0.0f, 0.0f, 800.0f, 600.0f), // The source rectangle is outside the 800x600 bounds of the image, // so nothing should be drawn. - FloatRect(1000.0f, 0.0f, 800.0f, 600.0f), draw_options); + gfx::RectF(1000.0f, 0.0f, 800.0f, 600.0f), draw_options); } TEST_F(PlaceholderImageTest, DrawWithoutOriginalResourceSize) { scoped_refptr<PlaceholderImage> image = - PlaceholderImage::Create(nullptr, IntSize(800, 600), 0); + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 0); constexpr float kTestScaleFactors[] = {0.5f, 1.0f, 2.0f}; for (const float scale_factor : kTestScaleFactors) { image->SetIconAndTextScaleFactor(scale_factor); DrawImageExpectingGrayBoxOnly( - *image, FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth - 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f)); + *image, gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth - 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f)); DrawImageExpectingGrayBoxOnly( - *image, FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, - scale_factor * kBaseFeatureHeight - 1.0f)); + *image, gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, + scale_factor * kBaseFeatureHeight - 1.0f)); DrawImageExpectingIconOnly( *image, - FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f), + gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f), scale_factor); DrawImageExpectingIconOnly( - *image, FloatRect(1000.0f, 2000.0f, 800.0f, 600.0f), scale_factor); + *image, gfx::RectF(1000.0f, 2000.0f, 800.0f, 600.0f), scale_factor); } } TEST_F(PlaceholderImageTest, DrawWithOriginalResourceSizeLTR) { scoped_refptr<PlaceholderImage> image = - PlaceholderImage::Create(nullptr, IntSize(800, 600), 50 * 1024); + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 50 * 1024); String expected_text = "50 KB"; expected_text.Ensure16Bit(); @@ -338,16 +338,16 @@ image->SetIconAndTextScaleFactor(scale_factor); DrawImageExpectingGrayBoxOnly( - *image, FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth - 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f)); + *image, gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth - 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f)); DrawImageExpectingGrayBoxOnly( - *image, FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, - scale_factor * kBaseFeatureHeight - 1.0f)); + *image, gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, + scale_factor * kBaseFeatureHeight - 1.0f)); DrawImageExpectingGrayBoxOnly( - *image, FloatRect(1000.0f, 2000.0f, 800.0f, - scale_factor * kBaseFeatureHeight - 1.0f)); + *image, gfx::RectF(1000.0f, 2000.0f, 800.0f, + scale_factor * kBaseFeatureHeight - 1.0f)); const float expected_text_width = GetExpectedPlaceholderTextWidth( image->GetTextForTesting(), scale_factor); @@ -358,29 +358,29 @@ DrawImageExpectingIconOnly( *image, - FloatRect(1000.0f, 2000.0f, - scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f), + gfx::RectF(1000.0f, 2000.0f, + scale_factor * kBaseIconOnlyFeatureWidth + 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f), scale_factor); DrawImageExpectingIconOnly( *image, - FloatRect(1000.0f, 2000.0f, expected_icon_and_text_width - 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f), + gfx::RectF(1000.0f, 2000.0f, expected_icon_and_text_width - 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f), scale_factor); DrawImageExpectingIconAndTextLTR( *image, - FloatRect(1000.0f, 2000.0f, expected_icon_and_text_width + 1.0f, - scale_factor * kBaseFeatureHeight + 1.0f), + gfx::RectF(1000.0f, 2000.0f, expected_icon_and_text_width + 1.0f, + scale_factor * kBaseFeatureHeight + 1.0f), scale_factor); DrawImageExpectingIconAndTextLTR( - *image, FloatRect(1000.0f, 2000.0f, 800.0f, 600.0f), scale_factor); + *image, gfx::RectF(1000.0f, 2000.0f, 800.0f, 600.0f), scale_factor); } } TEST_F(PlaceholderImageTest, DrawWithOriginalResourceSizeRTL) { scoped_refptr<PlaceholderImage> image = - PlaceholderImage::Create(nullptr, IntSize(800, 600), 50 * 1024); + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 50 * 1024); String expected_text = "50 KB"; expected_text.Ensure16Bit(); @@ -392,7 +392,7 @@ static constexpr float kScaleFactor = 2.0f; image->SetIconAndTextScaleFactor(kScaleFactor); - const FloatRect dest_rect(1000.0f, 2000.0f, 800.0f, 600.0f); + const gfx::RectF dest_rect(1000.0f, 2000.0f, 800.0f, 600.0f); MockPaintCanvas canvas; ExpectDrawGrayBox(canvas, dest_rect); @@ -453,28 +453,28 @@ ImageDrawOptions draw_options; draw_options.respect_orientation = kDoNotRespectImageOrientation; image->Draw(&canvas, PaintFlags(), dest_rect, - FloatRect(0.0f, 0.0f, 100.0f, 100.0f), draw_options); + gfx::RectF(0.0f, 0.0f, 100.0f, 100.0f), draw_options); } TEST_F(PlaceholderImageTest, DrawSeparateImageWithDifferentScaleFactor) { scoped_refptr<PlaceholderImage> image_1 = - PlaceholderImage::Create(nullptr, IntSize(800, 600), 50 * 1024); + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 50 * 1024); constexpr float kScaleFactor1 = 0.5f; image_1->SetIconAndTextScaleFactor(kScaleFactor1); DrawImageExpectingIconAndTextLTR( - *image_1, FloatRect(1000.0f, 2000.0f, 800.0f, 600.0f), kScaleFactor1); + *image_1, gfx::RectF(1000.0f, 2000.0f, 800.0f, 600.0f), kScaleFactor1); scoped_refptr<PlaceholderImage> image_2 = - PlaceholderImage::Create(nullptr, IntSize(800, 600), 100 * 1024); + PlaceholderImage::Create(nullptr, gfx::Size(800, 600), 100 * 1024); constexpr float kScaleFactor2 = 2.0f; image_2->SetIconAndTextScaleFactor(kScaleFactor2); DrawImageExpectingIconAndTextLTR( - *image_2, FloatRect(1000.0f, 2000.0f, 800.0f, 600.0f), kScaleFactor2); + *image_2, gfx::RectF(1000.0f, 2000.0f, 800.0f, 600.0f), kScaleFactor2); DrawImageExpectingIconAndTextLTR( - *image_1, FloatRect(1000.0f, 2000.0f, 1600.0f, 1200.0f), kScaleFactor1); + *image_1, gfx::RectF(1000.0f, 2000.0f, 1600.0f, 1200.0f), kScaleFactor1); } } // namespace
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.cc b/third_party/blink/renderer/platform/graphics/skia/skia_utils.cc index 54d6ba5..e3db3056 100644 --- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.cc +++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.cc
@@ -257,11 +257,10 @@ return fabs(value - floorf(value)) < std::numeric_limits<float>::epsilon(); } -bool IsValidImageSize(const IntSize& size) { +bool IsValidImageSize(const gfx::Size& size) { if (size.IsEmpty()) return false; - base::CheckedNumeric<int> area = size.width(); - area *= size.height(); + base::CheckedNumeric<int> area = size.GetCheckedArea(); if (!area.IsValid() || area.ValueOrDie() > kMaxCanvasArea) return false; if (size.width() > kMaxSkiaDim || size.height() > kMaxSkiaDim)
diff --git a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h index 19ca998..901fe944 100644 --- a/third_party/blink/renderer/platform/graphics/skia/skia_utils.h +++ b/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
@@ -64,7 +64,7 @@ kMaxSkiaDim = 65535 // Maximum width/height in CSS pixels. }; -bool PLATFORM_EXPORT IsValidImageSize(const IntSize&); +bool PLATFORM_EXPORT IsValidImageSize(const gfx::Size&); SkBlendMode PLATFORM_EXPORT WebCoreCompositeToSkiaComposite(CompositeOperator,
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc index 7bb7f49..2c95f25 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
@@ -15,6 +15,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkSurface.h" +#include "ui/gfx/geometry/skia_conversions.h" #include "v8/include/v8.h" namespace blink { @@ -35,27 +36,27 @@ orientation); } -IntSize StaticBitmapImage::SizeWithConfig(SizeConfig config) const { - IntSize size = SizeInternal(); +gfx::Size StaticBitmapImage::SizeWithConfig(SizeConfig config) const { + gfx::Size size = SizeInternal(); if (config.apply_orientation && orientation_.UsesWidthAsHeight()) - size = size.TransposedSize(); + size.Transpose(); return size; } void StaticBitmapImage::DrawHelper(cc::PaintCanvas* canvas, const PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options, const PaintImage& image) { - FloatRect adjusted_src_rect = src_rect; - adjusted_src_rect.Intersect(SkRect::MakeWH(image.width(), image.height())); + gfx::RectF adjusted_src_rect = src_rect; + adjusted_src_rect.Intersect(gfx::RectF(image.width(), image.height())); if (dst_rect.IsEmpty() || adjusted_src_rect.IsEmpty()) return; // Nothing to draw. cc::PaintCanvasAutoRestore auto_restore(canvas, false); - FloatRect adjusted_dst_rect = dst_rect; + gfx::RectF adjusted_dst_rect = dst_rect; if (draw_options.respect_orientation && orientation_ != ImageOrientationEnum::kDefault) { canvas->save(); @@ -67,16 +68,14 @@ canvas->concat(AffineTransformToSkMatrix( orientation_.TransformFromDefault(adjusted_dst_rect.size()))); - if (orientation_.UsesWidthAsHeight()) { - adjusted_dst_rect = - FloatRect(adjusted_dst_rect.x(), adjusted_dst_rect.y(), - adjusted_dst_rect.height(), adjusted_dst_rect.width()); - } + if (orientation_.UsesWidthAsHeight()) + adjusted_dst_rect.set_size(gfx::TransposeSize(adjusted_dst_rect.size())); } canvas->drawImageRect( - image, adjusted_src_rect, adjusted_dst_rect, - draw_options.sampling_options, &flags, + image, gfx::RectFToSkRect(adjusted_src_rect), + gfx::RectFToSkRect(adjusted_dst_rect), draw_options.sampling_options, + &flags, WebCoreClampingModeToSkiaRectConstraint(draw_options.clamping_mode)); }
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h index 5e536b2..affc4f5 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
@@ -41,7 +41,7 @@ // Methods overridden by all sub-classes ~StaticBitmapImage() override = default; - IntSize SizeWithConfig(SizeConfig) const final; + gfx::Size SizeWithConfig(SizeConfig) const final; virtual scoped_refptr<StaticBitmapImage> ConvertToColorSpace( sk_sp<SkColorSpace>, @@ -70,7 +70,7 @@ bool, bool, const gfx::Point&, - const IntRect&) { + const gfx::Rect&) { NOTREACHED(); return false; } @@ -113,12 +113,12 @@ // Helper for sub-classes void DrawHelper(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect&, - const FloatRect&, + const gfx::RectF&, + const gfx::RectF&, const ImageDrawOptions&, const PaintImage&); - virtual IntSize SizeInternal() const = 0; + virtual gfx::Size SizeInternal() const = 0; // The image orientation is stored here because it is only available when the // static image is created and the underlying representations do not store
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc index 62af6c2..0555822 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc
@@ -48,7 +48,7 @@ if (!image) return; - const auto size = ToGfxSize(image->Size()); + const auto size = image->Size(); if (!media::VideoFrame::IsValidSize(size, gfx::Rect(size), size)) { DVLOG(1) << __func__ << " received frame with invalid size " << size.ToString();
diff --git a/third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h b/third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h index 8a73591..9a9bec9 100644 --- a/third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h +++ b/third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h
@@ -18,8 +18,7 @@ class FakeCanvasResourceHost : public CanvasResourceHost { public: - FakeCanvasResourceHost(IntSize size) : size_(size) {} - ~FakeCanvasResourceHost() override {} + explicit FakeCanvasResourceHost(gfx::Size size) : size_(size) {} void NotifyGpuContextLost() override {} void SetNeedsCompositingUpdate() override {} void RestoreCanvasMatrixClipStack(cc::PaintCanvas*) const override {} @@ -67,7 +66,7 @@ } private: - IntSize size_; + gfx::Size size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h b/third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h index 2802027..cedc419 100644 --- a/third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h +++ b/third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h
@@ -53,7 +53,7 @@ // MockImageDecoder::decodedSize() to return the same thing as // MockImageDecoder::size(). See the precise implementation of // MockImageDecoder::decodedSize() below. - virtual IntSize DecodedSize() const { return IntSize(); } + virtual gfx::Size DecodedSize() const { return gfx::Size(); } void ForceFirstFrameToBeEmpty() { first_frame_forced_to_be_empty_ = true; } @@ -77,7 +77,7 @@ ~MockImageDecoder() override { client_->DecoderBeingDestroyed(); } - IntSize DecodedSize() const override { + gfx::Size DecodedSize() const override { return client_->DecodedSize().IsEmpty() ? Size() : client_->DecodedSize(); } @@ -144,12 +144,12 @@ MockImageDecoderClient* client, const SkISize& decoded_size) { return base::WrapUnique(new MockImageDecoderFactory( - client, IntSize(decoded_size.width(), decoded_size.height()))); + client, gfx::Size(decoded_size.width(), decoded_size.height()))); } static std::unique_ptr<MockImageDecoderFactory> Create( MockImageDecoderClient* client, - const IntSize& decoded_size) { + const gfx::Size& decoded_size) { return base::WrapUnique(new MockImageDecoderFactory(client, decoded_size)); } @@ -162,11 +162,11 @@ private: MockImageDecoderFactory(MockImageDecoderClient* client, - const IntSize& decoded_size) + const gfx::Size& decoded_size) : client_(client), decoded_size_(decoded_size) {} MockImageDecoderClient* client_; - IntSize decoded_size_; + gfx::Size decoded_size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/test/stub_image.h b/third_party/blink/renderer/platform/graphics/test/stub_image.h index e64d14be..ac11735b 100644 --- a/third_party/blink/renderer/platform/graphics/test/stub_image.h +++ b/third_party/blink/renderer/platform/graphics/test/stub_image.h
@@ -14,13 +14,15 @@ StubImage() = default; bool CurrentFrameKnownToBeOpaque() override { return false; } - IntSize SizeWithConfig(SizeConfig) const override { return IntSize(10, 10); } + gfx::Size SizeWithConfig(SizeConfig) const override { + return gfx::Size(10, 10); + } void DestroyDecodedData() override {} PaintImage PaintImageForCurrentFrame() override { return PaintImage(); } void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override {} };
diff --git a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc index 02b87fd6..dca2d66 100644 --- a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc +++ b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.cc
@@ -67,8 +67,8 @@ } } -IntSize UnacceleratedStaticBitmapImage::SizeInternal() const { - return IntSize(paint_image_.width(), paint_image_.height()); +gfx::Size UnacceleratedStaticBitmapImage::SizeInternal() const { + return gfx::Size(paint_image_.width(), paint_image_.height()); } bool UnacceleratedStaticBitmapImage::IsPremultiplied() const { @@ -82,8 +82,8 @@ void UnacceleratedStaticBitmapImage::Draw( cc::PaintCanvas* canvas, const cc::PaintFlags& flags, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions& draw_options) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); StaticBitmapImage::DrawHelper(canvas, flags, dst_rect, src_rect, draw_options,
diff --git a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h index a7ddfda..e837f89 100644 --- a/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h
@@ -33,8 +33,8 @@ void Draw(cc::PaintCanvas*, const cc::PaintFlags&, - const FloatRect& dst_rect, - const FloatRect& src_rect, + const gfx::RectF& dst_rect, + const gfx::RectF& src_rect, const ImageDrawOptions&) override; PaintImage PaintImageForCurrentFrame() override; @@ -49,7 +49,7 @@ UnacceleratedStaticBitmapImage(sk_sp<SkImage>, ImageOrientation); UnacceleratedStaticBitmapImage(PaintImage, ImageOrientation); - IntSize SizeInternal() const override; + gfx::Size SizeInternal() const override; PaintImage paint_image_; THREAD_CHECKER(thread_checker_);
diff --git a/third_party/blink/renderer/platform/graphics/video_frame_image_util.cc b/third_party/blink/renderer/platform/graphics/video_frame_image_util.cc index eacb5fb..f194886 100644 --- a/third_party/blink/renderer/platform/graphics/video_frame_image_util.cc +++ b/third_party/blink/renderer/platform/graphics/video_frame_image_util.cc
@@ -193,8 +193,7 @@ DLOG(ERROR) << "An external CanvasResourceProvider must be provided when " "providing a custom destination rect."; return nullptr; - } else if (!gfx::Rect(ToGfxSize(resource_provider->Size())) - .Contains(final_dest_rect)) { + } else if (!gfx::Rect(resource_provider->Size()).Contains(final_dest_rect)) { DLOG(ERROR) << "Provided CanvasResourceProvider is too small. Expected at least " << final_dest_rect.ToString() << " got " @@ -203,7 +202,7 @@ } auto raster_context_provider = GetRasterContextProvider(); - const auto resource_provider_size = IntSize(final_dest_rect.size()); + const auto resource_provider_size = final_dest_rect.size(); std::unique_ptr<CanvasResourceProvider> local_resource_provider; if (!resource_provider) { local_resource_provider = CreateResourceProviderForVideoFrame( @@ -241,7 +240,7 @@ bool ignore_video_transformation) { DCHECK(frame); DCHECK(resource_provider); - DCHECK(gfx::Rect(ToGfxSize(resource_provider->Size())).Contains(dest_rect)); + DCHECK(gfx::Rect(resource_provider->Size()).Contains(dest_rect)); if (frame->HasTextures()) { if (!raster_context_provider) { @@ -319,7 +318,7 @@ } std::unique_ptr<CanvasResourceProvider> CreateResourceProviderForVideoFrame( - IntSize size, + gfx::Size size, viz::RasterContextProvider* raster_context_provider) { if (!ShouldCreateAcceleratedImages(raster_context_provider)) { return CanvasResourceProvider::CreateBitmapProvider(
diff --git a/third_party/blink/renderer/platform/graphics/video_frame_image_util.h b/third_party/blink/renderer/platform/graphics/video_frame_image_util.h index 439de7e..7f1e8af 100644 --- a/third_party/blink/renderer/platform/graphics/video_frame_image_util.h +++ b/third_party/blink/renderer/platform/graphics/video_frame_image_util.h
@@ -112,7 +112,7 @@ // resource provider will be returned. PLATFORM_EXPORT std::unique_ptr<CanvasResourceProvider> CreateResourceProviderForVideoFrame( - IntSize size, + gfx::Size size, viz::RasterContextProvider* raster_context_provider); } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/video_frame_image_util_test.cc b/third_party/blink/renderer/platform/graphics/video_frame_image_util_test.cc index 50d9ed2..82169df3 100644 --- a/third_party/blink/renderer/platform/graphics/video_frame_image_util_test.cc +++ b/third_party/blink/renderer/platform/graphics/video_frame_image_util_test.cc
@@ -229,8 +229,8 @@ auto* raster_context_provider = fake_context.raster_context_provider(); ASSERT_TRUE(raster_context_provider); - auto provider = CreateResourceProviderForVideoFrame(IntSize(kTestSize), - raster_context_provider); + auto provider = + CreateResourceProviderForVideoFrame(kTestSize, raster_context_provider); ASSERT_TRUE(provider); EXPECT_TRUE(provider->IsAccelerated()); @@ -250,8 +250,7 @@ TEST(VideoFrameImageUtilTest, SoftwareCreateResourceProviderForVideoFrame) { // Creating a provider with a null viz::RasterContextProvider should result in // a non-accelerated provider being created. - auto provider = - CreateResourceProviderForVideoFrame(IntSize(kTestSize), nullptr); + auto provider = CreateResourceProviderForVideoFrame(kTestSize, nullptr); ASSERT_TRUE(provider); EXPECT_FALSE(provider->IsAccelerated()); } @@ -266,8 +265,7 @@ // Creating a provider with a null viz::RasterContextProvider should result in // a non-accelerated provider being created. { - auto provider = - CreateResourceProviderForVideoFrame(IntSize(kTestSize), nullptr); + auto provider = CreateResourceProviderForVideoFrame(kTestSize, nullptr); ASSERT_TRUE(provider); EXPECT_FALSE(provider->IsAccelerated()); } @@ -275,8 +273,8 @@ // Creating a provider with a real raster context provider should result in // an accelerated provider being created. { - auto provider = CreateResourceProviderForVideoFrame( - IntSize(kTestSize), raster_context_provider); + auto provider = + CreateResourceProviderForVideoFrame(kTestSize, raster_context_provider); ASSERT_TRUE(provider); EXPECT_TRUE(provider->IsAccelerated()); } @@ -292,8 +290,8 @@ // Creating a provider with a real raster context provider should result in // an unaccelerated provider being created due to the workaround. { - auto provider = CreateResourceProviderForVideoFrame( - IntSize(kTestSize), raster_context_provider); + auto provider = + CreateResourceProviderForVideoFrame(kTestSize, raster_context_provider); ASSERT_TRUE(provider); EXPECT_FALSE(provider->IsAccelerated()); } @@ -319,7 +317,7 @@ media::PIXEL_FORMAT_XRGB); auto provider = - CreateResourceProviderForVideoFrame(IntSize(gfx::Size(16, 16)), nullptr); + CreateResourceProviderForVideoFrame(gfx::Size(16, 16), nullptr); ASSERT_TRUE(provider); EXPECT_FALSE(provider->IsAccelerated()); @@ -335,8 +333,8 @@ media::VideoFrame::STORAGE_OWNED_MEMORY, media::PIXEL_FORMAT_XRGB); - auto provider = CreateResourceProviderForVideoFrame( - IntSize(gfx::Size(128, 128)), nullptr); + auto provider = + CreateResourceProviderForVideoFrame(gfx::Size(128, 128), nullptr); ASSERT_TRUE(provider); EXPECT_FALSE(provider->IsAccelerated());
diff --git a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc index f02dc42..a2a399b 100644 --- a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
@@ -297,11 +297,11 @@ } } -IntSize AVIFImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { +gfx::Size AVIFImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { DCHECK(IsDecodedSizeAvailable()); if (index == cc::YUVIndex::kU || index == cc::YUVIndex::kV) { - return IntSize(UVSize(Size().width(), chroma_shift_x_), - UVSize(Size().height(), chroma_shift_y_)); + return gfx::Size(UVSize(Size().width(), chroma_shift_x_), + UVSize(Size().height(), chroma_shift_y_)); } return Size(); } @@ -531,7 +531,7 @@ buffer.SetPixelFormat(ImageFrame::PixelFormat::kRGBA_F16); // For AVIFs, the frame always fills the entire image. - buffer.SetOriginalFrameRect(IntRect(gfx::Point(), Size())); + buffer.SetOriginalFrameRect(gfx::Rect(Size())); avifImageTiming timing; auto ret = avifDecoderNthImageTiming(decoder_.get(), index, &timing); @@ -888,9 +888,10 @@ const auto* image = decoder_->image; // Frame size must be equal to container size. - if (IntSize(image->width, image->height) != Size()) { - DVLOG(1) << "Frame size " << IntSize(image->width, image->height) - << " differs from container size " << Size(); + if (gfx::Size(image->width, image->height) != Size()) { + DVLOG(1) << "Frame size " + << gfx::Size(image->width, image->height).ToString() + << " differs from container size " << Size().ToString(); return AVIF_RESULT_UNKNOWN_ERROR; } // Frame bit depth must be equal to container bit depth.
diff --git a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h index 4d4eff9..19e360d2 100644 --- a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h
@@ -33,7 +33,7 @@ bool ImageIsHighBitDepth() override; void OnSetData(SegmentReader* data) override; cc::YUVSubsampling GetYUVSubsampling() const override; - IntSize DecodedYUVSize(cc::YUVIndex) const override; + gfx::Size DecodedYUVSize(cc::YUVIndex) const override; wtf_size_t DecodedYUVWidthBytes(cc::YUVIndex) const override; SkYUVColorSpace GetYUVColorSpace() const override; uint8_t GetYUVBitDepth() const override;
diff --git a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc index eff311d..5c9f41d 100644 --- a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc
@@ -592,8 +592,8 @@ } void ReadYUV(const char* file_name, - const IntSize& expected_y_size, - const IntSize& expected_uv_size, + const gfx::Size& expected_y_size, + const gfx::Size& expected_uv_size, SkColorType color_type, int bit_depth, gfx::Point3F* rgb_pixel = nullptr) { @@ -611,10 +611,10 @@ SkYUVColorSpace::kIdentity_SkYUVColorSpace); EXPECT_EQ(decoder->GetYUVBitDepth(), bit_depth); - IntSize size = decoder->DecodedSize(); - IntSize y_size = decoder->DecodedYUVSize(cc::YUVIndex::kY); - IntSize u_size = decoder->DecodedYUVSize(cc::YUVIndex::kU); - IntSize v_size = decoder->DecodedYUVSize(cc::YUVIndex::kV); + gfx::Size size = decoder->DecodedSize(); + gfx::Size y_size = decoder->DecodedYUVSize(cc::YUVIndex::kY); + gfx::Size u_size = decoder->DecodedYUVSize(cc::YUVIndex::kU); + gfx::Size v_size = decoder->DecodedYUVSize(cc::YUVIndex::kV); EXPECT_EQ(size, y_size); EXPECT_EQ(u_size, v_size); @@ -646,7 +646,7 @@ auto metadata = decoder->MakeMetadataForDecodeAcceleration(); EXPECT_EQ(cc::ImageType::kAVIF, metadata.image_type); - EXPECT_EQ(ToGfxSize(size), metadata.image_size); + EXPECT_EQ(size, metadata.image_size); if (expected_y_size == expected_uv_size) EXPECT_EQ(cc::YUVSubsampling::k444, metadata.yuv_subsampling); else if (expected_y_size.height() == expected_uv_size.height()) @@ -692,7 +692,7 @@ } void TestYUVRed(const char* file_name, - const IntSize& expected_uv_size, + const gfx::Size& expected_uv_size, SkColorType color_type = kGray_8_SkColorType, int bit_depth = 8) { #if !defined(HAVE_AVIF_BIT_DEPTH_12_SUPPORT) @@ -702,7 +702,7 @@ SCOPED_TRACE(base::StringPrintf("file_name=%s, color_type=%d", file_name, int{color_type})); - constexpr IntSize kRedYSize(3, 3); + constexpr gfx::Size kRedYSize(3, 3); gfx::Point3F decoded_pixel; ASSERT_NO_FATAL_FAILURE(ReadYUV(file_name, kRedYSize, expected_uv_size, @@ -822,16 +822,16 @@ TEST(StaticAVIFTests, YUV) { // 3x3, YUV 4:2:0 - constexpr IntSize kUVSize420(2, 2); + constexpr gfx::Size kUVSize420(2, 2); TestYUVRed("red-limited-range-420-8bpc.avif", kUVSize420); TestYUVRed("red-full-range-420-8bpc.avif", kUVSize420); // 3x3, YUV 4:2:2 - constexpr IntSize kUVSize422(2, 3); + constexpr gfx::Size kUVSize422(2, 3); TestYUVRed("red-limited-range-422-8bpc.avif", kUVSize422); // 3x3, YUV 4:4:4 - constexpr IntSize kUVSize444(3, 3); + constexpr gfx::Size kUVSize444(3, 3); TestYUVRed("red-limited-range-444-8bpc.avif", kUVSize444); // Full range BT709 color space is uncommon, but should be supported.
diff --git a/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc b/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc index a5bba21c..01a1ca93 100644 --- a/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc +++ b/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc
@@ -774,7 +774,7 @@ buffer_->SetHasAlpha(false); // For BMPs, the frame always fills the entire image. - buffer_->SetOriginalFrameRect(IntRect(gfx::Point(), parent_->Size())); + buffer_->SetOriginalFrameRect(gfx::Rect(parent_->Size())); if (!is_top_down_) coord_.set_y(parent_->Size().height() - 1);
diff --git a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder.cc index 0bbcca9..718aca9 100644 --- a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder.cc
@@ -206,8 +206,8 @@ // the current frame. Because of this, rather than correctly filling in the // frame rect, we set the frame rect to be the image's full size. // The original frame rect is not used, anyway. - IntSize full_image_size = Size(); - frame.SetOriginalFrameRect(IntRect(gfx::Point(), full_image_size)); + gfx::Size full_image_size = Size(); + frame.SetOriginalFrameRect(gfx::Rect(full_image_size)); SkCodec::FrameInfo frame_info; bool frame_info_received = codec_->getFrameInfo(index, &frame_info);
diff --git a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc index 587b70b..5861640 100644 --- a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc
@@ -345,7 +345,7 @@ ->CopyAs<Vector<char>>(); std::unique_ptr<ImageDecoder> decoder; - IntSize frame_size; + gfx::Size frame_size; // Compute hashes when the file is truncated. for (size_t i = 1; i <= full_data.size(); ++i) { @@ -469,7 +469,7 @@ decoder->SetMemoryAllocator(nullptr); ASSERT_TRUE(frame); - EXPECT_EQ(IntRect(gfx::Point(), decoder->Size()), frame->OriginalFrameRect()); + EXPECT_EQ(gfx::Rect(decoder->Size()), frame->OriginalFrameRect()); EXPECT_FALSE(frame->HasAlpha()); }
diff --git a/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc index b1ef636..f7e5922d 100644 --- a/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.cc
@@ -63,11 +63,11 @@ SetDataForPNGDecoderAtIndex(i); } -IntSize ICOImageDecoder::Size() const { +gfx::Size ICOImageDecoder::Size() const { return frame_size_.IsEmpty() ? ImageDecoder::Size() : frame_size_; } -IntSize ICOImageDecoder::FrameSizeAtIndex(wtf_size_t index) const { +gfx::Size ICOImageDecoder::FrameSizeAtIndex(wtf_size_t index) const { return (index && (index < dir_entries_.size())) ? dir_entries_[index].size_ : Size(); } @@ -77,7 +77,7 @@ // the icon directory. return frame_size_.IsEmpty() ? ImageDecoder::SetSize(width, height) - : ((IntSize(width, height) == frame_size_) || SetFailed()); + : ((gfx::Size(width, height) == frame_size_) || SetFailed()); } bool ICOImageDecoder::FrameIsReceivedAtIndex(wtf_size_t index) const { @@ -205,7 +205,7 @@ bmp_readers_[index]->SetBuffer(&frame_buffer_cache_[index]); frame_size_ = dir_entry.size_; bool result = bmp_readers_[index]->DecodeBMP(false); - frame_size_ = IntSize(); + frame_size_ = gfx::Size(); return result; } @@ -305,7 +305,7 @@ if (!height) height = 256; IconDirectoryEntry entry; - entry.size_ = IntSize(width, height); + entry.size_ = gfx::Size(width, height); if (file_type_ == CURSOR) { entry.bit_count_ = 0; entry.hot_spot_ = gfx::Point(ReadUint16(4), ReadUint16(6));
diff --git a/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h b/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h index a3a02e6..ef2b4cee 100644 --- a/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h
@@ -53,8 +53,8 @@ // ImageDecoder: String FilenameExtension() const override { return "ico"; } void OnSetData(SegmentReader*) override; - IntSize Size() const override; - IntSize FrameSizeAtIndex(wtf_size_t) const override; + gfx::Size Size() const override; + gfx::Size FrameSizeAtIndex(wtf_size_t) const override; bool SetSize(unsigned width, unsigned height) override; bool FrameIsReceivedAtIndex(wtf_size_t) const override; // CAUTION: SetFailed() deletes all readers and decoders. Be careful to @@ -77,7 +77,7 @@ struct IconDirectoryEntry { DISALLOW_NEW(); - IntSize size_; + gfx::Size size_; uint16_t bit_count_; gfx::Point hot_spot_; uint32_t image_offset_; @@ -178,7 +178,7 @@ // Valid only while a BMPImageReader is decoding, this holds the size // for the particular entry being decoded. - IntSize frame_size_; + gfx::Size frame_size_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/image_decoder.cc index 21355a3..7f22fae 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.cc
@@ -376,7 +376,7 @@ decoded_bytes_per_pixel = 8; } - const IntSize size = DecodedSize(); + const gfx::Size size = DecodedSize(); const wtf_size_t decoded_size_bytes = size.width() * size.height() * decoded_bytes_per_pixel; if (decoded_size_bytes > max_decoded_bytes_) { @@ -395,7 +395,7 @@ cc::ImageHeaderMetadata image_metadata{}; image_metadata.image_type = FileExtensionToImageType(FilenameExtension()); image_metadata.yuv_subsampling = GetYUVSubsampling(); - image_metadata.image_size = ToGfxSize(size_); + image_metadata.image_size = size_; image_metadata.has_embedded_color_profile = HasEmbeddedColorProfile(); return image_metadata; } @@ -432,7 +432,7 @@ if (frame->GetStatus() == ImageFrame::kFrameComplete) { BitmapImageMetrics::CountDecodedImageFrameTime( FilenameExtension(), metrics_time_delta_, - frame->OriginalFrameRect().size().Area(), + frame->OriginalFrameRect().size().Area64(), metrics_first_ && (index == 0)); metrics_frame_index_ = kNotFound; metrics_time_delta_ = base::TimeDelta(); @@ -472,7 +472,7 @@ ImageFrame::PixelFormat::kRGBA_F16) { decoded_bytes_per_pixel = 8; } - IntSize size = FrameSizeAtIndex(index); + gfx::Size size = FrameSizeAtIndex(index); base::CheckedNumeric<wtf_size_t> area = size.width(); area *= size.height(); area *= decoded_bytes_per_pixel; @@ -569,7 +569,7 @@ // When this frame spans the entire image rect we can SetHasAlpha to false, // since there are logically no transparent pixels outside of the frame rect. - if (buffer.OriginalFrameRect().Contains(IntRect(gfx::Point(), Size()))) { + if (buffer.OriginalFrameRect().Contains(gfx::Rect(Size()))) { buffer.SetHasAlpha(false); buffer.SetRequiredPreviousFrameIndex(kNotFound); } else if (buffer.RequiredPreviousFrameIndex() != kNotFound) { @@ -650,8 +650,8 @@ ImageFrame::kDisposeOverwriteBgcolor) { // We want to clear the previous frame to transparent, without // affecting pixels in the image outside of the frame. - const IntRect& prev_rect = prev_buffer->OriginalFrameRect(); - DCHECK(!prev_rect.Contains(IntRect(gfx::Point(), Size()))); + const gfx::Rect& prev_rect = prev_buffer->OriginalFrameRect(); + DCHECK(!prev_rect.Contains(gfx::Rect(Size()))); buffer->ZeroFillFrameRect(prev_rect); } } @@ -691,11 +691,12 @@ decoded_bytes_per_pixel = 8; } const uint64_t frame_memory_usage = - DecodedSize().Area() * decoded_bytes_per_pixel; + DecodedSize().Area64() * decoded_bytes_per_pixel; // This condition never fails in the current code. Our existing image decoders // parse for the image size and SetFailed() if that size overflows - DCHECK_EQ(frame_memory_usage / decoded_bytes_per_pixel, DecodedSize().Area()); + DCHECK_EQ(frame_memory_usage / decoded_bytes_per_pixel, + DecodedSize().Area64()); const uint64_t total_memory_usage = frame_memory_usage * index; if (total_memory_usage / frame_memory_usage != index) { // overflow occurred @@ -719,7 +720,7 @@ const ImageFrame* curr_buffer = &frame_buffer_cache_[frame_index]; if ((frame_rect_is_opaque || curr_buffer->GetAlphaBlendSource() == ImageFrame::kBlendAtopBgcolor) && - curr_buffer->OriginalFrameRect().Contains(IntRect(gfx::Point(), Size()))) + curr_buffer->OriginalFrameRect().Contains(gfx::Rect(Size()))) return kNotFound; // The starting state for this frame depends on the previous frame's @@ -752,8 +753,7 @@ // decoded without reference to any prior frame, the starting state for // this frame is a blank frame, so it can again be decoded alone. // Otherwise, the previous frame contributes to this frame. - return (prev_buffer->OriginalFrameRect().Contains( - IntRect(gfx::Point(), Size())) || + return (prev_buffer->OriginalFrameRect().Contains(gfx::Rect(Size())) || (prev_buffer->RequiredPreviousFrameIndex() == kNotFound)) ? kNotFound : prev_frame;
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder.h b/third_party/blink/renderer/platform/image-decoders/image_decoder.h index ee1fd2b..ba37780 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.h
@@ -40,7 +40,6 @@ #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" - #include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/skia/include/core/SkImageInfo.h" #include "third_party/skia/include/third_party/skcms/skcms.h" @@ -250,12 +249,12 @@ bool IsDecodedSizeAvailable() const { return !failed_ && size_available_; } - virtual IntSize Size() const { return size_; } + virtual gfx::Size Size() const { return size_; } virtual Vector<SkISize> GetSupportedDecodeSizes() const { return {}; } // Decoders which downsample images should override this method to // return the actual decoded size. - virtual IntSize DecodedSize() const { return Size(); } + virtual gfx::Size DecodedSize() const { return Size(); } // The YUV subsampling of the image. virtual cc::YUVSubsampling GetYUVSubsampling() const { @@ -264,9 +263,9 @@ // Image decoders that support YUV decoding must override this to // provide the size of each component. - virtual IntSize DecodedYUVSize(cc::YUVIndex) const { + virtual gfx::Size DecodedYUVSize(cc::YUVIndex) const { NOTREACHED(); - return IntSize(); + return gfx::Size(); } // Image decoders that support YUV decoding must override this to @@ -301,7 +300,7 @@ // sizes. This does NOT differ from Size() for GIF or WebP, since // decoding GIF or WebP composites any smaller frames against previous // frames to create full-size frames. - virtual IntSize FrameSizeAtIndex(wtf_size_t) const { return Size(); } + virtual gfx::Size FrameSizeAtIndex(wtf_size_t) const { return Size(); } // Returns whether the size is legal (i.e. not going to result in // overflow elsewhere). If not, marks decoding as failed. @@ -313,7 +312,7 @@ if (SizeCalculationMayOverflow(width, height, decoded_bytes_per_pixel)) return SetFailed(); - size_ = IntSize(width, height); + size_ = gfx::Size(width, height); size_available_ = true; return true; } @@ -353,7 +352,7 @@ virtual wtf_size_t FrameBytesAtIndex(wtf_size_t) const; ImageOrientation Orientation() const { return orientation_; } - IntSize DensityCorrectedSize() const { return density_corrected_size_; } + gfx::Size DensityCorrectedSize() const { return density_corrected_size_; } bool IgnoresColorSpace() const { return color_behavior_.IsIgnore(); } const ColorBehavior& GetColorBehavior() const { return color_behavior_; } @@ -537,7 +536,7 @@ const HighBitDepthDecodingOption high_bit_depth_decoding_option_; const ColorBehavior color_behavior_; ImageOrientation orientation_; - IntSize density_corrected_size_; + gfx::Size density_corrected_size_; // The maximum amount of memory a decoded image should require. Ideally, // image decoders should downsample large images to fit under this limit @@ -603,7 +602,7 @@ // previous frame. This condition is different for GIF and WEBP. virtual bool CanReusePreviousFrameBuffer(wtf_size_t) const { return false; } - IntSize size_; + gfx::Size size_; bool size_available_ = false; bool is_all_data_received_ = false; bool failed_ = false;
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/image_decoder_test.cc index 775445b2..5e556d0f 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder_test.cc
@@ -67,7 +67,7 @@ SetSize(width, height); frame_buffer_cache_.resize(num_frames); for (wtf_size_t i = 0; i < num_frames; ++i) - frame_buffer_cache_[i].SetOriginalFrameRect(IntRect(0, 0, width, height)); + frame_buffer_cache_[i].SetOriginalFrameRect(gfx::Rect(width, height)); } bool ImageIsHighBitDepth() override { return image_is_high_bit_depth_; } @@ -157,7 +157,7 @@ // Partially covering DisposeOverwriteBgcolor previous frame is required by // this frame. - frame_buffers[1].SetOriginalFrameRect(IntRect(50, 50, 50, 50)); + frame_buffers[1].SetOriginalFrameRect(gfx::Rect(50, 50, 50, 50)); decoder->ResetRequiredPreviousFrames(); EXPECT_EQ(1u, frame_buffers[2].RequiredPreviousFrameIndex()); } @@ -181,7 +181,7 @@ EXPECT_EQ(kNotFound, frame_buffers[1].RequiredPreviousFrameIndex()); // ... even if it partially covers. - frame_buffers[0].SetOriginalFrameRect(IntRect(50, 50, 50, 50)); + frame_buffers[0].SetOriginalFrameRect(gfx::Rect(50, 50, 50, 50)); frame_buffers[0].SetDisposalMethod(ImageFrame::kDisposeOverwritePrevious); decoder->ResetRequiredPreviousFrames(); @@ -197,7 +197,7 @@ decoder->InitFrames(3); Vector<ImageFrame, 1>& frame_buffers = decoder->FrameBufferCache(); - frame_buffers[1].SetOriginalFrameRect(IntRect(25, 25, 50, 50)); + frame_buffers[1].SetOriginalFrameRect(gfx::Rect(25, 25, 50, 50)); frame_buffers[2].SetAlphaBlendSource(ImageFrame::kBlendAtopBgcolor); // A full frame with 'blending method == BlendAtopBgcolor' doesn't depend on @@ -213,7 +213,7 @@ // A non-full frame with 'blending method == BlendAtopBgcolor' does depend on // a prior frame. - frame_buffers[2].SetOriginalFrameRect(IntRect(50, 50, 50, 50)); + frame_buffers[2].SetOriginalFrameRect(gfx::Rect(50, 50, 50, 50)); for (int dispose_method = ImageFrame::kDisposeNotSpecified; dispose_method <= ImageFrame::kDisposeOverwritePrevious; ++dispose_method) { @@ -230,7 +230,7 @@ decoder->InitFrames(3); Vector<ImageFrame, 1>& frame_buffers = decoder->FrameBufferCache(); - frame_buffers[1].SetOriginalFrameRect(IntRect(25, 25, 50, 50)); + frame_buffers[1].SetOriginalFrameRect(gfx::Rect(25, 25, 50, 50)); // A full frame that is known to be opaque doesn't depend on any prior frames. for (int dispose_method = ImageFrame::kDisposeNotSpecified; @@ -243,7 +243,7 @@ } // A non-full frame that is known to be opaque does depend on a prior frame. - frame_buffers[2].SetOriginalFrameRect(IntRect(50, 50, 50, 50)); + frame_buffers[2].SetOriginalFrameRect(gfx::Rect(50, 50, 50, 50)); for (int dispose_method = ImageFrame::kDisposeNotSpecified; dispose_method <= ImageFrame::kDisposeOverwritePrevious; ++dispose_method) {
diff --git a/third_party/blink/renderer/platform/image-decoders/image_frame.cc b/third_party/blink/renderer/platform/image-decoders/image_frame.cc index fb32006..737c8cb3 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_frame.cc +++ b/third_party/blink/renderer/platform/image-decoders/image_frame.cc
@@ -32,6 +32,7 @@ #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { @@ -168,11 +169,11 @@ } } -void ImageFrame::ZeroFillFrameRect(const IntRect& rect) { +void ImageFrame::ZeroFillFrameRect(const gfx::Rect& rect) { if (rect.IsEmpty()) return; - bitmap_.eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); + bitmap_.eraseArea(gfx::RectToSkIRect(rect), SkColorSetARGB(0, 0, 0, 0)); SetHasAlpha(true); }
diff --git a/third_party/blink/renderer/platform/image-decoders/image_frame.h b/third_party/blink/renderer/platform/image-decoders/image_frame.h index 5eeaacde4..e83e2f5 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_frame.h +++ b/third_party/blink/renderer/platform/image-decoders/image_frame.h
@@ -27,13 +27,15 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_IMAGE_DECODERS_IMAGE_FRAME_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_IMAGE_DECODERS_IMAGE_FRAME_H_ +#include "base/notreached.h" +#include "base/time/time.h" #include "third_party/blink/public/platform/web_vector.h" -#include "third_party/blink/renderer/platform/geometry/int_rect.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" - +#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColorPriv.h" +#include "ui/gfx/geometry/rect.h" class SkImage; @@ -94,7 +96,7 @@ // These do not touch other metadata, only the raw pixel data. void ClearPixelData(); void ZeroFillPixelData(); - void ZeroFillFrameRect(const IntRect&); + void ZeroFillFrameRect(const gfx::Rect&); // Makes this frame have an independent copy of the provided image's // pixel data, so that modifications in one frame are not reflected in @@ -129,7 +131,7 @@ bool HasAlpha() const { return has_alpha_; } PixelFormat GetPixelFormat() const { return pixel_format_; } - const IntRect& OriginalFrameRect() const { return original_frame_rect_; } + const gfx::Rect& OriginalFrameRect() const { return original_frame_rect_; } Status GetStatus() const { return status_; } base::TimeDelta Duration() const { return duration_; } DisposalMethod GetDisposalMethod() const { return disposal_method_; } @@ -153,7 +155,7 @@ } void SetHasAlpha(bool alpha); void SetPixelFormat(PixelFormat format) { pixel_format_ = format; } - void SetOriginalFrameRect(const IntRect& r) { original_frame_rect_ = r; } + void SetOriginalFrameRect(const gfx::Rect& r) { original_frame_rect_ = r; } void SetStatus(Status); void SetDuration(base::TimeDelta duration) { duration_ = duration; } void SetDisposalMethod(DisposalMethod disposal_method) { @@ -310,7 +312,7 @@ PixelFormat pixel_format_; // This will always just be the entire buffer except for GIF or WebP // frames whose original rect was smaller than the overall image size. - IntRect original_frame_rect_; + gfx::Rect original_frame_rect_; Status status_; base::TimeDelta duration_; DisposalMethod disposal_method_;
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc index d434458..0bd5ea3 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
@@ -47,6 +47,7 @@ #include "third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "ui/gfx/geometry/size_conversions.h" extern "C" { #include <stdio.h> // jpeglib.h needs stdio FILE. @@ -276,11 +277,13 @@ struct DecodedImageMetaData { ImageOrientation orientation; FloatSize resolution; - IntSize size; + gfx::Size size; unsigned resolution_unit { 0 }; }; -static IntSize ExtractDensityCorrectedSize(const DecodedImageMetaData& metadata, const IntSize& physical_size) { +static gfx::Size ExtractDensityCorrectedSize( + const DecodedImageMetaData& metadata, + const gfx::Size& physical_size) { const unsigned kDefaultResolution = 72; const unsigned kresolution_unitDPI = 2; @@ -291,12 +294,12 @@ CHECK(metadata.resolution.height()); // Division by zero is not possible since we check for empty resolution earlier. - FloatSize size_from_resolution( + gfx::SizeF size_from_resolution( physical_size.width() * kDefaultResolution / metadata.resolution.width(), physical_size.height() * kDefaultResolution / metadata.resolution.height()); - if (RoundedIntSize(size_from_resolution) == metadata.size) + if (gfx::ToRoundedSize(size_from_resolution) == metadata.size) return metadata.size; return physical_size; @@ -444,10 +447,10 @@ } } -static IntSize ComputeYUVSize(const jpeg_decompress_struct* info, - int component) { - return IntSize(info->comp_info[component].downsampled_width, - info->comp_info[component].downsampled_height); +static gfx::Size ComputeYUVSize(const jpeg_decompress_struct* info, + int component) { + return gfx::Size(info->comp_info[component].downsampled_width, + info->comp_info[component].downsampled_height); } static wtf_size_t ComputeYUVWidthBytes(const jpeg_decompress_struct* info, @@ -705,7 +708,8 @@ DecodedImageMetaData metadata; ReadImageMetaData(Info(), metadata); decoder_->SetOrientation(metadata.orientation); - decoder_->SetDensityCorrectedSize(ExtractDensityCorrectedSize(metadata, IntSize(info_.output_width, info_.output_height))); + decoder_->SetDensityCorrectedSize(ExtractDensityCorrectedSize( + metadata, gfx::Size(info_.output_width, info_.output_height))); // Allow color management of the decoded RGBA pixels if possible. if (!decoder_->IgnoresColorSpace()) { @@ -912,7 +916,7 @@ jpeg_decompress_struct* Info() { return &info_; } JSAMPARRAY Samples() const { return samples_; } JPEGImageDecoder* Decoder() { return decoder_; } - IntSize UvSize() const { return uv_size_; } + gfx::Size UvSize() const { return uv_size_; } bool HasStartedDecompression() const { return state_ > kJpegStartDecompress; } private: @@ -982,7 +986,7 @@ jstate state_; JSAMPARRAY samples_; - IntSize uv_size_; + gfx::Size uv_size_; }; void error_exit( @@ -1081,7 +1085,7 @@ } void JPEGImageDecoder::SetDecodedSize(unsigned width, unsigned height) { - decoded_size_ = IntSize(width, height); + decoded_size_ = gfx::Size(width, height); } cc::YUVSubsampling JPEGImageDecoder::GetYUVSubsampling() const { @@ -1091,7 +1095,7 @@ return YuvSubsampling(*reader_->Info()); } -IntSize JPEGImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { +gfx::Size JPEGImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { DCHECK(reader_); const jpeg_decompress_struct* info = reader_->Info(); @@ -1273,7 +1277,7 @@ bufferraw[2] = &bufferraw2[24]; // V channel rows (8) int y_height = info->output_height; int v = info->comp_info[0].v_samp_factor; - IntSize uv_size = reader->UvSize(); + gfx::Size uv_size = reader->UvSize(); int uv_height = uv_size.height(); JSAMPROW output_y = static_cast<JSAMPROW>(image_planes->Plane(cc::YUVIndex::kY)); @@ -1351,7 +1355,7 @@ buffer.SetHasAlpha(true); // For JPEGs, the frame always fills the entire image. - buffer.SetOriginalFrameRect(IntRect(gfx::Point(), Size())); + buffer.SetOriginalFrameRect(gfx::Rect(Size())); } #if defined(TURBO_JPEG_RGB_SWIZZLE)
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.h b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.h index 1703084..d9879e9 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.h
@@ -47,10 +47,10 @@ // ImageDecoder: String FilenameExtension() const override { return "jpg"; } void OnSetData(SegmentReader* data) override; - IntSize DecodedSize() const override { return decoded_size_; } + gfx::Size DecodedSize() const override { return decoded_size_; } bool SetSize(unsigned width, unsigned height) override; cc::YUVSubsampling GetYUVSubsampling() const override; - IntSize DecodedYUVSize(cc::YUVIndex) const override; + gfx::Size DecodedYUVSize(cc::YUVIndex) const override; wtf_size_t DecodedYUVWidthBytes(cc::YUVIndex) const override; void DecodeToYUV() override; SkYUVColorSpace GetYUVColorSpace() const override; @@ -70,7 +70,7 @@ orientation_ = orientation; } - void SetDensityCorrectedSize(const IntSize& size) { + void SetDensityCorrectedSize(const gfx::Size& size) { density_corrected_size_ = size; } void SetDecodedSize(unsigned width, unsigned height); @@ -107,7 +107,7 @@ std::unique_ptr<JPEGImageReader> reader_; const wtf_size_t offset_; - IntSize decoded_size_; + gfx::Size decoded_size_; Vector<SkISize> supported_decode_sizes_; };
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc index ab6a4ae..1e839961 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc
@@ -60,7 +60,7 @@ void Downsample(size_t max_decoded_bytes, const char* image_file_path, - const IntSize& expected_size) { + const gfx::Size& expected_size) { scoped_refptr<SharedBuffer> data = ReadFile(image_file_path); ASSERT_TRUE(data); @@ -76,8 +76,8 @@ void ReadYUV(size_t max_decoded_bytes, const char* image_file_path, - const IntSize& expected_y_size, - const IntSize& expected_uv_size, + const gfx::Size& expected_y_size, + const gfx::Size& expected_uv_size, const bool expect_decoding_failure = false) { scoped_refptr<SharedBuffer> data = ReadFile(image_file_path); ASSERT_TRUE(data); @@ -89,11 +89,11 @@ ASSERT_TRUE(decoder->IsSizeAvailable()); ASSERT_TRUE(decoder->CanDecodeToYUV()); - IntSize size = decoder->DecodedSize(); + gfx::Size size = decoder->DecodedSize(); - IntSize y_size = decoder->DecodedYUVSize(cc::YUVIndex::kY); - IntSize u_size = decoder->DecodedYUVSize(cc::YUVIndex::kU); - IntSize v_size = decoder->DecodedYUVSize(cc::YUVIndex::kV); + gfx::Size y_size = decoder->DecodedYUVSize(cc::YUVIndex::kY); + gfx::Size u_size = decoder->DecodedYUVSize(cc::YUVIndex::kU); + gfx::Size v_size = decoder->DecodedYUVSize(cc::YUVIndex::kV); EXPECT_EQ(size, y_size); EXPECT_EQ(u_size, v_size); @@ -141,25 +141,25 @@ const char* jpeg_file = "/images/resources/gracehopper.jpg"; // 256x256 // 1/8 downsample. - Downsample(40 * 40 * 4, jpeg_file, IntSize(32, 32)); + Downsample(40 * 40 * 4, jpeg_file, gfx::Size(32, 32)); // 2/8 downsample. - Downsample(70 * 70 * 4, jpeg_file, IntSize(64, 64)); + Downsample(70 * 70 * 4, jpeg_file, gfx::Size(64, 64)); // 3/8 downsample. - Downsample(100 * 100 * 4, jpeg_file, IntSize(96, 96)); + Downsample(100 * 100 * 4, jpeg_file, gfx::Size(96, 96)); // 4/8 downsample. - Downsample(130 * 130 * 4, jpeg_file, IntSize(128, 128)); + Downsample(130 * 130 * 4, jpeg_file, gfx::Size(128, 128)); // 5/8 downsample. - Downsample(170 * 170 * 4, jpeg_file, IntSize(160, 160)); + Downsample(170 * 170 * 4, jpeg_file, gfx::Size(160, 160)); // 6/8 downsample. - Downsample(200 * 200 * 4, jpeg_file, IntSize(192, 192)); + Downsample(200 * 200 * 4, jpeg_file, gfx::Size(192, 192)); // 7/8 downsample. - Downsample(230 * 230 * 4, jpeg_file, IntSize(224, 224)); + Downsample(230 * 230 * 4, jpeg_file, gfx::Size(224, 224)); } // Tests that JPEG decoder can downsample image whose width and height are not @@ -168,48 +168,49 @@ const char* jpeg_file = "/images/resources/icc-v2-gbr.jpg"; // 275x207 // 1/8 downsample. - Downsample(40 * 40 * 4, jpeg_file, IntSize(35, 26)); + Downsample(40 * 40 * 4, jpeg_file, gfx::Size(35, 26)); // 2/8 downsample. - Downsample(70 * 70 * 4, jpeg_file, IntSize(69, 52)); + Downsample(70 * 70 * 4, jpeg_file, gfx::Size(69, 52)); // 3/8 downsample. - Downsample(100 * 100 * 4, jpeg_file, IntSize(104, 78)); + Downsample(100 * 100 * 4, jpeg_file, gfx::Size(104, 78)); // 4/8 downsample. - Downsample(130 * 130 * 4, jpeg_file, IntSize(138, 104)); + Downsample(130 * 130 * 4, jpeg_file, gfx::Size(138, 104)); // 5/8 downsample. - Downsample(170 * 170 * 4, jpeg_file, IntSize(172, 130)); + Downsample(170 * 170 * 4, jpeg_file, gfx::Size(172, 130)); // 6/8 downsample. - Downsample(200 * 200 * 4, jpeg_file, IntSize(207, 156)); + Downsample(200 * 200 * 4, jpeg_file, gfx::Size(207, 156)); // 7/8 downsample. - Downsample(230 * 230 * 4, jpeg_file, IntSize(241, 182)); + Downsample(230 * 230 * 4, jpeg_file, gfx::Size(241, 182)); } // Tests that upsampling is not allowed. TEST(JPEGImageDecoderTest, upsample) { const char* jpeg_file = "/images/resources/gracehopper.jpg"; // 256x256 - Downsample(kLargeEnoughSize, jpeg_file, IntSize(256, 256)); + Downsample(kLargeEnoughSize, jpeg_file, gfx::Size(256, 256)); } TEST(JPEGImageDecoderTest, yuv) { // This image is 256x256 with YUV 4:2:0 const char* jpeg_file = "/images/resources/gracehopper.jpg"; - ReadYUV(kLargeEnoughSize, jpeg_file, IntSize(256, 256), IntSize(128, 128)); + ReadYUV(kLargeEnoughSize, jpeg_file, gfx::Size(256, 256), + gfx::Size(128, 128)); // Each plane is in its own scan. const char* jpeg_file_non_interleaved = "/images/resources/cs-uma-ycbcr-420-non-interleaved.jpg"; // 64x64 - ReadYUV(kLargeEnoughSize, jpeg_file_non_interleaved, IntSize(64, 64), - IntSize(32, 32)); + ReadYUV(kLargeEnoughSize, jpeg_file_non_interleaved, gfx::Size(64, 64), + gfx::Size(32, 32)); const char* jpeg_file_image_size_not_multiple_of8 = "/images/resources/cropped_mandrill.jpg"; // 439x154 ReadYUV(kLargeEnoughSize, jpeg_file_image_size_not_multiple_of8, - IntSize(439, 154), IntSize(220, 77)); + gfx::Size(439, 154), gfx::Size(220, 77)); // Make sure we revert to RGBA decoding when we're about to downscale, // which can occur on memory-constrained android devices. @@ -227,7 +228,8 @@ // failure but also results in displayable YUV data. TEST(JPEGImageDecoderTest, missingEoi) { const char* jpeg_file = "/images/resources/missing-eoi.jpg"; // 1599x899 - ReadYUV((1599 * 899 * 4), jpeg_file, IntSize(1599, 899), IntSize(800, 450), + ReadYUV((1599 * 899 * 4), jpeg_file, gfx::Size(1599, 899), + gfx::Size(800, 450), /*expect_decoding_failure=*/true); } @@ -431,13 +433,14 @@ bool expected_success = false; BitmapImageMetrics::JpegColorSpace expected_color_space; bool expect_yuv_decoding = false; - IntSize expected_uv_size; + gfx::Size expected_uv_size; }; void PrintTo(const ColorSpaceTestParam& param, std::ostream* os) { *os << "{\"" << param.file << "\", " << param.expected_success << "," << static_cast<int>(param.expected_color_space) << "," - << param.expected_uv_size << "," << param.expect_yuv_decoding << "}"; + << param.expected_uv_size.ToString() << "," << param.expect_yuv_decoding + << "}"; } class ColorSpaceTest : public ::testing::TestWithParam<ColorSpaceTestParam> {}; @@ -475,7 +478,7 @@ if (GetParam().expect_yuv_decoding) { const auto jpeg_file = ("/images/resources/" + GetParam().file); - ReadYUV(kLargeEnoughSize, jpeg_file.c_str(), IntSize(64, 64), + ReadYUV(kLargeEnoughSize, jpeg_file.c_str(), gfx::Size(64, 64), GetParam().expected_uv_size, /*expect_decoding_failure=*/false); } @@ -496,8 +499,8 @@ std::unique_ptr<ImageDecoder> decoder = CreateJPEGDecoder(kLargeEnoughSize); decoder->SetData(data.get(), true); - IntSize size = decoder->DecodedSize(); - EXPECT_EQ(IntSize(64, 64), size); + gfx::Size size = decoder->DecodedSize(); + EXPECT_EQ(gfx::Size(64, 64), size); ASSERT_FALSE(decoder->CanDecodeToYUV()); const ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(0); @@ -533,24 +536,24 @@ {"cs-uma-ycbcr-411.jpg", true, BitmapImageMetrics::JpegColorSpace::kYCbCr411, false}, {"cs-uma-ycbcr-420.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, IntSize(32, 32)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, // Each component is in a separate scan. Should not make a difference. {"cs-uma-ycbcr-420-non-interleaved.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, IntSize(32, 32)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, // 3 components/both JFIF and Adobe markers, so we expect libjpeg_turbo to // guess YCbCr. {"cs-uma-ycbcr-420-both-jfif-adobe.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, IntSize(32, 32)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, {"cs-uma-ycbcr-422.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr422, true, IntSize(32, 64)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr422, true, gfx::Size(32, 64)}, {"cs-uma-ycbcr-440.jpg", true, BitmapImageMetrics::JpegColorSpace::kYCbCr440, false}, {"cs-uma-ycbcr-444.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, IntSize(64, 64)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, gfx::Size(64, 64)}, // Contains RGB data but uses a bad Adobe color transform, so libjpeg_turbo // will guess YCbCr. {"cs-uma-rgb-unknown-transform.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, IntSize(64, 64)}, + BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, gfx::Size(64, 64)}, {"cs-uma-ycbcr-other.jpg", true, BitmapImageMetrics::JpegColorSpace::kYCbCrOther, false}, // Contains only 2 components. We expect the decode to fail and not produce
diff --git a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder_test.cc index 784caad..1cabdd2 100644 --- a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder_test.cc
@@ -127,7 +127,7 @@ EXPECT_NEAR(expected_a, a, eps); } -void TestSize(const char* jxl_file, IntSize expected_size) { +void TestSize(const char* jxl_file, gfx::Size expected_size) { auto decoder = CreateJXLDecoderWithData(jxl_file); EXPECT_TRUE(decoder->IsSizeAvailable()); EXPECT_EQ(expected_size, decoder->Size()); @@ -139,7 +139,7 @@ }; void TestPixel(const char* jxl_file, - IntSize expected_size, + gfx::Size expected_size, const WTF::Vector<FramePoint>& coordinates, const WTF::Vector<SkColor>& expected_colors, ImageDecoder::AlphaOption alpha_option, @@ -202,7 +202,7 @@ // Tests whether the decoder successfully parses the file without errors or // infinite loop in the worst case of the reader returning 1-byte segments. -void TestSegmented(const char* jxl_file, IntSize expected_size) { +void TestSegmented(const char* jxl_file, gfx::Size expected_size) { auto decoder = std::make_unique<JXLImageDecoder>( ImageDecoder::kAlphaNotPremultiplied, ImageDecoder::kDefaultBitDepth, ColorBehavior::Tag(), ImageDecoder::kNoDecodedImageByteLimit); @@ -231,43 +231,43 @@ } TEST(JXLTests, SegmentedTest) { - TestSegmented("/images/resources/jxl/alpha-lossless.jxl", IntSize(2, 10)); - TestSegmented("/images/resources/jxl/3x3_srgb_lossy.jxl", IntSize(3, 3)); + TestSegmented("/images/resources/jxl/alpha-lossless.jxl", gfx::Size(2, 10)); + TestSegmented("/images/resources/jxl/3x3_srgb_lossy.jxl", gfx::Size(3, 3)); TestSegmented("/images/resources/jxl/pq_gradient_icc_lossy.jxl", - IntSize(16, 16)); - TestSegmented("/images/resources/jxl/animated.jxl", IntSize(16, 16)); + gfx::Size(16, 16)); + TestSegmented("/images/resources/jxl/animated.jxl", gfx::Size(16, 16)); } TEST(JXLTests, SizeTest) { - TestSize("/images/resources/jxl/alpha-lossless.jxl", IntSize(2, 10)); + TestSize("/images/resources/jxl/alpha-lossless.jxl", gfx::Size(2, 10)); } TEST(JXLTests, PixelTest) { - TestPixel("/images/resources/jxl/red-10-default.jxl", IntSize(10, 10), + TestPixel("/images/resources/jxl/red-10-default.jxl", gfx::Size(10, 10), {{0, {0, 0}}}, {SkColorSetARGB(255, 255, 0, 0)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/red-10-lossless.jxl", IntSize(10, 10), + TestPixel("/images/resources/jxl/red-10-lossless.jxl", gfx::Size(10, 10), {{0, {0, 1}}}, {SkColorSetARGB(255, 255, 0, 0)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/red-10-container.jxl", IntSize(10, 10), + TestPixel("/images/resources/jxl/red-10-container.jxl", gfx::Size(10, 10), {{0, {1, 0}}}, {SkColorSetARGB(255, 255, 0, 0)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/green-10-lossless.jxl", IntSize(10, 10), + TestPixel("/images/resources/jxl/green-10-lossless.jxl", gfx::Size(10, 10), {{0, {2, 3}}}, {SkColorSetARGB(255, 0, 255, 0)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/blue-10-lossless.jxl", IntSize(10, 10), + TestPixel("/images/resources/jxl/blue-10-lossless.jxl", gfx::Size(10, 10), {{0, {9, 9}}}, {SkColorSetARGB(255, 0, 0, 255)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/alpha-lossless.jxl", IntSize(2, 10), + TestPixel("/images/resources/jxl/alpha-lossless.jxl", gfx::Size(2, 10), {{0, {0, 1}}}, {SkColorSetARGB(0, 255, 255, 255)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(), 0); - TestPixel("/images/resources/jxl/alpha-lossless.jxl", IntSize(2, 10), + TestPixel("/images/resources/jxl/alpha-lossless.jxl", gfx::Size(2, 10), {{0, {0, 1}}}, {SkColorSetARGB(0, 0, 0, 0)}, ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::Tag(), 0); @@ -277,7 +277,7 @@ {0, {2, 1}}, {0, {0, 2}}, {0, {1, 2}}, {0, {2, 2}}, }; - TestPixel("/images/resources/jxl/3x3_srgb_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_srgb_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -293,7 +293,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 0); - TestPixel("/images/resources/jxl/3x3_srgb_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_srgb_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -309,7 +309,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 15); - TestPixel("/images/resources/jxl/3x3a_srgb_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_srgb_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -325,7 +325,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 0); - TestPixel("/images/resources/jxl/3x3a_srgb_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_srgb_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -342,7 +342,7 @@ ColorBehavior::TransformToSRGB(), 15); // Lossless, but allow some inaccuracy due to the color profile conversion. - TestPixel("/images/resources/jxl/3x3_gbr_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_gbr_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 0, 255, 0), @@ -358,7 +358,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 3); - TestPixel("/images/resources/jxl/3x3_gbr_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_gbr_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 0, 255, 0), @@ -375,7 +375,7 @@ ColorBehavior::TransformToSRGB(), 35); // Lossless, but allow some inaccuracy due to the color profile conversion. - TestPixel("/images/resources/jxl/3x3a_gbr_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_gbr_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 0, 255, 0), @@ -391,7 +391,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 3); - TestPixel("/images/resources/jxl/3x3a_gbr_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_gbr_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 0, 255, 0), @@ -408,7 +408,7 @@ ColorBehavior::TransformToSRGB(), 35); // Lossless, but allow some inaccuracy due to the color profile conversion. - TestPixel("/images/resources/jxl/3x3_pq_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_pq_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -424,7 +424,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 2); - TestPixel("/images/resources/jxl/3x3_pq_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_pq_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -440,7 +440,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 15); - TestPixel("/images/resources/jxl/3x3a_pq_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_pq_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -456,7 +456,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 2); - TestPixel("/images/resources/jxl/3x3a_pq_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_pq_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -472,7 +472,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 2); - TestPixel("/images/resources/jxl/3x3_hlg_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_hlg_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -488,7 +488,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 15); - TestPixel("/images/resources/jxl/3x3_hlg_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3_hlg_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(255, 255, 0, 0), @@ -504,7 +504,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 15); - TestPixel("/images/resources/jxl/3x3a_hlg_lossless.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_hlg_lossless.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -520,7 +520,7 @@ ImageDecoder::AlphaOption::kAlphaPremultiplied, ColorBehavior::TransformToSRGB(), 6); - TestPixel("/images/resources/jxl/3x3a_hlg_lossy.jxl", IntSize(3, 3), + TestPixel("/images/resources/jxl/3x3a_hlg_lossy.jxl", gfx::Size(3, 3), coordinates_3x3, { SkColorSetARGB(128, 255, 0, 0), @@ -550,7 +550,7 @@ TEST(JXLTests, AnimatedPixelTest) { TestPixel( - "/images/resources/jxl/animated.jxl", IntSize(16, 16), + "/images/resources/jxl/animated.jxl", gfx::Size(16, 16), {{0, {0, 0}}, {1, {0, 0}}}, {SkColorSetARGB(255, 204, 0, 153), SkColorSetARGB(255, 0, 102, 102)}, ImageDecoder::AlphaOption::kAlphaNotPremultiplied, ColorBehavior::Tag(),
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc index 13724ef..be1f9568 100644 --- a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder.cc
@@ -147,7 +147,7 @@ if (decode_to_half_float_) buffer.SetPixelFormat(ImageFrame::PixelFormat::kRGBA_F16); - DCHECK(IntRect(gfx::Point(), Size()).Contains(frame_info.frame_rect)); + DCHECK(gfx::Rect(Size()).Contains(frame_info.frame_rect)); buffer.SetOriginalFrameRect(frame_info.frame_rect); buffer.SetDuration(base::Milliseconds(frame_info.duration)); @@ -532,7 +532,7 @@ png_get_interlace_type(png, reader_->InfoPtr())) { unsigned color_channels = has_alpha_channel_ ? 4 : 3; base::CheckedNumeric<int> interlace_buffer_size = color_channels; - interlace_buffer_size *= Size().Area(); + interlace_buffer_size *= Size().GetCheckedArea(); if (decode_to_half_float_) interlace_buffer_size *= 2; if (!interlace_buffer_size.IsValid()) { @@ -547,8 +547,8 @@ current_buffer_saw_alpha_ = false; } - const IntRect& frame_rect = buffer.OriginalFrameRect(); - DCHECK(IntRect(gfx::Point(), Size()).Contains(frame_rect)); + const gfx::Rect& frame_rect = buffer.OriginalFrameRect(); + DCHECK(gfx::Rect(Size()).Contains(frame_rect)); /* libpng comments (here to explain what follows). *
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc index aaeab266..b31122b 100644 --- a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc
@@ -63,7 +63,7 @@ return decoder; } -void TestSize(const char* png_file, IntSize expected_size) { +void TestSize(const char* png_file, gfx::Size expected_size) { auto decoder = CreatePNGDecoderWithPngData(png_file); EXPECT_TRUE(decoder->IsSizeAvailable()); EXPECT_EQ(expected_size, decoder->Size()); @@ -73,7 +73,7 @@ // data byte by byte. void TestSizeByteByByte(const char* png_file, size_t bytes_needed_to_decode_size, - IntSize expected_size) { + gfx::Size expected_size) { auto decoder = CreatePNGDecoder(); scoped_refptr<SharedBuffer> data = ReadFile(png_file); ASSERT_FALSE(data->IsEmpty()); @@ -114,7 +114,7 @@ struct PublicFrameInfo { base::TimeDelta duration; - IntRect frame_rect; + gfx::Rect frame_rect; ImageFrame::AlphaBlendSource alpha_blend; ImageFrame::DisposalMethod disposal_method; }; @@ -123,19 +123,19 @@ // web_tests/images/resources/png-animated-idat-part-of-animation.png static PublicFrameInfo g_png_animated_frame_info[] = { {base::Milliseconds(500), - {gfx::Point(0, 0), IntSize(5, 5)}, + {gfx::Point(0, 0), gfx::Size(5, 5)}, ImageFrame::kBlendAtopBgcolor, ImageFrame::kDisposeKeep}, {base::Milliseconds(900), - {gfx::Point(1, 1), IntSize(3, 1)}, + {gfx::Point(1, 1), gfx::Size(3, 1)}, ImageFrame::kBlendAtopBgcolor, ImageFrame::kDisposeOverwriteBgcolor}, {base::Milliseconds(2000), - {gfx::Point(1, 2), IntSize(3, 2)}, + {gfx::Point(1, 2), gfx::Size(3, 2)}, ImageFrame::kBlendAtopPreviousFrame, ImageFrame::kDisposeKeep}, {base::Milliseconds(1500), - {gfx::Point(1, 2), IntSize(3, 1)}, + {gfx::Point(1, 2), gfx::Size(3, 1)}, ImageFrame::kBlendAtopBgcolor, ImageFrame::kDisposeKeep}, }; @@ -277,11 +277,11 @@ TestSize( "/images/resources/" "png-animated-idat-part-of-animation.png", - IntSize(5, 5)); + gfx::Size(5, 5)); TestSize( "/images/resources/" "png-animated-idat-not-part-of-animation.png", - IntSize(227, 35)); + gfx::Size(227, 35)); } TEST(AnimatedPNGTests, repetitionCountTest) { @@ -330,11 +330,11 @@ TestSizeByteByByte( "/images/resources/" "png-animated-idat-part-of-animation.png", - 141u, IntSize(5, 5)); + 141u, gfx::Size(5, 5)); TestSizeByteByByte( "/images/resources/" "png-animated-idat-not-part-of-animation.png", - 79u, IntSize(227, 35)); + 79u, gfx::Size(227, 35)); } TEST(AnimatedPNGTests, ByteByByteMetaData) { @@ -703,7 +703,7 @@ decoder->SetData(modified_data, true); - IntSize expected_size(5, 5); + gfx::Size expected_size(5, 5); EXPECT_TRUE(decoder->IsSizeAvailable()); EXPECT_EQ(expected_size, decoder->Size()); @@ -955,7 +955,7 @@ frame = decoder->DecodeFrameBufferAtIndex(1); ASSERT_TRUE(frame); ASSERT_FALSE(decoder->Failed()); - ASSERT_NE(IntRect({}, decoder->Size()), frame->OriginalFrameRect()); + ASSERT_NE(gfx::Rect(decoder->Size()), frame->OriginalFrameRect()); ASSERT_EQ(kNotFound, frame->RequiredPreviousFrameIndex()); const auto hash = HashBitmap(frame->Bitmap()); @@ -1076,7 +1076,7 @@ } TEST(StaticPNGTests, sizeTest) { - TestSize("/images/resources/png-simple.png", IntSize(111, 29)); + TestSize("/images/resources/png-simple.png", gfx::Size(111, 29)); } TEST(StaticPNGTests, MetaDataTest) { @@ -1119,7 +1119,7 @@ ASSERT_TRUE(decoder->IsSizeAvailable()); ASSERT_TRUE(decoder->IsDecodedSizeAvailable()); - IntSize size(2, 2); + gfx::Size size(2, 2); ASSERT_EQ(size, decoder->Size()); ASSERT_EQ(size, decoder->DecodedSize()); ASSERT_EQ(true, decoder->ImageIsHighBitDepth()); @@ -1331,7 +1331,7 @@ TEST(StaticPNGTests, ImageIsHighBitDepth) { const bool include_8bit_pngs = true; Vector<PNGSample> png_samples = GetPNGSamplesInfo(include_8bit_pngs); - IntSize size(2, 2); + gfx::Size size(2, 2); String path = "/images/resources/png-16bit/"; for (PNGSample& png_sample : png_samples) {
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.cc b/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.cc index a6b58f89..9a352c3f0 100644 --- a/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.cc +++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.cc
@@ -140,7 +140,7 @@ return true; const bool first_frame_decode_in_progress = progressive_decode_offset_; const bool frame_size_matches_ihdr = - frame_info_[index].frame_rect == IntRect(0, 0, width_, height_); + frame_info_[index].frame_rect == gfx::Rect(0, 0, width_, height_); if (index) return first_frame_decode_in_progress || !frame_size_matches_ihdr; return !first_frame_decode_in_progress && !frame_size_matches_ihdr; @@ -202,8 +202,8 @@ DCHECK_GT(ihdr_offset_, initial_offset_); ProcessData(reader, initial_offset_, ihdr_offset_ - initial_offset_); - const IntRect& frame_rect = frame_info_[index].frame_rect; - if (frame_rect == IntRect(0, 0, width_, height_)) { + const gfx::Rect& frame_rect = frame_info_[index].frame_rect; + if (frame_rect == gfx::Rect(0, 0, width_, height_)) { DCHECK_GT(idat_offset_, ihdr_offset_); ProcessData(reader, ihdr_offset_, idat_offset_ - ihdr_offset_); return; @@ -384,7 +384,7 @@ // This should never be read in this case, but initialize just in case. frame.byte_length = kFirstFrameIndicator; frame.duration = 0; - frame.frame_rect = IntRect(0, 0, width_, height_); + frame.frame_rect = gfx::Rect(0, 0, width_, height_); frame.disposal_method = ImageFrame::DisposalMethod::kDisposeKeep; frame.alpha_blend = ImageFrame::AlphaBlendSource::kBlendAtopBgcolor; DCHECK(frame_info_.IsEmpty()); @@ -623,7 +623,7 @@ chunk = ReadAsConstPngBytep(reader, read_offset_ + 8, length, read_buffer); if (!ParseFrameInfo(chunk) || - new_frame_.frame_rect != IntRect(0, 0, width_, height_)) { + new_frame_.frame_rect != gfx::Rect(0, 0, width_, height_)) { ignore_animation_ = true; continue; } @@ -704,7 +704,7 @@ } new_frame_.frame_rect = - IntRect(x_offset, y_offset, frame_width, frame_height); + gfx::Rect(x_offset, y_offset, frame_width, frame_height); if (delay_denominator) new_frame_.duration = delay_numerator * 1000 / delay_denominator;
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.h b/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.h index 371a2ee..644b3fe 100644 --- a/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.h +++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_reader.h
@@ -67,7 +67,7 @@ // The number of bytes that contain frame data, starting at start_offset. wtf_size_t byte_length; wtf_size_t duration; - IntRect frame_rect; + gfx::Rect frame_rect; ImageFrame::DisposalMethod disposal_method; ImageFrame::AlphaBlendSource alpha_blend; };
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc index e209217..93e2f5e 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.cc
@@ -46,8 +46,8 @@ // Returns two point ranges (<left, width> pairs) at row |canvasY| which belong // to |src| but not |dst|. A range is empty if its width is 0. -inline void findBlendRangeAtRow(const blink::IntRect& src, - const blink::IntRect& dst, +inline void findBlendRangeAtRow(const gfx::Rect& src, + const gfx::Rect& dst, int canvasY, int& left1, int& width1, @@ -399,7 +399,7 @@ buffer.RequiredPreviousFrameIndex(); if (required_previous_frame_index == kNotFound) { frame_background_has_alpha_ = - !buffer.OriginalFrameRect().Contains(IntRect(gfx::Point(), Size())); + !buffer.OriginalFrameRect().Contains(gfx::Rect(Size())); } else { const ImageFrame& prev_buffer = frame_buffer_cache_[required_previous_frame_index]; @@ -439,17 +439,17 @@ } } -IntSize WEBPImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { +gfx::Size WEBPImageDecoder::DecodedYUVSize(cc::YUVIndex index) const { DCHECK(IsDecodedSizeAvailable()); switch (index) { case cc::YUVIndex::kY: return Size(); case cc::YUVIndex::kU: case cc::YUVIndex::kV: - return IntSize((Size().width() + 1) / 2, (Size().height() + 1) / 2); + return gfx::Size((Size().width() + 1) / 2, (Size().height() + 1) / 2); } NOTREACHED(); - return IntSize(0, 0); + return gfx::Size(0, 0); } wtf_size_t WEBPImageDecoder::DecodedYUVWidthBytes(cc::YUVIndex index) const { @@ -533,7 +533,7 @@ if (decoded_height <= 0) return; - const IntRect& frame_rect = buffer.OriginalFrameRect(); + const gfx::Rect& frame_rect = buffer.OriginalFrameRect(); SECURITY_DCHECK(width == frame_rect.width()); SECURITY_DCHECK(decoded_height <= frame_rect.height()); const int left = frame_rect.x(); @@ -586,7 +586,7 @@ blend_function_(buffer, prev_buffer, top + y, left, width); } } else if (prev_disposal_method == ImageFrame::kDisposeOverwriteBgcolor) { - const IntRect& prev_rect = prev_buffer.OriginalFrameRect(); + const gfx::Rect& prev_rect = prev_buffer.OriginalFrameRect(); // We need to blend a transparent pixel with the starting value (from just // after the InitFrame() call). If the pixel belongs to prev_rect, the // starting value was fully transparent, so this is a no-op. Otherwise, we @@ -625,10 +625,9 @@ WebPDemuxGetFrame(demux_, index + 1, &animated_frame); DCHECK_EQ(animated_frame.complete, 1); ImageFrame* buffer = &frame_buffer_cache_[index]; - IntRect frame_rect(animated_frame.x_offset, animated_frame.y_offset, - animated_frame.width, animated_frame.height); - buffer->SetOriginalFrameRect( - IntersectRects(frame_rect, IntRect(gfx::Point(), Size()))); + gfx::Rect frame_rect(animated_frame.x_offset, animated_frame.y_offset, + animated_frame.width, animated_frame.height); + buffer->SetOriginalFrameRect(IntersectRects(frame_rect, gfx::Rect(Size()))); buffer->SetDuration(base::Milliseconds(animated_frame.duration)); buffer->SetDisposalMethod(animated_frame.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND @@ -762,10 +761,10 @@ // is loading. The correct alpha value for the frame will be set when // it is fully decoded. buffer.SetHasAlpha(true); - buffer.SetOriginalFrameRect(IntRect(gfx::Point(), Size())); + buffer.SetOriginalFrameRect(gfx::Rect(Size())); } - const IntRect& frame_rect = buffer.OriginalFrameRect(); + const gfx::Rect& frame_rect = buffer.OriginalFrameRect(); if (!decoder_) { // Set up decoder_buffer_ with output mode WebPInitDecBuffer(&decoder_buffer_);
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.h b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.h index 4384427..fdb670d 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder.h
@@ -102,7 +102,7 @@ bool frame_background_has_alpha_; // Provides the size of each component. - IntSize DecodedYUVSize(cc::YUVIndex) const override; + gfx::Size DecodedYUVSize(cc::YUVIndex) const override; // Returns the width of each row of the memory allocation. wtf_size_t DecodedYUVWidthBytes(cc::YUVIndex) const override;
diff --git a/third_party/blink/renderer/platform/network/network_utils_test.cc b/third_party/blink/renderer/platform/network/network_utils_test.cc index b206ecfb..381ab9a1 100644 --- a/third_party/blink/renderer/platform/network/network_utils_test.cc +++ b/third_party/blink/renderer/platform/network/network_utils_test.cc
@@ -51,7 +51,7 @@ for (int i = 0; i < 256; i++) { net::IPAddress address(i, 0, 0, 1); std::string address_string = address.ToString(); - if (i == 0 || i == 10 || i == 127 || i > 223) { + if (i == 0 || i == 10 || i == 127 || i == 192 || i > 223) { EXPECT_TRUE(network_utils::IsReservedIPAddress( String::FromUTF8(address_string.data(), address_string.length()))); } else {
diff --git a/third_party/blink/renderer/platform/scheduler/common/idle_helper.cc b/third_party/blink/renderer/platform/scheduler/common/idle_helper.cc index bd4720b..74ae47d 100644 --- a/third_party/blink/renderer/platform/scheduler/common/idle_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/common/idle_helper.cc
@@ -84,7 +84,7 @@ return IdlePeriodState::kNotInIdlePeriod; } - auto wake_up = helper_->GetNextDelayedWakeUp(); + auto wake_up = helper_->GetNextWakeUp(); base::TimeDelta long_idle_period_duration;
diff --git a/third_party/blink/renderer/platform/scheduler/common/idle_helper_unittest.cc b/third_party/blink/renderer/platform/scheduler/common/idle_helper_unittest.cc index a86bcbc..752f74a 100644 --- a/third_party/blink/renderer/platform/scheduler/common/idle_helper_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/common/idle_helper_unittest.cc
@@ -656,7 +656,7 @@ // There shouldn't be any delayed tasks posted by the idle helper when paused. base::sequence_manager::LazyNow lazy_now_1( test_task_runner_->GetMockTickClock()); - EXPECT_FALSE(scheduler_helper_->GetNextDelayedWakeUp()); + EXPECT_FALSE(scheduler_helper_->GetNextWakeUp()); // Posting a task should transition us to the an active state. g_max_idle_task_reposts = 2; @@ -678,7 +678,7 @@ CheckIdlePeriodStateIs("in_long_idle_period_paused"); base::sequence_manager::LazyNow lazy_now_2( test_task_runner_->GetMockTickClock()); - EXPECT_FALSE(scheduler_helper_->GetNextDelayedWakeUp()); + EXPECT_FALSE(scheduler_helper_->GetNextWakeUp()); idle_helper_->EndIdlePeriod(); CheckIdlePeriodStateIs("not_in_idle_period");
diff --git a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.cc b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.cc index 3af09660..738e278a 100644 --- a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.cc +++ b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.cc
@@ -123,11 +123,11 @@ sequence_manager_->ReclaimMemory(); } -absl::optional<base::sequence_manager::DelayedWakeUp> -SchedulerHelper::GetNextDelayedWakeUp() const { +absl::optional<base::sequence_manager::WakeUp> SchedulerHelper::GetNextWakeUp() + const { CheckOnValidThread(); DCHECK(sequence_manager_); - return sequence_manager_->GetNextDelayedWakeUp(); + return sequence_manager_->GetNextWakeUp(); } void SchedulerHelper::SetTimeDomain(
diff --git a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h index cced801..451333d 100644 --- a/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h +++ b/third_party/blink/renderer/platform/scheduler/common/scheduler_helper.h
@@ -102,8 +102,7 @@ void ReclaimMemory(); // Accessor methods. - absl::optional<base::sequence_manager::DelayedWakeUp> GetNextDelayedWakeUp() - const; + absl::optional<base::sequence_manager::WakeUp> GetNextWakeUp() const; void SetTimeDomain(base::sequence_manager::TimeDomain* time_domain); void ResetTimeDomain(); bool GetAndClearSystemIsQuiescentBit();
diff --git a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.cc b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.cc index 43c602d4..db42ee4 100644 --- a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.cc +++ b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.cc
@@ -65,10 +65,10 @@ return throttling_ref_count_ > 0; } -absl::optional<base::sequence_manager::DelayedWakeUp> +absl::optional<base::sequence_manager::WakeUp> TaskQueueThrottler::GetNextAllowedWakeUpImpl( LazyNow* lazy_now, - absl::optional<base::sequence_manager::DelayedWakeUp> next_wake_up, + absl::optional<base::sequence_manager::WakeUp> next_wake_up, bool has_ready_task) { DCHECK(IsThrottled()); DCHECK(task_queue_->IsQueueEnabled()); @@ -82,7 +82,7 @@ if (!allowed_run_time.is_null()) { // WakeUpResolution::kLow is always used for throttled tasks since those // tasks can tolerate having their execution being delayed. - return base::sequence_manager::DelayedWakeUp{ + return base::sequence_manager::WakeUp{ allowed_run_time, base::sequence_manager::WakeUpResolution::kLow}; } } @@ -95,7 +95,7 @@ if (allowed_run_time.is_null()) allowed_run_time = desired_run_time; - return base::sequence_manager::DelayedWakeUp{ + return base::sequence_manager::WakeUp{ allowed_run_time, base::sequence_manager::WakeUpResolution::kLow}; } @@ -109,17 +109,16 @@ if (CanRunTasksAt(lazy_now.Now())) { UpdateFence(lazy_now.Now()); } else { - task_queue_->UpdateDelayedWakeUp(&lazy_now); + task_queue_->UpdateWakeUp(&lazy_now); } } -absl::optional<base::sequence_manager::DelayedWakeUp> +absl::optional<base::sequence_manager::WakeUp> TaskQueueThrottler::GetNextAllowedWakeUp( LazyNow* lazy_now, - absl::optional<base::sequence_manager::DelayedWakeUp> next_desired_wake_up, + absl::optional<base::sequence_manager::WakeUp> next_desired_wake_up, bool has_ready_task) { - TRACE_EVENT0("renderer.scheduler", - "TaskQueueThrottler::OnNextDelayedWakeUpChanged"); + TRACE_EVENT0("renderer.scheduler", "TaskQueueThrottler::OnNextWakeUpChanged"); return GetNextAllowedWakeUpImpl(lazy_now, next_desired_wake_up, has_ready_task); @@ -161,7 +160,7 @@ TRACE_EVENT_INSTANT("renderer.scheduler", "TaskQueueThrottler::InsertFence"); } - task_queue_->UpdateDelayedWakeUp(&lazy_now); + task_queue_->UpdateWakeUp(&lazy_now); } void TaskQueueThrottler::OnWakeUp(base::sequence_manager::LazyNow* lazy_now) {
diff --git a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h index c56289a..d38c356 100644 --- a/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h +++ b/third_party/blink/renderer/platform/scheduler/common/throttling/task_queue_throttler.h
@@ -98,16 +98,15 @@ base::TimeTicks GetTimeTasksCanRunUntil(base::TimeTicks now) const; // See GetNextAllowedWakeUp(). - absl::optional<base::sequence_manager::DelayedWakeUp> - GetNextAllowedWakeUpImpl( + absl::optional<base::sequence_manager::WakeUp> GetNextAllowedWakeUpImpl( base::sequence_manager::LazyNow* lazy_now, - absl::optional<base::sequence_manager::DelayedWakeUp> next_wake_up, + absl::optional<base::sequence_manager::WakeUp> next_wake_up, bool has_ready_task); // TaskQueue::Throttler implementation: - absl::optional<base::sequence_manager::DelayedWakeUp> GetNextAllowedWakeUp( + absl::optional<base::sequence_manager::WakeUp> GetNextAllowedWakeUp( base::sequence_manager::LazyNow* lazy_now, - absl::optional<base::sequence_manager::DelayedWakeUp> next_wake_up, + absl::optional<base::sequence_manager::WakeUp> next_wake_up, bool has_ready_task) override; void OnWakeUp(base::sequence_manager::LazyNow* lazy_now) override; void OnHasImmediateTask() override;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.cc b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.cc index 4845ae1..04a5085b 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.cc
@@ -57,7 +57,7 @@ } base::TimeTicks AutoAdvancingVirtualTimeDomain::GetNextDelayedTaskTime( - base::sequence_manager::DelayedWakeUp next_wake_up, + base::sequence_manager::WakeUp next_wake_up, base::sequence_manager::LazyNow* lazy_now) const { // We may have advanced virtual time past the next task when a // WebScopedVirtualTimePauser unpauses. @@ -70,7 +70,7 @@ } bool AutoAdvancingVirtualTimeDomain::MaybeFastForwardToWakeUp( - absl::optional<base::sequence_manager::DelayedWakeUp> wakeup, + absl::optional<base::sequence_manager::WakeUp> wakeup, bool quit_when_idle_requested) { if (!can_advance_virtual_time_) return false; @@ -146,7 +146,7 @@ // Delayed tasks are being excessively starved, so allow virtual time to // advance. - auto wake_up = helper_->GetNextDelayedWakeUp(); + auto wake_up = helper_->GetNextWakeUp(); if (wake_up && MaybeAdvanceVirtualTime(wake_up->time)) task_starvation_count_ = 0; }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.h b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.h index aa195f3..11162dd 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain.h
@@ -71,10 +71,10 @@ // TimeDomain implementation: base::TimeTicks GetNextDelayedTaskTime( - base::sequence_manager::DelayedWakeUp delayed_wakeup, + base::sequence_manager::WakeUp delayed_wakeup, base::sequence_manager::LazyNow* lazy_now) const override; bool MaybeFastForwardToWakeUp( - absl::optional<base::sequence_manager::DelayedWakeUp> wakeup, + absl::optional<base::sequence_manager::WakeUp> wakeup, bool quit_when_idle_requested) override; protected:
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc index 5e542b4..ea20449 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/auto_advancing_virtual_time_domain_unittest.cc
@@ -188,10 +188,10 @@ base::Milliseconds(100)); // Task at t+10ms should be run immediately. - EXPECT_TRUE(auto_advancing_time_domain_ - ->GetNextDelayedTaskTime( - *sequence_manager_->GetNextDelayedWakeUp(), nullptr) - .is_null()); + EXPECT_TRUE( + auto_advancing_time_domain_ + ->GetNextDelayedTaskTime(*sequence_manager_->GetNextWakeUp(), nullptr) + .is_null()); } } // namespace auto_advancing_virtual_time_domain_unittest
diff --git a/third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h b/third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h index 27601bb..a690bd0 100644 --- a/third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h +++ b/third_party/blink/renderer/platform/testing/fake_graphics_layer_client.h
@@ -16,12 +16,12 @@ public GraphicsLayerClient { public: // GraphicsLayerClient implementation. - IntRect ComputeInterestRect(const GraphicsLayer*, - const IntRect&) const override { - return IntRect(); + gfx::Rect ComputeInterestRect(const GraphicsLayer*, + const gfx::Rect&) const override { + return gfx::Rect(); } - IntRect PaintableRegion(const GraphicsLayer*) const override { - return IntRect(); + gfx::Rect PaintableRegion(const GraphicsLayer*) const override { + return gfx::Rect(); } PaintArtifactCompositor* GetPaintArtifactCompositor() override { return nullptr; @@ -36,7 +36,7 @@ void PaintContents(const GraphicsLayer* layer, GraphicsContext& context, GraphicsLayerPaintingPhase phase, - const IntRect& rect) const override { + const gfx::Rect& rect) const override { if (painter_) painter_(layer, context, phase, rect); } @@ -50,7 +50,7 @@ using Painter = std::function<void(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, - const IntRect&)>; + const gfx::Rect&)>; void SetPainter(const Painter& painter) { painter_ = painter; } void Trace(Visitor* visitor) const override {
diff --git a/third_party/blink/renderer/platform/testing/picture_matchers.cc b/third_party/blink/renderer/platform/testing/picture_matchers.cc index ae212d3..adaa8a24 100644 --- a/third_party/blink/renderer/platform/testing/picture_matchers.cc +++ b/third_party/blink/renderer/platform/testing/picture_matchers.cc
@@ -6,12 +6,12 @@ #include <utility> -#include "third_party/blink/renderer/platform/geometry/float_quad.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPicture.h" +#include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/skia_conversions.h" namespace blink { @@ -33,10 +33,10 @@ SkRect device_rect; device_rect.setBounds(quad, 4); SkIRect device_clip_bounds; - FloatRect clipped_rect; + gfx::RectF clipped_rect; if (getDeviceClipBounds(&device_clip_bounds) && device_rect.intersect(SkRect::Make(device_clip_bounds))) - clipped_rect = device_rect; + clipped_rect = gfx::SkRectToRectF(device_rect); unsigned paint_alpha = static_cast<unsigned>(paint.getAlpha()); SkPaint paint_with_alpha(paint); @@ -101,12 +101,12 @@ const auto& actual_rect_with_color = actual_rects[index]; const auto& expect_rect_with_color = rects_with_color_[index]; - if (EnclosingIntRect(actual_rect_with_color.rect) != - EnclosingIntRect(expect_rect_with_color.rect) || + if (gfx::ToEnclosingRect(actual_rect_with_color.rect) != + gfx::ToEnclosingRect(expect_rect_with_color.rect) || actual_rect_with_color.color != expect_rect_with_color.color) { if (listener->IsInterested()) { *listener << "at index " << index << " which draws " - << actual_rect_with_color.rect << " with color " + << actual_rect_with_color.rect.ToString() << " with color " << actual_rect_with_color.color.Serialized() << "\n"; } return false; @@ -120,8 +120,9 @@ *os << "\n"; for (unsigned index = 0; index < rects_with_color_.size(); index++) { const auto& rect_with_color = rects_with_color_[index]; - *os << "at index " << index << " rect draws " << rect_with_color.rect - << " with color " << rect_with_color.color.Serialized() << "\n"; + *os << "at index " << index << " rect draws " + << rect_with_color.rect.ToString() << " with color " + << rect_with_color.color.Serialized() << "\n"; } } @@ -131,7 +132,7 @@ } // namespace -testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect& rect, +testing::Matcher<const SkPicture&> DrawsRectangle(const gfx::RectF& rect, Color color) { Vector<RectWithColor> rects_with_color; rects_with_color.push_back(RectWithColor(rect, color));
diff --git a/third_party/blink/renderer/platform/testing/picture_matchers.h b/third_party/blink/renderer/platform/testing/picture_matchers.h index f9758ac..76d1992 100644 --- a/third_party/blink/renderer/platform/testing/picture_matchers.h +++ b/third_party/blink/renderer/platform/testing/picture_matchers.h
@@ -6,27 +6,25 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_PICTURE_MATCHERS_H_ #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/color.h" +#include "ui/gfx/geometry/rect_f.h" class SkPicture; namespace blink { -class FloatRect; - // Matches if the picture draws exactly one rectangle, which (after accounting // for the total transformation matrix and applying any clips inside that // transform) matches the rect provided, and whose paint has the color // requested. // Note that clips which appear outside of a transform are not currently // supported. -testing::Matcher<const SkPicture&> DrawsRectangle(const FloatRect&, Color); +testing::Matcher<const SkPicture&> DrawsRectangle(const gfx::RectF&, Color); struct RectWithColor { - RectWithColor(const FloatRect& rect_arg, const Color& color_arg) + RectWithColor(const gfx::RectF& rect_arg, const Color& color_arg) : rect(rect_arg), color(color_arg) {} - FloatRect rect; + gfx::RectF rect; Color color; };
diff --git a/third_party/blink/renderer/platform/timer_test.cc b/third_party/blink/renderer/platform/timer_test.cc index 55d1db45..7ae3f7c5 100644 --- a/third_party/blink/renderer/platform/timer_test.cc +++ b/third_party/blink/renderer/platform/timer_test.cc
@@ -64,7 +64,7 @@ base::sequence_manager::LazyNow lazy_now(platform_->NowTicks()); auto wake_up = platform_->GetMainThreadScheduler() ->GetSchedulerHelperForTesting() - ->GetNextDelayedWakeUp(); + ->GetNextWakeUp(); if (!wake_up) return false; *time = wake_up->time - lazy_now.Now();
diff --git a/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.cc b/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.cc index 0ff43c13..a28a557 100644 --- a/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.cc +++ b/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.cc
@@ -43,7 +43,7 @@ void InterpolatedTransformOperation::Apply( TransformationMatrix& transform, - const FloatSize& border_box_size) const { + const gfx::SizeF& border_box_size) const { TransformationMatrix from_transform; TransformationMatrix to_transform; from_.ApplyRemaining(border_box_size, starting_index_, from_transform);
diff --git a/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.h b/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.h index 41938b8..d584dda 100644 --- a/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/interpolated_transform_operation.h
@@ -55,7 +55,7 @@ bool operator==(const TransformOperation&) const override; void Apply(TransformationMatrix&, - const FloatSize& border_box_size) const override; + const gfx::SizeF& border_box_size) const override; scoped_refptr<TransformOperation> Accumulate( const TransformOperation&) override {
diff --git a/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.cc b/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.cc index f989a0e1..882e795f 100644 --- a/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.cc +++ b/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.cc
@@ -97,7 +97,7 @@ // Convert the TransformOperations into matrices. Fail the blend operation // if either of the matrices is non-invertible. - FloatSize size; + gfx::SizeF size; TransformationMatrix from_t; TransformationMatrix to_t; if (from) {
diff --git a/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h b/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h index fd26723..a0c2357 100644 --- a/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h
@@ -56,7 +56,8 @@ return matrix_ == m->matrix_; } - void Apply(TransformationMatrix& transform, const FloatSize&) const override { + void Apply(TransformationMatrix& transform, + const gfx::SizeF&) const override { transform.Multiply(TransformationMatrix(matrix_)); }
diff --git a/third_party/blink/renderer/platform/transforms/matrix_transform_operation.h b/third_party/blink/renderer/platform/transforms/matrix_transform_operation.h index 53fccaf8..9ff6a420 100644 --- a/third_party/blink/renderer/platform/transforms/matrix_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/matrix_transform_operation.h
@@ -69,7 +69,8 @@ e_ == m->e_ && f_ == m->f_; } - void Apply(TransformationMatrix& transform, const FloatSize&) const override { + void Apply(TransformationMatrix& transform, + const gfx::SizeF&) const override { TransformationMatrix matrix(a_, b_, c_, d_, e_, f_); transform.Multiply(matrix); }
diff --git a/third_party/blink/renderer/platform/transforms/perspective_transform_operation.h b/third_party/blink/renderer/platform/transforms/perspective_transform_operation.h index 67a9892..396c984 100644 --- a/third_party/blink/renderer/platform/transforms/perspective_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/perspective_transform_operation.h
@@ -70,7 +70,8 @@ return p_ == p->p_; } - void Apply(TransformationMatrix& transform, const FloatSize&) const override { + void Apply(TransformationMatrix& transform, + const gfx::SizeF&) const override { if (Perspective()) { transform.ApplyPerspective(UsedPerspective()); }
diff --git a/third_party/blink/renderer/platform/transforms/rotate_transform_operation.cc b/third_party/blink/renderer/platform/transforms/rotate_transform_operation.cc index 8ba1ffc..406aec8 100644 --- a/third_party/blink/renderer/platform/transforms/rotate_transform_operation.cc +++ b/third_party/blink/renderer/platform/transforms/rotate_transform_operation.cc
@@ -106,7 +106,7 @@ void RotateAroundOriginTransformOperation::Apply( TransformationMatrix& transform, - const FloatSize& box_size) const { + const gfx::SizeF& box_size) const { transform.Translate(origin_x_, origin_y_); RotateTransformOperation::Apply(transform, box_size); transform.Translate(-origin_x_, -origin_y_);
diff --git a/third_party/blink/renderer/platform/transforms/rotate_transform_operation.h b/third_party/blink/renderer/platform/transforms/rotate_transform_operation.h index 46211ac..922bfef 100644 --- a/third_party/blink/renderer/platform/transforms/rotate_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/rotate_transform_operation.h
@@ -74,7 +74,7 @@ OperationType PrimitiveType() const override { return kRotate3D; } void Apply(TransformationMatrix& transform, - const FloatSize& /*borderBoxSize*/) const override { + const gfx::SizeF& /*borderBoxSize*/) const override { transform.Rotate3d(rotation_); } @@ -124,7 +124,7 @@ new RotateAroundOriginTransformOperation(angle, origin_x, origin_y)); } - void Apply(TransformationMatrix&, const FloatSize&) const override; + void Apply(TransformationMatrix&, const gfx::SizeF&) const override; static bool IsMatchingOperationType(OperationType type) { return type == kRotateAroundOrigin;
diff --git a/third_party/blink/renderer/platform/transforms/scale_transform_operation.h b/third_party/blink/renderer/platform/transforms/scale_transform_operation.h index 4bc6277..bc3c549 100644 --- a/third_party/blink/renderer/platform/transforms/scale_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/scale_transform_operation.h
@@ -54,7 +54,8 @@ double Y() const { return y_; } double Z() const { return z_; } - void Apply(TransformationMatrix& transform, const FloatSize&) const override { + void Apply(TransformationMatrix& transform, + const gfx::SizeF&) const override { transform.Scale3d(x_, y_, z_); } scoped_refptr<TransformOperation> Accumulate(
diff --git a/third_party/blink/renderer/platform/transforms/skew_transform_operation.h b/third_party/blink/renderer/platform/transforms/skew_transform_operation.h index 7a838f1..de198de 100644 --- a/third_party/blink/renderer/platform/transforms/skew_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/skew_transform_operation.h
@@ -57,7 +57,8 @@ return angle_x_ == s->angle_x_ && angle_y_ == s->angle_y_; } - void Apply(TransformationMatrix& transform, const FloatSize&) const override { + void Apply(TransformationMatrix& transform, + const gfx::SizeF&) const override { transform.Skew(angle_x_, angle_y_); }
diff --git a/third_party/blink/renderer/platform/transforms/transform_operation.h b/third_party/blink/renderer/platform/transforms/transform_operation.h index 1df24aaa..c365a84 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/transform_operation.h
@@ -26,9 +26,9 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TRANSFORMS_TRANSFORM_OPERATION_H_ #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/transforms/transformation_matrix.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { @@ -72,7 +72,7 @@ bool operator!=(const TransformOperation& o) const { return !(*this == o); } virtual void Apply(TransformationMatrix&, - const FloatSize& border_box_size) const = 0; + const gfx::SizeF& border_box_size) const = 0; // Implements the accumulative behavior described in // https://drafts.csswg.org/css-transforms-2/#combining-transform-lists
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations.cc b/third_party/blink/renderer/platform/transforms/transform_operations.cc index 6dcaf85..430fc9e4 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations.cc +++ b/third_party/blink/renderer/platform/transforms/transform_operations.cc
@@ -85,7 +85,7 @@ return true; } -void TransformOperations::ApplyRemaining(const FloatSize& border_box_size, +void TransformOperations::ApplyRemaining(const gfx::SizeF& border_box_size, wtf_size_t start, TransformationMatrix& t) const { for (wtf_size_t i = start; i < operations_.size(); i++) { @@ -137,8 +137,8 @@ // unbounded depth. TransformationMatrix from_transform; TransformationMatrix to_transform; - from.ApplyRemaining(FloatSize(), matching_prefix_length, from_transform); - ApplyRemaining(FloatSize(), matching_prefix_length, to_transform); + from.ApplyRemaining(gfx::SizeF(), matching_prefix_length, from_transform); + ApplyRemaining(gfx::SizeF(), matching_prefix_length, to_transform); // Fallback to discrete interpolation if either transform matrix is singular. if (!(from_transform.IsInvertible() && to_transform.IsInvertible())) { @@ -216,8 +216,8 @@ if (success && matching_prefix_length < max_path_length) { TransformationMatrix from_transform; TransformationMatrix to_transform; - ApplyRemaining(FloatSize(), matching_prefix_length, from_transform); - to.ApplyRemaining(FloatSize(), matching_prefix_length, to_transform); + ApplyRemaining(gfx::SizeF(), matching_prefix_length, from_transform); + to.ApplyRemaining(gfx::SizeF(), matching_prefix_length, to_transform); scoped_refptr<TransformOperation> from_matrix = Matrix3DTransformOperation::Create(from_transform); @@ -427,8 +427,8 @@ continue; TransformationMatrix from_matrix; TransformationMatrix to_matrix; - from_transform->Apply(from_matrix, FloatSize()); - to_transform->Apply(to_matrix, FloatSize()); + from_transform->Apply(from_matrix, gfx::SizeF()); + to_transform->Apply(to_matrix, gfx::SizeF()); FloatBox from_box = *bounds; FloatBox to_box = *bounds; from_matrix.TransformBox(from_box);
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations.h b/third_party/blink/renderer/platform/transforms/transform_operations.h index 9d9229c..c1b24b3 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations.h +++ b/third_party/blink/renderer/platform/transforms/transform_operations.h
@@ -26,10 +26,10 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TRANSFORMS_TRANSFORM_OPERATIONS_H_ #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/geometry/layout_size.h" #include "third_party/blink/renderer/platform/transforms/transform_operation.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { class FloatBox; @@ -50,7 +50,7 @@ // Constructs a transformation matrix from the operations. The parameter // |border_box_size| is used when computing styles that are size-dependent. - void Apply(const FloatSize& border_box_size, TransformationMatrix& t) const { + void Apply(const gfx::SizeF& border_box_size, TransformationMatrix& t) const { for (auto& operation : operations_) operation->Apply(t, border_box_size); } @@ -59,7 +59,7 @@ // |start|. This process facilitates mixing pairwise operations for a common // prefix and matrix interpolation for the remainder. The parameter // |border_box_size| is used when computing styles that are size-dependent. - void ApplyRemaining(const FloatSize& border_box_size, + void ApplyRemaining(const gfx::SizeF& border_box_size, wtf_size_t start, TransformationMatrix& t) const;
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc index ffaee8e..f2d0faf 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc +++ b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc
@@ -60,7 +60,7 @@ t = min_progress + (max_progress - min_progress) * t; TransformOperations operations = from.Blend(to, t); TransformationMatrix matrix; - operations.Apply(FloatSize(0, 0), matrix); + operations.Apply(gfx::SizeF(0, 0), matrix); FloatBox transformed = box; matrix.TransformBox(transformed); @@ -460,7 +460,7 @@ TransformOperations operations = to_ops.Blend(from_ops, max_progress); TransformationMatrix blended_transform; - operations.Apply(FloatSize(0, 0), blended_transform); + operations.Apply(gfx::SizeF(0, 0), blended_transform); FloatPoint3D blended_point(0.9f, 0.9f, 0); blended_point = blended_transform.MapPoint(blended_point); @@ -532,7 +532,7 @@ FloatPoint3D unzoomed_point = original_point; TransformOperations unzoomed_ops = ops; TransformationMatrix unzoomed_matrix; - ops.Apply(FloatSize(0, 0), unzoomed_matrix); + ops.Apply(gfx::SizeF(0, 0), unzoomed_matrix); FloatPoint3D result1 = unzoomed_matrix.MapPoint(unzoomed_point); result1.Scale(zoom_factor, zoom_factor, zoom_factor); @@ -541,7 +541,7 @@ zoomed_point.Scale(zoom_factor, zoom_factor, zoom_factor); TransformOperations zoomed_ops = ops.Zoom(zoom_factor); TransformationMatrix zoomed_matrix; - zoomed_ops.Apply(FloatSize(0, 0), zoomed_matrix); + zoomed_ops.Apply(gfx::SizeF(0, 0), zoomed_matrix); FloatPoint3D result2 = zoomed_matrix.MapPoint(zoomed_point); EXPECT_EQ(result1, result2); @@ -671,7 +671,7 @@ ops_d3.Operations().push_back( RotateTransformOperation::Create(11.25, TransformOperation::kRotate)); - const FloatSize box_size(100, 100); + const gfx::SizeF box_size(100, 100); TransformationMatrix mat_d1, mat_d2, mat_d3; ops_d1.Apply(box_size, mat_d1); ops_d2.Apply(box_size, mat_d2); @@ -744,7 +744,7 @@ TransformOperation::kTranslate)); TransformationMatrix mat; - ops.Apply(FloatSize(800, 600), mat); + ops.Apply(gfx::SizeF(800, 600), mat); // There should not be inf or nan in the transformation result. EXPECT_TRUE(isfinite(mat.M11()));
diff --git a/third_party/blink/renderer/platform/transforms/translate_transform_operation.h b/third_party/blink/renderer/platform/transforms/translate_transform_operation.h index b02142f..b0880395 100644 --- a/third_party/blink/renderer/platform/transforms/translate_transform_operation.h +++ b/third_party/blink/renderer/platform/transforms/translate_transform_operation.h
@@ -58,10 +58,10 @@ (y_.IsPercentOrCalc() ? kDependsHeight : kDependsNone)); } - double X(const FloatSize& border_box_size) const { + double X(const gfx::SizeF& border_box_size) const { return FloatValueForLength(x_, border_box_size.width()); } - double Y(const FloatSize& border_box_size) const { + double Y(const gfx::SizeF& border_box_size) const { return FloatValueForLength(y_, border_box_size.height()); } @@ -70,7 +70,7 @@ double Z() const { return z_; } void Apply(TransformationMatrix& transform, - const FloatSize& border_box_size) const override { + const gfx::SizeF& border_box_size) const override { transform.Translate3d(X(border_box_size), Y(border_box_size), Z()); }
diff --git a/third_party/blink/renderer/platform/wtf/cross_thread_copier.h b/third_party/blink/renderer/platform/wtf/cross_thread_copier.h index 5f70203..ee1b180 100644 --- a/third_party/blink/renderer/platform/wtf/cross_thread_copier.h +++ b/third_party/blink/renderer/platform/wtf/cross_thread_copier.h
@@ -68,6 +68,7 @@ namespace gfx { class ColorSpace; +class Rect; class Size; } // namespace gfx @@ -370,6 +371,12 @@ }; template <> +struct CrossThreadCopier<gfx::Rect> + : public CrossThreadCopierPassThrough<gfx::Rect> { + STATIC_ONLY(CrossThreadCopier); +}; + +template <> struct CrossThreadCopier<gfx::ColorSpace> : public CrossThreadCopierPassThrough<gfx::ColorSpace> { STATIC_ONLY(CrossThreadCopier);
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index 686af73..f7f1fcf9 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -323,9 +323,11 @@ 'gfx::ComputeApproximateMaxScale', 'gfx::Determinant', 'gfx::IntersectRects', + 'gfx::MapRect', 'gfx::PointAtOffsetFromOrigin', 'gfx::PointFToSkPoint', 'gfx::PointToSkIPoint', + 'gfx::MapRect', 'gfx::MaximumCoveredRect', 'gfx::RectFToSkRect', 'gfx::RectToSkIRect', @@ -334,17 +336,24 @@ 'gfx::ScaleToCeiledSize', 'gfx::ScaleToEnclosingRect', 'gfx::ScaleToFlooredSize', + 'gfx::ScaleToRoundedRect', + 'gfx::ScaleToRoundedSize', 'gfx::ScaleSize', 'gfx::ScalePoint', 'gfx::ScaleToRoundedPoint', 'gfx::ScaleVector2d', + 'gfx::SizeFToSkSize', + 'gfx::SizeToSkISize', 'gfx::SkIPointToPoint', 'gfx::SkIRectToRect', - 'gfx::SkRectToRectF', + 'gfx::SkISizeToSize', 'gfx::SkPointToPointF', + 'gfx::SkRectToRectF', + 'gfx::SkSizeToSizeF', 'gfx::SubtractRects', 'gfx::ToCeiledPoint', 'gfx::ToCeiledSize', + 'gfx::ToCeiledVector2d', 'gfx::ToEnclosedRect', 'gfx::ToEnclosingRect', 'gfx::ToFlooredPoint',
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index cb65221..19c7753a 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -7313,3 +7313,5 @@ crbug.com/1275944 [ Mac ] external/wpt/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-innerheight-innerwidth.html [ Failure Pass ] crbug.com/1275967 [ Linux ] external/wpt/permissions-policy/permissions-policy-frame-policy-timing.https.sub.html [ Failure Pass ] crbug.com/1276044 [ Linux ] virtual/gpu-rasterization/images/color-profile-background-image-repeat.html [ Failure Pass ] +crbug.com/1275944 [ Mac ] http/tests/devtools/sources/debugger-ui/reveal-not-skipped.js [ Failure Pass ] +crbug.com/1275944 [ Win7 ] http/tests/devtools/sources/debugger-ui/reveal-not-skipped.js [ Failure Pass ]
diff --git a/third_party/blink/web_tests/WebGPUExpectations b/third_party/blink/web_tests/WebGPUExpectations index 1555e556..17ace2d 100644 --- a/third_party/blink/web_tests/WebGPUExpectations +++ b/third_party/blink/web_tests/WebGPUExpectations
@@ -467,6 +467,10 @@ # (NVIDIA-only) Started failing when the test was added. crbug.com/tint/1287 [ Linux ] wpt_internal/webgpu/cts.https.html?q=webgpu:shader,execution,shader_io,shared_structs:shared_between_stages:* [ Failure ] +# Missing several necessary Vulkan extensions on GTX 1660 machines. +crbug.com/dawn/1213 [ Linux ] wpt_internal/webgpu/cts.https.html?q=webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:* [ Crash Failure ] +crbug.com/dawn/1213 [ Linux ] wpt_internal/webgpu/cts.https.html?q=webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:* [ Crash Failure ] + ### ### Windows (D3D12) specific ###
diff --git a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-expected.png b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-expected.png index a0005890..f89ed93 100644 --- a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-expected.png +++ b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-rotate-expected.png b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-rotate-expected.png index f5f0fd2e..8736e02 100644 --- a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-rotate-expected.png +++ b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-animate-rotate-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-border-fade-expected.png b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-border-fade-expected.png index 2a828885..ebfcbf0 100644 --- a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-border-fade-expected.png +++ b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-border-fade-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-image-filter-all-expected.png b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-image-filter-all-expected.png index 6283ca4..9989ff0 100644 --- a/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-image-filter-all-expected.png +++ b/third_party/blink/web_tests/flag-specific/skia-vulkan-native/images/color-profile-image-filter-all-expected.png Binary files differ
diff --git a/third_party/libaom/options.gni b/third_party/libaom/options.gni index 258920d5..9ccf12e 100644 --- a/third_party/libaom/options.gni +++ b/third_party/libaom/options.gni
@@ -4,8 +4,7 @@ declare_args() { # Enable encoding and decoding AV1 video files. - enable_libaom = - !is_chromeos_lacros && !is_chromeos_ash && !is_android && !is_chromecast + enable_libaom = !is_chromeos_lacros && !is_android && !is_chromecast # To be deprecated soon. enable_libaom_decoder = false
diff --git a/third_party/zlib/google/zip_reader_unittest.cc b/third_party/zlib/google/zip_reader_unittest.cc index e5bb4b4..c1d654af 100644 --- a/third_party/zlib/google/zip_reader_unittest.cc +++ b/third_party/zlib/google/zip_reader_unittest.cc
@@ -632,11 +632,10 @@ protected: void SetUp() override { ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path_)); - file_.Initialize(temp_file_path_, (base::File::FLAG_CREATE_ALWAYS | - base::File::FLAG_READ | - base::File::FLAG_WRITE | - base::File::FLAG_TEMPORARY | - base::File::FLAG_DELETE_ON_CLOSE)); + file_.Initialize(temp_file_path_, + (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | + base::File::FLAG_WRITE | base::File::FLAG_WIN_TEMPORARY | + base::File::FLAG_DELETE_ON_CLOSE)); ASSERT_TRUE(file_.IsValid()); }
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 58b0d88..d578f5307 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -21,6 +21,7 @@ 'chromeos-eve-arc-r-chrome': 'chromeos_eve-arc-r_include_unwind_tables_official', 'chromeos-eve-chrome': 'chromeos_eve_include_unwind_tables_official_dchecks', 'chromeos-kevin-chrome': 'chromeos_kevin_include_unwind_tables_official_dchecks', + 'chromeos-octopus-chrome': 'chromeos_octopus_include_unwind_tables_official_dchecks', 'lacros-amd64-generic-chrome': 'chromeos_amd64-generic_lacros_official', 'lacros-amd64-generic-chrome-skylab': 'chromeos_amd64-generic_lacros_official_skylab', 'lacros-arm-generic-chrome': 'chromeos_arm-generic_lacros_official', @@ -898,6 +899,8 @@ 'chromeos-eve-compile-chrome': 'chromeos_eve_include_unwind_tables_official_dchecks', 'chromeos-kevin-chrome': 'chromeos_kevin_include_unwind_tables_official_dchecks', 'chromeos-kevin-compile-chrome': 'chromeos_kevin_include_unwind_tables_official_dchecks', + 'chromeos-octopus-chrome': 'chromeos_octopus_include_unwind_tables_official_dchecks', + 'chromeos-octopus-compile-chrome': 'chromeos_octopus_include_unwind_tables_official_dchecks', 'lacros-amd64-generic-chrome': 'chromeos_amd64-generic_lacros_official', 'lacros-amd64-generic-chrome-skylab': 'chromeos_amd64-generic_lacros_official_skylab', 'lacros-arm-generic-chrome': 'chromeos_arm-generic_lacros_official', @@ -1940,6 +1943,10 @@ 'chromeos', 'msan', 'release_bot', ], + 'chromeos_octopus_include_unwind_tables_official_dchecks': [ + 'chromeos_device', 'octopus', 'include_unwind_tables', 'official', 'dcheck_always_on', + ], + 'chromeos_with_codecs_debug_bot': [ 'chromeos_with_codecs', 'debug_bot', ], @@ -3744,6 +3751,10 @@ 'gn_args': 'ignore_missing_widevine_signing_cert=true', }, + 'octopus': { + 'args_file': '//build/args/chromeos/octopus.gni', + }, + 'official': { 'mixins': ['official_optimize'], 'gn_args': 'is_chrome_branded=true',
diff --git a/tools/mb/mb_config_expectations/chrome.json b/tools/mb/mb_config_expectations/chrome.json index 6010eaa9..8d77897b 100644 --- a/tools/mb/mb_config_expectations/chrome.json +++ b/tools/mb/mb_config_expectations/chrome.json
@@ -91,6 +91,18 @@ "use_goma": true } }, + "chromeos-octopus-chrome": { + "args_file": "//build/args/chromeos/octopus.gni", + "gn_args": { + "dcheck_always_on": true, + "exclude_unwind_tables": false, + "is_chrome_branded": true, + "is_chromeos_device": true, + "is_official_build": true, + "ozone_platform_headless": true, + "use_goma": true + } + }, "lacros-amd64-generic-chrome": { "args_file": "//build/args/chromeos/amd64-generic-crostoolchain.gni", "gn_args": {
diff --git a/tools/mb/mb_config_expectations/tryserver.chrome.json b/tools/mb/mb_config_expectations/tryserver.chrome.json index a74d2944..b82f368 100644 --- a/tools/mb/mb_config_expectations/tryserver.chrome.json +++ b/tools/mb/mb_config_expectations/tryserver.chrome.json
@@ -128,6 +128,30 @@ "use_goma": true } }, + "chromeos-octopus-chrome": { + "args_file": "//build/args/chromeos/octopus.gni", + "gn_args": { + "dcheck_always_on": true, + "exclude_unwind_tables": false, + "is_chrome_branded": true, + "is_chromeos_device": true, + "is_official_build": true, + "ozone_platform_headless": true, + "use_goma": true + } + }, + "chromeos-octopus-compile-chrome": { + "args_file": "//build/args/chromeos/octopus.gni", + "gn_args": { + "dcheck_always_on": true, + "exclude_unwind_tables": false, + "is_chrome_branded": true, + "is_chromeos_device": true, + "is_official_build": true, + "ozone_platform_headless": true, + "use_goma": true + } + }, "lacros-amd64-generic-chrome": { "args_file": "//build/args/chromeos/amd64-generic-crostoolchain.gni", "gn_args": {
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 5c020f98e..ccd6bda3 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -717,6 +717,12 @@ <description>Please enter the description of this user action.</description> </action> +<action name="Accel_Keyboard_Backlight"> + <owner>rtinkoff@google.com</owner> + <owner>cros-peripherals@google.com</owner> + <description>User pressed the keyboard backlight toggle key.</description> +</action> + <action name="Accel_KeyboardBrightnessDown_F6"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> @@ -16719,6 +16725,11 @@ </description> </action> +<action name="MobileMenuDisablePriceTracking"> + <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <description>Please enter the description of the metric.</description> +</action> + <action name="MobileMenuDownloadManager"> <owner>dfalcantara@chromium.org</owner> <owner>twellington@chromium.org</owner> @@ -16735,6 +16746,11 @@ </description> </action> +<action name="MobileMenuEnablePriceTracking"> + <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <description>Please enter the description of the metric.</description> +</action> + <action name="MobileMenuFeedback"> <owner>aurimas@chromium.org</owner> <description>User pressed 'Help and Feedback' in the app menu.</description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index baf8a85..d3d6e9b7 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -50839,6 +50839,7 @@ <int value="-680589442" label="MacRTL:disabled"/> <int value="-679500267" label="UseXpsForPrinting:disabled"/> <int value="-678184617" label="TranslateSubFrames:disabled"/> + <int value="-677938988" label="AssistantConsentSimplifiedText:disabled"/> <int value="-674804217" label="SoleIntegration:enabled"/> <int value="-673804828" label="EnablePlayStoreAppSearch:disabled"/> <int value="-673149604" label="RelatedSearches:enabled"/> @@ -51245,6 +51246,7 @@ <int value="-354783358" label="NTPSaveToOffline:disabled"/> <int value="-353182790" label="ConsistentOmniboxGeolocation:disabled"/> <int value="-353180213" label="DevicePosture:disabled"/> + <int value="-351830087" label="AssistantConsentSimplifiedText:enabled"/> <int value="-351552989" label="disable-hosted-apps-in-windows"/> <int value="-351127770" label="enable-offline-pages-as-bookmarks"/> <int value="-349437334" label="UseDdljsonApi:disabled"/> @@ -51418,6 +51420,7 @@ <int value="-221649438" label="AllowTouchpadHapticClickSettings:disabled"/> <int value="-220599034" label="UsePdfCompositorServiceForPrint:enabled"/> <int value="-220298483" label="ImeOptionsInSettings:enabled"/> + <int value="-217930860" label="EnableAutomaticSnooze:disabled"/> <int value="-217885320" label="CdmFactoryDaemon:disabled"/> <int value="-216219963" label="ash-shelf-color-scheme"/> <int value="-216189310" @@ -54465,6 +54468,7 @@ <int value="2047503404" label="FilesSWA:enabled"/> <int value="2047695652" label="DelegateOverscrollSwipes:enabled"/> <int value="2049432745" label="VaapiWebPImageDecodeAcceleration:enabled"/> + <int value="2049674680" label="EnableAutomaticSnooze:enabled"/> <int value="2050985807" label="AllowPopupsDuringPageUnload:enabled"/> <int value="2051403297" label="ShowBluetoothDeviceBattery:disabled"/> <int value="2051886966" label="PwaInstallUseBottomSheet:enabled"/>
diff --git a/tools/metrics/histograms/metadata/service/histograms.xml b/tools/metrics/histograms/metadata/service/histograms.xml index 2649626..3843d269 100644 --- a/tools/metrics/histograms/metadata/service/histograms.xml +++ b/tools/metrics/histograms/metadata/service/histograms.xml
@@ -1025,7 +1025,7 @@ <histogram name="ServiceWorker.StartTiming.ReceivedStartWorkerToScriptEvaluationStart" - units="ms" expires_after="2021-12-05"> + units="ms" expires_after="2022-09-01"> <owner>wanderview@chromium.org</owner> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner> @@ -1037,7 +1037,7 @@ </histogram> <histogram name="ServiceWorker.StartTiming.ScriptEvaluationEndToEnd" units="ms" - expires_after="2021-12-05"> + expires_after="2022-09-01"> <owner>wanderview@chromium.org</owner> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner> @@ -1051,7 +1051,7 @@ <histogram name="ServiceWorker.StartTiming.ScriptEvaluationStartToScriptEvaluationEnd" - units="ms" expires_after="2021-12-05"> + units="ms" expires_after="2022-09-01"> <owner>wanderview@chromium.org</owner> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner> @@ -1064,7 +1064,7 @@ <histogram name="ServiceWorker.StartTiming.SentStartWorkerToReceivedStartWorker" - units="ms" expires_after="2021-12-05"> + units="ms" expires_after="2022-09-01"> <owner>wanderview@chromium.org</owner> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner> @@ -1118,7 +1118,7 @@ </histogram> <histogram name="ServiceWorker.StartTiming.StartToSentStartWorker" units="ms" - expires_after="2021-12-05"> + expires_after="2022-09-01"> <owner>wanderview@chromium.org</owner> <owner>asamidoi@chromium.org</owner> <owner>chrome-worker@google.com</owner>
diff --git a/tools/style_variable_generator/css_generator.py b/tools/style_variable_generator/css_generator.py index 2d42fb3b..3013487 100644 --- a/tools/style_variable_generator/css_generator.py +++ b/tools/style_variable_generator/css_generator.py
@@ -66,44 +66,42 @@ Modes, } - def GetGeneratedVars(self, variable_type): - to_css_var_name_types = [ - VariableType.COLOR, - VariableType.OPACITY, - ] + def AddGeneratedVars(self, var_names, variable_type): + def AddVarNames(model_names, variations): + for model_name in model_names: + for v in variations: + var_name = v.replace('$css_name', + self.ToCSSVarName(model_name)) + if var_name in var_names: + raise ValueError(name + " is defined multiple times") + var_names[var_name] = model_name - if variable_type in to_css_var_name_types: - generated = set( - map(self.ToCSSVarName, self.model[variable_type].keys())) + submodel = self.model[variable_type] + if variable_type == VariableType.OPACITY: + AddVarNames(submodel.keys(), ['$css_name']) + elif variable_type == VariableType.COLOR: + AddVarNames(submodel.keys(), ['$css_name', '$css_name-rgb']) elif variable_type == VariableType.UNTYPED_CSS: - generated = set() - for category in self.model[VariableType.UNTYPED_CSS].values(): - generated |= set(map(self.ToCSSVarName, category.keys())) + for category in submodel.values(): + AddVarNames(category.keys(), ['$css_name']) elif variable_type == VariableType.TYPOGRAPHY: - generated = set() - typography = self.model[VariableType.TYPOGRAPHY] - for t in typography.typefaces.keys(): - var_name = self.ToCSSVarName(t) - generated.add(var_name + '-font') - generated.add(var_name + '-font-family') - generated.add(var_name + '-font-size') - generated.add(var_name + '-font-weight') - generated.add(var_name + '-line-height') - generated |= set( - map(self.ToCSSVarName, typography.font_families.keys())) + AddVarNames(submodel.typefaces.keys(), [ + '$css_name-font', + '$css_name-font-family', + '$css_name-font-size', + '$css_name-font-weight', + '$css_name-line-height', + ]) else: raise ValueError("GetGeneratedVars() for '%s' not implemented") - return generated - def GetCSSVarNames(self): - '''Returns generated CSS variable names (excluding color rgb versions) + '''Returns a map of all generated names to the model names that + generated them. ''' - var_names = set() + var_names = dict() for vt in VariableType.ALL: - generated = self.GetGeneratedVars(vt) - assert not generated.intersection(var_names) - var_names |= generated + generated = self.AddGeneratedVars(var_names, vt) return var_names
diff --git a/tools/style_variable_generator/find_invalid_css_variables.py b/tools/style_variable_generator/find_invalid_css_variables.py index e26a995..08b72a6 100644 --- a/tools/style_variable_generator/find_invalid_css_variables.py +++ b/tools/style_variable_generator/find_invalid_css_variables.py
@@ -5,6 +5,7 @@ import argparse import sys import os +import re sys.path += [os.path.dirname(os.path.dirname(__file__))] @@ -16,8 +17,10 @@ def FindInvalidCSSVariables(file_to_json_strings, git_runner=RunGit): style_generator = CSSStyleGenerator() css_prefixes = set() + referenced_vars = set() for f, json_string in file_to_json_strings.items(): style_generator.AddJSONToModel(json_string, in_file=f) + referenced_vars |= set(re.findall(r'\$([a-z_0-9]+)', json_string)) context = style_generator.in_file_to_context.get(f, {}).get('CSS') if (not context or 'prefix' not in context): @@ -26,7 +29,9 @@ css_prefixes.add('--' + context['prefix'] + '-') unspecified_file_and_names = [] - valid_names = style_generator.GetCSSVarNames() + css_var_names = style_generator.GetCSSVarNames() + valid_names = set(css_var_names.keys()) + unused = set(css_var_names.values()).difference(referenced_vars) for css_prefix in css_prefixes: grep_result = git_runner([ @@ -35,11 +40,10 @@ ]).decode('utf-8').splitlines() found_files_and_names = [x.split(':') for x in grep_result] found_names = set() - rgb_suffix = '-rgb' for (filename, line, name) in found_files_and_names: - if name.endswith(rgb_suffix): - name = name[:-len(rgb_suffix)] found_names.add(name) + if name in valid_names and css_var_names[name] in unused: + unused.remove(css_var_names[name]) unspecified = found_names.difference(valid_names) for (filename, line, name) in found_files_and_names: @@ -54,7 +58,7 @@ 'unspecified': unspecified_file_and_names, # TODO(calamity): This should also account for names referenced in json5 # files. - 'unused': valid_names.difference(found_names), + 'unused': unused, 'css_prefix': css_prefix, }
diff --git a/tools/style_variable_generator/find_invalid_css_variables_test.py b/tools/style_variable_generator/find_invalid_css_variables_test.py index 95c18fb..2030ac1 100755 --- a/tools/style_variable_generator/find_invalid_css_variables_test.py +++ b/tools/style_variable_generator/find_invalid_css_variables_test.py
@@ -82,15 +82,10 @@ result = FindInvalidCSSVariables({'test': json_string}, git_runner=GitResult) unused = set([ - '--test-unused', - '--test-font-family-unused', - '--test-headline-1-font', - '--test-headline-1-font-family', - '--test-headline-1-font-size', - '--test-headline-1-font-weight', - '--test-headline-1-line-height', - '--test-unused-css', - '--test-unused-opacity', + 'unused_opacity', + 'unused_css', + 'headline_1', + 'unused', ]) self.assertEqual(result['unused'], unused) unspecified = []
diff --git a/tools/style_variable_generator/presubmit_support.py b/tools/style_variable_generator/presubmit_support.py index ff983ca..154a4d39 100644 --- a/tools/style_variable_generator/presubmit_support.py +++ b/tools/style_variable_generator/presubmit_support.py
@@ -37,7 +37,7 @@ continue style_generator.AddJSONToModel('\n'.join(file_contents), in_file=f.LocalPath()) - return style_generator.GetCSSVarNames() + return set(style_generator.GetCSSVarNames().keys()) old_names = get_css_var_names_for_contents(lambda f: f.OldContents()) new_names = get_css_var_names_for_contents(lambda f: f.NewContents())
diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn index a8e27a9c..72c95d9 100644 --- a/ui/accessibility/platform/BUILD.gn +++ b/ui/accessibility/platform/BUILD.gn
@@ -92,8 +92,6 @@ "fuchsia/accessibility_bridge_fuchsia.h", "fuchsia/accessibility_bridge_fuchsia_registry.cc", "fuchsia/accessibility_bridge_fuchsia_registry.h", - "fuchsia/fuchsia_types.cc", - "fuchsia/fuchsia_types.h", ] public_deps +=
diff --git a/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h b/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h index 7c15877..c4fa61b9 100644 --- a/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h +++ b/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h
@@ -5,9 +5,9 @@ #ifndef UI_ACCESSIBILITY_PLATFORM_FUCHSIA_ACCESSIBILITY_BRIDGE_FUCHSIA_H_ #define UI_ACCESSIBILITY_PLATFORM_FUCHSIA_ACCESSIBILITY_BRIDGE_FUCHSIA_H_ -#include "third_party/abseil-cpp/absl/types/optional.h" +#include <fuchsia/accessibility/semantics/cpp/fidl.h> + #include "ui/accessibility/ax_export.h" -#include "ui/accessibility/platform/fuchsia/fuchsia_types.h" namespace ui { @@ -23,25 +23,28 @@ // // Note that |node_update.node_data| should not have any node ID fields // (node_id, child_ids, offset_container_id, etc.) filled initially. - virtual void UpdateNode(AXNodeUpdateFuchsia node_update) = 0; + virtual void UpdateNode(fuchsia::accessibility::semantics::Node node) = 0; // Translates |node_id| to a fuchsia node ID, and sends the deletion to // fuchsia. - virtual void DeleteNode(AXNodeDescriptorFuchsia node_id) = 0; + virtual void DeleteNode(uint32_t node_id) = 0; - // Sets has_input_focus to true for the fuchsia node specified by |new_focus|. - virtual void FocusNode(AXNodeDescriptorFuchsia new_focus) = 0; + // Sets focus to the fuchsia node specified by |new_focus|. + virtual void FocusNode(uint32_t new_focus) = 0; - // Sets has_input_focus to false for the fuchsia node specified by - // |old_focus|. - virtual void UnfocusNode(AXNodeDescriptorFuchsia old_focus) = 0; + // Removes focus from the fuchsia node specified by |old_focus|. + virtual void UnfocusNode(uint32_t old_focus) = 0; + // hit_test_request_id: A unique ID for the hit test, generated by the client. + // result: The fuchsia node ID of the entity returned by the hit test. + // // Method to notify the accessibility bridge when a hit test result is - // received. The accessibility bridge will convert |result| to a fuchsia node - // ID, build a fuchsia Hit object using that ID, and invoke the callback - // corresponding to hit_test_request_id. + // received. virtual void OnAccessibilityHitTestResult(int hit_test_request_id, - AXNodeDescriptorFuchsia result) = 0; + uint32_t result) = 0; + + // Specifies the unique ID of the root platform node. + virtual void SetRootID(uint32_t root_node_id) = 0; }; } // namespace ui
diff --git a/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia_registry.h b/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia_registry.h index d505524..1e19bbe 100644 --- a/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia_registry.h +++ b/ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia_registry.h
@@ -7,6 +7,7 @@ #include "base/containers/flat_map.h" #include "ui/accessibility/ax_export.h" +#include "ui/accessibility/ax_tree_id.h" #include "ui/accessibility/platform/fuchsia/accessibility_bridge_fuchsia.h" namespace ui {
diff --git a/ui/accessibility/platform/fuchsia/fuchsia_types.cc b/ui/accessibility/platform/fuchsia/fuchsia_types.cc deleted file mode 100644 index b4d5ac2..0000000 --- a/ui/accessibility/platform/fuchsia/fuchsia_types.cc +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/accessibility/platform/fuchsia/fuchsia_types.h" - -namespace ui { - -AXNodeDescriptorFuchsia::AXNodeDescriptorFuchsia() = default; - -AXNodeDescriptorFuchsia::AXNodeDescriptorFuchsia(AXTreeID tree_id, - AXNodeID node_id) - : tree_id(tree_id), node_id(node_id) {} - -AXNodeDescriptorFuchsia::~AXNodeDescriptorFuchsia() = default; - -AXNodeUpdateFuchsia::AXNodeUpdateFuchsia() = default; -AXNodeUpdateFuchsia::AXNodeUpdateFuchsia(AXNodeUpdateFuchsia&&) = default; -AXNodeUpdateFuchsia::~AXNodeUpdateFuchsia() = default; - -} // namespace ui
diff --git a/ui/accessibility/platform/fuchsia/fuchsia_types.h b/ui/accessibility/platform/fuchsia/fuchsia_types.h deleted file mode 100644 index 927be55..0000000 --- a/ui/accessibility/platform/fuchsia/fuchsia_types.h +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_ACCESSIBILITY_PLATFORM_FUCHSIA_FUCHSIA_TYPES_H_ -#define UI_ACCESSIBILITY_PLATFORM_FUCHSIA_FUCHSIA_TYPES_H_ - -#include <fuchsia/accessibility/semantics/cpp/fidl.h> - -#include <vector> - -#include "third_party/abseil-cpp/absl/types/optional.h" -#include "ui/accessibility/ax_export.h" -#include "ui/accessibility/ax_node_data.h" -#include "ui/accessibility/ax_tree_id.h" - -namespace ui { - -struct AX_EXPORT AXNodeDescriptorFuchsia { - AXTreeID tree_id = ui::AXTreeIDUnknown(); - AXNodeID node_id = ui::kInvalidAXNodeID; - - AXNodeDescriptorFuchsia(); - AXNodeDescriptorFuchsia(AXTreeID tree_id, AXNodeID node_id); - ~AXNodeDescriptorFuchsia(); -}; - -struct AX_EXPORT AXNodeUpdateFuchsia { - AXNodeDescriptorFuchsia node_id; - fuchsia::accessibility::semantics::Node node_data; - std::vector<AXNodeDescriptorFuchsia> child_ids; - absl::optional<AXNodeDescriptorFuchsia> offset_container_id; - bool is_root = false; - - AXNodeUpdateFuchsia(); - AXNodeUpdateFuchsia(AXNodeUpdateFuchsia&&); - ~AXNodeUpdateFuchsia(); -}; - -} // namespace ui - -#endif // UI_ACCESSIBILITY_PLATFORM_FUCHSIA_FUCHSIA_TYPES_H_
diff --git a/ui/base/ime/ash/ime_bridge.cc b/ui/base/ime/ash/ime_bridge.cc index 4f1ddf2..98fe853 100644 --- a/ui/base/ime/ash/ime_bridge.cc +++ b/ui/base/ime/ash/ime_bridge.cc
@@ -4,126 +4,85 @@ #include "ui/base/ime/ash/ime_bridge.h" -#include <map> - -#include "base/memory/singleton.h" -#include "base/observer_list.h" -#include "build/build_config.h" - namespace ui { static IMEBridge* g_ime_bridge = nullptr; -// An implementation of IMEBridge. -class IMEBridgeImpl : public IMEBridge { - public: - IMEBridgeImpl() - : current_input_context_(ui::TEXT_INPUT_TYPE_NONE, - ui::TEXT_INPUT_MODE_DEFAULT, - 0, - ui::TextInputClient::FOCUS_REASON_NONE, - false /* should_do_learning */) {} - - IMEBridgeImpl(const IMEBridgeImpl&) = delete; - IMEBridgeImpl& operator=(const IMEBridgeImpl&) = delete; - - ~IMEBridgeImpl() override = default; - - // IMEBridge override. - IMEInputContextHandlerInterface* GetInputContextHandler() const override { - return input_context_handler_; - } - - // IMEBridge override. - void SetInputContextHandler( - IMEInputContextHandlerInterface* handler) override { - input_context_handler_ = handler; - for (auto& observer : observers_) - observer.OnInputContextHandlerChanged(); - } - - // IMEBridge override. - void SetCurrentEngineHandler(IMEEngineHandlerInterface* handler) override { - engine_handler_ = handler; - } - - // IMEBridge override. - IMEEngineHandlerInterface* GetCurrentEngineHandler() const override { - return engine_handler_; - } - - // IMEBridge override. - void SetCurrentInputContext( - const IMEEngineHandlerInterface::InputContext& input_context) override { - current_input_context_ = input_context; - } - - // IMEBridge override. - const IMEEngineHandlerInterface::InputContext& GetCurrentInputContext() - const override { - return current_input_context_; - } - - // IMEBridge override. - void AddObserver(ui::IMEBridgeObserver* observer) override { - observers_.AddObserver(observer); - } - - // IMEBridge override. - void RemoveObserver(ui::IMEBridgeObserver* observer) override { - observers_.RemoveObserver(observer); - } - - // IMEBridge override. - void MaybeSwitchEngine() override { - for (auto& observer : observers_) - observer.OnRequestSwitchEngine(); - } - - // IMEBridge override. - void SetCandidateWindowHandler( - ash::IMECandidateWindowHandlerInterface* handler) override { - candidate_window_handler_ = handler; - } - - // IMEBridge override. - ash::IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() - const override { - return candidate_window_handler_; - } - - // IMEBridge override. - void SetAssistiveWindowHandler( - ash::IMEAssistiveWindowHandlerInterface* handler) override { - assistive_window_handler_ = handler; - } - - // IMEBridge override. - ash::IMEAssistiveWindowHandlerInterface* GetAssistiveWindowHandler() - const override { - return assistive_window_handler_; - } - - private: - IMEInputContextHandlerInterface* input_context_handler_ = nullptr; - IMEEngineHandlerInterface* engine_handler_ = nullptr; - base::ObserverList<IMEBridgeObserver> observers_; - IMEEngineHandlerInterface::InputContext current_input_context_; - - ash::IMECandidateWindowHandlerInterface* candidate_window_handler_ = nullptr; - ash::IMEAssistiveWindowHandlerInterface* assistive_window_handler_ = nullptr; -}; - -/////////////////////////////////////////////////////////////////////////////// -// IMEBridge -IMEBridge::IMEBridge() = default; +IMEBridge::IMEBridge() + : current_input_context_(ui::TEXT_INPUT_TYPE_NONE, + ui::TEXT_INPUT_MODE_DEFAULT, + 0, + ui::TextInputClient::FOCUS_REASON_NONE, + false /* should_do_learning */) {} IMEBridge::~IMEBridge() = default; +IMEInputContextHandlerInterface* IMEBridge::GetInputContextHandler() const { + return input_context_handler_; +} + +void IMEBridge::SetInputContextHandler( + IMEInputContextHandlerInterface* handler) { + input_context_handler_ = handler; + for (auto& observer : observers_) + observer.OnInputContextHandlerChanged(); +} + +void IMEBridge::SetCurrentEngineHandler(IMEEngineHandlerInterface* handler) { + engine_handler_ = handler; +} + +IMEEngineHandlerInterface* IMEBridge::GetCurrentEngineHandler() const { + return engine_handler_; +} + +void IMEBridge::SetCurrentInputContext( + const IMEEngineHandlerInterface::InputContext& input_context) { + current_input_context_ = input_context; +} + +const IMEEngineHandlerInterface::InputContext& +IMEBridge::GetCurrentInputContext() const { + return current_input_context_; +} + +void IMEBridge::AddObserver(ui::IMEBridgeObserver* observer) { + observers_.AddObserver(observer); +} + +void IMEBridge::RemoveObserver(ui::IMEBridgeObserver* observer) { + observers_.RemoveObserver(observer); +} + +void IMEBridge::MaybeSwitchEngine() { + for (auto& observer : observers_) + observer.OnRequestSwitchEngine(); +} + +void IMEBridge::SetCandidateWindowHandler( + ash::IMECandidateWindowHandlerInterface* handler) { + candidate_window_handler_ = handler; +} + +ash::IMECandidateWindowHandlerInterface* IMEBridge::GetCandidateWindowHandler() + const { + return candidate_window_handler_; +} + +void IMEBridge::SetAssistiveWindowHandler( + ash::IMEAssistiveWindowHandlerInterface* handler) { + assistive_window_handler_ = handler; +} + +ash::IMEAssistiveWindowHandlerInterface* IMEBridge::GetAssistiveWindowHandler() + const { + return assistive_window_handler_; +} + // static. void IMEBridge::Initialize() { if (!g_ime_bridge) - g_ime_bridge = new IMEBridgeImpl(); + g_ime_bridge = new IMEBridge(); } // static.
diff --git a/ui/base/ime/ash/ime_bridge.h b/ui/base/ime/ash/ime_bridge.h index 8c24a080..5fc7238 100644 --- a/ui/base/ime/ash/ime_bridge.h +++ b/ui/base/ime/ash/ime_bridge.h
@@ -6,7 +6,7 @@ #define UI_BASE_IME_ASH_IME_BRIDGE_H_ #include "base/component_export.h" -#include "build/build_config.h" +#include "base/observer_list.h" #include "ui/base/ime/ash/ime_assistive_window_handler_interface.h" #include "ui/base/ime/ash/ime_bridge_observer.h" #include "ui/base/ime/ash/ime_candidate_window_handler_interface.h" @@ -24,8 +24,7 @@ public: IMEBridge(const IMEBridge&) = delete; IMEBridge& operator=(const IMEBridge&) = delete; - - virtual ~IMEBridge(); + ~IMEBridge(); // Allocates the global instance. Must be called before any calls to Get(). static void Initialize(); @@ -38,55 +37,59 @@ // Returns current InputContextHandler. This function returns nullptr if input // context is not ready to use. - virtual IMEInputContextHandlerInterface* GetInputContextHandler() const = 0; + IMEInputContextHandlerInterface* GetInputContextHandler() const; // Updates current InputContextHandler. If there is no active input context, // pass nullptr for |handler|. Caller must release |handler|. - virtual void SetInputContextHandler( - IMEInputContextHandlerInterface* handler) = 0; + void SetInputContextHandler(IMEInputContextHandlerInterface* handler); // Updates current EngineHandler. If there is no active engine service, pass // nullptr for |handler|. Caller must release |handler|. - virtual void SetCurrentEngineHandler(IMEEngineHandlerInterface* handler) = 0; + void SetCurrentEngineHandler(IMEEngineHandlerInterface* handler); // Returns current EngineHandler. This function returns nullptr if current // engine is not ready to use. - virtual IMEEngineHandlerInterface* GetCurrentEngineHandler() const = 0; + IMEEngineHandlerInterface* GetCurrentEngineHandler() const; // Updates the current input context. // This is called from `InputMethodAsh`. - virtual void SetCurrentInputContext( - const IMEEngineHandlerInterface::InputContext& input_context) = 0; + void SetCurrentInputContext( + const IMEEngineHandlerInterface::InputContext& input_context); // Returns the current input context. // This is called from InputMethodEngine. - virtual const IMEEngineHandlerInterface::InputContext& - GetCurrentInputContext() const = 0; + const IMEEngineHandlerInterface::InputContext& GetCurrentInputContext() const; // Add or remove observers of events such as switching engines, etc. - virtual void AddObserver(ui::IMEBridgeObserver* observer) = 0; - virtual void RemoveObserver(ui::IMEBridgeObserver* observer) = 0; + void AddObserver(ui::IMEBridgeObserver* observer); + void RemoveObserver(ui::IMEBridgeObserver* observer); // Switches the engine handler upon top level window focus change. - virtual void MaybeSwitchEngine() = 0; + void MaybeSwitchEngine(); // Returns current CandidateWindowHandler. This function returns nullptr if // current candidate window is not ready to use. - virtual ash::IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() - const = 0; + ash::IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() const; // Updates current CandidatWindowHandler. If there is no active candidate // window service, pass nullptr for |handler|. Caller must release |handler|. - virtual void SetCandidateWindowHandler( - ash::IMECandidateWindowHandlerInterface* handler) = 0; + void SetCandidateWindowHandler( + ash::IMECandidateWindowHandlerInterface* handler); - virtual ash::IMEAssistiveWindowHandlerInterface* GetAssistiveWindowHandler() - const = 0; - virtual void SetAssistiveWindowHandler( - ash::IMEAssistiveWindowHandlerInterface* handler) = 0; + ash::IMEAssistiveWindowHandlerInterface* GetAssistiveWindowHandler() const; + void SetAssistiveWindowHandler( + ash::IMEAssistiveWindowHandlerInterface* handler); - protected: + private: IMEBridge(); + + IMEInputContextHandlerInterface* input_context_handler_ = nullptr; + IMEEngineHandlerInterface* engine_handler_ = nullptr; + base::ObserverList<IMEBridgeObserver> observers_; + IMEEngineHandlerInterface::InputContext current_input_context_; + + ash::IMECandidateWindowHandlerInterface* candidate_window_handler_ = nullptr; + ash::IMEAssistiveWindowHandlerInterface* assistive_window_handler_ = nullptr; }; } // namespace ui
diff --git a/ui/chromeos/styles/PRESUBMIT.py b/ui/chromeos/styles/PRESUBMIT.py index 025a2d3b..bd6b93c 100644 --- a/ui/chromeos/styles/PRESUBMIT.py +++ b/ui/chromeos/styles/PRESUBMIT.py
@@ -12,6 +12,10 @@ try: import sys old_sys_path = sys.path[:] + sys.path += [ + input_api.os_path.join( + input_api.change.RepositoryRoot(), 'ui', 'chromeos') + ] import styles.presubmit_support results += styles.presubmit_support._CheckSemanticColors( input_api, output_api)
diff --git a/ui/chromeos/styles/cros_colors.json5 b/ui/chromeos/styles/cros_colors.json5 index f95a2c6d..bc2ac5a 100644 --- a/ui/chromeos/styles/cros_colors.json5 +++ b/ui/chromeos/styles/cros_colors.json5
@@ -40,6 +40,7 @@ light: "$google_blue_600", dark: "$google_blue_300", debug: "$google_red_600", + generate_per_mode: true, }, color_alert: { light: "$google_red_600",
diff --git a/ui/chromeos/styles/presubmit_support.py b/ui/chromeos/styles/presubmit_support.py index b16414d..70039522 100644 --- a/ui/chromeos/styles/presubmit_support.py +++ b/ui/chromeos/styles/presubmit_support.py
@@ -12,6 +12,13 @@ first attempt is made to ensure lines affected have a var() occurrence which indicates we need to verify the variable. """ + file_filter = lambda f: input_api.FilterSourceFile( + f, files_to_check=(r'.+\.css', r'.+\.htm(l){1,}$', r'.+\.js$')) + affected_files = input_api.AffectedFiles(include_deletes=False, + file_filter=file_filter) + if not affected_files: + return [] + # Ensure the tools/ path is available to import style_variable_generator. input_api.sys.path.append( input_api.os_path.join(input_api.change.RepositoryRoot(), 'tools')) @@ -61,12 +68,9 @@ return invalid_matches valid_css_variables = style_generator.GetCSSVarNames() - file_filter = lambda f: input_api.FilterSourceFile( - f, files_to_check=(r'.+\.css', r'.+\.htm(l){1,}$', r'.+\.js$')) invalid_variables = [] - for f in input_api.AffectedFiles(include_deletes=False, - file_filter=file_filter): + for f in affected_files: for line_num, line in f.ChangedContents(): if any(prefix in line for prefix in css_prefixes): invalid_variables.extend(
diff --git a/ui/chromeos/ui_chromeos_strings.grd b/ui/chromeos/ui_chromeos_strings.grd index 16f9999..3121810 100644 --- a/ui/chromeos/ui_chromeos_strings.grd +++ b/ui/chromeos/ui_chromeos_strings.grd
@@ -152,7 +152,7 @@ </translations> <release seq="1"> <messages fallback_to_english="true"> - <!-- Files app strings. It's shared with ARC++ (//components/arc). --> + <!-- Files app strings. It's shared with ARC++ (//ash/components/arc). --> <part file="file_manager_strings.grdp" /> <!-- Default user profile images. -->
diff --git a/ui/events/keycodes/dom/dom_code_data.inc b/ui/events/keycodes/dom/dom_code_data.inc index 2642e55..c96987d 100644 --- a/ui/events/keycodes/dom/dom_code_data.inc +++ b/ui/events/keycodes/dom/dom_code_data.inc
@@ -103,6 +103,10 @@ // content. DOM_CODE(0x000018, 0x00f8, 0x0100, 0x0000, 0xffff, "MicrophoneMuteToggle", MICROPHONE_MUTE_TOGGLE), // Microphone Mute Toggle + // As with privacy screen, keyboard backlight toggle will not be exposed to web + // content. + DOM_CODE(0x000019, 0x00e4, 0x00ec, 0x0000, 0xffff, "KeyboardBacklightToggle", + KEYBOARD_BACKLIGHT_TOGGLE), // Keyboard Backlight Toggle // ========================================= // USB Usage Page 0x01: Generic Desktop Page
diff --git a/ui/events/keycodes/dom/keycode_converter_unittest.cc b/ui/events/keycodes/dom/keycode_converter_unittest.cc index 8c3987e..26e8317 100644 --- a/ui/events/keycodes/dom/keycode_converter_unittest.cc +++ b/ui/events/keycodes/dom/keycode_converter_unittest.cc
@@ -24,8 +24,8 @@ // These are in the same order as the columns in dom_code_data.inc // as reflected in the DOM_CODE() macro below. const size_t expected_mapped_key_count[] = { - 217, // evdev - 217, // xkb + 218, // evdev + 218, // xkb 157, // windows 119, // mac };
diff --git a/ui/events/keycodes/dom_us_layout_data.h b/ui/events/keycodes/dom_us_layout_data.h index 7eb00be..6c5dd279 100644 --- a/ui/events/keycodes/dom_us_layout_data.h +++ b/ui/events/keycodes/dom_us_layout_data.h
@@ -420,6 +420,8 @@ VKEY_PRIVACY_SCREEN_TOGGLE}, // 0x000017 PrivacyScreenToggle {DomCode::MICROPHONE_MUTE_TOGGLE, VKEY_MICROPHONE_MUTE_TOGGLE}, // 0x000018 MicrophoneMuteToggle + {DomCode::KEYBOARD_BACKLIGHT_TOGGLE, + VKEY_KBD_BACKLIGHT_TOGGLE}, // 0x000019 KeyboardBacklightToggle #endif {DomCode::SLEEP, VKEY_SLEEP}, // 0x010082 Sleep // DomCode::WAKE_UP 0x010083 WakeUp
diff --git a/ui/events/keycodes/keyboard_codes_posix.h b/ui/events/keycodes/keyboard_codes_posix.h index c69502bba..379da42 100644 --- a/ui/events/keycodes/keyboard_codes_posix.h +++ b/ui/events/keycodes/keyboard_codes_posix.h
@@ -226,6 +226,7 @@ VKEY_MICROPHONE_MUTE_TOGGLE = 0x9F, VKEY_BRIGHTNESS_DOWN = 0xD8, VKEY_BRIGHTNESS_UP = 0xD9, + VKEY_KBD_BACKLIGHT_TOGGLE = 0xB8, VKEY_KBD_BRIGHTNESS_DOWN = 0xDA, VKEY_KBD_BRIGHTNESS_UP = 0xE8,
diff --git a/ui/file_manager/PRESUBMIT.py b/ui/file_manager/PRESUBMIT.py index a8b75be..36ca53e 100644 --- a/ui/file_manager/PRESUBMIT.py +++ b/ui/file_manager/PRESUBMIT.py
@@ -27,6 +27,11 @@ import web_dev_style.presubmit_support results += web_dev_style.presubmit_support.CheckStyle( input_api, output_api) + + sys.path += [input_api.os_path.join(cwd, '..', 'chromeos')] + import styles.presubmit_support + results += styles.presubmit_support._CheckSemanticColors( + input_api, output_api) finally: sys.path = old_sys_path return results
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn index 9dea21c..dae1131 100644 --- a/ui/ozone/platform/wayland/BUILD.gn +++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -109,6 +109,8 @@ "host/wayland_event_watcher.h", "host/wayland_exchange_data_provider.cc", "host/wayland_exchange_data_provider.h", + "host/wayland_frame_manager.cc", + "host/wayland_frame_manager.h", "host/wayland_input_method_context.cc", "host/wayland_input_method_context.h", "host/wayland_input_method_context_factory.cc",
diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc index 0f2eb6e..db7037f 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc
@@ -414,65 +414,25 @@ void GbmSurfacelessWayland::OnSubmission(BufferId buffer_id, const gfx::SwapResult& swap_result, gfx::GpuFenceHandle release_fence) { - // submitted_frames_ may temporarily have more than one buffer in it if - // buffers are released out of order by the Wayland server. - DCHECK(!submitted_frames_.empty() || background_buffer_id_ == buffer_id); + DCHECK(!submitted_frames_.empty()); + DCHECK(submitted_frames_.front()->planes.count(buffer_id) || + buffer_id == background_buffer_id_); - // Let the holder mark this buffer as free to reuse. - solid_color_buffers_holder_->OnSubmission(buffer_id, buffer_manager_, - widget_); - - size_t erased = 0; - for (auto& submitted_frame : submitted_frames_) { - if ((erased = submitted_frame->planes.erase(buffer_id)) > 0) { - // |completion_callback| only takes 1 SwapResult. It's possible that only - // one of the buffers in a frame gets a SWAP_FAILED or - // SWAP_NAK_RECREATE_BUFFERS. Don't replace a failed swap_result with - // SWAP_ACK. If both SWAP_FAILED and SWAP_NAK_RECREATE_BUFFERS happens, - // this swap is treated as SWAP_FAILED. - if (submitted_frame->swap_result == gfx::SwapResult::SWAP_ACK || - swap_result == gfx::SwapResult::SWAP_FAILED) { - submitted_frame->swap_result = swap_result; - } - submitted_frame->pending_presentation_buffers.insert(buffer_id); - - // Accumulate release fences into a single fence. - if (!release_fence.is_null()) { - if (submitted_frame->merged_release_fence_fd.is_valid()) { - submitted_frame->merged_release_fence_fd.reset( - sync_merge("", submitted_frame->merged_release_fence_fd.get(), - release_fence.owned_fd.get())); - } else { - submitted_frame->merged_release_fence_fd = - std::move(release_fence.owned_fd); - } - DCHECK(submitted_frame->merged_release_fence_fd.is_valid()); - } - break; - } + auto submitted_frame = std::move(submitted_frames_.front()); + submitted_frames_.erase(submitted_frames_.begin()); + for (auto& plane : submitted_frame->planes) { + // Let the holder mark this buffer as free to reuse. + solid_color_buffers_holder_->OnSubmission(plane.first, buffer_manager_, + widget_); } + submitted_frame->planes.clear(); + submitted_frame->overlays.clear(); - // Following while loop covers below scenario: - // frame_1 submitted a buffer_1 for overlay; frame_2 submitted a buffer_2 - // for primary plane. This can happen at the end of a single-on-top overlay. - // buffer_1 is not attached immediately due to unack'ed wl_frame_callback. - // buffer_2 is attached immediately Onsubmission() of buffer_2 runs. - while (!submitted_frames_.empty() && - submitted_frames_.front()->planes.empty()) { - auto submitted_frame = std::move(submitted_frames_.front()); - submitted_frames_.erase(submitted_frames_.begin()); - submitted_frame->overlays.clear(); + std::move(submitted_frame->completion_callback) + .Run(gfx::SwapCompletionResult(swap_result, std::move(release_fence))); - gfx::GpuFenceHandle release_fence_handle; - if (submitted_frame->merged_release_fence_fd.is_valid()) - release_fence_handle.owned_fd = - std::move(submitted_frame->merged_release_fence_fd); - std::move(submitted_frame->completion_callback) - .Run(gfx::SwapCompletionResult(submitted_frame->swap_result, - std::move(release_fence_handle))); - - pending_presentation_frames_.push_back(std::move(submitted_frame)); - } + submitted_frame->pending_presentation_buffer = buffer_id; + pending_presentation_frames_.push_back(std::move(submitted_frame)); if (swap_result != gfx::SwapResult::SWAP_ACK) { last_swap_buffers_result_ = false; @@ -485,48 +445,13 @@ void GbmSurfacelessWayland::OnPresentation( BufferId buffer_id, const gfx::PresentationFeedback& feedback) { - DCHECK(!submitted_frames_.empty() || !pending_presentation_frames_.empty() || - background_buffer_id_ == buffer_id); + DCHECK(!pending_presentation_frames_.empty()); + DCHECK_EQ(pending_presentation_frames_.front()->pending_presentation_buffer, + buffer_id); - size_t erased = 0; - for (auto& frame : pending_presentation_frames_) { - if ((erased = frame->pending_presentation_buffers.erase(buffer_id)) > 0) { - frame->feedback = feedback; - break; - } - } - - // Items in |submitted_frames_| will not be moved to - // |pending_presentation_frames_| until |planes| is empty. - // Example: - // A SwapBuffers that submitted 2 buffers (buffer_1 and buffer_2) will push - // a submitted_frame expecting 2 submission feedbacks and 2 presentation - // feedbacks. - // If IPCs comes in the order of: - // buffer_1:submission > buffer_2:submission > buffer_1:presentation > - // buffer_2:presentation - // We are fine without below logic. However, this can happen: - // buffer_1:submission > buffer_1:presentation > buffer_2:submission > - // buffer_2:presentation - // In this case, we have to find the item in |submitted_frames_| and - // remove from |pending_presentation_buffers| there. - if (!erased) { - for (auto& frame : submitted_frames_) { - if ((erased = frame->pending_presentation_buffers.erase(buffer_id)) > 0) { - frame->feedback = feedback; - break; - } - } - } - - while (!pending_presentation_frames_.empty() && - pending_presentation_frames_.front() - ->pending_presentation_buffers.empty()) { - auto* frame = pending_presentation_frames_.front().get(); - DCHECK(frame->planes.empty()); - std::move(frame->presentation_callback).Run(frame->feedback); - pending_presentation_frames_.erase(pending_presentation_frames_.begin()); - } + std::move(pending_presentation_frames_.front()->presentation_callback) + .Run(feedback); + pending_presentation_frames_.erase(pending_presentation_frames_.begin()); } } // namespace ui
diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h index da89041..dd35920 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h +++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
@@ -126,6 +126,10 @@ void OnPresentation(BufferId buffer_id, const gfx::PresentationFeedback& feedback) override; + // PendingFrame here is a post-SkiaRenderer struct that contains overlays + + // primary plane informations. It is a "compositor frame" on AcceleratedWidget + // level. This information gets into browser process and overlays are + // translated to be attached to WaylandSurfaces of the AcceleratedWidget. struct PendingFrame { PendingFrame(); ~PendingFrame(); @@ -148,15 +152,12 @@ PresentationCallback presentation_callback; // Merged release fence fd. This is taken as the union of all release // fences for a particular OnSubmission. - base::ScopedFD merged_release_fence_fd; bool schedule_planes_succeeded = false; // Maps |buffer_id| to an OverlayPlane, used for committing overlays and // wait for OnSubmission's. base::small_map<std::map<BufferId, OverlayPlane>> planes; - base::flat_set<BufferId> pending_presentation_buffers; - gfx::SwapResult swap_result = gfx::SwapResult::SWAP_ACK; - gfx::PresentationFeedback feedback; + BufferId pending_presentation_buffer; }; void MaybeSubmitFrames(); @@ -177,8 +178,16 @@ // The native surface. Deleting this is allowed to free the EGLNativeWindow. gfx::AcceleratedWidget widget_; + + // PendingFrames that are waiting to be submitted. They can be either ready, + // waiting for gpu fences, or still scheduling overlays. std::vector<std::unique_ptr<PendingFrame>> unsubmitted_frames_; + + // PendingFrames that are submitted, pending OnSubmission() calls. std::vector<std::unique_ptr<PendingFrame>> submitted_frames_; + + // PendingFrames that have received OnSubmission(), pending OnPresentation() + // calls. std::vector<std::unique_ptr<PendingFrame>> pending_presentation_frames_; bool has_implicit_external_sync_; bool last_swap_buffers_result_ = true;
diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc index 683bf496..0e1114c 100644 --- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc +++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc
@@ -272,7 +272,7 @@ window_->primary_subsurface()->wayland_surface()->GetSurfaceId()); CallbacksHelper cbs_helper; - // Submit a frame with only primary plane + // Submit a frame with an overlay and background. { // Associate each image with swap id so that we could track released // buffers. @@ -283,12 +283,23 @@ // And set it to be busy... fake_gl_image[0]->SetBusy(true); - // Prepare overlay plane. + // Prepare background. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[0].get(), - /*z_order=*/0); + /*z_order=*/INT32_MIN); + + // Associate the image with the next swap id so that we can easily track if + // it became free to reuse. + fake_gl_image[1]->AssociateWithSwapId(swap_id); + // And set it to be busy... + fake_gl_image[1]->SetBusy(true); + + // Prepare overlay plane. + ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[1].get(), + /*z_order=*/1); std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; gl_images.push_back(fake_gl_image[0]); + gl_images.push_back(fake_gl_image[1]); // And submit each image. They will be executed in FIFO manner. gl_surface->SwapBuffersAsync( @@ -301,17 +312,19 @@ // Let's sync so that 1) GbmSurfacelessWayland submits the buffer according to // internal queue and fake server processes the request. - // Also, we expect only one buffer to be committed. - EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(1); - EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(1); - EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(1); - EXPECT_CALL(*mock_primary_surface, Commit()).Times(1); + // Also, we expect no buffer committed on primary subsurface. + EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(0); + EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(0); + EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(0); + // 1 buffer committed on root surface. + EXPECT_CALL(*root_surface, Attach(_, _, _)).Times(1); EXPECT_CALL(*root_surface, Frame(_)).Times(0); EXPECT_CALL(*root_surface, Commit()).Times(1); Sync(); - testing::Mock::VerifyAndClearExpectations(&mock_primary_surface); + testing::Mock::VerifyAndClearExpectations(mock_primary_surface); + testing::Mock::VerifyAndClearExpectations(root_surface); // Give mojo the chance to pass the callbacks. base::RunLoop().RunUntilIdle(); @@ -334,57 +347,12 @@ } } - // Submit another frame with only primary plane - { - // Associate each image with swap id so that we could track released - // buffers. - auto swap_id = cbs_helper.GetNextLocalSwapId(); - // Associate the image with the next swap id so that we can easily track if - // it became free to reuse. - fake_gl_image[1]->AssociateWithSwapId(swap_id); - // And set it to be busy... - fake_gl_image[1]->SetBusy(true); + auto* mock_overlay_surface = server_.GetObject<wl::MockSurface>( + (*window_->wayland_subsurfaces().begin()) + ->wayland_surface() + ->GetSurfaceId()); - // Prepare overlay plane. - ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[1].get(), - /*z_order=*/0); - - std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; - gl_images.push_back(fake_gl_image[1]); - - // And submit each image. They will be executed in FIFO manner. - gl_surface->SwapBuffersAsync( - base::BindOnce(&CallbacksHelper::FinishSwapBuffersAsync, - base::Unretained(&cbs_helper), swap_id, gl_images), - base::BindOnce(&CallbacksHelper::BufferPresented, - base::Unretained(&cbs_helper), swap_id)); - } - - // Expect one buffer to be committed. - EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(1); - EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(1); - EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(1); - EXPECT_CALL(*mock_primary_surface, Commit()).Times(1); - EXPECT_CALL(*root_surface, Frame(_)).Times(0); - EXPECT_CALL(*root_surface, Commit()).Times(1); - - // Send the frame callback so that pending buffer for swap id=1u is processed - // and swapped. - mock_primary_surface->SendFrameCallback(); - - Sync(); - - testing::Mock::VerifyAndClearExpectations(&mock_primary_surface); - - // Give mojo the chance to pass the callbacks. - base::RunLoop().RunUntilIdle(); - - // Even though the second buffer was submitted, we mustn't receive - // SwapCompletionCallback until the previous buffer is released. - EXPECT_EQ(cbs_helper.GetLastFinishedSwapId(), - std::numeric_limits<uint32_t>::max()); - - // Submit another frame with 2 overlays, 0 primary plane. + // Submit another frame with only an overlay. { // Associate each image with swap id so that we could track released // buffers. @@ -397,20 +365,68 @@ // Prepare overlay plane. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[2].get(), - /*z_order=*/-1); + /*z_order=*/1); + std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; + gl_images.push_back(fake_gl_image[2]); + + // And submit each image. They will be executed in FIFO manner. + gl_surface->SwapBuffersAsync( + base::BindOnce(&CallbacksHelper::FinishSwapBuffersAsync, + base::Unretained(&cbs_helper), swap_id, gl_images), + base::BindOnce(&CallbacksHelper::BufferPresented, + base::Unretained(&cbs_helper), swap_id)); + } + + // Expect no buffer committed on primary subsurface. + EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(0); + EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(0); + EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(0); + // Expect 1 buffer to be committed on overlay subsurface, with frame callback. + EXPECT_CALL(*mock_overlay_surface, Attach(_, _, _)).Times(1); + EXPECT_CALL(*mock_overlay_surface, Frame(_)).Times(1); + EXPECT_CALL(*mock_overlay_surface, DamageBuffer(_, _, _, _)).Times(1); + EXPECT_CALL(*mock_overlay_surface, Commit()).Times(1); + // Expect no buffer committed on root surface. + EXPECT_CALL(*root_surface, Attach(_, _, _)).Times(0); + EXPECT_CALL(*root_surface, Frame(_)).Times(0); + EXPECT_CALL(*root_surface, DamageBuffer(_, _, _, _)).Times(0); + EXPECT_CALL(*root_surface, Commit()).Times(1); + + // Send the frame callback so that pending buffer for swap id=1u is processed + // and swapped. + mock_overlay_surface->SendFrameCallback(); + + Sync(); + + testing::Mock::VerifyAndClearExpectations(mock_primary_surface); + testing::Mock::VerifyAndClearExpectations(mock_overlay_surface); + testing::Mock::VerifyAndClearExpectations(root_surface); + + // Give mojo the chance to pass the callbacks. + base::RunLoop().RunUntilIdle(); + + // Even though the second buffer was submitted, we mustn't receive + // SwapCompletionCallback until the previous buffer is released. + EXPECT_EQ(cbs_helper.GetLastFinishedSwapId(), + std::numeric_limits<uint32_t>::max()); + + // Submit another frame with 0 overlays, 1 primary plane. + { + // Associate each image with swap id so that we could track released + // buffers. + auto swap_id = cbs_helper.GetNextLocalSwapId(); // Associate the image with the next swap id so that we can easily track if // it became free to reuse. fake_gl_image[3]->AssociateWithSwapId(swap_id); // And set it to be busy... fake_gl_image[3]->SetBusy(true); - // Prepare overlay plane. + // Prepare primary plane. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[3].get(), - /*z_order=*/1); + /*z_order=*/0); std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; - gl_images.push_back(fake_gl_image[2]); gl_images.push_back(fake_gl_image[3]); // And submit each image. They will be executed in FIFO manner. @@ -421,41 +437,48 @@ base::Unretained(&cbs_helper), swap_id)); } - // Do not expect parent surface to be committed. - EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(0); - EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(0); - EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(0); - EXPECT_CALL(*mock_primary_surface, Commit()).Times(0); - // Expect root surface to be committed. + // Expect 1 buffer committed on primary subsurface, with frame callback. + EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(1); + EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(1); + EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(1); + EXPECT_CALL(*mock_primary_surface, Commit()).Times(1); + // Expect no buffer to be committed on overlay subsurface. + EXPECT_CALL(*mock_overlay_surface, Frame(_)).Times(0); + EXPECT_CALL(*mock_overlay_surface, DamageBuffer(_, _, _, _)).Times(0); + // Expect no buffer committed on root surface. + EXPECT_CALL(*root_surface, Attach(_, _, _)).Times(0); EXPECT_CALL(*root_surface, Frame(_)).Times(0); + EXPECT_CALL(*root_surface, DamageBuffer(_, _, _, _)).Times(0); EXPECT_CALL(*root_surface, Commit()).Times(1); // Send the frame callback so that pending buffer for swap id=2u is processed // and swapped. - mock_primary_surface->SendFrameCallback(); + mock_overlay_surface->SendFrameCallback(); + + // Release overlay image with swap id=1u before swap id=2u. + mock_overlay_surface->ReleaseBuffer(mock_overlay_surface->attached_buffer()); Sync(); - // Give mojo the chance to pass the callbacks. - base::RunLoop().RunUntilIdle(); + testing::Mock::VerifyAndClearExpectations(mock_primary_surface); + testing::Mock::VerifyAndClearExpectations(mock_overlay_surface); + testing::Mock::VerifyAndClearExpectations(root_surface); - // Even though OnSubmission can come back because 2 overlays are submitted to - // new wl_surfaces so OnSubmission for third frame has already run, - // GbmSurfacelessWayland should not run SwapCompletionCallback out of order. + // Even 2nd frame is released, we do not send OnSubmission() out of order. EXPECT_EQ(cbs_helper.GetLastFinishedSwapId(), std::numeric_limits<uint32_t>::max()); // This will result in Wayland server releasing previously attached buffer for // swap id=1u and calling OnSubmission for buffer with swap id=1u. - mock_primary_surface->ReleaseBuffer( - mock_primary_surface->prev_attached_buffer()); + mock_overlay_surface->ReleaseBuffer( + mock_overlay_surface->prev_attached_buffer()); Sync(); // Give mojo the chance to pass the callbacks. base::RunLoop().RunUntilIdle(); - // We should expect next 2 SwapCompletionCallbacks for the next 2 swap ids + // We should expect next 2 SwapCompletionCallbacks for the first 2 swap ids // consecutively. EXPECT_EQ(cbs_helper.GetLastFinishedSwapId(), 2u); @@ -473,9 +496,8 @@ TEST_P(WaylandSurfaceFactoryTest, GbmSurfacelessWaylandGroupOnSubmissionCallbacksTest) { - // This tests multiple buffers per-frame. GbmSurfacelessWayland should wait - // for all OnSubmission calls targeting the same frame before running - // SwapCompletionCallbacks. + // This tests multiple buffers per-frame. GbmSurfacelessWayland receive 1 + // OnSubmission call per frame before running in submission order. gl::SetGLImplementation(gl::kGLImplementationEGLGLES2); buffer_manager_gpu_->use_fake_gbm_device_for_test_ = true; @@ -490,12 +512,12 @@ static_cast<ui::GbmSurfacelessWayland*>(gl_surface.get()) ->SetNoGLFlushForTests(); - // Expect to create 4 buffers. - EXPECT_CALL(*server_.zwp_linux_dmabuf_v1(), CreateParams(_, _, _)).Times(4); + // Expect to create 5 buffers. + EXPECT_CALL(*server_.zwp_linux_dmabuf_v1(), CreateParams(_, _, _)).Times(5); // Create buffers and FakeGlImageNativePixmap. std::vector<scoped_refptr<FakeGLImageNativePixmap>> fake_gl_image; - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < 5; ++i) { auto native_pixmap = surface_factory_->CreateNativePixmap( widget_, nullptr, window_->GetBounds().size(), gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT); @@ -520,7 +542,7 @@ window_->primary_subsurface()->wayland_surface()->GetSurfaceId()); CallbacksHelper cbs_helper; - // Submit a frame with 1 primary plane and 1 overlay + // Submit a frame with 1 primary plane, 1 underlay, and 1 background. { // Associate each image with swap id so that we could track released // buffers. @@ -531,9 +553,9 @@ // And set it to be busy... fake_gl_image[0]->SetBusy(true); - // Prepare overlay plane. + // Prepare background. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[0].get(), - /*z_order=*/0); + /*z_order=*/INT32_MIN); // Associate the image with the next swap id so that we can easily track if // it became free to reuse. @@ -541,13 +563,24 @@ // And set it to be busy... fake_gl_image[1]->SetBusy(true); - // Prepare overlay plane. + // Prepare primary plane. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[1].get(), - /*z_order=*/1); + /*z_order=*/0); + + // Associate the image with the next swap id so that we can easily track if + // it became free to reuse. + fake_gl_image[2]->AssociateWithSwapId(swap_id); + // And set it to be busy... + fake_gl_image[2]->SetBusy(true); + + // Prepare underlay plane. + ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[2].get(), + /*z_order=*/-1); std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; gl_images.push_back(fake_gl_image[0]); gl_images.push_back(fake_gl_image[1]); + gl_images.push_back(fake_gl_image[2]); // And submit each image. They will be executed in FIFO manner. gl_surface->SwapBuffersAsync( @@ -603,27 +636,27 @@ auto swap_id = cbs_helper.GetNextLocalSwapId(); // Associate the image with the next swap id so that we can easily track if // it became free to reuse. - fake_gl_image[2]->AssociateWithSwapId(swap_id); - // And set it to be busy... - fake_gl_image[2]->SetBusy(true); - - // Prepare overlay plane. - ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[2].get(), - /*z_order=*/0); - - // Associate the image with the next swap id so that we can easily track if - // it became free to reuse. fake_gl_image[3]->AssociateWithSwapId(swap_id); // And set it to be busy... fake_gl_image[3]->SetBusy(true); - // Prepare overlay plane. + // Prepare primary plane. ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[3].get(), + /*z_order=*/0); + + // Associate the image with the next swap id so that we can easily track if + // it became free to reuse. + fake_gl_image[4]->AssociateWithSwapId(swap_id); + // And set it to be busy... + fake_gl_image[4]->SetBusy(true); + + // Prepare overlay plane. + ScheduleOverlayPlane(gl_surface.get(), fake_gl_image[4].get(), /*z_order=*/1); std::vector<scoped_refptr<FakeGLImageNativePixmap>> gl_images; - gl_images.push_back(fake_gl_image[2]); gl_images.push_back(fake_gl_image[3]); + gl_images.push_back(fake_gl_image[4]); // And submit each image. They will be executed in FIFO manner. gl_surface->SwapBuffersAsync( @@ -633,26 +666,29 @@ base::Unretained(&cbs_helper), swap_id)); } - // Expect primary buffer to be committed. + // Expect primary buffer to be committed, but since it is not the top-most + // surface in the frame it does not setup frame callback. EXPECT_CALL(*mock_primary_surface, Attach(_, _, _)).Times(1); - EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(1); + EXPECT_CALL(*mock_primary_surface, Frame(_)).Times(0); EXPECT_CALL(*mock_primary_surface, DamageBuffer(_, _, _, _)).Times(1); EXPECT_CALL(*mock_primary_surface, Commit()).Times(1); - // Expect overlay buffer to be committed. + // Expect overlay buffer to be committed, and sets up frame callback. EXPECT_CALL(*mock_overlay_surface, Attach(_, _, _)).Times(1); EXPECT_CALL(*mock_overlay_surface, Frame(_)).Times(1); EXPECT_CALL(*mock_overlay_surface, DamageBuffer(_, _, _, _)).Times(1); EXPECT_CALL(*mock_overlay_surface, Commit()).Times(1); // Expect root surface to be committed without buffer. + EXPECT_CALL(*root_surface, Attach(_, _, _)).Times(0); EXPECT_CALL(*root_surface, Frame(_)).Times(0); + EXPECT_CALL(*root_surface, DamageBuffer(_, _, _, _)).Times(0); EXPECT_CALL(*root_surface, Commit()).Times(1); // Send the frame callback so that pending buffer for swap id=1u is processed // and swapped. - mock_overlay_surface->SendFrameCallback(); mock_primary_surface->SendFrameCallback(); + mock_overlay_surface->SendFrameCallback(); Sync();
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_backing.cc b/ui/ozone/platform/wayland/host/wayland_buffer_backing.cc index dc913f2..f44d7993 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_backing.cc +++ b/ui/ozone/platform/wayland/host/wayland_buffer_backing.cc
@@ -6,6 +6,7 @@ #include "base/check_op.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_handle.h" +#include "ui/ozone/platform/wayland/host/wayland_connection.h" namespace ui { @@ -19,17 +20,22 @@ WaylandBufferBacking::~WaylandBufferBacking() = default; -bool WaylandBufferBacking::EnsureBufferHandle(WaylandSurface* requestor) { +bool WaylandBufferBacking::UseExplicitSyncRelease() const { + return connection_->linux_explicit_synchronization_v1(); +} + +WaylandBufferHandle* WaylandBufferBacking::EnsureBufferHandle( + WaylandSurface* requestor) { auto& buffer_handle = buffer_handles_[requestor]; if (buffer_handle) - return buffer_handle->wl_buffer_.get(); + return buffer_handle.get(); // Assign the anonymous handle to the |requestor|. auto& anonymous_handle = buffer_handles_[nullptr]; if (anonymous_handle) { buffer_handle.swap(anonymous_handle); - return buffer_handle->wl_buffer_.get(); + return buffer_handle.get(); } // The requested wl_buffer object is not requested. @@ -39,7 +45,7 @@ RequestBufferHandle(base::BindOnce(&WaylandBufferHandle::OnWlBufferCreated, buffer_handle->AsWeakPtr())); - return buffer_handle->wl_buffer_.get(); + return buffer_handle.get(); } WaylandBufferHandle* WaylandBufferBacking::GetBufferHandle(
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_backing.h b/ui/ozone/platform/wayland/host/wayland_buffer_backing.h index 69bc929..59cfd26 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_backing.h +++ b/ui/ozone/platform/wayland/host/wayland_buffer_backing.h
@@ -36,11 +36,16 @@ uint32_t id() const { return buffer_id_; } gfx::Size size() const { return size_; } - // Returns true if a wl_buffer can be attached to the |requestor|. Requests a - // new wl_buffer if such a wl_buffer does not exist. - bool EnsureBufferHandle(WaylandSurface* requestor = nullptr); + // Whether linux_explicit_synchronization extension is enabled. It is an + // extension that completely replaces base protocol's wl_buffer.release + // events. + bool UseExplicitSyncRelease() const; // Returns a wl_buffer wrapper that can be attached to the |requestor|. + // Requests a new wl_buffer if such a wl_buffer does not exist. + WaylandBufferHandle* EnsureBufferHandle(WaylandSurface* requestor = nullptr); + + // Same as above but does not do the requesting. WaylandBufferHandle* GetBufferHandle(WaylandSurface* requestor); protected:
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_handle.cc b/ui/ozone/platform/wayland/host/wayland_buffer_handle.cc index b2543d7..430d8769 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_handle.cc +++ b/ui/ozone/platform/wayland/host/wayland_buffer_handle.cc
@@ -11,7 +11,7 @@ WaylandBufferHandle::~WaylandBufferHandle() { if (!released_callback_.is_null()) - std::move(released_callback_).Run(); + std::move(released_callback_).Run(wl_buffer()); } void WaylandBufferHandle::OnWlBufferCreated( @@ -24,27 +24,23 @@ static struct wl_buffer_listener buffer_listener = { &WaylandBufferHandle::BufferRelease, }; - wl_buffer_add_listener(wl_buffer_.get(), &buffer_listener, this); + if (!backing_->UseExplicitSyncRelease()) + wl_buffer_add_listener(wl_buffer_.get(), &buffer_listener, this); if (!created_callback_.is_null()) std::move(created_callback_).Run(); } -void WaylandBufferHandle::Attached() { - expected_wl_buffer_releases_++; - released_ = false; -} - -void WaylandBufferHandle::Release(gfx::GpuFenceHandle fence) { - released_ = true; - release_fence_ = std::move(fence); +void WaylandBufferHandle::OnExplicitRelease() { + DCHECK(!released_callback_.is_null()); + released_callback_.Reset(); } void WaylandBufferHandle::OnWlBufferRelease(struct wl_buffer* wl_buff) { DCHECK_EQ(wl_buff, wl_buffer_.get()); - expected_wl_buffer_releases_--; - if (!released_callback_.is_null() && expected_wl_buffer_releases_ == 0) - std::move(released_callback_).Run(); + DCHECK(!backing_->UseExplicitSyncRelease()); + if (!released_callback_.is_null()) + std::move(released_callback_).Run(wl_buff); } base::WeakPtr<WaylandBufferHandle> WaylandBufferHandle::AsWeakPtr() {
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_handle.h b/ui/ozone/platform/wayland/host/wayland_buffer_handle.h index b06d8838..f878882 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_handle.h +++ b/ui/ozone/platform/wayland/host/wayland_buffer_handle.h
@@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "ui/gfx/gpu_fence_handle.h" +#include "ui/gfx/native_widget_types.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_backing.h" namespace ui { @@ -26,7 +27,8 @@ DCHECK(created_callback_.is_null()); created_callback_ = std::move(callback); } - void set_buffer_released_callback(base::OnceClosure callback) { + void set_buffer_released_callback( + base::OnceCallback<void(struct wl_buffer*)> callback) { released_callback_ = std::move(callback); } @@ -39,17 +41,16 @@ struct wl_buffer* wl_buffer() const { return wl_buffer_.get(); } - bool released() const { return released_; } - // Call when this buffer is ready to be re-used (i.e. giving back to viz). - // N.B. This moves the release fence, so it is not idempotent. - gfx::GpuFenceHandle TakeReleaseFence() { return std::move(release_fence_); } + // The existence of |released_callback_| is an indicator of whether the + // wl_buffer is released, when deciding whether wl_surface should explicitly + // call wl_surface.attach w/ the wl_bufffer. + bool released() const { return released_callback_.is_null(); } - // Call when this buffer is attached to a surface. - void Attached(); - - // Call when this buffer is unattached from a surface. - void Release(gfx::GpuFenceHandle release_fence); + // Called when the wl_surface this buffer is attached to becomes hidden, or + // when linux_explicit_synchronization extension is enabled to replace + // wl_buffer.release events. + void OnExplicitRelease(); private: // Called when wl_buffer object is created. @@ -67,13 +68,14 @@ // A callback that runs when the wl_buffer is created. base::OnceClosure created_callback_; - // A callback that runs when the wl_buffer is released by the Wayland - // compositor. - base::OnceClosure released_callback_; - // Tells that the buffer has already been released aka not busy, and the - // surface can tell the gpu about a successful swap. - bool released_ = true; + // A callback that binds WaylandFrameManager::OnWlBufferRelease() function, + // which erases a pending release buffer entry from the + // WaylandFrame::submitted_buffers, when wl_buffer.release event is signalled + // from the wl_compositor. + // When linux explicit synchronization is adopted, buffer_listener is unset + // and this callback should be reset by OnExplicitRelease() instead. + base::OnceCallback<void(struct wl_buffer*)> released_callback_; // Optional release fence. This may be set if the buffer is released // via the explicit synchronization Wayland protocol.
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc index 7cc59268..e711f9f 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc +++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc
@@ -9,15 +9,11 @@ #include <utility> #include "base/bind.h" -#include "base/callback_helpers.h" -#include "base/compiler_specific.h" -#include "base/containers/cxx20_erase.h" #include "base/i18n/number_formatting.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/task/current_thread.h" #include "base/trace_event/trace_event.h" -#include "ui/gfx/gpu_fence.h" #include "ui/gfx/gpu_fence_handle.h" #include "ui/gfx/linux/drm_util_linux.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_backing.h" @@ -28,700 +24,26 @@ #include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_drm.h" #include "ui/ozone/platform/wayland/host/wayland_shm.h" -#include "ui/ozone/platform/wayland/host/wayland_subsurface.h" -#include "ui/ozone/platform/wayland/host/wayland_surface.h" #include "ui/ozone/platform/wayland/host/wayland_window.h" #include "ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.h" +#include "ui/ozone/public/mojom/wayland/wayland_overlay_config.mojom.h" namespace ui { namespace { -// Use |kInvalidBufferId| to commit surface state without updating wl_buffer. -constexpr uint32_t kInvalidBufferId = 0u; - -uint32_t GetPresentationKindFlags(uint32_t flags) { - // Wayland spec has different meaning of VSync. In Chromium, VSync means to - // update the begin frame vsync timing based on presentation feedback. - uint32_t presentation_flags = gfx::PresentationFeedback::kVSync; - - if (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK) - presentation_flags |= gfx::PresentationFeedback::kHWClock; - if (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION) - presentation_flags |= gfx::PresentationFeedback::kHWCompletion; - if (flags & WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY) - presentation_flags |= gfx::PresentationFeedback::kZeroCopy; - - return presentation_flags; -} - std::string NumberToString(uint32_t number) { return base::UTF16ToUTF8(base::FormatNumber(number)); } } // namespace -struct WaylandBufferManagerHost::Frame { - explicit Frame(WaylandSurface* root_surface, - WaylandBufferManagerHost* manager) - : root_surface(root_surface), - buffer_manager_(manager), - weak_factory(this) {} - void IncrementPendingActions() { ++pending_actions; } - void PendingActionComplete() { - DCHECK(base::CurrentUIThread::IsSet()); - CHECK_GT(pending_actions, 0u); - if (!--pending_actions && !frame_commit_cb.is_null()) - std::move(frame_commit_cb).Run(); - } - - // |root_surface| and |buffer_id| are saved so this Frame can be destroyed to - // prevent running |frame_commit_cb| in case the corresponding surface/buffer - // is removed. - WaylandSurface* root_surface; - uint32_t buffer_id = 0u; - - // Calls TerminateGpuProcess() if buffer does not exist. - WaylandBufferManagerHost* const buffer_manager_; - - // Number of actions to be completed before |frame_commit_cb| is run - // automatically. Such actions include: - // 1) End Frame; - // 2) Commit of a subsurface in this frame; - size_t pending_actions = 0u; - - // This runs WaylandBufferManagerHost::Surface::CommitBuffer() of - // |root_surface| with |buffer_id|. - base::OnceCallback<bool()> frame_commit_cb = - base::BindOnce([] { return true; }); - base::WeakPtrFactory<WaylandBufferManagerHost::Frame> weak_factory; -}; - -class WaylandBufferManagerHost::Surface { - public: - Surface(WaylandSurface* wayland_surface, - WaylandConnection* connection, - WaylandBufferManagerHost* buffer_manager) - : wayland_surface_(wayland_surface), - connection_(connection), - buffer_manager_(buffer_manager) { - wayland_surface_->set_explicit_release_callback(base::BindRepeating( - &Surface::BufferExplicitRelease, weak_ptr_factory_.GetWeakPtr())); - } - - Surface(const Surface&) = delete; - Surface& operator=(const Surface&) = delete; - - ~Surface() = default; - - bool CommitBuffer( - uint32_t buffer_id, - const gfx::Rect& damage_region, - bool wait_for_frame_callback, - base::OnceClosure post_commit_cb, - gfx::GpuFenceHandle access_fence_handle = gfx::GpuFenceHandle()) { - DCHECK(!post_commit_cb.is_null()); - // The window has already been destroyed. - if (!wayland_surface_) - return true; - - // This is a buffer-less commit, do not lookup buffers. - if (buffer_id == kInvalidBufferId) { - DCHECK(access_fence_handle.is_null()); - pending_commits_.push_back({nullptr, wait_for_frame_callback, - gfx::GpuFenceHandle(), - std::move(post_commit_cb), gfx::Rect()}); - MaybeProcessPendingBuffer(); - return true; - } - - bool wl_buffer_created = - buffer_manager_->EnsureBufferHandle(wayland_surface_, buffer_id); - WaylandBufferHandle* buffer = - buffer_manager_->GetBufferHandle(wayland_surface_, buffer_id); - - if (!buffer) - return false; - - if (!wl_buffer_created) { - buffer->set_buffer_created_callback(base::BindOnce( - &WaylandBufferManagerHost::Surface::MaybeProcessPendingBuffer, - weak_ptr_factory_.GetWeakPtr())); - } - - pending_commits_.push_back({buffer->AsWeakPtr(), wait_for_frame_callback, - std::move(access_fence_handle), - std::move(post_commit_cb), damage_region}); - MaybeProcessPendingBuffer(); - return true; - } - - void ClearState() { - ResetSurfaceContents(); - - feedback_queue_.clear(); - submitted_buffers_.clear(); - - connection_->ScheduleFlush(); - } - - void ResetSurfaceContents() { - if (!wayland_surface_) - return; - - if (wayland_surface_->has_buffer_attached()) { - wayland_surface_->AttachBuffer(nullptr); - wayland_surface_->ApplyPendingState(); - wayland_surface_->Commit(); - } - - wl_frame_callback_.reset(); - - for (auto& pending_commit : pending_commits_) { - std::move(pending_commit.post_commit_cb).Run(); - if (!pending_commit.buffer) - continue; - - submitted_buffers_.push_back(SubmissionInfo{ - pending_commit.buffer->AsWeakPtr(), pending_commit.buffer->id(), - /*acked=*/submitted_buffers_.empty() ? true : false}); - if (connection_->presentation()) { - feedback_queue_.push_back( - {wl::Object<struct wp_presentation_feedback>(), - pending_commit.buffer->id(), gfx::PresentationFeedback::Failure(), - /*submission_completed=*/false}); - } - } - pending_commits_.clear(); - // Mutter sometimes does not call buffer.release if wl_surface role is - // destroyed, causing graphics freeze. Manually release them and trigger - // OnSubmission callbacks. - for (auto& buffer : submitted_buffers_) { - auto* buff = buffer.buffer.get(); - if (buff) - buff->Release(/*release_fence=*/gfx::GpuFenceHandle()); - } - MaybeProcessSubmittedBuffers(); - - // 1) ResetSurfaceContents happens upon WaylandWindow::Hide call, which - // destroys xdg_surface, xdg_popup, etc. They are going to be reinitialized - // once WaylandWindow::Show is called. Thus, they will have to be configured - // once again before buffers can be attached. - // 2) ResetSurfaceContents can also be called if gpu crashed and a channel - // has been destroyed. Thus, the surface's configure state has to be - // verified at this point. - configured_ = wayland_surface_->root_window()->IsSurfaceConfigured(); - - connection_->ScheduleFlush(); - } - - void OnSurfaceRemoved() { wayland_surface_ = nullptr; } - bool HasSurface() const { return !!wayland_surface_; } - - void OnSurfaceConfigured() { - if (configured_) - return; - - configured_ = true; - MaybeProcessPendingBuffer(); - } - - private: - struct FeedbackInfo { - // The wayland object identifying this feedback. - wl::Object<struct wp_presentation_feedback> wp_presentation_feedback; - // The buffer that this presentation feedback is for. - uint32_t buffer_id; - // The actual presentation feedback. May be missing if the callback from the - // Wayland server has not arrived yet. - absl::optional<gfx::PresentationFeedback> feedback; - // True iff OnSubmission has been called. - bool submission_completed; - }; - - using PresentationFeedbackQueue = std::vector<FeedbackInfo>; - - // Holds information about a submitted buffer. - struct SubmissionInfo { - // Weak reference to the submitted buffer handle. - base::WeakPtr<WaylandBufferHandle> buffer; - // ID of the submitted buffer. Buffers may be destroyed after they have been - // submitted but before we send OnSubmission for them, e.g. if the same - // buffer is submitted twice in a row. Keep the ID so we send OnSubmission - // even if a buffer is destroyed. - uint32_t buffer_id; - // Whether this buffer has had OnSubmission sent for it. - bool acked; - }; - - // Represents a pending surface commit. - struct PendingCommit { - // If null, means this commit will not attach buffer. - base::WeakPtr<WaylandBufferHandle> buffer; - // Whether this commit must wait for a wl_frame_callback and setup another - // wl_frame_callback. - bool wait_for_callback = false; - // Fence to wait on before the |buffer| content is available to read by - // Wayland host. - gfx::GpuFenceHandle access_fence; - // Callback to run once this commit is applied. - base::OnceClosure post_commit_cb; - // Damage region this buffer describes. - gfx::Rect damage_region; - }; - - bool CommitBufferInternal(WaylandBufferHandle* buffer, - bool wait_for_callback, - const gfx::Rect& damage_region, - gfx::GpuFenceHandle access_fence_handle) { - DCHECK(buffer && wayland_surface_); - - // If the same buffer has been submitted again right after the client - // received OnSubmission for that buffer, just damage the buffer and - // commit the surface again. However, if the buffer is released, it's safe - // to reattach the buffer. - bool should_attach_buffer = - submitted_buffers_.empty() || - submitted_buffers_.back().buffer_id != buffer->id() || - buffer->released(); - if (should_attach_buffer) { - // Once the BufferRelease is called, the buffer will be released. - DCHECK(buffer->released()); - buffer->Attached(); - AttachBuffer(buffer, std::move(access_fence_handle)); - } - - // If the client submits the same buffer twice, we need to store it twice, - // because the client will expect two acks for it. - submitted_buffers_.push_back( - SubmissionInfo{buffer->AsWeakPtr(), buffer->id(), /*acked=*/false}); - - DamageBuffer(buffer, damage_region); - - // On Mutter, we don't receive frame.callback acks if we don't attach a new - // wl_buffer. This is more likely to happen with overlay single-on-top - // strategy, which leads to graphics freeze. So only setup frame_callback - // when we're attaching a different buffer. - if (should_attach_buffer && wait_for_callback) - SetupFrameCallback(); - - SetupPresentationFeedback(buffer->id()); - - CommitSurface(); - connection_->ScheduleFlush(); - MaybeProcessSubmittedBuffers(); - - return true; - } - - void DamageBuffer(WaylandBufferHandle* buffer, gfx::Rect damage_region) { - DCHECK(wayland_surface_); - wayland_surface_->UpdateBufferDamageRegion(damage_region); - } - - void AttachBuffer(WaylandBufferHandle* buffer, - gfx::GpuFenceHandle access_fence_handle) { - DCHECK(wayland_surface_ && configured_); - if (!access_fence_handle.is_null()) - wayland_surface_->SetAcquireFence(std::move(access_fence_handle)); - wayland_surface_->AttachBuffer(buffer); - } - - void CommitSurface() { - DCHECK(wayland_surface_); - wayland_surface_->ApplyPendingState(); - wayland_surface_->Commit(); - } - - void SetupFrameCallback() { - DCHECK(wayland_surface_); - static constexpr wl_callback_listener frame_listener = {&FrameCallbackDone}; - - DCHECK(!wl_frame_callback_); - wl_frame_callback_.reset(wl_surface_frame(wayland_surface_->surface())); - wl_callback_add_listener(wl_frame_callback_.get(), &frame_listener, this); - } - - void SetupPresentationFeedback(uint32_t buffer_id) { - DCHECK(wayland_surface_); - // Set up presentation feedback. - if (!connection_->presentation()) - return; - - static constexpr wp_presentation_feedback_listener feedback_listener = { - &FeedbackSyncOutput, &FeedbackPresented, &FeedbackDiscarded}; - - feedback_queue_.push_back( - {wl::Object<struct wp_presentation_feedback>(wp_presentation_feedback( - connection_->presentation(), wayland_surface_->surface())), - buffer_id, /*feedback=*/absl::nullopt, - /*submission_completed=*/false}); - wp_presentation_feedback_add_listener( - feedback_queue_.back().wp_presentation_feedback.get(), - &feedback_listener, this); - } - - void OnFrameCallback(struct wl_callback* callback) { - DCHECK(wl_frame_callback_.get() == callback); - wl_frame_callback_.reset(); - - MaybeProcessPendingBuffer(); - } - - // wl_callback_listener - static void FrameCallbackDone(void* data, - struct wl_callback* callback, - uint32_t time) { - Surface* self = static_cast<Surface*>(data); - DCHECK(self); - self->OnFrameCallback(callback); - } - - void OnRelease(struct wl_buffer* wl_buffer, - gfx::GpuFenceHandle release_fence) { - DCHECK(wl_buffer); - - // Releases may not necessarily come in order, so search the submitted - // buffers. - WaylandBufferHandle* buffer = nullptr; - for (const auto& buff : submitted_buffers_) { - auto* submitted_buffer = buff.buffer.get(); - if (submitted_buffer && wl_buffer == submitted_buffer->wl_buffer()) { - buffer = submitted_buffer; - break; - } - } - // It's possible to be unable to find the released buffer in - // |submitted_buffers_| due to the manual releasing in - // ResetSurfaceContents(). - if (buffer) - buffer->Release(std::move(release_fence)); - - // A release means we may be able to send OnSubmission for previously - // submitted buffers. - MaybeProcessSubmittedBuffers(); - } - - // Called when we receive an immediate or fenced release for a buffer, via - // the explicit synchronization protocol. - void BufferExplicitRelease(wl_buffer* wl_buffer, - absl::optional<int32_t> fence) { - if (fence) { - gfx::GpuFenceHandle handle; - handle.owned_fd.reset(fence.value()); - OnRelease(wl_buffer, std::move(handle)); - } else { - OnRelease(wl_buffer, /*release_fence=*/gfx::GpuFenceHandle()); - } - } - - void MaybeProcessSubmittedBuffers() { - if (!wayland_surface_) - return; - - // We force an OnSubmission call for the very first buffer submitted, - // otherwise buffers are not acked in a quiescent state. We keep track of - // whether it has already been acked. A buffer may have already been acked - // if it is the first buffer submitted and it is destroyed before being - // explicitly released. In that case, don't send an OnSubmission. - if (submitted_buffers_.size() == 1u && !submitted_buffers_[0].acked) - ProcessOldestSubmittedBuffer(/*release_fence=*/gfx::GpuFenceHandle()); - - // Buffers may be released out of order, but we need to provide the - // guarantee that OnSubmission will be called in order of buffer submission. - while (submitted_buffers_.size() >= 2) { - auto* buffer0 = submitted_buffers_[0].buffer.get(); - // Treat a buffer as released if it has been explicitly released or - // destroyed. This includes if we have a release fence for it - in that - // case, the OnSubmission for the 2nd oldest buffer should contain the - // release fence for the oldest buffer. - bool buffer0_released = !buffer0 || buffer0->released(); - // We can send OnSubmission for the 2nd oldest buffer if the oldest buffer - // is released, or it's the same buffer. - if (!buffer0_released && - submitted_buffers_[0].buffer_id != submitted_buffers_[1].buffer_id) - break; - - DCHECK(submitted_buffers_[0].acked); - DCHECK(!submitted_buffers_[1].acked); - submitted_buffers_.erase(submitted_buffers_.begin()); - ProcessOldestSubmittedBuffer(buffer0 ? buffer0->TakeReleaseFence() - : gfx::GpuFenceHandle()); - } - } - - void ProcessOldestSubmittedBuffer(gfx::GpuFenceHandle release_fence) { - DCHECK(wayland_surface_); - DCHECK(!submitted_buffers_.empty()); - - submitted_buffers_.front().acked = true; - auto buffer_id = submitted_buffers_.front().buffer_id; - - // We can now complete the latest submission. We had to wait for this - // release because SwapCompletionCallback indicates to the client that the - // previous buffer is available for reuse. - buffer_manager_->OnSubmission(wayland_surface_->GetWidget(), buffer_id, - gfx::SwapResult::SWAP_ACK, - std::move(release_fence)); - - // If presentation feedback is not supported, use a fake feedback. This - // literally means there are no presentation feedback callbacks created. - if (!connection_->presentation()) { - DCHECK(feedback_queue_.empty()); - buffer_manager_->OnPresentation( - wayland_surface_->GetWidget(), buffer_id, - gfx::PresentationFeedback(base::TimeTicks::Now(), base::TimeDelta(), - GetPresentationKindFlags(0))); - } else { - for (auto& info : feedback_queue_) { - if (info.buffer_id == buffer_id && !info.submission_completed) { - info.submission_completed = true; - ProcessPresentationFeedbacks(); - return; - } - } - NOTREACHED() << "Did not find matching feedback for buffer_id=" - << buffer_id; - } - } - - void OnPresentation(struct wp_presentation_feedback* wp_presentation_feedback, - const gfx::PresentationFeedback& feedback, - bool discarded = false) { - FeedbackInfo* feedback_info = nullptr; - for (auto& info : feedback_queue_) { - if (info.wp_presentation_feedback.get() == wp_presentation_feedback) { - feedback_info = &info; - break; - } else if (!info.feedback.has_value() && !discarded) { - // Feedback must come in order. However, if one of the feedbacks was - // discarded and the previous feedbacks haven't been received yet, don't - // mark previous feedbacks as failed as they will come later. For - // example, imagine you are waiting for f[0], f[1] and f[2]. f[2] gets - // discarded, previous ones mustn't be marked as failed as they will - // come later. - info.feedback = gfx::PresentationFeedback::Failure(); - } - } - DCHECK(feedback_info); - DCHECK(!feedback_info->feedback.has_value()); - feedback_info->feedback = feedback; - - ProcessPresentationFeedbacks(); - } - - // We provide the guarantee to the client that: - // 1. OnPresentation and OnSubmission will be called for each submitted buffer - // 2. OnPresentation(buffer_id) will be called after OnSubmission(buffer_id) - // 3. OnPresentation and OnSubmission will be called in the same order - // of buffer submission. - // We make the following assumptions about the server: - // 1. Presentation feedback will arrive in the same order of submission. - // 2. Presentation feedback may never arrive if the buffer is destroyed. - // 3. Presentation feedback may arrive at an arbitrary time after commit. - // For these reasons, we can't associate feedback with a specific buffer, - // as there may be more than one feedback in-flight for a single buffer. - // This function ensures that we send OnPresentation for each buffer that - // already has had OnSubmission called for it (condition #2). - void ProcessPresentationFeedbacks() { - if (!wayland_surface_) - return; - - while (!feedback_queue_.empty()) { - const auto& info = feedback_queue_.front(); - if (!info.submission_completed || !info.feedback.has_value()) - break; - buffer_manager_->OnPresentation(wayland_surface_->GetWidget(), - info.buffer_id, *info.feedback); - feedback_queue_.erase(feedback_queue_.begin()); - } - // This queue should be small - if not it's likely a bug. - DCHECK_LE(feedback_queue_.size(), 25u); - } - - // wp_presentation_feedback_listener - static void FeedbackSyncOutput( - void* data, - struct wp_presentation_feedback* wp_presentation_feedback, - struct wl_output* output) {} - - static void FeedbackPresented( - void* data, - struct wp_presentation_feedback* wp_presentation_feedback, - uint32_t tv_sec_hi, - uint32_t tv_sec_lo, - uint32_t tv_nsec, - uint32_t refresh, - uint32_t seq_hi, - uint32_t seq_lo, - uint32_t flags) { - Surface* self = static_cast<Surface*>(data); - DCHECK(self); - self->OnPresentation( - wp_presentation_feedback, - gfx::PresentationFeedback(self->connection_->ConvertPresentationTime( - tv_sec_hi, tv_sec_lo, tv_nsec), - base::Nanoseconds(refresh), - GetPresentationKindFlags(flags))); - } - - static void FeedbackDiscarded( - void* data, - struct wp_presentation_feedback* wp_presentation_feedback) { - Surface* self = static_cast<Surface*>(data); - DCHECK(self); - self->OnPresentation(wp_presentation_feedback, - gfx::PresentationFeedback::Failure(), - true /* discarded */); - } - - void MaybeProcessPendingBuffer() { - DCHECK_LE(pending_commits_.size(), 6u); - // There is nothing to process if there is no pending buffer or the window - // has been destroyed. - if (pending_commits_.empty() || !wayland_surface_) - return; - - // This request may come earlier than the Wayland compositor has imported a - // wl_buffer. Wait until the buffer is created. The wait takes place only - // once. Though, the case when a request to attach a buffer comes earlier - // than the wl_buffer is created does not happen often. 1) Depending on the - // zwp linux dmabuf protocol version, the wl_buffer can be created - // immediately without asynchronous wait 2) the wl_buffer can have been - // created by this time. - // - // Another case, which always happen is waiting until the frame callback is - // completed. Thus, wait here when the Wayland compositor fires the frame - // callback. - // - // The third case happens if the window hasn't been configured until a - // request to attach a buffer to its surface is sent. - const auto& pending_commit = pending_commits_.front(); - if ((pending_commit.buffer && !pending_commit.buffer->wl_buffer()) || - (wl_frame_callback_ && pending_commit.wait_for_callback) || - !configured_) { - return; - } - - auto commit = std::move(pending_commits_.front()); - pending_commits_.erase(pending_commits_.begin()); - - // A Commit without attaching buffers only needs to setup wl_frame_callback. - if (!commit.buffer) { - if (commit.wait_for_callback) - SetupFrameCallback(); - CommitSurface(); - std::move(commit.post_commit_cb).Run(); - connection_->ScheduleFlush(); - MaybeProcessSubmittedBuffers(); - return; - } - - commit.buffer->set_buffer_released_callback(base::BindOnce( - &WaylandBufferManagerHost::Surface::OnRelease, - weak_ptr_factory_.GetWeakPtr(), commit.buffer->wl_buffer(), - /*release_fence=*/gfx::GpuFenceHandle())); - - CommitBufferInternal(commit.buffer.get(), commit.wait_for_callback, - commit.damage_region, std::move(commit.access_fence)); - std::move(commit.post_commit_cb).Run(); - } - - // Widget this helper surface backs and has 1:1 relationship with the - // WaylandWindow. - - // Non-owned. The surface this helper stores and submits buffers for. - WaylandSurface* wayland_surface_; - - // Non-owned pointer to the connection. - WaylandConnection* const connection_; - - // Non-owned pointer to the buffer manager. - WaylandBufferManagerHost* const buffer_manager_; - - // A Wayland callback, which is triggered once wl_buffer has been committed - // and it is right time to notify the GPU that it can start a new drawing - // operation. - wl::Object<wl_callback> wl_frame_callback_; - - // Queue of commits which are pending to be submitted (look the comment - // in the CommitBuffer method). - std::list<PendingCommit> pending_commits_; - - // Queue of buffers which have been submitted and are waiting to be - // acked (send OnSubmission) - std::vector<SubmissionInfo> submitted_buffers_; - - // Queue of buffers which have been acked and are waiting to have - // OnPresentation sent. - PresentationFeedbackQueue feedback_queue_; - - // If WaylandWindow has never been configured, do not try to attach - // buffers to its surface. Otherwise, Wayland server will drop the connection - // and send an error - "The surface has never been configured.". - bool configured_ = false; - - base::WeakPtrFactory<Surface> weak_ptr_factory_{this}; -}; - WaylandBufferManagerHost::WaylandBufferManagerHost( WaylandConnection* connection) - : connection_(connection), receiver_(this), weak_factory_(this) { - connection_->wayland_window_manager()->AddObserver(this); -} + : connection_(connection), receiver_(this) {} WaylandBufferManagerHost::~WaylandBufferManagerHost() = default; -void WaylandBufferManagerHost::OnWindowAdded(WaylandWindow* window) { - DCHECK(window); - surfaces_[window->root_surface()] = - std::make_unique<Surface>(window->root_surface(), connection_, this); -} - -void WaylandBufferManagerHost::OnWindowRemoved(WaylandWindow* window) { - DCHECK(window); - auto it = surfaces_.find(window->root_surface()); - DCHECK(it != surfaces_.end()); - surfaces_.erase(it); - - RemovePendingFrames(window->root_surface(), 0u); -} - -void WaylandBufferManagerHost::OnWindowConfigured(WaylandWindow* window) { - DCHECK(window); - auto it = surfaces_.find(window->root_surface()); - DCHECK(it != surfaces_.end()); - it->second->OnSurfaceConfigured(); -} - -void WaylandBufferManagerHost::OnSubsurfaceAdded( - WaylandWindow* window, - WaylandSubsurface* subsurface) { - DCHECK(subsurface); - surfaces_[subsurface->wayland_surface()] = std::make_unique<Surface>( - subsurface->wayland_surface(), connection_, this); - // WaylandSubsurface is always configured. - surfaces_[subsurface->wayland_surface()]->OnSurfaceConfigured(); -} - -void WaylandBufferManagerHost::OnSubsurfaceRemoved( - WaylandWindow* window, - WaylandSubsurface* subsurface) { - DCHECK(subsurface); - auto it = surfaces_.find(subsurface->wayland_surface()); - DCHECK(it != surfaces_.end()); - surfaces_.erase(it); - - RemovePendingFrames(subsurface->wayland_surface(), 0u); -} - -void WaylandBufferManagerHost::SetSurfaceConfigured(WaylandSurface* surface) { - DCHECK(surface); - auto it = surfaces_.find(surface); - DCHECK(it != surfaces_.end()); - it->second->OnSurfaceConfigured(); -} - void WaylandBufferManagerHost::SetTerminateGpuCallback( base::OnceCallback<void(std::string)> terminate_callback) { terminate_gpu_cb_ = std::move(terminate_callback); @@ -740,14 +62,14 @@ } void WaylandBufferManagerHost::OnChannelDestroyed() { - for (auto& surface_pair : surfaces_) - surface_pair.second->ClearState(); + DCHECK(base::CurrentUIThread::IsSet()); + + buffer_backings_.clear(); + for (auto* window : connection_->wayland_window_manager()->GetAllWindows()) + window->OnChannelDestroyed(); buffer_manager_gpu_associated_.reset(); receiver_.reset(); - - pending_frames_.clear(); - buffer_backings_.clear(); } wl::BufferFormatsWithModifiersMap @@ -899,24 +221,7 @@ backing->EnsureBufferHandle(); } -bool WaylandBufferManagerHost::EnsureBufferHandle(WaylandSurface* requestor, - uint32_t buffer_id) { - DCHECK(base::CurrentUIThread::IsSet()); - DCHECK(error_message_.empty()); - DCHECK(requestor); - - auto it = buffer_backings_.find(buffer_id); - if (it == buffer_backings_.end()) { - error_message_ = base::StrCat( - {"Buffer with ", NumberToString(buffer_id), " id does not exist"}); - TerminateGpuProcess(); - return false; - } - - return it->second->EnsureBufferHandle(requestor); -} - -WaylandBufferHandle* WaylandBufferManagerHost::GetBufferHandle( +WaylandBufferHandle* WaylandBufferManagerHost::EnsureBufferHandle( WaylandSurface* requestor, uint32_t buffer_id) { DCHECK(base::CurrentUIThread::IsSet()); @@ -927,76 +232,22 @@ if (it == buffer_backings_.end()) return nullptr; + return it->second->EnsureBufferHandle(requestor); +} + +WaylandBufferHandle* WaylandBufferManagerHost::GetBufferHandle( + WaylandSurface* requestor, + uint32_t buffer_id) { + DCHECK(base::CurrentUIThread::IsSet()); + DCHECK(requestor); + + auto it = buffer_backings_.find(buffer_id); + if (it == buffer_backings_.end()) + return nullptr; + return it->second->GetBufferHandle(requestor); } -void WaylandBufferManagerHost::StartFrame(WaylandSurface* root_surface) { - RemovePendingFrames(nullptr, 0u); - DCHECK_LE(pending_frames_.size(), 10u); - pending_frames_.push_back( - std::make_unique<WaylandBufferManagerHost::Frame>(root_surface, this)); - pending_frames_.back()->IncrementPendingActions(); -} - -void WaylandBufferManagerHost::EndFrame(uint32_t buffer_id, - const gfx::Rect& damage_region) { - DCHECK(base::CurrentUIThread::IsSet()); - - // If TerminateGpuProcess() is called, pending_frames_ would be cleared. - if (pending_frames_.empty()) - return; - - pending_frames_.back()->buffer_id = buffer_id; - Surface* surface = GetSurface(pending_frames_.back()->root_surface); - if (!surface) { - pending_frames_.erase(--pending_frames_.end()); - return; - } - - base::OnceClosure post_commit_cb = base::DoNothing(); - pending_frames_.back()->frame_commit_cb = base::BindOnce( - &WaylandBufferManagerHost::Surface::CommitBuffer, - base::Unretained(surface), buffer_id, damage_region, !!buffer_id, - std::move(post_commit_cb), gfx::GpuFenceHandle()); - - pending_frames_.back()->PendingActionComplete(); -} - -void WaylandBufferManagerHost::RemovePendingFrames(WaylandSurface* root_surface, - uint32_t buffer_id) { - base::EraseIf(pending_frames_, - [buffer_id, root_surface](const std::unique_ptr<Frame>& frame) { - return !frame->pending_actions || - (frame->buffer_id == buffer_id && buffer_id) || - (frame->root_surface == root_surface && root_surface); - }); -} - -bool WaylandBufferManagerHost::CommitBufferInternal( - WaylandSurface* wayland_surface, - uint32_t buffer_id, - const gfx::Rect& damage_region, - bool wait_for_frame_callback, - bool commit_synced_subsurface, - gfx::GpuFenceHandle access_fence_handle) { - DCHECK(base::CurrentUIThread::IsSet()); - - Surface* surface = GetSurface(wayland_surface); - if (!surface || !ValidateBufferIdFromGpu(buffer_id)) - return false; - - base::OnceClosure subsurface_committed_cb = base::DoNothing(); - if (!pending_frames_.empty() && commit_synced_subsurface) { - pending_frames_.back()->IncrementPendingActions(); - subsurface_committed_cb = - base::BindOnce(&WaylandBufferManagerHost::Frame::PendingActionComplete, - pending_frames_.back()->weak_factory.GetWeakPtr()); - } - return surface->CommitBuffer( - buffer_id, damage_region, wait_for_frame_callback, - std::move(subsurface_committed_cb), std::move(access_fence_handle)); -} - void WaylandBufferManagerHost::CommitOverlays( gfx::AcceleratedWidget widget, std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlays) { @@ -1018,6 +269,13 @@ if (!window) return; + for (auto& overlay : overlays) { + if (!ValidateBufferExistence(overlay->buffer_id)) { + TerminateGpuProcess(); + return; + } + } + window->CommitOverlays(overlays); } @@ -1032,38 +290,12 @@ "Buffer id", buffer_id); DCHECK(error_message_.empty()); - if (!ValidateBufferIdFromGpu(buffer_id)) { + if (!ValidateBufferExistence(buffer_id)) { TerminateGpuProcess(); return; } - auto it = buffer_backings_.find(buffer_id); - if (it == buffer_backings_.end()) { - error_message_ = base::StrCat( - {"Buffer with ", NumberToString(buffer_id), " id does not exist"}); - TerminateGpuProcess(); - return; - } - - buffer_backings_.erase(it); -} - -void WaylandBufferManagerHost::ResetSurfaceContents( - WaylandSurface* wayland_surface) { - auto* surface = GetSurface(wayland_surface); - DCHECK(surface); - for (auto& pending_frame : pending_frames_) { - if (pending_frame->root_surface == wayland_surface) { - pending_frame->frame_commit_cb = base::BindOnce([] { return true; }); - } - } - surface->ResetSurfaceContents(); -} - -WaylandBufferManagerHost::Surface* WaylandBufferManagerHost::GetSurface( - WaylandSurface* wayland_surface) const { - auto it = surfaces_.find(wayland_surface); - return it != surfaces_.end() ? it->second.get() : nullptr; + buffer_backings_.erase(buffer_id); } bool WaylandBufferManagerHost::ValidateDataFromGpu( @@ -1156,6 +388,19 @@ return error_message_.empty(); } +bool WaylandBufferManagerHost::ValidateBufferExistence(uint32_t buffer_id) { + if (!ValidateBufferIdFromGpu(buffer_id)) + return false; + + auto it = buffer_backings_.find(buffer_id); + if (it == buffer_backings_.end()) { + error_message_ = base::StrCat( + {"Buffer with ", NumberToString(buffer_id), " id does not exist"}); + } + + return error_message_.empty(); +} + void WaylandBufferManagerHost::OnSubmission(gfx::AcceleratedWidget widget, uint32_t buffer_id, const gfx::SwapResult& swap_result,
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h index fea1a71..5e0bb02 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h +++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h
@@ -11,7 +11,6 @@ #include "base/containers/flat_map.h" #include "base/files/scoped_file.h" #include "base/gtest_prod_util.h" -#include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" @@ -22,7 +21,6 @@ #include "ui/gfx/swap_result.h" #include "ui/ozone/platform/wayland/common/wayland_object.h" #include "ui/ozone/platform/wayland/common/wayland_util.h" -#include "ui/ozone/platform/wayland/host/wayland_window_observer.h" #include "ui/ozone/public/mojom/wayland/wayland_buffer_manager.mojom.h" namespace ui { @@ -30,7 +28,6 @@ class WaylandBufferBacking; class WaylandBufferHandle; class WaylandConnection; -class WaylandSubsurface; class WaylandWindow; class WaylandSurface; @@ -38,8 +35,7 @@ // accelerated compositing) or shared memory (software compositing) and uses // internal representation of surfaces, which are used to store buffers // associated with the WaylandWindow. -class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost, - public WaylandWindowObserver { +class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost { public: explicit WaylandBufferManagerHost(WaylandConnection* connection); @@ -48,18 +44,6 @@ ~WaylandBufferManagerHost() override; - // WaylandWindowObserver implements: - void OnWindowAdded(WaylandWindow* window) override; - void OnWindowRemoved(WaylandWindow* window) override; - void OnWindowConfigured(WaylandWindow* window) override; - void OnSubsurfaceAdded(WaylandWindow* window, - WaylandSubsurface* subsurface) override; - void OnSubsurfaceRemoved(WaylandWindow* window, - WaylandSubsurface* subsurface) override; - - // Start allowing attaching buffers to |surface|, same as - // OnWindowConfigured(), but for WaylandSurface. - void SetSurfaceConfigured(WaylandSurface* surface); void SetTerminateGpuCallback( base::OnceCallback<void(std::string)> terminate_gpu_cb); @@ -125,65 +109,27 @@ gfx::AcceleratedWidget widget, std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlays) override; - // Called by WaylandWindow to start recording a frame. This helps record the - // number of subsurface commits needed to finish for this frame before - // |root_surface| can be committed. - // This pairs with an EndCommitFrame(). Every CommitBufferInternal() in - // between increases the number of needed pending commits by 1. - void StartFrame(WaylandSurface* root_surface); - void EndFrame(uint32_t buffer_id = 0u, - const gfx::Rect& damage_region = gfx::Rect()); - - // Called by the WaylandWindow and asks to attach a wl_buffer with a - // |buffer_id| to a WaylandSurface. - // Calls OnSubmission and OnPresentation on successful swap and pixels - // presented. - // |wait_for_frame_callback| instructs that a surface should wait for previous - // wl_frame_callback. This is primarily used for sync wl_subsurfaces case - // where buffer updates within a frame should be seen together. A root_surface - // commit will move an entire wl_surface tree from pending state to ready - // state. This root_surface commit must wait for wl_frame_callback, such that - // in effect all other surface updates wait for this wl_frame_callback, too. - // |access_fence_handle| specifies a gpu fence created by the gpu process. - // It's to be waited on before content of the buffer is ready to be read by - // Wayland host. - bool CommitBufferInternal( - WaylandSurface* wayland_surface, - uint32_t buffer_id, - const gfx::Rect& damage_region, - bool wait_for_frame_callback = true, - bool commit_synced_subsurface = false, - gfx::GpuFenceHandle access_fence_handle = gfx::GpuFenceHandle()); - - // When a surface is hidden, the client may want to detach the buffer attached - // to the surface to ensure Wayland does not present those contents and do not - // composite in a wrong way. Otherwise, users may see the contents of a hidden - // surface on their screens. - void ResetSurfaceContents(WaylandSurface* wayland_surface); - // Ensures a WaylandBufferHandle of |buffer_id| is created for the - // |requestor|, with its wl_buffer object requested via Wayland. - bool EnsureBufferHandle(WaylandSurface* requestor, uint32_t buffer_id); + // |requestor|, with its wl_buffer object requested via Wayland. Returns said + // buffer handle. + WaylandBufferHandle* EnsureBufferHandle(WaylandSurface* requestor, + uint32_t buffer_id); // Gets the WaylandBufferHandle of |buffer_id| used for |requestor|. WaylandBufferHandle* GetBufferHandle(WaylandSurface* requestor, uint32_t buffer_id); + // Tells the |buffer_manager_gpu_ptr_| the result of a swap call and provides + // it with the presentation feedback. + void OnSubmission(gfx::AcceleratedWidget widget, + uint32_t buffer_id, + const gfx::SwapResult& swap_result, + gfx::GpuFenceHandle release_fence); + void OnPresentation(gfx::AcceleratedWidget widget, + uint32_t buffer_id, + const gfx::PresentationFeedback& feedback); + private: - // This is an internal representation of a real surface, which holds a pointer - // to WaylandSurface. Also, this object holds buffers, frame callbacks and - // presentation callbacks for that surface. - class Surface; - - // This represents a frame that consists of state changes to multiple - // synchronized wl_surfaces that are in the same hierarchy. It defers - // committing the root surface until all child surfaces' states are ready. - struct Frame; - - Surface* GetSurface(WaylandSurface* wayland_surface) const; - - void RemovePendingFrames(WaylandSurface* root_surface, uint32_t buffer_id); - // Validates data sent from GPU. If invalid, returns false and sets an error // message to |error_message_|. bool ValidateDataFromGpu(const base::ScopedFD& file, @@ -200,40 +146,11 @@ const gfx::Size& size, uint32_t buffer_id); bool ValidateDataFromGpu(const gfx::Size& size, uint32_t buffer_id); - - // Callback method. Receives a result for the request to create a wl_buffer - // backend by dmabuf file descriptor from ::CreateBuffer call. - void OnCreateBufferComplete(uint32_t buffer_id, - wl::Object<struct wl_buffer> new_buffer); - - // Tells the |buffer_manager_gpu_ptr_| the result of a swap call and provides - // it with the presentation feedback. - void OnSubmission(gfx::AcceleratedWidget widget, - uint32_t buffer_id, - const gfx::SwapResult& swap_result, - gfx::GpuFenceHandle release_fence); - void OnPresentation(gfx::AcceleratedWidget widget, - uint32_t buffer_id, - const gfx::PresentationFeedback& feedback); + bool ValidateBufferExistence(uint32_t buffer_id); // Terminates the GPU process on invalid data received void TerminateGpuProcess(); - bool DestroyAnonymousBuffer(uint32_t buffer_id); - - base::flat_map<WaylandSurface*, std::unique_ptr<Surface>> surfaces_; - - // When StartCommitFrame() is called, a Frame is pushed to - // |pending_frames_|. See StartCommitFrame(). - std::vector<std::unique_ptr<Frame>> pending_frames_; - - // When a WaylandWindow/WaylandSubsurface is removed, its corresponding - // Surface may still have an un-released buffer and un-acked presentation. - // Thus, we keep removed surfaces in the graveyard. It's safe to delete them - // when all of the Surface's buffers are destroyed because buffer destruction - // is deferred till after buffers are released and presentations are acked. - std::list<std::unique_ptr<Surface>> surface_graveyard_; - // Set when invalid data is received from the GPU process. std::string error_message_; @@ -251,8 +168,6 @@ // Maps buffer_id's to corresponding WaylandBufferBacking objects. base::flat_map<uint32_t, std::unique_ptr<WaylandBufferBacking>> buffer_backings_; - - base::WeakPtrFactory<WaylandBufferManagerHost> weak_factory_; }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_frame_manager.cc b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc new file mode 100644 index 0000000..99ff062 --- /dev/null +++ b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc
@@ -0,0 +1,586 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/wayland/host/wayland_frame_manager.h" + +#include <presentation-time-client-protocol.h> +#include <sync/sync.h> + +#include "ui/ozone/platform/wayland/host/wayland_buffer_handle.h" +#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" +#include "ui/ozone/platform/wayland/host/wayland_connection.h" +#include "ui/ozone/platform/wayland/host/wayland_subsurface.h" +#include "ui/ozone/platform/wayland/host/wayland_surface.h" +#include "ui/ozone/platform/wayland/host/wayland_window.h" + +namespace ui { + +namespace { + +uint32_t GetPresentationKindFlags(uint32_t flags) { + // Wayland spec has different meaning of VSync. In Chromium, VSync means to + // update the begin frame vsync timing based on presentation feedback. + uint32_t presentation_flags = gfx::PresentationFeedback::kVSync; + + if (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK) + presentation_flags |= gfx::PresentationFeedback::kHWClock; + if (flags & WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION) + presentation_flags |= gfx::PresentationFeedback::kHWCompletion; + if (flags & WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY) + presentation_flags |= gfx::PresentationFeedback::kZeroCopy; + + return presentation_flags; +} + +} // namespace + +WaylandFrame::WaylandFrame( + WaylandSurface* root_surface, + ui::ozone::mojom::WaylandOverlayConfigPtr root_config, + base::circular_deque<std::pair<WaylandSubsurface*, + ui::ozone::mojom::WaylandOverlayConfigPtr>> + subsurfaces_to_overlays, + bool expects_ack) + : root_surface(root_surface), + root_config(std::move(root_config)), + subsurfaces_to_overlays(std::move(subsurfaces_to_overlays)), + buffer_id(this->root_config ? this->root_config->buffer_id : 0), + submission_acked(!expects_ack), + presentation_acked(!expects_ack) {} + +WaylandFrame::~WaylandFrame() = default; + +WaylandFrameManager::WaylandFrameManager(WaylandWindow* window, + WaylandConnection* connection) + : window_(window), connection_(connection), weak_factory_(this) {} + +WaylandFrameManager::~WaylandFrameManager() { + ClearStates(); +} + +void WaylandFrameManager::RecordFrame(std::unique_ptr<WaylandFrame> frame) { + DCHECK_LE(pending_frames_.size(), 6u); + + // Request for buffer handle creation at record time. + for (auto& subsurface_to_overlay : frame->subsurfaces_to_overlays) { + if (!subsurface_to_overlay.second.is_null() && + subsurface_to_overlay.second->buffer_id) { + auto* handle = connection_->buffer_manager_host()->EnsureBufferHandle( + subsurface_to_overlay.first->wayland_surface(), + subsurface_to_overlay.second->buffer_id); + if (!handle) + return; + } + } + if (frame->root_config && frame->root_config->buffer_id) { + auto* handle = connection_->buffer_manager_host()->EnsureBufferHandle( + frame->root_surface, frame->root_config->buffer_id); + if (!handle) + return; + } + + pending_frames_.push_back(std::move(frame)); + MaybeProcessPendingFrame(); +} + +void WaylandFrameManager::MaybeProcessPendingFrame() { + if (pending_frames_.empty()) + return; + auto* frame = pending_frames_.front().get(); + DCHECK(frame) << "This WaylandFrame is already in playback."; + if (!frame) + return; + + // Ensure wl_buffer existence. + WaylandBufferHandle* handle_pending_creation = nullptr; + for (auto& subsurface_to_overlay : frame->subsurfaces_to_overlays) { + if (!subsurface_to_overlay.second.is_null() && + subsurface_to_overlay.second->buffer_id) { + auto* handle = connection_->buffer_manager_host()->EnsureBufferHandle( + subsurface_to_overlay.first->wayland_surface(), + subsurface_to_overlay.second->buffer_id); + // Buffer is gone while this frame is pending, remove this config. + if (!handle) { + subsurface_to_overlay.second.reset(); + } else if (!handle->wl_buffer() && !handle_pending_creation) { + // Found the first not-ready buffer, let handle invoke + // MaybeProcessPendingFrame() when wl_buffer is created. + handle_pending_creation = handle; + } + } + } + if (frame->root_config && frame->root_config->buffer_id) { + auto* handle = connection_->buffer_manager_host()->EnsureBufferHandle( + frame->root_surface, frame->root_config->buffer_id); + if (!handle) { + frame->root_config.reset(); + } else if (!handle->wl_buffer() && !handle_pending_creation) { + handle_pending_creation = handle; + } + } + + // There are wl_buffers missing, need to wait. + if (handle_pending_creation) { + handle_pending_creation->set_buffer_created_callback( + base::BindOnce(&WaylandFrameManager::MaybeProcessPendingFrame, + weak_factory_.GetWeakPtr())); + return; + } + // Frame callback hasn't been acked, need to wait. + if (!submitted_frames_.empty() && + submitted_frames_.back()->wl_frame_callback) { + return; + } + // Window is not configured, need to wait. + if (!window_->can_submit_frames()) + return; + + std::unique_ptr<WaylandFrame> playback = std::move(pending_frames_.front()); + PlayBackFrame(std::move(playback)); + + pending_frames_.pop_front(); +} + +void WaylandFrameManager::PlayBackFrame(std::unique_ptr<WaylandFrame> frame) { + auto* root_surface = frame->root_surface; + auto& root_config = frame->root_config; + bool empty_frame = !root_config || !root_config->buffer_id; + + if (!empty_frame) { + window_->UpdateVisualSize(root_config->bounds_rect.size(), + root_config->surface_scale_factor); + } + + // Configure subsurfaces. Traverse the deque backwards s.t. we can set + // frame_callback and presentation_feedback on the top-most possible surface. + WaylandSurface* reference_above = nullptr; + for (auto r_iter = frame->subsurfaces_to_overlays.rbegin(); + r_iter != frame->subsurfaces_to_overlays.rend(); ++r_iter) { + auto* subsurface = r_iter->first; + DCHECK(subsurface); + auto* surface = subsurface->wayland_surface(); + auto& config = r_iter->second; + if (empty_frame || config.is_null() || + wl_fixed_from_double(config->opacity) == 0) { + subsurface->Hide(); + // Mutter sometimes does not call buffer.release if wl_surface role is + // destroyed, causing graphics freeze. Manually release buffer from the + // last frame and trigger OnSubmission callbacks. + if (!submitted_frames_.empty()) { + auto result = submitted_frames_.back()->submitted_buffers.find(surface); + if (result != submitted_frames_.back()->submitted_buffers.end()) { + submitted_frames_.back()->submitted_buffers.erase(result); + surface->AttachBuffer(nullptr); + surface->ApplyPendingState(); + surface->Commit(false); + } + } + } else { + subsurface->ConfigureAndShowSurface( + config->bounds_rect, root_config->bounds_rect, + root_config->surface_scale_factor, + reference_above ? nullptr : root_surface, reference_above); + ApplySurfaceConfigure(frame.get(), surface, config, true); + reference_above = surface; + surface->Commit(false); + } + } + + if (empty_frame) { + root_surface->AttachBuffer(nullptr); + root_surface->ApplyPendingState(); + if (!frame->presentation_acked) + frame->feedback = gfx::PresentationFeedback::Failure(); + } else { + // Opaque region is set during UpdateVisualSize() no need to set it again. + ApplySurfaceConfigure(frame.get(), root_surface, root_config, false); + } + + DCHECK(empty_frame || !connection_->presentation() || + frame->pending_feedback || frame->feedback.has_value()); + root_surface->Commit(true); + + frame->root_config.reset(); + frame->subsurfaces_to_overlays.clear(); + + // Empty frames do not expect feedbacks so don't push to |submitted_frames_|. + if (!empty_frame) + submitted_frames_.push_back(std::move(frame)); + + // This queue should be small - if not it's likely a bug. + DCHECK_LE(submitted_frames_.size(), 25u); + MaybeProcessSubmittedFrames(); +} + +void WaylandFrameManager::ApplySurfaceConfigure( + WaylandFrame* frame, + WaylandSurface* surface, + ui::ozone::mojom::WaylandOverlayConfigPtr& config, + bool set_opaque_region) { + DCHECK(surface); + if (!config->buffer_id) + return; + + static const wl_callback_listener frame_listener = { + &WaylandFrameManager::FrameCallbackDone}; + static const wp_presentation_feedback_listener feedback_listener = { + &WaylandFrameManager::FeedbackSyncOutput, + &WaylandFrameManager::FeedbackPresented, + &WaylandFrameManager::FeedbackDiscarded}; + + surface->SetBufferTransform(config->transform); + surface->SetSurfaceBufferScale(ceil(config->surface_scale_factor)); + surface->SetViewportSource(config->crop_rect); + surface->SetViewportDestination(config->bounds_rect.size()); + surface->SetOpacity(config->opacity); + surface->SetBlending(config->enable_blend); + surface->SetRoundedCorners(config->rounded_corners); + surface->SetOverlayPriority(config->priority_hint); + if (set_opaque_region) { + std::vector<gfx::Rect> region_px = {gfx::Rect(config->bounds_rect.size())}; + surface->SetOpaqueRegion(config->enable_blend ? nullptr : ®ion_px); + } + + WaylandBufferHandle* buffer_handle = + connection_->buffer_manager_host()->GetBufferHandle(surface, + config->buffer_id); + DCHECK(buffer_handle); + bool will_attach = surface->AttachBuffer(buffer_handle); + // If we don't attach a released buffer, graphics freeze will occur. + DCHECK(will_attach || !buffer_handle->released()); + + surface->UpdateBufferDamageRegion(config->damage_region); + if (!config->access_fence_handle.is_null()) + surface->SetAcquireFence(std::move(config->access_fence_handle)); + + if (will_attach) { + // Setup frame callback if wayland_surface will commit this buffer. + // On Mutter, we don't receive frame.callback acks if we don't attach a + // new wl_buffer, which leads to graphics freeze. So only setup + // frame_callback when we're attaching a different buffer. + if (!frame->wl_frame_callback) { + frame->buffer_id = config->buffer_id; + frame->wl_frame_callback.reset(wl_surface_frame(surface->surface())); + wl_callback_add_listener(frame->wl_frame_callback.get(), &frame_listener, + this); + } + + if (connection_->linux_explicit_synchronization_v1() && + !surface->has_explicit_release_callback()) { + surface->set_explicit_release_callback( + base::BindRepeating(&WaylandFrameManager::OnExplicitBufferRelease, + weak_factory_.GetWeakPtr(), surface)); + } + buffer_handle->set_buffer_released_callback( + base::BindOnce(&WaylandFrameManager::OnWlBufferRelease, + weak_factory_.GetWeakPtr(), surface)); + } + + if (connection_->presentation() && !frame->pending_feedback) { + frame->pending_feedback.reset(wp_presentation_feedback( + connection_->presentation(), surface->surface())); + wp_presentation_feedback_add_listener(frame->pending_feedback.get(), + &feedback_listener, this); + } + + // If we have submitted this buffer in a previous frame and it is not released + // yet, submitting the buffer again will not make wayland compositor to + // release it twice. Remove it from the previous frame. + for (auto& submitted_frames : submitted_frames_) { + auto result = submitted_frames->submitted_buffers.find(surface); + if (result != submitted_frames->submitted_buffers.end() && + result->second->wl_buffer() == buffer_handle->wl_buffer()) { + submitted_frames->submitted_buffers.erase(result); + break; + } + } + + frame->submitted_buffers.emplace(surface, buffer_handle); + + // Send instructions across wayland protocol, but do not commit yet, let the + // caller decide whether the commit should flush. + surface->ApplyPendingState(); + return; +} + +// static +void WaylandFrameManager::FrameCallbackDone(void* data, + struct wl_callback* callback, + uint32_t time) { + WaylandFrameManager* self = static_cast<WaylandFrameManager*>(data); + DCHECK(self); + self->OnFrameCallback(callback); +} + +void WaylandFrameManager::OnFrameCallback(struct wl_callback* callback) { + DCHECK(submitted_frames_.back()->wl_frame_callback.get() == callback); + submitted_frames_.back()->wl_frame_callback.reset(); + MaybeProcessPendingFrame(); +} + +// static +void WaylandFrameManager::FeedbackSyncOutput( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback, + struct wl_output* output) {} + +// static +void WaylandFrameManager::FeedbackPresented( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback, + uint32_t tv_sec_hi, + uint32_t tv_sec_lo, + uint32_t tv_nsec, + uint32_t refresh, + uint32_t seq_hi, + uint32_t seq_lo, + uint32_t flags) { + WaylandFrameManager* self = static_cast<WaylandFrameManager*>(data); + DCHECK(self); + self->OnPresentation( + wp_presentation_feedback, + gfx::PresentationFeedback(self->connection_->ConvertPresentationTime( + tv_sec_hi, tv_sec_lo, tv_nsec), + base::Nanoseconds(refresh), + GetPresentationKindFlags(flags))); +} + +// static +void WaylandFrameManager::FeedbackDiscarded( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback) { + WaylandFrameManager* self = static_cast<WaylandFrameManager*>(data); + DCHECK(self); + self->OnPresentation(wp_presentation_feedback, + gfx::PresentationFeedback::Failure(), + true /* discarded */); +} + +void WaylandFrameManager::OnPresentation( + struct wp_presentation_feedback* wp_presentation_feedback, + const gfx::PresentationFeedback& feedback, + bool discarded) { + for (auto& frame : submitted_frames_) { + if (frame->pending_feedback.get() == wp_presentation_feedback) { + frame->feedback = feedback; + break; + } else if (!frame->feedback.has_value() && !discarded) { + // Feedback must come in order. However, if one of the feedbacks was + // discarded and the previous feedbacks haven't been received yet, don't + // mark previous feedbacks as failed as they will come later. For + // example, imagine you are waiting for f[0], f[1] and f[2]. f[2] gets + // discarded, previous ones mustn't be marked as failed as they will + // come later. + // TODO(fangzhoug): Exo seems to deliver presentation_feedbacks out of + // order occasionally, causing us to mark a valid feedback as failed. + // Investigate the issue with surface sync. + frame->feedback = gfx::PresentationFeedback::Failure(); + } + CHECK_NE(frame, submitted_frames_.back()); + } + MaybeProcessSubmittedFrames(); +} + +void WaylandFrameManager::OnExplicitBufferRelease( + WaylandSurface* surface, + struct wl_buffer* wl_buffer, + absl::optional<int32_t> fence) { + DCHECK(wl_buffer); + + // Releases may not necessarily come in order, so search the submitted + // buffers. + for (const auto& frame : submitted_frames_) { + auto result = frame->submitted_buffers.find(surface); + if (result != frame->submitted_buffers.end() && + result->second->wl_buffer() == wl_buffer) { + // Explicitly make this buffer released when + // linux_explicit_synchronization is used. + result->second->OnExplicitRelease(); + + if (fence.has_value()) { + base::ScopedFD fd{fence.value()}; + // Accumulate release fences into a single fence. + if (frame->merged_release_fence_fd.is_valid()) { + frame->merged_release_fence_fd.reset( + sync_merge("", frame->merged_release_fence_fd.get(), fd.get())); + } else { + frame->merged_release_fence_fd = std::move(fd); + } + DCHECK(frame->merged_release_fence_fd.is_valid()); + } + + frame->submitted_buffers.erase(result); + break; + } + } + + // A release means we may be able to send OnSubmission for previously + // submitted buffers. + MaybeProcessSubmittedFrames(); +} + +void WaylandFrameManager::OnWlBufferRelease(WaylandSurface* surface, + struct wl_buffer* wl_buffer) { + DCHECK(wl_buffer); + + // Releases may not necessarily come in order, so search the submitted + // buffers. + for (const auto& frame : submitted_frames_) { + auto result = frame->submitted_buffers.find(surface); + if (result != frame->submitted_buffers.end() && + result->second->wl_buffer() == wl_buffer) { + frame->submitted_buffers.erase(result); + break; + } + } + + // A release means we may be able to send OnSubmission for previously + // submitted buffers. + MaybeProcessSubmittedFrames(); +} + +void WaylandFrameManager::MaybeProcessSubmittedFrames() { + if (submitted_frames_.empty()) + return; + + // We force an OnSubmission call for the very first buffer submitted, + // otherwise buffers are not acked in a quiescent state. We keep track of + // whether it has already been acked. A buffer may have already been acked + // if it is the first buffer submitted and it is destroyed before being + // explicitly released. In that case, don't send an OnSubmission. + if (submitted_frames_.size() == 1u && + !submitted_frames_.front()->submission_acked) { + ProcessOldSubmittedFrame(submitted_frames_.front().get(), + gfx::GpuFenceHandle()); + } + + CHECK_LT(submitted_frames_.size(), 25u); + + // Buffers may be released out of order, but we need to provide the + // guarantee that OnSubmission will be called in order of buffer submission. + for (auto iter = submitted_frames_.begin(); + iter < submitted_frames_.end() - 1; ++iter) { + // Treat a buffer as released if it has been explicitly released or + // destroyed. + bool all_buffers_released = (*iter)->submitted_buffers.empty(); + // We can send OnSubmission for the |iter + 1| if the buffers of |iter| are + // all released. + if (!all_buffers_released) + break; + + DCHECK((*iter)->submission_acked); + if ((*(iter + 1))->submission_acked) + continue; + + // Call OnSubmission() for this for |iter + 1| since |iter| is fully + // released. + gfx::GpuFenceHandle release_fence_handle; + if ((*iter)->merged_release_fence_fd.is_valid()) + release_fence_handle.owned_fd = + std::move((*iter)->merged_release_fence_fd); + ProcessOldSubmittedFrame((iter + 1)->get(), + std::move(release_fence_handle)); + } + + // Process for presentation feedbacks. OnPresentation() must be called after + // OnSubmission() for a frame. + for (auto& frame : submitted_frames_) { + if (!frame->submission_acked || !frame->feedback.has_value()) + break; + if (frame->presentation_acked) + continue; + frame->presentation_acked = true; + connection_->buffer_manager_host()->OnPresentation( + window_->GetWidget(), /*buffer_id*/ frame->buffer_id, + frame->feedback.value()); + } + + // Clear frames that are fully released and has already called + // OnPresentation(). + while (submitted_frames_.size() > 1 && + submitted_frames_.front()->submitted_buffers.empty() && + submitted_frames_.front()->presentation_acked) { + DCHECK(submitted_frames_.front()->submission_acked); + submitted_frames_.pop_front(); + } +} + +void WaylandFrameManager::ProcessOldSubmittedFrame( + WaylandFrame* frame, + gfx::GpuFenceHandle release_fence_handle) { + DCHECK(!submitted_frames_.empty()); + DCHECK(!frame->submission_acked); + DCHECK(!frame->presentation_acked); + DCHECK(frame->pending_feedback || frame->feedback.has_value() || + !connection_->presentation()); + frame->submission_acked = true; + + // We can now complete the latest submission. We had to wait for this + // release because SwapCompletionCallback indicates to the client that the + // buffers in previous frame is available for reuse. + connection_->buffer_manager_host()->OnSubmission( + window_->GetWidget(), /*buffer_id*/ frame->buffer_id, + gfx::SwapResult::SWAP_ACK, std::move(release_fence_handle)); + + // If presentation feedback is not supported, use a fake feedback. This + // literally means there are no presentation feedback callbacks created. + if (!connection_->presentation()) { + DCHECK(!frame->feedback.has_value() || frame->feedback->failed()); + frame->feedback = frame->feedback.value_or( + gfx::PresentationFeedback(base::TimeTicks::Now(), base::TimeDelta(), + GetPresentationKindFlags(0))); + } +} + +void WaylandFrameManager::Hide() { + if (!submitted_frames_.empty() && + submitted_frames_.back()->wl_frame_callback) { + submitted_frames_.back()->wl_frame_callback.reset(); + // Mutter sometimes does not call buffer.release if wl_surface role is + // destroyed, causing graphics freeze. Manually release them and trigger + // OnSubmission callbacks. + for (auto& submitted : submitted_frames_.back()->submitted_buffers) + submitted.second->OnExplicitRelease(); + submitted_frames_.back()->submitted_buffers.clear(); + submitted_frames_.back()->feedback = gfx::PresentationFeedback::Failure(); + } + + // Discard |pending_frames_| since they're not going to be used when hidden. + for (auto& frame : pending_frames_) { + DCHECK(frame) << "Can't perform Hide() during a frame playback."; + frame->feedback = gfx::PresentationFeedback::Failure(); + submitted_frames_.push_back(std::move(frame)); + } + pending_frames_.clear(); + + MaybeProcessSubmittedFrames(); +} + +void WaylandFrameManager::ClearStates() { + for (auto& frame : submitted_frames_) { + frame->wl_frame_callback.reset(); + for (auto& submitted : frame->submitted_buffers) + submitted.second->OnExplicitRelease(); + frame->submitted_buffers.clear(); + if (!frame->feedback.has_value()) + frame->feedback = gfx::PresentationFeedback::Failure(); + } + + for (auto& frame : pending_frames_) { + DCHECK(frame) + << "Can't perform OnChannelDestroyed() during a frame playback."; + frame->feedback = gfx::PresentationFeedback::Failure(); + submitted_frames_.push_back(std::move(frame)); + } + pending_frames_.clear(); + + MaybeProcessSubmittedFrames(); + + DCHECK(submitted_frames_.empty() || + (submitted_frames_.size() == 1 && + submitted_frames_.back()->submission_acked && + submitted_frames_.back()->presentation_acked)); +} + +} // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_frame_manager.h b/ui/ozone/platform/wayland/host/wayland_frame_manager.h new file mode 100644 index 0000000..94dd19c --- /dev/null +++ b/ui/ozone/platform/wayland/host/wayland_frame_manager.h
@@ -0,0 +1,177 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_FRAME_MANAGER_H_ +#define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_FRAME_MANAGER_H_ + +#include <cstdint> +#include <memory> +#include <vector> + +#include "base/containers/circular_deque.h" +#include "base/containers/flat_map.h" +#include "base/files/scoped_file.h" +#include "base/memory/weak_ptr.h" +#include "ui/gfx/gpu_fence_handle.h" +#include "ui/gfx/presentation_feedback.h" +#include "ui/ozone/platform/wayland/common/wayland_object.h" +#include "ui/ozone/public/mojom/wayland/wayland_overlay_config.mojom.h" + +namespace ui { + +class WaylandBufferHandle; +class WaylandConnection; +class WaylandWindow; +class WaylandSurface; +class WaylandSubsurface; + +// Representation of a graphical frame update (DrawingFrame), stores the +// configuration information required to present this frame across Wayland. It +// also has information about when/whether resources of the frame has been +// presented and released. +struct WaylandFrame { + public: + WaylandFrame( + WaylandSurface* root_surface, + ui::ozone::mojom::WaylandOverlayConfigPtr root_config, + base::circular_deque<std::pair<WaylandSubsurface*, + ui::ozone::mojom::WaylandOverlayConfigPtr>> + subsurfaces_to_overlays = {}, + bool expects_ack = true); + WaylandFrame() = delete; + WaylandFrame(const WaylandFrame&) = delete; + WaylandFrame& operator=(const WaylandFrame&) = delete; + ~WaylandFrame(); + + private: + friend class WaylandFrameManager; + + WaylandSurface* root_surface; + ui::ozone::mojom::WaylandOverlayConfigPtr root_config; + base::circular_deque< + std::pair<WaylandSubsurface*, ui::ozone::mojom::WaylandOverlayConfigPtr>> + subsurfaces_to_overlays; + + base::flat_map<WaylandSurface*, WaylandBufferHandle*> submitted_buffers; + + // ID of one of the buffers that will be attached to the subsurfaces. If none + // of the buffers will be attached, this is |root_config->buffer_id|. + // Used to invoke buffer_manager_host OnSubmission and OnPrensentation calls. + uint32_t buffer_id; + + // A Wayland callback, which is triggered once wl_buffer has been committed + // and it is the right time to notify the GPU that it can start a new drawing + // operation. + wl::Object<wl_callback> wl_frame_callback; + + // Merged release fence fd. This is taken as the union of all release fences + // for this frame. + base::ScopedFD merged_release_fence_fd; + // Whether this frame has had OnSubmission sent for it. + bool submission_acked = false; + + // The wayland object identifying this feedback. + wl::Object<struct wp_presentation_feedback> pending_feedback; + // The actual presentation feedback. May be missing if the callback from the + // Wayland server has not arrived yet. + absl::optional<gfx::PresentationFeedback> feedback = absl::nullopt; + // Whether this frame has had OnPresentation sent for it. + bool presentation_acked = false; +}; + +// This is the frame update manager that configures graphical window/surface +// state and submits buffer swaps to a window. Meanwhile it keeps track of the +// pending/submitted swaps in order to send the acknowledgements back to gpu +// process. +class WaylandFrameManager { + public: + WaylandFrameManager(WaylandWindow* window, WaylandConnection* connection); + WaylandFrameManager(const WaylandFrameManager&) = delete; + WaylandFrameManager& operator=(const WaylandFrameManager&) = delete; + ~WaylandFrameManager(); + + // WaylandWindow::CommitOverlays() calls this to put a pending frame in, + // without making any actual Wayland protocol requests to the compositor that + // will change the visual properties of the window. + // A pending frame will be played back in PlayBackFrame() if the requirements + // for submitting it are met. + void RecordFrame(std::unique_ptr<WaylandFrame> frame); + + // Verifies if the first pending_frame can be played back. Requirements are: + // 1) Previous frame's wl_frame_callback must be ack'ed; + // 2) Window has been configured; + // 3) All required wl_buffers are ready. + // Does the playback if all requirements are met. + void MaybeProcessPendingFrame(); + + // Clears the state of the |frame_manager_| when the GPU channel is destroyed. + void ClearStates(); + + // Similar to ClearStates(), but does not clear submitted frames. + void Hide(); + + private: + void PlayBackFrame(std::unique_ptr<WaylandFrame> frame); + // Configures |surface| but does not commit wl_surface states yet. + void ApplySurfaceConfigure(WaylandFrame* frame, + WaylandSurface* surface, + ui::ozone::mojom::WaylandOverlayConfigPtr& config, + bool needs_opaque_region); + + void MaybeProcessSubmittedFrames(); + void ProcessOldSubmittedFrame(WaylandFrame* frame, + gfx::GpuFenceHandle release_fence_handle); + void OnExplicitBufferRelease(WaylandSurface* surface, + struct wl_buffer* wl_buffer, + absl::optional<int32_t> fence); + void OnWlBufferRelease(WaylandSurface* surface, struct wl_buffer* wl_buffer); + + // wl_callback_listener + static void FrameCallbackDone(void* data, + struct wl_callback* callback, + uint32_t time); + void OnFrameCallback(struct wl_callback* callback); + + // wp_presentation_feedback_listener + static void FeedbackSyncOutput( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback, + struct wl_output* output); + static void FeedbackPresented( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback, + uint32_t tv_sec_hi, + uint32_t tv_sec_lo, + uint32_t tv_nsec, + uint32_t refresh, + uint32_t seq_hi, + uint32_t seq_lo, + uint32_t flags); + static void FeedbackDiscarded( + void* data, + struct wp_presentation_feedback* wp_presentation_feedback); + + void OnPresentation(struct wp_presentation_feedback* wp_presentation_feedback, + const gfx::PresentationFeedback& feedback, + bool discarded = false); + + WaylandWindow* const window_; + + // When RecordFrame() is called, a Frame is pushed to |pending_frames_|. See + // RecordFrame(). + base::circular_deque<std::unique_ptr<WaylandFrame>> pending_frames_; + + // After PlayBackFrame() is called, a Frame is pushed to |submitted_frames_|. + // See MaybeProcessPendingFrame(). + base::circular_deque<std::unique_ptr<WaylandFrame>> submitted_frames_; + + // Non-owned pointer to the main connection. + WaylandConnection* const connection_; + + base::WeakPtrFactory<WaylandFrameManager> weak_factory_; +}; + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_FRAME_MANAGER_H_
diff --git a/ui/ozone/platform/wayland/host/wayland_popup.cc b/ui/ozone/platform/wayland/host/wayland_popup.cc index dbf4ee2..c4d8ca4 100644 --- a/ui/ozone/platform/wayland/host/wayland_popup.cc +++ b/ui/ozone/platform/wayland/host/wayland_popup.cc
@@ -61,6 +61,11 @@ params.anchor->anchor_rect.set_size({1, 1}); } + // Certain Wayland compositors (E.g. Mutter) expects wl_surface to have no + // buffer attached when xdg-surface role is created. + wl_surface_attach(root_surface()->surface(), nullptr, 0, 0); + root_surface()->Commit(false); + ShellObjectFactory factory; shell_popup_ = factory.CreateShellPopupWrapper(connection(), this, params); if (!shell_popup_) { @@ -128,10 +133,7 @@ parent_window()->set_child_window(nullptr); shell_popup_.reset(); } - - // Detach buffer from surface in order to completely shutdown popups and - // tooltips, and release resources. - connection()->buffer_manager_host()->ResetSurfaceContents(root_surface()); + connection()->ScheduleFlush(); } bool WaylandPopup::IsVisible() const {
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.cc b/ui/ozone/platform/wayland/host/wayland_subsurface.cc index 28ad5699..a0ef886 100644 --- a/ui/ozone/platform/wayland/host/wayland_subsurface.cc +++ b/ui/ozone/platform/wayland/host/wayland_subsurface.cc
@@ -59,7 +59,6 @@ return; subsurface_.reset(); - connection_->buffer_manager_host()->ResetSurfaceContents(wayland_surface()); } bool WaylandSubsurface::IsVisible() const { @@ -81,8 +80,6 @@ // dispatch all of the input to platform window. gfx::Rect region_px; wayland_surface()->SetInputRegion(®ion_px); - - connection_->buffer_manager_host()->SetSurfaceConfigured(wayland_surface()); } void WaylandSubsurface::ConfigureAndShowSurface( @@ -96,8 +93,10 @@ // Chromium positions quads in display::Display coordinates in physical // pixels, but Wayland requires them to be in local surface coordinates a.k.a // relative to parent window. - auto bounds_dip_in_parent_surface = - AdjustSubsurfaceBounds(bounds_px, parent_bounds_px, buffer_scale); + auto bounds_dip_in_parent_surface = AdjustSubsurfaceBounds( + bounds_px, parent_bounds_px, + connection_->surface_submission_in_pixel_coordinates() ? 1.f + : buffer_scale); wl_subsurface_set_position(subsurface_.get(), bounds_dip_in_parent_surface.x(), bounds_dip_in_parent_surface.y());
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc index db8db98..18050db 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.cc +++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
@@ -156,17 +156,26 @@ return; } -void WaylandSurface::AttachBuffer(WaylandBufferHandle* buffer_handle) { +bool WaylandSurface::AttachBuffer(WaylandBufferHandle* buffer_handle) { DCHECK(!apply_state_immediately_); if (!buffer_handle) { pending_state_.buffer = nullptr; pending_state_.buffer_id = 0; - return; + return false; } pending_state_.buffer_size_px = buffer_handle->size(); pending_state_.buffer = buffer_handle->wl_buffer(); pending_state_.buffer_id = buffer_handle->id(); + + if (state_.buffer_id == pending_state_.buffer_id && + buffer_handle->released()) { + state_.buffer = nullptr; + state_.buffer_id = 0; + } + // Compare buffer_id because it is monotonically increasing. state_.buffer + // may have been de-allocated. + return state_.buffer_id != pending_state_.buffer_id; } void WaylandSurface::UpdateBufferDamageRegion(const gfx::Rect& damage_px) { @@ -174,9 +183,10 @@ pending_state_.damage_px.push_back(damage_px); } -void WaylandSurface::Commit() { +void WaylandSurface::Commit(bool flush) { wl_surface_commit(surface_.get()); - connection_->ScheduleFlush(); + if (flush) + connection_->ScheduleFlush(); } void WaylandSurface::SetBufferTransform(gfx::OverlayTransform transform) { @@ -354,21 +364,24 @@ surface_sync, pending_state_.acquire_fence.owned_fd.get()); } - auto* linux_buffer_release = - zwp_linux_surface_synchronization_v1_get_release(surface_sync); + if (!explicit_release_callback_.is_null()) { + auto* linux_buffer_release = + zwp_linux_surface_synchronization_v1_get_release(surface_sync); - static struct zwp_linux_buffer_release_v1_listener release_listener = { - &WaylandSurface::FencedRelease, - &WaylandSurface::ImmediateRelease, - }; - zwp_linux_buffer_release_v1_add_listener(linux_buffer_release, - &release_listener, this); + static struct zwp_linux_buffer_release_v1_listener release_listener = + { + &WaylandSurface::FencedRelease, + &WaylandSurface::ImmediateRelease, + }; + zwp_linux_buffer_release_v1_add_listener(linux_buffer_release, + &release_listener, this); - linux_buffer_releases_.emplace( - linux_buffer_release, - ExplicitReleaseInfo( - wl::Object<zwp_linux_buffer_release_v1>(linux_buffer_release), - pending_state_.buffer)); + linux_buffer_releases_.emplace( + linux_buffer_release, + ExplicitReleaseInfo( + wl::Object<zwp_linux_buffer_release_v1>(linux_buffer_release), + pending_state_.buffer)); + } } } }
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.h b/ui/ozone/platform/wayland/host/wayland_surface.h index 93cbcfe..838982a 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.h +++ b/ui/ozone/platform/wayland/host/wayland_surface.h
@@ -48,19 +48,22 @@ wp_viewport* viewport() const { return viewport_.get(); } zcr_blending_v1* blending() const { return blending_.get(); } + uint32_t buffer_id() const { return state_.buffer_id; } + int32_t buffer_scale() const { return state_.buffer_scale; } + float opacity() const { return state_.opacity; } + bool use_blending() const { return state_.use_blending; } + const std::vector<uint32_t>& entered_outputs() const { return entered_outputs_; } + bool has_explicit_release_callback() const { + return !explicit_release_callback_.is_null(); + } void set_explicit_release_callback(ExplicitReleaseCallback callback) { explicit_release_callback_ = callback; } - int32_t pending_buffer_scale() const { return pending_state_.buffer_scale; } - - // Tells if the surface has a buffer attached. - bool has_buffer_attached() const { return !!state_.buffer; } - // Returns an id that identifies the |wl_surface_|. uint32_t GetSurfaceId() const; // Returns a gfx::AcceleratedWidget that identifies the WaylandWindow that @@ -81,15 +84,13 @@ void SetAcquireFence(gfx::GpuFenceHandle acquire_fence); // Attaches the given wl_buffer to the underlying wl_surface at (0, 0). - void AttachBuffer(WaylandBufferHandle* buffer_handle); + // Returns true if wl_surface.attach will be called in ApplyPendingStates(). + bool AttachBuffer(WaylandBufferHandle* buffer_handle); // Describes where the surface needs to be repainted according to // |buffer_pending_damage_region|, which should be in buffer coordinates (px). void UpdateBufferDamageRegion(const gfx::Rect& damage_px); - // Commits the underlying wl_surface and triggers a wayland connection flush. - void Commit(); - // Sets an optional transformation for how the Wayland compositor interprets // the contents of the buffer attached to this surface. void SetBufferTransform(gfx::OverlayTransform transform); @@ -157,6 +158,10 @@ // Then copy |pending_states_| to |states_|. void ApplyPendingState(); + // Commits the underlying wl_surface, triggers a wayland connection flush if + // |flush| is true. + void Commit(bool flush = true); + // Workaround used by GLSurfaceWayland when libgbm is not available. Causes // SetSurfaceBufferScale() SetOpaqueRegion(), and SetInputRegion() to take // effect immediately. @@ -197,6 +202,10 @@ gfx::GpuFenceHandle acquire_fence; uint32_t buffer_id = 0; + // Note that this wl_buffer ptr is never cleared, even when the + // buffer_handle owning this wl_buffer is destroyed. Accessing this field + // should ensure wl_buffer exists by calling + // WaylandBufferManagerHost::EnsureBufferHandle(buffer_id). wl_buffer* buffer = nullptr; gfx::Size buffer_size_px;
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index 0661ac4..669903a 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -54,6 +54,11 @@ WaylandToplevelWindow::~WaylandToplevelWindow() = default; bool WaylandToplevelWindow::CreateShellToplevel() { + // Certain Wayland compositors (E.g. Mutter) expects wl_surface to have no + // buffer attached when xdg-surface role is created. + wl_surface_attach(root_surface()->surface(), nullptr, 0, 0); + root_surface()->Commit(false); + ShellObjectFactory factory; shell_toplevel_ = factory.CreateShellToplevelWrapper(connection(), this); if (!shell_toplevel_) { @@ -129,10 +134,6 @@ shell_toplevel_.reset(); connection()->ScheduleFlush(); - - // Detach buffer from surface in order to completely shutdown menus and - // tooltips, and release resources. - connection()->buffer_manager_host()->ResetSurfaceContents(root_surface()); } bool WaylandToplevelWindow::IsVisible() const {
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index 6ac4986..0ef600b 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -26,14 +26,14 @@ #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" +#include "ui/gfx/overlay_priority_hint.h" #include "ui/ozone/common/bitmap_cursor.h" #include "ui/ozone/common/features.h" -#include "ui/ozone/platform/wayland/common/wayland_util.h" -#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_cursor_position.h" #include "ui/ozone/platform/wayland/host/wayland_data_drag_controller.h" #include "ui/ozone/platform/wayland/host/wayland_event_source.h" +#include "ui/ozone/platform/wayland/host/wayland_frame_manager.h" #include "ui/ozone/platform/wayland/host/wayland_output_manager.h" #include "ui/ozone/platform/wayland/host/wayland_pointer.h" #include "ui/ozone/platform/wayland/host/wayland_subsurface.h" @@ -62,6 +62,7 @@ WaylandConnection* connection) : delegate_(delegate), connection_(connection), + frame_manager_(std::make_unique<WaylandFrameManager>(this, connection)), wayland_overlay_delegation_enabled_(connection->viewporter() && IsWaylandOverlayDelegationEnabled()), accelerated_widget_( @@ -222,16 +223,34 @@ } void WaylandWindow::Show(bool inactive) { - if (background_buffer_id_ != 0u) - should_attach_background_buffer_ = true; + frame_manager_->MaybeProcessPendingFrame(); } void WaylandWindow::Hide() { + can_submit_frames_ = false; + // Mutter compositor crashes if we don't remove subsurface roles when hiding. - if (primary_subsurface_) + if (primary_subsurface_) { primary_subsurface()->Hide(); - for (auto& subsurface : wayland_subsurfaces_) + } + for (auto& subsurface : wayland_subsurfaces_) { subsurface->Hide(); + } + frame_manager_->Hide(); +} + +void WaylandWindow::OnChannelDestroyed() { + frame_manager_->ClearStates(); + base::circular_deque< + std::pair<WaylandSubsurface*, ui::ozone::mojom::WaylandOverlayConfigPtr>> + subsurfaces_to_overlays; + subsurfaces_to_overlays.reserve(wayland_subsurfaces_.size() + 1); + for (auto& subsurface : wayland_subsurfaces_) + subsurfaces_to_overlays.emplace_back(subsurface.get(), nullptr); + + frame_manager_->RecordFrame(std::make_unique<WaylandFrame>( + root_surface(), nullptr, std::move(subsurfaces_to_overlays), + /*expects_ack=*/false)); } void WaylandWindow::Close() { @@ -283,6 +302,13 @@ return gfx::ScaleToRoundedRect(bounds_px_, 1.0f / window_scale()); } +void WaylandWindow::OnSurfaceConfigureEvent() { + if (can_submit_frames_) + return; + can_submit_frames_ = true; + frame_manager_->MaybeProcessPendingFrame(); +} + void WaylandWindow::SetTitle(const std::u16string& title) {} void WaylandWindow::SetCapture() { @@ -764,30 +790,52 @@ CHECK(split == overlays.end() || (*split)->z_order >= 0); size_t num_primary_planes = (split != overlays.end() && (*split)->z_order == 0) ? 1 : 0; + size_t num_background_planes = + (overlays.front()->z_order == INT32_MIN) ? 1 : 0; size_t above = (overlays.end() - split) - num_primary_planes; - size_t below = split - overlays.begin(); - - if (overlays.front()->z_order == INT32_MIN) - --below; + size_t below = (split - overlays.begin()) - num_background_planes; // Re-arrange the list of subsurfaces to fit the |overlays|. Request extra // subsurfaces if needed. if (!ArrangeSubsurfaceStack(above, below)) return false; - if (wayland_overlay_delegation_enabled_) { - primary_subsurface()->Show(); - connection_->buffer_manager_host()->StartFrame(root_surface()); + auto main_overlay = split; + if (split == overlays.end() && overlays.front()->z_order == INT32_MIN) + main_overlay = overlays.begin(); + + gfx::Size visual_size = (*main_overlay)->bounds_rect.size(); + float buffer_scale = (*main_overlay)->surface_scale_factor; + auto& rounded_corners = (*main_overlay)->rounded_corners; + + if (!wayland_overlay_delegation_enabled_) { + DCHECK_EQ(overlays.size(), 1u); + frame_manager_->RecordFrame(std::make_unique<WaylandFrame>( + root_surface(), std::move(*main_overlay))); + return true; } - // Update buffer scale before subsurfaces are configured. - { - auto main_overlay = split; - if (split == overlays.end() && overlays.front()->z_order == INT32_MIN) - main_overlay = overlays.begin(); - root_surface()->SetSurfaceBufferScale( - ceil((*main_overlay)->surface_scale_factor)); + base::circular_deque< + std::pair<WaylandSubsurface*, ui::ozone::mojom::WaylandOverlayConfigPtr>> + subsurfaces_to_overlays; + subsurfaces_to_overlays.reserve( + std::max(overlays.size() - num_background_planes, + wayland_subsurfaces_.size() + 1)); + + // TODO(fangzhoug): Keeping this surface alive removes the black background + // when doing animation of showing/hiding auxiliary windows. i.e. Without + // overlay delegation feature, black background is shown on tooltip. So keep a + // fake config for primary_subsurface when it is not in the overlay list, such + // that the frame_manager does not destroy the subsurface. + subsurfaces_to_overlays.emplace_back( + primary_subsurface(), + num_primary_planes ? std::move(*split) + : ui::ozone::mojom::WaylandOverlayConfig::New()); + if (!num_primary_planes) { + auto& primary_config = subsurfaces_to_overlays.back().second; + primary_config->opacity = + primary_subsurface()->wayland_surface()->opacity(); } { @@ -797,51 +845,12 @@ auto overlay_iter = split - 1; for (auto iter = subsurface_stack_below_.begin(); iter != subsurface_stack_below_.end(); ++iter, --overlay_iter) { - if (overlays.front()->z_order == INT32_MIN - ? overlay_iter >= ++overlays.begin() - : overlay_iter >= overlays.begin()) { - WaylandSurface* reference_above = nullptr; - if (overlay_iter == split - 1) { - // It's possible that |overlays| does not contain primary plane, we - // still want to place relative to the surface with z_order=0. - reference_above = primary_subsurface_->wayland_surface(); - } else { - reference_above = (*std::next(iter))->wayland_surface(); - } - (*iter)->ConfigureAndShowSurface( - (*overlay_iter)->bounds_rect, (*split)->bounds_rect, - root_surface()->pending_buffer_scale(), nullptr, reference_above); - - (*iter)->wayland_surface()->SetBufferTransform( - (*overlay_iter)->transform); - (*iter)->wayland_surface()->SetSurfaceBufferScale( - root_surface()->pending_buffer_scale()); - (*iter)->wayland_surface()->SetViewportSource( - (*overlay_iter)->crop_rect); - (*iter)->wayland_surface()->SetOverlayPriority( - (*overlay_iter)->priority_hint); - (*iter)->wayland_surface()->SetViewportDestination( - (*overlay_iter)->bounds_rect.size()); - gfx::Rect region_px = - (*overlay_iter)->enable_blend - ? gfx::Rect() - : gfx::Rect((*overlay_iter)->bounds_rect.size()); - std::vector<gfx::Rect> opaque_region{region_px}; - (*iter)->wayland_surface()->SetOpaqueRegion(&opaque_region); - (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); - (*iter)->wayland_surface()->SetBlending((*overlay_iter)->enable_blend); - (*iter)->wayland_surface()->SetRoundedCorners( - (*overlay_iter)->rounded_corners); - connection_->buffer_manager_host()->CommitBufferInternal( - (*iter)->wayland_surface(), (*overlay_iter)->buffer_id, - (*overlay_iter)->damage_region, - /*wait_for_frame_callback=*/true, - /*commit_synced_subsurface=*/true, - std::move((*overlay_iter)->access_fence_handle)); + if (overlay_iter >= overlays.begin() + num_background_planes) { + subsurfaces_to_overlays.emplace_front(*iter, std::move(*overlay_iter)); } else { // If there're more subsurfaces requested that we don't need at the // moment, hide them. - (*iter)->Hide(); + subsurfaces_to_overlays.emplace_front(*iter, nullptr); } } @@ -852,126 +861,35 @@ for (auto iter = subsurface_stack_above_.begin(); iter != subsurface_stack_above_.end(); ++iter, ++overlay_iter) { if (overlay_iter < overlays.end()) { - WaylandSurface* reference_below = nullptr; - if (overlay_iter == split + num_primary_planes) { - // It's possible that |overlays| does not contain primary plane, we - // still want to place relative to the surface with z_order=0. - reference_below = primary_subsurface_->wayland_surface(); - } else { - reference_below = (*std::prev(iter))->wayland_surface(); - } - (*iter)->ConfigureAndShowSurface( - (*overlay_iter)->bounds_rect, (*split)->bounds_rect, - root_surface()->pending_buffer_scale(), reference_below, nullptr); - - (*iter)->wayland_surface()->SetBufferTransform( - (*overlay_iter)->transform); - (*iter)->wayland_surface()->SetSurfaceBufferScale( - root_surface()->pending_buffer_scale()); - (*iter)->wayland_surface()->SetViewportSource( - (*overlay_iter)->crop_rect); - (*iter)->wayland_surface()->SetOverlayPriority( - (*overlay_iter)->priority_hint); - (*iter)->wayland_surface()->SetViewportDestination( - (*overlay_iter)->bounds_rect.size()); - gfx::Rect region_px = - (*overlay_iter)->enable_blend - ? gfx::Rect() - : gfx::Rect((*overlay_iter)->bounds_rect.size()); - std::vector<gfx::Rect> opaque_region{region_px}; - (*iter)->wayland_surface()->SetOpaqueRegion(&opaque_region); - (*iter)->wayland_surface()->SetOpacity((*overlay_iter)->opacity); - (*iter)->wayland_surface()->SetBlending((*overlay_iter)->enable_blend); - (*iter)->wayland_surface()->SetRoundedCorners( - (*overlay_iter)->rounded_corners); - connection_->buffer_manager_host()->CommitBufferInternal( - (*iter)->wayland_surface(), (*overlay_iter)->buffer_id, - (*overlay_iter)->damage_region, - /*wait_for_frame_callback=*/true, - /*commit_synced_subsurface=*/true, - std::move((*overlay_iter)->access_fence_handle)); + subsurfaces_to_overlays.emplace_back(*iter, std::move(*overlay_iter)); } else { // If there're more subsurfaces requested that we don't need at the // moment, hide them. - (*iter)->Hide(); + subsurfaces_to_overlays.emplace_back(*iter, nullptr); } } } - if (split == overlays.end() && overlays.front()->z_order == INT32_MIN) - split = overlays.begin(); - - UpdateVisualSize((*split)->bounds_rect.size(), - (*split)->surface_scale_factor); - - if (!wayland_overlay_delegation_enabled_) { - root_surface_->SetViewportSource((*split)->crop_rect); - // TODO(fangzhoug): Refactor some of this logic s.t. the decision of whether - // to apply viewport.destination is made at commit time. - root_surface_->SetViewportDestination((*split)->crop_rect == - gfx::RectF(1.f, 1.f) - ? gfx::Size() - : (*split)->bounds_rect.size()); - connection_->buffer_manager_host()->CommitBufferInternal( - root_surface(), (*split)->buffer_id, (*split)->damage_region, - /*wait_for_frame_callback=*/true); - return true; - } - - if (num_primary_planes) { - // Mutter has incorrect damage when processing un-cropped buffer commits - // with viewport.destination == buffer.size. So do not set - // viewport.destination to primary planes if crop_rect is uniform. - // TODO(fangzhoug): Refactor some of this logic s.t. the decision of whether - // to apply viewport.destination is made at commit time. Right now PIP - // would have incorrect size b/c it is fullscreen overlay scheduled at - // z_order=0. - primary_subsurface_->wayland_surface()->SetBufferTransform( - (*split)->transform); - primary_subsurface_->wayland_surface()->SetSurfaceBufferScale( - root_surface()->pending_buffer_scale()); - primary_subsurface_->wayland_surface()->SetViewportSource( - (*split)->crop_rect); - primary_subsurface_->wayland_surface()->SetOverlayPriority( - (*split)->priority_hint); - primary_subsurface_->wayland_surface()->SetViewportDestination( - (*split)->crop_rect == gfx::RectF(1.f, 1.f) - ? gfx::Size() - : (*split)->bounds_rect.size()); - gfx::Rect region_px = (*split)->enable_blend - ? gfx::Rect() - : gfx::Rect((*split)->bounds_rect.size()); - std::vector<gfx::Rect> opaque_region{region_px}; - primary_subsurface_->wayland_surface()->SetOpaqueRegion(&opaque_region); - primary_subsurface_->wayland_surface()->SetOpacity((*split)->opacity); - primary_subsurface_->wayland_surface()->SetBlending((*split)->enable_blend); - primary_subsurface_->wayland_surface()->SetRoundedCorners( - (*split)->rounded_corners); - connection_->buffer_manager_host()->CommitBufferInternal( - primary_subsurface_->wayland_surface(), (*split)->buffer_id, - (*split)->damage_region, - /*wait_for_frame_callback=*/true, - /*commit_synced_subsurface=*/true, - std::move((*split)->access_fence_handle)); - } - - gfx::Rect background_damage; - if (overlays.front()->z_order == INT32_MIN) { - background_buffer_id_ = overlays.front()->buffer_id; - background_damage = overlays.front()->damage_region; - should_attach_background_buffer_ = true; - } - - root_surface_->SetViewportDestination(visual_size_px_); - if (should_attach_background_buffer_) { - connection_->buffer_manager_host()->EndFrame(background_buffer_id_, - background_damage); - should_attach_background_buffer_ = false; + // Configuration of the root_surface + ui::ozone::mojom::WaylandOverlayConfigPtr root_config; + if (num_background_planes) { + root_config = std::move(overlays.front()); } else { - // Subsurfaces are set to sync, above surface configs will only take effect - // when root_surface is committed. - connection_->buffer_manager_host()->EndFrame(); + root_config = ui::ozone::mojom::WaylandOverlayConfig::New(); + root_config->z_order = INT32_MIN; + root_config->transform = gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE; + root_config->buffer_id = root_surface()->buffer_id(); + root_config->enable_blend = root_surface()->use_blending(); + root_config->opacity = root_surface()->opacity(); + root_config->priority_hint = gfx::OverlayPriorityHint::kNone; } + root_config->bounds_rect.set_size(visual_size); + root_config->surface_scale_factor = buffer_scale; + root_config->rounded_corners = rounded_corners; + + frame_manager_->RecordFrame( + std::make_unique<WaylandFrame>(root_surface(), std::move(root_config), + std::move(subsurfaces_to_overlays))); return true; }
diff --git a/ui/ozone/platform/wayland/host/wayland_window.h b/ui/ozone/platform/wayland/host/wayland_window.h index 7e59a96..1302bfc 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.h +++ b/ui/ozone/platform/wayland/host/wayland_window.h
@@ -38,6 +38,7 @@ class WaylandConnection; class WaylandSubsurface; class WaylandWindowDragController; +class WaylandFrameManager; class WaylandPopup; using WidgetSubsurfaceSet = base::flat_set<std::unique_ptr<WaylandSubsurface>>; @@ -136,6 +137,8 @@ } void set_frame_insets_px(gfx::Insets insets) { frame_insets_px_ = insets; } + bool can_submit_frames() const { return can_submit_frames_; } + // These are never intended to be used except in unit tests. void set_update_visual_size_immediately(bool update_immediately) { update_visual_size_immediately_ = update_immediately; @@ -241,6 +244,10 @@ // Tells if the surface has already been configured. virtual bool IsSurfaceConfigured() = 0; + // Called by shell surfaces to indicate that this window can start submitting + // frames. + void OnSurfaceConfigureEvent(); + // Sets the window geometry. virtual void SetWindowGeometry(gfx::Rect bounds); @@ -288,6 +295,9 @@ return weak_ptr_factory_.GetWeakPtr(); } + // Clears the state of the |frame_manager_| when the GPU channel is destroyed. + void OnChannelDestroyed(); + protected: WaylandWindow(PlatformWindowDelegate* delegate, WaylandConnection* connection); @@ -368,8 +378,9 @@ WaylandWindow* parent_window_ = nullptr; WaylandWindow* child_window_ = nullptr; - bool should_attach_background_buffer_ = false; - uint32_t background_buffer_id_ = 0u; + std::unique_ptr<WaylandFrameManager> frame_manager_; + bool can_submit_frames_ = false; + // |root_surface_| is a surface for the opaque background. Its z-order is // INT32_MIN. std::unique_ptr<WaylandSurface> root_surface_;
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 86158d1..7670724e 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -2594,7 +2594,7 @@ EXPECT_TRUE(mock_surface->xdg_surface()->xdg_popup()); } -TEST_P(WaylandWindowTest, RemovesReattachesBackgroundOnHideShow) { +TEST_P(WaylandWindowTest, ReattachesBackgroundOnShow) { EXPECT_TRUE(connection_->buffer_manager_host()); auto interface_ptr = connection_->buffer_manager_host()->BindInterface(); @@ -2639,6 +2639,7 @@ background->transform = gfx::OVERLAY_TRANSFORM_NONE; background->buffer_id = buffer_id1; background->surface_scale_factor = 1; + background->opacity = 1.f; overlays.push_back(std::move(background)); buffer_manager_gpu_->CommitOverlays(window->GetWidget(), std::move(overlays)); mock_surface->SendFrameCallback(); @@ -2647,21 +2648,21 @@ EXPECT_NE(mock_surface->attached_buffer(), nullptr); - // Hiding window attaches a nil wl_buffer as background. window->Hide(); mock_surface->SendFrameCallback(); Sync(); - EXPECT_EQ(mock_surface->attached_buffer(), nullptr); - - mock_surface->ReleaseBuffer(mock_surface->prev_attached_buffer()); + mock_surface->ReleaseBuffer(mock_surface->attached_buffer()); window->Show(false); Sync(); SendConfigureEvent(mock_surface->xdg_surface(), 100, 100, 2, states.get()); + // Expects to receive an attach request on next frame. + EXPECT_CALL(*mock_surface, Attach(_, _, _)).Times(1); + // Commit a frame with only the primary_plane. overlays.clear(); ui::ozone::mojom::WaylandOverlayConfigPtr primary{ @@ -2670,6 +2671,7 @@ primary->transform = gfx::OVERLAY_TRANSFORM_NONE; primary->buffer_id = buffer_id2; primary->surface_scale_factor = 1; + primary->opacity = 1.f; overlays.push_back(std::move(primary)); buffer_manager_gpu_->CommitOverlays(window->GetWidget(), std::move(overlays));
diff --git a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc index b8d15bf..3116311f 100644 --- a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_impl.cc
@@ -71,6 +71,7 @@ DCHECK(surface); surface->wayland_window_->HandleSurfaceConfigure(serial); + surface->wayland_window_->OnSurfaceConfigureEvent(); } xdg_surface* XDGSurfaceWrapperImpl::xdg_surface() const {
diff --git a/ui/ozone/platform/wayland/host/zxdg_surface_v6_wrapper_impl.cc b/ui/ozone/platform/wayland/host/zxdg_surface_v6_wrapper_impl.cc index d8a2a69..33786ef 100644 --- a/ui/ozone/platform/wayland/host/zxdg_surface_v6_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/zxdg_surface_v6_wrapper_impl.cc
@@ -75,6 +75,7 @@ DCHECK(surface); surface->wayland_window_->HandleSurfaceConfigure(serial); + surface->wayland_window_->OnSurfaceConfigureEvent(); } zxdg_surface_v6* ZXDGSurfaceV6WrapperImpl::zxdg_surface() const {
diff --git a/ui/ozone/platform/wayland/test/mock_surface.cc b/ui/ozone/platform/wayland/test/mock_surface.cc index 692fc68..3525925 100644 --- a/ui/ozone/platform/wayland/test/mock_surface.cc +++ b/ui/ozone/platform/wayland/test/mock_surface.cc
@@ -182,17 +182,20 @@ } void MockSurface::ReleaseBuffer(wl_resource* buffer) { - DCHECK(buffer); - wl_buffer_send_release(buffer); - wl_client_flush(wl_resource_get_client(buffer)); - // Strictly speaking, Wayland protocol requires that we send both an explicit // release and a buffer release if an explicit release has been asked for. // But, this makes testing harder, and ozone/wayland should work with // just one of these signals (and handle both gracefully). - auto iter = linux_buffer_releases_.find(buffer); - if (iter != linux_buffer_releases_.end()) - linux_buffer_releases_.erase(iter); + // TODO(fangzhoug): Make buffer release mechanism a testing config variation. + if (linux_buffer_releases_.find(buffer) != linux_buffer_releases_.end()) { + ReleaseBufferFenced(buffer, {}); + wl_buffer_send_release(buffer); + wl_client_flush(wl_resource_get_client(buffer)); + } + + DCHECK(buffer); + wl_buffer_send_release(buffer); + wl_client_flush(wl_resource_get_client(buffer)); if (buffer == prev_attached_buffer_) prev_attached_buffer_ = nullptr;
diff --git a/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc b/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc index ac1328b..a8dec27 100644 --- a/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc +++ b/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc
@@ -1764,7 +1764,7 @@ linux_dmabuf->buffer_params()[0]->resource(), linux_dmabuf->buffer_params()[0]->buffer_resource()); EXPECT_CALL(*mock_surface, Attach(_, _, _)).Times(1); - EXPECT_CALL(*mock_surface, Frame(_)).Times(1); + EXPECT_CALL(*mock_surface, Frame(_)).Times(0); EXPECT_CALL(*mock_surface, Commit()).Times(1); Sync();
diff --git a/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_pairing_ui.js b/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_pairing_ui.js index d1960c6..e4c801eb 100644 --- a/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_pairing_ui.js +++ b/ui/webui/resources/cr_components/chromeos/bluetooth/bluetooth_pairing_ui.js
@@ -120,6 +120,8 @@ }, /** + * This can be null if no pairing attempt was started or a pairing attempt + * was cancelled by user. * @private {?chromeos.bluetoothConfig.mojom.BluetoothDeviceProperties} */ devicePendingPairing_: { @@ -342,7 +344,10 @@ this.pairingDeviceAddress = null; this.selectedPageId_ = BluetoothPairingSubpageId.DEVICE_SELECTION_PAGE; - this.lastFailedPairingDeviceId_ = this.devicePendingPairing_.id; + if (this.devicePendingPairing_) { + this.lastFailedPairingDeviceId_ = this.devicePendingPairing_.id; + } + this.devicePendingPairing_ = null; if (this.queuedDevicePendingPairing_) { @@ -486,6 +491,7 @@ */ onCancelClick_(event) { event.stopPropagation(); + this.devicePendingPairing_ = null; if (this.pairingDelegateReceiver_) { this.pairingDelegateReceiver_.$.close(); }