diff --git a/.gitignore b/.gitignore index 179ef51..13ace36 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,6 +1,7 @@ /client-py/ *.bak *.code-workspace +*.gstmp *.mk *.ncb *.opensdf
diff --git a/BUILD.gn b/BUILD.gn index 9f9e1e42..ea356bd 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -153,10 +153,11 @@ } if (!is_castos) { - deps += [ - "//chrome/installer", - "//chrome/updater", - ] + deps += [ "//chrome/installer" ] + } + + if (enable_updater) { + deps += [ "//chrome/updater" ] } if (enable_ppapi) {
diff --git a/DEPS b/DEPS index 6d7fd75..0149255 100644 --- a/DEPS +++ b/DEPS
@@ -304,15 +304,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': 'fe6b72b4d94081c9e08d67615c1d4964098acbe2', + 'skia_revision': '14c62c66936707e9d26c4972242ee2c6229410c8', # 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': 'e06e3961d5bca8ed2f1a504f478a4c1f5cefb98e', + 'v8_revision': '6813c888ce1426bee5e6a3cceca0e0095f44e1b3', # 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': '5ff1298ce5b89ec748d75e9a24cabe11bc952a07', + 'angle_revision': '3b27647cb9f8c18308183788ab06737539e5b229', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -375,7 +375,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': '5eeb59b9e99b1ec1a3bff01581eeed0e7cccd85b', + 'catapult_revision': 'c4e9d16032d8217ec6de404a66f4f0cc1d8e366a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -383,7 +383,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '5ab9aad531588de1540d5b4e150e1e45f48f0afd', + 'devtools_frontend_revision': '75eada74795ea506c979d1db745c21e6cfcd0c03', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -419,7 +419,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '0a31cadaf37f70d07554d6d3ce9b83baeceb00a9', + 'dawn_revision': 'f586545aef99b21bf5cc34c91e8877c592854913', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -443,7 +443,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nearby # and whatever else without interference from each other. - 'nearby_revision': 'ea3fa0e3924c9e4be23504cbde398cef305d3197', + 'nearby_revision': '43ec97b13bdaf7cb90941a87b0457948d4a0410d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling securemessage # and whatever else without interference from each other. @@ -463,7 +463,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'libcxxabi_revision': 'dc82f3042daa8b06d34e51d8492d37ce901a6f8d', + 'libcxxabi_revision': 'd520d582aa710cc0a4635620c02c5dbc187deb4f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -770,7 +770,7 @@ 'src/clank': { 'url': 'https://chrome-internal.googlesource.com/clank/internal/apps.git' + '@' + - '78cba7f21b6a7c6b4bbf04576790f01a2ae5da5e', + '4a684aa5bb100eaa6526f1996c518308fefd8655', 'condition': 'checkout_android and checkout_src_internal', }, @@ -1204,13 +1204,13 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '7c6ebe7fd16001db4ef52131e5146535c6748232', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'e8523914418f7c71281df174be4778f36a357b12', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '6a12da93fff53baa0acada6d0c938d318fb4d6d6', + 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + 'fd2a693a39a9c8fdded6f2b74fa746fcef89a188', 'condition': 'checkout_src_internal', }, @@ -1638,7 +1638,7 @@ Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + 'db956674bbdfbaab5acdd3fdb4117c2fef5527e9', 'src/third_party/openscreen/src': - Var('chromium_git') + '/openscreen' + '@' + '92617e1e49192abb93ded7bffcfdf33d1bf9175c', + Var('chromium_git') + '/openscreen' + '@' + 'bcee0c4761291983173e390885193aa3c3ea7148', 'src/third_party/openxr/src': { 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + 'bf21ccb1007bb531b45d9978919a56ea5059c245', @@ -1800,7 +1800,7 @@ 'dep_type': 'cipd', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@f709feae795b2c20ecec2901c4e7deb41e7762c0', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@e55b93bb3f992cdee2c74a0dbc9f6b7fd0478832', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1910,7 +1910,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@63d0071ea2e6f87464b85ecccd8114f9225c5914', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4a29dd840779bec3bd089b95bab37a947223bfcd', 'condition': 'checkout_src_internal', },
diff --git a/ash/app_list/BUILD.gn b/ash/app_list/BUILD.gn index b4e588e9..fcdded8 100644 --- a/ash/app_list/BUILD.gn +++ b/ash/app_list/BUILD.gn
@@ -20,6 +20,8 @@ "app_list_event_targeter.h", "app_list_feature_usage_metrics.cc", "app_list_feature_usage_metrics.h", + "app_list_item_util.cc", + "app_list_item_util.h", "app_list_metrics.cc", "app_list_metrics.h", "app_list_model_provider.cc",
diff --git a/ash/app_list/app_list_item_util.cc b/ash/app_list/app_list_item_util.cc new file mode 100644 index 0000000..bb40d1b --- /dev/null +++ b/ash/app_list/app_list_item_util.cc
@@ -0,0 +1,16 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/app_list/app_list_item_util.h" + +namespace ash { + +const ui::ClipboardFormatType& GetAppItemFormatType() { + static const base::NoDestructor<ui::ClipboardFormatType> format( + ui::ClipboardFormatType::GetType("ash/x-app-item-id")); + + return *format; +} + +} // namespace ash
diff --git a/ash/app_list/app_list_item_util.h b/ash/app_list/app_list_item_util.h new file mode 100644 index 0000000..63fd6d4 --- /dev/null +++ b/ash/app_list/app_list_item_util.h
@@ -0,0 +1,17 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_APP_LIST_APP_LIST_ITEM_UTIL_H_ +#define ASH_APP_LIST_APP_LIST_ITEM_UTIL_H_ + +#include "ui/base/clipboard/clipboard_format_type.h" +#include "ui/base/dragdrop/drag_drop_types.h" + +namespace ash { + +const ui::ClipboardFormatType& GetAppItemFormatType(); + +} // namespace ash + +#endif // ASH_APP_LIST_APP_LIST_ITEM_UTIL_H_
diff --git a/ash/app_list/app_list_util.cc b/ash/app_list/app_list_util.cc index a164c16c..f3b93f1 100644 --- a/ash/app_list/app_list_util.cc +++ b/ash/app_list/app_list_util.cc
@@ -72,7 +72,7 @@ } bool IsFolderItem(AppListItem* item) { - return item->GetItemType() == AppListFolderItem::kItemType; + return item && item->GetItemType() == AppListFolderItem::kItemType; } bool LeftRightKeyEventShouldExitText(views::Textfield* textfield,
diff --git a/ash/app_list/views/app_list_folder_view.cc b/ash/app_list/views/app_list_folder_view.cc index cbdf585c..e2ad2707 100644 --- a/ash/app_list/views/app_list_folder_view.cc +++ b/ash/app_list/views/app_list_folder_view.cc
@@ -25,6 +25,7 @@ #include "ash/controls/scroll_view_gradient_helper.h" #include "ash/keyboard/ui/keyboard_ui_controller.h" #include "ash/public/cpp/app_list/app_list_config.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_model_delegate.h" #include "ash/public/cpp/metrics_util.h" #include "ash/public/cpp/style/color_provider.h" @@ -1078,6 +1079,8 @@ AppsGridView::Pointer pointer, AppListItemView* original_drag_view, const gfx::Point& drag_point_in_folder_grid) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + // Convert the drag point relative to the root level AppsGridView. gfx::Point to_root_level_grid = drag_point_in_folder_grid; ConvertPointToTarget(items_grid_view_, root_apps_grid_view_, @@ -1095,6 +1098,8 @@ void AppListFolderView::DispatchDragEventForReparent( AppsGridView::Pointer pointer, const gfx::Point& drag_point_in_folder_grid) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + gfx::Point drag_point_in_root_grid = drag_point_in_folder_grid; // Temporarily reset the transform of the contents container so that the point // can be correctly converted to the root grid's coordinates. @@ -1112,6 +1117,8 @@ bool events_forwarded_to_drag_drop_host, bool cancel_drag, std::unique_ptr<AppDragIconProxy> drag_icon_proxy) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + folder_item_->NotifyOfDraggedItem(nullptr); folder_controller_->ReparentDragEnded(); @@ -1127,6 +1134,12 @@ std::move(drag_icon_proxy)); } +void AppListFolderView::Close() { + DCHECK(app_list_features::IsDragAndDropRefactorEnabled()); + + CloseFolderPage(); +} + void AppListFolderView::HideViewImmediately() { SetVisible(false); ResetState(/*restore_folder_item_view_state=*/true);
diff --git a/ash/app_list/views/app_list_folder_view.h b/ash/app_list/views/app_list_folder_view.h index eeb74b1..2e244b6 100644 --- a/ash/app_list/views/app_list_folder_view.h +++ b/ash/app_list/views/app_list_folder_view.h
@@ -184,6 +184,7 @@ bool events_forwarded_to_drag_drop_host, bool cancel_drag, std::unique_ptr<AppDragIconProxy> drag_icon_proxy) override; + void Close() override; bool IsDragPointOutsideOfFolder(const gfx::Point& drag_point) override; bool IsOEMFolder() const override; void HandleKeyboardReparent(AppListItemView* reparented_view,
diff --git a/ash/app_list/views/app_list_item_view.cc b/ash/app_list/views/app_list_item_view.cc index a978f0037..2572b4f 100644 --- a/ash/app_list/views/app_list_item_view.cc +++ b/ash/app_list/views/app_list_item_view.cc
@@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "ash/app_list/app_list_item_util.h" #include "ash/app_list/app_list_metrics.h" #include "ash/app_list/app_list_util.h" #include "ash/app_list/app_list_view_delegate.h" @@ -18,6 +19,7 @@ #include "ash/app_list/views/apps_grid_context_menu.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/app_list/app_list_config.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/style/color_provider.h" #include "ash/strings/grit/ash_strings.h" @@ -28,9 +30,11 @@ #include "base/auto_reset.h" #include "base/check.h" #include "base/functional/bind.h" +#include "base/pickle.h" #include "base/strings/utf_string_conversions.h" #include "cc/paint/paint_flags.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h" @@ -533,6 +537,10 @@ } void AppListItemView::SetTouchDragging(bool touch_dragging) { + // Drag and drop refactor handles all drag operations as Mouse Dragging. + // TODO(b/261985897): Figure out a way to correctly direct drag operations. + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + if (touch_dragging_ == touch_dragging) return; @@ -557,6 +565,7 @@ } void AppListItemView::OnMouseDragTimer() { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); // Show scaled up app icon to indicate draggable state. SetMouseDragging(true); } @@ -564,14 +573,18 @@ void AppListItemView::OnTouchDragTimer( const gfx::Point& tap_down_location, const gfx::Point& tap_down_root_location) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); // Show scaled up app icon to indicate draggable state. if (!InitiateDrag(tap_down_location, tap_down_root_location)) return; + SetTouchDragging(true); } bool AppListItemView::InitiateDrag(const gfx::Point& location, const gfx::Point& root_location) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + if (!grid_delegate_->InitiateDrag( this, location, root_location, base::BindOnce(&AppListItemView::OnDragStarted, @@ -585,8 +598,6 @@ } void AppListItemView::OnDragStarted() { - DCHECK_EQ(DragState::kInitialized, drag_state_); - mouse_drag_timer_.Stop(); touch_drag_timer_.Stop(); drag_state_ = DragState::kStarted; @@ -595,8 +606,6 @@ } void AppListItemView::OnDragEnded() { - DCHECK_NE(drag_state_, DragState::kNone); - mouse_dragging_ = false; mouse_drag_timer_.Stop(); @@ -831,7 +840,11 @@ } bool AppListItemView::OnMousePressed(const ui::MouseEvent& event) { - Button::OnMousePressed(event); + bool return_value = Button::OnMousePressed(event); + + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return return_value; + } if (!ShouldEnterPushedState(event)) return true; @@ -910,6 +923,10 @@ if (!weak_this) return; + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return; + } + SetMouseDragging(false); // EndDrag may delete |this|. @@ -920,12 +937,21 @@ Button::OnMouseCaptureLost(); SetMouseDragging(false); + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return; + } + // EndDrag may delete |this|. grid_delegate_->EndDrag(/*cancel=*/true); } bool AppListItemView::OnMouseDragged(const ui::MouseEvent& event) { - Button::OnMouseDragged(event); + bool return_value = Button::OnMouseDragged(event); + + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return return_value; + } + if (drag_state_ != DragState::kNone && mouse_dragging_) { // Update the drag location of the drag proxy if it has been created. // If the drag is no longer happening, it could be because this item @@ -960,7 +986,35 @@ views::FocusRing::Get(this)->SchedulePaint(); } +int AppListItemView::GetDragOperations(const gfx::Point& press_pt) { + return app_list_features::IsDragAndDropRefactorEnabled() + ? ui::DragDropTypes::DRAG_MOVE + : views::View::GetDragOperations(press_pt); +} + +void AppListItemView::WriteDragData(const gfx::Point& press_pt, + OSExchangeData* data) { + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + views::View::WriteDragData(press_pt, data); + return; + } + + SetMouseDragging(true); + if (item_weak_) { + data->provider().SetDragImage(icon_image_, press_pt.OffsetFromOrigin()); + base::Pickle data_pickle; + data_pickle.WriteString(item_weak_->id()); + data->SetPickledData(GetAppItemFormatType(), data_pickle); + } +} + void AppListItemView::OnGestureEvent(ui::GestureEvent* event) { + if (app_list_features::IsDragAndDropRefactorEnabled() && + event->type() != ui::ET_GESTURE_TAP_DOWN) { + Button::OnGestureEvent(event); + return; + } + switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: if (touch_dragging_) { @@ -1304,6 +1358,12 @@ item_weak_->RemoveObserver(this); item_weak_ = nullptr; + // TODO(b/261985897): Consider canceling drag when the item is being + // destroyed. + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return; + } + // `EndDrag()` may delete this. if (drag_state_ != DragState::kNone) grid_delegate_->EndDrag(/*cancel=*/true);
diff --git a/ash/app_list/views/app_list_item_view.h b/ash/app_list/views/app_list_item_view.h index 8149ed3c..4236def27 100644 --- a/ash/app_list/views/app_list_item_view.h +++ b/ash/app_list/views/app_list_item_view.h
@@ -243,6 +243,10 @@ // dot for new install. gfx::Rect GetDefaultTitleBoundsForTest(); + // Called when the drag registered for this view ends. + // `drag_end_callback` passed to `GridDelegate::InitiateDrag()`. + void OnDragEnded(); + // Sets the most recent grid index for this item view. Also sets // `has_pending_row_change_` based on whether the grid index change is // considered a row change for the purposes of animating item views between @@ -323,14 +327,6 @@ bool InitiateDrag(const gfx::Point& location, const gfx::Point& root_location); - // Called when the drag registered for this view starts moving. - // `drag_start_callback` passed to `GridDelegate::InitiateDrag()`. - void OnDragStarted(); - - // Called when the drag registered for this view ends. - // `drag_end_callback` passed to `GridDelegate::InitiateDrag()`. - void OnDragEnded(); - // Callback invoked when a context menu is received after calling // |AppListViewDelegate::GetContextMenuModel|. void OnContextMenuModelReceived( @@ -358,6 +354,12 @@ bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; void OnFocus() override; void OnBlur() override; + int GetDragOperations(const gfx::Point& press_pt) override; + void WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) override; + + // Called when the drag registered for this view starts moving. + // `drag_start_callback` passed to `GridDelegate::InitiateDrag()`. + void OnDragStarted(); // AppListItemObserver overrides: void ItemIconChanged(AppListConfigType config_type) override;
diff --git a/ash/app_list/views/app_list_view_unittest.cc b/ash/app_list/views/app_list_view_unittest.cc index 088b3ab..1c726ff1 100644 --- a/ash/app_list/views/app_list_view_unittest.cc +++ b/ash/app_list/views/app_list_view_unittest.cc
@@ -185,8 +185,9 @@ bool IsViewVisibleOnScreen(views::View* view) { if (!view->IsDrawn()) return false; - if (view->layer() && !view->layer()->IsDrawn()) + if (view->layer() && !view->layer()->IsVisible()) { return false; + } if (view->layer() && view->layer()->opacity() == 0.0f) return false;
diff --git a/ash/app_list/views/apps_grid_view.cc b/ash/app_list/views/apps_grid_view.cc index b09b9f7..6310fe9 100644 --- a/ash/app_list/views/apps_grid_view.cc +++ b/ash/app_list/views/apps_grid_view.cc
@@ -11,7 +11,9 @@ #include <utility> #include <vector> +#include "ash/app_list/app_list_item_util.h" #include "ash/app_list/app_list_metrics.h" +#include "ash/app_list/app_list_model_provider.h" #include "ash/app_list/app_list_util.h" #include "ash/app_list/app_list_view_delegate.h" #include "ash/app_list/apps_grid_row_change_animator.h" @@ -31,6 +33,7 @@ #include "ash/app_list/views/pulsing_block_view.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/app_list/app_list_config.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/metrics_util.h" #include "ash/strings/grit/ash_strings.h" @@ -41,10 +44,13 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "base/pickle.h" #include "base/ranges/algorithm.h" #include "base/time/time.h" #include "ui/aura/window.h" #include "ui/base/dragdrop/drag_drop_types.h" +#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" +#include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/compositor.h" @@ -315,9 +321,10 @@ // Coming here |drag_view_| should already be canceled since otherwise the // drag would disappear after the app list got animated away and closed, // which would look odd. - DCHECK(!drag_item_); - if (drag_item_) - EndDrag(true); + if (drag_item_) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + EndDrag(/*cancel=*/true); + } if (model_) model_->RemoveObserver(this); @@ -388,6 +395,16 @@ CHECK_EQ(item_list_->item_count(), view_model_.view_size()); } +void AppsGridView::EndDragCallback(const ui::DropTargetEvent& event, + ui::mojom::DragOperation& output_drag_op) { + DCHECK(app_list_features::IsDragAndDropRefactorEnabled()); + output_drag_op = ui::mojom::DragOperation::kMove; + if (drag_view_) { + drag_view_->OnDragEnded(); + } + EndDrag(/*cancel=*/false); +} + void AppsGridView::CancelDragWithNoDropAnimation() { EndDrag(/*cancel=*/true); drag_view_hider_.reset(); @@ -454,6 +471,8 @@ const gfx::Point& root_location, base::OnceClosure drag_start_callback, base::OnceClosure drag_end_callback) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + DCHECK(view); if (drag_item_ || pulsing_blocks_model_.view_size()) return false; @@ -509,6 +528,8 @@ bool AppsGridView::UpdateDragFromItem(bool is_touch, const ui::LocatedEvent& event) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + if (!drag_item_) return false; // Drag canceled. @@ -550,15 +571,21 @@ gfx::Vector2d drag_vector(point - drag_start_grid_view_); - if (ExceededDragThreshold(drag_vector)) { - if (!IsDragging()) - TryStartDragAndDropHostDrag(pointer); + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + if (ExceededDragThreshold(drag_vector)) { + if (!IsDragging()) { + TryStartDragAndDropHostDrag(pointer); + } + MaybeStartCardifiedView(); + } + + if (drag_pointer_ != pointer) { + return; + } + } else { MaybeStartCardifiedView(); } - if (drag_pointer_ != pointer) - return; - last_drag_point_ = point; const GridIndex last_drop_target = drop_target_; DropTargetRegion last_drop_target_region = drop_target_region_; @@ -629,14 +656,19 @@ // The animation direction used for the ideal bounds animation. bool top_to_bottom_animation = reorder_placeholder_ < drop_target_; + bool is_drag_drop_refactor_enabled = + app_list_features::IsDragAndDropRefactorEnabled(); + if (forward_events_to_drag_and_drop_host_) { - DCHECK(!IsDraggingForReparentInRootLevelGridView()); + DCHECK(!IsDraggingForReparentInRootLevelGridView() || + !is_drag_drop_refactor_enabled); forward_events_to_drag_and_drop_host_ = false; // Pass the drag icon proxy on to the drag and drop host, so the drag and // drop host handles the animation to drop the icon proxy into correct spot. drag_and_drop_host_->EndDrag(cancel, std::move(drag_icon_proxy_)); - if (IsDraggingForReparentInHiddenGridView()) { + if (!is_drag_drop_refactor_enabled && + IsDraggingForReparentInHiddenGridView()) { EndDragForReparentInHiddenFolderGridView(); folder_delegate_->DispatchEndDragEventForReparent( true /* events_forwarded_to_drag_drop_host */, @@ -644,7 +676,8 @@ return; } } else { - if (IsDraggingForReparentInHiddenGridView()) { + if (!is_drag_drop_refactor_enabled && + IsDraggingForReparentInHiddenGridView()) { EndDragForReparentInHiddenFolderGridView(); // Forward the EndDrag event to the root level grid view. folder_delegate_->DispatchEndDragEventForReparent( @@ -656,9 +689,13 @@ if (IsDraggingForReparentInRootLevelGridView()) { // An EndDrag can be received during a reparent via a model change. This // is always a cancel and needs to be forwarded to the folder. - DCHECK(cancel); - if (reparent_drag_cancellation_) - std::move(reparent_drag_cancellation_).Run(); + if (cancel) { + if (reparent_drag_cancellation_) { + std::move(reparent_drag_cancellation_).Run(); + } + } else { + EndDragFromReparentItemInRootLevel(nullptr, false, false, nullptr); + } return; } @@ -760,6 +797,8 @@ AppListItemView* original_drag_view, const gfx::Point& drag_point, base::OnceClosure cancellation_callback) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + DVLOG(1) << __FUNCTION__; DCHECK(original_drag_view && !drag_view_); DCHECK(!dragging_for_reparent_item_); @@ -985,16 +1024,103 @@ bool AppsGridView::GetDropFormats( int* formats, std::set<ui::ClipboardFormatType>* format_types) { - // TODO(koz): Only accept a specific drag type for app shortcuts. - *formats = OSExchangeData::FILE_NAME; + if (app_list_features::IsDragAndDropRefactorEnabled()) { + format_types->insert(GetAppItemFormatType()); + } return true; } bool AppsGridView::CanDrop(const OSExchangeData& data) { - return true; + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + return true; + } + + // Ignore drop events if the app list is syncing. + if (pulsing_blocks_model_.view_size()) { + return false; + } + + return data.HasCustomFormat(GetAppItemFormatType()); +} + +void AppsGridView::OnDragExited() { + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + views::View::OnDragExited(); + return; + } + + // TODO(b/261985897): Consider removing the direct call to OnDragEnded. + if (drag_view_) { + drag_view_->OnDragEnded(); + } + + // When the drag and drop host is a folder apps grid, close the folder when + // drag exits folder grid bounds. + // TODO(b/261985897): Add timer to close folder bounds. + if (folder_delegate_) { + folder_delegate_->Close(); + } +} + +void AppsGridView::OnDragEntered(const ui::DropTargetEvent& event) { + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + views::View::OnDragEntered(event); + return; + } + + // Ignore drag events if the app list is syncing. + if (pulsing_blocks_model_.view_size()) { + return; + } + + DCHECK(!drag_item_); + + std::string drag_item_id; + + base::Pickle data_pickle; + if (!event.data().GetPickledData(GetAppItemFormatType(), &data_pickle)) { + return; + } + + base::PickleIterator iter(data_pickle); + if (!iter.ReadString(&drag_item_id)) { + return; + } + + drag_item_ = AppListModelProvider::Get()->model()->FindItem(drag_item_id); + if (!drag_item_) { + return; + } + + // Finalize previous drag icon animation if it's still in progress. + drag_view_hider_.reset(); + folder_icon_item_hider_.reset(); + folder_to_open_after_drag_icon_animation_.clear(); + drag_icon_proxy_.reset(); + + PrepareItemsForBoundsAnimation(); + + drag_pointer_ = MOUSE; + drag_view_ = GetItemViewAt(GetModelIndexOfItem(drag_item_)); + if (drag_view_) { + drag_view_hider_ = std::make_unique<DragViewHider>(drag_view_); + // Dragged view should have focus. This also fixed the issue + // https://crbug.com/834682. + drag_view_->RequestFocus(); + drag_view_init_index_ = GetIndexOfView(drag_view_); + } else { + dragging_for_reparent_item_ = true; + } + reorder_placeholder_ = + drag_view_ ? drag_view_init_index_ + : GetGridIndexFromIndexInViewModel(view_model()->view_size()); + ExtractDragLocation(event.root_location(), &drag_start_grid_view_); } int AppsGridView::OnDragUpdated(const ui::DropTargetEvent& event) { + if (app_list_features::IsDragAndDropRefactorEnabled()) { + UpdateDrag(MOUSE, event.location()); + } return ui::DragDropTypes::DRAG_MOVE; } @@ -1003,6 +1129,14 @@ app_list_state == AppListViewState::kFullscreenSearch); } +views::View::DropCallback AppsGridView::GetDropCallback( + const ui::DropTargetEvent& event) { + return app_list_features::IsDragAndDropRefactorEnabled() + ? base::BindOnce(&AppsGridView::EndDragCallback, + base::Unretained(this)) + : base::DoNothing(); +} + bool AppsGridView::OnKeyPressed(const ui::KeyEvent& event) { // The user may press VKEY_CONTROL before an arrow key when intending to do an // app move with control+arrow. @@ -1710,7 +1844,9 @@ void AppsGridView::OnFolderItemReparentTimer(Pointer pointer) { DCHECK(folder_delegate_); if (drag_out_of_folder_container_ && drag_view_) { - folder_delegate_->ReparentItem(pointer, drag_view_, last_drag_point_); + if (!app_list_features::IsDragAndDropRefactorEnabled()) { + folder_delegate_->ReparentItem(pointer, drag_view_, last_drag_point_); + } // Set the flag in the folder's grid view. dragging_for_reparent_item_ = true; @@ -1726,7 +1862,8 @@ if (IsUnderOEMFolder()) return; - if (IsDraggingForReparentInHiddenGridView()) { + if (!app_list_features::IsDragAndDropRefactorEnabled() && + IsDraggingForReparentInHiddenGridView()) { // Dispatch drag event to root level grid view for re-parenting folder // folder item purpose. DispatchDragEventForReparent(pointer, drag_point); @@ -1930,6 +2067,7 @@ void AppsGridView::DispatchDragEventForReparent(Pointer pointer, const gfx::Point& drag_point) { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); folder_delegate_->DispatchDragEventForReparent(pointer, drag_point); } @@ -1939,7 +2077,6 @@ bool cancel_drag, std::unique_ptr<AppDragIconProxy> drag_icon_proxy) { DCHECK(!IsInFolder()); - DCHECK(view_model_.GetIndexOfView(original_parent_item_view).has_value()); // EndDrag was called before if |drag_view_| is nullptr. if (!drag_item_) @@ -1960,7 +2097,9 @@ // Cache the original item folder id, as model updates may destroy the // original folder item. const std::string original_folder_id = - original_parent_item_view->item()->id(); + app_list_features::IsDragAndDropRefactorEnabled() + ? drag_item_->id() + : original_parent_item_view->item()->id(); if (!events_forwarded_to_drag_drop_host && !cancel_reparent) { UpdateDropTargetRegion(); @@ -2028,6 +2167,8 @@ } void AppsGridView::EndDragForReparentInHiddenFolderGridView() { + DCHECK(!app_list_features::IsDragAndDropRefactorEnabled()); + SetAsFolderDroppingTarget(drop_target_, false); ClearDragState(); @@ -2290,6 +2431,11 @@ } bool AppsGridView::FireFolderItemReparentTimerForTest() { + // With the drag and drop refactor, folder is closed immediately OnDragExit + // without timer. For testing purpuses, return true on this case. + if (app_list_features::IsDragAndDropRefactorEnabled()) { + return true; + } if (!folder_item_reparent_timer_.IsRunning()) return false; folder_item_reparent_timer_.FireNow();
diff --git a/ash/app_list/views/apps_grid_view.h b/ash/app_list/views/apps_grid_view.h index 14c0a078..89528d4 100644 --- a/ash/app_list/views/apps_grid_view.h +++ b/ash/app_list/views/apps_grid_view.h
@@ -175,6 +175,9 @@ std::set<ui::ClipboardFormatType>* format_types) override; bool CanDrop(const OSExchangeData& data) override; int OnDragUpdated(const ui::DropTargetEvent& event) override; + void OnDragEntered(const ui::DropTargetEvent& event) override; + void OnDragExited() override; + DropCallback GetDropCallback(const ui::DropTargetEvent& event) override; // Updates the visibility of app list items according to |app_list_state|. void UpdateControlVisibility(AppListViewState app_list_state); @@ -925,6 +928,10 @@ // Called when ideal bounds animations complete. void OnIdealBoundsAnimationDone(); + // Callback method to clean up the dragging state of the app list. + void EndDragCallback(const ui::DropTargetEvent& event, + ui::mojom::DragOperation& output_drag_op); + class ScopedModelUpdate; AppListModel* model_ = nullptr; // Owned by AppListView.
diff --git a/ash/app_list/views/apps_grid_view_folder_delegate.h b/ash/app_list/views/apps_grid_view_folder_delegate.h index 2fecdd1..761950d 100644 --- a/ash/app_list/views/apps_grid_view_folder_delegate.h +++ b/ash/app_list/views/apps_grid_view_folder_delegate.h
@@ -49,6 +49,9 @@ bool cancel_drag, std::unique_ptr<AppDragIconProxy> drag_icon_proxy) = 0; + // Close the associated folder and goes back to top level page grid. + virtual void Close() = 0; + // Returns whether |drag_point| in the folder apps grid bounds is within the // folder view's bounds. virtual bool IsDragPointOutsideOfFolder(const gfx::Point& drag_point) = 0;
diff --git a/ash/app_list/views/apps_grid_view_unittest.cc b/ash/app_list/views/apps_grid_view_unittest.cc index a61e738..ddd9660ca 100644 --- a/ash/app_list/views/apps_grid_view_unittest.cc +++ b/ash/app_list/views/apps_grid_view_unittest.cc
@@ -40,9 +40,11 @@ #include "ash/app_list/views/search_box_view.h" #include "ash/app_menu/app_menu_model_adapter.h" #include "ash/constants/ash_features.h" +#include "ash/drag_drop/drag_drop_controller.h" #include "ash/keyboard/ui/keyboard_ui_controller.h" #include "ash/keyboard/ui/test/keyboard_test_util.h" #include "ash/public/cpp/app_list/app_list_config.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/pagination/pagination_model.h" #include "ash/public/cpp/shelf_item_delegate.h" #include "ash/public/cpp/shelf_model.h" @@ -67,6 +69,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/client/drag_drop_client.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h" #include "ui/compositor/presentation_time_recorder.h" @@ -287,7 +290,17 @@ void SetUp() override { if (is_rtl_) base::i18n::SetICUDefaultLocale("he"); + auto enabled_features = std::vector<base::test::FeatureRef>(); + if (use_drag_drop_refactor_) { + enabled_features.push_back(app_list_features::kDragAndDropRefactor); + } + if (enable_shelf_party_) { + enabled_features.push_back(features::kShelfParty); + } + + scoped_feature_list_.InitWithFeatures(enabled_features, + /*disabled_features*/ {}); AshTestBase::SetUp(); // Make the display big enough to hold the app list. @@ -446,6 +459,8 @@ return app_list_folder_view_; } + bool use_drag_drop_refactor() const { return use_drag_drop_refactor_; } + AppsGridView* folder_apps_grid_view() const { return app_list_folder_view_->items_grid_view(); } @@ -561,11 +576,15 @@ if (pointer == AppsGridView::TOUCH) { generator->MoveTouch(from); generator->PressTouch(); - view->FireTouchDragTimerForTest(); + if (!use_drag_drop_refactor_) { + view->FireTouchDragTimerForTest(); + } } else { generator->MoveMouseTo(from); generator->PressLeftButton(); - view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor_) { + view->FireMouseDragTimerForTest(); + } } current_drag_location_ = from; @@ -573,18 +592,28 @@ // the cardified state starts only once the drag distance exceeds a drag // threshold, so the pointer has to sufficiently move from the original // position. + // Move in steps, because the drag and drop controller notifies the drop + // target OnDragUpdate(). current_drag_location_ = from + gfx::Vector2d(10, 10); - UpdateDragInScreen(pointer, from + gfx::Vector2d(10, 10)); + UpdateDragInScreen(pointer, current_drag_location_.value(), 2); return view; } void UpdateDragInScreen(AppsGridView::Pointer pointer, - const gfx::Point& to_in_screen) { - auto* generator = GetEventGenerator(); - if (pointer == AppsGridView::TOUCH) - generator->MoveTouch(to_in_screen); - else - generator->MoveMouseTo(to_in_screen); + const gfx::Point& to_in_screen, + int steps = 1) { + for (int step = 1; step <= steps; step += 1) { + gfx::Point drag_increment_point(*current_drag_location_); + drag_increment_point += gfx::Vector2d( + (to_in_screen.x() - current_drag_location_->x()) * step / steps, + (to_in_screen.y() - current_drag_location_->y()) * step / steps); + auto* generator = GetEventGenerator(); + if (pointer == AppsGridView::TOUCH) { + generator->MoveTouch(drag_increment_point); + } else { + generator->MoveMouseTo(drag_increment_point); + } + } } // Updates the drag from the current drag location to the destination point @@ -600,13 +629,7 @@ gfx::Point to_in_screen(to); views::View::ConvertPointToScreen(apps_grid_view, &to_in_screen); - for (int step = 1; step <= steps; step += 1) { - gfx::Point drag_increment_point(*current_drag_location_); - drag_increment_point += gfx::Vector2d( - (to_in_screen.x() - current_drag_location_->x()) * step / steps, - (to_in_screen.y() - current_drag_location_->y()) * step / steps); - UpdateDragInScreen(pointer, drag_increment_point); - } + UpdateDragInScreen(pointer, to_in_screen, steps); current_drag_location_ = to_in_screen; } @@ -696,6 +719,10 @@ bool is_rtl_ = false; // True if we set the test on tablet mode. bool create_as_tablet_mode_ = false; + // True to test with the drag and drop refactor feature enabled. + bool use_drag_drop_refactor_ = false; + // True shelf part feature is enabled. + bool enable_shelf_party_ = true; std::unique_ptr<PageFlipWaiter> page_flip_waiter_; @@ -707,6 +734,7 @@ // Used to track haptics events sent during drag. std::unique_ptr<HapticsTrackingTestInputController> haptics_tracker_; + base::test::ScopedFeatureList scoped_feature_list_; }; // Tests suite to test both tablet and clamshell mode behavior. @@ -720,17 +748,22 @@ AppsGridViewClamshellAndTabletTest, testing::Bool()); -// Tests suite for app list items drag and drop tests. These tests are -// parameterized by RTL locale. -class AppsGridViewDragTest : public AppsGridViewTest, - public testing::WithParamInterface<bool> { +class AppsGridViewDragTestBase : public AppsGridViewTest { public: - AppsGridViewDragTest() { is_rtl_ = GetParam(); } + AppsGridViewDragTestBase() = default; // AppsGridViewTest: void SetUp() override { AppsGridViewTest::SetUp(); ShelfModel::Get()->SetShelfItemFactory(&shelf_item_factory_); + // Disable nested loops to avoid blocking during drag and drop sequences. + if (use_drag_drop_refactor_) { + auto* drag_drop_controller = static_cast<DragDropController*>( + aura::client::GetDragDropClient(apps_grid_view_->GetWidget() + ->GetNativeWindow() + ->GetRootWindow())); + drag_drop_controller->SetDisableNestedLoopForTesting(true); + } } void TearDown() override { @@ -743,21 +776,39 @@ ShelfItemFactoryFake shelf_item_factory_; }; -INSTANTIATE_TEST_SUITE_P(All, AppsGridViewDragTest, testing::Bool()); - -class AppsGridViewDragWithShelfPartyTest : public AppsGridViewDragTest { +// Tests suite for app list items drag and drop tests. These tests are +// parameterized by RTL locale and drag and drop implementation. +class AppsGridViewDragTest + : public AppsGridViewDragTestBase, + public testing::WithParamInterface<std::tuple<bool, bool>> { public: - AppsGridViewDragWithShelfPartyTest() { - scoped_feature_list_.InitAndEnableFeature(features::kShelfParty); + AppsGridViewDragTest() { + is_rtl_ = std::get<0>(GetParam()); + use_drag_drop_refactor_ = std::get<1>(GetParam()); } +}; + +INSTANTIATE_TEST_SUITE_P(All, + AppsGridViewDragTest, + testing::Combine(testing::Bool(), testing::Bool())); + +// Tests for legacy behaviour using the old drag and drop code. +class AppsGridViewDragLegacyTest : public AppsGridViewDragTestBase, + public testing::WithParamInterface<bool> { + public: + AppsGridViewDragLegacyTest() { is_rtl_ = GetParam(); } +}; + +INSTANTIATE_TEST_SUITE_P(All, AppsGridViewDragLegacyTest, testing::Bool()); + +class AppsGridViewDragWithShelfPartyTest : public AppsGridViewDragLegacyTest { + public: + AppsGridViewDragWithShelfPartyTest() { enable_shelf_party_ = true; } AppsGridViewDragWithShelfPartyTest( const AppsGridViewDragWithShelfPartyTest&) = delete; AppsGridViewDragWithShelfPartyTest& operator=( const AppsGridViewDragWithShelfPartyTest&) = delete; ~AppsGridViewDragWithShelfPartyTest() override = default; - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_SUITE_P(All, @@ -966,7 +1017,9 @@ generator->MoveMouseTo( dragged_item_view->GetIconBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - dragged_item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_item_view->FireMouseDragTimerForTest(); + } ui::ScopedAnimationDurationScaleMode non_zero_duration_mode( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); @@ -1562,7 +1615,8 @@ EXPECT_FALSE(GetItemViewInTopLevelGrid(i)->layer()); } -TEST_P(AppsGridViewDragTest, AppAndFolderIconProxyShouldHaveSameShadowSizes) { +TEST_P(AppsGridViewDragLegacyTest, + AppAndFolderIconProxyShouldHaveSameShadowSizes) { model_->CreateAndPopulateFolderWithApps(2); model_->PopulateApps(1); UpdateLayout(); @@ -1589,7 +1643,6 @@ TEST_P(AppsGridViewDragTest, DismissWhileDraggingDoesNotCrash) { model_->PopulateApps(2); UpdateLayout(); - AppListItemView* const item_view = GetItemViewInTopLevelGrid(1); // Non-zero animation durations are necessary to make sure we don't miss // crashes involving animation delegates. Specifically, `bounds_animator_` had @@ -1597,19 +1650,20 @@ ui::ScopedAnimationDurationScaleMode non_zero_duration_mode( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); - GetEventGenerator()->MoveMouseTo( - item_view->GetBoundsInScreen().CenterPoint()); - GetEventGenerator()->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); - GetEventGenerator()->MoveMouseBy(20, 20); - EXPECT_EQ(1, GetHapticTickEventsCount()); + AppListItemView* const item_view = InitiateDragForItemAtCurrentPageAt( + AppsGridView::MOUSE, 0, 1, apps_grid_view_); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ASSERT_TRUE(apps_grid_view_->drag_item()); ASSERT_TRUE(apps_grid_view_->IsDragging()); ASSERT_EQ(item_view->item(), apps_grid_view_->drag_item()); GetAppListTestHelper()->Dismiss(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // No crash } @@ -1618,28 +1672,26 @@ test_api_->Update(); test_api_->PressItemAt(0); - AppListItemView* const item_view = - GetItemViewInAppsGridAt(1, folder_apps_grid_view()); - // Non-zero animation durations are necessary to make sure we don't miss // crashes involving animation delegates. Specifically, `bounds_animator_` had // a use after free problem in the past. ui::ScopedAnimationDurationScaleMode non_zero_duration_mode( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); - GetEventGenerator()->MoveMouseTo( - item_view->GetBoundsInScreen().CenterPoint()); - GetEventGenerator()->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); - GetEventGenerator()->MoveMouseBy(20, 20); - EXPECT_EQ(1, GetHapticTickEventsCount()); + AppListItemView* const item_view = InitiateDragForItemAtCurrentPageAt( + AppsGridView::MOUSE, 0, 1, folder_apps_grid_view()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ASSERT_TRUE(folder_apps_grid_view()->drag_item()); ASSERT_TRUE(folder_apps_grid_view()->IsDragging()); ASSERT_EQ(item_view->item(), folder_apps_grid_view()->drag_item()); GetAppListTestHelper()->Dismiss(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // No crash } @@ -1649,7 +1701,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_1 over item_0 creates a folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1660,7 +1714,9 @@ EXPECT_TRUE(GetItemViewInTopLevelGrid(i)->layer()); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewDragTest, ItemViewsDontHaveLayerAfterDrag) { @@ -1669,14 +1725,18 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_1 over item_0 creates a folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); EndDrag(); test_api_->WaitForItemMoveAnimationDone(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // The layer should be destroyed after the dragging. for (size_t i = 0; i < model_->top_level_item_list()->item_count(); ++i) @@ -1689,7 +1749,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_1 over item_0 creates a folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1718,7 +1780,9 @@ EXPECT_TRUE(app_list_folder_view_->folder_header_view() ->GetFolderNameViewForTest() ->HasFocus()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewDragTest, MouseDragSecondItemIntoFolder) { @@ -1727,7 +1791,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_2 to the folder adds Item_2 to the folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1750,10 +1816,12 @@ EXPECT_EQ(folder_item->id(), item_2->folder_id()); EXPECT_FALSE(GetAppListTestHelper()->IsInFolderView()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } -TEST_P(AppsGridViewDragTest, DragIconAnimatesAfterDragToFolder) { +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterDragToFolder) { model_->CreateAndPopulateFolderWithApps(2); model_->PopulateApps(1); UpdateLayout(); @@ -1763,7 +1831,9 @@ InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_2 to the folder adds Item_2 to the folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1778,10 +1848,12 @@ ui::LayerAnimationStoppedWaiter animation_waiter; animation_waiter.Wait(drag_icon_layer); EXPECT_FALSE(GetAppListTestHelper()->IsInFolderView()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } -TEST_P(AppsGridViewDragTest, DragIconHiddenImmediatelyWhenGridHides) { +TEST_P(AppsGridViewDragLegacyTest, DragIconHiddenImmediatelyWhenGridHides) { model_->CreateAndPopulateFolderWithApps(2); model_->PopulateApps(1); UpdateLayout(); @@ -1791,7 +1863,9 @@ InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_2 to the folder adds Item_2 to the folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1813,10 +1887,12 @@ EXPECT_FALSE(test_api_->GetDragIconLayer()); EXPECT_FALSE(apps_grid_view_->drag_item()); EXPECT_FALSE(apps_grid_view_->IsDragging()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } -TEST_P(AppsGridViewDragTest, DragIconAnimatesAfterDragToCreateFolder) { +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterDragToCreateFolder) { model_->PopulateApps(3); UpdateLayout(); @@ -1825,7 +1901,9 @@ InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_1 over item_0 creates a folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1840,10 +1918,12 @@ ui::LayerAnimationStoppedWaiter animation_waiter; animation_waiter.Wait(drag_icon_layer); EXPECT_TRUE(GetAppListTestHelper()->IsInFolderView()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } -TEST_P(AppsGridViewDragTest, FolderNotOpenedIfGridHidesDuringIconDrop) { +TEST_P(AppsGridViewDragLegacyTest, FolderNotOpenedIfGridHidesDuringIconDrop) { model_->PopulateApps(3); UpdateLayout(); @@ -1852,7 +1932,9 @@ InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging item_1 over Item_0 creates a folder. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -1879,7 +1961,9 @@ EXPECT_FALSE(test_api_->GetDragIconLayer()); EXPECT_FALSE(helper->IsInFolderView()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } TEST_F(AppsGridViewTest, CheckFolderWithMultipleItemsContents) { @@ -1974,7 +2058,9 @@ // Drag the first folder child out of the folder. AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::MOUSE, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point empty_space = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height() @@ -1993,7 +2079,9 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, folder_apps_grid_view(), 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } AppListItem* item_0 = model_->FindItem("Item 0"); AppListItem* item_1 = model_->FindItem("Item 1"); @@ -2006,7 +2094,7 @@ EXPECT_FALSE(GetAppListTestHelper()->IsInFolderView()); } -TEST_P(AppsGridViewDragTest, DragIconAnimatesAfterDragOutOfFolder) { +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterDragOutOfFolder) { model_->CreateAndPopulateFolderWithApps(5); test_api_->Update(); test_api_->PressItemAt(0); @@ -2017,7 +2105,9 @@ // Drag the first folder child out of the folder. AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::MOUSE, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point empty_space = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height() @@ -2036,14 +2126,16 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, folder_apps_grid_view(), 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ui::Layer* drag_icon_layer = test_api_->GetDragIconLayer(); ASSERT_TRUE(drag_icon_layer); EXPECT_TRUE(drag_icon_layer->GetAnimator()->is_animating()); } -TEST_P(AppsGridViewDragTest, DragIconAnimatesAfterDragToAnotherFolder) { +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterDragToAnotherFolder) { model_->CreateAndPopulateFolderWithApps(5); model_->CreateAndPopulateFolderWithApps(5); test_api_->Update(); @@ -2055,7 +2147,9 @@ // Drag the first folder child out of the folder. AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::MOUSE, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point empty_space = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height() @@ -2073,7 +2167,9 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, folder_apps_grid_view(), 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ui::Layer* drag_icon_layer = test_api_->GetDragIconLayer(); ASSERT_TRUE(drag_icon_layer); @@ -2085,7 +2181,7 @@ EXPECT_FALSE(GetAppListTestHelper()->IsInFolderView()); } -TEST_P(AppsGridViewDragTest, +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterDragThatDeletesOriginalFolder) { model_->PopulateApps(2); model_->CreateSingleItemFolder("folder_id", "item_id"); @@ -2098,7 +2194,9 @@ // Drag the only folder child out of the folder. AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::MOUSE, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point empty_space = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height() @@ -2117,14 +2215,16 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, folder_apps_grid_view(), 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ui::Layer* drag_icon_layer = test_api_->GetDragIconLayer(); ASSERT_TRUE(drag_icon_layer); EXPECT_TRUE(drag_icon_layer->GetAnimator()->is_animating()); } -TEST_P(AppsGridViewDragTest, DragIconAnimatesAfterReorderDrag) { +TEST_P(AppsGridViewDragLegacyTest, DragIconAnimatesAfterReorderDrag) { model_->PopulateApps(3); test_api_->Update(); UpdateLayout(); @@ -2135,11 +2235,15 @@ // Drag the first item to an empty slot in the grid. InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point drop_point = GetItemRectOnCurrentPageAt(0, 3).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, drop_point, apps_grid_view_, 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } ui::Layer* drag_icon_layer = test_api_->GetDragIconLayer(); ASSERT_TRUE(drag_icon_layer); @@ -2157,14 +2261,18 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging one item into the folder, the folder should accept the item. gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); EndDrag(); test_api_->LayoutToIdealBounds(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(1u, model_->top_level_item_list()->item_count()); EXPECT_EQ(folder_item->id(), model_->top_level_item_list()->item_at(0)->id()); @@ -2184,7 +2292,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Dragging the last item over the folder, the folder won't accept the new // item. @@ -2192,7 +2302,9 @@ UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); EndDrag(); test_api_->LayoutToIdealBounds(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); EXPECT_EQ(kMaxItemsInFolder, folder_item->ChildItemCount()); @@ -2210,7 +2322,9 @@ // Drag the new item to the left so that the grid reorders. InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).bottom_left(); to.Offset(0, -1); // Get a point inside the rect. @@ -2224,7 +2338,9 @@ GetItemRectOnCurrentPageAt(0, 1).CenterPoint())); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } // Check that moving items around doesn't allow a drop to happen into a full @@ -2238,22 +2354,23 @@ model_->PopulateAppWithId(kMaxItemsInFolder); UpdateLayout(); // Drag the new item to the left so that the grid reorders. - AppListItemView* dragged_view = InitiateDragForItemAtCurrentPageAt( - AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, + apps_grid_view_); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).bottom_left(); to.Offset(0, -1); // Get a point inside the rect. UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); gfx::Point folder_in_second_slot = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); - gfx::Point translated_destination = gfx::PointAtOffsetFromOrigin( - folder_in_second_slot - dragged_view->origin()); - ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, translated_destination, - folder_in_second_slot, ui::EventTimeForNow(), 0, 0); - apps_grid_view_->UpdateDragFromItem(/*is_touch=*/false, drag_event); + UpdateDrag(AppsGridView::MOUSE, folder_in_second_slot, apps_grid_view_, + 10 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // The item should not have moved into the folder. EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); @@ -2268,7 +2385,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); int half_tile_width = std::abs(GetItemRectOnCurrentPageAt(0, 1).x() - @@ -2283,7 +2402,9 @@ UpdateDrag(AppsGridView::MOUSE, to + drag_vector, apps_grid_view_, 10 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 1"), model_->GetModelContent()); TestAppListItemViewIndice(); @@ -2294,7 +2415,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); int half_tile_width = std::abs(GetItemRectOnCurrentPageAt(0, 1).x() - @@ -2312,7 +2435,9 @@ UpdateDrag(AppsGridView::MOUSE, to + drag_vector, apps_grid_view_, 10 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 1,Item 0"), model_->GetModelContent()); TestAppListItemViewIndice(); @@ -2325,7 +2450,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); int half_tile_width = std::abs(GetItemRectOnCurrentPageAt(0, 1).x() - @@ -2343,7 +2470,9 @@ UpdateDrag(AppsGridView::MOUSE, to + drag_vector, apps_grid_view_, 10 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 2,Item 3,Item 4,Item 5,Item 1,Item 6"), model_->GetModelContent()); @@ -2357,7 +2486,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 1, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(1, 0).CenterPoint(); int half_tile_width = std::abs(GetItemRectOnCurrentPageAt(0, 1).x() - @@ -2376,7 +2507,9 @@ 10 /*steps*/); EndDrag(); test_api_->LayoutToIdealBounds(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 5,Item 1,Item 2,Item 3,Item 4,Item 6"), model_->GetModelContent()); @@ -2390,7 +2523,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); int half_tile_width = std::abs(GetItemRectOnCurrentPageAt(0, 1).x() - @@ -2408,7 +2543,9 @@ UpdateDrag(AppsGridView::MOUSE, to + drag_vector, apps_grid_view_, 10 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 2,Item 3,Item 4,Item 5,Item 6,Item 1"), model_->GetModelContent()); @@ -2424,13 +2561,17 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_); EndDrag(); test_api_->LayoutToIdealBounds(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(2u, model_->top_level_item_list()->item_count()); EXPECT_EQ("Item 2", model_->top_level_item_list()->item_at(0)->id()); @@ -2445,7 +2586,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); @@ -2453,7 +2596,9 @@ // Dismiss the app list to cancel drag. GetAppListTestHelper()->Dismiss(); GetAppListTestHelper()->ShowAppList(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 1"), model_->GetModelContent()); test_api_->LayoutToIdealBounds(); @@ -2466,13 +2611,17 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); model_->DeleteItem(model_->GetItemName(2)); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 1"), model_->GetModelContent()); test_api_->LayoutToIdealBounds(); @@ -2485,13 +2634,17 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point to = GetItemRectOnCurrentPageAt(0, 1).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_, 10 /*steps*/); model_->CreateAndAddItem("Extra"); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(std::string("Item 0,Item 1,Extra"), model_->GetModelContent()); test_api_->LayoutToIdealBounds(); @@ -3342,7 +3495,9 @@ page_flip_waiter_->Reset(); InitiateDragForItemAtCurrentPageAt(AppsGridView::TOUCH, 0, 0, paged_apps_grid_view_); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } gfx::Point apps_grid_bottom_center = gfx::Point(apps_grid_bounds.width() / 2, apps_grid_bounds.bottom() - 1); UpdateDrag(AppsGridView::TOUCH, apps_grid_bottom_center, @@ -3366,7 +3521,9 @@ // End the drag to satisfy checks in AppsGridView destructor. EndDrag(AppsGridView::TOUCH); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewTabletTest, ReparentDragToNewPage) { @@ -3390,7 +3547,9 @@ // Initiate drag. generator->MoveMouseTo(dragged_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - dragged_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); // Drag the item outside the folder bounds. @@ -3471,7 +3630,9 @@ // Initiate drag. generator->MoveMouseTo(dragged_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - dragged_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); // Drag the item outside the folder bounds. @@ -3547,9 +3708,13 @@ // Initiate drag. generator->MoveMouseTo(dragged_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - dragged_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Drag the item to launcher page flip zone, and flip the launcher to the // second page. @@ -3609,7 +3774,9 @@ } EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(1, GetPaginationModel()->selected_page()); EXPECT_EQ(2, GetPaginationModel()->total_pages()); @@ -3648,9 +3815,13 @@ // Initiate drag. generator->MoveMouseTo(dragged_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - dragged_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Drag the item to launcher page flip zone, and flip the launcher to the // second page. @@ -3733,7 +3904,9 @@ } generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_EQ(1, GetPaginationModel()->selected_page()); EXPECT_EQ(2, GetPaginationModel()->total_pages()); @@ -3858,7 +4031,9 @@ page_flip_waiter_->Reset(); InitiateDragForItemAtCurrentPageAt(AppsGridView::TOUCH, 0, 0, paged_apps_grid_view_); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } gfx::Point apps_grid_top_center( paged_apps_grid_view_->GetLocalBounds().width() / 2, 0); UpdateDrag(AppsGridView::TOUCH, apps_grid_top_center, paged_apps_grid_view_, @@ -3882,7 +4057,9 @@ // End the drag to satisfy checks in AppsGridView destructor. EndDrag(AppsGridView::TOUCH); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewDragTest, CancelDragDoesNotReorderItems) { @@ -3895,12 +4072,16 @@ // Starts a mouse drag and then cancels it. InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } const gfx::Point to = GetItemRectOnCurrentPageAt(0, 2).CenterPoint(); UpdateDrag(AppsGridView::MOUSE, to, apps_grid_view_); GetAppListTestHelper()->Dismiss(); GetAppListTestHelper()->ShowAppList(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Model is not changed. EXPECT_EQ(std::string("Item 0,Item 1,Item 2,Item 3"), @@ -4044,7 +4225,7 @@ EXPECT_FALSE(item_view->HasFocus()); } -TEST_P(AppsGridViewDragTest, DragAndPinItemToShelf) { +TEST_P(AppsGridViewDragLegacyTest, DragAndPinItemToShelf) { model_->PopulateApps(2); UpdateLayout(); @@ -4053,9 +4234,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify that item drag has started. ASSERT_TRUE(apps_grid_view_->drag_item()); @@ -4073,10 +4258,12 @@ generator->ReleaseLeftButton(); EXPECT_TRUE(ShelfModel::Get()->IsAppPinned("Item 1")); EXPECT_EQ("Item 1", ShelfModel::Get()->items()[0].id.app_id); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } -TEST_P(AppsGridViewDragTest, DragAndPinNotInitiallyVisibleItemToShelf) { +TEST_P(AppsGridViewDragLegacyTest, DragAndPinNotInitiallyVisibleItemToShelf) { // Add more apps to the root apps grid. model_->PopulateApps(50); UpdateLayout(); @@ -4097,9 +4284,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(apps_grid_view_->drag_item()); @@ -4115,23 +4306,23 @@ // Releasing drag over shelf should pin the dragged app. generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_TRUE(ShelfModel::Get()->IsAppPinned("Item 40")); EXPECT_EQ("Item 40", ShelfModel::Get()->items()[0].id.app_id); } -TEST_P(AppsGridViewDragTest, DragItemToAndFromShelf) { +TEST_P(AppsGridViewDragLegacyTest, DragItemToAndFromShelf) { model_->PopulateApps(2); UpdateLayout(); - AppListItemView* const item_view = GetItemViewInTopLevelGrid(1); + AppListItemView* const item_view = InitiateDragForItemAtCurrentPageAt( + AppsGridView::MOUSE, 0, 1, apps_grid_view_); - auto* generator = GetEventGenerator(); - generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); - generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); - generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(apps_grid_view_->drag_item()); @@ -4140,21 +4331,26 @@ // Shelf should start handling the drag if it moves within its bounds. auto* shelf_view = GetPrimaryShelf()->GetShelfViewForTesting(); - generator->MoveMouseTo(shelf_view->GetBoundsInScreen().left_center()); + UpdateDragInScreen(AppsGridView::MOUSE, + shelf_view->GetBoundsInScreen().left_center()); ASSERT_TRUE(apps_grid_view_->FireDragToShelfTimerForTest()); + EXPECT_EQ("Item 1", shelf_view->drag_and_drop_shelf_id().app_id); // Move the app away from shelf, and verify the app doesn't get pinned when // the drag ends. - generator->MoveMouseTo(apps_grid_view_->GetBoundsInScreen().origin()); - generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + UpdateDragInScreen(AppsGridView::MOUSE, + apps_grid_view_->GetBoundsInScreen().origin()); + EndDrag(); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_FALSE(ShelfModel::Get()->IsAppPinned("Item 1")); EXPECT_TRUE(ShelfModel::Get()->items().empty()); } -TEST_P(AppsGridViewDragTest, DragAndPinItemFromFolderToShelf) { +TEST_P(AppsGridViewDragLegacyTest, DragAndPinItemFromFolderToShelf) { // Creates a folder item - the folder size was chosen arbitrarily. model_->CreateAndPopulateFolderWithApps(5); // Add more apps to the root apps grid. @@ -4170,9 +4366,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(folder_apps_grid_view()->drag_item()); @@ -4196,12 +4396,15 @@ // Releasing drag over shelf should pin the dragged app. generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_TRUE(ShelfModel::Get()->IsAppPinned("Item 1")); EXPECT_EQ("Item 1", ShelfModel::Get()->items()[0].id.app_id); } -TEST_P(AppsGridViewDragTest, DragAndPinNotInitiallyVisibleFolderItemToShelf) { +TEST_P(AppsGridViewDragLegacyTest, + DragAndPinNotInitiallyVisibleFolderItemToShelf) { model_->CreateAndPopulateFolderWithApps(kMaxItemsInFolder); UpdateLayout(); @@ -4226,9 +4429,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(folder_apps_grid_view()->drag_item()); @@ -4252,13 +4459,15 @@ // Releasing drag over shelf should pin the dragged app. generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_TRUE(ShelfModel::Get()->IsAppPinned("Item 30")); EXPECT_EQ("Item 30", ShelfModel::Get()->items()[0].id.app_id); } -TEST_P(AppsGridViewDragTest, DragAnItemFromFolderToAndFromShelf) { +TEST_P(AppsGridViewDragLegacyTest, DragAnItemFromFolderToAndFromShelf) { // Creates a folder item - the folder size was chosen arbitrarily. model_->CreateAndPopulateFolderWithApps(5); // Add more apps to the root apps grid. @@ -4274,9 +4483,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(folder_apps_grid_view()->drag_item()); @@ -4302,13 +4515,15 @@ // the drag ends. generator->MoveMouseTo(apps_grid_view_->GetBoundsInScreen().origin()); generator->ReleaseLeftButton(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_FALSE(ShelfModel::Get()->IsAppPinned("Item 1")); EXPECT_TRUE(ShelfModel::Get()->items().empty()); } -TEST_P(AppsGridViewDragTest, RemoveDisplayWhileDraggingItemOntoShelf) { +TEST_P(AppsGridViewDragLegacyTest, RemoveDisplayWhileDraggingItemOntoShelf) { UpdateDisplay("1024x768,1024x768"); model_->PopulateApps(3); @@ -4321,9 +4536,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify that item drag has started. ASSERT_TRUE(apps_grid_view_->drag_item()); @@ -4352,7 +4571,8 @@ EXPECT_TRUE(ShelfModel::Get()->items().empty()); } -TEST_P(AppsGridViewDragTest, RemoveDisplayWhileDraggingFolderItemOntoShelf) { +TEST_P(AppsGridViewDragLegacyTest, + RemoveDisplayWhileDraggingFolderItemOntoShelf) { UpdateDisplay("1024x768,1024x768"); // Creates a folder item - the folder size was chosen arbitrarily. @@ -4373,9 +4593,13 @@ auto* generator = GetEventGenerator(); generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_view->FireMouseDragTimerForTest(); + } generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify app list item drag has started. ASSERT_TRUE(folder_apps_grid_view()->drag_item()); @@ -4420,12 +4644,12 @@ AppListItemView* const item_view = GetItemViewInTopLevelGrid(1); - auto* generator = GetEventGenerator(); - generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); - generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); - generator->MoveMouseBy(10, 10); - EXPECT_EQ(1, GetHapticTickEventsCount()); + InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, + apps_grid_view_); + + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify that item drag has started. ASSERT_TRUE(apps_grid_view_->drag_item()); @@ -4434,16 +4658,19 @@ // Shelf should start handling the drag if it moves within its bounds. auto* shelf_view = GetPrimaryShelf()->GetShelfViewForTesting(); - generator->MoveMouseTo(shelf_view->GetBoundsInScreen().left_center()); + UpdateDragInScreen(AppsGridView::MOUSE, + shelf_view->GetBoundsInScreen().left_center()); ASSERT_TRUE(apps_grid_view_->FireDragToShelfTimerForTest()); EXPECT_EQ("Item 1", shelf_view->drag_and_drop_shelf_id().app_id); // Releasing drag over shelf should pin the dragged app. - generator->ReleaseLeftButton(); + EndDrag(); EXPECT_TRUE(ShelfModel::Get()->IsAppPinned("Item 1")); EXPECT_EQ("Item 1", ShelfModel::Get()->items()[0].id.app_id); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewDragTest, MousePointerIsGrabbingDuringDrag) { @@ -4453,11 +4680,8 @@ // Populate the apps grid and start dragging one of the items. model_->PopulateApps(3); UpdateLayout(); - AppListItemView* const item_view = GetItemViewInTopLevelGrid(1); - auto* generator = GetEventGenerator(); - generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); - generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, + apps_grid_view_); // Ensure the cursor type is set to grabbing during the drag. EXPECT_EQ(ui::mojom::CursorType::kGrabbing, @@ -4465,7 +4689,7 @@ // Release the left mouse button to cancel the drag and verify that the cursor // type is reset. - generator->ReleaseLeftButton(); + EndDrag(); EXPECT_EQ(previous_cursor_type, cursor_manager->GetCursor().type()); } @@ -4476,11 +4700,8 @@ // Populate the apps grid and start dragging one of the items. model_->PopulateApps(3); UpdateLayout(); - AppListItemView* const item_view = GetItemViewInTopLevelGrid(1); - auto* generator = GetEventGenerator(); - generator->MoveMouseTo(item_view->GetBoundsInScreen().CenterPoint()); - generator->PressLeftButton(); - item_view->FireMouseDragTimerForTest(); + InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, + apps_grid_view_); // The cursor type should be set to grabbing during the drag. ASSERT_EQ(ui::mojom::CursorType::kGrabbing, @@ -4488,7 +4709,7 @@ // Cancel the drag without releasing the left mouse button and verify that the // cursor is still reset in this case. - generator->PressAndReleaseKey(ui::VKEY_ESCAPE); + GetEventGenerator()->PressAndReleaseKey(ui::VKEY_ESCAPE); EXPECT_EQ(previous_cursor_type, cursor_manager->GetCursor().type()); } @@ -4502,10 +4723,9 @@ AppListItemView* const item0 = GetItemViewInTopLevelGrid(0); gfx::Point starting_point = item0->GetBoundsInScreen().CenterPoint(); AppListItemView* const item1 = GetItemViewInTopLevelGrid(1); - auto* generator = GetEventGenerator(); - generator->MoveMouseTo(starting_point); - generator->PressLeftButton(); - item0->FireMouseDragTimerForTest(); + + InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 0, + apps_grid_view_); // Verify the cursor is grabbing now that the drag has started. ASSERT_EQ(ui::mojom::CursorType::kGrabbing, @@ -4513,14 +4733,15 @@ // Move the first item on top of the second item as if to create a folder, but // don't actually create a folder. - generator->MoveMouseTo(item1->GetBoundsInScreen().CenterPoint()); + UpdateDragInScreen(AppsGridView::MOUSE, + item1->GetBoundsInScreen().CenterPoint()); // Verify the cursor is still grabbing in this state. ASSERT_EQ(ui::mojom::CursorType::kGrabbing, cursor_manager->GetCursor().type()); // Move the first item back to its original position. - generator->MoveMouseTo(starting_point); + UpdateDragInScreen(AppsGridView::MOUSE, starting_point); // The cursor should still be grabbing. EXPECT_EQ(ui::mojom::CursorType::kGrabbing, @@ -4881,7 +5102,9 @@ GetPaginationModel()->SelectPage(1, false); InitiateDragForItemAtCurrentPageAt(AppsGridView::MOUSE, 0, 1, apps_grid_view_); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Rect tile_rect = test_api_->GetItemTileRectAtVisualIndex(0, 0); gfx::Point to_in_previous_page = @@ -4905,7 +5128,9 @@ EXPECT_EQ("Item " + base::NumberToString((i + kApps - 1) % kApps), view_model->view_at(i)->item()->id()); } - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } } // Test that the background cards remain stacked as the bottom layer during @@ -5133,7 +5358,9 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, apps_grid_view_, /*steps=*/5); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } // Verify that the dragged item was dropped into the last slot in the grid, // and that it's within the visible apps grid bounds. @@ -5158,7 +5385,9 @@ AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::MOUSE, 0, 0, folder_apps_grid_view()); ASSERT_EQ("Item 0", drag_view->item()->id()); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } gfx::Point point_outside_folder = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height()); @@ -5182,7 +5411,9 @@ UpdateDrag(AppsGridView::MOUSE, drop_point, folder_apps_grid_view(), 5 /*steps*/); EndDrag(); - EXPECT_EQ(1, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(1, GetHapticTickEventsCount()); + } EXPECT_FALSE(GetAppListTestHelper()->IsInFolderView()); // Verify that the dragged item was dropped into the last slot in the grid, @@ -5204,12 +5435,16 @@ InitiateDragForItemAtCurrentPageAt(AppsGridView::TOUCH, 0, 0, paged_apps_grid_view_); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } EXPECT_TRUE(paged_apps_grid_view_->cardified_state_for_testing()); EndDrag(AppsGridView::TOUCH); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } EXPECT_FALSE(paged_apps_grid_view_->cardified_state_for_testing()); } @@ -5227,7 +5462,9 @@ // Drag the first folder child within the folder. InitiateDragForItemAtCurrentPageAt(AppsGridView::TOUCH, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } const gfx::Point to = folder_grid_test_api.GetItemTileRectOnCurrentPageAt(0, 1).CenterPoint(); UpdateDrag(AppsGridView::TOUCH, to, folder_apps_grid_view(), 10 /*steps*/); @@ -5237,7 +5474,9 @@ EXPECT_FALSE(paged_apps_grid_view_->cardified_state_for_testing()); EndDrag(); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } } TEST_P(AppsGridViewTabletTest, DragOutsideFolderEntersCardifiedState) { @@ -5252,7 +5491,9 @@ // Drag the first folder child out of the folder. AppListItemView* drag_view = InitiateDragForItemAtCurrentPageAt( AppsGridView::TOUCH, 0, 0, folder_apps_grid_view()); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } const gfx::Point to = app_list_folder_view()->GetLocalBounds().bottom_center() + gfx::Vector2d(0, drag_view->height() @@ -5265,7 +5506,9 @@ EXPECT_TRUE(paged_apps_grid_view_->cardified_state_for_testing()); EndDrag(AppsGridView::TOUCH); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } EXPECT_FALSE(paged_apps_grid_view_->cardified_state_for_testing()); } @@ -5278,7 +5521,9 @@ UpdateLayout(); InitiateDragForItemAtCurrentPageAt(AppsGridView::TOUCH, 0, 1, paged_apps_grid_view_); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } // Dragging item_1 over folder to expand it. const gfx::Point to = GetItemRectOnCurrentPageAt(0, 0).CenterPoint(); @@ -5287,7 +5532,9 @@ EXPECT_TRUE(paged_apps_grid_view_->cardified_state_for_testing()); EndDrag(AppsGridView::TOUCH); - EXPECT_EQ(0, GetHapticTickEventsCount()); + if (!use_drag_drop_refactor()) { + EXPECT_EQ(0, GetHapticTickEventsCount()); + } EXPECT_FALSE(paged_apps_grid_view_->cardified_state_for_testing()); test_api_->WaitForItemMoveAnimationDone(); test_api_->LayoutToIdealBounds(); @@ -5773,7 +6020,9 @@ GetEventGenerator()->MoveMouseTo( item_in_folder->GetBoundsInScreen().CenterPoint()); GetEventGenerator()->PressLeftButton(); - item_in_folder->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + item_in_folder->FireMouseDragTimerForTest(); + } // Drag item outside of the folder, to slot 0. const gfx::Point to = @@ -5814,7 +6063,9 @@ GetEventGenerator()->MoveMouseTo( dragged_item->GetBoundsInScreen().CenterPoint()); GetEventGenerator()->PressLeftButton(); - dragged_item->FireMouseDragTimerForTest(); + if (!use_drag_drop_refactor()) { + dragged_item->FireMouseDragTimerForTest(); + } GetEventGenerator()->MoveMouseBy(10, 10); // Wait for layer animations before the drag to trigger drag reorder
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 084cfe4..cbdb3a48 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -3809,6 +3809,26 @@ <ph name="MODIFIER_ONE">$1<ex>shift</ex></ph> <ph name="MODIFIER_TWO">$2<ex>alt</ex></ph> <ph name="KEY_ONE">$3<ex>i</ex></ph> then <ph name="KEY_TWO">$4<ex>esc</ex></ph> </message> + <!-- Six-Pack Keys --> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_DELETE_DESCRIPTION" translateable="false" desc="Label for the delete six-pack-key."> + Delete + </message> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_HOME_DESCRIPTION" translateable="false" desc="Label for the home six-pack-key."> + Home + </message> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_PAGE_UP_DESCRIPTION" translateable="false" desc="Label for the page up six-pack-key."> + PageUp + </message> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_END_DESCRIPTION" translateable="false" desc="Label for the end six-pack-key."> + End + </message> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_PAGE_DOWN_DESCRIPTION" translateable="false" desc="Label for the page down six-pack-key."> + PageDown + </message> + <message name="IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_INSERT_DESCRIPTION" translateable="false" desc="Label for the insert six-pack-key."> + Insert + </message> + <!-- Tray scale strings --> <message name="IDS_ASH_STATUS_TRAY_SCALE" desc="The label used in scale setting detailed page of ash tray popup."> Display scale settings
diff --git a/ash/capture_mode/capture_mode_test_util.cc b/ash/capture_mode/capture_mode_test_util.cc index df38fc22..b9e2c52 100644 --- a/ash/capture_mode/capture_mode_test_util.cc +++ b/ash/capture_mode/capture_mode_test_util.cc
@@ -206,8 +206,10 @@ auto* projector_controller = ProjectorController::Get(); projector_controller->SetClient(&projector_client_); ON_CALL(projector_client_, StopSpeechRecognition) - .WillByDefault(testing::Invoke( - []() { ProjectorController::Get()->OnSpeechRecognitionStopped(); })); + .WillByDefault(testing::Invoke([]() { + ProjectorController::Get()->OnSpeechRecognitionStopped( + /*forced=*/false); + })); // Simulate the availability of speech recognition. SpeechRecognitionAvailability availability;
diff --git a/ash/capture_mode/capture_mode_util.cc b/ash/capture_mode/capture_mode_util.cc index 9bc377db..8416316 100644 --- a/ash/capture_mode/capture_mode_util.cc +++ b/ash/capture_mode/capture_mode_util.cc
@@ -26,7 +26,7 @@ #include "base/task/single_thread_task_runner.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/image_model.h" -#include "ui/chromeos/events/keyboard_layout_util.h" +#include "ui/chromeos/events/keyboard_capability.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" @@ -278,8 +278,9 @@ views::BoxLayout::Orientation::kHorizontal)); const std::u16string shortcut_key = l10n_util::GetStringUTF16( - ui::DeviceUsesKeyboardLayout2() ? IDS_ASH_SHORTCUT_MODIFIER_LAUNCHER - : IDS_ASH_SHORTCUT_MODIFIER_SEARCH); + Shell::Get()->keyboard_capability()->HasLauncherButton() + ? IDS_ASH_SHORTCUT_MODIFIER_LAUNCHER + : IDS_ASH_SHORTCUT_MODIFIER_SEARCH); const std::u16string label_text = l10n_util::GetStringFUTF16( IDS_ASH_MULTIPASTE_SCREENSHOT_NOTIFICATION_NUDGE, shortcut_key);
diff --git a/ash/projector/projector_controller_impl.cc b/ash/projector/projector_controller_impl.cc index 12a91617d..f51d4c64 100644 --- a/ash/projector/projector_controller_impl.cc +++ b/ash/projector/projector_controller_impl.cc
@@ -38,6 +38,8 @@ namespace { +constexpr base::TimeDelta kForceEndRecognitionSessionTimer = base::Seconds(90); + // Create directory. Returns true if saving succeeded, or false otherwise. bool CreateDirectory(const base::FilePath& path) { DCHECK(!base::CurrentUIThread::IsSet()); @@ -235,16 +237,20 @@ } void ProjectorControllerImpl::OnTranscriptionError() { - is_speech_recognition_on_ = false; + force_stop_recognition_timer_.AbandonAndStop(); // TODO(b/261093550) Investigate the real reason why // we get a speech recognition error after we notify it to // stop. - if (!pending_speech_recognition_stop_) { + if (speech_recognition_state_ != + SpeechRecognitionState::kRecognitionStopping) { ProjectorUiController::ShowFailureNotification( IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION); } + speech_recognition_state_ = SpeechRecognitionState::kRecognitionError; + metadata_controller_->SetSpeechRecognitionStatus(RecognitionStatus::kError); + auto* capture_mode_controller = CaptureModeController::Get(); if (capture_mode_controller->is_recording_in_progress()) { capture_mode_controller->EndVideoRecording( @@ -252,15 +258,18 @@ } else { MaybeWrapUpRecording(); } - - pending_speech_recognition_stop_ = false; } -void ProjectorControllerImpl::OnSpeechRecognitionStopped() { - is_speech_recognition_on_ = false; - pending_speech_recognition_stop_ = false; +void ProjectorControllerImpl::OnSpeechRecognitionStopped(bool forced) { + speech_recognition_state_ = SpeechRecognitionState::kRecognitionNotStarted; + + const auto metadata_recognition_status = + forced ? RecognitionStatus::kIncomplete : RecognitionStatus::kComplete; + metadata_controller_->SetSpeechRecognitionStatus(metadata_recognition_status); + // Try to wrap up recording. This can be no-op if DLP check is not completed. MaybeWrapUpRecording(); + force_stop_recognition_timer_.AbandonAndStop(); } NewScreencastPrecondition @@ -400,8 +409,7 @@ SaveThumbnailFile(thumbnail); } - // Try to wrap up recording. This can be no-op if speech recognition is not - // completely stopped. + // Try to wrap up recording. MaybeWrapUpRecording(); // At this point, the screencast might not synced to Drive yet. Open @@ -498,24 +506,48 @@ return; DCHECK(client_->GetSpeechRecognitionAvailability().IsAvailable()); + DCHECK(speech_recognition_state_ != + SpeechRecognitionState::kRecognitionStarted); - DCHECK(!is_speech_recognition_on_); client_->StartSpeechRecognition(); - is_speech_recognition_on_ = true; - pending_speech_recognition_stop_ = false; + speech_recognition_state_ = SpeechRecognitionState::kRecognitionStarted; } void ProjectorControllerImpl::MaybeStopSpeechRecognition() { if (ProjectorController::AreExtendedProjectorFeaturesDisabled() || - !is_speech_recognition_on_ || !client_) { - OnSpeechRecognitionStopped(); + speech_recognition_state_ == + SpeechRecognitionState::kRecognitionNotStarted || + !client_) { + OnSpeechRecognitionStopped(/*forced=*/false); return; } DCHECK(client_->GetSpeechRecognitionAvailability().IsAvailable()); + // We are already stopping. + if (speech_recognition_state_ == + SpeechRecognitionState::kRecognitionStopping) { + return; + } + + speech_recognition_state_ = SpeechRecognitionState::kRecognitionStopping; client_->StopSpeechRecognition(); - pending_speech_recognition_stop_ = true; + + force_stop_recognition_timer_.Start( + FROM_HERE, kForceEndRecognitionSessionTimer, + base::BindOnce(&ProjectorControllerImpl::ForceEndSpeechRecognition, + weak_factory_.GetWeakPtr())); +} + +void ProjectorControllerImpl::ForceEndSpeechRecognition() { + if (!client_) { + return; + } + + DCHECK_EQ(speech_recognition_state_, + SpeechRecognitionState::kRecognitionStopping); + + client_->ForceEndSpeechRecognition(); } void ProjectorControllerImpl::OnContainerFolderCreated( @@ -547,11 +579,17 @@ } void ProjectorControllerImpl::MaybeWrapUpRecording() { - // Only wrap up the recording if speech recognition session and DLP check are - // completed. - if (is_speech_recognition_on_ || !dlp_restriction_checked_completed_) + // Speech recognition could stopped before DLP check is completed, only wrap + // up the recording if DLP check is completed. + if (!dlp_restriction_checked_completed_) { return; + } + // We reach this stage in the following scenarios: + // 1. Recording has stopped but speech recognition is not yet complete. + // 2. Both recording and speech recognition have completed. + // In both cases, we save the screencast. However, we will end the session + // when both speech recognition and recording have completed. if (!user_deleted_video_file_ && projector_session_->screencast_container_path().has_value()) { // Finish saving the screencast if the container is available. The container @@ -560,7 +598,13 @@ SaveScreencast(); } - projector_session_->Stop(); + if ((speech_recognition_state_ == + SpeechRecognitionState::kRecognitionNotStarted || + speech_recognition_state_ == + SpeechRecognitionState::kRecognitionError) && + projector_session_->is_active()) { + projector_session_->Stop(); + } } void ProjectorControllerImpl::SaveThumbnailFile(
diff --git a/ash/projector/projector_controller_impl.h b/ash/projector/projector_controller_impl.h index d93587c0..1c4af5d0 100644 --- a/ash/projector/projector_controller_impl.h +++ b/ash/projector/projector_controller_impl.h
@@ -11,6 +11,7 @@ #include "ash/ash_export.h" #include "ash/projector/model/projector_session_impl.h" #include "ash/public/cpp/projector/projector_controller.h" +#include "base/timer/timer.h" #include "chromeos/ash/components/audio/cras_audio_handler.h" #include "third_party/skia/include/core/SkColor.h" @@ -71,7 +72,7 @@ void OnSpeechRecognitionAvailabilityChanged() override; void OnTranscription(const media::SpeechRecognitionResult& result) override; void OnTranscriptionError() override; - void OnSpeechRecognitionStopped() override; + void OnSpeechRecognitionStopped(bool forced) override; NewScreencastPrecondition GetNewScreencastPrecondition() const override; void OnUndoRedoAvailabilityChanged(bool undo_available, bool redo_available) override; @@ -152,7 +153,19 @@ // CrasAudioHandler::AudioObserver: void OnAudioNodesChanged() override; + base::OneShotTimer* get_timer_for_testing() { + return &force_stop_recognition_timer_; + } + private: + // Enum class representing the speech recognition status state. + enum class SpeechRecognitionState { + kRecognitionNotStarted = 0, + kRecognitionStarted = 1, + kRecognitionStopping = 2, + kRecognitionError = 3, + }; + // ProjectorSessionObserver: void OnProjectorSessionActiveStateChanged(bool active) override; @@ -161,6 +174,7 @@ // Starts or stops the speech recognition session. void StartSpeechRecognition(); void MaybeStopSpeechRecognition(); + void ForceEndSpeechRecognition(); // Triggered when finish creating the screencast container folder. This method // caches the the container folder path in `ProjectorSession` and triggers the @@ -182,8 +196,9 @@ void CleanupContainerFolder(); // Wrap up recording by saving the metadata file and stop the projector - // session. This is no-op if speech recognition is not finished or DLP - // restriction check is not completed. + // session. This is a no-op if DLP restriction check is not completed. + // If speech recognition is not finished, this method will set a timer + // for force end the speech recognition session. void MaybeWrapUpRecording(); // Returns all file paths related to current recording. Paths are calculated @@ -195,12 +210,9 @@ std::unique_ptr<ProjectorUiController> ui_controller_; std::unique_ptr<ProjectorMetadataController> metadata_controller_; - // Whether ProjectorController has informed its client to stop - // speech recognition. - bool pending_speech_recognition_stop_ = false; - // Whether speech recognition is taking place or not. - bool is_speech_recognition_on_ = false; + SpeechRecognitionState speech_recognition_state_ = + SpeechRecognitionState::kRecognitionNotStarted; // Whether DLP restriction check is completed. bool dlp_restriction_checked_completed_ = false; @@ -215,6 +227,11 @@ // If set, will be called when the canvas is initialized. base::OnceClosure on_canvas_initialized_callback_for_test_; + // There is a delay on completing speech recognition session. We enforce a 90 + // second timeout from the recording stopped signal to force end the speech + // recognition session. + base::OneShotTimer force_stop_recognition_timer_; + base::WeakPtrFactory<ProjectorControllerImpl> weak_factory_{this}; };
diff --git a/ash/projector/projector_controller_unittest.cc b/ash/projector/projector_controller_unittest.cc index d32c0c5..84afe58 100644 --- a/ash/projector/projector_controller_unittest.cc +++ b/ash/projector/projector_controller_unittest.cc
@@ -348,8 +348,9 @@ {NewScreencastPreconditionReason::kEnabledBySoda}))) .Times(0); EXPECT_CALL(mock_client_, StopSpeechRecognition()) - .WillOnce(testing::Invoke( - [&]() { controller_->OnSpeechRecognitionStopped(); })); + .WillOnce(testing::Invoke([&]() { + controller_->OnSpeechRecognitionStopped(/*forced=*/false); + })); EXPECT_CALL(*mock_metadata_controller_, SaveMetadata(_)).Times(0); controller_->OnRecordingEnded(/*is_in_projector_mode=*/true); @@ -365,8 +366,20 @@ /*count=*/3); } +enum class RecognitionEndLatency { + // The speech recognition has ended even before recording + // has wrapped up dlp check. + kImmediate, + // The speech recognition ends after recording has wrapped up dlp check + // but fore the restricted timeout. + kDelayed, + // The speech recognition doesn't end and it causes a time out. + kDelayedCausingTimeout +}; + class ProjectorOnDlpRestrictionCheckedAtVideoEndTest - : public ::testing::WithParamInterface<::testing::tuple<bool, bool>>, + : public ::testing::WithParamInterface< + ::testing::tuple<RecognitionEndLatency, bool>>, public ProjectorControllerTest { public: ProjectorOnDlpRestrictionCheckedAtVideoEndTest() = default; @@ -378,7 +391,23 @@ }; TEST_P(ProjectorOnDlpRestrictionCheckedAtVideoEndTest, WrapUpRecordingOnce) { - bool wrap_up_by_speech_stopped = std::get<0>(GetParam()); + bool wrap_up_by_speech_stopped; + bool transcript_end_timed_out; + switch (std::get<0>(GetParam())) { + case RecognitionEndLatency::kImmediate: + wrap_up_by_speech_stopped = false; + transcript_end_timed_out = false; + break; + case RecognitionEndLatency::kDelayed: + wrap_up_by_speech_stopped = true; + transcript_end_timed_out = false; + break; + case RecognitionEndLatency::kDelayedCausingTimeout: + wrap_up_by_speech_stopped = true; + transcript_end_timed_out = true; + break; + } + bool user_deleted_video_file = std::get<1>(GetParam()); base::FilePath screencast_container_path; @@ -427,6 +456,7 @@ .Append(expected_screencast_name) // Screencast file name without extension. .Append(expected_screencast_name); + controller_->OnRecordingEnded(/*is_in_projector_mode=*/true); if (!user_deleted_video_file) { // Verify that |SaveMetadata| in |ProjectorMetadataController| is // called with the expected path. @@ -434,8 +464,9 @@ // Verify that save metadata only triggered once. The path will not // change as the clock advances. task_environment()->AdvanceClock(base::Minutes(1)); + int expected_count = wrap_up_by_speech_stopped ? 2 : 1; EXPECT_CALL(*mock_metadata_controller_, SaveMetadata(expected_path)) - .Times(1); + .Times(expected_count); // Verify that thumbnail file is saved. controller_->SetOnFileSavedCallbackForTest(base::BindLambdaForTesting( [&](const base::FilePath& path, bool success) { @@ -468,9 +499,21 @@ /*is_in_projector_mode=*/true, /*user_deleted_video_file=*/user_deleted_video_file, /*thumbnail=*/image); - controller_->OnSpeechRecognitionStopped(); + if (!transcript_end_timed_out) { + controller_->OnSpeechRecognitionStopped(/*forced=*/false); + } else { + EXPECT_CALL(mock_client_, ForceEndSpeechRecognition()) + .Times(1) + .WillOnce(testing::Invoke([&]() { + controller_->OnSpeechRecognitionStopped(/*forced=*/true); + })); + + // Simulate that the timer has fired. + EXPECT_TRUE(controller_->get_timer_for_testing()->IsRunning()); + controller_->get_timer_for_testing()->FireNow(); + } } else { - controller_->OnSpeechRecognitionStopped(); + controller_->OnSpeechRecognitionStopped(/*forced=*/false); controller_->OnDlpRestrictionCheckedAtVideoEnd( /*is_in_projector_mode=*/true, /*user_deleted_video_file=*/user_deleted_video_file, @@ -482,13 +525,17 @@ runLoop.Run(); histogram_tester_.ExpectTotalCount(kProjectorCreationFlowHistogramName, - /*count=*/3); + /*expected_count=*/4); } -INSTANTIATE_TEST_SUITE_P(WrapUpRecordingOnce, - ProjectorOnDlpRestrictionCheckedAtVideoEndTest, - ::testing::Combine(::testing::Bool(), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P( + WrapUpRecordingOnce, + ProjectorOnDlpRestrictionCheckedAtVideoEndTest, + ::testing::Combine( + ::testing::ValuesIn({RecognitionEndLatency::kImmediate, + RecognitionEndLatency::kDelayed, + RecognitionEndLatency::kDelayedCausingTimeout}), + ::testing::Bool())); TEST_F(ProjectorControllerTest, NoTranscriptsTest) { InitializeRealMetadataController();
diff --git a/ash/projector/projector_metadata_controller.cc b/ash/projector/projector_metadata_controller.cc index 2120419..79b632b 100644 --- a/ash/projector/projector_metadata_controller.cc +++ b/ash/projector/projector_metadata_controller.cc
@@ -67,6 +67,12 @@ speech_result.transcription, timing->hypothesis_parts.value())); } +void ProjectorMetadataController::SetSpeechRecognitionStatus( + RecognitionStatus status) { + DCHECK(metadata_); + metadata_->SetSpeechRecognitionStatus(status); +} + void ProjectorMetadataController::RecordKeyIdea() { DCHECK(metadata_); metadata_->MarkKeyIdea();
diff --git a/ash/projector/projector_metadata_controller.h b/ash/projector/projector_metadata_controller.h index e462ffc..2e3ac2b3 100644 --- a/ash/projector/projector_metadata_controller.h +++ b/ash/projector/projector_metadata_controller.h
@@ -35,6 +35,8 @@ // Records the transcript in metadata. Virtual for testing. virtual void RecordTranscription( const media::SpeechRecognitionResult& speech_result); + // Records the state of the transcription. Virtual for testing. + virtual void SetSpeechRecognitionStatus(RecognitionStatus status); // Marks the next transcript as the beginning of a key idea. // Virtual for testing. virtual void RecordKeyIdea();
diff --git a/ash/projector/projector_metadata_model.cc b/ash/projector/projector_metadata_model.cc index d3dd64a..02fb1ad 100644 --- a/ash/projector/projector_metadata_model.cc +++ b/ash/projector/projector_metadata_model.cc
@@ -21,6 +21,7 @@ constexpr base::StringPiece kCaptionsKey = "captions"; constexpr base::StringPiece kKeyIdeasKey = "tableOfContent"; constexpr base::StringPiece kOffset = "offset"; +constexpr base::StringPiece kRecognitionStatus = "recognitionStatus"; base::Value HypothesisPartsToValue( const media::HypothesisParts& hypothesis_parts) { @@ -137,6 +138,10 @@ should_mark_key_idea_ = false; } +void ProjectorMetadata::SetSpeechRecognitionStatus(RecognitionStatus status) { + speech_recognition_status_ = status; +} + void ProjectorMetadata::MarkKeyIdea() { should_mark_key_idea_ = true; } @@ -173,7 +178,8 @@ // "startOffset": 4400, // "text": "Making a creation", // }, -// ] +// ], +// "recognitionStatus": 0, // } // // Which is: @@ -183,6 +189,7 @@ // "captions": LIST // "captionLanguage": STRING // "tableOfContent": LIST +// "recognitionStatus": INTEGER base::Value ProjectorMetadata::ToJson() { base::Value metadata(base::Value::Type::DICTIONARY); metadata.SetStringKey(kCaptionLanguage, caption_language_); @@ -196,6 +203,8 @@ for (auto& key_idea : key_ideas_) key_ideas_value.Append(key_idea->ToJson()); metadata.SetKey(kKeyIdeasKey, std::move(key_ideas_value)); + metadata.SetIntKey(kRecognitionStatus, + static_cast<int>(speech_recognition_status_)); return metadata; }
diff --git a/ash/projector/projector_metadata_model.h b/ash/projector/projector_metadata_model.h index 2db5b669..45b97f3 100644 --- a/ash/projector/projector_metadata_model.h +++ b/ash/projector/projector_metadata_model.h
@@ -19,6 +19,18 @@ namespace ash { +// The speech recognition status. +enum class ASH_EXPORT RecognitionStatus : int { + // Speech recognition was incomplete by the time the metadata + // was written. + kIncomplete = 0, + // Speech recognition was completed by the time the metadata was + // written to file. + kComplete = 1, + // Speech recognition had encountered an error. + kError = 2 +}; + // Base class to describe a metadata item. class MetadataItem { public: @@ -91,6 +103,8 @@ // Adds the transcript to the metadata. void AddTranscript(std::unique_ptr<ProjectorTranscript> transcript); + // Notifies the metadata that transcription has completed. + void SetSpeechRecognitionStatus(RecognitionStatus status); // Marks a beginning of a key idea. The timing info of the next transcript // will be used as the timing of the key idea. void MarkKeyIdea(); @@ -109,6 +123,9 @@ // True if user mark the transcript as a key idea. It will be reset to false // when the final recognition result is received and recorded as a key idea. bool should_mark_key_idea_ = false; + + // The speech recognition status. + RecognitionStatus speech_recognition_status_ = RecognitionStatus::kIncomplete; }; } // namespace ash
diff --git a/ash/projector/projector_metadata_model_unittest.cc b/ash/projector/projector_metadata_model_unittest.cc index df80c39..7c4f991 100644 --- a/ash/projector/projector_metadata_model_unittest.cc +++ b/ash/projector/projector_metadata_model_unittest.cc
@@ -38,6 +38,64 @@ "offset": %i })"; +constexpr char kCompleteMetadataTemplate[] = R"({ + "captions": [ + { + "endOffset": 3000, + "hypothesisParts": [ + { + "offset": 1000, + "text": [ + "transcript" + ] + }, + { + "offset": 2000, + "text": [ + "text" + ] + } + ], + "startOffset": 1000, + "text": "transcript text" + }, + { + "endOffset": 5000, + "hypothesisParts": [ + { + "offset": 3200, + "text": [ + "transcript" + ] + }, + { + "offset": 4200, + "text": [ + "text" + ] + }, + { + "offset": 4500, + "text": [ + "2" + ] + } + ], + "startOffset": 3000, + "text": "transcript text 2" + } + ], + "captionLanguage": "en", + "recognitionStatus": %i, + "tableOfContent": [ + { + "endOffset": 5000, + "startOffset": 3000, + "text": "" + } + ] + })"; + void AssertSerializedString(const std::string& expected, const std::string& actual) { absl::optional<base::Value> expected_value = base::JSONReader::Read(expected); @@ -165,63 +223,6 @@ }; TEST_F(ProjectorMetadataTest, Serialize) { - const char kExpectedMetaData[] = R"({ - "captions": [ - { - "endOffset": 3000, - "hypothesisParts": [ - { - "offset": 1000, - "text": [ - "transcript" - ] - }, - { - "offset": 2000, - "text": [ - "text" - ] - } - ], - "startOffset": 1000, - "text": "transcript text" - }, - { - "endOffset": 5000, - "hypothesisParts": [ - { - "offset": 3200, - "text": [ - "transcript" - ] - }, - { - "offset": 4200, - "text": [ - "text" - ] - }, - { - "offset": 4500, - "text": [ - "2" - ] - } - ], - "startOffset": 3000, - "text": "transcript text 2" - } - ], - "captionLanguage": "en", - "tableOfContent": [ - { - "endOffset": 5000, - "startOffset": 3000, - "text": "" - } - ] - })"; - ProjectorMetadata metadata; metadata.SetCaptionLanguage("en"); @@ -251,7 +252,23 @@ /*end_time=*/base::Milliseconds(5000), "transcript text 2", std::move(second_transcript))); - AssertSerializedString(kExpectedMetaData, metadata.Serialize()); + metadata.SetSpeechRecognitionStatus(RecognitionStatus::kIncomplete); + AssertSerializedString( + base::StringPrintf(kCompleteMetadataTemplate, + static_cast<int>(RecognitionStatus::kIncomplete)), + metadata.Serialize()); + + metadata.SetSpeechRecognitionStatus(RecognitionStatus::kComplete); + AssertSerializedString( + base::StringPrintf(kCompleteMetadataTemplate, + static_cast<int>(RecognitionStatus::kComplete)), + metadata.Serialize()); + + metadata.SetSpeechRecognitionStatus(RecognitionStatus::kError); + AssertSerializedString( + base::StringPrintf(kCompleteMetadataTemplate, + static_cast<int>(RecognitionStatus::kError)), + metadata.Serialize()); } } // namespace ash
diff --git a/ash/projector/test/mock_projector_metadata_controller.h b/ash/projector/test/mock_projector_metadata_controller.h index 567b88e..0d7eb233 100644 --- a/ash/projector/test/mock_projector_metadata_controller.h +++ b/ash/projector/test/mock_projector_metadata_controller.h
@@ -27,8 +27,10 @@ // ProjectorMetadataController: MOCK_METHOD0(OnRecordingStarted, void()); + MOCK_METHOD1(SetSpeechRecognitionStatus, void(RecognitionStatus status)); MOCK_METHOD1(RecordTranscription, void(const media::SpeechRecognitionResult& speech_result)); + MOCK_METHOD0(OnTranscriptionComplete, void()); MOCK_METHOD0(RecordKeyIdea, void()); MOCK_METHOD1(SaveMetadata, void(const base::FilePath& video_file_path)); };
diff --git a/ash/public/cpp/app_list/app_list_metrics.h b/ash/public/cpp/app_list/app_list_metrics.h index 0a6b515..bdc655d 100644 --- a/ash/public/cpp/app_list/app_list_metrics.h +++ b/ash/public/cpp/app_list/app_list_metrics.h
@@ -56,12 +56,12 @@ kMaxValue = kBrowser, }; -// Tracks the result of each search session starting from the search box. -enum class SearchSessionResult { - kLaunch = 0, - kAnswerCardImpression = 1, - kQuit = 2, - kMaxValue = kQuit, +// Tracks the conclusion of each search session starting from the search box. +enum class SearchSessionConclusion { + kQuit = 0, + kLaunch = 1, + kAnswerCardSeen = 2, + kMaxValue = kAnswerCardSeen, }; // The type of the ChromeSearchResult. This is used for logging so do not
diff --git a/ash/public/cpp/app_list/app_list_notifier.h b/ash/public/cpp/app_list/app_list_notifier.h index 1442d197..3ef9866 100644 --- a/ash/public/cpp/app_list/app_list_notifier.h +++ b/ash/public/cpp/app_list/app_list_notifier.h
@@ -49,6 +49,12 @@ // Called when |results| have been displayed for the length of the // impression timer. + virtual void OnSeen(Location location, + const std::vector<Result>& results, + const std::u16string& query) {} + + // Called when |results| have been displayed for the length of the + // impression timer, launched, or ignored. virtual void OnImpression(Location location, const std::vector<Result>& results, const std::u16string& query) {}
diff --git a/ash/public/cpp/projector/projector_client.h b/ash/public/cpp/projector/projector_client.h index 37a0bf2..97d1a60 100644 --- a/ash/public/cpp/projector/projector_client.h +++ b/ash/public/cpp/projector/projector_client.h
@@ -33,6 +33,7 @@ const = 0; virtual void StartSpeechRecognition() = 0; virtual void StopSpeechRecognition() = 0; + virtual void ForceEndSpeechRecognition() = 0; // Returns false if base storage path is not available. Normally the base path // is the DriveFS mounted folder. It is download folder when extended feature // command line flag is disabled.
diff --git a/ash/public/cpp/projector/projector_controller.h b/ash/public/cpp/projector/projector_controller.h index bf157af1d..81e47c1 100644 --- a/ash/public/cpp/projector/projector_controller.h +++ b/ash/public/cpp/projector/projector_controller.h
@@ -48,8 +48,10 @@ // Called when there is an error in transcription. virtual void OnTranscriptionError() = 0; - // Called when speech recognition stopped. - virtual void OnSpeechRecognitionStopped() = 0; + // Called when speech recognition stopped. `forced` is set to true + // if the recognition session was forced to stop before it finishes + // processing. + virtual void OnSpeechRecognitionStopped(bool forced) = 0; // Returns true if we can start a new Projector session. virtual NewScreencastPrecondition GetNewScreencastPrecondition() const = 0;
diff --git a/ash/public/cpp/test/mock_projector_client.h b/ash/public/cpp/test/mock_projector_client.h index 70c19ab..92da637 100644 --- a/ash/public/cpp/test/mock_projector_client.h +++ b/ash/public/cpp/test/mock_projector_client.h
@@ -33,6 +33,7 @@ SpeechRecognitionAvailability()); MOCK_METHOD0(StartSpeechRecognition, void()); MOCK_METHOD0(StopSpeechRecognition, void()); + MOCK_METHOD0(ForceEndSpeechRecognition, void()); bool GetBaseStoragePath(base::FilePath* result) const override; MOCK_CONST_METHOD0(IsDriveFsMounted, bool()); MOCK_CONST_METHOD0(IsDriveFsMountFailed, bool());
diff --git a/ash/public/cpp/test/mock_projector_controller.h b/ash/public/cpp/test/mock_projector_controller.h index aa955ee9..a17b694a 100644 --- a/ash/public/cpp/test/mock_projector_controller.h +++ b/ash/public/cpp/test/mock_projector_controller.h
@@ -25,7 +25,7 @@ MOCK_METHOD1(OnTranscription, void(const media::SpeechRecognitionResult& result)); MOCK_METHOD0(OnTranscriptionError, void()); - MOCK_METHOD0(OnSpeechRecognitionStopped, void()); + MOCK_METHOD1(OnSpeechRecognitionStopped, void(bool forced)); MOCK_METHOD1(SetProjectorToolsVisible, void(bool is_visible)); MOCK_CONST_METHOD0(GetNewScreencastPrecondition, NewScreencastPrecondition()); MOCK_METHOD2(OnUndoRedoAvailabilityChanged,
diff --git a/ash/public/mojom/accelerator_info.mojom b/ash/public/mojom/accelerator_info.mojom index 6bba511..57cbd2b 100644 --- a/ash/public/mojom/accelerator_info.mojom +++ b/ash/public/mojom/accelerator_info.mojom
@@ -75,6 +75,7 @@ kAccessibility, kDebug, kDeveloper, + kEventRewriter, }; // Enum of secondary-level accelerator categories. Used in the UI for @@ -85,6 +86,7 @@ kGeneral, kSystemControls, kSystemApps, + kSixPackKeys, }; // Enum of possible options for text accelerators.
diff --git a/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_controller.ts b/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_controller.ts index 87ab666..79a2cae 100644 --- a/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_controller.ts +++ b/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_controller.ts
@@ -7,6 +7,7 @@ import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; import {Url} from 'chrome://resources/mojo/url/mojom/url.mojom-webui.js'; +import {setErrorAction} from '../personalization_actions.js'; import {GooglePhotosAlbum, GooglePhotosEnablementState, GooglePhotosPhoto, WallpaperCollection, WallpaperLayout, WallpaperProviderInterface, WallpaperType} from '../personalization_app.mojom-webui.js'; import {PersonalizationStore} from '../personalization_store.js'; import {isNonEmptyArray} from '../utils.js'; @@ -14,6 +15,7 @@ import {DisplayableImage} from './constants.js'; import {isDefaultImage, isFilePath, isGooglePhotosPhoto, isImageEqualToSelected, isWallpaperImage} from './utils.js'; import * as action from './wallpaper_actions.js'; +import {DailyRefreshType} from './wallpaper_state.js'; /** * @fileoverview contains all of the functions to interact with C++ side through @@ -431,10 +433,15 @@ // Only trigger the pending UI if this call successfully enables daily refresh // and the wallpaper is going to be refreshed. Otherwise, update the daily // refresh state immediately to prevent the users from seeing unnecessary - // loading UI. + // loading UI. If the call fails due to Google Photos API call failure, + // displays an error message. if (!!albumId && response.success && response.forceRefresh) { store.dispatch(action.beginUpdateDailyRefreshImageAction()); } else { + if (!response.success && response.forceRefresh) { + store.dispatch(setErrorAction( + {message: loadTimeData.getString('googlePhotosError')})); + } getDailyRefreshState(provider, store); } } @@ -472,6 +479,21 @@ const {success} = await provider.updateDailyRefreshWallpaper(); if (success) { store.dispatch(action.setUpdatedDailyRefreshImageAction()); + } else { + const currentWallpaper = store.data.wallpaper.currentSelected; + const dailyRefresh = store.data.wallpaper.dailyRefresh; + // Displays error if daily refresh is activated for Google Photos album + // and refresh failed to fetch a new Google Photo wallpaper. + // Also dispatches setUpdatedDailyRefreshImageAction() and + // setSelectedImageAction() to avoid pending UI. + // TODO (b/266257678): displays error message when daily refresh fails for + // online wallpaper collections. + if (!!dailyRefresh && dailyRefresh.type == DailyRefreshType.GOOGLE_PHOTOS) { + store.dispatch(action.setUpdatedDailyRefreshImageAction()); + store.dispatch(action.setSelectedImageAction(currentWallpaper)); + store.dispatch(setErrorAction( + {message: loadTimeData.getString('googlePhotosError')})); + } } }
diff --git a/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.cc b/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.cc index f48c204ee..778bf875 100644 --- a/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.cc +++ b/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.cc
@@ -347,6 +347,24 @@ {NonConfigurableActions::kAmbientCaretBrowsing, NonConfigurableAcceleratorDetails({ui::Accelerator( ui::VKEY_7, ui::EF_CONTROL_DOWN | ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackDelete, + NonConfigurableAcceleratorDetails( + {ui::Accelerator(ui::VKEY_BACK, ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackHome, + NonConfigurableAcceleratorDetails( + {ui::Accelerator(ui::VKEY_LEFT, ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackPageUp, + NonConfigurableAcceleratorDetails( + {ui::Accelerator(ui::VKEY_UP, ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackEnd, + NonConfigurableAcceleratorDetails( + {ui::Accelerator(ui::VKEY_RIGHT, ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackPageDown, + NonConfigurableAcceleratorDetails( + {ui::Accelerator(ui::VKEY_DOWN, ui::EF_COMMAND_DOWN)})}, + {NonConfigurableActions::kSixPackInsert, + NonConfigurableAcceleratorDetails({ui::Accelerator( + ui::VKEY_BACK, ui::EF_SHIFT_DOWN | ui::EF_COMMAND_DOWN)})}, }); return *nonConfigurableActionsMap; }
diff --git a/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h b/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h index 34795d0f..bb246fc 100644 --- a/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h +++ b/ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h
@@ -75,7 +75,7 @@ kBrowserPageUp, kBrowserPageDown, kBrowserRightClick, - // Ambient action id + // Ambient action ids: kAmbientDragLinkInSameTab, kAmbientCycleForwardMRU, kAmbientDragLinkInNewTab, @@ -98,7 +98,14 @@ kAmbientLaunchAppByIndex, kAmbientDisplayHiddenFiles, kAmbientOpenRightClickMenu, - kAmbientCaretBrowsing + kAmbientCaretBrowsing, + // Six-pack-key action ids: + kSixPackDelete, + kSixPackHome, + kSixPackPageUp, + kSixPackEnd, + kSixPackPageDown, + kSixPackInsert, }; // Used to separate text accelerator parts in the UI e.g ctrl + 1. @@ -896,6 +903,42 @@ mojom::AcceleratorSubcategory::kSystemApps, /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackDelete, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_DELETE_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackHome, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_HOME_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackPageUp, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_PAGE_UP_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackEnd, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_END_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackPageDown, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_PAGE_DOWN_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, + {NonConfigurableActions::kSixPackInsert, + IDS_EVENT_REWRITER_ACCELERATOR_SIX_PACK_INSERT_DESCRIPTION, + mojom::AcceleratorCategory::kEventRewriter, + mojom::AcceleratorSubcategory::kSixPackKeys, + /*locked=*/true, mojom::AcceleratorLayoutStyle::kDefault, + mojom::AcceleratorSource::kAmbient}, }; } // namespace ash
diff --git a/ash/webui/shortcut_customization_ui/resources/js/fake_data.ts b/ash/webui/shortcut_customization_ui/resources/js/fake_data.ts index 2870e6d7..d7f5528 100644 --- a/ash/webui/shortcut_customization_ui/resources/js/fake_data.ts +++ b/ash/webui/shortcut_customization_ui/resources/js/fake_data.ts
@@ -64,6 +64,25 @@ }, }; +const sixPackDeleteAccelerator: MojoAcceleratorInfo = { + type: AcceleratorType.kDefault, + state: AcceleratorState.kEnabled, + locked: true, + layoutProperties: { + standardAccelerator: { + keyDisplay: stringToMojoString16('backspace'), + accelerator: { + modifiers: Modifier.COMMAND, + keyCode: 8, + keyState: 0, + timeStamp: fakeTimestamp, + }, + }, + textAccelerator: undefined, + + }, +}; + export const fakeAcceleratorConfig: MojoAcceleratorConfig = { [AcceleratorSource.kAsh]: { // Snap Window Left @@ -147,6 +166,7 @@ // New Tab [0]: [newTabAccelerator], [1]: [cycleTabsAccelerator], + [2]: [sixPackDeleteAccelerator], }, }; @@ -154,6 +174,7 @@ [AcceleratorSource.kAmbient]: { [0]: [newTabAccelerator], [1]: [cycleTabsAccelerator], + [2]: [sixPackDeleteAccelerator], }, }; @@ -206,6 +227,14 @@ source: AcceleratorSource.kAmbient, action: 1, }, + { + category: AcceleratorCategory.kEventRewriter, + subCategory: AcceleratorSubcategory.kSixPackKeys, + description: stringToMojoString16('Delete'), + style: LayoutStyle.kDefault, + source: AcceleratorSource.kAmbient, + action: 2, + }, ]; // The following code is used to add fake accelerator entries for each icon.
diff --git a/ash/webui/shortcut_customization_ui/resources/js/shortcut_utils.ts b/ash/webui/shortcut_customization_ui/resources/js/shortcut_utils.ts index 5b38dae..9703398f 100644 --- a/ash/webui/shortcut_customization_ui/resources/js/shortcut_utils.ts +++ b/ash/webui/shortcut_customization_ui/resources/js/shortcut_utils.ts
@@ -80,6 +80,8 @@ return `${categoryPrefix}Debug`; case AcceleratorCategory.kDeveloper: return `${categoryPrefix}Developer`; + case AcceleratorCategory.kEventRewriter: + return `${categoryPrefix}EventRewriter`; default: { // If this case is reached, then an invalid category was passed in. assertNotReached(); @@ -97,6 +99,8 @@ return `${subcategoryPrefix}SystemApps`; case AcceleratorSubcategory.kSystemControls: return `${subcategoryPrefix}SystemControls`; + case AcceleratorSubcategory.kSixPackKeys: + return `${subcategoryPrefix}SixPackKeys`; default: { // If this case is reached, then an invalid category was passed in. assertNotReached();
diff --git a/ash/webui/shortcut_customization_ui/shortcut_customization_app_ui.cc b/ash/webui/shortcut_customization_ui/shortcut_customization_app_ui.cc index 97cf287..2ad192a6 100644 --- a/ash/webui/shortcut_customization_ui/shortcut_customization_app_ui.cc +++ b/ash/webui/shortcut_customization_ui/shortcut_customization_app_ui.cc
@@ -63,6 +63,8 @@ IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_ACCESSIBILITY}, {"categoryDebug", IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_DEBUG}, {"categoryDeveloper", IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_DEVELOPER}, + {"categoryEventRewriter", + IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_EVENT_REWRITER}, {"shortcutWithConflictStatusMessage", IDS_SHORTCUT_CUSTOMIZATION_SHORTCUT_WITH_CONFILICT_STATUS_MESSAGE}, {"lockedShortcutStatusMessage", @@ -72,6 +74,8 @@ IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SYSTEM_APPS}, {"subcategorySystemControls", IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SYSTEM_CONTROLS}, + {"subcategorySixPackKeys", + IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SIX_PACK}, {"iconLabelArrowDown", IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ARROW_DOWN}, {"iconLabelArrowLeft", IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ARROW_LEFT}, {"iconLabelArrowRight",
diff --git a/ash/wm/desks/desk.cc b/ash/wm/desks/desk.cc index 5eafb10..b6f94ea 100644 --- a/ash/wm/desks/desk.cc +++ b/ash/wm/desks/desk.cc
@@ -892,7 +892,12 @@ auto& adw_data = all_desk_window_stacking_[root]; auto it = base::ranges::find(adw_data, window, &AllDeskWindowStackingData::window); - DCHECK(it != adw_data.end()); + if (it == adw_data.end()) { + // This will happen when the desk was created after the window was made into + // an all desk window. In this case, there's nothing to do since this desk + // doesn't have any stacking info for this window. + return; + } it = adw_data.erase(it); // Raise all remaining windows up.
diff --git a/ash/wm/float/float_controller_unittest.cc b/ash/wm/float/float_controller_unittest.cc index 07d938c..90666570 100644 --- a/ash/wm/float/float_controller_unittest.cc +++ b/ash/wm/float/float_controller_unittest.cc
@@ -1690,4 +1690,38 @@ EXPECT_EQ(split_view_controller->secondary_window(), other_window.get()); } +// When reset a floated window that's previously snapped, maximize instead of +// snap. +TEST_F(TabletWindowFloatSplitviewTest, ResetFloatToMaximize) { + Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); + + // Create two windows and snap one on each side. + std::unique_ptr<aura::Window> window_1 = CreateAppWindow(); + std::unique_ptr<aura::Window> window_2 = CreateAppWindow(); + + auto* split_view_controller = + SplitViewController::Get(Shell::GetPrimaryRootWindow()); + + const WMEvent snap_left(WM_EVENT_SNAP_PRIMARY); + WindowState::Get(window_1.get())->OnWMEvent(&snap_left); + const WMEvent snap_right(WM_EVENT_SNAP_SECONDARY); + WindowState::Get(window_2.get())->OnWMEvent(&snap_right); + EXPECT_TRUE(split_view_controller->BothSnapped()); + EXPECT_EQ(split_view_controller->primary_window(), window_1.get()); + EXPECT_EQ(split_view_controller->secondary_window(), window_2.get()); + + // Float `window_1`, `window_2` should be maximized. + wm::ActivateWindow(window_1.get()); + PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN); + ASSERT_TRUE(WindowState::Get(window_1.get())->IsFloated()); + ASSERT_TRUE(WindowState::Get(window_2.get())->IsMaximized()); + + // Float `window_2`, previously floated `window_1` should be maximized instead + // of restoring back to snapped. + wm::ActivateWindow(window_2.get()); + PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN); + ASSERT_TRUE(WindowState::Get(window_2.get())->IsFloated()); + ASSERT_TRUE(WindowState::Get(window_1.get())->IsMaximized()); +} + } // namespace ash
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index 1a437948..bb88bd3 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -785,8 +785,17 @@ // kMaximized window state for a maximize-able window, and also should be able // to support restoring a fullscreen/minimized/maximized window to snapped // window states. - if (IsTabletModeEnabled() && restore_state == WindowStateType::kNormal) - restore_state = GetMaximizedOrCenteredWindowType(); + if (IsTabletModeEnabled()) { + // In tablet mode, if we reset a floated window that's previously snapped + // (float another window will reset currently floated window), maximize + // floated window instead of restore floated window back to snapped state. + if (restore_state == WindowStateType::kNormal || + (IsFloated() && + (restore_state == WindowStateType::kPrimarySnapped || + restore_state == WindowStateType::kSecondarySnapped))) { + restore_state = GetMaximizedOrCenteredWindowType(); + } + } return restore_state; }
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index c8efb73..f9283e2 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc
@@ -286,13 +286,13 @@ w1->Show(); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); - EXPECT_FALSE(w1->layer()->IsDrawn()); + EXPECT_FALSE(w1->layer()->IsVisible()); EXPECT_TRUE(w1->layer()->GetTargetTransform().IsIdentity()); // Show the window. w1->Show(); EXPECT_TRUE(WindowState::Get(w1.get())->IsNormalStateType()); - EXPECT_TRUE(w1->layer()->IsDrawn()); + EXPECT_TRUE(w1->layer()->IsVisible()); } // Assertions around minimizing a fullscreen window. @@ -311,22 +311,22 @@ // Minimize w2. w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); - EXPECT_TRUE(w1->layer()->IsDrawn()); - EXPECT_FALSE(w2->layer()->IsDrawn()); + EXPECT_TRUE(w1->layer()->IsVisible()); + EXPECT_FALSE(w2->layer()->IsVisible()); // Show the window, which should trigger unminimizing. w2->Show(); w2_state->Activate(); EXPECT_TRUE(w2_state->IsFullscreen()); - EXPECT_TRUE(w1->layer()->IsDrawn()); - EXPECT_TRUE(w2->layer()->IsDrawn()); + EXPECT_TRUE(w1->layer()->IsVisible()); + EXPECT_TRUE(w2->layer()->IsVisible()); // Minimize the window, which should hide the window. EXPECT_TRUE(w2_state->IsActive()); w2_state->Minimize(); EXPECT_FALSE(w2_state->IsActive()); - EXPECT_FALSE(w2->layer()->IsDrawn()); + EXPECT_FALSE(w2->layer()->IsVisible()); EXPECT_TRUE(w1_state->IsActive()); EXPECT_EQ(w2.get(), GetDesktop()->children()[0]); EXPECT_EQ(w1.get(), GetDesktop()->children()[1]); @@ -338,7 +338,7 @@ EXPECT_TRUE(w1_state->IsActive()); EXPECT_EQ(w2.get(), GetDesktop()->children()[0]); EXPECT_EQ(w1.get(), GetDesktop()->children()[1]); - EXPECT_TRUE(w2->layer()->IsDrawn()); + EXPECT_TRUE(w2->layer()->IsVisible()); } // Verifies ShelfLayoutManager's visibility/auto-hide state is correctly
diff --git a/base/BUILD.gn b/base/BUILD.gn index 36efb22c3..125fe6e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -429,7 +429,6 @@ "memory/platform_shared_memory_region.cc", "memory/platform_shared_memory_region.h", "memory/ptr_util.h", - "memory/raw_ptr.cc", "memory/raw_ptr.h", "memory/raw_ptr_asan_bound_arg_tracker.cc", "memory/raw_ptr_asan_bound_arg_tracker.h", @@ -1475,13 +1474,7 @@ } all_dependent_configs = [] - defines = [ - "BASE_IMPLEMENTATION", - - # Temporary placement for `raw_ptr` using PA's `component_export.h`; - # will be moved: crbug.com/1371729 - "IS_RAW_PTR_IMPL", - ] + defines = [ "BASE_IMPLEMENTATION" ] data = [] data_deps = [] libs = [] @@ -2079,7 +2072,10 @@ # BUILDFLAG(USE_PARTITION_ALLOC). A linker will remove all # partition_alloc code if use_partition_alloc = false because no code uses # partition_alloc. - public_deps += [ "allocator/partition_allocator:partition_alloc" ] + public_deps += [ + "allocator/partition_allocator:partition_alloc", + "allocator/partition_allocator:raw_ptr", + ] } # Windows.
diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn index a6f2b1a..bd173b7 100644 --- a/base/allocator/partition_allocator/BUILD.gn +++ b/base/allocator/partition_allocator/BUILD.gn
@@ -368,11 +368,22 @@ } source_set("raw_ptr") { - public = [ "pointers/raw_ptr_exclusion.h" ] + # `gn check` is unhappy with most `#includes` when PA isn't + # actually built. + check_includes = use_partition_alloc + public = [ + "pointers/raw_ptr.h", + "pointers/raw_ptr_exclusion.h", + "pointers/raw_ref.h", + ] + sources = [ "pointers/raw_ptr.cc" ] if (use_partition_alloc) { public_deps = [ ":partition_alloc" ] } deps = [ ":buildflags" ] + + # See also: `partition_alloc_base/component_export.h` + defines = [ "IS_RAW_PTR_IMPL" ] } buildflag_header("partition_alloc_buildflags") {
diff --git a/base/allocator/partition_allocator/OWNERS b/base/allocator/partition_allocator/OWNERS index 369174c..7ce390d 100644 --- a/base/allocator/partition_allocator/OWNERS +++ b/base/allocator/partition_allocator/OWNERS
@@ -3,3 +3,6 @@ keishi@chromium.org lizeb@chromium.org tasak@google.com + +per-file pointers/raw_ptr*=file://base/memory/MIRACLE_PTR_OWNERS +per-file pointers/raw_ref*=file://base/memory/MIRACLE_PTR_OWNERS
diff --git a/base/memory/raw_ptr.cc b/base/allocator/partition_allocator/pointers/raw_ptr.cc similarity index 98% rename from base/memory/raw_ptr.cc rename to base/allocator/partition_allocator/pointers/raw_ptr.cc index 1cb62080..f7233eda 100644 --- a/base/memory/raw_ptr.cc +++ b/base/allocator/partition_allocator/pointers/raw_ptr.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 "base/memory/raw_ptr.h" +#include "base/allocator/partition_allocator/pointers/raw_ptr.h" #include <cstdint> #include "base/allocator/partition_allocator/dangling_raw_ptr_checks.h"
diff --git a/base/allocator/partition_allocator/pointers/raw_ptr.h b/base/allocator/partition_allocator/pointers/raw_ptr.h new file mode 100644 index 0000000..a8e02a06 --- /dev/null +++ b/base/allocator/partition_allocator/pointers/raw_ptr.h
@@ -0,0 +1,1986 @@ +// Copyright 2020 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_PTR_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_PTR_H_ + +#include <stddef.h> +#include <stdint.h> + +#include <climits> +#include <cstddef> +#include <functional> +#include <type_traits> +#include <utility> + +#include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" +#include "base/allocator/partition_allocator/partition_alloc_base/component_export.h" +#include "base/allocator/partition_allocator/partition_alloc_base/debug/debugging_buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_config.h" +#include "base/allocator/partition_allocator/partition_alloc_forward.h" +#include "base/allocator/partition_allocator/pointers/raw_ptr_exclusion.h" +#include "build/build_config.h" +#include "build/buildflag.h" + +#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +#include "base/allocator/partition_allocator/partition_tag.h" +#include "base/allocator/partition_allocator/partition_tag_types.h" +#include "base/allocator/partition_allocator/tagging.h" +#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ + PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +// USE_BACKUP_REF_PTR implies USE_PARTITION_ALLOC, needed for code under +// allocator/partition_allocator/ to be built. +#include "base/allocator/partition_allocator/address_pool_manager_bitmap.h" +#include "base/allocator/partition_allocator/partition_address_space.h" +#include "base/allocator/partition_allocator/partition_alloc_constants.h" +#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || + // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + +#if BUILDFLAG(IS_WIN) +#include "base/allocator/partition_allocator/partition_alloc_base/win/win_handle_types.h" +#endif + +#if BUILDFLAG(USE_PARTITION_ALLOC) +#include "base/allocator/partition_allocator/partition_alloc_base/check.h" +// Live implementation of MiraclePtr being built. +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ + BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) || \ + PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +#define PA_RAW_PTR_CHECK(condition) PA_BASE_CHECK(condition) +#else +// No-op implementation of MiraclePtr being built. +// Note that `PA_BASE_DCHECK()` evaporates from non-DCHECK builds, +// minimizing impact of generated code. +#define PA_RAW_PTR_CHECK(condition) PA_BASE_DCHECK(condition) +#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || + // BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) || + // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +#else // BUILDFLAG(USE_PARTITION_ALLOC) +// Without PartitionAlloc, there's no `PA_BASE_D?CHECK()` implementation +// available. +#define PA_RAW_PTR_CHECK(condition) +#endif // BUILDFLAG(USE_PARTITION_ALLOC) + +namespace cc { +class Scheduler; +} +namespace base::internal { +class DelayTimerBase; +} +namespace content::responsiveness { +class Calculator; +} + +namespace base { + +// NOTE: All methods should be `PA_ALWAYS_INLINE`. raw_ptr is meant to be a +// lightweight replacement of a raw pointer, hence performance is critical. + +namespace raw_ptr_traits { + +// Disables dangling pointer detection, but keeps other raw_ptr protections. +// Don't use directly, use DisableDanglingPtrDetection or DanglingUntriaged +// instead. +struct MayDangle {}; +// Disables any protections when MTECheckedPtrImpl is requested, by switching to +// NoOpImpl in that case. +// Don't use directly, use DegradeToNoOpWhenMTE instead. +struct DisableMTECheckedPtr {}; +// Disables any hooks, by switching to NoOpImpl in that case. +// Internal use only. +struct DisableHooks {}; +// Adds accounting, on top of the chosen implementation, for test purposes. +// raw_ptr/raw_ref with this trait perform extra bookkeeping, e.g. to track the +// number of times the raw_ptr is wrapped, unrwapped, etc. +// Test only. +struct UseCountingWrapperForTest {}; +// Very internal use only. +using EmptyTrait = void; + +template <typename Trait> +inline constexpr bool IsValidTraitV = + std::is_same_v<Trait, MayDangle> || + std::is_same_v<Trait, DisableMTECheckedPtr> || + std::is_same_v<Trait, DisableHooks> || + std::is_same_v<Trait, UseCountingWrapperForTest> || + std::is_same_v<Trait, EmptyTrait>; + +template <typename... Traits> +struct TraitPack { + static_assert((IsValidTraitV<Traits> && ...), "Unknown raw_ptr trait"); + + template <typename TraitToSearch> + static inline constexpr bool HasV = + (std::is_same_v<TraitToSearch, Traits> || ...); +}; + +// Replaces an unwanted trait with EmptyTrait. +template <typename TraitToExclude> +struct ExcludeTrait { + template <typename Trait> + using Filter = std:: + conditional_t<std::is_same_v<TraitToExclude, Trait>, EmptyTrait, Trait>; +}; + +// Use TraitBundle alias, instead of TraitBundleInt, so that traits in different +// order and duplicates resolve to the same underlying type. For example, +// TraitBundle<A,B> is the same C++ type as TraitBundle<B,A,B,A>. This also +// allows to entirely ignore a trait under some build configurations, to prevent +// it from turning TraitBundle into a different C++ type. +// +// It'd be easier to just pass bools into TraitBundleInt, instead of echo'ing +// the trait, but that would lead to less readable compiler messages that spit +// out the type. TraitBundleInt<MayDangle,EmptyTrait,DisableHooks,EmptyTrait> is +// more readable than TraitBundleInt<true,false,true,false>. +template <typename... Traits> +struct TraitBundleInt; +template <typename... Traits> +using TraitBundle = TraitBundleInt< + std::conditional_t<TraitPack<Traits...>::template HasV<MayDangle>, + MayDangle, + EmptyTrait>, +#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + std::conditional_t< + TraitPack<Traits...>::template HasV<DisableMTECheckedPtr>, + DisableMTECheckedPtr, + EmptyTrait>, +#else + // Entirely ignore DisableMTECheckedPtr on non-MTECheckedPtr builds, so that + // TraitBundle (and thus raw_ptr/raw_ref) with that trait is considered + // exactly the same type as without it. This matches the long standing + // behavior prior to crrev.com/c/4113514. + EmptyTrait, +#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +#if BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) + std::conditional_t<TraitPack<Traits...>::template HasV<DisableHooks>, + DisableHooks, + EmptyTrait>, +#else + // Entirely ignore DisableHooks on non-ASanBRP builds, so that + // TraitBundle (and thus raw_ptr/raw_ref) with that trait is considered + // exactly the same type as without it. This matches the long standing + // behavior prior to crrev.com/c/4113514. + EmptyTrait, +#endif // BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) + std::conditional_t< + TraitPack<Traits...>::template HasV<UseCountingWrapperForTest>, + UseCountingWrapperForTest, + EmptyTrait>>; + +template <typename... Traits> +struct TraitBundleInt { + static constexpr bool kMayDangle = + TraitPack<Traits...>::template HasV<MayDangle>; + static constexpr bool kDisableMTECheckedPtr = + TraitPack<Traits...>::template HasV<DisableMTECheckedPtr>; + static constexpr bool kDisableHooks = + TraitPack<Traits...>::template HasV<DisableHooks>; + static constexpr bool kUseCountingWrapperForTest = + TraitPack<Traits...>::template HasV<UseCountingWrapperForTest>; + + // Assert that on certain build configurations, the related traits are not + // even used. If they were, they'd result in a different C++ type, and would + // trigger more costly cross-type raw_ptr/raw_ref conversions. +#if !PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + static_assert(!kDisableMTECheckedPtr); +#endif +#if !BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) + static_assert(!kDisableHooks); +#endif + + // Use TraitBundle, instead of TraitBundleInt, to re-normalize trait list + // (i.e. order canonically and remove duplicates). + template <typename TraitToAdd> + using AddTraitT = TraitBundle<Traits..., TraitToAdd>; + // Unlike AddTraitT, no need to re-normalize because ExcludeTrait preserves + // the trait list structure. + template <typename TraitToRemove> + using RemoveTraitT = TraitBundleInt< + typename ExcludeTrait<TraitToRemove>::template Filter<Traits>...>; +}; + +template <typename TraitBundle> +struct TraitsToImpl; + +} // namespace raw_ptr_traits + +namespace internal { +// These classes/structures are part of the raw_ptr implementation. +// DO NOT USE THESE CLASSES DIRECTLY YOURSELF. + +struct RawPtrNoOpImpl { + // Wraps a pointer. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + return ptr; + } + + // Notifies the allocator when a wrapped pointer is being removed or replaced. + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T*) {} + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function is allowed to crash on nullptr. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { + return wrapped_ptr; + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function must handle nullptr gracefully. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + return wrapped_ptr; + } + + // Unwraps the pointer, without making an assertion on whether memory was + // freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + return wrapped_ptr; + } + + // Upcasts the wrapped pointer. + template <typename To, typename From> + static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { + static_assert(std::is_convertible<From*, To*>::value, + "From must be convertible to To."); + // Note, this cast may change the address if upcasting to base that lies in + // the middle of the derived object. + return wrapped_ptr; + } + + // Advance the wrapped pointer by `delta_elems`. + template < + typename T, + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { + return wrapped_ptr + delta_elems; + } + + template <typename T> + static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, + T* wrapped_ptr2) { + return wrapped_ptr1 - wrapped_ptr2; + } + + // Returns a copy of a wrapped pointer, without making an assertion on whether + // memory was freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { + return wrapped_ptr; + } + + // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used + // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + return ptr; + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + return wrapped_ptr; + } + + // This is for accounting only, used by unit tests. + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} + static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} +}; + +#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + +constexpr int kValidAddressBits = 48; +constexpr uintptr_t kAddressMask = (1ull << kValidAddressBits) - 1; +constexpr int kTagBits = sizeof(uintptr_t) * 8 - kValidAddressBits; + +// MTECheckedPtr has no business with the topmost bits reserved for the +// tag used by true ARM MTE, so we strip it out here. +constexpr uintptr_t kTagMask = + ~kAddressMask & partition_alloc::internal::kPtrUntagMask; + +constexpr int kTopBitShift = 63; +constexpr uintptr_t kTopBit = 1ull << kTopBitShift; +static_assert(kTopBit << 1 == 0, "kTopBit should really be the top bit"); +static_assert((kTopBit & kTagMask) > 0, + "kTopBit bit must be inside the tag region"); + +// This functionality is outside of MTECheckedPtrImpl, so that it can be +// overridden by tests. +struct MTECheckedPtrImplPartitionAllocSupport { + // Checks if the necessary support is enabled in PartitionAlloc for `ptr`. + template <typename T> + static PA_ALWAYS_INLINE bool EnabledForPtr(T* ptr) { + // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this class + // is responsible for handling the software MTE tag. + auto addr = partition_alloc::UntagPtr(ptr); + return partition_alloc::IsManagedByPartitionAlloc(addr); + } + + // Returns pointer to the tag that protects are pointed by |addr|. + static PA_ALWAYS_INLINE void* TagPointer(uintptr_t addr) { + return partition_alloc::PartitionTagPointer(addr); + } +}; + +template <typename PartitionAllocSupport> +struct MTECheckedPtrImpl { + // This implementation assumes that pointers are 64 bits long and at least 16 + // top bits are unused. The latter is harder to verify statically, but this is + // true for all currently supported 64-bit architectures (PA_DCHECK when + // wrapping will verify that). + static_assert(sizeof(void*) >= 8, "Need 64-bit pointers"); + + // Wraps a pointer, and returns its uintptr_t representation. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this + // function is responsible for adding the software MTE tag. + uintptr_t addr = partition_alloc::UntagPtr(ptr); + PA_BASE_DCHECK(ExtractTag(addr) == 0ull); + + // Return a not-wrapped |addr|, if it's either nullptr or if the protection + // for this pointer is disabled. + if (!PartitionAllocSupport::EnabledForPtr(ptr)) { + return ptr; + } + + // Read the tag and place it in the top bits of the address. + // Even if PartitionAlloc's tag has less than kTagBits, we'll read + // what's given and pad the rest with 0s. + static_assert(sizeof(partition_alloc::PartitionTag) * 8 <= kTagBits, ""); + uintptr_t tag = *(static_cast<volatile partition_alloc::PartitionTag*>( + PartitionAllocSupport::TagPointer(addr))); + PA_BASE_DCHECK(tag); + + tag <<= kValidAddressBits; + addr |= tag; + // See the disambiguation comment above. + // TODO(kdlee): Ensure that ptr's hardware MTE tag is preserved. + // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. + return static_cast<T*>(partition_alloc::internal::TagAddr(addr)); + } + + // Notifies the allocator when a wrapped pointer is being removed or replaced. + // No-op for MTECheckedPtrImpl. + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T*) {} + + // Unwraps the pointer's uintptr_t representation, while asserting that memory + // hasn't been freed. The function is allowed to crash on nullptr. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { + // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this + // function is responsible for removing the software MTE tag. + uintptr_t wrapped_addr = partition_alloc::UntagPtr(wrapped_ptr); + uintptr_t tag = ExtractTag(wrapped_addr); + if (tag > 0) { + // Read the tag provided by PartitionAlloc. + // + // Cast to volatile to ensure memory is read. E.g. in a tight loop, the + // compiler could cache the value in a register and thus could miss that + // another thread freed memory and changed tag. + uintptr_t read_tag = + *static_cast<volatile partition_alloc::PartitionTag*>( + PartitionAllocSupport::TagPointer(ExtractAddress(wrapped_addr))); + if (PA_UNLIKELY(tag != read_tag)) { + PA_IMMEDIATE_CRASH(); + } + // See the disambiguation comment above. + // TODO(kdlee): Ensure that ptr's hardware MTE tag is preserved. + // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. + return static_cast<T*>( + partition_alloc::internal::TagAddr(ExtractAddress(wrapped_addr))); + } + return wrapped_ptr; + } + + // Unwraps the pointer's uintptr_t representation, while asserting that memory + // hasn't been freed. The function must handle nullptr gracefully. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + // SafelyUnwrapPtrForDereference handles nullptr case well. + return SafelyUnwrapPtrForDereference(wrapped_ptr); + } + + // Unwraps the pointer's uintptr_t representation, without making an assertion + // on whether memory was freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + return ExtractPtr(wrapped_ptr); + } + + // Upcasts the wrapped pointer. + template <typename To, typename From> + static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { + static_assert(std::is_convertible<From*, To*>::value, + "From must be convertible to To."); + + // The top-bit tag must not affect the result of upcast. + return static_cast<To*>(wrapped_ptr); + } + + // Advance the wrapped pointer by `delta_elems`. + template < + typename T, + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { + return wrapped_ptr + delta_elems; + } + + template <typename T> + static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, + T* wrapped_ptr2) { + // Ensure that both pointers come from the same allocation. + // + // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this + // class is responsible for handling the software MTE tag. + // + // MTECheckedPtr doesn't use 0 as a valid tag; depending on which + // subtraction operator is called, we may be getting the actual + // untagged T* or the wrapped pointer (passed as a T*) in one or + // both args. We can only check slot cohabitation when both args + // come with tags. + const uintptr_t tag1 = ExtractTag(partition_alloc::UntagPtr(wrapped_ptr1)); + const uintptr_t tag2 = ExtractTag(partition_alloc::UntagPtr(wrapped_ptr2)); + if (tag1 && tag2) { + PA_BASE_CHECK(tag1 == tag2); + return wrapped_ptr1 - wrapped_ptr2; + } + + // If one or the other arg come untagged, we have to perform the + // subtraction entirely without tags. + return reinterpret_cast<T*>( + ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr1))) - + reinterpret_cast<T*>( + ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr2))); + } + + // Returns a copy of a wrapped pointer, without making an assertion + // on whether memory was freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { + return wrapped_ptr; + } + + // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used + // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + return WrapRawPtr(ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + return ExtractPtr(wrapped_ptr); + } + + // This is for accounting only, used by unit tests. + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} + static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} + + private: + static PA_ALWAYS_INLINE uintptr_t ExtractAddress(uintptr_t wrapped_ptr) { + return wrapped_ptr & kAddressMask; + } + + template <typename T> + static PA_ALWAYS_INLINE T* ExtractPtr(T* wrapped_ptr) { + // Disambiguation: UntagPtr/TagAddr handle the hardware MTE tag, whereas + // this function is responsible for removing the software MTE tag. + // TODO(kdlee): Ensure that wrapped_ptr's hardware MTE tag is preserved. + // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. + return static_cast<T*>(partition_alloc::internal::TagAddr( + ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr)))); + } + + static PA_ALWAYS_INLINE uintptr_t ExtractTag(uintptr_t wrapped_ptr) { + return (wrapped_ptr & kTagMask) >> kValidAddressBits; + } +}; + +#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) +PA_COMPONENT_EXPORT(RAW_PTR) +void CheckThatAddressIsntWithinFirstPartitionPage(uintptr_t address); +#endif + +template <bool AllowDangling = false> +struct BackupRefPtrImpl { + // Note that `BackupRefPtrImpl` itself is not thread-safe. If multiple threads + // modify the same smart pointer object without synchronization, a data race + // will occur. + + static PA_ALWAYS_INLINE bool IsSupportedAndNotNull(uintptr_t address) { + // There are many situations where the compiler can prove that + // `ReleaseWrappedPtr` is called on a value that is always nullptr, but the + // way `IsManagedByPartitionAllocBRPPool` is written, the compiler can't + // prove that nullptr is not managed by PartitionAlloc; and so the compiler + // has to emit a useless check and dead code. To avoid that without making + // the runtime check slower, tell the compiler to skip + // `IsManagedByPartitionAllocBRPPool` when it can statically determine that + // address is nullptr. +#if PA_HAS_BUILTIN(__builtin_constant_p) + if (__builtin_constant_p(address == 0) && (address == 0)) { +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + PA_BASE_CHECK( + !partition_alloc::IsManagedByPartitionAllocBRPPool(address)); +#endif // BUILDFLAG(PA_DCHECK_IS_ON) || + // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + return false; + } +#endif // PA_HAS_BUILTIN(__builtin_constant_p) + + // This covers the nullptr case, as address 0 is never in any + // PartitionAlloc pool. + bool is_in_brp_pool = + partition_alloc::IsManagedByPartitionAllocBRPPool(address); + + // There may be pointers immediately after the allocation, e.g. + // { + // // Assume this allocation happens outside of PartitionAlloc. + // raw_ptr<T> ptr = new T[20]; + // for (size_t i = 0; i < 20; i ++) { ptr++; } + // } + // + // Such pointers are *not* at risk of accidentally falling into BRP pool, + // because: + // 1) On 64-bit systems, BRP pool is preceded by a forbidden region. + // 2) On 32-bit systems, the guard pages and metadata of super pages in BRP + // pool aren't considered to be part of that pool. + // + // This allows us to make a stronger assertion that if + // IsManagedByPartitionAllocBRPPool returns true for a valid pointer, + // it must be at least partition page away from the beginning of a super + // page. +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + if (is_in_brp_pool) { + CheckThatAddressIsntWithinFirstPartitionPage(address); + } +#endif + + return is_in_brp_pool; + } + +#if PA_CONFIG(USE_OOB_POISON) + // Out-Of-Bounds (OOB) poison bit is set when the pointer has overflowed by + // one byte. +#if defined(ARCH_CPU_X86_64) + // Bit 63 is the only pointer bit that will work as the poison bit across both + // LAM48 and LAM57. It also works when all unused linear address bits are + // checked for canonicality. + static constexpr uintptr_t OOB_POISON_BIT = static_cast<uintptr_t>(1) << 63; +#else + // Avoid ARM's Top-Byte Ignore. + static constexpr uintptr_t OOB_POISON_BIT = static_cast<uintptr_t>(1) << 55; +#endif + + template <typename T> + static PA_ALWAYS_INLINE T* UnpoisonPtr(T* ptr) { + return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(ptr) & + ~OOB_POISON_BIT); + } + + template <typename T> + static PA_ALWAYS_INLINE bool IsPtrOOB(T* ptr) { + return (reinterpret_cast<uintptr_t>(ptr) & OOB_POISON_BIT) == + OOB_POISON_BIT; + } + + template <typename T> + static PA_ALWAYS_INLINE T* PoisonOOBPtr(T* ptr) { + return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(ptr) | + OOB_POISON_BIT); + } +#else // PA_USE_OOB_POISON + template <typename T> + static PA_ALWAYS_INLINE T* UnpoisonPtr(T* ptr) { + return ptr; + } +#endif // PA_USE_OOB_POISON + + // Wraps a pointer. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + uintptr_t address = partition_alloc::UntagPtr(UnpoisonPtr(ptr)); + if (IsSupportedAndNotNull(address)) { +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + PA_BASE_CHECK(ptr != nullptr); +#endif + AcquireInternal(address); + } else { +#if !PA_CONFIG(HAS_64_BITS_POINTERS) +#if PA_HAS_BUILTIN(__builtin_constant_p) + // Similarly to `IsSupportedAndNotNull` above, elide the + // `BanSuperPageFromBRPPool` call if the compiler can prove that `address` + // is zero since PA won't be able to map anything at that address anyway. + bool known_constant_zero = + __builtin_constant_p(address == 0) && (address == 0); +#else // PA_HAS_BUILTIN(__builtin_constant_p) + bool known_constant_zero = false; +#endif // PA_HAS_BUILTIN(__builtin_constant_p) + + if (!known_constant_zero) { + partition_alloc::internal::AddressPoolManagerBitmap:: + BanSuperPageFromBRPPool(address); + } +#endif // !PA_CONFIG(HAS_64_BITS_POINTERS) + } + + return ptr; + } + + // Notifies the allocator when a wrapped pointer is being removed or replaced. + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* wrapped_ptr) { + uintptr_t address = partition_alloc::UntagPtr(UnpoisonPtr(wrapped_ptr)); + if (IsSupportedAndNotNull(address)) { +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + PA_BASE_CHECK(wrapped_ptr != nullptr); +#endif + ReleaseInternal(address); + } + // We are unable to counteract BanSuperPageFromBRPPool(), called from + // WrapRawPtr(). We only use one bit per super-page and, thus can't tell if + // there's more than one associated raw_ptr<T> at a given time. The risk of + // exhausting the entire address space is minuscule, therefore, we couldn't + // resist the perf gain of a single relaxed store (in the above mentioned + // function) over much more expensive two CAS operations, which we'd have to + // use if we were to un-ban a super-page. + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function is allowed to crash on nullptr. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) +#if PA_CONFIG(USE_OOB_POISON) + PA_BASE_CHECK(!IsPtrOOB(wrapped_ptr)); +#endif + uintptr_t address = partition_alloc::UntagPtr(wrapped_ptr); + if (IsSupportedAndNotNull(address)) { + PA_BASE_CHECK(wrapped_ptr != nullptr); + PA_BASE_CHECK(IsPointeeAlive(address)); + } +#endif // BUILDFLAG(PA_DCHECK_IS_ON) || + // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + return wrapped_ptr; + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function must handle nullptr gracefully. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + T* unpoisoned_ptr = UnpoisonPtr(wrapped_ptr); +#if PA_CONFIG(USE_OOB_POISON) + // Some code uses invalid pointer values as indicators, so those values must + // be passed through unchanged during extraction. The following check will + // pass invalid values through if those values do not fall within the BRP + // pool after being unpoisoned. + if (!IsSupportedAndNotNull(partition_alloc::UntagPtr(unpoisoned_ptr))) { + return wrapped_ptr; + } + // Poison-based OOB checks do not extend to extracted pointers. The + // alternative of retaining poison on extracted pointers could introduce new + // OOB conditions, e.g., in code that extracts an end-of-allocation pointer + // for use in a loop termination condition. The poison bit would make that + // pointer appear to reference a very high address. +#endif // PA_CONFIG(USE_OOB_POISON) + return unpoisoned_ptr; + } + + // Unwraps the pointer, without making an assertion on whether memory was + // freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + // This may be used for unwrapping an end-of-allocation pointer to be used + // as an endpoint in an iterative algorithm, so this removes the OOB poison + // bit. + return UnpoisonPtr(wrapped_ptr); + } + + // Upcasts the wrapped pointer. + template <typename To, typename From> + static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { + static_assert(std::is_convertible<From*, To*>::value, + "From must be convertible to To."); + // Note, this cast may change the address if upcasting to base that lies in + // the middle of the derived object. + return wrapped_ptr; + } + + // Advance the wrapped pointer by `delta_elems`. + template < + typename T, + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { +#if BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) + T* unpoisoned_ptr = UnpoisonPtr(wrapped_ptr); + T* new_ptr = unpoisoned_ptr + delta_elems; + // First check if the new address didn't migrate in/out the BRP pool, and + // that it lands within the same allocation. An end-of-allocation address is + // ok, too, and that may lead to the pointer being poisoned if the relevant + // feature is enabled. These checks add a non-trivial cost, but they're + // cheaper and more secure than the previous implementation that rewrapped + // the pointer (wrapped the new pointer and unwrapped the old one). + // + // Note, the value of these checks goes beyond OOB protection. They're + // important for integrity of the BRP algorithm. Without these, an attacker + // could make the pointer point to another allocation, and cause its + // ref-count to go to 0 upon this pointer's destruction, even though there + // may be another pointer still pointing to it, thus making it lose the BRP + // protection prematurely. + uintptr_t address = partition_alloc::UntagPtr(unpoisoned_ptr); + // TODO(bartekn): Consider adding support for non-BRP pools too (without + // removing the cross-pool migration check). + if (IsSupportedAndNotNull(address)) { + auto ptr_pos_within_alloc = IsValidDelta( + address, delta_elems * static_cast<Z>(sizeof(T)), sizeof(T)); + // No need to check that |new_ptr| is in the same pool, as IsValidDeta() + // checks that it's within the same allocation, so must be the same pool. + PA_BASE_CHECK(ptr_pos_within_alloc != + partition_alloc::PtrPosWithinAlloc::kFarOOB); +#if PA_CONFIG(USE_OOB_POISON) + if (ptr_pos_within_alloc == + partition_alloc::PtrPosWithinAlloc::kAllocEnd) { + new_ptr = PoisonOOBPtr(new_ptr); + } +#endif + } else { + // Check that the new address didn't migrate into the BRP pool, as it + // would result in more pointers pointing to an allocation than its + // ref-count reflects. + PA_BASE_CHECK(!IsSupportedAndNotNull(partition_alloc::UntagPtr(new_ptr))); + } + return new_ptr; +#else // BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) + // In the "before allocation" mode, on 32-bit, we can run into a problem + // that the end-of-allocation address could fall outside of + // PartitionAlloc's pools, if this is the last slot of the super page, + // thus pointing to the guard page. This means the ref-count won't be + // decreased when the pointer is released (leak). + // + // We could possibly solve it in a few different ways: + // - Add the trailing guard page to the pool, but we'd have to think very + // hard if this doesn't create another hole. + // - Add an address adjustment to "is in pool?" check, similar as the one in + // PartitionAllocGetSlotStartInBRPPool(), but that seems fragile, not to + // mention adding an extra instruction to an inlined hot path. + // - Let the leak happen, since it should a very rare condition. + // - Go back to the previous solution of rewrapping the pointer, but that + // had an issue of losing BRP protection in case the pointer ever gets + // shifted back before the end of allocation. + // + // We decided to cross that bridge once we get there... if we ever get + // there. Currently there are no plans to switch back to the "before + // allocation" mode. + // + // This problem doesn't exist in the "previous slot" mode, or any mode that + // involves putting extras after the allocation, because the + // end-of-allocation address belongs to the same slot. + static_assert(false); +#endif // BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) + } + + template <typename T> + static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, + T* wrapped_ptr2) { + T* unpoisoned_ptr1 = UnpoisonPtr(wrapped_ptr1); + T* unpoisoned_ptr2 = UnpoisonPtr(wrapped_ptr2); + uintptr_t address1 = partition_alloc::UntagPtr(unpoisoned_ptr1); + uintptr_t address2 = partition_alloc::UntagPtr(unpoisoned_ptr2); + // Ensure that both pointers are within the same slot, and pool! + // TODO(bartekn): Consider adding support for non-BRP pool too. + if (IsSupportedAndNotNull(address1)) { + PA_BASE_CHECK(IsSupportedAndNotNull(address2)); + PA_BASE_CHECK(IsValidDelta(address2, address1 - address2, sizeof(T)) != + partition_alloc::PtrPosWithinAlloc::kFarOOB); + } else { + PA_BASE_CHECK(!IsSupportedAndNotNull(address2)); + } + return unpoisoned_ptr1 - unpoisoned_ptr2; + } + + // Returns a copy of a wrapped pointer, without making an assertion on whether + // memory was freed or not. + // This method increments the reference count of the allocation slot. + template <typename T> + static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { + return WrapRawPtr(wrapped_ptr); + } + + // Report the current wrapped pointer if pointee isn't alive anymore. + template <typename T> + static PA_ALWAYS_INLINE void ReportIfDangling(T* wrapped_ptr) { + ReportIfDanglingInternal(partition_alloc::UntagPtr(wrapped_ptr)); + } + + // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used + // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + return WrapRawPtr(ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + return UnpoisonPtr(wrapped_ptr); + } + + // This is for accounting only, used by unit tests. + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} + static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} + + private: + // We've evaluated several strategies (inline nothing, various parts, or + // everything in |Wrap()| and |Release()|) using the Speedometer2 benchmark + // to measure performance. The best results were obtained when only the + // lightweight |IsManagedByPartitionAllocBRPPool()| check was inlined. + // Therefore, we've extracted the rest into the functions below and marked + // them as PA_NOINLINE to prevent unintended LTO effects. + static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE + void AcquireInternal(uintptr_t address); + static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE + void ReleaseInternal(uintptr_t address); + static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE + bool IsPointeeAlive(uintptr_t address); + static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE + void ReportIfDanglingInternal(uintptr_t address); + template < + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE partition_alloc::PtrPosWithinAlloc + IsValidDelta(uintptr_t address, Z delta_in_bytes, size_t type_size) { + using delta_t = std::conditional_t<std::is_signed_v<Z>, ptrdiff_t, size_t>; + partition_alloc::internal::PtrDelta<delta_t> ptr_delta(delta_in_bytes, + type_size); + + return IsValidDelta(address, ptr_delta); + } + template <typename Z> + static PA_COMPONENT_EXPORT(RAW_PTR) + PA_NOINLINE partition_alloc::PtrPosWithinAlloc + IsValidDelta(uintptr_t address, + partition_alloc::internal::PtrDelta<Z> delta); +}; + +#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + +#if BUILDFLAG(USE_ASAN_UNOWNED_PTR) + +struct AsanUnownedPtrImpl { + // Wraps a pointer. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + return ptr; + } + + // Notifies the allocator when a wrapped pointer is being removed or replaced. + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* wrapped_ptr) { + ProbeForLowSeverityLifetimeIssue(wrapped_ptr); + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function is allowed to crash on nullptr. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { + // ASAN will catch use of dereferenced ptr without additional probing. + return wrapped_ptr; + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function must handle nullptr gracefully. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + ProbeForLowSeverityLifetimeIssue(wrapped_ptr); + return wrapped_ptr; + } + + // Unwraps the pointer, without making an assertion on whether memory was + // freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + return wrapped_ptr; + } + + // Upcasts the wrapped pointer. + template <typename To, typename From> + static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { + static_assert(std::is_convertible<From*, To*>::value, + "From must be convertible to To."); + // Note, this cast may change the address if upcasting to base that lies in + // the middle of the derived object. + return wrapped_ptr; + } + + // Advance the wrapped pointer by `delta_elems`. + template < + typename T, + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { + return wrapped_ptr + delta_elems; + } + + template <typename T> + static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, + T* wrapped_ptr2) { + return wrapped_ptr1 - wrapped_ptr2; + } + + // Returns a copy of a wrapped pointer, without making an assertion on whether + // memory was freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { + return wrapped_ptr; + } + + template <typename T> + static void ProbeForLowSeverityLifetimeIssue(T* wrapped_ptr) { + if (wrapped_ptr && !LikelySmuggledScalar(wrapped_ptr) && + !EndOfAliveAllocation(wrapped_ptr)) { + reinterpret_cast<const volatile uint8_t*>(wrapped_ptr)[0]; + } + } + + static bool EndOfAliveAllocation(const volatile void* ptr); + static bool LikelySmuggledScalar(const volatile void* ptr); + + // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used + // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + return ptr; + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + return wrapped_ptr; + } + + // This is for accounting only, used by unit tests. + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} + static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} +}; + +#endif // BUILDFLAG(USE_ASAN_UNOWNED_PTR) + +#if BUILDFLAG(USE_HOOKABLE_RAW_PTR) + +struct RawPtrHooks { + using WrapPtr = void(uintptr_t address); + using ReleaseWrappedPtr = void(uintptr_t address); + using SafelyUnwrapForDereference = void(uintptr_t address); + using SafelyUnwrapForExtraction = void(uintptr_t address); + using UnsafelyUnwrapForComparison = void(uintptr_t address); + using Advance = void(uintptr_t old_address, uintptr_t new_address); + using Duplicate = void(uintptr_t address); + + WrapPtr* wrap_ptr; + ReleaseWrappedPtr* release_wrapped_ptr; + SafelyUnwrapForDereference* safely_unwrap_for_dereference; + SafelyUnwrapForExtraction* safely_unwrap_for_extraction; + UnsafelyUnwrapForComparison* unsafely_unwrap_for_comparison; + Advance* advance; + Duplicate* duplicate; +}; + +PA_COMPONENT_EXPORT(RAW_PTR) const RawPtrHooks* GetRawPtrHooks(); +PA_COMPONENT_EXPORT(RAW_PTR) void InstallRawPtrHooks(const RawPtrHooks*); +PA_COMPONENT_EXPORT(RAW_PTR) void ResetRawPtrHooks(); + +struct RawPtrHookableImpl { + // Wraps a pointer. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + GetRawPtrHooks()->wrap_ptr(reinterpret_cast<uintptr_t>(ptr)); + return ptr; + } + + // Notifies the allocator when a wrapped pointer is being removed or replaced. + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* ptr) { + GetRawPtrHooks()->release_wrapped_ptr(reinterpret_cast<uintptr_t>(ptr)); + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function is allowed to crash on nullptr. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { + GetRawPtrHooks()->safely_unwrap_for_dereference( + reinterpret_cast<uintptr_t>(wrapped_ptr)); + return wrapped_ptr; + } + + // Unwraps the pointer, while asserting that memory hasn't been freed. The + // function must handle nullptr gracefully. + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + GetRawPtrHooks()->safely_unwrap_for_extraction( + reinterpret_cast<uintptr_t>(wrapped_ptr)); + return wrapped_ptr; + } + + // Unwraps the pointer, without making an assertion on whether memory was + // freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + GetRawPtrHooks()->unsafely_unwrap_for_comparison( + reinterpret_cast<uintptr_t>(wrapped_ptr)); + return wrapped_ptr; + } + + // Upcasts the wrapped pointer. + template <typename To, typename From> + static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { + static_assert(std::is_convertible<From*, To*>::value, + "From must be convertible to To."); + // Note, this cast may change the address if upcasting to base that lies in + // the middle of the derived object. + return wrapped_ptr; + } + + // Advance the wrapped pointer by `delta_elems`. + template < + typename T, + typename Z, + typename = + std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> + static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { + GetRawPtrHooks()->advance( + reinterpret_cast<uintptr_t>(wrapped_ptr), + reinterpret_cast<uintptr_t>(wrapped_ptr + delta_elems)); + return wrapped_ptr + delta_elems; + } + + template <typename T> + static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, + T* wrapped_ptr2) { + return wrapped_ptr1 - wrapped_ptr2; + } + + // Returns a copy of a wrapped pointer, without making an assertion on whether + // memory was freed or not. + template <typename T> + static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { + GetRawPtrHooks()->duplicate(reinterpret_cast<uintptr_t>(wrapped_ptr)); + return wrapped_ptr; + } + + // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used + // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + return ptr; + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + return wrapped_ptr; + } + + // This is for accounting only, used by unit tests. + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} + static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} +}; + +#endif // BUILDFLAG(USE_HOOKABLE_RAW_PTR) + +// Wraps a raw_ptr/raw_ref implementation, with a class of the same interface +// that provides accounting, for test purposes. raw_ptr/raw_ref that use it +// perform extra bookkeeping, e.g. to track the number of times the raw_ptr is +// wrapped, unrwapped, etc. +// +// Test only. +template <typename Traits> +struct RawPtrCountingImplWrapperForTest + : public raw_ptr_traits::TraitsToImpl<Traits>::Impl { + static_assert(!Traits::kUseCountingWrapperForTest); + + using SuperImpl = typename raw_ptr_traits::TraitsToImpl<Traits>::Impl; + + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { + ++wrap_raw_ptr_cnt; + return SuperImpl::WrapRawPtr(ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* ptr) { + ++release_wrapped_ptr_cnt; + SuperImpl::ReleaseWrappedPtr(ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { + ++get_for_dereference_cnt; + return SuperImpl::SafelyUnwrapPtrForDereference(wrapped_ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { + ++get_for_extraction_cnt; + return SuperImpl::SafelyUnwrapPtrForExtraction(wrapped_ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { + ++get_for_comparison_cnt; + return SuperImpl::UnsafelyUnwrapPtrForComparison(wrapped_ptr); + } + + static PA_ALWAYS_INLINE void IncrementSwapCountForTest() { + ++wrapped_ptr_swap_cnt; + } + + static PA_ALWAYS_INLINE void IncrementLessCountForTest() { + ++wrapped_ptr_less_cnt; + } + + static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() { + ++pointer_to_member_operator_cnt; + } + + template <typename T> + static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { + ++wrap_raw_ptr_for_dup_cnt; + return SuperImpl::WrapRawPtrForDuplication(ptr); + } + + template <typename T> + static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { + ++get_for_duplication_cnt; + return SuperImpl::UnsafelyUnwrapPtrForDuplication(wrapped_ptr); + } + + static void ClearCounters() { + wrap_raw_ptr_cnt = 0; + release_wrapped_ptr_cnt = 0; + get_for_dereference_cnt = 0; + get_for_extraction_cnt = 0; + get_for_comparison_cnt = 0; + wrapped_ptr_swap_cnt = 0; + wrapped_ptr_less_cnt = 0; + pointer_to_member_operator_cnt = 0; + wrap_raw_ptr_for_dup_cnt = 0; + get_for_duplication_cnt = 0; + } + + static inline int wrap_raw_ptr_cnt = INT_MIN; + static inline int release_wrapped_ptr_cnt = INT_MIN; + static inline int get_for_dereference_cnt = INT_MIN; + static inline int get_for_extraction_cnt = INT_MIN; + static inline int get_for_comparison_cnt = INT_MIN; + static inline int wrapped_ptr_swap_cnt = INT_MIN; + static inline int wrapped_ptr_less_cnt = INT_MIN; + static inline int pointer_to_member_operator_cnt = INT_MIN; + static inline int wrap_raw_ptr_for_dup_cnt = INT_MIN; + static inline int get_for_duplication_cnt = INT_MIN; +}; + +} // namespace internal + +namespace raw_ptr_traits { + +// IsSupportedType<T>::value answers whether raw_ptr<T> 1) compiles and 2) is +// always safe at runtime. Templates that may end up using `raw_ptr<T>` should +// use IsSupportedType to ensure that raw_ptr is not used with unsupported +// types. As an example, see how base::internal::StorageTraits uses +// IsSupportedType as a condition for using base::internal::UnretainedWrapper +// (which has a `ptr_` field that will become `raw_ptr<T>` after the Big +// Rewrite). +template <typename T, typename SFINAE = void> +struct IsSupportedType { + static constexpr bool value = true; +}; + +// raw_ptr<T> is not compatible with function pointer types. Also, they don't +// even need the raw_ptr protection, because they don't point on heap. +template <typename T> +struct IsSupportedType<T, std::enable_if_t<std::is_function<T>::value>> { + static constexpr bool value = false; +}; + +// This section excludes some types from raw_ptr<T> to avoid them from being +// used inside base::Unretained in performance sensitive places. These were +// identified from sampling profiler data. See crbug.com/1287151 for more info. +template <> +struct IsSupportedType<cc::Scheduler> { + static constexpr bool value = false; +}; +template <> +struct IsSupportedType<base::internal::DelayTimerBase> { + static constexpr bool value = false; +}; +template <> +struct IsSupportedType<content::responsiveness::Calculator> { + static constexpr bool value = false; +}; + +#if __OBJC__ +// raw_ptr<T> is not compatible with pointers to Objective-C classes for a +// multitude of reasons. They may fail to compile in many cases, and wouldn't +// work well with tagged pointers. Anyway, Objective-C objects have their own +// way of tracking lifespan, hence don't need the raw_ptr protection as much. +// +// Such pointers are detected by checking if they're convertible to |id| type. +template <typename T> +struct IsSupportedType<T, + std::enable_if_t<std::is_convertible<T*, id>::value>> { + static constexpr bool value = false; +}; +#endif // __OBJC__ + +#if BUILDFLAG(IS_WIN) +// raw_ptr<HWND__> is unsafe at runtime - if the handle happens to also +// represent a valid pointer into a PartitionAlloc-managed region then it can +// lead to manipulating random memory when treating it as BackupRefPtr +// ref-count. See also https://crbug.com/1262017. +// +// TODO(https://crbug.com/1262017): Cover other handle types like HANDLE, +// HLOCAL, HINTERNET, or HDEVINFO. Maybe we should avoid using raw_ptr<T> when +// T=void (as is the case in these handle types). OTOH, explicit, +// non-template-based raw_ptr<void> should be allowed. Maybe this can be solved +// by having 2 traits: IsPointeeAlwaysSafe (to be used in templates) and +// IsPointeeUsuallySafe (to be used in the static_assert in raw_ptr). The +// upside of this approach is that it will safely handle base::Bind closing over +// HANDLE. The downside of this approach is that base::Bind closing over a +// void* pointer will not get UaF protection. +#define PA_WINDOWS_HANDLE_TYPE(name) \ + template <> \ + struct IsSupportedType<name##__, void> { \ + static constexpr bool value = false; \ + }; +#include "base/allocator/partition_allocator/partition_alloc_base/win/win_handle_types_list.inc" +#undef PA_WINDOWS_HANDLE_TYPE +#endif + +template <typename Traits> +struct TraitsToImpl { + private: + // UnderlyingImpl is the struct that provides the implementation of the + // protections related to raw_ptr. +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + using UnderlyingImpl = internal::BackupRefPtrImpl< + /*AllowDangling=*/Traits::kMayDangle>; +#elif BUILDFLAG(USE_ASAN_UNOWNED_PTR) + using UnderlyingImpl = + std::conditional_t<Traits::kMayDangle, + // No special bookkeeping required for this case, + // just treat these as ordinary pointers. + internal::RawPtrNoOpImpl, + internal::AsanUnownedPtrImpl>; +#elif PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + using UnderlyingImpl = + std::conditional_t<Traits::kDisableMTECheckedPtr, + internal::RawPtrNoOpImpl, + internal::MTECheckedPtrImpl< + internal::MTECheckedPtrImplPartitionAllocSupport>>; +#elif BUILDFLAG(USE_HOOKABLE_RAW_PTR) + using UnderlyingImpl = std::conditional_t<Traits::kDisableHooks, + internal::RawPtrNoOpImpl, + internal::RawPtrHookableImpl>; +#else + using UnderlyingImpl = internal::RawPtrNoOpImpl; +#endif + + public: + // Impl is the struct that implements raw_ptr functions. Think of raw_ptr as a + // thin wrapper, that directs calls to Impl. + // Impl may be different from UnderlyingImpl, because it may include a + // wrapper. + using Impl = std::conditional_t< + Traits::kUseCountingWrapperForTest, + internal::RawPtrCountingImplWrapperForTest< + typename Traits::template RemoveTraitT<UseCountingWrapperForTest>>, + UnderlyingImpl>; +}; + +} // namespace raw_ptr_traits + +// `raw_ptr<T>` is a non-owning smart pointer that has improved memory-safety +// over raw pointers. It behaves just like a raw pointer on platforms where +// USE_BACKUP_REF_PTR is off, and almost like one when it's on (the main +// difference is that it's zero-initialized and cleared on destruction and +// move). Unlike `std::unique_ptr<T>`, `base::scoped_refptr<T>`, etc., it +// doesn’t manage ownership or lifetime of an allocated object - you are still +// responsible for freeing the object when no longer used, just as you would +// with a raw C++ pointer. +// +// Compared to a raw C++ pointer, on platforms where USE_BACKUP_REF_PTR is on, +// `raw_ptr<T>` incurs additional performance overhead for initialization, +// destruction, and assignment (including `ptr++` and `ptr += ...`). There is +// no overhead when dereferencing a pointer. +// +// `raw_ptr<T>` is beneficial for security, because it can prevent a significant +// percentage of Use-after-Free (UaF) bugs from being exploitable. `raw_ptr<T>` +// has limited impact on stability - dereferencing a dangling pointer remains +// Undefined Behavior. Note that the security protection is not yet enabled by +// default. +// +// raw_ptr<T> is marked as [[gsl::Pointer]] which allows the compiler to catch +// some bugs where the raw_ptr holds a dangling pointer to a temporary object. +// However the [[gsl::Pointer]] analysis expects that such types do not have a +// non-default move constructor/assignment. Thus, it's possible to get an error +// where the pointer is not actually dangling, and have to work around the +// compiler. We have not managed to construct such an example in Chromium yet. +template <typename T, typename Traits = raw_ptr_traits::TraitBundle<>> +class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr { + // Type to return from ExtractAsDangling(), which is identical except + // MayDangle trait is added (if one isn't there already). + using DanglingRawPtrType = + raw_ptr<T, + typename Traits::template AddTraitT<raw_ptr_traits::MayDangle>>; + + public: + using Impl = typename raw_ptr_traits::TraitsToImpl<Traits>::Impl; + +#if !BUILDFLAG(USE_PARTITION_ALLOC) + // See comment at top about `PA_RAW_PTR_CHECK()`. + static_assert(std::is_same_v<Impl, internal::RawPtrNoOpImpl>); +#endif // !BUILDFLAG(USE_PARTITION_ALLOC) + + static_assert(raw_ptr_traits::IsSupportedType<T>::value, + "raw_ptr<T> doesn't work with this kind of pointee type T"); + +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ + BUILDFLAG(USE_ASAN_UNOWNED_PTR) || BUILDFLAG(USE_HOOKABLE_RAW_PTR) + // BackupRefPtr requires a non-trivial default constructor, destructor, etc. + constexpr PA_ALWAYS_INLINE raw_ptr() noexcept : wrapped_ptr_(nullptr) {} + + PA_ALWAYS_INLINE raw_ptr(const raw_ptr& p) noexcept + : wrapped_ptr_(Impl::Duplicate(p.wrapped_ptr_)) {} + + PA_ALWAYS_INLINE raw_ptr(raw_ptr&& p) noexcept { + wrapped_ptr_ = p.wrapped_ptr_; + p.wrapped_ptr_ = nullptr; + } + + PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr& p) noexcept { + // Duplicate before releasing, in case the pointer is assigned to itself. + // + // Unlike the move version of this operator, don't add |this != &p| branch, + // for performance reasons. Even though Duplicate() is not cheap, we + // practically never assign a raw_ptr<T> to itself. We suspect that a + // cumulative cost of a conditional branch, even if always correctly + // predicted, would exceed that. + T* new_ptr = Impl::Duplicate(p.wrapped_ptr_); + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = new_ptr; + return *this; + } + + PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr&& p) noexcept { + // Unlike the the copy version of this operator, this branch is necessaty + // for correctness. + if (PA_LIKELY(this != &p)) { + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = p.wrapped_ptr_; + p.wrapped_ptr_ = nullptr; + } + return *this; + } + + PA_ALWAYS_INLINE ~raw_ptr() noexcept { + Impl::ReleaseWrappedPtr(wrapped_ptr_); + // Work around external issues where raw_ptr is used after destruction. + wrapped_ptr_ = nullptr; + } + +#else // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || + // BUILDFLAG(USE_ASAN_UNOWNED_PTR) || BUILDFLAG(USE_HOOKABLE_RAW_PTR) + + // raw_ptr can be trivially default constructed (leaving |wrapped_ptr_| + // uninitialized). This is needed for compatibility with raw pointers. + // + // TODO(lukasza): Always initialize |wrapped_ptr_|. Fix resulting build + // errors. Analyze performance impact. + constexpr PA_ALWAYS_INLINE raw_ptr() noexcept = default; + + // In addition to nullptr_t ctor above, raw_ptr needs to have these + // as |=default| or |constexpr| to avoid hitting -Wglobal-constructors in + // cases like this: + // struct SomeStruct { int int_field; raw_ptr<int> ptr_field; }; + // SomeStruct g_global_var = { 123, nullptr }; + PA_ALWAYS_INLINE raw_ptr(const raw_ptr&) noexcept = default; + PA_ALWAYS_INLINE raw_ptr(raw_ptr&&) noexcept = default; + PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr&) noexcept = default; + PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr&&) noexcept = default; + + PA_ALWAYS_INLINE ~raw_ptr() noexcept = default; + +#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || + // BUILDFLAG(USE_ASAN_UNOWNED_PTR) + + template < + typename PassedTraits, + typename Unused = std::enable_if_t<!std::is_same_v<Traits, PassedTraits>>> + PA_ALWAYS_INLINE explicit raw_ptr(const raw_ptr<T, PassedTraits>& p) noexcept + : wrapped_ptr_(Impl::WrapRawPtrForDuplication( + raw_ptr_traits::TraitsToImpl<PassedTraits>::Impl:: + UnsafelyUnwrapPtrForDuplication(p.wrapped_ptr_))) {} + + template < + typename PassedTraits, + typename Unused = std::enable_if_t<!std::is_same_v<Traits, PassedTraits>>> + PA_ALWAYS_INLINE raw_ptr& operator=( + const raw_ptr<T, PassedTraits>& p) noexcept { + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = Impl::WrapRawPtrForDuplication( + raw_ptr_traits::TraitsToImpl<PassedTraits>::Impl:: + UnsafelyUnwrapPtrForDuplication(p.wrapped_ptr_)); + return *this; + } + + // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. + // NOLINTNEXTLINE(google-explicit-constructor) + constexpr PA_ALWAYS_INLINE raw_ptr(std::nullptr_t) noexcept + : wrapped_ptr_(nullptr) {} + + // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. + // NOLINTNEXTLINE(google-explicit-constructor) + PA_ALWAYS_INLINE raw_ptr(T* p) noexcept : wrapped_ptr_(Impl::WrapRawPtr(p)) {} + + // Deliberately implicit in order to support implicit upcast. + template <typename U, + typename Unused = std::enable_if_t< + std::is_convertible<U*, T*>::value && + !std::is_void<typename std::remove_cv<T>::type>::value>> + // NOLINTNEXTLINE(google-explicit-constructor) + PA_ALWAYS_INLINE raw_ptr(const raw_ptr<U, Traits>& ptr) noexcept + : wrapped_ptr_( + Impl::Duplicate(Impl::template Upcast<T, U>(ptr.wrapped_ptr_))) {} + // Deliberately implicit in order to support implicit upcast. + template <typename U, + typename Unused = std::enable_if_t< + std::is_convertible<U*, T*>::value && + !std::is_void<typename std::remove_cv<T>::type>::value>> + // NOLINTNEXTLINE(google-explicit-constructor) + PA_ALWAYS_INLINE raw_ptr(raw_ptr<U, Traits>&& ptr) noexcept + : wrapped_ptr_(Impl::template Upcast<T, U>(ptr.wrapped_ptr_)) { +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + ptr.wrapped_ptr_ = nullptr; +#endif + } + + PA_ALWAYS_INLINE raw_ptr& operator=(std::nullptr_t) noexcept { + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = nullptr; + return *this; + } + PA_ALWAYS_INLINE raw_ptr& operator=(T* p) noexcept { + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = Impl::WrapRawPtr(p); + return *this; + } + + // Upcast assignment + template <typename U, + typename Unused = std::enable_if_t< + std::is_convertible<U*, T*>::value && + !std::is_void<typename std::remove_cv<T>::type>::value>> + PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr<U, Traits>& ptr) noexcept { + // Make sure that pointer isn't assigned to itself (look at pointer address, + // not its value). +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + PA_RAW_PTR_CHECK(reinterpret_cast<uintptr_t>(this) != + reinterpret_cast<uintptr_t>(&ptr)); +#endif + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = + Impl::Duplicate(Impl::template Upcast<T, U>(ptr.wrapped_ptr_)); + return *this; + } + template <typename U, + typename Unused = std::enable_if_t< + std::is_convertible<U*, T*>::value && + !std::is_void<typename std::remove_cv<T>::type>::value>> + PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr<U, Traits>&& ptr) noexcept { + // Make sure that pointer isn't assigned to itself (look at pointer address, + // not its value). +#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) + PA_RAW_PTR_CHECK(reinterpret_cast<uintptr_t>(this) != + reinterpret_cast<uintptr_t>(&ptr)); +#endif + Impl::ReleaseWrappedPtr(wrapped_ptr_); + wrapped_ptr_ = Impl::template Upcast<T, U>(ptr.wrapped_ptr_); +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + ptr.wrapped_ptr_ = nullptr; +#endif + return *this; + } + + // Avoid using. The goal of raw_ptr is to be as close to raw pointer as + // possible, so use it only if absolutely necessary (e.g. for const_cast). + PA_ALWAYS_INLINE T* get() const { return GetForExtraction(); } + + constexpr explicit PA_ALWAYS_INLINE operator bool() const { + return !!wrapped_ptr_; + } + + template <typename U = T, + typename Unused = std::enable_if_t< + !std::is_void<typename std::remove_cv<U>::type>::value>> + PA_ALWAYS_INLINE U& operator*() const { + return *GetForDereference(); + } + PA_ALWAYS_INLINE T* operator->() const { return GetForDereference(); } + + // Disables `(my_raw_ptr->*pmf)(...)` as a workaround for + // the ICE in GCC parsing the code, reported at + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103455 + template <typename PMF> + void operator->*(PMF) const = delete; + + // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. + // NOLINTNEXTLINE(runtime/explicit) + PA_ALWAYS_INLINE operator T*() const { return GetForExtraction(); } + template <typename U> + explicit PA_ALWAYS_INLINE operator U*() const { + // This operator may be invoked from static_cast, meaning the types may not + // be implicitly convertible, hence the need for static_cast here. + return static_cast<U*>(GetForExtraction()); + } + + PA_ALWAYS_INLINE raw_ptr& operator++() { + wrapped_ptr_ = Impl::Advance(wrapped_ptr_, 1); + return *this; + } + PA_ALWAYS_INLINE raw_ptr& operator--() { + wrapped_ptr_ = Impl::Advance(wrapped_ptr_, -1); + return *this; + } + PA_ALWAYS_INLINE raw_ptr operator++(int /* post_increment */) { + raw_ptr result = *this; + ++(*this); + return result; + } + PA_ALWAYS_INLINE raw_ptr operator--(int /* post_decrement */) { + raw_ptr result = *this; + --(*this); + return result; + } + template < + typename Z, + typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> + PA_ALWAYS_INLINE raw_ptr& operator+=(Z delta_elems) { + wrapped_ptr_ = Impl::Advance(wrapped_ptr_, delta_elems); + return *this; + } + template < + typename Z, + typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> + PA_ALWAYS_INLINE raw_ptr& operator-=(Z delta_elems) { + return *this += -delta_elems; + } + + template < + typename Z, + typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> + friend PA_ALWAYS_INLINE raw_ptr operator+(const raw_ptr& p, Z delta_elems) { + raw_ptr result = p; + return result += delta_elems; + } + template < + typename Z, + typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> + friend PA_ALWAYS_INLINE raw_ptr operator-(const raw_ptr& p, Z delta_elems) { + raw_ptr result = p; + return result -= delta_elems; + } + friend PA_ALWAYS_INLINE ptrdiff_t operator-(const raw_ptr& p1, + const raw_ptr& p2) { + return Impl::GetDeltaElems(p1.wrapped_ptr_, p2.wrapped_ptr_); + } + friend PA_ALWAYS_INLINE ptrdiff_t operator-(T* p1, const raw_ptr& p2) { + return Impl::GetDeltaElems(p1, p2.wrapped_ptr_); + } + friend PA_ALWAYS_INLINE ptrdiff_t operator-(const raw_ptr& p1, T* p2) { + return Impl::GetDeltaElems(p1.wrapped_ptr_, p2); + } + + // Stop referencing the underlying pointer and free its memory. Compared to + // raw delete calls, this avoids the raw_ptr to be temporarily dangling + // during the free operation, which will lead to taking the slower path that + // involves quarantine. + PA_ALWAYS_INLINE void ClearAndDelete() noexcept { + delete GetForExtractionAndReset(); + } + PA_ALWAYS_INLINE void ClearAndDeleteArray() noexcept { + delete[] GetForExtractionAndReset(); + } + + // Clear the underlying pointer and return another raw_ptr instance + // that is allowed to dangle. + // This can be useful in cases such as: + // ``` + // ptr.ExtractAsDangling()->SelfDestroy(); + // ``` + // ``` + // c_style_api_do_something_and_destroy(ptr.ExtractAsDangling()); + // ``` + // NOTE, avoid using this method as it indicates an error-prone memory + // ownership pattern. If possible, use smart pointers like std::unique_ptr<> + // instead of raw_ptr<>. + // If you have to use it, avoid saving the return value in a long-lived + // variable (or worse, a field)! It's meant to be used as a temporary, to be + // passed into a cleanup & freeing function, and destructed at the end of the + // statement. + PA_ALWAYS_INLINE DanglingRawPtrType ExtractAsDangling() noexcept { + if constexpr (std::is_same_v< + typename std::remove_reference<decltype(*this)>::type, + DanglingRawPtrType>) { + DanglingRawPtrType res(std::move(*this)); + // Not all implementation clear the source pointer on move, so do it + // here just in case. Should be cheap. + operator=(nullptr); + return res; + } else { + T* ptr = GetForExtraction(); + DanglingRawPtrType res(ptr); + operator=(nullptr); + return res; + } + } + + // Comparison operators between raw_ptr and raw_ptr<U>/U*/std::nullptr_t. + // Strictly speaking, it is not necessary to provide these: the compiler can + // use the conversion operator implicitly to allow comparisons to fall back to + // comparisons between raw pointers. However, `operator T*`/`operator U*` may + // perform safety checks with a higher runtime cost, so to avoid this, provide + // explicit comparison operators for all combinations of parameters. + + // Comparisons between `raw_ptr`s. This unusual declaration and separate + // definition below is because `GetForComparison()` is a private method. The + // more conventional approach of defining a comparison operator between + // `raw_ptr` and `raw_ptr<U>` in the friend declaration itself does not work, + // because a comparison operator defined inline would not be allowed to call + // `raw_ptr<U>`'s private `GetForComparison()` method. + template <typename U, typename V, typename R1, typename R2> + friend PA_ALWAYS_INLINE bool operator==(const raw_ptr<U, R1>& lhs, + const raw_ptr<V, R2>& rhs); + template <typename U> + friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, + const raw_ptr<U, Traits>& rhs) { + return !(lhs == rhs); + } + template <typename U, typename V, typename R> + friend PA_ALWAYS_INLINE bool operator<(const raw_ptr<U, R>& lhs, + const raw_ptr<V, R>& rhs); + template <typename U, typename V, typename R> + friend PA_ALWAYS_INLINE bool operator>(const raw_ptr<U, R>& lhs, + const raw_ptr<V, R>& rhs); + template <typename U, typename V, typename R> + friend PA_ALWAYS_INLINE bool operator<=(const raw_ptr<U, R>& lhs, + const raw_ptr<V, R>& rhs); + template <typename U, typename V, typename R> + friend PA_ALWAYS_INLINE bool operator>=(const raw_ptr<U, R>& lhs, + const raw_ptr<V, R>& rhs); + + // Comparisons with U*. These operators also handle the case where the RHS is + // T*. + template <typename U> + friend PA_ALWAYS_INLINE bool operator==(const raw_ptr& lhs, U* rhs) { + return lhs.GetForComparison() == rhs; + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, U* rhs) { + return !(lhs == rhs); + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator==(U* lhs, const raw_ptr& rhs) { + return rhs == lhs; // Reverse order to call the operator above. + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator!=(U* lhs, const raw_ptr& rhs) { + return rhs != lhs; // Reverse order to call the operator above. + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator<(const raw_ptr& lhs, U* rhs) { + return lhs.GetForComparison() < rhs; + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator<=(const raw_ptr& lhs, U* rhs) { + return lhs.GetForComparison() <= rhs; + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator>(const raw_ptr& lhs, U* rhs) { + return lhs.GetForComparison() > rhs; + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator>=(const raw_ptr& lhs, U* rhs) { + return lhs.GetForComparison() >= rhs; + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator<(U* lhs, const raw_ptr& rhs) { + return lhs < rhs.GetForComparison(); + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator<=(U* lhs, const raw_ptr& rhs) { + return lhs <= rhs.GetForComparison(); + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator>(U* lhs, const raw_ptr& rhs) { + return lhs > rhs.GetForComparison(); + } + template <typename U> + friend PA_ALWAYS_INLINE bool operator>=(U* lhs, const raw_ptr& rhs) { + return lhs >= rhs.GetForComparison(); + } + + // Comparisons with `std::nullptr_t`. + friend PA_ALWAYS_INLINE bool operator==(const raw_ptr& lhs, std::nullptr_t) { + return !lhs; + } + friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, std::nullptr_t) { + return !!lhs; // Use !! otherwise the costly implicit cast will be used. + } + friend PA_ALWAYS_INLINE bool operator==(std::nullptr_t, const raw_ptr& rhs) { + return !rhs; + } + friend PA_ALWAYS_INLINE bool operator!=(std::nullptr_t, const raw_ptr& rhs) { + return !!rhs; // Use !! otherwise the costly implicit cast will be used. + } + + friend PA_ALWAYS_INLINE void swap(raw_ptr& lhs, raw_ptr& rhs) noexcept { + Impl::IncrementSwapCountForTest(); + std::swap(lhs.wrapped_ptr_, rhs.wrapped_ptr_); + } + + PA_ALWAYS_INLINE void ReportIfDangling() const noexcept { +#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) + Impl::ReportIfDangling(wrapped_ptr_); +#endif + } + + private: + // This getter is meant for situations where the pointer is meant to be + // dereferenced. It is allowed to crash on nullptr (it may or may not), + // because it knows that the caller will crash on nullptr. + PA_ALWAYS_INLINE T* GetForDereference() const { + return Impl::SafelyUnwrapPtrForDereference(wrapped_ptr_); + } + // This getter is meant for situations where the raw pointer is meant to be + // extracted outside of this class, but not necessarily with an intention to + // dereference. It mustn't crash on nullptr. + PA_ALWAYS_INLINE T* GetForExtraction() const { + return Impl::SafelyUnwrapPtrForExtraction(wrapped_ptr_); + } + // This getter is meant *only* for situations where the pointer is meant to be + // compared (guaranteeing no dereference or extraction outside of this class). + // Any verifications can and should be skipped for performance reasons. + PA_ALWAYS_INLINE T* GetForComparison() const { + return Impl::UnsafelyUnwrapPtrForComparison(wrapped_ptr_); + } + + PA_ALWAYS_INLINE T* GetForExtractionAndReset() { + T* ptr = GetForExtraction(); + operator=(nullptr); + return ptr; + } + + // This field is not a raw_ptr<> because it was filtered by the rewriter for: + // #union, #global-scope, #constexpr-ctor-field-initializer + RAW_PTR_EXCLUSION T* wrapped_ptr_; + + template <typename U, typename R> + friend class raw_ptr; +}; + +template <typename U, typename V, typename Traits1, typename Traits2> +PA_ALWAYS_INLINE bool operator==(const raw_ptr<U, Traits1>& lhs, + const raw_ptr<V, Traits2>& rhs) { + return lhs.GetForComparison() == rhs.GetForComparison(); +} + +template <typename U, typename V, typename Traits> +PA_ALWAYS_INLINE bool operator<(const raw_ptr<U, Traits>& lhs, + const raw_ptr<V, Traits>& rhs) { + return lhs.GetForComparison() < rhs.GetForComparison(); +} + +template <typename U, typename V, typename Traits> +PA_ALWAYS_INLINE bool operator>(const raw_ptr<U, Traits>& lhs, + const raw_ptr<V, Traits>& rhs) { + return lhs.GetForComparison() > rhs.GetForComparison(); +} + +template <typename U, typename V, typename Traits> +PA_ALWAYS_INLINE bool operator<=(const raw_ptr<U, Traits>& lhs, + const raw_ptr<V, Traits>& rhs) { + return lhs.GetForComparison() <= rhs.GetForComparison(); +} + +template <typename U, typename V, typename Traits> +PA_ALWAYS_INLINE bool operator>=(const raw_ptr<U, Traits>& lhs, + const raw_ptr<V, Traits>& rhs) { + return lhs.GetForComparison() >= rhs.GetForComparison(); +} + +template <typename T> +struct IsRawPtr : std::false_type {}; + +template <typename T, typename Traits> +struct IsRawPtr<raw_ptr<T, Traits>> : std::true_type {}; + +template <typename T> +inline constexpr bool IsRawPtrV = IsRawPtr<T>::value; + +template <typename T> +inline constexpr bool IsRawPtrMayDangleV = false; + +template <typename T, typename Traits> +inline constexpr bool IsRawPtrMayDangleV<raw_ptr<T, Traits>> = + Traits::kMayDangle; + +// Template helpers for working with T* or raw_ptr<T>. +template <typename T> +struct IsPointer : std::false_type {}; + +template <typename T> +struct IsPointer<T*> : std::true_type {}; + +template <typename T, typename Traits> +struct IsPointer<raw_ptr<T, Traits>> : std::true_type {}; + +template <typename T> +inline constexpr bool IsPointerV = IsPointer<T>::value; + +template <typename T> +struct RemovePointer { + using type = T; +}; + +template <typename T> +struct RemovePointer<T*> { + using type = T; +}; + +template <typename T, typename Traits> +struct RemovePointer<raw_ptr<T, Traits>> { + using type = T; +}; + +template <typename T> +using RemovePointerT = typename RemovePointer<T>::type; + +} // namespace base + +using base::raw_ptr; + +// DisableDanglingPtrDetection option for raw_ptr annotates +// "intentional-and-safe" dangling pointers. It is meant to be used at the +// margin, only if there is no better way to re-architecture the code. +// +// Usage: +// raw_ptr<T, DisableDanglingPtrDetection> dangling_ptr; +// +// When using it, please provide a justification about what guarantees that it +// will never be dereferenced after becoming dangling. +using DisableDanglingPtrDetection = + base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>; + +// See `docs/dangling_ptr.md` +// Annotates known dangling raw_ptr. Those haven't been triaged yet. All the +// occurrences are meant to be removed. See https://crbug.com/1291138. +using DanglingUntriaged = + base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>; + +// This type is to be used in callbacks arguments when it is known that they +// might receive dangling pointers. In any other cases, please use one of: +// - raw_ptr<T, DanglingUntriaged> +// - raw_ptr<T, DisableDanglingPtrDetection> +template <typename T> +using MayBeDangling = base::raw_ptr< + T, + base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>>; + +// The following template parameters are only meaningful when `raw_ptr` +// is `MTECheckedPtr` (never the case unless a particular GN arg is set +// true.) `raw_ptr` users need not worry about this and can refer solely +// to `DisableDanglingPtrDetection` and `DanglingUntriaged` above. +// +// The `raw_ptr` definition allows users to specify an implementation. +// When `MTECheckedPtr` is in play, we need to augment this +// implementation setting with another layer that allows the `raw_ptr` +// to degrade into the no-op version. +// +// See `base/memory/raw_ptr_mtecheckedptr.md` + +// Direct pass-through to no-op implementation. +using DegradeToNoOpWhenMTE = base::raw_ptr_traits::TraitBundle< + base::raw_ptr_traits::DisableMTECheckedPtr>; + +// As above, but with the "untriaged dangling" annotation. +using DanglingUntriagedDegradeToNoOpWhenMTE = base::raw_ptr_traits::TraitBundle< + base::raw_ptr_traits::MayDangle, + base::raw_ptr_traits::DisableMTECheckedPtr>; + +// As above, but with the "explicitly disable protection" annotation. +using DisableDanglingPtrDetectionDegradeToNoOpWhenMTE = + base::raw_ptr_traits::TraitBundle< + base::raw_ptr_traits::MayDangle, + base::raw_ptr_traits::DisableMTECheckedPtr>; + +namespace std { + +// Override so set/map lookups do not create extra raw_ptr. This also allows +// dangling pointers to be used for lookup. +template <typename T, typename Traits> +struct less<raw_ptr<T, Traits>> { + using Impl = typename raw_ptr<T, Traits>::Impl; + using is_transparent = void; + + bool operator()(const raw_ptr<T, Traits>& lhs, + const raw_ptr<T, Traits>& rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } + + bool operator()(T* lhs, const raw_ptr<T, Traits>& rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } + + bool operator()(const raw_ptr<T, Traits>& lhs, T* rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } +}; + +// Define for cases where raw_ptr<T> holds a pointer to an array of type T. +// This is consistent with definition of std::iterator_traits<T*>. +// Algorithms like std::binary_search need that. +template <typename T, typename Traits> +struct iterator_traits<raw_ptr<T, Traits>> { + using difference_type = ptrdiff_t; + using value_type = std::remove_cv_t<T>; + using pointer = T*; + using reference = T&; + using iterator_category = std::random_access_iterator_tag; +}; + +} // namespace std + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_PTR_H_
diff --git a/base/allocator/partition_allocator/pointers/raw_ref.h b/base/allocator/partition_allocator/pointers/raw_ref.h new file mode 100644 index 0000000..28f319a --- /dev/null +++ b/base/allocator/partition_allocator/pointers/raw_ref.h
@@ -0,0 +1,372 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_REF_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_REF_H_ + +#include <memory> +#include <type_traits> +#include <utility> + +#include "base/allocator/partition_allocator/partition_alloc_base/augmentations/compiler_specific.h" +#include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_config.h" +#include "base/allocator/partition_allocator/pointers/raw_ptr.h" + +namespace base { + +template <class T, typename Traits> +class raw_ref; + +namespace internal { + +template <class T> +struct is_raw_ref : std::false_type {}; + +template <class T, typename Traits> +struct is_raw_ref<::base::raw_ref<T, Traits>> : std::true_type {}; + +template <class T> +constexpr inline bool is_raw_ref_v = is_raw_ref<T>::value; + +} // namespace internal + +// A smart pointer for a pointer which can not be null, and which provides +// Use-after-Free protection in the same ways as raw_ptr. This class acts like a +// combination of std::reference_wrapper and raw_ptr. +// +// See raw_ptr and //base/memory/raw_ptr.md for more details on the +// Use-after-Free protection. +// +// # Use after move +// +// The raw_ref type will abort if used after being moved. +// +// # Constness +// +// Use a `const raw_ref<T>` when the smart pointer should not be able to rebind +// to a new reference. Use a `const raw_ref<const T>` do the same for a const +// reference, which is like `const T&`. +// +// Unlike a native `T&` reference, a mutable `raw_ref<T>` can be changed +// independent of the underlying `T`, similar to `std::reference_wrapper`. That +// means the reference inside it can be moved and reassigned. +template <class T, typename Traits = raw_ptr_traits::TraitBundle<>> +class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ref { + // operator* is used with the expectation of GetForExtraction semantics: + // + // raw_ref<Foo> foo_raw_ref = something; + // Foo& foo_ref = *foo_raw_ref; + // + // The implementation of operator* provides GetForDereference semantics, and + // this results in spurious crashes in BRP-ASan builds, so we need to disable + // hooks that provide BRP-ASan instrumentation for raw_ref. + using Inner = raw_ptr< + T, + typename Traits::template AddTraitT<raw_ptr_traits::DisableHooks>>; + + public: + using Impl = typename Inner::Impl; + + // These impls do not clear on move, which produces an inconsistent behaviour. + // We want consistent behaviour such that using a raw_ref after move is caught + // and aborts. Failure to clear would be indicated by the related death tests + // not CHECKing appropriately. + static constexpr bool need_clear_after_move = +#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) + std::is_same_v<Impl, + internal::MTECheckedPtrImpl< + internal::MTECheckedPtrImplPartitionAllocSupport>> || +#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) +#if BUILDFLAG(USE_ASAN_UNOWNED_PTR) + std::is_same_v<Impl, internal::AsanUnownedPtrImpl> || +#endif // BUILDFLAG(USE_ASAN_UNOWNED_PTR) + std::is_same_v<Impl, internal::RawPtrNoOpImpl>; + + PA_ALWAYS_INLINE explicit raw_ref(T& p) noexcept + : inner_(std::addressof(p)) {} + + PA_ALWAYS_INLINE raw_ref& operator=(T& p) noexcept { + inner_.operator=(&p); + return *this; + } + + // Disallow holding references to temporaries. + raw_ref(const T&& p) = delete; + raw_ref& operator=(const T&& p) = delete; + + PA_ALWAYS_INLINE raw_ref(const raw_ref& p) noexcept : inner_(p.inner_) { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + } + + PA_ALWAYS_INLINE raw_ref(raw_ref&& p) noexcept : inner_(std::move(p.inner_)) { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + if constexpr (need_clear_after_move) { + p.inner_ = nullptr; + } + } + + PA_ALWAYS_INLINE raw_ref& operator=(const raw_ref& p) noexcept { + PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. + inner_.operator=(p.inner_); + return *this; + } + + PA_ALWAYS_INLINE raw_ref& operator=(raw_ref&& p) noexcept { + PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. + inner_.operator=(std::move(p.inner_)); + if constexpr (need_clear_after_move) { + p.inner_ = nullptr; + } + return *this; + } + + // Deliberately implicit in order to support implicit upcast. + template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> + // NOLINTNEXTLINE(google-explicit-constructor) + PA_ALWAYS_INLINE raw_ref(const raw_ref<U, Traits>& p) noexcept + : inner_(p.inner_) { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + } + // Deliberately implicit in order to support implicit upcast. + template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> + // NOLINTNEXTLINE(google-explicit-constructor) + PA_ALWAYS_INLINE raw_ref(raw_ref<U, Traits>&& p) noexcept + : inner_(std::move(p.inner_)) { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + if constexpr (need_clear_after_move) { + p.inner_ = nullptr; + } + } + + static PA_ALWAYS_INLINE raw_ref from_ptr(T* ptr) noexcept { + PA_RAW_PTR_CHECK(ptr); + return raw_ref(*ptr); + } + + // Upcast assignment + template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> + PA_ALWAYS_INLINE raw_ref& operator=(const raw_ref<U, Traits>& p) noexcept { + PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. + inner_.operator=(p.inner_); + return *this; + } + template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> + PA_ALWAYS_INLINE raw_ref& operator=(raw_ref<U, Traits>&& p) noexcept { + PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. + inner_.operator=(std::move(p.inner_)); + if constexpr (need_clear_after_move) { + p.inner_ = nullptr; + } + return *this; + } + + PA_ALWAYS_INLINE T& operator*() const { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + return inner_.operator*(); + } + + // This is an equivalent to operator*() that provides GetForExtraction rather + // rather than GetForDereference semantics (see raw_ptr.h). This should be + // used in place of operator*() when the memory referred to by the reference + // is not immediately going to be accessed. + PA_ALWAYS_INLINE T& get() const { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + return *inner_.get(); + } + + PA_ALWAYS_INLINE T* operator->() const PA_ATTRIBUTE_RETURNS_NONNULL { + PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. + return inner_.operator->(); + } + + // This is used to verify callbacks are not invoked with dangling references. + // If the `raw_ref` references a deleted object, it will trigger an error. + // Depending on the PartitionAllocUnretainedDanglingPtr feature, this is + // either a DumpWithoutCrashing, a crash, or ignored. + PA_ALWAYS_INLINE void ReportIfDangling() const noexcept { + inner_.ReportIfDangling(); + } + + friend PA_ALWAYS_INLINE void swap(raw_ref& lhs, raw_ref& rhs) noexcept { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + swap(lhs.inner_, rhs.inner_); + } + + template <class U> + friend PA_ALWAYS_INLINE bool operator==(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ == rhs.inner_; + } + template <class U> + friend PA_ALWAYS_INLINE bool operator!=(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ != rhs.inner_; + } + template <class U> + friend PA_ALWAYS_INLINE bool operator<(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ < rhs.inner_; + } + template <class U> + friend PA_ALWAYS_INLINE bool operator>(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ > rhs.inner_; + } + template <class U> + friend PA_ALWAYS_INLINE bool operator<=(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ <= rhs.inner_; + } + template <class U> + friend PA_ALWAYS_INLINE bool operator>=(const raw_ref& lhs, + const raw_ref<U, Traits>& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ >= rhs.inner_; + } + + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator==(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ == &rhs; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator!=(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ != &rhs; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator<(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ < &rhs; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator>(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ > &rhs; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator<=(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ <= &rhs; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator>=(const raw_ref& lhs, const U& rhs) { + PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. + return lhs.inner_ >= &rhs; + } + + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator==(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs == rhs.inner_; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator!=(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs != rhs.inner_; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator<(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs < rhs.inner_; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator>(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs > rhs.inner_; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator<=(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs <= rhs.inner_; + } + template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> + friend PA_ALWAYS_INLINE bool operator>=(const U& lhs, const raw_ref& rhs) { + PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. + return &lhs >= rhs.inner_; + } + + private: + template <class U, typename R> + friend class raw_ref; + + Inner inner_; +}; + +// CTAD deduction guide. +template <class T> +raw_ref(T&) -> raw_ref<T>; +template <class T> +raw_ref(const T&) -> raw_ref<const T>; + +// Template helpers for working with raw_ref<T>. +template <typename T> +struct IsRawRef : std::false_type {}; + +template <typename T, typename Traits> +struct IsRawRef<raw_ref<T, Traits>> : std::true_type {}; + +template <typename T> +inline constexpr bool IsRawRefV = IsRawRef<T>::value; + +template <typename T> +struct RemoveRawRef { + using type = T; +}; + +template <typename T, typename Traits> +struct RemoveRawRef<raw_ref<T, Traits>> { + using type = T; +}; + +template <typename T> +using RemoveRawRefT = typename RemoveRawRef<T>::type; + +} // namespace base + +using base::raw_ref; + +namespace std { + +// Override so set/map lookups do not create extra raw_ref. This also +// allows C++ references to be used for lookup. +template <typename T, typename Traits> +struct less<raw_ref<T, Traits>> { + using Impl = typename raw_ref<T, Traits>::Impl; + using is_transparent = void; + + bool operator()(const raw_ref<T, Traits>& lhs, + const raw_ref<T, Traits>& rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } + + bool operator()(T& lhs, const raw_ref<T, Traits>& rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } + + bool operator()(const raw_ref<T, Traits>& lhs, T& rhs) const { + Impl::IncrementLessCountForTest(); + return lhs < rhs; + } +}; + +} // namespace std + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_POINTERS_RAW_REF_H_
diff --git a/base/check_unittest.cc b/base/check_unittest.cc index 8a7a583..71560c2 100644 --- a/base/check_unittest.cc +++ b/base/check_unittest.cc
@@ -453,7 +453,7 @@ #if DCHECK_IS_ON() // Expect a DCHECK with streamed params intact. EXPECT_DCHECK("Check failed: false. foo", NOTREACHED() << "foo"); -#elif CHECK_WILL_STREAM() +#elif CHECK_WILL_STREAM() || BUILDFLAG(ENABLE_LOG_ERROR_NOT_REACHED) // Expect LOG(ERROR) that looks like CHECK(false) with streamed params intact. EXPECT_LOG_ERROR(__LINE__, NOTREACHED() << "foo", "Check failed: false. foo\n");
diff --git a/base/memory/raw_ptr.h b/base/memory/raw_ptr.h index 1660a76..03acb73 100644 --- a/base/memory/raw_ptr.h +++ b/base/memory/raw_ptr.h
@@ -1,1986 +1,13 @@ -// Copyright 2020 The Chromium Authors +// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_MEMORY_RAW_PTR_H_ #define BASE_MEMORY_RAW_PTR_H_ -#include <stddef.h> -#include <stdint.h> - -#include <climits> -#include <cstddef> -#include <functional> -#include <type_traits> -#include <utility> - -#include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" -#include "base/allocator/partition_allocator/partition_alloc_base/component_export.h" -#include "base/allocator/partition_allocator/partition_alloc_base/debug/debugging_buildflags.h" -#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" -#include "base/allocator/partition_allocator/partition_alloc_config.h" -#include "base/allocator/partition_allocator/partition_alloc_forward.h" -#include "base/memory/raw_ptr_exclusion.h" -#include "build/build_config.h" -#include "build/buildflag.h" - -#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -#include "base/allocator/partition_allocator/partition_tag.h" -#include "base/allocator/partition_allocator/partition_tag_types.h" -#include "base/allocator/partition_allocator/tagging.h" -#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ - PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -// USE_BACKUP_REF_PTR implies USE_PARTITION_ALLOC, needed for code under -// allocator/partition_allocator/ to be built. -#include "base/allocator/partition_allocator/address_pool_manager_bitmap.h" -#include "base/allocator/partition_allocator/partition_address_space.h" -#include "base/allocator/partition_allocator/partition_alloc_constants.h" -#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || - // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - -#if BUILDFLAG(IS_WIN) -#include "base/allocator/partition_allocator/partition_alloc_base/win/win_handle_types.h" -#endif - -#if BUILDFLAG(USE_PARTITION_ALLOC) -#include "base/allocator/partition_allocator/partition_alloc_base/check.h" -// Live implementation of MiraclePtr being built. -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ - BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) || \ - PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -#define PA_RAW_PTR_CHECK(condition) PA_BASE_CHECK(condition) -#else -// No-op implementation of MiraclePtr being built. -// Note that `PA_BASE_DCHECK()` evaporates from non-DCHECK builds, -// minimizing impact of generated code. -#define PA_RAW_PTR_CHECK(condition) PA_BASE_DCHECK(condition) -#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || - // BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) || - // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -#else // BUILDFLAG(USE_PARTITION_ALLOC) -// Without PartitionAlloc, there's no `PA_BASE_D?CHECK()` implementation -// available. -#define PA_RAW_PTR_CHECK(condition) -#endif // BUILDFLAG(USE_PARTITION_ALLOC) - -namespace cc { -class Scheduler; -} -namespace base::internal { -class DelayTimerBase; -} -namespace content::responsiveness { -class Calculator; -} - -namespace base { - -// NOTE: All methods should be `PA_ALWAYS_INLINE`. raw_ptr is meant to be a -// lightweight replacement of a raw pointer, hence performance is critical. - -namespace raw_ptr_traits { - -// Disables dangling pointer detection, but keeps other raw_ptr protections. -// Don't use directly, use DisableDanglingPtrDetection or DanglingUntriaged -// instead. -struct MayDangle {}; -// Disables any protections when MTECheckedPtrImpl is requested, by switching to -// NoOpImpl in that case. -// Don't use directly, use DegradeToNoOpWhenMTE instead. -struct DisableMTECheckedPtr {}; -// Disables any hooks, by switching to NoOpImpl in that case. -// Internal use only. -struct DisableHooks {}; -// Adds accounting, on top of the chosen implementation, for test purposes. -// raw_ptr/raw_ref with this trait perform extra bookkeeping, e.g. to track the -// number of times the raw_ptr is wrapped, unrwapped, etc. -// Test only. -struct UseCountingWrapperForTest {}; -// Very internal use only. -using EmptyTrait = void; - -template <typename Trait> -inline constexpr bool IsValidTraitV = - std::is_same_v<Trait, MayDangle> || - std::is_same_v<Trait, DisableMTECheckedPtr> || - std::is_same_v<Trait, DisableHooks> || - std::is_same_v<Trait, UseCountingWrapperForTest> || - std::is_same_v<Trait, EmptyTrait>; - -template <typename... Traits> -struct TraitPack { - static_assert((IsValidTraitV<Traits> && ...), "Unknown raw_ptr trait"); - - template <typename TraitToSearch> - static inline constexpr bool HasV = - (std::is_same_v<TraitToSearch, Traits> || ...); -}; - -// Replaces an unwanted trait with EmptyTrait. -template <typename TraitToExclude> -struct ExcludeTrait { - template <typename Trait> - using Filter = std:: - conditional_t<std::is_same_v<TraitToExclude, Trait>, EmptyTrait, Trait>; -}; - -// Use TraitBundle alias, instead of TraitBundleInt, so that traits in different -// order and duplicates resolve to the same underlying type. For example, -// TraitBundle<A,B> is the same C++ type as TraitBundle<B,A,B,A>. This also -// allows to entirely ignore a trait under some build configurations, to prevent -// it from turning TraitBundle into a different C++ type. -// -// It'd be easier to just pass bools into TraitBundleInt, instead of echo'ing -// the trait, but that would lead to less readable compiler messages that spit -// out the type. TraitBundleInt<MayDangle,EmptyTrait,DisableHooks,EmptyTrait> is -// more readable than TraitBundleInt<true,false,true,false>. -template <typename... Traits> -struct TraitBundleInt; -template <typename... Traits> -using TraitBundle = TraitBundleInt< - std::conditional_t<TraitPack<Traits...>::template HasV<MayDangle>, - MayDangle, - EmptyTrait>, -#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - std::conditional_t< - TraitPack<Traits...>::template HasV<DisableMTECheckedPtr>, - DisableMTECheckedPtr, - EmptyTrait>, -#else - // Entirely ignore DisableMTECheckedPtr on non-MTECheckedPtr builds, so that - // TraitBundle (and thus raw_ptr/raw_ref) with that trait is considered - // exactly the same type as without it. This matches the long standing - // behavior prior to crrev.com/c/4113514. - EmptyTrait, -#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -#if BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) - std::conditional_t<TraitPack<Traits...>::template HasV<DisableHooks>, - DisableHooks, - EmptyTrait>, -#else - // Entirely ignore DisableHooks on non-ASanBRP builds, so that - // TraitBundle (and thus raw_ptr/raw_ref) with that trait is considered - // exactly the same type as without it. This matches the long standing - // behavior prior to crrev.com/c/4113514. - EmptyTrait, -#endif // BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) - std::conditional_t< - TraitPack<Traits...>::template HasV<UseCountingWrapperForTest>, - UseCountingWrapperForTest, - EmptyTrait>>; - -template <typename... Traits> -struct TraitBundleInt { - static constexpr bool kMayDangle = - TraitPack<Traits...>::template HasV<MayDangle>; - static constexpr bool kDisableMTECheckedPtr = - TraitPack<Traits...>::template HasV<DisableMTECheckedPtr>; - static constexpr bool kDisableHooks = - TraitPack<Traits...>::template HasV<DisableHooks>; - static constexpr bool kUseCountingWrapperForTest = - TraitPack<Traits...>::template HasV<UseCountingWrapperForTest>; - - // Assert that on certain build configurations, the related traits are not - // even used. If they were, they'd result in a different C++ type, and would - // trigger more costly cross-type raw_ptr/raw_ref conversions. -#if !PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - static_assert(!kDisableMTECheckedPtr); -#endif -#if !BUILDFLAG(USE_ASAN_BACKUP_REF_PTR) - static_assert(!kDisableHooks); -#endif - - // Use TraitBundle, instead of TraitBundleInt, to re-normalize trait list - // (i.e. order canonically and remove duplicates). - template <typename TraitToAdd> - using AddTraitT = TraitBundle<Traits..., TraitToAdd>; - // Unlike AddTraitT, no need to re-normalize because ExcludeTrait preserves - // the trait list structure. - template <typename TraitToRemove> - using RemoveTraitT = TraitBundleInt< - typename ExcludeTrait<TraitToRemove>::template Filter<Traits>...>; -}; - -template <typename TraitBundle> -struct TraitsToImpl; - -} // namespace raw_ptr_traits - -namespace internal { -// These classes/structures are part of the raw_ptr implementation. -// DO NOT USE THESE CLASSES DIRECTLY YOURSELF. - -struct RawPtrNoOpImpl { - // Wraps a pointer. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - return ptr; - } - - // Notifies the allocator when a wrapped pointer is being removed or replaced. - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T*) {} - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function is allowed to crash on nullptr. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { - return wrapped_ptr; - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function must handle nullptr gracefully. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - return wrapped_ptr; - } - - // Unwraps the pointer, without making an assertion on whether memory was - // freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - return wrapped_ptr; - } - - // Upcasts the wrapped pointer. - template <typename To, typename From> - static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { - static_assert(std::is_convertible<From*, To*>::value, - "From must be convertible to To."); - // Note, this cast may change the address if upcasting to base that lies in - // the middle of the derived object. - return wrapped_ptr; - } - - // Advance the wrapped pointer by `delta_elems`. - template < - typename T, - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { - return wrapped_ptr + delta_elems; - } - - template <typename T> - static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, - T* wrapped_ptr2) { - return wrapped_ptr1 - wrapped_ptr2; - } - - // Returns a copy of a wrapped pointer, without making an assertion on whether - // memory was freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { - return wrapped_ptr; - } - - // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used - // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - return ptr; - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - return wrapped_ptr; - } - - // This is for accounting only, used by unit tests. - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} - static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} -}; - -#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - -constexpr int kValidAddressBits = 48; -constexpr uintptr_t kAddressMask = (1ull << kValidAddressBits) - 1; -constexpr int kTagBits = sizeof(uintptr_t) * 8 - kValidAddressBits; - -// MTECheckedPtr has no business with the topmost bits reserved for the -// tag used by true ARM MTE, so we strip it out here. -constexpr uintptr_t kTagMask = - ~kAddressMask & partition_alloc::internal::kPtrUntagMask; - -constexpr int kTopBitShift = 63; -constexpr uintptr_t kTopBit = 1ull << kTopBitShift; -static_assert(kTopBit << 1 == 0, "kTopBit should really be the top bit"); -static_assert((kTopBit & kTagMask) > 0, - "kTopBit bit must be inside the tag region"); - -// This functionality is outside of MTECheckedPtrImpl, so that it can be -// overridden by tests. -struct MTECheckedPtrImplPartitionAllocSupport { - // Checks if the necessary support is enabled in PartitionAlloc for `ptr`. - template <typename T> - static PA_ALWAYS_INLINE bool EnabledForPtr(T* ptr) { - // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this class - // is responsible for handling the software MTE tag. - auto addr = partition_alloc::UntagPtr(ptr); - return partition_alloc::IsManagedByPartitionAlloc(addr); - } - - // Returns pointer to the tag that protects are pointed by |addr|. - static PA_ALWAYS_INLINE void* TagPointer(uintptr_t addr) { - return partition_alloc::PartitionTagPointer(addr); - } -}; - -template <typename PartitionAllocSupport> -struct MTECheckedPtrImpl { - // This implementation assumes that pointers are 64 bits long and at least 16 - // top bits are unused. The latter is harder to verify statically, but this is - // true for all currently supported 64-bit architectures (PA_DCHECK when - // wrapping will verify that). - static_assert(sizeof(void*) >= 8, "Need 64-bit pointers"); - - // Wraps a pointer, and returns its uintptr_t representation. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this - // function is responsible for adding the software MTE tag. - uintptr_t addr = partition_alloc::UntagPtr(ptr); - PA_BASE_DCHECK(ExtractTag(addr) == 0ull); - - // Return a not-wrapped |addr|, if it's either nullptr or if the protection - // for this pointer is disabled. - if (!PartitionAllocSupport::EnabledForPtr(ptr)) { - return ptr; - } - - // Read the tag and place it in the top bits of the address. - // Even if PartitionAlloc's tag has less than kTagBits, we'll read - // what's given and pad the rest with 0s. - static_assert(sizeof(partition_alloc::PartitionTag) * 8 <= kTagBits, ""); - uintptr_t tag = *(static_cast<volatile partition_alloc::PartitionTag*>( - PartitionAllocSupport::TagPointer(addr))); - PA_BASE_DCHECK(tag); - - tag <<= kValidAddressBits; - addr |= tag; - // See the disambiguation comment above. - // TODO(kdlee): Ensure that ptr's hardware MTE tag is preserved. - // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. - return static_cast<T*>(partition_alloc::internal::TagAddr(addr)); - } - - // Notifies the allocator when a wrapped pointer is being removed or replaced. - // No-op for MTECheckedPtrImpl. - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T*) {} - - // Unwraps the pointer's uintptr_t representation, while asserting that memory - // hasn't been freed. The function is allowed to crash on nullptr. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { - // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this - // function is responsible for removing the software MTE tag. - uintptr_t wrapped_addr = partition_alloc::UntagPtr(wrapped_ptr); - uintptr_t tag = ExtractTag(wrapped_addr); - if (tag > 0) { - // Read the tag provided by PartitionAlloc. - // - // Cast to volatile to ensure memory is read. E.g. in a tight loop, the - // compiler could cache the value in a register and thus could miss that - // another thread freed memory and changed tag. - uintptr_t read_tag = - *static_cast<volatile partition_alloc::PartitionTag*>( - PartitionAllocSupport::TagPointer(ExtractAddress(wrapped_addr))); - if (PA_UNLIKELY(tag != read_tag)) { - PA_IMMEDIATE_CRASH(); - } - // See the disambiguation comment above. - // TODO(kdlee): Ensure that ptr's hardware MTE tag is preserved. - // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. - return static_cast<T*>( - partition_alloc::internal::TagAddr(ExtractAddress(wrapped_addr))); - } - return wrapped_ptr; - } - - // Unwraps the pointer's uintptr_t representation, while asserting that memory - // hasn't been freed. The function must handle nullptr gracefully. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - // SafelyUnwrapPtrForDereference handles nullptr case well. - return SafelyUnwrapPtrForDereference(wrapped_ptr); - } - - // Unwraps the pointer's uintptr_t representation, without making an assertion - // on whether memory was freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - return ExtractPtr(wrapped_ptr); - } - - // Upcasts the wrapped pointer. - template <typename To, typename From> - static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { - static_assert(std::is_convertible<From*, To*>::value, - "From must be convertible to To."); - - // The top-bit tag must not affect the result of upcast. - return static_cast<To*>(wrapped_ptr); - } - - // Advance the wrapped pointer by `delta_elems`. - template < - typename T, - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { - return wrapped_ptr + delta_elems; - } - - template <typename T> - static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, - T* wrapped_ptr2) { - // Ensure that both pointers come from the same allocation. - // - // Disambiguation: UntagPtr removes the hardware MTE tag, whereas this - // class is responsible for handling the software MTE tag. - // - // MTECheckedPtr doesn't use 0 as a valid tag; depending on which - // subtraction operator is called, we may be getting the actual - // untagged T* or the wrapped pointer (passed as a T*) in one or - // both args. We can only check slot cohabitation when both args - // come with tags. - const uintptr_t tag1 = ExtractTag(partition_alloc::UntagPtr(wrapped_ptr1)); - const uintptr_t tag2 = ExtractTag(partition_alloc::UntagPtr(wrapped_ptr2)); - if (tag1 && tag2) { - PA_BASE_CHECK(tag1 == tag2); - return wrapped_ptr1 - wrapped_ptr2; - } - - // If one or the other arg come untagged, we have to perform the - // subtraction entirely without tags. - return reinterpret_cast<T*>( - ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr1))) - - reinterpret_cast<T*>( - ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr2))); - } - - // Returns a copy of a wrapped pointer, without making an assertion - // on whether memory was freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { - return wrapped_ptr; - } - - // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used - // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - return WrapRawPtr(ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - return ExtractPtr(wrapped_ptr); - } - - // This is for accounting only, used by unit tests. - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} - static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} - - private: - static PA_ALWAYS_INLINE uintptr_t ExtractAddress(uintptr_t wrapped_ptr) { - return wrapped_ptr & kAddressMask; - } - - template <typename T> - static PA_ALWAYS_INLINE T* ExtractPtr(T* wrapped_ptr) { - // Disambiguation: UntagPtr/TagAddr handle the hardware MTE tag, whereas - // this function is responsible for removing the software MTE tag. - // TODO(kdlee): Ensure that wrapped_ptr's hardware MTE tag is preserved. - // TODO(kdlee): Ensure that hardware and software MTE tags don't conflict. - return static_cast<T*>(partition_alloc::internal::TagAddr( - ExtractAddress(partition_alloc::UntagPtr(wrapped_ptr)))); - } - - static PA_ALWAYS_INLINE uintptr_t ExtractTag(uintptr_t wrapped_ptr) { - return (wrapped_ptr & kTagMask) >> kValidAddressBits; - } -}; - -#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) -PA_COMPONENT_EXPORT(RAW_PTR) -void CheckThatAddressIsntWithinFirstPartitionPage(uintptr_t address); -#endif - -template <bool AllowDangling = false> -struct BackupRefPtrImpl { - // Note that `BackupRefPtrImpl` itself is not thread-safe. If multiple threads - // modify the same smart pointer object without synchronization, a data race - // will occur. - - static PA_ALWAYS_INLINE bool IsSupportedAndNotNull(uintptr_t address) { - // There are many situations where the compiler can prove that - // `ReleaseWrappedPtr` is called on a value that is always nullptr, but the - // way `IsManagedByPartitionAllocBRPPool` is written, the compiler can't - // prove that nullptr is not managed by PartitionAlloc; and so the compiler - // has to emit a useless check and dead code. To avoid that without making - // the runtime check slower, tell the compiler to skip - // `IsManagedByPartitionAllocBRPPool` when it can statically determine that - // address is nullptr. -#if PA_HAS_BUILTIN(__builtin_constant_p) - if (__builtin_constant_p(address == 0) && (address == 0)) { -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - PA_BASE_CHECK( - !partition_alloc::IsManagedByPartitionAllocBRPPool(address)); -#endif // BUILDFLAG(PA_DCHECK_IS_ON) || - // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - return false; - } -#endif // PA_HAS_BUILTIN(__builtin_constant_p) - - // This covers the nullptr case, as address 0 is never in any - // PartitionAlloc pool. - bool is_in_brp_pool = - partition_alloc::IsManagedByPartitionAllocBRPPool(address); - - // There may be pointers immediately after the allocation, e.g. - // { - // // Assume this allocation happens outside of PartitionAlloc. - // raw_ptr<T> ptr = new T[20]; - // for (size_t i = 0; i < 20; i ++) { ptr++; } - // } - // - // Such pointers are *not* at risk of accidentally falling into BRP pool, - // because: - // 1) On 64-bit systems, BRP pool is preceded by a forbidden region. - // 2) On 32-bit systems, the guard pages and metadata of super pages in BRP - // pool aren't considered to be part of that pool. - // - // This allows us to make a stronger assertion that if - // IsManagedByPartitionAllocBRPPool returns true for a valid pointer, - // it must be at least partition page away from the beginning of a super - // page. -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - if (is_in_brp_pool) { - CheckThatAddressIsntWithinFirstPartitionPage(address); - } -#endif - - return is_in_brp_pool; - } - -#if PA_CONFIG(USE_OOB_POISON) - // Out-Of-Bounds (OOB) poison bit is set when the pointer has overflowed by - // one byte. -#if defined(ARCH_CPU_X86_64) - // Bit 63 is the only pointer bit that will work as the poison bit across both - // LAM48 and LAM57. It also works when all unused linear address bits are - // checked for canonicality. - static constexpr uintptr_t OOB_POISON_BIT = static_cast<uintptr_t>(1) << 63; -#else - // Avoid ARM's Top-Byte Ignore. - static constexpr uintptr_t OOB_POISON_BIT = static_cast<uintptr_t>(1) << 55; -#endif - - template <typename T> - static PA_ALWAYS_INLINE T* UnpoisonPtr(T* ptr) { - return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(ptr) & - ~OOB_POISON_BIT); - } - - template <typename T> - static PA_ALWAYS_INLINE bool IsPtrOOB(T* ptr) { - return (reinterpret_cast<uintptr_t>(ptr) & OOB_POISON_BIT) == - OOB_POISON_BIT; - } - - template <typename T> - static PA_ALWAYS_INLINE T* PoisonOOBPtr(T* ptr) { - return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(ptr) | - OOB_POISON_BIT); - } -#else // PA_USE_OOB_POISON - template <typename T> - static PA_ALWAYS_INLINE T* UnpoisonPtr(T* ptr) { - return ptr; - } -#endif // PA_USE_OOB_POISON - - // Wraps a pointer. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - uintptr_t address = partition_alloc::UntagPtr(UnpoisonPtr(ptr)); - if (IsSupportedAndNotNull(address)) { -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - PA_BASE_CHECK(ptr != nullptr); -#endif - AcquireInternal(address); - } else { -#if !PA_CONFIG(HAS_64_BITS_POINTERS) -#if PA_HAS_BUILTIN(__builtin_constant_p) - // Similarly to `IsSupportedAndNotNull` above, elide the - // `BanSuperPageFromBRPPool` call if the compiler can prove that `address` - // is zero since PA won't be able to map anything at that address anyway. - bool known_constant_zero = - __builtin_constant_p(address == 0) && (address == 0); -#else // PA_HAS_BUILTIN(__builtin_constant_p) - bool known_constant_zero = false; -#endif // PA_HAS_BUILTIN(__builtin_constant_p) - - if (!known_constant_zero) { - partition_alloc::internal::AddressPoolManagerBitmap:: - BanSuperPageFromBRPPool(address); - } -#endif // !PA_CONFIG(HAS_64_BITS_POINTERS) - } - - return ptr; - } - - // Notifies the allocator when a wrapped pointer is being removed or replaced. - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* wrapped_ptr) { - uintptr_t address = partition_alloc::UntagPtr(UnpoisonPtr(wrapped_ptr)); - if (IsSupportedAndNotNull(address)) { -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - PA_BASE_CHECK(wrapped_ptr != nullptr); -#endif - ReleaseInternal(address); - } - // We are unable to counteract BanSuperPageFromBRPPool(), called from - // WrapRawPtr(). We only use one bit per super-page and, thus can't tell if - // there's more than one associated raw_ptr<T> at a given time. The risk of - // exhausting the entire address space is minuscule, therefore, we couldn't - // resist the perf gain of a single relaxed store (in the above mentioned - // function) over much more expensive two CAS operations, which we'd have to - // use if we were to un-ban a super-page. - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function is allowed to crash on nullptr. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) -#if PA_CONFIG(USE_OOB_POISON) - PA_BASE_CHECK(!IsPtrOOB(wrapped_ptr)); -#endif - uintptr_t address = partition_alloc::UntagPtr(wrapped_ptr); - if (IsSupportedAndNotNull(address)) { - PA_BASE_CHECK(wrapped_ptr != nullptr); - PA_BASE_CHECK(IsPointeeAlive(address)); - } -#endif // BUILDFLAG(PA_DCHECK_IS_ON) || - // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - return wrapped_ptr; - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function must handle nullptr gracefully. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - T* unpoisoned_ptr = UnpoisonPtr(wrapped_ptr); -#if PA_CONFIG(USE_OOB_POISON) - // Some code uses invalid pointer values as indicators, so those values must - // be passed through unchanged during extraction. The following check will - // pass invalid values through if those values do not fall within the BRP - // pool after being unpoisoned. - if (!IsSupportedAndNotNull(partition_alloc::UntagPtr(unpoisoned_ptr))) { - return wrapped_ptr; - } - // Poison-based OOB checks do not extend to extracted pointers. The - // alternative of retaining poison on extracted pointers could introduce new - // OOB conditions, e.g., in code that extracts an end-of-allocation pointer - // for use in a loop termination condition. The poison bit would make that - // pointer appear to reference a very high address. -#endif // PA_CONFIG(USE_OOB_POISON) - return unpoisoned_ptr; - } - - // Unwraps the pointer, without making an assertion on whether memory was - // freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - // This may be used for unwrapping an end-of-allocation pointer to be used - // as an endpoint in an iterative algorithm, so this removes the OOB poison - // bit. - return UnpoisonPtr(wrapped_ptr); - } - - // Upcasts the wrapped pointer. - template <typename To, typename From> - static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { - static_assert(std::is_convertible<From*, To*>::value, - "From must be convertible to To."); - // Note, this cast may change the address if upcasting to base that lies in - // the middle of the derived object. - return wrapped_ptr; - } - - // Advance the wrapped pointer by `delta_elems`. - template < - typename T, - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { -#if BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) - T* unpoisoned_ptr = UnpoisonPtr(wrapped_ptr); - T* new_ptr = unpoisoned_ptr + delta_elems; - // First check if the new address didn't migrate in/out the BRP pool, and - // that it lands within the same allocation. An end-of-allocation address is - // ok, too, and that may lead to the pointer being poisoned if the relevant - // feature is enabled. These checks add a non-trivial cost, but they're - // cheaper and more secure than the previous implementation that rewrapped - // the pointer (wrapped the new pointer and unwrapped the old one). - // - // Note, the value of these checks goes beyond OOB protection. They're - // important for integrity of the BRP algorithm. Without these, an attacker - // could make the pointer point to another allocation, and cause its - // ref-count to go to 0 upon this pointer's destruction, even though there - // may be another pointer still pointing to it, thus making it lose the BRP - // protection prematurely. - uintptr_t address = partition_alloc::UntagPtr(unpoisoned_ptr); - // TODO(bartekn): Consider adding support for non-BRP pools too (without - // removing the cross-pool migration check). - if (IsSupportedAndNotNull(address)) { - auto ptr_pos_within_alloc = IsValidDelta( - address, delta_elems * static_cast<Z>(sizeof(T)), sizeof(T)); - // No need to check that |new_ptr| is in the same pool, as IsValidDeta() - // checks that it's within the same allocation, so must be the same pool. - PA_BASE_CHECK(ptr_pos_within_alloc != - partition_alloc::PtrPosWithinAlloc::kFarOOB); -#if PA_CONFIG(USE_OOB_POISON) - if (ptr_pos_within_alloc == - partition_alloc::PtrPosWithinAlloc::kAllocEnd) { - new_ptr = PoisonOOBPtr(new_ptr); - } -#endif - } else { - // Check that the new address didn't migrate into the BRP pool, as it - // would result in more pointers pointing to an allocation than its - // ref-count reflects. - PA_BASE_CHECK(!IsSupportedAndNotNull(partition_alloc::UntagPtr(new_ptr))); - } - return new_ptr; -#else // BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) - // In the "before allocation" mode, on 32-bit, we can run into a problem - // that the end-of-allocation address could fall outside of - // PartitionAlloc's pools, if this is the last slot of the super page, - // thus pointing to the guard page. This means the ref-count won't be - // decreased when the pointer is released (leak). - // - // We could possibly solve it in a few different ways: - // - Add the trailing guard page to the pool, but we'd have to think very - // hard if this doesn't create another hole. - // - Add an address adjustment to "is in pool?" check, similar as the one in - // PartitionAllocGetSlotStartInBRPPool(), but that seems fragile, not to - // mention adding an extra instruction to an inlined hot path. - // - Let the leak happen, since it should a very rare condition. - // - Go back to the previous solution of rewrapping the pointer, but that - // had an issue of losing BRP protection in case the pointer ever gets - // shifted back before the end of allocation. - // - // We decided to cross that bridge once we get there... if we ever get - // there. Currently there are no plans to switch back to the "before - // allocation" mode. - // - // This problem doesn't exist in the "previous slot" mode, or any mode that - // involves putting extras after the allocation, because the - // end-of-allocation address belongs to the same slot. - static_assert(false); -#endif // BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) - } - - template <typename T> - static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, - T* wrapped_ptr2) { - T* unpoisoned_ptr1 = UnpoisonPtr(wrapped_ptr1); - T* unpoisoned_ptr2 = UnpoisonPtr(wrapped_ptr2); - uintptr_t address1 = partition_alloc::UntagPtr(unpoisoned_ptr1); - uintptr_t address2 = partition_alloc::UntagPtr(unpoisoned_ptr2); - // Ensure that both pointers are within the same slot, and pool! - // TODO(bartekn): Consider adding support for non-BRP pool too. - if (IsSupportedAndNotNull(address1)) { - PA_BASE_CHECK(IsSupportedAndNotNull(address2)); - PA_BASE_CHECK(IsValidDelta(address2, address1 - address2, sizeof(T)) != - partition_alloc::PtrPosWithinAlloc::kFarOOB); - } else { - PA_BASE_CHECK(!IsSupportedAndNotNull(address2)); - } - return unpoisoned_ptr1 - unpoisoned_ptr2; - } - - // Returns a copy of a wrapped pointer, without making an assertion on whether - // memory was freed or not. - // This method increments the reference count of the allocation slot. - template <typename T> - static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { - return WrapRawPtr(wrapped_ptr); - } - - // Report the current wrapped pointer if pointee isn't alive anymore. - template <typename T> - static PA_ALWAYS_INLINE void ReportIfDangling(T* wrapped_ptr) { - ReportIfDanglingInternal(partition_alloc::UntagPtr(wrapped_ptr)); - } - - // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used - // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - return WrapRawPtr(ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - return UnpoisonPtr(wrapped_ptr); - } - - // This is for accounting only, used by unit tests. - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} - static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} - - private: - // We've evaluated several strategies (inline nothing, various parts, or - // everything in |Wrap()| and |Release()|) using the Speedometer2 benchmark - // to measure performance. The best results were obtained when only the - // lightweight |IsManagedByPartitionAllocBRPPool()| check was inlined. - // Therefore, we've extracted the rest into the functions below and marked - // them as PA_NOINLINE to prevent unintended LTO effects. - static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE - void AcquireInternal(uintptr_t address); - static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE - void ReleaseInternal(uintptr_t address); - static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE - bool IsPointeeAlive(uintptr_t address); - static PA_COMPONENT_EXPORT(RAW_PTR) PA_NOINLINE - void ReportIfDanglingInternal(uintptr_t address); - template < - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE partition_alloc::PtrPosWithinAlloc - IsValidDelta(uintptr_t address, Z delta_in_bytes, size_t type_size) { - using delta_t = std::conditional_t<std::is_signed_v<Z>, ptrdiff_t, size_t>; - partition_alloc::internal::PtrDelta<delta_t> ptr_delta(delta_in_bytes, - type_size); - - return IsValidDelta(address, ptr_delta); - } - template <typename Z> - static PA_COMPONENT_EXPORT(RAW_PTR) - PA_NOINLINE partition_alloc::PtrPosWithinAlloc - IsValidDelta(uintptr_t address, - partition_alloc::internal::PtrDelta<Z> delta); -}; - -#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - -#if BUILDFLAG(USE_ASAN_UNOWNED_PTR) - -struct AsanUnownedPtrImpl { - // Wraps a pointer. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - return ptr; - } - - // Notifies the allocator when a wrapped pointer is being removed or replaced. - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* wrapped_ptr) { - ProbeForLowSeverityLifetimeIssue(wrapped_ptr); - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function is allowed to crash on nullptr. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { - // ASAN will catch use of dereferenced ptr without additional probing. - return wrapped_ptr; - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function must handle nullptr gracefully. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - ProbeForLowSeverityLifetimeIssue(wrapped_ptr); - return wrapped_ptr; - } - - // Unwraps the pointer, without making an assertion on whether memory was - // freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - return wrapped_ptr; - } - - // Upcasts the wrapped pointer. - template <typename To, typename From> - static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { - static_assert(std::is_convertible<From*, To*>::value, - "From must be convertible to To."); - // Note, this cast may change the address if upcasting to base that lies in - // the middle of the derived object. - return wrapped_ptr; - } - - // Advance the wrapped pointer by `delta_elems`. - template < - typename T, - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { - return wrapped_ptr + delta_elems; - } - - template <typename T> - static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, - T* wrapped_ptr2) { - return wrapped_ptr1 - wrapped_ptr2; - } - - // Returns a copy of a wrapped pointer, without making an assertion on whether - // memory was freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { - return wrapped_ptr; - } - - template <typename T> - static void ProbeForLowSeverityLifetimeIssue(T* wrapped_ptr) { - if (wrapped_ptr && !LikelySmuggledScalar(wrapped_ptr) && - !EndOfAliveAllocation(wrapped_ptr)) { - reinterpret_cast<const volatile uint8_t*>(wrapped_ptr)[0]; - } - } - - static bool EndOfAliveAllocation(const volatile void* ptr); - static bool LikelySmuggledScalar(const volatile void* ptr); - - // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used - // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - return ptr; - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - return wrapped_ptr; - } - - // This is for accounting only, used by unit tests. - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} - static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} -}; - -#endif // BUILDFLAG(USE_ASAN_UNOWNED_PTR) - -#if BUILDFLAG(USE_HOOKABLE_RAW_PTR) - -struct RawPtrHooks { - using WrapPtr = void(uintptr_t address); - using ReleaseWrappedPtr = void(uintptr_t address); - using SafelyUnwrapForDereference = void(uintptr_t address); - using SafelyUnwrapForExtraction = void(uintptr_t address); - using UnsafelyUnwrapForComparison = void(uintptr_t address); - using Advance = void(uintptr_t old_address, uintptr_t new_address); - using Duplicate = void(uintptr_t address); - - WrapPtr* wrap_ptr; - ReleaseWrappedPtr* release_wrapped_ptr; - SafelyUnwrapForDereference* safely_unwrap_for_dereference; - SafelyUnwrapForExtraction* safely_unwrap_for_extraction; - UnsafelyUnwrapForComparison* unsafely_unwrap_for_comparison; - Advance* advance; - Duplicate* duplicate; -}; - -PA_COMPONENT_EXPORT(RAW_PTR) const RawPtrHooks* GetRawPtrHooks(); -PA_COMPONENT_EXPORT(RAW_PTR) void InstallRawPtrHooks(const RawPtrHooks*); -PA_COMPONENT_EXPORT(RAW_PTR) void ResetRawPtrHooks(); - -struct RawPtrHookableImpl { - // Wraps a pointer. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - GetRawPtrHooks()->wrap_ptr(reinterpret_cast<uintptr_t>(ptr)); - return ptr; - } - - // Notifies the allocator when a wrapped pointer is being removed or replaced. - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* ptr) { - GetRawPtrHooks()->release_wrapped_ptr(reinterpret_cast<uintptr_t>(ptr)); - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function is allowed to crash on nullptr. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { - GetRawPtrHooks()->safely_unwrap_for_dereference( - reinterpret_cast<uintptr_t>(wrapped_ptr)); - return wrapped_ptr; - } - - // Unwraps the pointer, while asserting that memory hasn't been freed. The - // function must handle nullptr gracefully. - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - GetRawPtrHooks()->safely_unwrap_for_extraction( - reinterpret_cast<uintptr_t>(wrapped_ptr)); - return wrapped_ptr; - } - - // Unwraps the pointer, without making an assertion on whether memory was - // freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - GetRawPtrHooks()->unsafely_unwrap_for_comparison( - reinterpret_cast<uintptr_t>(wrapped_ptr)); - return wrapped_ptr; - } - - // Upcasts the wrapped pointer. - template <typename To, typename From> - static PA_ALWAYS_INLINE constexpr To* Upcast(From* wrapped_ptr) { - static_assert(std::is_convertible<From*, To*>::value, - "From must be convertible to To."); - // Note, this cast may change the address if upcasting to base that lies in - // the middle of the derived object. - return wrapped_ptr; - } - - // Advance the wrapped pointer by `delta_elems`. - template < - typename T, - typename Z, - typename = - std::enable_if_t<partition_alloc::internal::offset_type<Z>, void>> - static PA_ALWAYS_INLINE T* Advance(T* wrapped_ptr, Z delta_elems) { - GetRawPtrHooks()->advance( - reinterpret_cast<uintptr_t>(wrapped_ptr), - reinterpret_cast<uintptr_t>(wrapped_ptr + delta_elems)); - return wrapped_ptr + delta_elems; - } - - template <typename T> - static PA_ALWAYS_INLINE ptrdiff_t GetDeltaElems(T* wrapped_ptr1, - T* wrapped_ptr2) { - return wrapped_ptr1 - wrapped_ptr2; - } - - // Returns a copy of a wrapped pointer, without making an assertion on whether - // memory was freed or not. - template <typename T> - static PA_ALWAYS_INLINE T* Duplicate(T* wrapped_ptr) { - GetRawPtrHooks()->duplicate(reinterpret_cast<uintptr_t>(wrapped_ptr)); - return wrapped_ptr; - } - - // `WrapRawPtrForDuplication` and `UnsafelyUnwrapPtrForDuplication` are used - // to create a new raw_ptr<T> from another raw_ptr<T> of a different flavor. - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - return ptr; - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - return wrapped_ptr; - } - - // This is for accounting only, used by unit tests. - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() {} - static PA_ALWAYS_INLINE void IncrementLessCountForTest() {} - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() {} -}; - -#endif // BUILDFLAG(USE_HOOKABLE_RAW_PTR) - -// Wraps a raw_ptr/raw_ref implementation, with a class of the same interface -// that provides accounting, for test purposes. raw_ptr/raw_ref that use it -// perform extra bookkeeping, e.g. to track the number of times the raw_ptr is -// wrapped, unrwapped, etc. -// -// Test only. -template <typename Traits> -struct RawPtrCountingImplWrapperForTest - : public raw_ptr_traits::TraitsToImpl<Traits>::Impl { - static_assert(!Traits::kUseCountingWrapperForTest); - - using SuperImpl = typename raw_ptr_traits::TraitsToImpl<Traits>::Impl; - - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtr(T* ptr) { - ++wrap_raw_ptr_cnt; - return SuperImpl::WrapRawPtr(ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE void ReleaseWrappedPtr(T* ptr) { - ++release_wrapped_ptr_cnt; - SuperImpl::ReleaseWrappedPtr(ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForDereference(T* wrapped_ptr) { - ++get_for_dereference_cnt; - return SuperImpl::SafelyUnwrapPtrForDereference(wrapped_ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* SafelyUnwrapPtrForExtraction(T* wrapped_ptr) { - ++get_for_extraction_cnt; - return SuperImpl::SafelyUnwrapPtrForExtraction(wrapped_ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForComparison(T* wrapped_ptr) { - ++get_for_comparison_cnt; - return SuperImpl::UnsafelyUnwrapPtrForComparison(wrapped_ptr); - } - - static PA_ALWAYS_INLINE void IncrementSwapCountForTest() { - ++wrapped_ptr_swap_cnt; - } - - static PA_ALWAYS_INLINE void IncrementLessCountForTest() { - ++wrapped_ptr_less_cnt; - } - - static PA_ALWAYS_INLINE void IncrementPointerToMemberOperatorCountForTest() { - ++pointer_to_member_operator_cnt; - } - - template <typename T> - static PA_ALWAYS_INLINE T* WrapRawPtrForDuplication(T* ptr) { - ++wrap_raw_ptr_for_dup_cnt; - return SuperImpl::WrapRawPtrForDuplication(ptr); - } - - template <typename T> - static PA_ALWAYS_INLINE T* UnsafelyUnwrapPtrForDuplication(T* wrapped_ptr) { - ++get_for_duplication_cnt; - return SuperImpl::UnsafelyUnwrapPtrForDuplication(wrapped_ptr); - } - - static void ClearCounters() { - wrap_raw_ptr_cnt = 0; - release_wrapped_ptr_cnt = 0; - get_for_dereference_cnt = 0; - get_for_extraction_cnt = 0; - get_for_comparison_cnt = 0; - wrapped_ptr_swap_cnt = 0; - wrapped_ptr_less_cnt = 0; - pointer_to_member_operator_cnt = 0; - wrap_raw_ptr_for_dup_cnt = 0; - get_for_duplication_cnt = 0; - } - - static inline int wrap_raw_ptr_cnt = INT_MIN; - static inline int release_wrapped_ptr_cnt = INT_MIN; - static inline int get_for_dereference_cnt = INT_MIN; - static inline int get_for_extraction_cnt = INT_MIN; - static inline int get_for_comparison_cnt = INT_MIN; - static inline int wrapped_ptr_swap_cnt = INT_MIN; - static inline int wrapped_ptr_less_cnt = INT_MIN; - static inline int pointer_to_member_operator_cnt = INT_MIN; - static inline int wrap_raw_ptr_for_dup_cnt = INT_MIN; - static inline int get_for_duplication_cnt = INT_MIN; -}; - -} // namespace internal - -namespace raw_ptr_traits { - -// IsSupportedType<T>::value answers whether raw_ptr<T> 1) compiles and 2) is -// always safe at runtime. Templates that may end up using `raw_ptr<T>` should -// use IsSupportedType to ensure that raw_ptr is not used with unsupported -// types. As an example, see how base::internal::StorageTraits uses -// IsSupportedType as a condition for using base::internal::UnretainedWrapper -// (which has a `ptr_` field that will become `raw_ptr<T>` after the Big -// Rewrite). -template <typename T, typename SFINAE = void> -struct IsSupportedType { - static constexpr bool value = true; -}; - -// raw_ptr<T> is not compatible with function pointer types. Also, they don't -// even need the raw_ptr protection, because they don't point on heap. -template <typename T> -struct IsSupportedType<T, std::enable_if_t<std::is_function<T>::value>> { - static constexpr bool value = false; -}; - -// This section excludes some types from raw_ptr<T> to avoid them from being -// used inside base::Unretained in performance sensitive places. These were -// identified from sampling profiler data. See crbug.com/1287151 for more info. -template <> -struct IsSupportedType<cc::Scheduler> { - static constexpr bool value = false; -}; -template <> -struct IsSupportedType<base::internal::DelayTimerBase> { - static constexpr bool value = false; -}; -template <> -struct IsSupportedType<content::responsiveness::Calculator> { - static constexpr bool value = false; -}; - -#if __OBJC__ -// raw_ptr<T> is not compatible with pointers to Objective-C classes for a -// multitude of reasons. They may fail to compile in many cases, and wouldn't -// work well with tagged pointers. Anyway, Objective-C objects have their own -// way of tracking lifespan, hence don't need the raw_ptr protection as much. -// -// Such pointers are detected by checking if they're convertible to |id| type. -template <typename T> -struct IsSupportedType<T, - std::enable_if_t<std::is_convertible<T*, id>::value>> { - static constexpr bool value = false; -}; -#endif // __OBJC__ - -#if BUILDFLAG(IS_WIN) -// raw_ptr<HWND__> is unsafe at runtime - if the handle happens to also -// represent a valid pointer into a PartitionAlloc-managed region then it can -// lead to manipulating random memory when treating it as BackupRefPtr -// ref-count. See also https://crbug.com/1262017. -// -// TODO(https://crbug.com/1262017): Cover other handle types like HANDLE, -// HLOCAL, HINTERNET, or HDEVINFO. Maybe we should avoid using raw_ptr<T> when -// T=void (as is the case in these handle types). OTOH, explicit, -// non-template-based raw_ptr<void> should be allowed. Maybe this can be solved -// by having 2 traits: IsPointeeAlwaysSafe (to be used in templates) and -// IsPointeeUsuallySafe (to be used in the static_assert in raw_ptr). The -// upside of this approach is that it will safely handle base::Bind closing over -// HANDLE. The downside of this approach is that base::Bind closing over a -// void* pointer will not get UaF protection. -#define PA_WINDOWS_HANDLE_TYPE(name) \ - template <> \ - struct IsSupportedType<name##__, void> { \ - static constexpr bool value = false; \ - }; -#include "base/allocator/partition_allocator/partition_alloc_base/win/win_handle_types_list.inc" -#undef PA_WINDOWS_HANDLE_TYPE -#endif - -template <typename Traits> -struct TraitsToImpl { - private: - // UnderlyingImpl is the struct that provides the implementation of the - // protections related to raw_ptr. -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - using UnderlyingImpl = internal::BackupRefPtrImpl< - /*AllowDangling=*/Traits::kMayDangle>; -#elif BUILDFLAG(USE_ASAN_UNOWNED_PTR) - using UnderlyingImpl = - std::conditional_t<Traits::kMayDangle, - // No special bookkeeping required for this case, - // just treat these as ordinary pointers. - internal::RawPtrNoOpImpl, - internal::AsanUnownedPtrImpl>; -#elif PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - using UnderlyingImpl = - std::conditional_t<Traits::kDisableMTECheckedPtr, - internal::RawPtrNoOpImpl, - internal::MTECheckedPtrImpl< - internal::MTECheckedPtrImplPartitionAllocSupport>>; -#elif BUILDFLAG(USE_HOOKABLE_RAW_PTR) - using UnderlyingImpl = std::conditional_t<Traits::kDisableHooks, - internal::RawPtrNoOpImpl, - internal::RawPtrHookableImpl>; -#else - using UnderlyingImpl = internal::RawPtrNoOpImpl; -#endif - - public: - // Impl is the struct that implements raw_ptr functions. Think of raw_ptr as a - // thin wrapper, that directs calls to Impl. - // Impl may be different from UnderlyingImpl, because it may include a - // wrapper. - using Impl = std::conditional_t< - Traits::kUseCountingWrapperForTest, - internal::RawPtrCountingImplWrapperForTest< - typename Traits::template RemoveTraitT<UseCountingWrapperForTest>>, - UnderlyingImpl>; -}; - -} // namespace raw_ptr_traits - -// `raw_ptr<T>` is a non-owning smart pointer that has improved memory-safety -// over raw pointers. It behaves just like a raw pointer on platforms where -// USE_BACKUP_REF_PTR is off, and almost like one when it's on (the main -// difference is that it's zero-initialized and cleared on destruction and -// move). Unlike `std::unique_ptr<T>`, `base::scoped_refptr<T>`, etc., it -// doesn’t manage ownership or lifetime of an allocated object - you are still -// responsible for freeing the object when no longer used, just as you would -// with a raw C++ pointer. -// -// Compared to a raw C++ pointer, on platforms where USE_BACKUP_REF_PTR is on, -// `raw_ptr<T>` incurs additional performance overhead for initialization, -// destruction, and assignment (including `ptr++` and `ptr += ...`). There is -// no overhead when dereferencing a pointer. -// -// `raw_ptr<T>` is beneficial for security, because it can prevent a significant -// percentage of Use-after-Free (UaF) bugs from being exploitable. `raw_ptr<T>` -// has limited impact on stability - dereferencing a dangling pointer remains -// Undefined Behavior. Note that the security protection is not yet enabled by -// default. -// -// raw_ptr<T> is marked as [[gsl::Pointer]] which allows the compiler to catch -// some bugs where the raw_ptr holds a dangling pointer to a temporary object. -// However the [[gsl::Pointer]] analysis expects that such types do not have a -// non-default move constructor/assignment. Thus, it's possible to get an error -// where the pointer is not actually dangling, and have to work around the -// compiler. We have not managed to construct such an example in Chromium yet. -template <typename T, typename Traits = raw_ptr_traits::TraitBundle<>> -class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr { - // Type to return from ExtractAsDangling(), which is identical except - // MayDangle trait is added (if one isn't there already). - using DanglingRawPtrType = - raw_ptr<T, - typename Traits::template AddTraitT<raw_ptr_traits::MayDangle>>; - - public: - using Impl = typename raw_ptr_traits::TraitsToImpl<Traits>::Impl; - -#if !BUILDFLAG(USE_PARTITION_ALLOC) - // See comment at top about `PA_RAW_PTR_CHECK()`. - static_assert(std::is_same_v<Impl, internal::RawPtrNoOpImpl>); -#endif // !BUILDFLAG(USE_PARTITION_ALLOC) - - static_assert(raw_ptr_traits::IsSupportedType<T>::value, - "raw_ptr<T> doesn't work with this kind of pointee type T"); - -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || \ - BUILDFLAG(USE_ASAN_UNOWNED_PTR) || BUILDFLAG(USE_HOOKABLE_RAW_PTR) - // BackupRefPtr requires a non-trivial default constructor, destructor, etc. - constexpr PA_ALWAYS_INLINE raw_ptr() noexcept : wrapped_ptr_(nullptr) {} - - PA_ALWAYS_INLINE raw_ptr(const raw_ptr& p) noexcept - : wrapped_ptr_(Impl::Duplicate(p.wrapped_ptr_)) {} - - PA_ALWAYS_INLINE raw_ptr(raw_ptr&& p) noexcept { - wrapped_ptr_ = p.wrapped_ptr_; - p.wrapped_ptr_ = nullptr; - } - - PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr& p) noexcept { - // Duplicate before releasing, in case the pointer is assigned to itself. - // - // Unlike the move version of this operator, don't add |this != &p| branch, - // for performance reasons. Even though Duplicate() is not cheap, we - // practically never assign a raw_ptr<T> to itself. We suspect that a - // cumulative cost of a conditional branch, even if always correctly - // predicted, would exceed that. - T* new_ptr = Impl::Duplicate(p.wrapped_ptr_); - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = new_ptr; - return *this; - } - - PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr&& p) noexcept { - // Unlike the the copy version of this operator, this branch is necessaty - // for correctness. - if (PA_LIKELY(this != &p)) { - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = p.wrapped_ptr_; - p.wrapped_ptr_ = nullptr; - } - return *this; - } - - PA_ALWAYS_INLINE ~raw_ptr() noexcept { - Impl::ReleaseWrappedPtr(wrapped_ptr_); - // Work around external issues where raw_ptr is used after destruction. - wrapped_ptr_ = nullptr; - } - -#else // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || - // BUILDFLAG(USE_ASAN_UNOWNED_PTR) || BUILDFLAG(USE_HOOKABLE_RAW_PTR) - - // raw_ptr can be trivially default constructed (leaving |wrapped_ptr_| - // uninitialized). This is needed for compatibility with raw pointers. - // - // TODO(lukasza): Always initialize |wrapped_ptr_|. Fix resulting build - // errors. Analyze performance impact. - constexpr PA_ALWAYS_INLINE raw_ptr() noexcept = default; - - // In addition to nullptr_t ctor above, raw_ptr needs to have these - // as |=default| or |constexpr| to avoid hitting -Wglobal-constructors in - // cases like this: - // struct SomeStruct { int int_field; raw_ptr<int> ptr_field; }; - // SomeStruct g_global_var = { 123, nullptr }; - PA_ALWAYS_INLINE raw_ptr(const raw_ptr&) noexcept = default; - PA_ALWAYS_INLINE raw_ptr(raw_ptr&&) noexcept = default; - PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr&) noexcept = default; - PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr&&) noexcept = default; - - PA_ALWAYS_INLINE ~raw_ptr() noexcept = default; - -#endif // BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) || - // BUILDFLAG(USE_ASAN_UNOWNED_PTR) - - template < - typename PassedTraits, - typename Unused = std::enable_if_t<!std::is_same_v<Traits, PassedTraits>>> - PA_ALWAYS_INLINE explicit raw_ptr(const raw_ptr<T, PassedTraits>& p) noexcept - : wrapped_ptr_(Impl::WrapRawPtrForDuplication( - raw_ptr_traits::TraitsToImpl<PassedTraits>::Impl:: - UnsafelyUnwrapPtrForDuplication(p.wrapped_ptr_))) {} - - template < - typename PassedTraits, - typename Unused = std::enable_if_t<!std::is_same_v<Traits, PassedTraits>>> - PA_ALWAYS_INLINE raw_ptr& operator=( - const raw_ptr<T, PassedTraits>& p) noexcept { - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = Impl::WrapRawPtrForDuplication( - raw_ptr_traits::TraitsToImpl<PassedTraits>::Impl:: - UnsafelyUnwrapPtrForDuplication(p.wrapped_ptr_)); - return *this; - } - - // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. - // NOLINTNEXTLINE(google-explicit-constructor) - constexpr PA_ALWAYS_INLINE raw_ptr(std::nullptr_t) noexcept - : wrapped_ptr_(nullptr) {} - - // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. - // NOLINTNEXTLINE(google-explicit-constructor) - PA_ALWAYS_INLINE raw_ptr(T* p) noexcept : wrapped_ptr_(Impl::WrapRawPtr(p)) {} - - // Deliberately implicit in order to support implicit upcast. - template <typename U, - typename Unused = std::enable_if_t< - std::is_convertible<U*, T*>::value && - !std::is_void<typename std::remove_cv<T>::type>::value>> - // NOLINTNEXTLINE(google-explicit-constructor) - PA_ALWAYS_INLINE raw_ptr(const raw_ptr<U, Traits>& ptr) noexcept - : wrapped_ptr_( - Impl::Duplicate(Impl::template Upcast<T, U>(ptr.wrapped_ptr_))) {} - // Deliberately implicit in order to support implicit upcast. - template <typename U, - typename Unused = std::enable_if_t< - std::is_convertible<U*, T*>::value && - !std::is_void<typename std::remove_cv<T>::type>::value>> - // NOLINTNEXTLINE(google-explicit-constructor) - PA_ALWAYS_INLINE raw_ptr(raw_ptr<U, Traits>&& ptr) noexcept - : wrapped_ptr_(Impl::template Upcast<T, U>(ptr.wrapped_ptr_)) { -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - ptr.wrapped_ptr_ = nullptr; -#endif - } - - PA_ALWAYS_INLINE raw_ptr& operator=(std::nullptr_t) noexcept { - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = nullptr; - return *this; - } - PA_ALWAYS_INLINE raw_ptr& operator=(T* p) noexcept { - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = Impl::WrapRawPtr(p); - return *this; - } - - // Upcast assignment - template <typename U, - typename Unused = std::enable_if_t< - std::is_convertible<U*, T*>::value && - !std::is_void<typename std::remove_cv<T>::type>::value>> - PA_ALWAYS_INLINE raw_ptr& operator=(const raw_ptr<U, Traits>& ptr) noexcept { - // Make sure that pointer isn't assigned to itself (look at pointer address, - // not its value). -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - PA_RAW_PTR_CHECK(reinterpret_cast<uintptr_t>(this) != - reinterpret_cast<uintptr_t>(&ptr)); -#endif - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = - Impl::Duplicate(Impl::template Upcast<T, U>(ptr.wrapped_ptr_)); - return *this; - } - template <typename U, - typename Unused = std::enable_if_t< - std::is_convertible<U*, T*>::value && - !std::is_void<typename std::remove_cv<T>::type>::value>> - PA_ALWAYS_INLINE raw_ptr& operator=(raw_ptr<U, Traits>&& ptr) noexcept { - // Make sure that pointer isn't assigned to itself (look at pointer address, - // not its value). -#if BUILDFLAG(PA_DCHECK_IS_ON) || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS) - PA_RAW_PTR_CHECK(reinterpret_cast<uintptr_t>(this) != - reinterpret_cast<uintptr_t>(&ptr)); -#endif - Impl::ReleaseWrappedPtr(wrapped_ptr_); - wrapped_ptr_ = Impl::template Upcast<T, U>(ptr.wrapped_ptr_); -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - ptr.wrapped_ptr_ = nullptr; -#endif - return *this; - } - - // Avoid using. The goal of raw_ptr is to be as close to raw pointer as - // possible, so use it only if absolutely necessary (e.g. for const_cast). - PA_ALWAYS_INLINE T* get() const { return GetForExtraction(); } - - constexpr explicit PA_ALWAYS_INLINE operator bool() const { - return !!wrapped_ptr_; - } - - template <typename U = T, - typename Unused = std::enable_if_t< - !std::is_void<typename std::remove_cv<U>::type>::value>> - PA_ALWAYS_INLINE U& operator*() const { - return *GetForDereference(); - } - PA_ALWAYS_INLINE T* operator->() const { return GetForDereference(); } - - // Disables `(my_raw_ptr->*pmf)(...)` as a workaround for - // the ICE in GCC parsing the code, reported at - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103455 - template <typename PMF> - void operator->*(PMF) const = delete; - - // Deliberately implicit, because raw_ptr is supposed to resemble raw ptr. - // NOLINTNEXTLINE(runtime/explicit) - PA_ALWAYS_INLINE operator T*() const { return GetForExtraction(); } - template <typename U> - explicit PA_ALWAYS_INLINE operator U*() const { - // This operator may be invoked from static_cast, meaning the types may not - // be implicitly convertible, hence the need for static_cast here. - return static_cast<U*>(GetForExtraction()); - } - - PA_ALWAYS_INLINE raw_ptr& operator++() { - wrapped_ptr_ = Impl::Advance(wrapped_ptr_, 1); - return *this; - } - PA_ALWAYS_INLINE raw_ptr& operator--() { - wrapped_ptr_ = Impl::Advance(wrapped_ptr_, -1); - return *this; - } - PA_ALWAYS_INLINE raw_ptr operator++(int /* post_increment */) { - raw_ptr result = *this; - ++(*this); - return result; - } - PA_ALWAYS_INLINE raw_ptr operator--(int /* post_decrement */) { - raw_ptr result = *this; - --(*this); - return result; - } - template < - typename Z, - typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> - PA_ALWAYS_INLINE raw_ptr& operator+=(Z delta_elems) { - wrapped_ptr_ = Impl::Advance(wrapped_ptr_, delta_elems); - return *this; - } - template < - typename Z, - typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> - PA_ALWAYS_INLINE raw_ptr& operator-=(Z delta_elems) { - return *this += -delta_elems; - } - - template < - typename Z, - typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> - friend PA_ALWAYS_INLINE raw_ptr operator+(const raw_ptr& p, Z delta_elems) { - raw_ptr result = p; - return result += delta_elems; - } - template < - typename Z, - typename = std::enable_if_t<partition_alloc::internal::offset_type<Z>>> - friend PA_ALWAYS_INLINE raw_ptr operator-(const raw_ptr& p, Z delta_elems) { - raw_ptr result = p; - return result -= delta_elems; - } - friend PA_ALWAYS_INLINE ptrdiff_t operator-(const raw_ptr& p1, - const raw_ptr& p2) { - return Impl::GetDeltaElems(p1.wrapped_ptr_, p2.wrapped_ptr_); - } - friend PA_ALWAYS_INLINE ptrdiff_t operator-(T* p1, const raw_ptr& p2) { - return Impl::GetDeltaElems(p1, p2.wrapped_ptr_); - } - friend PA_ALWAYS_INLINE ptrdiff_t operator-(const raw_ptr& p1, T* p2) { - return Impl::GetDeltaElems(p1.wrapped_ptr_, p2); - } - - // Stop referencing the underlying pointer and free its memory. Compared to - // raw delete calls, this avoids the raw_ptr to be temporarily dangling - // during the free operation, which will lead to taking the slower path that - // involves quarantine. - PA_ALWAYS_INLINE void ClearAndDelete() noexcept { - delete GetForExtractionAndReset(); - } - PA_ALWAYS_INLINE void ClearAndDeleteArray() noexcept { - delete[] GetForExtractionAndReset(); - } - - // Clear the underlying pointer and return another raw_ptr instance - // that is allowed to dangle. - // This can be useful in cases such as: - // ``` - // ptr.ExtractAsDangling()->SelfDestroy(); - // ``` - // ``` - // c_style_api_do_something_and_destroy(ptr.ExtractAsDangling()); - // ``` - // NOTE, avoid using this method as it indicates an error-prone memory - // ownership pattern. If possible, use smart pointers like std::unique_ptr<> - // instead of raw_ptr<>. - // If you have to use it, avoid saving the return value in a long-lived - // variable (or worse, a field)! It's meant to be used as a temporary, to be - // passed into a cleanup & freeing function, and destructed at the end of the - // statement. - PA_ALWAYS_INLINE DanglingRawPtrType ExtractAsDangling() noexcept { - if constexpr (std::is_same_v< - typename std::remove_reference<decltype(*this)>::type, - DanglingRawPtrType>) { - DanglingRawPtrType res(std::move(*this)); - // Not all implementation clear the source pointer on move, so do it - // here just in case. Should be cheap. - operator=(nullptr); - return res; - } else { - T* ptr = GetForExtraction(); - DanglingRawPtrType res(ptr); - operator=(nullptr); - return res; - } - } - - // Comparison operators between raw_ptr and raw_ptr<U>/U*/std::nullptr_t. - // Strictly speaking, it is not necessary to provide these: the compiler can - // use the conversion operator implicitly to allow comparisons to fall back to - // comparisons between raw pointers. However, `operator T*`/`operator U*` may - // perform safety checks with a higher runtime cost, so to avoid this, provide - // explicit comparison operators for all combinations of parameters. - - // Comparisons between `raw_ptr`s. This unusual declaration and separate - // definition below is because `GetForComparison()` is a private method. The - // more conventional approach of defining a comparison operator between - // `raw_ptr` and `raw_ptr<U>` in the friend declaration itself does not work, - // because a comparison operator defined inline would not be allowed to call - // `raw_ptr<U>`'s private `GetForComparison()` method. - template <typename U, typename V, typename R1, typename R2> - friend PA_ALWAYS_INLINE bool operator==(const raw_ptr<U, R1>& lhs, - const raw_ptr<V, R2>& rhs); - template <typename U> - friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, - const raw_ptr<U, Traits>& rhs) { - return !(lhs == rhs); - } - template <typename U, typename V, typename R> - friend PA_ALWAYS_INLINE bool operator<(const raw_ptr<U, R>& lhs, - const raw_ptr<V, R>& rhs); - template <typename U, typename V, typename R> - friend PA_ALWAYS_INLINE bool operator>(const raw_ptr<U, R>& lhs, - const raw_ptr<V, R>& rhs); - template <typename U, typename V, typename R> - friend PA_ALWAYS_INLINE bool operator<=(const raw_ptr<U, R>& lhs, - const raw_ptr<V, R>& rhs); - template <typename U, typename V, typename R> - friend PA_ALWAYS_INLINE bool operator>=(const raw_ptr<U, R>& lhs, - const raw_ptr<V, R>& rhs); - - // Comparisons with U*. These operators also handle the case where the RHS is - // T*. - template <typename U> - friend PA_ALWAYS_INLINE bool operator==(const raw_ptr& lhs, U* rhs) { - return lhs.GetForComparison() == rhs; - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, U* rhs) { - return !(lhs == rhs); - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator==(U* lhs, const raw_ptr& rhs) { - return rhs == lhs; // Reverse order to call the operator above. - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator!=(U* lhs, const raw_ptr& rhs) { - return rhs != lhs; // Reverse order to call the operator above. - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator<(const raw_ptr& lhs, U* rhs) { - return lhs.GetForComparison() < rhs; - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator<=(const raw_ptr& lhs, U* rhs) { - return lhs.GetForComparison() <= rhs; - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator>(const raw_ptr& lhs, U* rhs) { - return lhs.GetForComparison() > rhs; - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator>=(const raw_ptr& lhs, U* rhs) { - return lhs.GetForComparison() >= rhs; - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator<(U* lhs, const raw_ptr& rhs) { - return lhs < rhs.GetForComparison(); - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator<=(U* lhs, const raw_ptr& rhs) { - return lhs <= rhs.GetForComparison(); - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator>(U* lhs, const raw_ptr& rhs) { - return lhs > rhs.GetForComparison(); - } - template <typename U> - friend PA_ALWAYS_INLINE bool operator>=(U* lhs, const raw_ptr& rhs) { - return lhs >= rhs.GetForComparison(); - } - - // Comparisons with `std::nullptr_t`. - friend PA_ALWAYS_INLINE bool operator==(const raw_ptr& lhs, std::nullptr_t) { - return !lhs; - } - friend PA_ALWAYS_INLINE bool operator!=(const raw_ptr& lhs, std::nullptr_t) { - return !!lhs; // Use !! otherwise the costly implicit cast will be used. - } - friend PA_ALWAYS_INLINE bool operator==(std::nullptr_t, const raw_ptr& rhs) { - return !rhs; - } - friend PA_ALWAYS_INLINE bool operator!=(std::nullptr_t, const raw_ptr& rhs) { - return !!rhs; // Use !! otherwise the costly implicit cast will be used. - } - - friend PA_ALWAYS_INLINE void swap(raw_ptr& lhs, raw_ptr& rhs) noexcept { - Impl::IncrementSwapCountForTest(); - std::swap(lhs.wrapped_ptr_, rhs.wrapped_ptr_); - } - - PA_ALWAYS_INLINE void ReportIfDangling() const noexcept { -#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) - Impl::ReportIfDangling(wrapped_ptr_); -#endif - } - - private: - // This getter is meant for situations where the pointer is meant to be - // dereferenced. It is allowed to crash on nullptr (it may or may not), - // because it knows that the caller will crash on nullptr. - PA_ALWAYS_INLINE T* GetForDereference() const { - return Impl::SafelyUnwrapPtrForDereference(wrapped_ptr_); - } - // This getter is meant for situations where the raw pointer is meant to be - // extracted outside of this class, but not necessarily with an intention to - // dereference. It mustn't crash on nullptr. - PA_ALWAYS_INLINE T* GetForExtraction() const { - return Impl::SafelyUnwrapPtrForExtraction(wrapped_ptr_); - } - // This getter is meant *only* for situations where the pointer is meant to be - // compared (guaranteeing no dereference or extraction outside of this class). - // Any verifications can and should be skipped for performance reasons. - PA_ALWAYS_INLINE T* GetForComparison() const { - return Impl::UnsafelyUnwrapPtrForComparison(wrapped_ptr_); - } - - PA_ALWAYS_INLINE T* GetForExtractionAndReset() { - T* ptr = GetForExtraction(); - operator=(nullptr); - return ptr; - } - - // This field is not a raw_ptr<> because it was filtered by the rewriter for: - // #union, #global-scope, #constexpr-ctor-field-initializer - RAW_PTR_EXCLUSION T* wrapped_ptr_; - - template <typename U, typename R> - friend class raw_ptr; -}; - -template <typename U, typename V, typename Traits1, typename Traits2> -PA_ALWAYS_INLINE bool operator==(const raw_ptr<U, Traits1>& lhs, - const raw_ptr<V, Traits2>& rhs) { - return lhs.GetForComparison() == rhs.GetForComparison(); -} - -template <typename U, typename V, typename Traits> -PA_ALWAYS_INLINE bool operator<(const raw_ptr<U, Traits>& lhs, - const raw_ptr<V, Traits>& rhs) { - return lhs.GetForComparison() < rhs.GetForComparison(); -} - -template <typename U, typename V, typename Traits> -PA_ALWAYS_INLINE bool operator>(const raw_ptr<U, Traits>& lhs, - const raw_ptr<V, Traits>& rhs) { - return lhs.GetForComparison() > rhs.GetForComparison(); -} - -template <typename U, typename V, typename Traits> -PA_ALWAYS_INLINE bool operator<=(const raw_ptr<U, Traits>& lhs, - const raw_ptr<V, Traits>& rhs) { - return lhs.GetForComparison() <= rhs.GetForComparison(); -} - -template <typename U, typename V, typename Traits> -PA_ALWAYS_INLINE bool operator>=(const raw_ptr<U, Traits>& lhs, - const raw_ptr<V, Traits>& rhs) { - return lhs.GetForComparison() >= rhs.GetForComparison(); -} - -template <typename T> -struct IsRawPtr : std::false_type {}; - -template <typename T, typename Traits> -struct IsRawPtr<raw_ptr<T, Traits>> : std::true_type {}; - -template <typename T> -inline constexpr bool IsRawPtrV = IsRawPtr<T>::value; - -template <typename T> -inline constexpr bool IsRawPtrMayDangleV = false; - -template <typename T, typename Traits> -inline constexpr bool IsRawPtrMayDangleV<raw_ptr<T, Traits>> = - Traits::kMayDangle; - -// Template helpers for working with T* or raw_ptr<T>. -template <typename T> -struct IsPointer : std::false_type {}; - -template <typename T> -struct IsPointer<T*> : std::true_type {}; - -template <typename T, typename Traits> -struct IsPointer<raw_ptr<T, Traits>> : std::true_type {}; - -template <typename T> -inline constexpr bool IsPointerV = IsPointer<T>::value; - -template <typename T> -struct RemovePointer { - using type = T; -}; - -template <typename T> -struct RemovePointer<T*> { - using type = T; -}; - -template <typename T, typename Traits> -struct RemovePointer<raw_ptr<T, Traits>> { - using type = T; -}; - -template <typename T> -using RemovePointerT = typename RemovePointer<T>::type; - -} // namespace base - -using base::raw_ptr; - -// DisableDanglingPtrDetection option for raw_ptr annotates -// "intentional-and-safe" dangling pointers. It is meant to be used at the -// margin, only if there is no better way to re-architecture the code. -// -// Usage: -// raw_ptr<T, DisableDanglingPtrDetection> dangling_ptr; -// -// When using it, please provide a justification about what guarantees that it -// will never be dereferenced after becoming dangling. -using DisableDanglingPtrDetection = - base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>; - -// See `docs/dangling_ptr.md` -// Annotates known dangling raw_ptr. Those haven't been triaged yet. All the -// occurrences are meant to be removed. See https://crbug.com/1291138. -using DanglingUntriaged = - base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>; - -// This type is to be used in callbacks arguments when it is known that they -// might receive dangling pointers. In any other cases, please use one of: -// - raw_ptr<T, DanglingUntriaged> -// - raw_ptr<T, DisableDanglingPtrDetection> -template <typename T> -using MayBeDangling = base::raw_ptr< - T, - base::raw_ptr_traits::TraitBundle<base::raw_ptr_traits::MayDangle>>; - -// The following template parameters are only meaningful when `raw_ptr` -// is `MTECheckedPtr` (never the case unless a particular GN arg is set -// true.) `raw_ptr` users need not worry about this and can refer solely -// to `DisableDanglingPtrDetection` and `DanglingUntriaged` above. -// -// The `raw_ptr` definition allows users to specify an implementation. -// When `MTECheckedPtr` is in play, we need to augment this -// implementation setting with another layer that allows the `raw_ptr` -// to degrade into the no-op version. -// -// See `base/memory/raw_ptr_mtecheckedptr.md` - -// Direct pass-through to no-op implementation. -using DegradeToNoOpWhenMTE = base::raw_ptr_traits::TraitBundle< - base::raw_ptr_traits::DisableMTECheckedPtr>; - -// As above, but with the "untriaged dangling" annotation. -using DanglingUntriagedDegradeToNoOpWhenMTE = base::raw_ptr_traits::TraitBundle< - base::raw_ptr_traits::MayDangle, - base::raw_ptr_traits::DisableMTECheckedPtr>; - -// As above, but with the "explicitly disable protection" annotation. -using DisableDanglingPtrDetectionDegradeToNoOpWhenMTE = - base::raw_ptr_traits::TraitBundle< - base::raw_ptr_traits::MayDangle, - base::raw_ptr_traits::DisableMTECheckedPtr>; - -namespace std { - -// Override so set/map lookups do not create extra raw_ptr. This also allows -// dangling pointers to be used for lookup. -template <typename T, typename Traits> -struct less<raw_ptr<T, Traits>> { - using Impl = typename raw_ptr<T, Traits>::Impl; - using is_transparent = void; - - bool operator()(const raw_ptr<T, Traits>& lhs, - const raw_ptr<T, Traits>& rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } - - bool operator()(T* lhs, const raw_ptr<T, Traits>& rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } - - bool operator()(const raw_ptr<T, Traits>& lhs, T* rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } -}; - -// Define for cases where raw_ptr<T> holds a pointer to an array of type T. -// This is consistent with definition of std::iterator_traits<T*>. -// Algorithms like std::binary_search need that. -template <typename T, typename Traits> -struct iterator_traits<raw_ptr<T, Traits>> { - using difference_type = ptrdiff_t; - using value_type = std::remove_cv_t<T>; - using pointer = T*; - using reference = T&; - using iterator_category = std::random_access_iterator_tag; -}; - -} // namespace std +// Although `raw_ptr` is part of the standalone PA distribution, it is +// easier to use the shorter path in `//base/memory`. We retain this +// facade header for ease of typing. +#include "base/allocator/partition_allocator/pointers/raw_ptr.h" // IWYU pragma: export #endif // BASE_MEMORY_RAW_PTR_H_
diff --git a/base/memory/raw_ref.h b/base/memory/raw_ref.h index e32bbbf..6a599d9 100644 --- a/base/memory/raw_ref.h +++ b/base/memory/raw_ref.h
@@ -5,368 +5,9 @@ #ifndef BASE_MEMORY_RAW_REF_H_ #define BASE_MEMORY_RAW_REF_H_ -#include <memory> -#include <type_traits> -#include <utility> - -#include "base/allocator/partition_allocator/partition_alloc_base/augmentations/compiler_specific.h" -#include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" -#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" -#include "base/allocator/partition_allocator/partition_alloc_config.h" -#include "base/memory/raw_ptr.h" - -namespace base { - -template <class T, typename Traits> -class raw_ref; - -namespace internal { - -template <class T> -struct is_raw_ref : std::false_type {}; - -template <class T, typename Traits> -struct is_raw_ref<::base::raw_ref<T, Traits>> : std::true_type {}; - -template <class T> -constexpr inline bool is_raw_ref_v = is_raw_ref<T>::value; - -} // namespace internal - -// A smart pointer for a pointer which can not be null, and which provides -// Use-after-Free protection in the same ways as raw_ptr. This class acts like a -// combination of std::reference_wrapper and raw_ptr. -// -// See raw_ptr and //base/memory/raw_ptr.md for more details on the -// Use-after-Free protection. -// -// # Use after move -// -// The raw_ref type will abort if used after being moved. -// -// # Constness -// -// Use a `const raw_ref<T>` when the smart pointer should not be able to rebind -// to a new reference. Use a `const raw_ref<const T>` do the same for a const -// reference, which is like `const T&`. -// -// Unlike a native `T&` reference, a mutable `raw_ref<T>` can be changed -// independent of the underlying `T`, similar to `std::reference_wrapper`. That -// means the reference inside it can be moved and reassigned. -template <class T, typename Traits = raw_ptr_traits::TraitBundle<>> -class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ref { - // operator* is used with the expectation of GetForExtraction semantics: - // - // raw_ref<Foo> foo_raw_ref = something; - // Foo& foo_ref = *foo_raw_ref; - // - // The implementation of operator* provides GetForDereference semantics, and - // this results in spurious crashes in BRP-ASan builds, so we need to disable - // hooks that provide BRP-ASan instrumentation for raw_ref. - using Inner = raw_ptr< - T, - typename Traits::template AddTraitT<raw_ptr_traits::DisableHooks>>; - - public: - using Impl = typename Inner::Impl; - - // These impls do not clear on move, which produces an inconsistent behaviour. - // We want consistent behaviour such that using a raw_ref after move is caught - // and aborts. Failure to clear would be indicated by the related death tests - // not CHECKing appropriately. - static constexpr bool need_clear_after_move = -#if PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) - std::is_same_v<Impl, - internal::MTECheckedPtrImpl< - internal::MTECheckedPtrImplPartitionAllocSupport>> || -#endif // PA_CONFIG(ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) -#if BUILDFLAG(USE_ASAN_UNOWNED_PTR) - std::is_same_v<Impl, internal::AsanUnownedPtrImpl> || -#endif // BUILDFLAG(USE_ASAN_UNOWNED_PTR) - std::is_same_v<Impl, internal::RawPtrNoOpImpl>; - - PA_ALWAYS_INLINE explicit raw_ref(T& p) noexcept - : inner_(std::addressof(p)) {} - - PA_ALWAYS_INLINE raw_ref& operator=(T& p) noexcept { - inner_.operator=(&p); - return *this; - } - - // Disallow holding references to temporaries. - raw_ref(const T&& p) = delete; - raw_ref& operator=(const T&& p) = delete; - - PA_ALWAYS_INLINE raw_ref(const raw_ref& p) noexcept : inner_(p.inner_) { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - } - - PA_ALWAYS_INLINE raw_ref(raw_ref&& p) noexcept : inner_(std::move(p.inner_)) { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - if constexpr (need_clear_after_move) { - p.inner_ = nullptr; - } - } - - PA_ALWAYS_INLINE raw_ref& operator=(const raw_ref& p) noexcept { - PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. - inner_.operator=(p.inner_); - return *this; - } - - PA_ALWAYS_INLINE raw_ref& operator=(raw_ref&& p) noexcept { - PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. - inner_.operator=(std::move(p.inner_)); - if constexpr (need_clear_after_move) { - p.inner_ = nullptr; - } - return *this; - } - - // Deliberately implicit in order to support implicit upcast. - template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> - // NOLINTNEXTLINE(google-explicit-constructor) - PA_ALWAYS_INLINE raw_ref(const raw_ref<U, Traits>& p) noexcept - : inner_(p.inner_) { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - } - // Deliberately implicit in order to support implicit upcast. - template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> - // NOLINTNEXTLINE(google-explicit-constructor) - PA_ALWAYS_INLINE raw_ref(raw_ref<U, Traits>&& p) noexcept - : inner_(std::move(p.inner_)) { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - if constexpr (need_clear_after_move) { - p.inner_ = nullptr; - } - } - - static PA_ALWAYS_INLINE raw_ref from_ptr(T* ptr) noexcept { - PA_RAW_PTR_CHECK(ptr); - return raw_ref(*ptr); - } - - // Upcast assignment - template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> - PA_ALWAYS_INLINE raw_ref& operator=(const raw_ref<U, Traits>& p) noexcept { - PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. - inner_.operator=(p.inner_); - return *this; - } - template <class U, class = std::enable_if_t<std::is_convertible_v<U&, T&>>> - PA_ALWAYS_INLINE raw_ref& operator=(raw_ref<U, Traits>&& p) noexcept { - PA_RAW_PTR_CHECK(p.inner_.get()); // Catch use-after-move. - inner_.operator=(std::move(p.inner_)); - if constexpr (need_clear_after_move) { - p.inner_ = nullptr; - } - return *this; - } - - PA_ALWAYS_INLINE T& operator*() const { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - return inner_.operator*(); - } - - // This is an equivalent to operator*() that provides GetForExtraction rather - // rather than GetForDereference semantics (see raw_ptr.h). This should be - // used in place of operator*() when the memory referred to by the reference - // is not immediately going to be accessed. - PA_ALWAYS_INLINE T& get() const { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - return *inner_.get(); - } - - PA_ALWAYS_INLINE T* operator->() const PA_ATTRIBUTE_RETURNS_NONNULL { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - return inner_.operator->(); - } - - // This is used to verify callbacks are not invoked with dangling references. - // If the `raw_ref` references a deleted object, it will trigger an error. - // Depending on the PartitionAllocUnretainedDanglingPtr feature, this is - // either a DumpWithoutCrashing, a crash, or ignored. - PA_ALWAYS_INLINE void ReportIfDangling() const noexcept { - inner_.ReportIfDangling(); - } - - friend PA_ALWAYS_INLINE void swap(raw_ref& lhs, raw_ref& rhs) noexcept { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - swap(lhs.inner_, rhs.inner_); - } - - template <class U> - friend PA_ALWAYS_INLINE bool operator==(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ == rhs.inner_; - } - template <class U> - friend PA_ALWAYS_INLINE bool operator!=(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ != rhs.inner_; - } - template <class U> - friend PA_ALWAYS_INLINE bool operator<(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ < rhs.inner_; - } - template <class U> - friend PA_ALWAYS_INLINE bool operator>(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ > rhs.inner_; - } - template <class U> - friend PA_ALWAYS_INLINE bool operator<=(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ <= rhs.inner_; - } - template <class U> - friend PA_ALWAYS_INLINE bool operator>=(const raw_ref& lhs, - const raw_ref<U, Traits>& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ >= rhs.inner_; - } - - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator==(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ == &rhs; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator!=(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ != &rhs; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator<(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ < &rhs; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator>(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ > &rhs; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator<=(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ <= &rhs; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator>=(const raw_ref& lhs, const U& rhs) { - PA_RAW_PTR_CHECK(lhs.inner_.get()); // Catch use-after-move. - return lhs.inner_ >= &rhs; - } - - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator==(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs == rhs.inner_; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator!=(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs != rhs.inner_; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator<(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs < rhs.inner_; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator>(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs > rhs.inner_; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator<=(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs <= rhs.inner_; - } - template <class U, class = std::enable_if_t<!internal::is_raw_ref_v<U>, void>> - friend PA_ALWAYS_INLINE bool operator>=(const U& lhs, const raw_ref& rhs) { - PA_RAW_PTR_CHECK(rhs.inner_.get()); // Catch use-after-move. - return &lhs >= rhs.inner_; - } - - private: - template <class U, typename R> - friend class raw_ref; - - Inner inner_; -}; - -// CTAD deduction guide. -template <class T> -raw_ref(T&) -> raw_ref<T>; -template <class T> -raw_ref(const T&) -> raw_ref<const T>; - -// Template helpers for working with raw_ref<T>. -template <typename T> -struct IsRawRef : std::false_type {}; - -template <typename T, typename Traits> -struct IsRawRef<raw_ref<T, Traits>> : std::true_type {}; - -template <typename T> -inline constexpr bool IsRawRefV = IsRawRef<T>::value; - -template <typename T> -struct RemoveRawRef { - using type = T; -}; - -template <typename T, typename Traits> -struct RemoveRawRef<raw_ref<T, Traits>> { - using type = T; -}; - -template <typename T> -using RemoveRawRefT = typename RemoveRawRef<T>::type; - -} // namespace base - -using base::raw_ref; - -namespace std { - -// Override so set/map lookups do not create extra raw_ref. This also -// allows C++ references to be used for lookup. -template <typename T, typename Traits> -struct less<raw_ref<T, Traits>> { - using Impl = typename raw_ref<T, Traits>::Impl; - using is_transparent = void; - - bool operator()(const raw_ref<T, Traits>& lhs, - const raw_ref<T, Traits>& rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } - - bool operator()(T& lhs, const raw_ref<T, Traits>& rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } - - bool operator()(const raw_ref<T, Traits>& lhs, T& rhs) const { - Impl::IncrementLessCountForTest(); - return lhs < rhs; - } -}; - -} // namespace std +// Although `raw_ref` is part of the standalone PA distribution, it is +// easier to use the shorter path in `//base/memory`. We retain this +// facade header for ease of typing. +#include "base/allocator/partition_allocator/pointers/raw_ref.h" // IWYU pragma: export #endif // BASE_MEMORY_RAW_REF_H_
diff --git a/base/notreached.h b/base/notreached.h index 07f9d7de..8452758 100644 --- a/base/notreached.h +++ b/base/notreached.h
@@ -21,7 +21,7 @@ // wild before always turning NOTREACHED()s FATAL. // // TODO(crbug.com/851128): Turn NOTREACHED() FATAL and mark them [[noreturn]]. -#if CHECK_WILL_STREAM() +#if CHECK_WILL_STREAM() || BUILDFLAG(ENABLE_LOG_ERROR_NOT_REACHED) #define NOTREACHED() \ CHECK_FUNCTION_IMPL( \ ::logging::NotReachedError::NotReached(__FILE__, __LINE__), false)
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 35be3ae..f275105 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -11.20230120.0.1 +11.20230120.1.1
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index 18a09f3..a43b848 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -437,10 +437,10 @@ "trees/viewport_layers.cc", "trees/viewport_layers.h", "trees/viewport_property_ids.h", + "view_transition/view_transition_element_id.cc", + "view_transition/view_transition_element_id.h", "view_transition/view_transition_request.cc", "view_transition/view_transition_request.h", - "view_transition/view_transition_shared_element_id.cc", - "view_transition/view_transition_shared_element_id.h", ] public_deps = [
diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc index 4ccda6e..91b23dc 100644 --- a/cc/animation/animation_host.cc +++ b/cc/animation/animation_host.cc
@@ -155,13 +155,12 @@ has_smil_animation_.Write(*this) = has_smil_animation; } -bool AnimationHost::HasSharedElementTransition() const { - return has_shared_element_transition_.Read(*this); +bool AnimationHost::HasViewTransition() const { + return has_view_transition_.Read(*this); } -void AnimationHost::SetHasSharedElementTransition( - bool has_shared_element_transition) { - has_shared_element_transition_.Write(*this) = has_shared_element_transition; +void AnimationHost::SetHasViewTransition(bool has_view_transition) { + has_view_transition_.Write(*this) = has_view_transition; } void AnimationHost::SetCurrentFrameHadRaf(bool current_frame_had_raf) { @@ -345,7 +344,7 @@ host_impl->SetHasCanvasInvalidation(HasCanvasInvalidation()); host_impl->SetHasInlineStyleMutation(HasJSAnimation()); host_impl->SetHasSmilAnimation(HasSmilAnimation()); - host_impl->SetHasSharedElementTransition(HasSharedElementTransition()); + host_impl->SetHasViewTransition(HasViewTransition()); if (needs_push_properties()) { needs_push_properties_.Write(*this) = false;
diff --git a/cc/animation/animation_host.h b/cc/animation/animation_host.h index b22c471..1f5f2e4 100644 --- a/cc/animation/animation_host.h +++ b/cc/animation/animation_host.h
@@ -209,7 +209,7 @@ bool HasCanvasInvalidation() const override; bool HasJSAnimation() const override; bool HasSmilAnimation() const override; - bool HasSharedElementTransition() const override; + bool HasViewTransition() const override; // Starts/stops throughput tracking represented by |sequence_id|. void StartThroughputTracking(TrackedAnimationSequenceId sequence_id); @@ -219,7 +219,7 @@ void SetHasCanvasInvalidation(bool has_canvas_invalidation); void SetHasInlineStyleMutation(bool has_inline_style_mutation); void SetHasSmilAnimation(bool has_svg_smil_animation); - void SetHasSharedElementTransition(bool hash_shared_element_transition); + void SetHasViewTransition(bool has_view_transition); void SetCurrentFrameHadRaf(bool current_frame_had_raf); void SetNextFrameHasPendingRaf(bool next_frame_has_pending_raf); @@ -289,7 +289,7 @@ ProtectedSequenceReadable<bool> has_canvas_invalidation_{false}; ProtectedSequenceReadable<bool> has_inline_style_mutation_{false}; ProtectedSequenceReadable<bool> has_smil_animation_{false}; - ProtectedSequenceReadable<bool> has_shared_element_transition_{false}; + ProtectedSequenceReadable<bool> has_view_transition_{false}; ProtectedSequenceWritable<PendingThroughputTrackerInfos> pending_throughput_tracker_infos_;
diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h index 2e21ab5..4504b8e6 100644 --- a/cc/layers/render_surface_impl.h +++ b/cc/layers/render_surface_impl.h
@@ -18,7 +18,7 @@ #include "cc/layers/layer_collections.h" #include "cc/trees/occlusion.h" #include "cc/trees/property_tree.h" -#include "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" #include "components/viz/common/quads/compositor_render_pass.h" #include "components/viz/common/quads/shared_quad_state.h" #include "components/viz/common/surfaces/subtree_capture_id.h"
diff --git a/cc/trees/effect_node.h b/cc/trees/effect_node.h index 4c305773..c329bea7 100644 --- a/cc/trees/effect_node.h +++ b/cc/trees/effect_node.h
@@ -8,7 +8,7 @@ #include "cc/cc_export.h" #include "cc/paint/element_id.h" #include "cc/paint/filter_operations.h" -#include "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" #include "components/viz/common/surfaces/subtree_capture_id.h" #include "components/viz/common/view_transition_element_resource_id.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 12a1491e..940f15c 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -780,7 +780,7 @@ mutator_host_->HasSmilAnimation()) { frame_trackers_.StartSequence( FrameSequenceTrackerType::kMainThreadAnimation); - if (mutator_host_->HasSharedElementTransition()) { + if (mutator_host_->HasViewTransition()) { frame_trackers_.StartSequence( FrameSequenceTrackerType::kSETMainThreadAnimation); } @@ -2546,7 +2546,7 @@ FrameSequenceTrackerType::kMainThreadAnimation); frame_trackers_.StopSequence( FrameSequenceTrackerType::kSETMainThreadAnimation); - } else if (!mutator_host_->HasSharedElementTransition()) { + } else if (!mutator_host_->HasViewTransition()) { frame_trackers_.StopSequence( FrameSequenceTrackerType::kSETMainThreadAnimation); } @@ -4302,7 +4302,7 @@ FrameSequenceTrackerType::kCompositorAnimation); } - if (animated && mutator_host_->HasSharedElementTransition()) { + if (animated && mutator_host_->HasViewTransition()) { frame_trackers_.StartSequence( FrameSequenceTrackerType::kSETCompositorAnimation); } else { @@ -5150,9 +5150,9 @@ void LayerTreeHostImpl::SetUkmSmoothnessDestination( base::WritableSharedMemoryMapping ukm_smoothness_data) { - ukm_smoothness_mapping_ = std::move(ukm_smoothness_data); dropped_frame_counter_.SetUkmSmoothnessDestination( - ukm_smoothness_mapping_.GetMemoryAs<UkmSmoothnessDataShared>()); + ukm_smoothness_data.GetMemoryAs<UkmSmoothnessDataShared>()); + ukm_smoothness_mapping_ = std::move(ukm_smoothness_data); } void LayerTreeHostImpl::NotifyDidPresentCompositorFrameOnImplThread(
diff --git a/cc/trees/mutator_host.h b/cc/trees/mutator_host.h index aed5595..74fddb4 100644 --- a/cc/trees/mutator_host.h +++ b/cc/trees/mutator_host.h
@@ -141,7 +141,7 @@ virtual bool HasCanvasInvalidation() const = 0; virtual bool HasJSAnimation() const = 0; virtual bool HasSmilAnimation() const = 0; - virtual bool HasSharedElementTransition() const = 0; + virtual bool HasViewTransition() const = 0; // Iterates through all animations and returns the minimum tick interval. // Returns 0 if there is a continuous animation which should be ticked
diff --git a/cc/view_transition/view_transition_shared_element_id.cc b/cc/view_transition/view_transition_element_id.cc similarity index 95% rename from cc/view_transition/view_transition_shared_element_id.cc rename to cc/view_transition/view_transition_element_id.cc index ed88e6e1..066c5f3 100644 --- a/cc/view_transition/view_transition_shared_element_id.cc +++ b/cc/view_transition/view_transition_element_id.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 "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" #include <sstream> #include <string>
diff --git a/cc/view_transition/view_transition_shared_element_id.h b/cc/view_transition/view_transition_element_id.h similarity index 85% rename from cc/view_transition/view_transition_shared_element_id.h rename to cc/view_transition/view_transition_element_id.h index f3e4118..7590fb5 100644 --- a/cc/view_transition/view_transition_shared_element_id.h +++ b/cc/view_transition/view_transition_element_id.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 CC_VIEW_TRANSITION_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ -#define CC_VIEW_TRANSITION_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ +#ifndef CC_VIEW_TRANSITION_VIEW_TRANSITION_ELEMENT_ID_H_ +#define CC_VIEW_TRANSITION_VIEW_TRANSITION_ELEMENT_ID_H_ #include <stdint.h> @@ -23,7 +23,7 @@ ViewTransitionElementId(ViewTransitionElementId&&); ~ViewTransitionElementId(); - // Add a shared index to this id. It must have a valid document tag. + // Add an element index to this id. It must have a valid document tag. void AddIndex(uint32_t index); // Returns true if the document tag matches this id and the index is in the @@ -61,4 +61,4 @@ } // namespace cc -#endif // CC_VIEW_TRANSITION_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ +#endif // CC_VIEW_TRANSITION_VIEW_TRANSITION_ELEMENT_ID_H_
diff --git a/cc/view_transition/view_transition_request.cc b/cc/view_transition/view_transition_request.cc index b7b24b9..81db4a28 100644 --- a/cc/view_transition/view_transition_request.cc +++ b/cc/view_transition/view_transition_request.cc
@@ -14,7 +14,7 @@ #include "base/functional/callback_helpers.h" #include "base/memory/ptr_util.h" #include "base/ranges/algorithm.h" -#include "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" #include "components/viz/common/quads/compositor_frame_transition_directive.h" #include "components/viz/common/quads/compositor_render_pass.h"
diff --git a/cc/view_transition/view_transition_request.h b/cc/view_transition/view_transition_request.h index 6ff8490..6d27beb0 100644 --- a/cc/view_transition/view_transition_request.h +++ b/cc/view_transition/view_transition_request.h
@@ -13,7 +13,7 @@ #include "base/functional/callback.h" #include "cc/cc_export.h" -#include "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" #include "components/viz/common/quads/compositor_frame_transition_directive.h" #include "components/viz/common/quads/compositor_render_pass.h"
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index b9c3027a..d455138f 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -454,6 +454,7 @@ "java/res/layout/auto_sign_in_first_run_dialog.xml", "java/res/layout/autofill_billing_address_dropdown.xml", "java/res/layout/autofill_card_unmask_prompt.xml", + "java/res/layout/autofill_card_unmask_prompt_card_details.xml", "java/res/layout/autofill_card_unmask_prompt_new.xml", "java/res/layout/autofill_cc_details.xml", "java/res/layout/autofill_expiration_date_fix_flow.xml",
diff --git a/chrome/android/expectations/monochrome_public_bundle__base.AndroidManifest.expected b/chrome/android/expectations/monochrome_public_bundle__base.AndroidManifest.expected index 5bd302d..c45c2ff3 100644 --- a/chrome/android/expectations/monochrome_public_bundle__base.AndroidManifest.expected +++ b/chrome/android/expectations/monochrome_public_bundle__base.AndroidManifest.expected
@@ -853,6 +853,7 @@ <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <meta-data android:name="com.google.ar.core" android:value="optional"/> <meta-data android:name="com.google.ar.core.min_apk_version" android:value="221020000"/> + <meta-data android:name="com.google.ar.core.session_settings" android:value="allow_front_facing_motion_tracking_6dof,"/> <meta-data android:name="com.samsung.android.sdk.multiwindow.enable" android:value="true"/> <meta-data android:name="com.samsung.android.sdk.multiwindow.penwindow.enable" android:value="true"/> <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES" android:value="5"/>
diff --git a/chrome/android/expectations/trichrome_chrome_bundle__base.AndroidManifest.expected b/chrome/android/expectations/trichrome_chrome_bundle__base.AndroidManifest.expected index 294a034..151f868 100644 --- a/chrome/android/expectations/trichrome_chrome_bundle__base.AndroidManifest.expected +++ b/chrome/android/expectations/trichrome_chrome_bundle__base.AndroidManifest.expected
@@ -800,6 +800,7 @@ <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <meta-data android:name="com.google.ar.core" android:value="optional"/> <meta-data android:name="com.google.ar.core.min_apk_version" android:value="221020000"/> + <meta-data android:name="com.google.ar.core.session_settings" android:value="allow_front_facing_motion_tracking_6dof,"/> <meta-data android:name="com.samsung.android.sdk.multiwindow.enable" android:value="true"/> <meta-data android:name="com.samsung.android.sdk.multiwindow.penwindow.enable" android:value="true"/> <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES" android:value="5"/>
diff --git a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTabSwitcherTest.java b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTabSwitcherTest.java index acc8f1d7..4c240ed1 100644 --- a/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTabSwitcherTest.java +++ b/chrome/android/features/start_surface/javatests/src/org/chromium/chrome/features/start_surface/InstantStartTabSwitcherTest.java
@@ -22,6 +22,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.chromium.chrome.features.start_surface.StartSurfaceTestUtils.INSTANT_START_TEST_BASE_PARAMS; import static org.chromium.ui.test.util.ViewUtils.onViewWaiting; @@ -368,7 +369,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_NATIVE_INITIALIZATION, INSTANT_START_TEST_BASE_PARAMS, FeedPlaceholderLayout.DISABLE_ANIMATION_SWITCH}) - public void testScrollToSelectedTab() throws IOException { + public void testScrollToSelectedTab() throws Exception { // clang-format on StartSurfaceTestUtils.createTabStateFile(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, null, 5); StartSurfaceTestUtils.startMainActivityFromLauncher(mActivityTestRule); @@ -389,6 +390,9 @@ Assert.assertTrue(v instanceof RecyclerView); LinearLayoutManager layoutManager = (LinearLayoutManager) ((RecyclerView) v).getLayoutManager(); + assertEquals(2, layoutManager.findFirstVisibleItemPosition()); + assertTrue(layoutManager.isViewPartiallyVisible( + layoutManager.getChildAt(5), false, false)); assertEquals(7, layoutManager.findLastVisibleItemPosition()); });
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java index f232602a..3c068fff7 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java
@@ -4,8 +4,6 @@ package org.chromium.chrome.browser.tasks.tab_management; -import static org.chromium.chrome.browser.tasks.tab_management.TabSwitcherMediator.INITIAL_SCROLL_INDEX_OFFSET_GTS; - import android.app.Activity; import android.content.ComponentName; import android.content.Context; @@ -535,8 +533,7 @@ } List<Tab> relatedTabs = getRelatedTabs(mCurrentTabId); Tab currentTab = mTabModelSelector.getTabById(mCurrentTabId); - int initialPosition = - Math.max(relatedTabs.indexOf(currentTab) - INITIAL_SCROLL_INDEX_OFFSET_GTS, 0); + int initialPosition = relatedTabs.indexOf(currentTab); mModel.set(TabGridPanelProperties.INITIAL_SCROLL_INDEX, initialPosition); }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinder.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinder.java index 2d00bce..07b2d0a 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinder.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinder.java
@@ -34,9 +34,10 @@ import android.widget.FrameLayout; import androidx.annotation.Nullable; -import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import org.chromium.chrome.browser.tab.TabUtils; import org.chromium.ui.base.ViewUtils; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; @@ -127,8 +128,13 @@ } } else if (INITIAL_SCROLL_INDEX == propertyKey) { int index = (Integer) model.get(INITIAL_SCROLL_INDEX); - ((LinearLayoutManager) viewHolder.contentView.getLayoutManager()) - .scrollToPositionWithOffset(index, 0); + RecyclerView view = viewHolder.contentView; + if (view.getWidth() == 0 || view.getHeight() == 0) { + // If layout hasn't happened post the scroll index change until layout happens. + view.post(() -> setScrollIndex(view, index)); + return; + } + setScrollIndex(viewHolder.contentView, index); } else if (IS_MAIN_CONTENT_VISIBLE == propertyKey) { viewHolder.contentView.setVisibility(View.VISIBLE); } else if (MENU_CLICK_LISTENER == propertyKey) { @@ -165,4 +171,18 @@ } } } + + private static void setScrollIndex(RecyclerView view, int index) { + GridLayoutManager layoutManager = (GridLayoutManager) view.getLayoutManager(); + int offset = computeOffset(view, layoutManager); + layoutManager.scrollToPositionWithOffset(index, offset); + } + + private static int computeOffset(View view, GridLayoutManager layoutManager) { + int width = view.getWidth(); + int height = view.getHeight(); + int cardWidth = width / layoutManager.getSpanCount(); + int cardHeight = TabUtils.deriveGridCardHeight(cardWidth, view.getContext()); + return height / 2 - cardHeight / 2; + } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerProperties.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerProperties.java index 93e10b58..aa329c5 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerProperties.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerProperties.java
@@ -40,7 +40,13 @@ public static final PropertyModel.WritableIntPropertyKey BOTTOM_PADDING = new PropertyModel.WritableIntPropertyKey(); + /** + * Same as {@link TabListCoordinator.TabListMode}. + */ + public static final PropertyModel.WritableIntPropertyKey MODE = + new PropertyModel.WritableIntPropertyKey(); + public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {IS_VISIBLE, IS_INCOGNITO, VISIBILITY_LISTENER, INITIAL_SCROLL_INDEX, ANIMATE_VISIBILITY_CHANGES, TOP_MARGIN, - BOTTOM_CONTROLS_HEIGHT, SHADOW_TOP_OFFSET, BOTTOM_PADDING}; + BOTTOM_CONTROLS_HEIGHT, SHADOW_TOP_OFFSET, BOTTOM_PADDING, MODE}; }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinder.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinder.java index 63c59408..b8788c9b 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinder.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinder.java
@@ -10,14 +10,20 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.INITIAL_SCROLL_INDEX; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_INCOGNITO; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE; +import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.MODE; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.SHADOW_TOP_OFFSET; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_MARGIN; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER; +import android.app.Activity; +import android.graphics.Rect; import android.widget.FrameLayout; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; +import org.chromium.chrome.browser.tab.TabUtils; +import org.chromium.chrome.tab_ui.R; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.ui.base.ViewUtils; import org.chromium.ui.modelutil.PropertyKey; @@ -47,9 +53,11 @@ } else if (VISIBILITY_LISTENER == propertyKey) { view.setVisibilityListener(model.get(VISIBILITY_LISTENER)); } else if (INITIAL_SCROLL_INDEX == propertyKey) { - // RecyclerView#scrollToPosition(int) behaves incorrectly first time after cold start. int index = (Integer) model.get(INITIAL_SCROLL_INDEX); - ((LinearLayoutManager) view.getLayoutManager()).scrollToPositionWithOffset(index, 0); + int offset = computeOffset(view, model); + // RecyclerView#scrollToPosition(int) behaves incorrectly first time after cold start. + ((LinearLayoutManager) view.getLayoutManager()) + .scrollToPositionWithOffset(index, offset); } else if (TOP_MARGIN == propertyKey) { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams(); final int newTopMargin = model.get(TOP_MARGIN); @@ -67,4 +75,52 @@ view.setBottomPadding(model.get(BOTTOM_PADDING)); } } + + private static int computeOffset(TabListRecyclerView view, PropertyModel model) { + int width = view.getWidth(); + int height = view.getHeight(); + // If layout hasn't happened yet fallback to dimensions based on visible display frame. This + // works for multi-window and different orientations. Don't use View#post() because this + // will cause animation jank for expand/shrink animations. + if (width == 0 || height == 0) { + Rect frame = new Rect(); + ((Activity) view.getContext()) + .getWindow() + .getDecorView() + .getWindowVisibleDisplayFrame(frame); + width = frame.width(); + // Remove toolbar height from height. + height = frame.height() + - view.getContext().getResources().getDimensionPixelSize( + R.dimen.toolbar_height_no_shadow); + } + if (width <= 0 || height <= 0) return 0; + + @TabListCoordinator.TabListMode + int mode = model.get(MODE); + LinearLayoutManager layoutManager = (LinearLayoutManager) view.getLayoutManager(); + if (mode == TabListCoordinator.TabListMode.GRID) { + GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager; + int cardWidth = width / gridLayoutManager.getSpanCount(); + int cardHeight = TabUtils.deriveGridCardHeight(cardWidth, view.getContext()); + return Math.max(0, height / 2 - cardHeight / 2); + } + if (mode == TabListCoordinator.TabListMode.CAROUSEL) { + return Math.max(0, + width / 2 + - view.getContext().getResources().getDimensionPixelSize( + R.dimen.tab_carousel_card_width) + / 2); + } + if (mode == TabListCoordinator.TabListMode.LIST) { + // Avoid divide by 0 when there are no tabs. + if (layoutManager.getItemCount() == 0) return 0; + + return Math.max(0, + height / 2 + - view.computeVerticalScrollRange() / layoutManager.getItemCount() / 2); + } + assert false : "Unexpected MODE when setting INITIAL_SCROLL_INDEX."; + return 0; + } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediator.java index 2a3bc80f..c307c5d8 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediator.java
@@ -10,6 +10,7 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.INITIAL_SCROLL_INDEX; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_INCOGNITO; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE; +import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.MODE; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.SHADOW_TOP_OFFSET; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_MARGIN; import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER; @@ -81,11 +82,6 @@ TabSwitcherCustomViewManager.Delegate, BackPressHandler { private static final String TAG = "TabSwitcherMediator"; - // This should be the same as TabListCoordinator.GRID_LAYOUT_SPAN_COUNT for the selected tab - // to be on the 2nd row. - static final int INITIAL_SCROLL_INDEX_OFFSET_GTS = 2; - static final int INITIAL_SCROLL_INDEX_OFFSET_CAROUSEL = 1; - private static final int DEFAULT_TOP_PADDING = 0; // Count histograms for tab counts when showing switcher. @@ -294,6 +290,7 @@ mBrowserControlsStateProvider = browserControlsStateProvider; mMultiWindowModeStateDispatcher = multiWindowModeStateDispatcher; mMode = mode; + mContainerViewModel.set(MODE, mode); mContext = context; if (incognitoReauthControllerSupplier != null) { @@ -761,12 +758,9 @@ } private void setInitialScrollIndexOffset() { - int offset = mMode == TabListMode.CAROUSEL ? INITIAL_SCROLL_INDEX_OFFSET_CAROUSEL - : INITIAL_SCROLL_INDEX_OFFSET_GTS; - int initialPosition = Math.max( - mTabModelSelector.getTabModelFilterProvider().getCurrentTabModelFilter().index() - - offset, - 0); + int initialPosition = + mTabModelSelector.getTabModelFilterProvider().getCurrentTabModelFilter().index(); + // In MRU order, selected Tab is always at the first position. if (mShowTabsInMruOrder) initialPosition = 0; mContainerViewModel.set(INITIAL_SCROLL_INDEX, initialPosition);
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinderTest.java index 0d64711..8ce7dd44b 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinderTest.java
@@ -4,6 +4,15 @@ package org.chromium.chrome.browser.tasks.tab_management; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.lessThan; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.hamcrest.MockitoHamcrest.intThat; + import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.areAnimatorsEnabled; import android.content.res.ColorStateList; @@ -31,6 +40,7 @@ import org.junit.runner.RunWith; import org.chromium.base.test.UiThreadTest; +import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.chrome.browser.tasks.tab_management.TabGridDialogView.VisibilityListener; @@ -50,6 +60,7 @@ * Tests for {@link TabGridPanelViewBinder}. */ @RunWith(ChromeJUnit4ClassRunner.class) +@Batch(Batch.PER_CLASS) public class TabGridPanelViewBinderTest extends BlankUiTestActivityTestCase { private static final String TAG = "TGPVBT"; private static final int CONTENT_TOP_MARGIN = 56; @@ -64,6 +75,7 @@ private EditText mTitleTextView; private View mMainContent; private ScrimCoordinator mScrimCoordinator; + private GridLayoutManager mLayoutManager; @Override public void setUpTest() throws Exception { @@ -74,7 +86,8 @@ mContentView = (TabListRecyclerView) LayoutInflater.from(getActivity()) .inflate(R.layout.tab_list_recycler_view_layout, parentView, false); - mContentView.setLayoutManager(new GridLayoutManager(getActivity(), 2)); + mLayoutManager = spy(new GridLayoutManager(getActivity(), 2)); + mContentView.setLayoutManager(mLayoutManager); mToolbarView = (TabGroupUiToolbarView) LayoutInflater.from(getActivity()) .inflate(R.layout.bottom_tab_grid_toolbar, mContentView, false); LayoutInflater.from(getActivity()) @@ -468,6 +481,19 @@ Assert.assertNotNull(mTabGridDialogView.getVisibilityListenerForTesting()); } + @Test + @SmallTest + @UiThreadTest + public void testSetInitialScrollIndex() { + mContentView.layout(0, 0, 100, 500); + + mModel.set(TabGridPanelProperties.INITIAL_SCROLL_INDEX, 5); + + verify(mLayoutManager, times(1)) + .scrollToPositionWithOffset(eq(5), + intThat(allOf(lessThan(mContentView.getHeight() / 2), greaterThan(0)))); + } + @Override public void tearDownTest() throws Exception { TestThreadUtils.runOnUiThreadBlocking(mMCP::destroy);
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java index d7e42cbc..9c543df 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerViewBinderTest.java
@@ -6,8 +6,17 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.lessThan; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.hamcrest.MockitoHamcrest.intThat; import static org.chromium.chrome.browser.tasks.tab_management.TabUiTestHelper.areAnimatorsEnabled; @@ -16,6 +25,8 @@ import android.widget.FrameLayout; import android.widget.ImageView; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; import androidx.test.filters.MediumTest; import org.hamcrest.Matchers; @@ -24,10 +35,12 @@ import org.junit.Test; import org.junit.rules.TestRule; import org.junit.runner.RunWith; +import org.mockito.Spy; import org.chromium.base.CommandLine; import org.chromium.base.MathUtils; import org.chromium.base.test.UiThreadTest; +import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; @@ -49,6 +62,7 @@ */ @RunWith(ChromeJUnit4ClassRunner.class) @Features.EnableFeatures({ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID}) +@Batch(Batch.PER_CLASS) public class TabListContainerViewBinderTest extends BlankUiTestActivityTestCase { /** * BlankUiTestActivityTestCase also needs {@link ChromeFeatureList}'s @@ -63,6 +77,10 @@ private PropertyModel mContainerModel; private PropertyModelChangeProcessor mMCP; private TabListRecyclerView mRecyclerView; + @Spy + private GridLayoutManager mGridLayoutManager; + @Spy + private LinearLayoutManager mLinearLayoutManager; private CallbackHelper mStartedShowingCallback; private CallbackHelper mFinishedShowingCallback; private CallbackHelper mStartedHidingCallback; @@ -119,6 +137,20 @@ }); } + private void setUpGridLayoutManager() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mGridLayoutManager = spy(new GridLayoutManager(getActivity(), 2)); + mRecyclerView.setLayoutManager(mGridLayoutManager); + }); + } + + private void setUpLinearLayoutManager() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mLinearLayoutManager = spy(new LinearLayoutManager(getActivity())); + mRecyclerView.setLayoutManager(mLinearLayoutManager); + }); + } + @Test @MediumTest // clang-format off @@ -291,6 +323,72 @@ assertThat(mRecyclerView.getPaddingBottom(), equalTo(CONTAINER_HEIGHT)); } + @Test + @MediumTest + @UiThreadTest + public void testSetInitialScrollIndex_Carousel() { + setUpLinearLayoutManager(); + mRecyclerView.layout(0, 0, 1000, 100); + + mContainerModel.set( + TabListContainerProperties.MODE, TabListCoordinator.TabListMode.CAROUSEL); + mContainerModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 3); + + // Offset will be view width (1000) / 2 - tab card width calculated from dp dimension / 2. + verify(mLinearLayoutManager, times(1)) + .scrollToPositionWithOffset(eq(3), + intThat(allOf(lessThan(mRecyclerView.getWidth() / 2), greaterThan(0)))); + } + + @Test + @MediumTest + @UiThreadTest + public void testSetInitialScrollIndex_Grid() { + setUpGridLayoutManager(); + mRecyclerView.layout(0, 0, 100, 500); + + mContainerModel.set(TabListContainerProperties.MODE, TabListCoordinator.TabListMode.GRID); + mContainerModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 5); + + // Offset will be view height (500) / 2 - tab card height calculated from TabUtils / 2 + verify(mGridLayoutManager, times(1)) + .scrollToPositionWithOffset(eq(5), + intThat(allOf(lessThan(mRecyclerView.getHeight() / 2), greaterThan(0)))); + } + + @Test + @MediumTest + @UiThreadTest + public void testSetInitialScrollIndex_List_NoTabs() { + setUpLinearLayoutManager(); + mRecyclerView.layout(0, 0, 100, 500); + + mContainerModel.set(TabListContainerProperties.MODE, TabListCoordinator.TabListMode.LIST); + mContainerModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 7); + + // Offset will be 0 to avoid divide by 0 with no tabs. + verify(mLinearLayoutManager, times(1)).scrollToPositionWithOffset(eq(7), eq(0)); + } + + @Test + @MediumTest + @UiThreadTest + public void testSetInitialScrollIndex_List_WithTabs() { + setUpLinearLayoutManager(); + mRecyclerView.layout(0, 0, 100, 500); + + doReturn(9).when(mLinearLayoutManager).getItemCount(); + int range = mRecyclerView.computeVerticalScrollRange(); + + mContainerModel.set(TabListContainerProperties.MODE, TabListCoordinator.TabListMode.LIST); + mContainerModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 5); + + // 9 Tabs at 900 scroll extent = 100 per tab. With view height of 500 the offset is + // 500 / 2 - range / 9 / 2 = result. + verify(mLinearLayoutManager, times(1)) + .scrollToPositionWithOffset(eq(5), eq(250 - range / 9 / 2)); + } + @Override public void tearDownTest() throws Exception { TestThreadUtils.runOnUiThreadBlocking(mMCP::destroy);
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java index 73b8ebeb..78ec6d6 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediatorUnitTest.java
@@ -29,6 +29,7 @@ import android.view.View; import android.widget.EditText; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -1270,6 +1271,26 @@ } @Test + public void testScrollToTab() { + // Mock that tab1, tab2 and newTab are in the same group and newTab is the root tab. + TabImpl newTab = prepareTab(TAB3_ID, TAB3_TITLE); + List<Tab> tabgroup = new ArrayList<>(Arrays.asList(mTab1, mTab2, newTab)); + createTabGroup(tabgroup, TAB2_ID); + + // Mock that mTab2 is the current tab for the dialog. + doReturn(0).when(mTabGroupModelFilter).indexOf(mTab1); + doReturn(mTab2).when(mTabGroupModelFilter).getTabAt(0); + doReturn(TAB2_ID).when(mTabModelSelector).getCurrentTabId(); + doReturn(mTab2).when(mTabModelSelector).getTabById(TAB2_ID); + doReturn(tabgroup).when(mTabGroupModelFilter).getRelatedTabList(TAB2_ID); + + // Reset and confirm scroll index. + mMediator.onReset(tabgroup); + + Assert.assertEquals(1, mModel.get(TabGridPanelProperties.INITIAL_SCROLL_INDEX).intValue()); + } + + @Test public void destroy() { mMediator.destroy();
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java index 1089f51..b60250f 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherMediatorUnitTest.java
@@ -476,15 +476,15 @@ doReturn(1).when(mTabModelFilter).index(); mTabModelSelectorObserverCaptor.getValue().onTabModelSelected(incognitoTabModel, mTabModel); - assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(0)); + assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(1)); doReturn(2).when(mTabModelFilter).index(); mTabModelSelectorObserverCaptor.getValue().onTabModelSelected(incognitoTabModel, mTabModel); - assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(0)); + assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(2)); doReturn(3).when(mTabModelFilter).index(); mTabModelSelectorObserverCaptor.getValue().onTabModelSelected(incognitoTabModel, mTabModel); - assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(1)); + assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(3)); } @Test @@ -576,10 +576,11 @@ mMediator.showTabSwitcherView(true); assertThat(mModel.get(TabListContainerProperties.IS_VISIBLE), equalTo(true)); - mModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 1); + // Set to an "invalid" value and ensure it gets changed. + mModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 1337); mTabModelObserverCaptor.getValue().restoreCompleted(); - assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(0)); + assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(2)); } @Test @@ -715,10 +716,11 @@ initAndAssertAllProperties(); doReturn(true).when(mTabModelSelector).isTabStateInitialized(); - mModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 1); + // Set to an "invalid" value and ensure it gets changed. + mModel.set(TabListContainerProperties.INITIAL_SCROLL_INDEX, 1337); mMediator.prepareTabSwitcherView(); - assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(0)); + assertThat(mModel.get(TabListContainerProperties.INITIAL_SCROLL_INDEX), equalTo(2)); } @Test
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml index c6f5b3b..74502dc 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml
@@ -1245,6 +1245,12 @@ <!-- ARCore APK integration --> <!-- This tag indicates that this application optionally uses ARCore. --> <meta-data android:name="com.google.ar.core" android:value="optional" /> + + {% block base_application_extra_arcore_definitions %} + <meta-data android:name="com.google.ar.core.session_settings" + android:value="allow_front_facing_motion_tracking_6dof," /> + {% endblock base_application_extra_arcore_definitions %} + {% endif %} <!-- Cast support -->
diff --git a/chrome/android/java/res/layout/autofill_card_unmask_prompt_card_details.xml b/chrome/android/java/res/layout/autofill_card_unmask_prompt_card_details.xml new file mode 100644 index 0000000..e253f5e8 --- /dev/null +++ b/chrome/android/java/res/layout/autofill_card_unmask_prompt_card_details.xml
@@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2023 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. --> + +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/card_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="4dp"> + + <org.chromium.ui.widget.ChromeImageView + android:id="@+id/card_icon" + app:srcCompat="@drawable/visa_card" + android:layout_width="32dp" + android:layout_height="20dp" + android:layout_alignParentStart="true" + android:layout_centerVertical="true" + android:layout_marginEnd="16dp" + android:scaleType="fitCenter" /> + + <LinearLayout + android:id="@+id/card_name_and_last_four_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_toEndOf="@id/card_icon"> + + <TextView + android:id="@+id/card_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxLines="1" + android:ellipsize="end" + android:layout_weight="1" + style="@style/TextAppearance.TextLarge.Primary" /> + + <TextView + android:id="@+id/card_last_four" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:maxLines="1" + android:layout_weight="0" + style="@style/TextAppearance.TextLarge.Primary" /> + </LinearLayout> + + <TextView + android:id="@+id/card_expiration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/card_name_and_last_four_container" + android:layout_toEndOf="@id/card_icon" + android:textAppearance="@style/TextAppearance.TextMedium.Secondary" /> +</RelativeLayout>
diff --git a/chrome/android/java/res/layout/autofill_card_unmask_prompt_new.xml b/chrome/android/java/res/layout/autofill_card_unmask_prompt_new.xml index cdfe996a..67ff1acc 100644 --- a/chrome/android/java/res/layout/autofill_card_unmask_prompt_new.xml +++ b/chrome/android/java/res/layout/autofill_card_unmask_prompt_new.xml
@@ -77,17 +77,26 @@ android:id="@+id/instructions" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="24dp" - android:layout_marginEnd="10dp" - android:layout_marginBottom="8dp" - android:layout_marginTop="16dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:layout_marginTop="20dp" android:textAppearance="@style/TextAppearance.AutofillCardInstructionsText" android:lineSpacingMultiplier="1.25" android:gravity="start" /> + <include + android:id="@+id/card_details_container" + layout="@layout/autofill_card_unmask_prompt_card_details" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="9dp" + android:layout_marginHorizontal="20dp" + android:visibility="gone" /> + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="10dp" android:layout_marginStart="4dp" android:orientation="horizontal">
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java index 8c2e5f2..4c6a260c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
@@ -35,6 +35,7 @@ import androidx.core.view.ViewCompat; import org.chromium.base.task.AsyncTask; +import org.chromium.build.BuildConfig; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill.AutofillUiUtils.ErrorType; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -44,6 +45,7 @@ import org.chromium.ui.modelutil.PropertyModel; import java.util.Calendar; +import java.util.Locale; /** * A prompt that bugs users to enter their CVC when unmasking a Wallet instrument (credit card). @@ -158,6 +160,24 @@ if (ChromeFeatureList.isEnabled( ChromeFeatureList.AUTOFILL_TOUCH_TO_FILL_FOR_CREDIT_CARDS_ANDROID)) { mMainView = inflater.inflate(R.layout.autofill_card_unmask_prompt_new, null); + + // TODO (crbug.com/1356735): These mock card details are added to demo the UI. Remove + // when actual card details are synced from native. Only shown in debug builds. + if (BuildConfig.ENABLE_ASSERTS) { + ViewGroup cardDetails = + (ViewGroup) mMainView.findViewById(R.id.card_details_container); + cardDetails.setVisibility(View.VISIBLE); + + String cardName = "Chase Sapphire Preferred Ultimate Rewards Card"; + String lastFour = "....1234"; + String expiration = "12/2029"; + ((TextView) mMainView.findViewById(R.id.card_name)) + .setText(String.format(Locale.ROOT, "%s", cardName)); + ((TextView) mMainView.findViewById(R.id.card_last_four)) + .setText(String.format(Locale.ROOT, "%s", lastFour)); + ((TextView) mMainView.findViewById(R.id.card_expiration)) + .setText(String.format(Locale.ROOT, "%s", expiration)); + } } else { mMainView = inflater.inflate(R.layout.autofill_card_unmask_prompt, null); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java index 4f08eac..9b0bf91 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java
@@ -84,6 +84,7 @@ // Ignore the subsequent calls since we are only interested in initializing tab // observers once. if (mCurrentTabObserver != null) return; + mAdaptiveToolbarButtonController.initializePageLoadMetricsRecorder(tabSupplier); if (!AdaptiveToolbarFeatures.isContextualPageActionsEnabled()) return;
diff --git a/chrome/android/javatests/AndroidManifest_monochrome.xml b/chrome/android/javatests/AndroidManifest_monochrome.xml index ffa7ee9..37b36e32 100644 --- a/chrome/android/javatests/AndroidManifest_monochrome.xml +++ b/chrome/android/javatests/AndroidManifest_monochrome.xml
@@ -27,6 +27,9 @@ {% endblock %} {% block base_application_definitions %} +{% endblock %} + +{% block base_application_extra_arcore_definitions %} <meta-data android:name="com.google.ar.core.session_settings" - android:value="dataset_path,/sdcard/chromium_tests_root/chrome/test/data/xr/dataset.mp4"/> + android:value="dataset_path,/sdcard/chromium_tests_root/chrome/test/data/xr/dataset.mp4,allow_front_facing_motion_tracking_6dof,"/> {% endblock %}
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index b5abd3e..9ba7bb1 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -833,22 +833,25 @@ <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_SCREEN_NEXT_BUTTON_LABEL" desc="The label of the button that is shown on preferences screen and that confirms chosen configuration and shows next demo setup screen."> Continue </message> - <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_LABEL" desc="Label for retailer id input field on the demo mode setup screen. User should provide the retailer id if assigned."> - Retailer-store ID code (optional) + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_LABEL" desc="Label for required retailer name input field on the demo mode setup screen."> + Retailer Name </message> - <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_PLACEHOLDER" desc="Placeholder for retailer id input field on the demo mode setup screen."> - Retailer-store ID code + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_PLACEHOLDER" desc="Placeholder for retailer name input field on the demo mode setup screen."> + Retailer Name </message> - <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT" desc="Help text for retailer id input field on the demo mode setup screen."> - Invalid ID. The format you entered is incorrect. Please check the instructions you received to ensure you are entering the ID in the correct format. If you’re unable to resolve this issue, please leave the field blank and continue with installation. + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_PRIVACY_DISCLAIMER" desc="Instructions and privacy disclaimer text for the retailer and store number input fields on the demo mode setup screen."> + <ph name="BEGIN_PARAGRAPH1"><p></ph>Enter the name of the retailer and the store number that this demo device is being configured for*. <ph name="END_PARAGRAPH1"></p></ph> + <ph name="BEGIN_PARAGRAPH2"><p></ph>If you don't know the store number, you can enter "0000" to continue with Demo Mode installation. <ph name="END_PARAGRAPH2"></p></ph> + <ph name="BEGIN_PARAGRAPH3"><p></ph>*Note: Google uses this information to identify which version of Demo Mode the device should receive and to measure usage of Demo Mode.<ph name="END_PARAGRAPH3"></p></ph> </message> - <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT" desc="Help text for retailer id input field on the demo mode setup screen."> - The retailer-store ID format is ABC-1234 + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_LABEL" desc="Label for store number input field on the demo mode setup screen. Input is required."> + Store Number </message> - <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_PRIVACY_DISCLAIMER" desc="Privacy disclaimer text for retailer id input field on the demo mode setup screen."> - <ph name="BEGIN_PARAGRAPH1"><p></ph>If you received instructions to enter a retailer-store ID code during Demo Mode installation, please enter it on the right*. Otherwise, you can leave this field blank and continue.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>You will still be able to install Demo Mode without a code, but it’s important to enter this code if it’s applicable to your store.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>*Note: Google uses these codes to identify which version of Demo Mode the device should receive and to measure usage of Demo Mode.<ph name="END_PARAGRAPH3"></p></ph> + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_PLACEHOLDER" desc="Placeholder for store number input field on the demo mode setup screen"> + Store Number + </message> + <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT" desc="Help text for store number input field on the demo mode setup screen"> + Use numerical digits only </message> <message name="IDS_OOBE_DEMO_SETUP_PREFERENCES_SCREEN_COUNTRY_NOT_SELECTED_TITLE" desc="The title of country not selected option for demo mode preference screen."> Please select a country
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT.png.sha1 deleted file mode 100644 index 35486d2..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -0010e36248684f522d7f227271eae4acfb8a9608 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT.png.sha1 deleted file mode 100644 index 4ed5a84..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -5fe074f4f400eb6ce036c420d145d00cd8beb09b \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_LABEL.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_LABEL.png.sha1 deleted file mode 100644 index 106532f..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_LABEL.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -78288bfd987cbde7fe9dab2f85bd4f111f8e9886 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_PLACEHOLDER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_PLACEHOLDER.png.sha1 deleted file mode 100644 index ed2aa30..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_PLACEHOLDER.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -3c536cceeb38cd775ddde4cbd4fabd85524dded3 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_PRIVACY_DISCLAIMER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_PRIVACY_DISCLAIMER.png.sha1 deleted file mode 100644 index 5ef2416c..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_PRIVACY_DISCLAIMER.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -0dc388a394f32ace1e2cbd4633b43a14bdb7703f \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_LABEL.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_LABEL.png.sha1 new file mode 100644 index 0000000..0818060 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_LABEL.png.sha1
@@ -0,0 +1 @@ +be3586038e8c15661a5cfe4d627f97fe8985b72b \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_PLACEHOLDER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_PLACEHOLDER.png.sha1 new file mode 100644 index 0000000..17d1ccc --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_PLACEHOLDER.png.sha1
@@ -0,0 +1 @@ +a7b146c3dd493fed01b9d313bc0240fe7003c1c8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_PRIVACY_DISCLAIMER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_PRIVACY_DISCLAIMER.png.sha1 new file mode 100644 index 0000000..a331ccd --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_PRIVACY_DISCLAIMER.png.sha1
@@ -0,0 +1 @@ +9ee0174e03ae037c4d053d2c194f4ba204672864 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT.png.sha1 new file mode 100644 index 0000000..b6231f5 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT.png.sha1
@@ -0,0 +1 @@ +6b6ef0887f6f44adbfb2224ca587ad66118457ef \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_LABEL.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_LABEL.png.sha1 new file mode 100644 index 0000000..3e114691 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_LABEL.png.sha1
@@ -0,0 +1 @@ +49aef22e946b9957fa054a7a7bd90c68e6e1fd8a \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_PLACEHOLDER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_PLACEHOLDER.png.sha1 new file mode 100644 index 0000000..f83c62b --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_PLACEHOLDER.png.sha1
@@ -0,0 +1 @@ +0e2062675e857bf7b89907bb5614b1ecafb6848f \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 814c145..b9e87a9 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2107,6 +2107,7 @@ "//components/dom_distiller/content/browser", "//components/dom_distiller/content/common/mojom", "//components/domain_reliability", + "//components/domain_reliability:prefs", "//components/download/content/factory", "//components/download/content/public", "//components/download/database", @@ -3328,7 +3329,6 @@ "//chrome/browser/sync/android:jni_headers", "//chrome/browser/tab:jni_headers", "//chrome/browser/touch_to_fill/payments/android:public", - "//chrome/browser/ui:adaptive_toolbar_enums_java", "//chrome/browser/ui/android/layouts:android", "//chrome/browser/ui/webui/feed_internals:mojo_bindings", "//chrome/browser/usb/android:jni_headers",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ef60d70..07751bc 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -9274,6 +9274,13 @@ "GalleryAppPdfEditNotification")}, #endif +#if BUILDFLAG(IS_CHROMEOS_ASH) + {"google-one-offer-files-banner", + flag_descriptions::kGoogleOneOfferFilesBannerName, + flag_descriptions::kGoogleOneOfferFilesBannerDescription, kOsCrOS, + FEATURE_VALUE_TYPE(ash::features::kGoogleOneOfferFilesBanner)}, +#endif + {"sync-autofill-wallet-usage-data", flag_descriptions::kSyncAutofillWalletUsageDataName, flag_descriptions::kSyncAutofillWalletUsageDataDescription, kOsAll,
diff --git a/chrome/browser/android/vr/BUILD.gn b/chrome/browser/android/vr/BUILD.gn index 7b7709d9..3498789 100644 --- a/chrome/browser/android/vr/BUILD.gn +++ b/chrome/browser/android/vr/BUILD.gn
@@ -204,7 +204,6 @@ "//components/translate/core/language_detection:language_detection", "//components/webxr:webxr", "//device/vr:vr_fakes", - "//device/vr/android/arcore", "//device/vr/public/mojom:isolated_xr_service", "//mojo/core/embedder", "//mojo/public/cpp/bindings", @@ -216,4 +215,8 @@ "//ui/android:ui_java", # TODO: Remove once http://crbug.com/951419 is # fixed! ] + + if (enable_arcore) { + deps += [ "//device/vr/android/arcore" ] + } }
diff --git a/chrome/browser/apps/icon_standardizer.cc b/chrome/browser/apps/icon_standardizer.cc index 937dd6c..3c26c4f1 100644 --- a/chrome/browser/apps/icon_standardizer.cc +++ b/chrome/browser/apps/icon_standardizer.cc
@@ -26,61 +26,7 @@ constexpr float kMinimumVisibleCircularIconSizeRatio = 0.625f; -// Returns the bounding rect for the opaque part of the icon. -gfx::Rect GetVisibleIconBounds(const SkBitmap& bitmap) { - const SkPixmap pixmap = bitmap.pixmap(); - - bool const nativeColorType = pixmap.colorType() == kN32_SkColorType; - - const int width = pixmap.width(); - const int height = pixmap.height(); - - // Overall bounds of the visible icon. - int y_from = -1; - int y_to = -1; - int x_left = width; - int x_right = -1; - - // Find bounding rect of the visible icon by going through all pixels one row - // at a time and for each row find the first and the last non-transparent - // pixel. - for (int y = 0; y < height; y++) { - const SkColor* nativeRow = - nativeColorType - ? reinterpret_cast<const SkColor*>(bitmap.getAddr32(0, y)) - : nullptr; - bool does_row_have_visible_pixels = false; - - for (int x = 0; x < width; x++) { - if (SkColorGetA(nativeRow ? nativeRow[x] : pixmap.getColor(x, y)) > - kMinimumVisibleAlpha) { - does_row_have_visible_pixels = true; - x_left = std::min(x_left, x); - break; - } - } - - // No visible pixels on this row. - if (!does_row_have_visible_pixels) - continue; - - for (int x = width - 1; x > 0; x--) { - if (SkColorGetA(nativeRow ? nativeRow[x] : pixmap.getColor(x, y)) > - kMinimumVisibleAlpha) { - x_right = std::max(x_right, x); - break; - } - } - - y_to = y; - if (y_from == -1) - y_from = y; - } - - int visible_width = x_right - x_left + 1; - int visible_height = y_to - y_from + 1; - return gfx::Rect(x_left, y_from, visible_width, visible_height); -} +constexpr float kMaximumVisibleCircularIconSizeRatio = 1.20f; float GetDistanceBetweenPoints(gfx::PointF first_point, gfx::PointF second_point) { @@ -125,8 +71,9 @@ } // No visible pixels on this row. - if (!does_row_have_visible_pixels) + if (!does_row_have_visible_pixels) { continue; + } for (int x = width - 1; x > 0; x--) { if (SkColorGetA(nativeRow ? nativeRow[x] : pixmap.getColor(x, y)) > @@ -172,15 +119,19 @@ } } - gfx::Rect visible_preview_bounds = GetVisibleIconBounds(preview); + const float circle_radius = GetFarthestVisiblePointFromCenter(preview); + const float visible_icon_size_ratio = + (circle_radius * 2) / static_cast<float>(width); - float visible_icon_size_ratio = - static_cast<float>(visible_preview_bounds.width()) / - static_cast<float>(width); - // If the visible icon is too small then it should not be considered - // circular. - if (visible_icon_size_ratio < kMinimumVisibleCircularIconSizeRatio) + // If the visible icon is too small or too large then it should not be + // considered circular. This rules out small icons and large square shaped + // icons. + if (visible_icon_size_ratio < kMinimumVisibleCircularIconSizeRatio || + visible_icon_size_ratio > kMaximumVisibleCircularIconSizeRatio) { return false; + } + + SkPoint circle_center = SkPoint::Make(width / 2, height / 2); // Use a canvas to perform XOR and DST_OUT operations, which should // generate a transparent bitmap for |preview| if the original icon is @@ -193,24 +144,22 @@ // XOR operation to remove a circle. paint_circle_mask.setBlendMode(SkBlendMode::kXor); - canvas.drawCircle(SkPoint::Make(width / 2.0f, height / 2.0f), - visible_preview_bounds.width() / 2.0f, paint_circle_mask); + canvas.drawCircle(circle_center, circle_radius, paint_circle_mask); SkPaint paint_outline; paint_outline.setColor(SK_ColorGREEN); paint_outline.setStyle(SkPaint::kStroke_Style); const float outline_stroke_width = - visible_preview_bounds.width() * kCircleOutlineStrokeWidthRatio; - const float radius_offset = outline_stroke_width / 8.0f; + circle_radius * 2 * kCircleOutlineStrokeWidthRatio; + const float radius_offset = outline_stroke_width / 4.0f; paint_outline.setStrokeWidth(outline_stroke_width); paint_outline.setAntiAlias(true); // DST_OUT operation to remove an extra circle outline. paint_outline.setBlendMode(SkBlendMode::kDstOut); - canvas.drawCircle(SkPoint::Make(width / 2.0f, height / 2.0f), - visible_preview_bounds.width() / 2.0f + radius_offset, + canvas.drawCircle(circle_center, circle_radius - radius_offset, paint_outline); // Compute the total pixel difference between the circle mask and the @@ -219,14 +168,14 @@ for (int y = 0; y < preview.height(); ++y) { SkColor* src_color = reinterpret_cast<SkColor*>(preview.getAddr32(0, y)); for (int x = 0; x < preview.width(); ++x) { - if (SkColorGetA(src_color[x]) >= kMinimumVisibleAlpha) + if (SkColorGetA(src_color[x]) >= kMinimumVisibleAlpha) { total_pixel_difference++; + } } } float percentage_diff_pixels = - static_cast<float>(total_pixel_difference) / - (visible_preview_bounds.width() * visible_preview_bounds.height()); + static_cast<float>(total_pixel_difference) / (width * height); // If the pixel difference between a circle and the original icon is small // enough, then the icon can be considered circle shaped. @@ -240,8 +189,9 @@ int width = unscaled_bitmap.width(); int height = unscaled_bitmap.height(); - if (width == height) + if (width == height) { return absl::nullopt; + } int longest_side = std::max(width, height); @@ -264,8 +214,9 @@ for (gfx::ImageSkiaRep rep : image.image_reps()) { absl::optional<gfx::ImageSkiaRep> new_rep = StandardizeSizeOfImageRep(rep, rep.scale()); - if (!new_rep) + if (!new_rep) { return image; + } final_image.AddRepresentation(new_rep.value()); }
diff --git a/chrome/browser/apps/icon_standardizer_unittest.cc b/chrome/browser/apps/icon_standardizer_unittest.cc index 1ff0d46..5a563d0d 100644 --- a/chrome/browser/apps/icon_standardizer_unittest.cc +++ b/chrome/browser/apps/icon_standardizer_unittest.cc
@@ -35,6 +35,17 @@ return bitmaps_equal; } +bool DoesIconHaveWhiteBackgroundCircle(const SkBitmap& bitmap) { + const int y = kIconSize / 2; + SkColor* src_color = reinterpret_cast<SkColor*>(bitmap.getAddr32(0, y)); + for (int x = 0; x < bitmap.width(); ++x) { + if (src_color[x] == SK_ColorWHITE) { + return true; + } + } + return false; +} + } // namespace using CreateStandardIconTest = testing::Test; @@ -69,6 +80,7 @@ square_icon_bitmap, skia::ImageOperations::RESIZE_BEST, 36, 36); canvas.drawImage(scaled_bitmap.asImage(), 14, 14); + EXPECT_TRUE(DoesIconHaveWhiteBackgroundCircle(*standard_icon.bitmap())); EXPECT_TRUE(AreBitmapsEqual(*standard_icon.bitmap(), test_standard_bitmap)); } @@ -104,6 +116,8 @@ SkCanvas canvas2(manually_scaled_bitmap); canvas2.drawImage(scaled_bitmap.asImage(), 3, 3); + EXPECT_FALSE( + DoesIconHaveWhiteBackgroundCircle(*generated_standard_icon.bitmap())); EXPECT_TRUE(AreBitmapsEqual(*generated_standard_icon.bitmap(), manually_scaled_bitmap)); } @@ -128,5 +142,34 @@ gfx::ImageSkia standard_icon = apps::CreateStandardIconImage( gfx::ImageSkia::CreateFromBitmap(circle_icon_bitmap, 2.0f)); + EXPECT_FALSE(DoesIconHaveWhiteBackgroundCircle(*standard_icon.bitmap())); EXPECT_TRUE(AreBitmapsEqual(*standard_icon.bitmap(), circle_icon_bitmap)); } + +// Test that a circle icon that has an extra opaque area near the outside of the +// circle will have a background circle added when standardized. +TEST_F(CreateStandardIconTest, AlmostCircularIconToStandardIcon) { + // Create a bitmap with a red circle as a placeholder circular icon. + SkBitmap almost_circle_icon_bitmap; + almost_circle_icon_bitmap.allocN32Pixels(kIconSize, kIconSize); + almost_circle_icon_bitmap.eraseColor(SK_ColorTRANSPARENT); + + SkCanvas canvas(almost_circle_icon_bitmap); + SkPaint paint_flags; + paint_flags.setAntiAlias(true); + paint_flags.setColor(SK_ColorRED); + paint_flags.setStyle(SkPaint::kFill_Style); + canvas.drawCircle(SkPoint::Make(kIconSize / 2.0f, kIconSize / 2.0f), + kStandardCircleRadius, paint_flags); + + // Draw a small square partially outside of the main red circle. + canvas.drawRect(SkRect::MakeXYWH(6, 6, 15, 15), paint_flags); + + // Get the standard icon version of the almost red circle icon. + gfx::ImageSkia standard_icon = apps::CreateStandardIconImage( + gfx::ImageSkia::CreateFromBitmap(almost_circle_icon_bitmap, 2.0f)); + + EXPECT_TRUE(DoesIconHaveWhiteBackgroundCircle(*standard_icon.bitmap())); + EXPECT_FALSE( + AreBitmapsEqual(*standard_icon.bitmap(), almost_circle_icon_bitmap)); +}
diff --git a/chrome/browser/ash/accessibility/dictation_browsertest.cc b/chrome/browser/ash/accessibility/dictation_browsertest.cc index 3e01cda..b3ba66fe 100644 --- a/chrome/browser/ash/accessibility/dictation_browsertest.cc +++ b/chrome/browser/ash/accessibility/dictation_browsertest.cc
@@ -110,6 +110,10 @@ "pumpkin"; constexpr char kContentEditableUrl[] = "data:text/html;charset=utf-8,<div id='input' contenteditable></div>"; +constexpr char kFormattedContentEditableUrl[] = R"( + data:text/html;charset=utf-8,<div id='input' contenteditable> + <p><strong>This</strong> <b>is</b> a <em>test</em></p></div> +)"; constexpr char kInputUrl[] = "data:text/html;charset=utf-8,<input id='input' type='text'></input>"; constexpr char kTextAreaUrl[] = @@ -159,7 +163,12 @@ } // The type of editable field to use in tests. -enum class EditableType { kContentEditable, kInput, kTextArea }; +enum class EditableType { + kContentEditable, + kFormattedContentEditable, + kInput, + kTextArea +}; // A class used to define the parameters of a test case. class TestConfig { @@ -329,6 +338,9 @@ case EditableType::kTextArea: url = kTextAreaUrl; break; + case EditableType::kFormattedContentEditable: + url = kFormattedContentEditableUrl; + break; case EditableType::kInput: url = kInputUrl; break; @@ -399,7 +411,7 @@ return; } - std::string script = "testSupport.WaitForPumpkinTaggerReady();"; + std::string script = "testSupport.waitForPumpkinTaggerReady();"; ExecuteAccessibilityCommonScript(script); } @@ -483,9 +495,13 @@ "document.getElementById('input').value)"; break; case EditableType::kContentEditable: + case EditableType::kFormattedContentEditable: + // Replace all non-breaking spaces with regular spaces. Otherwise, + // string comparisons will unexpectedly fail. script = "window.domAutomationController.send(" - "document.getElementById('input').innerText)"; + "document.getElementById('input').innerText.replaceAll(" + "'\u00a0', ' '));"; break; } CHECK(ExecuteScriptAndExtractString( @@ -556,9 +572,12 @@ } bool RunOnMultilineContent() { + // TODO(b:259353252): Contenteditables have an error where inserting a \n + // actually inserts two \n characters. // <input> represents a one-line plain text control, so multiline test cases - // should be skipped. - return editable_type() != EditableType::kInput; + // should be skipped. Run multiline test cases only on <textarea> for these + // reasons. + return editable_type() == EditableType::kTextArea; } speech::SpeechRecognitionType speech_recognition_type() { @@ -1121,9 +1140,6 @@ WaitForRecognitionStopped(); DictationTest::TearDownOnMainThread(); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; INSTANTIATE_TEST_SUITE_P( @@ -1138,6 +1154,12 @@ ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, EditableType::kInput))); +INSTANTIATE_TEST_SUITE_P( + NetworkContentEditable, + DictationRegexCommandsTest, + ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, + EditableType::kContentEditable))); + IN_PROC_BROWSER_TEST_P(DictationRegexCommandsTest, TypesCommands) { std::string expected_text = ""; int i = 0; @@ -1394,18 +1416,36 @@ } IN_PROC_BROWSER_TEST_P(DictationRegexCommandsTest, SmartInsertBefore) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("This is a test.", "This is a test."); SendFinalResultAndWaitForEditableValue("insert simple before test", "This is a simple test."); } IN_PROC_BROWSER_TEST_P(DictationRegexCommandsTest, SmartSelectBetween) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("This is a test.", "This is a test."); SendFinalResultAndWaitForSelectionChanged("select from this to test"); SendFinalResultAndWaitForEditableValue("Hello world", "Hello world."); } IN_PROC_BROWSER_TEST_P(DictationRegexCommandsTest, MoveBySentence) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("Hello world! Goodnight world?", "Hello world! Goodnight world?"); SendFinalResultAndWaitForCaretBoundsChanged("move to the previous sentence"); @@ -1451,6 +1491,12 @@ IN_PROC_BROWSER_TEST_P(DictationRegexCommandsTest, CursorPositionSmartInsertBefore) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("This is a test", "This is a test"); SendFinalResultAndWaitForEditableValue("insert simple before test", "This is a simple test"); @@ -1786,11 +1832,6 @@ WaitForRecognitionStopped(); DictationTest::TearDownOnMainThread(); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; - base::ScopedTempDir pumpkin_root_dir_; - std::vector<std::unique_ptr<base::ScopedTempDir>> sub_dirs_; }; INSTANTIATE_TEST_SUITE_P( @@ -1805,8 +1846,11 @@ ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, EditableType::kInput))); -// TODO(b:259353252): Add NetworkContentEditable test once commands are working -// in content editables. +INSTANTIATE_TEST_SUITE_P( + NetworkContentEditable, + DictationPumpkinTest, + ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, + EditableType::kContentEditable))); // TODO(crbug.com/1368843): Test is flaky on MSAN builds. #if defined(MEMORY_SANITIZER) @@ -1904,12 +1948,24 @@ } IN_PROC_BROWSER_TEST_P(DictationPumpkinTest, SmartInsertBefore) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("This is a test.", "This is a test."); SendFinalResultAndWaitForEditableValue("insert simple in front of test", "This is a simple test."); } IN_PROC_BROWSER_TEST_P(DictationPumpkinTest, SmartSelectBetween) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("This is a test.", "This is a test."); SendFinalResultAndWaitForSelectionChanged( "highlight everything between is and test"); @@ -1917,6 +1973,12 @@ } IN_PROC_BROWSER_TEST_P(DictationPumpkinTest, MoveBySentence) { + if (editable_type() == EditableType::kContentEditable) { + // TODO(b:259353252): Remove this once this command is supported in + // contenteditables. + return; + } + SendFinalResultAndWaitForEditableValue("Hello world! Goodnight world?", "Hello world! Goodnight world?"); SendFinalResultAndWaitForCaretBoundsChanged("one sentence back"); @@ -2117,6 +2179,12 @@ std::unique_ptr<NotificationCenterTestApi> test_api_; }; +INSTANTIATE_TEST_SUITE_P( + NetworkTextArea, + NotificationCenterDictationTest, + ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, + EditableType::kTextArea))); + // Tests that clicking the notification center tray does not crash when // dictation is enabled. IN_PROC_BROWSER_TEST_P(NotificationCenterDictationTest, OpenBubble) { @@ -2130,10 +2198,58 @@ EXPECT_TRUE(test_api()->IsBubbleShown()); } +// A test class that only runs on formatted content editables. +class DictationFormattedContentEditableTest : public DictationPumpkinTest { + public: + DictationFormattedContentEditableTest() = default; + ~DictationFormattedContentEditableTest() override = default; + DictationFormattedContentEditableTest( + const DictationFormattedContentEditableTest&) = delete; + DictationFormattedContentEditableTest& operator=( + const DictationFormattedContentEditableTest&) = delete; + + protected: + void SetUpOnMainThread() override { + DictationPumpkinTest::SetUpOnMainThread(); + + // Place the selection at the end of the content editable (the pre-populated + // editable value has a length of 14). + std::string script = "testSupport.setSelection(14, 14);"; + ExecuteAccessibilityCommonScript(script); + } +}; + +// Note: For these tests, the content editable comes pre-populated with a value +// of "This is a test". See `kFormattedContentEditableUrl` for more details. INSTANTIATE_TEST_SUITE_P( - NetworkTextArea, - NotificationCenterDictationTest, + NetworkFormattedContentEditable, + DictationFormattedContentEditableTest, ::testing::Values(TestConfig(speech::SpeechRecognitionType::kNetwork, - EditableType::kTextArea))); + EditableType::kFormattedContentEditable))); + +IN_PROC_BROWSER_TEST_P(DictationFormattedContentEditableTest, DeletePhrase) { + SendFinalResultAndWaitForEditableValue("delete a", "This is test"); +} + +IN_PROC_BROWSER_TEST_P(DictationFormattedContentEditableTest, + ReplacePhraseMultipleWords) { + std::string command = "replace the phrase is a test with was just one exam"; + std::string expected_value = "This was just one exam"; + SendFinalResultAndWaitForEditableValue(command, expected_value); +} + +IN_PROC_BROWSER_TEST_P(DictationFormattedContentEditableTest, + ReplacePhraseFirstWord) { + std::string command = "replace this with it"; + std::string expected_value = "It is a test"; + SendFinalResultAndWaitForEditableValue(command, expected_value); +} + +IN_PROC_BROWSER_TEST_P(DictationFormattedContentEditableTest, + ReplacePhraseLastWord) { + std::string command = "replace test with quiz"; + std::string expected_value = "This is a quiz"; + SendFinalResultAndWaitForEditableValue(command, expected_value); +} } // namespace ash
diff --git a/chrome/browser/ash/app_list/app_list_notifier_impl.cc b/chrome/browser/ash/app_list/app_list_notifier_impl.cc index 85a2121..2e72d2e 100644 --- a/chrome/browser/ash/app_list/app_list_notifier_impl.cc +++ b/chrome/browser/ash/app_list/app_list_notifier_impl.cc
@@ -250,6 +250,17 @@ StopTimer(location); } + // Notify of seen on kShown -> {kSeen} when there is one or more result for + // `location`. + if (old_state == State::kShown && new_state == State::kSeen) { + auto results = ResultsForLocation(location); + if (results.size() > 0) { + for (auto& observer : observers_) { + observer.OnSeen(location, results, query_); + } + } + } + // Notify of impression on kShown -> {kSeen, kIgnored, kLaunched}. if (old_state == State::kShown && (new_state == State::kSeen || new_state == State::kLaunched ||
diff --git a/chrome/browser/ash/app_list/search/search_metrics_util.h b/chrome/browser/ash/app_list/search/search_metrics_util.h index 0271fb7..920b2b7 100644 --- a/chrome/browser/ash/app_list/search/search_metrics_util.h +++ b/chrome/browser/ash/app_list/search/search_metrics_util.h
@@ -12,7 +12,7 @@ namespace app_list { constexpr char kHistogramPrefix[] = "Apps.AppList.Search."; -constexpr char kSessionHistogramPrefix[] = "Apps.AppList.Search.Session."; +constexpr char kSessionHistogramPrefix[] = "Apps.AppList.Search.Session2."; // Represents possible error states of the metrics observer itself. These // values persist to logs. Entries should not be renumbered and numeric
diff --git a/chrome/browser/ash/app_list/search/search_session_metrics_manager.cc b/chrome/browser/ash/app_list/search/search_session_metrics_manager.cc index 8671911..c8bd689 100644 --- a/chrome/browser/ash/app_list/search/search_session_metrics_manager.cc +++ b/chrome/browser/ash/app_list/search/search_session_metrics_manager.cc
@@ -36,7 +36,7 @@ base::UmaHistogramEnumeration( base::StrCat({kSessionHistogramPrefix, show_source}), session_result_); - session_result_ = ash::SearchSessionResult::kQuit; + session_result_ = ash::SearchSessionConclusion::kQuit; session_active_ = false; } @@ -48,13 +48,12 @@ EndSearchSession(); } -void SearchSessionMetricsManager::OnImpression( - Location location, - const std::vector<Result>& results, - const std::u16string& query) { +void SearchSessionMetricsManager::OnSeen(Location location, + const std::vector<Result>& results, + const std::u16string& query) { if (location == Location::kAnswerCard) { DCHECK(session_active_); - session_result_ = ash::SearchSessionResult::kAnswerCardImpression; + session_result_ = ash::SearchSessionConclusion::kAnswerCardSeen; } } @@ -64,7 +63,7 @@ const std::u16string& query) { if (location == Location::kList) { DCHECK(session_active_); - session_result_ = ash::SearchSessionResult::kLaunch; + session_result_ = ash::SearchSessionConclusion::kLaunch; } }
diff --git a/chrome/browser/ash/app_list/search/search_session_metrics_manager.h b/chrome/browser/ash/app_list/search/search_session_metrics_manager.h index e706836..02b3ce3 100644 --- a/chrome/browser/ash/app_list/search/search_session_metrics_manager.h +++ b/chrome/browser/ash/app_list/search/search_session_metrics_manager.h
@@ -35,9 +35,9 @@ // ash::AppListNotifier::Observer: void OnSearchSessionStarted() override; void OnSearchSessionEnded() override; - void OnImpression(Location location, - const std::vector<Result>& results, - const std::u16string& query) override; + void OnSeen(Location location, + const std::vector<Result>& results, + const std::u16string& query) override; void OnLaunch(Location location, const Result& launched, const std::vector<Result>& shown, @@ -47,7 +47,8 @@ // Whether the metrics manager is tracking an active search session. bool session_active_ = false; // Tracks the metric recorded when EndSearchSession() is called. - ash::SearchSessionResult session_result_ = ash::SearchSessionResult::kQuit; + ash::SearchSessionConclusion session_result_ = + ash::SearchSessionConclusion::kQuit; base::ScopedObservation<ash::AppListNotifier, ash::AppListNotifier::Observer> observation_{this};
diff --git a/chrome/browser/ash/app_list/search/search_session_metrics_manager_unittest.cc b/chrome/browser/ash/app_list/search/search_session_metrics_manager_unittest.cc index 2ecce254..5929072 100644 --- a/chrome/browser/ash/app_list/search/search_session_metrics_manager_unittest.cc +++ b/chrome/browser/ash/app_list/search/search_session_metrics_manager_unittest.cc
@@ -20,8 +20,9 @@ using Type = ash::SearchResultType; -constexpr char HomeButtonHistogram[] = "Apps.AppList.Search.Session.HomeButton"; -constexpr char SearchKeyHistogram[] = "Apps.AppList.Search.Session.SearchKey"; +constexpr char HomeButtonHistogram[] = + "Apps.AppList.Search.Session2.HomeButton"; +constexpr char SearchKeyHistogram[] = "Apps.AppList.Search.Session2.SearchKey"; } // namespace @@ -65,7 +66,7 @@ results.emplace_back(CreateFakeResult(Type::KEYBOARD_SHORTCUT, "result_id")); metrics_manager()->OnSearchSessionStarted(); - metrics_manager_->OnImpression(location, results, query); + metrics_manager_->OnSeen(location, results, query); // No metrics should be recorded until the search session ends. histogram_tester()->ExpectTotalCount(HomeButtonHistogram, 0); @@ -77,7 +78,7 @@ histogram_tester()->ExpectTotalCount(HomeButtonHistogram, 0); histogram_tester()->ExpectTotalCount(SearchKeyHistogram, 1); histogram_tester()->ExpectUniqueSample( - SearchKeyHistogram, ash::SearchSessionResult::kAnswerCardImpression, 1); + SearchKeyHistogram, ash::SearchSessionConclusion::kAnswerCardSeen, 1); } TEST_F(SearchSessionMetricsManagerTest, LaunchResult) { @@ -98,7 +99,7 @@ results.emplace_back(launched_result); metrics_manager()->OnSearchSessionStarted(); - metrics_manager_->OnImpression(location, results, query); + metrics_manager_->OnSeen(location, results, query); // No metrics should be recorded until the search session ends. histogram_tester()->ExpectTotalCount(HomeButtonHistogram, 0); @@ -112,8 +113,8 @@ metrics_manager()->OnSearchSessionEnded(); histogram_tester()->ExpectTotalCount(HomeButtonHistogram, 0); histogram_tester()->ExpectTotalCount(SearchKeyHistogram, 1); - histogram_tester()->ExpectUniqueSample(SearchKeyHistogram, - ash::SearchSessionResult::kLaunch, 1); + histogram_tester()->ExpectUniqueSample( + SearchKeyHistogram, ash::SearchSessionConclusion::kLaunch, 1); } TEST_F(SearchSessionMetricsManagerTest, AbandonResult) { @@ -132,8 +133,8 @@ histogram_tester()->ExpectTotalCount(HomeButtonHistogram, 0); histogram_tester()->ExpectTotalCount(SearchKeyHistogram, 1); - histogram_tester()->ExpectUniqueSample(SearchKeyHistogram, - ash::SearchSessionResult::kQuit, 1); + histogram_tester()->ExpectUniqueSample( + SearchKeyHistogram, ash::SearchSessionConclusion::kQuit, 1); } } // namespace app_list::test
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc index 8d7ed11..7c49ac5 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc
@@ -91,10 +91,12 @@ const test::UIPath kDemoPreferencesCountry = {kDemoPrefsId, "countrySelect"}; const test::UIPath kDemoPreferencesCountrySelect = {kDemoPrefsId, "countrySelect", "select"}; -const test::UIPath kDemoPreferencesRetailerStoreId = {kDemoPrefsId, - "retailerIdInput"}; -const test::UIPath kDemoPreferencesRetailerStoreIdInputDisplayMessage = { - kDemoPrefsId, "retailer-id-input-display-text"}; +const test::UIPath kDemoPreferencesRetailerName = {kDemoPrefsId, + "retailerNameInput"}; +const test::UIPath kDemoPreferencesStoreNumber = {kDemoPrefsId, + "storeNumberInput"}; +const test::UIPath kDemoPreferencesStoreNumberInputDisplayMessage = { + kDemoPrefsId, "store-number-input-display-text"}; const test::UIPath kDemoPreferencesNext = {kDemoPrefsId, "nextButton"}; const test::UIPath kNetworkScreen = {kNetworkId}; @@ -268,6 +270,22 @@ base::RunLoop().RunUntilIdle(); } + void ProceedThroughDemoPreferencesScreen() { + SetAndVerifyValidRetailerNameAndStoreNumber("Retailer", "1234"); + test::OobeJS().ClickOnPath(kDemoPreferencesNext); + } + + // Type in valid input and the "continue" button is enabled. + void SetAndVerifyValidRetailerNameAndStoreNumber( + const std::string& expected_retailer_name, + const std::string& expected_store_number) { + test::OobeJS().TypeIntoPath(expected_retailer_name, + kDemoPreferencesRetailerName); + test::OobeJS().TypeIntoPath(expected_store_number, + kDemoPreferencesStoreNumber); + test::OobeJS().ExpectEnabledPath(kDemoPreferencesNext); + } + // Sets fake time in MultiTapDetector to remove dependency on real time in // test environment. void SetFakeTimeForMultiTapDetector(base::Time fake_time) { @@ -332,33 +350,15 @@ test::OobeJS().ExpectVisiblePath(kCCAcceptButton); } - // Type in valid input and the "continue" button is enabled. - void ContinueForValidRetailerAndStoreId( - const std::string& expected_retailer_store_id) { - test::OobeJS().TypeIntoPath(expected_retailer_store_id, - kDemoPreferencesRetailerStoreId); - test::OobeJS().ExpectEnabledPath(kDemoPreferencesNext); - test::OobeJS().ExpectElementText( - l10n_util::GetStringUTF8( - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT), - kDemoPreferencesRetailerStoreIdInputDisplayMessage); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); - - EXPECT_EQ(expected_retailer_store_id, WizardController::default_controller() - ->demo_setup_controller() - ->get_retailer_store_id_input()); - } - // Type in invalid input and the "continue" button is disabled. - void DisableContinueButtonForInvalidRetailerAndStoreId( - const std::string& expected_retailer_store_id) { - test::OobeJS().TypeIntoPath(expected_retailer_store_id, - kDemoPreferencesRetailerStoreId); + void SetAndVerifyInvalidRetailerNameAndStoreNumber( + const std::string& expected_retailer_name, + const std::string& expected_store_number) { + test::OobeJS().TypeIntoPath(expected_retailer_name, + kDemoPreferencesRetailerName); + test::OobeJS().TypeIntoPath(expected_store_number, + kDemoPreferencesStoreNumber); test::OobeJS().ExpectDisabledPath(kDemoPreferencesNext); - test::OobeJS().ExpectElementText( - l10n_util::GetStringUTF8( - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT), - kDemoPreferencesRetailerStoreIdInputDisplayMessage); } void AcceptArcTos() { @@ -539,7 +539,7 @@ UseOnlineModeOnNetworkScreen(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupProgress(); @@ -586,6 +586,8 @@ EXPECT_EQ(it->second, test::OobeJS().GetString(query)); } + SetAndVerifyValidRetailerNameAndStoreNumber("Retailer", "1234"); + // Expect active "OK" button with "US" selected as country. test::OobeJS().ExpectEnabledPath(kDemoPreferencesNext); test::OobeJS().ExpectElementValue("US", kDemoPreferencesCountrySelect); @@ -594,7 +596,7 @@ } IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, - OnlineSetupFlowSuccessWithRetailerAndStoreId) { + OnlineSetupFlowSuccessWithValidRetailerAndStore) { // Simulate successful online setup. enrollment_helper_.ExpectEnrollmentMode( policy::EnrollmentConfig::MODE_ATTESTATION); @@ -605,46 +607,15 @@ UseOnlineModeOnNetworkScreen(); - ContinueForValidRetailerAndStoreId("ABC-1234"); + // Test a couple valid inputs, verify the "continue" button is enabled. + SetAndVerifyValidRetailerNameAndStoreNumber("Ret@iler with $ymb0ls", "0000"); + SetAndVerifyValidRetailerNameAndStoreNumber("R", "1"); + SetAndVerifyValidRetailerNameAndStoreNumber("Retailer", "1234"); - AcceptTermsAndExpectDemoSetupProgress(); - - EXPECT_EQ("admin-us@cros-demo-mode.com", - DemoSetupController::GetSubOrganizationEmail()); - // LoginOrLockScreen is shown at beginning of OOBE, so we need to wait until - // it's shown again when Demo setup completes. - LoginOrLockScreenVisibleWaiter().WaitEvenIfShown(); - - EXPECT_EQ("ABC", g_browser_process->local_state()->GetString( - prefs::kDemoModeRetailerId)); - EXPECT_EQ("1234", g_browser_process->local_state()->GetString( - prefs::kDemoModeStoreId)); - - EXPECT_TRUE(StartupUtils::IsOobeCompleted()); - EXPECT_TRUE(StartupUtils::IsDeviceRegistered()); -} - -/** - * Test the cases of valid retailer and store ID. - */ -using DemoSetupValidRetailerAndStoreIdTest = DemoSetupArcSupportedTest; - -IN_PROC_BROWSER_TEST_F(DemoSetupValidRetailerAndStoreIdTest, - OnlineSetupFlowSuccessWithValidNullRetailerAndStoreId) { - // Simulate successful online setup. - enrollment_helper_.ExpectEnrollmentMode( - policy::EnrollmentConfig::MODE_ATTESTATION); - enrollment_helper_.ExpectAttestationEnrollmentSuccess(); - SimulateNetworkConnected(); - - TriggerDemoModeOnWelcomeScreen(); - - UseOnlineModeOnNetworkScreen(); - - DisableContinueButtonForInvalidRetailerAndStoreId("ABC-12345"); - - // Clear the input, the "continue" button is enabled. - ContinueForValidRetailerAndStoreId(""); + test::OobeJS().ExpectElementText( + l10n_util::GetStringUTF8( + IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT), + kDemoPreferencesStoreNumberInputDisplayMessage); test::OobeJS().ClickOnPath(kDemoPreferencesNext); @@ -656,45 +627,8 @@ // it's shown again when Demo setup completes. LoginOrLockScreenVisibleWaiter().WaitEvenIfShown(); - EXPECT_EQ("", g_browser_process->local_state()->GetString( - prefs::kDemoModeRetailerId)); - EXPECT_EQ( - "", g_browser_process->local_state()->GetString(prefs::kDemoModeStoreId)); - - EXPECT_TRUE(StartupUtils::IsOobeCompleted()); - EXPECT_TRUE(StartupUtils::IsDeviceRegistered()); -} - -IN_PROC_BROWSER_TEST_F( - DemoSetupValidRetailerAndStoreIdTest, - OnlineSetupFlowSuccessWithValidNonNullRetailerAndStoreId) { - // Simulate successful online setup. - enrollment_helper_.ExpectEnrollmentMode( - policy::EnrollmentConfig::MODE_ATTESTATION); - enrollment_helper_.ExpectAttestationEnrollmentSuccess(); - SimulateNetworkConnected(); - - TriggerDemoModeOnWelcomeScreen(); - - UseOnlineModeOnNetworkScreen(); - - DisableContinueButtonForInvalidRetailerAndStoreId("AB-1235"); - - // Type in the valid input, the "continue" button is enabled. - ContinueForValidRetailerAndStoreId("BBY-1234"); - - test::OobeJS().ClickOnPath(kDemoPreferencesNext); - - AcceptTermsAndExpectDemoSetupProgress(); - - EXPECT_EQ("admin-us@cros-demo-mode.com", - DemoSetupController::GetSubOrganizationEmail()); - // LoginOrLockScreen is shown at beginning of OOBE, so we need to wait until - // it's shown again when Demo setup completes. - LoginOrLockScreenVisibleWaiter().WaitEvenIfShown(); - - EXPECT_EQ("BBY", g_browser_process->local_state()->GetString( - prefs::kDemoModeRetailerId)); + EXPECT_EQ("Retailer", g_browser_process->local_state()->GetString( + prefs::kDemoModeRetailerId)); EXPECT_EQ("1234", g_browser_process->local_state()->GetString( prefs::kDemoModeStoreId)); @@ -702,28 +636,8 @@ EXPECT_TRUE(StartupUtils::IsDeviceRegistered()); } -/** - * Test the cases of invalid retailer and store ID. - */ -class DemoSetupInvalidRetailerAndStoreIdTest - : public DemoSetupArcSupportedTest, - public ::testing::WithParamInterface<std::string> {}; - -INSTANTIATE_TEST_SUITE_P( - All, - DemoSetupInvalidRetailerAndStoreIdTest, - ::testing::Values( - "ABCD-1234", // Retailer ID letters are more than three. - "A-1234", // Retailer ID letters are less than three. - "ABC-123", // Store ID digits are less than four. - "ABC-12345", // Store ID digits are more than four. - "abC-1234", // Retailer ID contains lower case letters. - "ABC_1234", // There is no hyphen between retailer ID and store ID. - "ABC1234" // There is no hyphen between retailer ID and store ID. - )); - -IN_PROC_BROWSER_TEST_P(DemoSetupInvalidRetailerAndStoreIdTest, - OnlineSetupNoEnrollmentWithInvalidRetailerAndStoreId) { +IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, + OnlineSetupNoEnrollmentWithInvalidRetailerAndStore) { // Simulate demo online setup not finished. enrollment_helper_.ExpectNoEnrollment(); SimulateNetworkConnected(); @@ -732,14 +646,22 @@ UseOnlineModeOnNetworkScreen(); - // Display the valid message if no retailer and store ID is provided. test::OobeJS().ExpectElementText( l10n_util::GetStringUTF8( - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT), - kDemoPreferencesRetailerStoreIdInputDisplayMessage); - test::OobeJS().ExpectEnabledPath(kDemoPreferencesNext); + IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT), + kDemoPreferencesStoreNumberInputDisplayMessage); + test::OobeJS().ExpectDisabledPath(kDemoPreferencesNext); - DisableContinueButtonForInvalidRetailerAndStoreId(GetParam()); + SetAndVerifyInvalidRetailerNameAndStoreNumber("ValidRetailer", "NotANumber"); + SetAndVerifyInvalidRetailerNameAndStoreNumber("", "1234"); + SetAndVerifyInvalidRetailerNameAndStoreNumber("ValidRetailer", ""); + SetAndVerifyInvalidRetailerNameAndStoreNumber("ValidRetailer", "1234a"); + SetAndVerifyInvalidRetailerNameAndStoreNumber("ValidRetailer", "12-34"); + + // Verify that continue button goes back to being disabled after enabled + // for correct input + SetAndVerifyValidRetailerNameAndStoreNumber("ValidRetailer", "1234"); + SetAndVerifyInvalidRetailerNameAndStoreNumber("", ""); EXPECT_FALSE(StartupUtils::IsOobeCompleted()); EXPECT_FALSE(StartupUtils::IsDeviceRegistered()); @@ -758,7 +680,7 @@ UseOnlineModeOnNetworkScreen(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupFailure(); @@ -788,7 +710,7 @@ UseOnlineModeOnNetworkScreen(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupFailure(); @@ -820,7 +742,7 @@ ->SetCrOSComponentLoadErrorForTest( component_updater::CrOSComponentManager::Error::INSTALL_FAILURE); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupFailure(); @@ -849,7 +771,8 @@ SimulateNetworkConnected(); OobeScreenWaiter(DemoPreferencesScreenView::kScreenId).Wait(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + + ProceedThroughDemoPreferencesScreen(); if (features::IsOobeConsolidatedConsentEnabled()) { test::WaitForConsolidatedConsentScreen(); @@ -872,7 +795,7 @@ OobeScreenWaiter(DemoPreferencesScreenView::kScreenId).Wait(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); if (features::IsOobeConsolidatedConsentEnabled()) { test::WaitForConsolidatedConsentScreen(); @@ -899,7 +822,7 @@ if (features::IsOobeConsolidatedConsentEnabled()) { UseOnlineModeOnNetworkScreen(); OobeScreenWaiter(DemoPreferencesScreenView::kScreenId).Wait(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); test::WaitForConsolidatedConsentScreen(); test::OobeJS().ClickOnPath(kCCBackButton); histogram_tester_.ExpectTotalCount( @@ -915,7 +838,7 @@ StartupUtils::MarkEulaAccepted(); UseOnlineModeOnNetworkScreen(); OobeScreenWaiter(DemoPreferencesScreenView::kScreenId).Wait(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); OobeScreenWaiter(ArcTermsOfServiceScreenView::kScreenId).Wait(); test::OobeJS().ClickOnPath(kArcTosBackButton); } @@ -935,7 +858,7 @@ UseOnlineModeOnNetworkScreen(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupFailure(); @@ -964,7 +887,7 @@ UseOnlineModeOnNetworkScreen(); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupFailure(); test::LockDemoDeviceInstallAttributes(); @@ -1240,9 +1163,8 @@ UseOnlineModeOnNetworkScreen(); // Expect active "OK" button when entering the preference screen. - test::OobeJS().ExpectEnabledPath(kDemoPreferencesNext); test::OobeJS().ExpectElementValue("US", kDemoPreferencesCountrySelect); - test::OobeJS().ClickOnPath(kDemoPreferencesNext); + ProceedThroughDemoPreferencesScreen(); AcceptTermsAndExpectDemoSetupProgress();
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc b/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc index 3fc6bd06..e72fbdf 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc
@@ -506,7 +506,9 @@ SetCurrentSetupStep(DemoSetupStep::kDownloadResources); - SetRetailerAndStoreIdInPref(); + PrefService* prefs = g_browser_process->local_state(); + prefs->SetString(prefs::kDemoModeRetailerId, retailer_name_); + prefs->SetString(prefs::kDemoModeStoreId, store_number_); switch (demo_config_) { case DemoSession::DemoModeConfig::kOnline: @@ -687,16 +689,4 @@ ClearDemoRequisition(); } -void DemoSetupController::SetRetailerAndStoreIdInPref() { - std::vector<std::string> retailer_and_store_id_list = - base::SplitString(retailer_store_id_input_, "-", base::TRIM_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); - if (retailer_and_store_id_list.size() != 2) - return; - - PrefService* prefs = g_browser_process->local_state(); - prefs->SetString(prefs::kDemoModeRetailerId, retailer_and_store_id_list[0]); - prefs->SetString(prefs::kDemoModeStoreId, retailer_and_store_id_list[1]); -} - } // namespace ash
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h index 44f3cbe..dc30de4 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h +++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h
@@ -202,14 +202,12 @@ demo_config_ = demo_config; } - std::string& get_retailer_store_id_input() { - return retailer_store_id_input_; + void set_retailer_name(const std::string& retailer_name) { + retailer_name_ = retailer_name; } - // Sets demo mode retailer id input by the user. It will be saved as local - // prefs when enrollment completes. - void set_retailer_store_id_input(const std::string& retailer_store_id_input) { - retailer_store_id_input_ = retailer_store_id_input; + void set_store_number(const std::string& store_number) { + store_number_ = store_number; } // Initiates enrollment that sets up the device in the demo mode domain. The @@ -260,9 +258,6 @@ // Sets current setup step. void SetCurrentSetupStep(DemoSetupStep current_step); - // Sets retailer and store id in local pref. - void SetRetailerAndStoreIdInPref(); - // Finish the flow with an error. void SetupFailed(const DemoSetupError& error); @@ -279,7 +274,12 @@ // setup. int num_setup_retries_ = 0; - std::string retailer_store_id_input_; + // Name of retailer entered during setup flow. Corresponds to the + // kDemoModeRetailerId pref. + std::string retailer_name_; + // Store number entered during setup flow. Corresponds to the kDemoModeStoreId + // pref. + std::string store_number_; // Demo mode configuration type that will be setup when Enroll() is called. // Should be set explicitly.
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc index d2659fd..477720c 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc
@@ -373,11 +373,12 @@ EXPECT_EQ(email, "test-user-name@cros-demo-mode.com"); } -TEST_F(DemoSetupControllerTest, OnlineSuccessWithValidRetailerAndStoreId) { +TEST_F(DemoSetupControllerTest, OnlineSuccessWithValidRetailerAndStore) { SetupMockDemoModeOnlineEnrollmentHelper(DemoModeSetupResult::SUCCESS); tested_controller_->set_demo_config(DemoSession::DemoModeConfig::kOnline); - tested_controller_->set_retailer_store_id_input("ABC-1234"); + tested_controller_->set_retailer_name("Retailer"); + tested_controller_->set_store_number("1234"); tested_controller_->Enroll( base::BindOnce(&DemoSetupControllerTestHelper::OnSetupSuccess, base::Unretained(helper_.get())), @@ -389,33 +390,11 @@ EXPECT_TRUE( helper_->WaitResult(true, DemoSetupController::DemoSetupStep::kComplete)); EXPECT_EQ("", GetDeviceRequisition()); - EXPECT_EQ("ABC", g_browser_process->local_state()->GetString( - prefs::kDemoModeRetailerId)); + EXPECT_EQ("Retailer", g_browser_process->local_state()->GetString( + prefs::kDemoModeRetailerId)); EXPECT_EQ("1234", g_browser_process->local_state()->GetString( prefs::kDemoModeStoreId)); } -TEST_F(DemoSetupControllerTest, OnlineSuccessWithInvalidRetailerAndStoreId) { - SetupMockDemoModeOnlineEnrollmentHelper(DemoModeSetupResult::SUCCESS); - tested_controller_->set_retailer_store_id_input("ABC"); - - tested_controller_->set_demo_config(DemoSession::DemoModeConfig::kOnline); - tested_controller_->Enroll( - base::BindOnce(&DemoSetupControllerTestHelper::OnSetupSuccess, - base::Unretained(helper_.get())), - base::BindOnce(&DemoSetupControllerTestHelper::OnSetupError, - base::Unretained(helper_.get())), - base::BindRepeating(&DemoSetupControllerTestHelper::SetCurrentSetupStep, - base::Unretained(helper_.get()))); - - EXPECT_TRUE( - helper_->WaitResult(true, DemoSetupController::DemoSetupStep::kComplete)); - EXPECT_EQ("", GetDeviceRequisition()); - EXPECT_EQ("", g_browser_process->local_state()->GetString( - prefs::kDemoModeRetailerId)); - EXPECT_EQ( - "", g_browser_process->local_state()->GetString(prefs::kDemoModeStoreId)); -} - } // namespace } // namespace ash
diff --git a/chrome/browser/ash/login/screens/demo_preferences_screen.cc b/chrome/browser/ash/login/screens/demo_preferences_screen.cc index d487bf0..139b5fee 100644 --- a/chrome/browser/ash/login/screens/demo_preferences_screen.cc +++ b/chrome/browser/ash/login/screens/demo_preferences_screen.cc
@@ -47,13 +47,6 @@ DemoPreferencesScreen::~DemoPreferencesScreen() = default; -void DemoPreferencesScreen::SetDemoModeRetailerAndStoreIdInput( - const std::string& retailer_store_id_input) { - WizardController::default_controller() - ->demo_setup_controller() - ->set_retailer_store_id_input(retailer_store_id_input); -} - void DemoPreferencesScreen::ShowImpl() { if (view_) view_->Show(); @@ -64,16 +57,22 @@ void DemoPreferencesScreen::OnUserAction(const base::Value::List& args) { const std::string& action_id = args[0].GetString(); if (action_id == kUserActionContinue) { - CHECK_EQ(args.size(), 2u); + CHECK_EQ(args.size(), 3u); std::string country( g_browser_process->local_state()->GetString(prefs::kDemoModeCountry)); if (country == DemoSession::kCountryNotSelectedId) { return; } - // Set retailer store input string regardless of pattern, let server decide - // what action take when it is invalid. - const std::string& retailer_store_id_input = args[1].GetString(); - SetDemoModeRetailerAndStoreIdInput(retailer_store_id_input); + + // Pass retailer_name and store_input to DemoSetupController to set as prefs + // once user has proceeded through setup + const std::string& retailer_name_input = args[1].GetString(); + const std::string& store_number_input = args[2].GetString(); + DemoSetupController* demo_setup_controller = + WizardController::default_controller()->demo_setup_controller(); + demo_setup_controller->set_retailer_name(retailer_name_input); + demo_setup_controller->set_store_number(store_number_input); + exit_callback_.Run(features::IsOobeConsolidatedConsentEnabled() ? Result::COMPLETED_CONSOLIDATED_CONSENT : Result::COMPLETED);
diff --git a/chrome/browser/ash/login/screens/demo_preferences_screen.h b/chrome/browser/ash/login/screens/demo_preferences_screen.h index 1c1a475..6552ca8 100644 --- a/chrome/browser/ash/login/screens/demo_preferences_screen.h +++ b/chrome/browser/ash/login/screens/demo_preferences_screen.h
@@ -33,8 +33,6 @@ ~DemoPreferencesScreen() override; void SetDemoModeCountry(const std::string& country_id); - void SetDemoModeRetailerAndStoreIdInput( - const std::string& retailer_store_id_input); protected: // BaseScreen:
diff --git a/chrome/browser/devtools/protocol/security_handler.cc b/chrome/browser/devtools/protocol/security_handler.cc index b6133e1..a8f0834 100644 --- a/chrome/browser/devtools/protocol/security_handler.cc +++ b/chrome/browser/devtools/protocol/security_handler.cc
@@ -152,13 +152,6 @@ std::unique_ptr<protocol::Security::SafetyTipInfo> CreateSafetyTipInfo( const security_state::SafetyTipInfo& safety_tip_info) { switch (safety_tip_info.status) { - case security_state::SafetyTipStatus::kBadReputation: - case security_state::SafetyTipStatus::kBadReputationIgnored: - return protocol::Security::SafetyTipInfo::Create() - .SetSafetyTipStatus( - protocol::Security::SafetyTipStatusEnum::BadReputation) - .Build(); - case security_state::SafetyTipStatus::kLookalike: case security_state::SafetyTipStatus::kLookalikeIgnored: return protocol::Security::SafetyTipInfo::Create() @@ -167,11 +160,6 @@ .SetSafeUrl(safety_tip_info.safe_url.spec()) .Build(); - case security_state::SafetyTipStatus::kBadKeyword: - NOTREACHED(); - return nullptr; - - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: case security_state::SafetyTipStatus::kNone: case security_state::SafetyTipStatus::kUnknown: return nullptr;
diff --git a/chrome/browser/domain_reliability/browsertest.cc b/chrome/browser/domain_reliability/browsertest.cc index fcde524e..0964a58f 100644 --- a/chrome/browser/domain_reliability/browsertest.cc +++ b/chrome/browser/domain_reliability/browsertest.cc
@@ -7,13 +7,20 @@ #include "base/json/json_reader.h" #include "base/run_loop.h" #include "base/test/values_test_util.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/domain_reliability/service_factory.h" +#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/net/profile_network_context_service.h" +#include "chrome/browser/policy/policy_test_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/domain_reliability/domain_reliability_prefs.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/policy_constants.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/test/browser_test.h" @@ -93,15 +100,84 @@ } }; +class DomainReliabilityPolicyTest : public policy::PolicyTest { + protected: + void SetAndUpdateDomainReliabilityAllowedPolicy(bool value) { + policy::PolicyMap policies; + policies.Set(policy::key::kDomainReliabilityAllowed, + policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, + policy::POLICY_SOURCE_CLOUD, base::Value(value), nullptr); + provider_.UpdateChromePolicy(policies); + } + + void SetAndUpdateIsMetricsReporting(bool value) { + is_metrics_reporting_enabled_ = value; + ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting( + &is_metrics_reporting_enabled_); + } + + private: + bool is_metrics_reporting_enabled_ = false; +}; + +IN_PROC_BROWSER_TEST_F(DomainReliabilityPolicyTest, PolicyOverride) { + // Confirm that DomainReliabilityAllowed enterprise policy overrides existing + // prefs + PrefService* prefs = g_browser_process->local_state(); + prefs->SetBoolean(prefs::kDomainReliabilityAllowedByPolicy, true); + + // Set policy to false and check pref + SetAndUpdateDomainReliabilityAllowedPolicy(false); + EXPECT_FALSE(prefs->GetBoolean(prefs::kDomainReliabilityAllowedByPolicy)); + + // Set policy to true and check pref + SetAndUpdateDomainReliabilityAllowedPolicy(true); + EXPECT_TRUE(prefs->GetBoolean(prefs::kDomainReliabilityAllowedByPolicy)); +} + +IN_PROC_BROWSER_TEST_F(DomainReliabilityPolicyTest, + PolicyEnabledMetricsEnabled) { + // Confirm behavior with policy true and metrics enabled + SetAndUpdateDomainReliabilityAllowedPolicy(true); + SetAndUpdateIsMetricsReporting(true); + EXPECT_TRUE(domain_reliability::ShouldCreateService()); + ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting(nullptr); +} + +IN_PROC_BROWSER_TEST_F(DomainReliabilityPolicyTest, + PolicyEnabledMetricsDisabled) { + // Confirm behavior with policy true and metrics disabled + SetAndUpdateDomainReliabilityAllowedPolicy(true); + SetAndUpdateIsMetricsReporting(false); + EXPECT_FALSE(domain_reliability::ShouldCreateService()); + ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting(nullptr); +} + +IN_PROC_BROWSER_TEST_F(DomainReliabilityPolicyTest, + PolicyDisabledMetricsEnabled) { + // Confirm behavior with policy false and metrics enabled + SetAndUpdateDomainReliabilityAllowedPolicy(false); + SetAndUpdateIsMetricsReporting(true); + EXPECT_FALSE(domain_reliability::ShouldCreateService()); + ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting(nullptr); +} + +IN_PROC_BROWSER_TEST_F(DomainReliabilityPolicyTest, + PolicyDisabledMetricsDisabled) { + // Confirm behavior with policy false and metrics disabled + SetAndUpdateDomainReliabilityAllowedPolicy(false); + SetAndUpdateIsMetricsReporting(false); + EXPECT_FALSE(domain_reliability::ShouldCreateService()); + ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting(nullptr); +} + IN_PROC_BROWSER_TEST_F(DomainReliabilityDisabledBrowserTest, ServiceNotCreated) { - EXPECT_FALSE(domain_reliability::DomainReliabilityServiceFactory:: - ShouldCreateService()); + EXPECT_FALSE(domain_reliability::ShouldCreateService()); } IN_PROC_BROWSER_TEST_F(DomainReliabilityBrowserTest, ServiceCreated) { - EXPECT_TRUE(domain_reliability::DomainReliabilityServiceFactory:: - ShouldCreateService()); + EXPECT_TRUE(domain_reliability::ShouldCreateService()); } static const char kUploadPath[] = "/domainreliability/upload";
diff --git a/chrome/browser/domain_reliability/service_factory.cc b/chrome/browser/domain_reliability/service_factory.cc index 26b63740..23775760 100644 --- a/chrome/browser/domain_reliability/service_factory.cc +++ b/chrome/browser/domain_reliability/service_factory.cc
@@ -6,8 +6,11 @@ #include "base/command_line.h" #include "base/metrics/field_trial.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/common/chrome_switches.h" +#include "components/domain_reliability/domain_reliability_prefs.h" +#include "components/prefs/pref_service.h" namespace domain_reliability { @@ -20,18 +23,24 @@ const char kFieldTrialName[] = "DomRel-Enable"; const char kFieldTrialValueEnable[] = "enable"; +bool IsDomainReliabilityAllowed() { + return g_browser_process->local_state()->GetBoolean( + prefs::kDomainReliabilityAllowedByPolicy); +} + } // namespace -// Identifies Chrome as the source of Domain Reliability uploads it sends. -const char DomainReliabilityServiceFactory::kUploadReporterString[] = "chrome"; +const char kUploadReporterString[] = "chrome"; -// static -bool DomainReliabilityServiceFactory::ShouldCreateService() { +bool ShouldCreateService() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDisableDomainReliability)) return false; if (command_line->HasSwitch(switches::kEnableDomainReliability)) return true; + if (!IsDomainReliabilityAllowed()) { + return false; + } if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()) return false; if (base::FieldTrialList::TrialExists(kFieldTrialName)) {
diff --git a/chrome/browser/domain_reliability/service_factory.h b/chrome/browser/domain_reliability/service_factory.h index 896e4ca..8ce523c 100644 --- a/chrome/browser/domain_reliability/service_factory.h +++ b/chrome/browser/domain_reliability/service_factory.h
@@ -7,12 +7,13 @@ namespace domain_reliability { -class DomainReliabilityServiceFactory { - public: - static bool ShouldCreateService(); +// Determines if Domain Reliability service should be created based on +// command line flags, Chrome policies, and field trials. +// Used in //chrome/browser/net/profile_network_context_service.cc. +bool ShouldCreateService(); - static const char kUploadReporterString[]; -}; +// Identifies Chrome as the source of Domain Reliability uploads it sends. +extern const char kUploadReporterString[]; } // namespace domain_reliability
diff --git a/chrome/browser/download/bubble/download_bubble_prefs.cc b/chrome/browser/download/bubble/download_bubble_prefs.cc index 6660c20..5290de8 100644 --- a/chrome/browser/download/bubble/download_bubble_prefs.cc +++ b/chrome/browser/download/bubble/download_bubble_prefs.cc
@@ -51,15 +51,6 @@ ->IsDownloadUiEnabled(); } -bool ShouldShowDetailsAutomatically(Profile* profile) { - // Do not show details automatically if this download is observed by at least - // one extension. This is to avoid conflicts between the download bubble and - // the extension bubble. - return !DownloadCoreServiceFactory::GetForBrowserContext( - profile->GetOriginalProfile()) - ->IsDownloadObservedByExtension(); -} - bool IsDownloadConnectorEnabled(Profile* profile) { auto* connector_service = enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
diff --git a/chrome/browser/download/bubble/download_bubble_prefs.h b/chrome/browser/download/bubble/download_bubble_prefs.h index 7331070..ef331ca 100644 --- a/chrome/browser/download/bubble/download_bubble_prefs.h +++ b/chrome/browser/download/bubble/download_bubble_prefs.h
@@ -18,10 +18,6 @@ // Called when deciding whether to show or hide the bubble. bool ShouldShowDownloadBubble(Profile* profile); -// Called when deciding whehther to pop up the bubble automatically when a -// download has started or completed. -bool ShouldShowDetailsAutomatically(Profile* profile); - bool IsDownloadConnectorEnabled(Profile* profile); } // namespace download
diff --git a/chrome/browser/download/bubble/download_display_controller.cc b/chrome/browser/download/bubble/download_display_controller.cc index 21e7eb3..f85d020 100644 --- a/chrome/browser/download/bubble/download_display_controller.cc +++ b/chrome/browser/download/bubble/download_display_controller.cc
@@ -141,7 +141,7 @@ /*notify_download=*/true, /*force_update=*/true); } - } else if (download::ShouldShowDetailsAutomatically(browser_->profile())) { + } else { display_->ShowDetails(); } } @@ -241,7 +241,7 @@ UpdateToolbarButtonState(all_models); int in_progress_count = InProgressDownloadCount(all_models); if (in_progress_count > 0 && - download::ShouldShowDetailsAutomatically(browser_->profile())) { + download::ShouldShowDownloadBubble(browser_->profile())) { display_->ShowDetails(); } }
diff --git a/chrome/browser/download/bubble/download_display_controller_unittest.cc b/chrome/browser/download/bubble/download_display_controller_unittest.cc index bf5d673..a8569472 100644 --- a/chrome/browser/download/bubble/download_display_controller_unittest.cc +++ b/chrome/browser/download/bubble/download_display_controller_unittest.cc
@@ -116,6 +116,29 @@ OfflineItemList offline_items_; }; +class MockDownloadCoreService : public DownloadCoreService { + public: + MOCK_METHOD(ChromeDownloadManagerDelegate*, GetDownloadManagerDelegate, ()); + MOCK_METHOD(DownloadUIController*, GetDownloadUIController, ()); + MOCK_METHOD(DownloadHistory*, GetDownloadHistory, ()); + MOCK_METHOD(extensions::ExtensionDownloadsEventRouter*, + GetExtensionEventRouter, + ()); + MOCK_METHOD(bool, HasCreatedDownloadManager, ()); + MOCK_METHOD(int, NonMaliciousDownloadCount, (), (const)); + MOCK_METHOD(void, CancelDownloads, ()); + MOCK_METHOD(void, + SetDownloadManagerDelegateForTesting, + (std::unique_ptr<ChromeDownloadManagerDelegate> delegate)); + MOCK_METHOD(bool, IsDownloadUiEnabled, ()); + MOCK_METHOD(bool, IsDownloadObservedByExtension, ()); +}; + +std::unique_ptr<KeyedService> BuildMockDownloadCoreService( + content::BrowserContext* browser_context) { + return std::make_unique<MockDownloadCoreService>(); +} + } // namespace class DownloadDisplayControllerTest : public testing::Test { @@ -136,10 +159,15 @@ EXPECT_CALL(*manager_.get(), GetBrowserContext()) .WillRepeatedly(Return(profile_.get())); - // Set test delegate to get the corresponding download prefs. - auto delegate = std::make_unique<ChromeDownloadManagerDelegate>(profile_); - DownloadCoreServiceFactory::GetForBrowserContext(profile_) - ->SetDownloadManagerDelegateForTesting(std::move(delegate)); + DownloadCoreServiceFactory::GetInstance()->SetTestingFactory( + profile_, base::BindRepeating(&BuildMockDownloadCoreService)); + mock_download_core_service_ = static_cast<MockDownloadCoreService*>( + DownloadCoreServiceFactory::GetForBrowserContext(profile_)); + EXPECT_CALL(*mock_download_core_service(), IsDownloadUiEnabled()) + .WillRepeatedly(Return(true)); + delegate_ = std::make_unique<ChromeDownloadManagerDelegate>(profile_); + EXPECT_CALL(*mock_download_core_service(), GetDownloadManagerDelegate()) + .WillRepeatedly(Return(delegate_.get())); display_ = std::make_unique<FakeDownloadDisplay>(); window_ = std::make_unique<TestBrowserWindow>(); @@ -176,6 +204,9 @@ return *bubble_controller_; } Profile* profile() { return profile_; } + MockDownloadCoreService* mock_download_core_service() { + return mock_download_core_service_; + } void InitDownloadItem(const base::FilePath::CharType* path, DownloadState state, @@ -326,6 +357,8 @@ raw_ptr<Profile> profile_; std::unique_ptr<TestBrowserWindow> window_; std::unique_ptr<Browser> browser_; + MockDownloadCoreService* mock_download_core_service_; + std::unique_ptr<ChromeDownloadManagerDelegate> delegate_; }; TEST_F(DownloadDisplayControllerTest, GetProgressItemsInProgress) { @@ -825,3 +858,14 @@ /*icon_state=*/DownloadIconState::kComplete, /*is_active=*/false)); } + +TEST_F(DownloadDisplayControllerTest, + ShowsDetailsWhenExtensionObservingDownloads) { + EXPECT_CALL(*mock_download_core_service(), IsDownloadObservedByExtension()) + .WillRepeatedly(Return(true)); + InitDownloadItem(FILE_PATH_LITERAL("/foo/bar.pdf"), + download::DownloadItem::IN_PROGRESS); + EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/true, + /*icon_state=*/DownloadIconState::kProgress, + /*is_active=*/true)); +}
diff --git a/chrome/browser/download/download_core_service.h b/chrome/browser/download/download_core_service.h index 81d870e6..3033fa5 100644 --- a/chrome/browser/download/download_core_service.h +++ b/chrome/browser/download/download_core_service.h
@@ -81,10 +81,6 @@ // Returns false if at least one extension has disabled the UI, true // otherwise. virtual bool IsDownloadUiEnabled() = 0; - - // Returns true if at least one extension is observing download events, false - // otherwise. - virtual bool IsDownloadObservedByExtension() = 0; }; #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CORE_SERVICE_H_
diff --git a/chrome/browser/download/download_core_service_impl.cc b/chrome/browser/download/download_core_service_impl.cc index 5e3feb2d..13c02a7e 100644 --- a/chrome/browser/download/download_core_service_impl.cc +++ b/chrome/browser/download/download_core_service_impl.cc
@@ -161,15 +161,6 @@ #endif } -bool DownloadCoreServiceImpl::IsDownloadObservedByExtension() { -#if BUILDFLAG(IS_ANDROID) - return false; -#else - return extension_event_router_ && - extension_event_router_->IsDownloadObservedByExtension(); -#endif -} - void DownloadCoreServiceImpl::Shutdown() { if (download_manager_created_) { // Normally the DownloadManager would be shutdown later, after the Profile
diff --git a/chrome/browser/download/download_core_service_impl.h b/chrome/browser/download/download_core_service_impl.h index cad7b08..c4c9931 100644 --- a/chrome/browser/download/download_core_service_impl.h +++ b/chrome/browser/download/download_core_service_impl.h
@@ -53,7 +53,6 @@ void SetDownloadManagerDelegateForTesting( std::unique_ptr<ChromeDownloadManagerDelegate> delegate) override; bool IsDownloadUiEnabled() override; - bool IsDownloadObservedByExtension() override; DownloadUIController* GetDownloadUIController() override; void SetDownloadHistoryForTesting( std::unique_ptr<DownloadHistory> download_history) override;
diff --git a/chrome/browser/download/download_ui_model.cc b/chrome/browser/download/download_ui_model.cc index fffffcf..1aff20e 100644 --- a/chrome/browser/download/download_ui_model.cc +++ b/chrome/browser/download/download_ui_model.cc
@@ -34,6 +34,7 @@ #if !BUILDFLAG(IS_ANDROID) #include "chrome/browser/ui/browser.h" +#include "components/url_formatter/elide_url.h" #include "ui/views/vector_icons.h" #endif @@ -240,6 +241,21 @@ return status_text_builder_->GetStatusText(GetState()); } +#if !BUILDFLAG(IS_ANDROID) +std::u16string DownloadUIModel::GetStatusTextForLabel( + const gfx::FontList& font_list, + float available_pixel_width) const { + if (!ShouldPromoteOrigin()) { + return GetStatusText(); + } + // TODO(crbug.com/1409167): Avoid calling the deprecated function. + const GURL url = GetOriginalURL().DeprecatedGetOriginAsURL(); + return url.is_valid() + ? url_formatter::ElideUrl(url, font_list, available_pixel_width) + : GetStatusText(); +} +#endif + std::u16string DownloadUIModel::StatusTextBuilderBase::GetStatusText( download::DownloadItem::DownloadState state) const { DCHECK(model_);
diff --git a/chrome/browser/download/download_ui_model.h b/chrome/browser/download/download_ui_model.h index d4e8b29..ac916916 100644 --- a/chrome/browser/download/download_ui_model.h +++ b/chrome/browser/download/download_ui_model.h
@@ -34,6 +34,10 @@ class WebContents; } // namespace content +namespace gfx { +class FontList; +} // namespace gfx + // This class is an abstraction for common UI tasks and properties associated // with a download. class DownloadUIModel { @@ -220,6 +224,10 @@ // Returns a short one-line status string for the download. std::u16string GetStatusText() const; +#if !BUILDFLAG(IS_ANDROID) + std::u16string GetStatusTextForLabel(const gfx::FontList& font_list, + float available_pixel_width) const; +#endif // Returns a string suitable for use as a tooltip. For a regular download, the // tooltip is the filename. For an interrupted download, the string states the
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc index 14af307..a46c2c1 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
@@ -127,11 +127,7 @@ DeclarativeContentCssConditionTracker::DeclarativeContentCssConditionTracker( Delegate* delegate) - : delegate_(delegate) { - registrar_.Add(this, - content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllBrowserContextsAndSources()); -} + : delegate_(delegate) {} DeclarativeContentCssConditionTracker:: ~DeclarativeContentCssConditionTracker() = default; @@ -242,16 +238,9 @@ return true; } -void DeclarativeContentCssConditionTracker::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_CREATED, type); - - content::RenderProcessHost* process = - content::Source<content::RenderProcessHost>(source).ptr(); - InstructRenderProcessIfManagingBrowserContext(process, - GetWatchedCssSelectors()); +void DeclarativeContentCssConditionTracker::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { + InstructRenderProcessIfManagingBrowserContext(host, GetWatchedCssSelectors()); } void DeclarativeContentCssConditionTracker::
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h index 2c8faf6e..deea11e 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
@@ -15,8 +15,7 @@ #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/render_process_host_creation_observer.h" #include "content/public/browser/web_contents_observer.h" namespace base { @@ -62,7 +61,7 @@ // context, and querying for the matching CSS selectors for a context. class DeclarativeContentCssConditionTracker : public ContentPredicateEvaluator, - public content::NotificationObserver { + public content::RenderProcessHostCreationObserver { public: explicit DeclarativeContentCssConditionTracker(Delegate* delegate); @@ -131,10 +130,8 @@ std::unordered_set<std::string> matching_css_selectors_; }; - // content::NotificationObserver implementation. - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + // content::RenderProcessHostCreationObserver implementation. + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; // Informs renderer processes of a new set of watched CSS selectors. void UpdateRenderersWatchedCssSelectors( @@ -166,9 +163,6 @@ // Maps WebContents to the tracker for that WebContents state. std::map<content::WebContents*, std::unique_ptr<PerWebContentsTracker>> per_web_contents_tracker_; - - // Manages our notification registrations. - content::NotificationRegistrar registrar_; }; } // namespace extensions
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index a4d57e851..cac5d95 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -1755,11 +1755,6 @@ return ui_disabling_extensions_.empty(); } -bool ExtensionDownloadsEventRouter::IsDownloadObservedByExtension() const { - EventRouter* router = EventRouter::Get(profile_); - return router && router->HasEventListener(downloads::OnChanged::kEventName); -} - // The method by which extensions hook into the filename determination process // is based on the method by which the omnibox API allows extensions to hook // into the omnibox autocompletion process. Extensions that wish to play a part
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h index 9ad098d6..b84288d 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.h +++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -393,8 +393,6 @@ void SetUiEnabled(const extensions::Extension* extension, bool enabled); bool IsUiEnabled() const; - bool IsDownloadObservedByExtension() const; - // Called by ChromeDownloadManagerDelegate during the filename determination // process, allows extensions to change the item's target filename. If no // extension wants to change the target filename, then |filename_changed| will
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index c6e7d95..3bc2462 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -4846,29 +4846,6 @@ EXPECT_FALSE(GetDownloadToolbarButton()->IsShowing()); } -// Flaky. crbug.com/1386043 -IN_PROC_BROWSER_TEST_F(DownloadExtensionBubbleEnabledTest, - DISABLED_SetUiOptionsShowDetails) { - LoadExtension("downloads_split"); - DownloadManager::DownloadVector items; - CreateFirstSlowTestDownload(); - GetCurrentManager()->GetAllDownloads(&items); - ScopedItemVectorCanceller delete_items(&items); - - EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); - // Details are not shown because the download item is observed by an - // extension. - EXPECT_FALSE(GetDownloadToolbarButton()->IsShowingDetails()); - - DisableExtension(GetExtensionId()); - - CreateSecondSlowTestDownload(); - GetCurrentManager()->GetAllDownloads(&items); - EXPECT_TRUE(GetDownloadToolbarButton()->IsShowing()); - // Details are shown because the extension is disabled. - EXPECT_TRUE(GetDownloadToolbarButton()->IsShowingDetails()); -} - IN_PROC_BROWSER_TEST_F(DownloadExtensionBubbleEnabledTest, SetUiOptionsOffTheRecord) { LoadExtension("downloads_split");
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index a75c340..19b0a4b6 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3996,6 +3996,11 @@ "expiry_milestone": 112 }, { + "name": "google-one-offer-files-banner", + "owners": ["yawano@google.com","assistive-eng@google.com"], + "expiry_milestone": 116 + }, + { "name": "grid-tab-switcher-for-tablets", "owners": [ "nemco", "clank-app-team@google.com" ], "expiry_milestone": 114
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index d45058257..56b682a 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1554,6 +1554,10 @@ "Use a redesigned version of the Global Media Controls UI. Requires " "#global-media-controls to also be enabled."; +const char kGoogleOneOfferFilesBannerName[] = "Google One offer Files banner"; +const char kGoogleOneOfferFilesBannerDescription[] = + "Shows a Files banner about Google One offer."; + const char kOpenscreenCastStreamingSessionName[] = "Enable Open Screen Library (libcast) as the Mirroring Service's Cast " "Streaming implementation";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 1ce6843..3fac8b1 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -866,6 +866,9 @@ extern const char kGlobalMediaControlsModernUIName[]; extern const char kGlobalMediaControlsModernUIDescription[]; +extern const char kGoogleOneOfferFilesBannerName[]; +extern const char kGoogleOneOfferFilesBannerDescription[]; + extern const char kOpenscreenCastStreamingSessionName[]; extern const char kOpenscreenCastStreamingSessionDescription[];
diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h index b74ff94..5698ea63 100644 --- a/chrome/browser/icon_loader.h +++ b/chrome/browser/icon_loader.h
@@ -21,13 +21,20 @@ //////////////////////////////////////////////////////////////////////////////// class IconLoader { public: - // An IconGroup is a class of files that all share the same icon. For all - // platforms but Windows, and for most files on Windows, it is the file type - // (e.g. all .mp3 files share an icon, all .html files share an icon). On - // Windows, for certain file types (.exe, .dll, etc), each file of that type - // is assumed to have a unique icon. In that case, each of those files is a - // group to itself. + // An IconGroup is a class of files that all share the same icon. +#if BUILDFLAG(IS_MAC) + // On the Mac, it's the UTType's identifier. (Apps do have unique icons, just + // like in Windows, below, but `IconLoader` is never used to get their icons, + // so that case isn't handled.) + using IconGroup = std::string; +#else + // On all other platforms except Windows, and for most files on Windows, it is + // the file type (e.g. all .mp3 files share an icon, all .html files share an + // icon). On Windows, for certain file types (.exe, .dll, etc), each file of + // that type is assumed to have a unique icon. In that case, each of those + // files is a group to itself. using IconGroup = base::FilePath::StringType; +#endif enum IconSize { SMALL = 0, // 16x16
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm index 69b7b4eb..535c113a 100644 --- a/chrome/browser/icon_loader_mac.mm +++ b/chrome/browser/icon_loader_mac.mm
@@ -5,9 +5,11 @@ #include "chrome/browser/icon_loader.h" #import <AppKit/AppKit.h> +#include <UniformTypeIdentifiers/UniformTypeIdentifiers.h> #include "base/files/file_path.h" #include "base/functional/bind.h" +#include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "base/task/thread_pool.h" #include "base/threading/thread.h" @@ -17,7 +19,24 @@ // static IconLoader::IconGroup IconLoader::GroupForFilepath( const base::FilePath& file_path) { - return file_path.Extension(); + NSURL* file_url = base::mac::FilePathToNSURL(file_path); + if (@available(macOS 11, *)) { + UTType* type; + if (![file_url getResourceValue:&type + forKey:NSURLContentTypeKey + error:nil]) { + return {}; + } + return base::SysNSStringToUTF8(type.identifier); + } else { + NSString* type; + if (![file_url getResourceValue:&type + forKey:NSURLTypeIdentifierKey + error:nil]) { + return {}; + } + return base::SysNSStringToUTF8(type); + } } // static @@ -27,31 +46,40 @@ } void IconLoader::ReadIcon() { - NSString* group = base::SysUTF8ToNSString(group_); - NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; - NSImage* icon = [workspace iconForFileType:group]; - gfx::Image image; - if (icon_size_ == ALL) { - // The NSImage already has all sizes. - image = gfx::Image(icon); - } else { - NSSize size = NSZeroSize; - switch (icon_size_) { - case IconLoader::SMALL: - size = NSMakeSize(16, 16); - break; - case IconLoader::NORMAL: - size = NSMakeSize(32, 32); - break; - default: - NOTREACHED(); + if (!group_.empty()) { + NSImage* icon; + if (@available(macOS 11, *)) { + UTType* type = + [UTType typeWithIdentifier:base::SysUTF8ToNSString(group_)]; + icon = [NSWorkspace.sharedWorkspace iconForContentType:type]; + } else { + NSString* type = base::SysUTF8ToNSString(group_); + icon = [NSWorkspace.sharedWorkspace iconForFileType:type]; } - gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size)); - if (!image_skia.isNull()) { - image_skia.MakeThreadSafe(); - image = gfx::Image(image_skia); + + if (icon_size_ == ALL) { + // The NSImage already has all sizes. + image = gfx::Image(icon); + } else { + NSSize size = NSZeroSize; + switch (icon_size_) { + case IconLoader::SMALL: + size = NSMakeSize(16, 16); + break; + case IconLoader::NORMAL: + size = NSMakeSize(32, 32); + break; + default: + NOTREACHED(); + } + + gfx::ImageSkia image_skia = gfx::ImageSkiaFromResizedNSImage(icon, size); + if (!image_skia.isNull()) { + image_skia.MakeThreadSafe(); + image = gfx::Image(image_skia); + } } }
diff --git a/chrome/browser/lookalikes/safety_tip_message_delegate_android_unittest.cc b/chrome/browser/lookalikes/safety_tip_message_delegate_android_unittest.cc index ebc8f1b6..e4392e4 100644 --- a/chrome/browser/lookalikes/safety_tip_message_delegate_android_unittest.cc +++ b/chrome/browser/lookalikes/safety_tip_message_delegate_android_unittest.cc
@@ -118,7 +118,7 @@ TEST_F(SafetyTipMessageDelegateAndroidTest, DismissOnNoAction) { base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; EnqueueMessage(mock_callback_receiver.Get(), true, - security_state::SafetyTipStatus::kBadReputation); + security_state::SafetyTipStatus::kLookalike); EXPECT_CALL(mock_callback_receiver, Run(SafetyTipInteraction::kNoAction)); DismissMessage(); } @@ -126,11 +126,11 @@ TEST_F(SafetyTipMessageDelegateAndroidTest, DoNotReplaceCurrentMessage) { base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; EnqueueMessage(mock_callback_receiver.Get(), true, - security_state::SafetyTipStatus::kBadReputation); + security_state::SafetyTipStatus::kLookalike); EXPECT_CALL(mock_callback_receiver, Run(SafetyTipInteraction::kNoAction)) .Times(0); EnqueueMessage(mock_callback_receiver.Get(), false, - security_state::SafetyTipStatus::kBadReputation); + security_state::SafetyTipStatus::kLookalike); EXPECT_CALL(mock_callback_receiver, Run(SafetyTipInteraction::kNoAction)) .Times(1); DismissMessage(); @@ -139,7 +139,7 @@ TEST_F(SafetyTipMessageDelegateAndroidTest, PrimaryActionCallback) { base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; EnqueueMessage(mock_callback_receiver.Get(), true, - security_state::SafetyTipStatus::kBadReputation); + security_state::SafetyTipStatus::kLookalike); web_contents()->SetDelegate(GetTestNavigationDelegate()); TriggerPrimaryButtonClick(); @@ -151,7 +151,7 @@ TEST_F(SafetyTipMessageDelegateAndroidTest, SecondaryActionCallback) { base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; EnqueueMessage(mock_callback_receiver.Get(), true, - security_state::SafetyTipStatus::kBadReputation); + security_state::SafetyTipStatus::kLookalike); web_contents()->SetDelegate(GetTestNavigationDelegate()); TriggerSecondaryButtonClick(); @@ -160,30 +160,6 @@ DismissMessage(); } -TEST_F(SafetyTipMessageDelegateAndroidTest, - MessagePropertyValuesBadReputation) { - base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; - security_state::SafetyTipStatus status = - security_state::SafetyTipStatus::kBadReputation; - EnqueueMessage(mock_callback_receiver.Get(), true, status); - - EXPECT_EQ(GetSafetyTipTitle(status, GURL(kSuggestUrl)), - GetMessageWrapper()->GetTitle()); - EXPECT_EQ(GetSafetyTipDescription(status, GURL(kSuggestUrl)), - GetMessageWrapper()->GetDescription()); - - EXPECT_EQ(l10n_util::GetStringUTF16(GetSafetyTipLeaveButtonId(status)), - GetMessageWrapper()->GetPrimaryButtonText()); - EXPECT_EQ( - ResourceMapper::MapToJavaDrawableId(IDR_ANDROID_INFOBAR_SAFETYTIP_SHIELD), - GetMessageWrapper()->GetIconResourceId()); - EXPECT_EQ(ResourceMapper::MapToJavaDrawableId(IDR_ANDROID_MESSAGE_SETTINGS), - GetMessageWrapper()->GetSecondaryIconResourceId()); - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_MORE_INFO_LINK), - GetMessageWrapper()->GetSecondaryButtonMenuText()); - DismissMessage(); -} - TEST_F(SafetyTipMessageDelegateAndroidTest, MessagePropertyValuesLookAlike) { base::MockOnceCallback<void(SafetyTipInteraction)> mock_callback_receiver; security_state::SafetyTipStatus status =
diff --git a/chrome/browser/lookalikes/safety_tip_ui_helper.cc b/chrome/browser/lookalikes/safety_tip_ui_helper.cc index 8908a8e3..0e53018 100644 --- a/chrome/browser/lookalikes/safety_tip_ui_helper.cc +++ b/chrome/browser/lookalikes/safety_tip_ui_helper.cc
@@ -72,18 +72,12 @@ security_state::SafetyTipStatus safety_tip_status, const GURL& suggested_url) { switch (safety_tip_status) { - case security_state::SafetyTipStatus::kBadReputation: - return l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE); case security_state::SafetyTipStatus::kLookalike: return l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SAFETY_TIP_LOOKALIKE_TITLE, security_interstitials::common_string_util::GetFormattedHostName( suggested_url)); - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - case security_state::SafetyTipStatus::kBadReputationIgnored: case security_state::SafetyTipStatus::kLookalikeIgnored: - case security_state::SafetyTipStatus::kBadKeyword: case security_state::SafetyTipStatus::kUnknown: case security_state::SafetyTipStatus::kNone: NOTREACHED(); @@ -97,13 +91,9 @@ security_state::SafetyTipStatus warning_type, const GURL& suggested_url) { switch (warning_type) { - case security_state::SafetyTipStatus::kBadReputation: case security_state::SafetyTipStatus::kLookalike: return l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_DESCRIPTION); - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - case security_state::SafetyTipStatus::kBadReputationIgnored: case security_state::SafetyTipStatus::kLookalikeIgnored: - case security_state::SafetyTipStatus::kBadKeyword: case security_state::SafetyTipStatus::kNone: case security_state::SafetyTipStatus::kUnknown: NOTREACHED(); @@ -114,14 +104,9 @@ int GetSafetyTipLeaveButtonId(security_state::SafetyTipStatus warning_type) { switch (warning_type) { - case security_state::SafetyTipStatus::kBadReputation: - return IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_LEAVE_BUTTON; case security_state::SafetyTipStatus::kLookalike: return IDS_PAGE_INFO_SAFETY_TIP_LOOKALIKE_LEAVE_BUTTON; - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - case security_state::SafetyTipStatus::kBadReputationIgnored: case security_state::SafetyTipStatus::kLookalikeIgnored: - case security_state::SafetyTipStatus::kBadKeyword: case security_state::SafetyTipStatus::kUnknown: case security_state::SafetyTipStatus::kNone: NOTREACHED();
diff --git a/chrome/browser/lookalikes/safety_tip_web_contents_observer.cc b/chrome/browser/lookalikes/safety_tip_web_contents_observer.cc index fb05f51..f4a684c1 100644 --- a/chrome/browser/lookalikes/safety_tip_web_contents_observer.cc +++ b/chrome/browser/lookalikes/safety_tip_web_contents_observer.cc
@@ -278,18 +278,14 @@ web_contents()->DidChangeVisibleSecurityState(); } - if (result.safety_tip_status == security_state::SafetyTipStatus::kNone || - result.safety_tip_status == - security_state::SafetyTipStatus::kBadKeyword) { + if (result.safety_tip_status == security_state::SafetyTipStatus::kNone) { FinalizeSafetyTipCheckWhenTipNotShown(record_ukm_if_tip_not_shown, result, navigation_source_id); return; } if (result.safety_tip_status == - security_state::SafetyTipStatus::kLookalikeIgnored || - result.safety_tip_status == - security_state::SafetyTipStatus::kBadReputationIgnored) { + security_state::SafetyTipStatus::kLookalikeIgnored) { UMA_HISTOGRAM_ENUMERATION("Security.SafetyTips.SafetyTipIgnoredPageLoad", result.safety_tip_status); FinalizeSafetyTipCheckWhenTipNotShown(record_ukm_if_tip_not_shown, result,
diff --git a/chrome/browser/metrics/chrome_metrics_service_accessor.h b/chrome/browser/metrics/chrome_metrics_service_accessor.h index 8b9ca92..f19833c6 100644 --- a/chrome/browser/metrics/chrome_metrics_service_accessor.h +++ b/chrome/browser/metrics/chrome_metrics_service_accessor.h
@@ -34,7 +34,7 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace domain_reliability { -class DomainReliabilityServiceFactory; +bool ShouldCreateService(); } namespace extensions { @@ -115,7 +115,7 @@ friend class ChromeBrowserMainParts; friend class ChromeContentBrowserClient; friend class ChromeMetricsServicesManagerClient; - friend class domain_reliability::DomainReliabilityServiceFactory; + friend bool domain_reliability::ShouldCreateService(); friend class extensions::ChromeGuestViewManagerDelegate; friend class extensions::ChromeMetricsPrivateDelegate; friend void ChangeMetricsReportingStateWithReply( @@ -178,9 +178,6 @@ // For Ash Chrome, if a user is logged in and the device has an owner or is // managed, the current user's consent (if applicable) will be used if metrics // reporting for the device has been enabled. - // - // TODO(gayane): Consolidate metric prefs on all platforms. - // http://crbug.com/362192, http://crbug.com/532084 static bool IsMetricsAndCrashReportingEnabled(); // This is identical to the function without the |local_state| param but can
diff --git a/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc b/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc index 2ca942d..56e1ebcf 100644 --- a/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc +++ b/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc
@@ -25,8 +25,6 @@ #include "components/ukm/content/source_url_recorder.h" #include "components/ukm/test_ukm_recorder.h" #include "content/public/browser/navigation_handle.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" @@ -136,10 +134,9 @@ } void SimulateRendererCreated() { - content::NotificationService::current()->Notify( - content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::Source<content::RenderProcessHost>(process()), - content::NotificationService::NoDetails()); +#if BUILDFLAG(IS_ANDROID) + child_exit_observer_->OnRenderProcessHostCreated(process()); +#endif } void SimulateOOM() {
diff --git a/chrome/browser/metrics/structured/ash_structured_metrics_recorder_browsertest.cc b/chrome/browser/metrics/structured/ash_structured_metrics_recorder_browsertest.cc index b16daf9..eb9729c 100644 --- a/chrome/browser/metrics/structured/ash_structured_metrics_recorder_browsertest.cc +++ b/chrome/browser/metrics/structured/ash_structured_metrics_recorder_browsertest.cc
@@ -75,6 +75,14 @@ // Wait for the test messages to have been received. base::RunLoop run_loop; + + // TODO(crbug/1350322): Replace this with a mixin once mixin is ready to use. + // There is currently no way to test structured metrics E2E in a browser test. + // This delegate intercepts the event to ensure that the mojo interface is + // working correctly. + // + // A better way to test this would be to verify that the events are persisted + // correctly using a mixin. EventDelegate event_handler = base::BindLambdaForTesting([&run_loop](const Event& event) { EXPECT_THAT(event.project_name(), Eq("TestProjectOne"));
diff --git a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc index 25468d90..4ed2e58 100644 --- a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc +++ b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc
@@ -10,10 +10,11 @@ #include "base/task/sequenced_task_runner.h" #include "chrome/browser/metrics/structured/cros_events_processor.h" #include "components/metrics/structured/histogram_util.h" +#include "components/metrics/structured/recorder.h" #include "components/metrics/structured/structured_metrics_features.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/browser_process.h" // nogncheck +#include "chrome/browser/browser_process.h" // nogncheck #include "chrome/browser/metrics/structured/ash_structured_metrics_recorder.h" // nogncheck #elif BUILDFLAG(IS_CHROMEOS_LACROS) #include "base/task/current_thread.h" @@ -68,16 +69,17 @@ void ChromeStructuredMetricsRecorder::Initialize() { #if BUILDFLAG(IS_CHROMEOS_ASH) + auto* ash_recorder = + static_cast<AshStructuredMetricsRecorder*>(delegate_.get()); + ash_recorder->Initialize(); + // Adds CrOSEvents processor if feature is enabled. if (base::FeatureList::IsEnabled(kEventSequenceLogging)) { - StructuredMetricsClient::Get()->AddEventsProcessor( + Recorder::GetInstance()->AddEventsProcessor( std::make_unique<cros_event::CrOSEventsProcessor>( g_browser_process->local_state())); } - auto* ash_recorder = - static_cast<AshStructuredMetricsRecorder*>(delegate_.get()); - ash_recorder->Initialize(); LogInitializationInStructuredMetrics(StructuredMetricsPlatform::kAshChrome); #elif BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index 6af146b..99fb0211 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -964,12 +964,10 @@ } #endif - if (domain_reliability::DomainReliabilityServiceFactory:: - ShouldCreateService()) { + if (domain_reliability::ShouldCreateService()) { network_context_params->enable_domain_reliability = true; network_context_params->domain_reliability_upload_reporter = - domain_reliability::DomainReliabilityServiceFactory:: - kUploadReporterString; + domain_reliability::kUploadReporterString; network_context_params->discard_domain_reliablity_uploads = g_discard_domain_reliability_uploads_for_testing ? *g_discard_domain_reliability_uploads_for_testing
diff --git a/chrome/browser/performance_manager/browser_child_process_watcher.cc b/chrome/browser/performance_manager/browser_child_process_watcher.cc index 18917e96..d5a2304 100644 --- a/chrome/browser/performance_manager/browser_child_process_watcher.cc +++ b/chrome/browser/performance_manager/browser_child_process_watcher.cc
@@ -31,8 +31,8 @@ DCHECK(!browser_process_node_); DCHECK(tracked_process_nodes_.empty()); - browser_process_node_ = PerformanceManagerImpl::CreateProcessNode( - content::PROCESS_TYPE_BROWSER, RenderProcessHostProxy()); + browser_process_node_ = + PerformanceManagerImpl::CreateProcessNode(BrowserProcessNodeTag{}); OnProcessLaunched(base::Process::Current(), /*metrics_name=*/{}, browser_process_node_.get()); BrowserChildProcessObserver::Add(this); @@ -59,8 +59,7 @@ data.process_type == content::PROCESS_TYPE_UTILITY) { std::unique_ptr<ProcessNodeImpl> process_node = PerformanceManagerImpl::CreateProcessNode( - static_cast<content::ProcessType>(data.process_type), - RenderProcessHostProxy()); + static_cast<content::ProcessType>(data.process_type)); OnProcessLaunched(data.GetProcess(), data.metrics_name, process_node.get()); tracked_process_nodes_[data.id] = std::move(process_node); }
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 3058b939..e408c9d 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -66,6 +66,7 @@ #include "components/content_settings/core/browser/insecure_private_network_policy_handler.h" #include "components/content_settings/core/common/pref_names.h" #include "components/custom_handlers/pref_names.h" +#include "components/domain_reliability/domain_reliability_prefs.h" #include "components/embedder_support/pref_names.h" #include "components/enterprise/browser/reporting/cloud_profile_reporting_policy_handler.h" #include "components/enterprise/browser/reporting/cloud_reporting_frequency_policy_handler.h" @@ -238,6 +239,9 @@ { key::kDisableSafeBrowsingProceedAnyway, prefs::kSafeBrowsingProceedAnywayDisabled, base::Value::Type::BOOLEAN }, + { key::kDomainReliabilityAllowed, + domain_reliability::prefs::kDomainReliabilityAllowedByPolicy, + base::Value::Type::BOOLEAN }, { key::kEditBookmarksEnabled, bookmarks::prefs::kEditBookmarksEnabled, base::Value::Type::BOOLEAN },
diff --git a/chrome/browser/policy/extension_policy_browsertest.cc b/chrome/browser/policy/extension_policy_browsertest.cc index 8d3adb4..5390358 100644 --- a/chrome/browser/policy/extension_policy_browsertest.cc +++ b/chrome/browser/policy/extension_policy_browsertest.cc
@@ -59,6 +59,7 @@ #include "components/version_info/channel.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_process_host_creation_observer.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/result_codes.h" #include "content/public/test/browser_test.h" @@ -368,6 +369,28 @@ web_app::OsIntegrationManager::ScopedSuppressForTesting os_hooks_suppress_; }; +// Allows tests to wait for renderer process creation. +class WindowedProcessCreationObserver + : public content::RenderProcessHostCreationObserver { + public: + void Wait() { + if (!seen_) { + run_loop_.Run(); + } + EXPECT_TRUE(seen_); + } + + // content::RenderProcessHostCreationObserver: + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override { + seen_ = true; + run_loop_.Quit(); + } + + private: + base::RunLoop run_loop_; + bool seen_ = false; +}; + } // namespace #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -1029,9 +1052,7 @@ const std::string old_version_number = registry->enabled_extensions().GetByID(kGoodCrxId)->version().GetString(); - content::WindowedNotificationObserver new_process_observer( - content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllSources()); + WindowedProcessCreationObserver new_process_observer; // Updating the force-installed extension. extensions::ExtensionUpdater* updater = service->updater();
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index f0a8ce90..7e917c31 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -97,6 +97,7 @@ #include "components/dom_distiller/core/distilled_page_prefs.h" #include "components/dom_distiller/core/dom_distiller_features.h" #include "components/dom_distiller/core/pref_names.h" +#include "components/domain_reliability/domain_reliability_prefs.h" #include "components/embedder_support/origin_trials/origin_trial_prefs.h" #include "components/enterprise/browser/identifiers/identifiers_prefs.h" #include "components/flags_ui/pref_service_flags_storage.h" @@ -1135,6 +1136,7 @@ ChromeMetricsServiceClient::RegisterPrefs(registry); chrome::enterprise_util::RegisterLocalStatePrefs(registry); component_updater::RegisterPrefs(registry); + domain_reliability::RegisterPrefs(registry); embedder_support::OriginTrialPrefs::RegisterPrefs(registry); enterprise_reporting::RegisterLocalStatePrefs(registry); ExternalProtocolHandler::RegisterPrefs(registry);
diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js index 374c9fb..93a08b7 100644 --- a/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js +++ b/chrome/browser/resources/bluetooth_internals/characteristic_list_item.js
@@ -5,12 +5,12 @@ import './descriptor_list.js'; import './expandable_list_item.js'; import './object_fieldset.js'; +import './value_control.js'; import {CustomElement} from 'chrome://resources/js/custom_element.js'; import {getTemplate} from './characteristic_list_item.html.js'; import {CharacteristicInfo, Property} from './device.mojom-webui.js'; -import {ValueControl} from './value_control.js'; /** Property names for the CharacteristicInfo fieldset */ const INFO_PROPERTY_NAMES = {
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/dictation_test_support.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/dictation_test_support.js index 82728a2..af762a0 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/dictation_test_support.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/dictation_test_support.js
@@ -61,7 +61,7 @@ } /** Waits for the SandboxedPumpkinTagger to initialize. */ - async WaitForPumpkinTaggerReady() { + async waitForPumpkinTaggerReady() { const strategy = this.dictation_.speechParser_.pumpkinParseStrategy_; const isReady = () => { return strategy.pumpkinTaggerReady_; @@ -128,6 +128,15 @@ this.notifyCcTests_(); } + + /** + * @param {number} selStart + * @param {number} selEnd + */ + async setSelection(selStart, selEnd) { + await this.dictation_.inputController_.setSelection_(selStart, selEnd); + this.notifyCcTests_(); + } } globalThis.testSupport = new DictationTestSupport();
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js index 469112d..528899f 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util.js
@@ -11,25 +11,22 @@ export class EditingUtil { /** * TODO(https://crbug.com/1331351): Add RTL support. - * Replaces a phrase to the left of the text caret with another phrase. If - * multiple instances of `deletePhrase` are present, this function will - * replace the one closest to the text caret. Returns an object that contains - * the new value and the new text caret position. + * Returns data needed by inputController.replacePhrase(). Calculates the new + * caret index and number of characters to be deleted. Only operates on the + * text to the left of the text caret. If multiple instances of `deletePhrase` + * are present, this function will operate on the one closest one to the text + * caret. * @param {string} value The current value of the text field. * @param {number} caretIndex * @param {string} deletePhrase The phrase to be deleted. - * @param {string} insertPhrase The phrase to be inserted. - * @return {!{ - * value: string, - * caretIndex: number + * @return {?{ + * newIndex: number, + * deleteLength: number, * }} */ - static replacePhrase(value, caretIndex, deletePhrase, insertPhrase) { + static getReplacePhraseData(value, caretIndex, deletePhrase) { const leftOfCaret = value.substring(0, caretIndex); - const rightOfCaret = value.substring(caretIndex); - const performingDelete = insertPhrase === ''; deletePhrase = deletePhrase.trim(); - insertPhrase = insertPhrase.trim(); // Find the right-most occurrence of `deletePhrase`. If we're deleting text, // prefer the RegExps that include a leading/trailing space to preserve @@ -45,26 +42,32 @@ const reWithTrailingSpace = EditingUtil.getPhraseRegexTrailingSpace_(deletePhrase); - let newLeft; - let newIndex = insertPhrase.length; - if (performingDelete && reWithLeadingSpace.test(leftOfCaret)) { - newLeft = leftOfCaret.replace(reWithLeadingSpace, insertPhrase); - newIndex += reWithLeadingSpace.exec(leftOfCaret).index; - } else if (performingDelete && reWithTrailingSpace.test(leftOfCaret)) { - newLeft = leftOfCaret.replace(reWithTrailingSpace, insertPhrase); - newIndex += reWithTrailingSpace.exec(leftOfCaret).index; - } else if (re.test(leftOfCaret)) { - newLeft = leftOfCaret.replace(re, insertPhrase); - newIndex += re.exec(leftOfCaret).index; + const leadingSpaceResult = + EditingUtil.getIndexFromRegex_(reWithLeadingSpace, leftOfCaret); + const trailingSpaceResult = + EditingUtil.getIndexFromRegex_(reWithTrailingSpace, leftOfCaret); + const noSpacesResult = EditingUtil.getIndexFromRegex_(re, leftOfCaret); + + let newIndex = caretIndex; + let deleteLength = 0; + if (leadingSpaceResult !== -1) { + // Delete one extra character to preserve spacing. + newIndex = leadingSpaceResult; + deleteLength = deletePhrase.length + 1; + } else if (trailingSpaceResult !== -1) { + // Delete one extra character to preserve spacing. + newIndex = trailingSpaceResult; + deleteLength = deletePhrase.length + 1; + } else if (noSpacesResult !== -1) { + // Matched with no spacing. + newIndex = noSpacesResult; + deleteLength = deletePhrase.length; } else { - newLeft = leftOfCaret; - newIndex = caretIndex; + // No match. + return null; } - return { - value: newLeft + rightOfCaret, - caretIndex: newIndex, - }; + return {newIndex, deleteLength}; } /** @@ -346,6 +349,17 @@ static getPhraseRegexTrailingSpace_(phrase) { return new RegExp(`(\\b${phrase}\\b )(?!.*\\b\\1\\b)`, 'i'); } + + /** + * @param {!RegExp} re + * @param {string} str + * @return {number} + * @private + */ + static getIndexFromRegex_(re, str) { + const result = re.exec(str); + return result ? result.index : -1; + } } /**
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js index 4946af8..73ee52a 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/editing_util_test.js
@@ -14,161 +14,130 @@ } }; -AX_TEST_F('DictationEditingUtilTest', 'ReplacePhrase', function() { +AX_TEST_F('DictationEditingUtilTest', 'GetReplacePhraseData', function() { let value; let caretIndex; let deletePhrase; - let insertPhrase; let result; const f = () => - EditingUtil.replacePhrase(value, caretIndex, deletePhrase, insertPhrase); + EditingUtil.getReplacePhraseData(value, caretIndex, deletePhrase); // Simple delete. value = 'This is a difficult test'; caretIndex = value.length; deletePhrase = 'difficult'; - insertPhrase = ''; result = f(); - assertEquals('This is a test', result.value); - assertEquals(9, result.caretIndex); + assertEquals(9, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Case-insensitive delete. value = 'This is a DIFFICULT test'; caretIndex = value.length; deletePhrase = 'difficult'; - insertPhrase = ''; result = f(); - assertEquals('This is a test', result.value); - assertEquals(9, result.caretIndex); + assertEquals(9, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Delete when there are multiple instances of `deletePhrase`. value = 'The cow jumped over the moon'; caretIndex = value.length; deletePhrase = 'the'; - insertPhrase = ''; result = f(); - assertEquals('The cow jumped over moon', result.value); - assertEquals(19, result.caretIndex); + assertEquals(19, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Delete only content to the left of the caret. // "The cow| jumped over the moon" value = 'The cow jumped over the moon'; caretIndex = 7; deletePhrase = 'the'; - insertPhrase = ''; result = f(); - assertEquals('cow jumped over the moon', result.value); - assertEquals(0, result.caretIndex); + assertEquals(0, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Delete last word. value = 'The cow jumped over the moon.'; caretIndex = value.length; deletePhrase = 'moon'; - insertPhrase = ''; result = f(); - assertEquals('The cow jumped over the.', result.value); - assertEquals(23, result.caretIndex); + assertEquals(23, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Delete only at word boundaries. value = 'A square is also a rectangle'; caretIndex = value.length; deletePhrase = 'a'; - insertPhrase = ''; result = f(); - assertEquals('A square is also rectangle', result.value); - assertEquals(16, result.caretIndex); + assertEquals(16, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Nothing is deleted if we can't find `deletePhrase`. value = 'This is a test'; caretIndex = value.length; deletePhrase = 'coconut'; - insertPhrase = ''; result = f(); - assertEquals('This is a test', result.value); - assertEquals(caretIndex, result.caretIndex); + assertEquals(null, result); // Nothing is deleted if the caret is at index 0. value = 'This is a test'; caretIndex = 0; deletePhrase = 'test'; - insertPhrase = ''; result = f(); - assertEquals('This is a test', result.value); - assertEquals(caretIndex, result.caretIndex); + assertEquals(null, result); // Nothing is deleted if the caret is in the middle of the matched phrase. // "A squ|are is also a rectangle". value = 'A square is also a rectangle'; caretIndex = 5; deletePhrase = 'square'; - insertPhrase = ''; result = f(); - assertEquals('A square is also a rectangle', result.value); - assertEquals(caretIndex, result.caretIndex); + assertEquals(null, result); // Verify that we don't unexpectedly remove punctuation. value = 'Hello world.'; caretIndex = value.length; deletePhrase = 'world'; - insertPhrase = ''; result = f(); - assertEquals('Hello.', result.value); - assertEquals(5, result.caretIndex); + assertEquals(5, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Nothing is deleted if `deletePhrase` includes punctuation. value = 'Hello world.'; caretIndex = value.length; deletePhrase = 'world.'; - insertPhrase = ''; result = f(); - assertEquals('Hello world.', result.value); - assertEquals(caretIndex, result.caretIndex); - - // Simple replacement. - value = 'This is a difficult test'; - caretIndex = value.length; - deletePhrase = 'difficult'; - insertPhrase = 'simple'; - result = f(); - assertEquals('This is a simple test', result.value); - assertEquals(16, result.caretIndex); + assertEquals(null, result); // Replace multiple words. value = 'The cow jumped over the moon'; caretIndex = value.length; deletePhrase = 'jumped over the moon'; - insertPhrase = 'went to bed early'; result = f(); - assertEquals('The cow went to bed early', result.value); - assertEquals(25, result.caretIndex); + assertEquals(7, result.newIndex); + assertEquals(deletePhrase.length + 1, result.deleteLength); // Edge case: value is empty. value = ''; caretIndex = 0; deletePhrase = 'coconut'; - insertPhrase = ''; result = f(); - assertEquals('', result.value); - assertEquals(caretIndex, result.caretIndex); + assertEquals(null, result); // Edge case: caretIndex is negative. value = 'This is a test'; caretIndex = -1; deletePhrase = 'test'; - insertPhrase = ''; result = f(); - assertEquals('This is a test', result.value); - assertEquals(caretIndex, result.caretIndex); + assertEquals(null, result); // Edge case: caretIndex is larger than `value.length`. We treat this as // if the text caret is at the end of value. value = 'Hello'; caretIndex = 5000; deletePhrase = 'Hello'; - insertPhrase = ''; result = f(); - assertEquals('', result.value); - assertEquals(0, result.caretIndex); + assertEquals(0, result.newIndex); + assertEquals(deletePhrase.length, result.deleteLength); }); AX_TEST_F('DictationEditingUtilTest', 'InsertBefore', function() {
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/input_controller.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/input_controller.js index 62399c1..375668a8 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/input_controller.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/input_controller.js
@@ -2,12 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {EventHandler} from '../../common/event_handler.js'; + import {EditingUtil} from './editing_util.js'; import {FocusHandler} from './focus_handler.js'; import {LocaleInfo} from './locale_info.js'; const AutomationNode = chrome.automation.AutomationNode; const EventType = chrome.automation.EventType; +const PositionType = chrome.automation.PositionType; +const RoleType = chrome.automation.RoleType; const StateType = chrome.automation.StateType; /** @@ -30,6 +34,58 @@ */ let EditableNodeData; +/** A helper class that waits for automation and IME events. */ +class AutomationImeEventWaiter { + /** + * @param {!AutomationNode} node + * @param {!EventType} event + */ + constructor(node, event) { + /** @private {!AutomationNode} */ + this.node_ = node; + /** @private {!EventType} */ + this.event_ = event; + } + + /** + * Calls |doAction|, then waits for |this.event_| and a + * chrome.input.ime.onSurroundingTextChanged event. We need to wait for both + * since we use the automation and IME APIs to retrieve the editable node + * data. + * @param {!function(): void} doAction + * @return {!Promise} + */ + async doActionAndWait(doAction) { + let surroundingTextChanged = false; + let eventSeen = false; + return new Promise(resolve => { + const onSurroundingTextChanged = () => { + surroundingTextChanged = true; + chrome.input.ime.onSurroundingTextChanged.removeListener( + onSurroundingTextChanged); + if (eventSeen) { + resolve(); + } + }; + + let handler = new EventHandler([this.node_], this.event_, () => { + eventSeen = true; + handler.stop(); + handler = null; + if (surroundingTextChanged) { + resolve(); + } + }); + + handler.start(); + chrome.input.ime.onSurroundingTextChanged.addListener( + onSurroundingTextChanged); + + doAction(); + }); + } +} + /** InputController handles interaction with input fields for Dictation. */ export class InputController { constructor(stopDictationCallback, focusHandler) { @@ -240,15 +296,28 @@ * @param {number} length The number of characters to be deleted. * @param {number} offset The offset from the caret position where deletion * will start. This value can be negative. + * @return {!Promise} * @private */ - deleteSurroundingText_(length, offset) { - chrome.input.ime.deleteSurroundingText({ - contextID: this.activeImeContextId_, - engineID: InputController.IME_ENGINE_ID, - length, - offset, - }); + async deleteSurroundingText_(length, offset) { + const editableNode = this.focusHandler_.getEditableNode(); + if (!editableNode) { + throw new Error('deleteSurroundingText_ requires a valid editable node'); + } + + const deleteSurroundingText = () => { + chrome.input.ime.deleteSurroundingText({ + contextID: this.activeImeContextId_, + engineID: InputController.IME_ENGINE_ID, + length, + offset, + }); + }; + + // Delete the surrounding text and wait for events to propagate. + const waiter = new AutomationImeEventWaiter( + editableNode, EventType.VALUE_IN_TEXT_FIELD_CHANGED); + await waiter.doActionAndWait(deleteSurroundingText); } /** @@ -266,19 +335,75 @@ * replace the one closest to the text caret. * @param {string} deletePhrase The phrase to be deleted. * @param {string} insertPhrase The phrase to be inserted. + * @return {!Promise} */ - replacePhrase(deletePhrase, insertPhrase) { - let data = this.getEditableNodeData(); + async replacePhrase(deletePhrase, insertPhrase) { + const data = this.getEditableNodeData(); if (!this.checkEditableNodeData_(data)) { return; } - const {value, selStart, selEnd} = data; - data = - EditingUtil.replacePhrase(value, selStart, deletePhrase, insertPhrase); - const newValue = data.value; - const newIndex = data.caretIndex; - this.setEditableValueAndUpdateCaretPosition_(newValue, newIndex); + const {value, selStart} = data; + const replacePhraseData = + EditingUtil.getReplacePhraseData(value, selStart, deletePhrase); + if (!replacePhraseData) { + return; + } + + const {newIndex, deleteLength} = replacePhraseData; + await this.setSelection_(newIndex, newIndex); + await this.deleteSurroundingText_(deleteLength, deleteLength); + if (insertPhrase) { + this.commitText(insertPhrase); + } + } + + /** + * Sets the selection within the editable node. `selStart` and `selEnd` are + * relative to the value of the editable node. Works in all types of text + * fields, including content editables. + * @param {number} selStart + * @param {number} selEnd + * @return {!Promise} + * @private + */ + async setSelection_(selStart, selEnd) { + const editableNode = this.focusHandler_.getEditableNode(); + if (!editableNode) { + return; + } + + let anchorObject = editableNode; + let anchorOffset = selStart; + let focusObject = editableNode; + let focusOffset = selEnd; + + const isContentEditable = editableNode.state[StateType.RICHLY_EDITABLE]; + if (isContentEditable) { + // Contenteditables can contain multiple inline text nodes, so we need to + // translate `selStart` and `selEnd` to a node and index within the + // contenteditable. + let data = this.textNodeAndIndex_(selStart); + if (data) { + anchorObject = data.node; + anchorOffset = data.index; + } + data = this.textNodeAndIndex_(selEnd); + if (data) { + focusObject = data.node; + focusOffset = data.index; + } + } + + const setDocumentSelection = () => { + chrome.automation.setDocumentSelection( + {anchorObject, anchorOffset, focusObject, focusOffset}); + }; + + // Set selection and wait for events to propagate. + const waiter = new AutomationImeEventWaiter( + editableNode, EventType.TEXT_SELECTION_CHANGED); + await waiter.doActionAndWait(setDocumentSelection); } /** @@ -435,6 +560,32 @@ return true; } + + /** + * Translates `index`, which is relative to the editable's value, to an inline + * text node and index within the editable. Only returns valid data when the + * editable node is a contenteditable. + * @param {number} index + * @return {?{node: !AutomationNode, index: number}} + * @private + */ + textNodeAndIndex_(index) { + const editableNode = this.focusHandler_.getEditableNode(); + if (!editableNode || !editableNode.state[StateType.RICHLY_EDITABLE]) { + throw new Error('textNodeAndIndex_ requires a content editable node'); + } + + const position = editableNode.createPosition(PositionType.TEXT, index); + position.asLeafTextPosition(); + if (!position || !position.node || position.textOffset === undefined) { + return null; + } + + return { + node: position.node, + index: position.textOffset, + }; + } } /**
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html index 59b3bdf..bda8023 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html +++ b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.html
@@ -11,7 +11,7 @@ color: var(--cros-text-color-primary); font-size: 13px; } - #retailer-id-input-display-text { + #store-number-input-display-text { color: var(--cros-text-color-secondary); display: var(--cr-input-error-display, block); font-size: 10px; @@ -21,7 +21,7 @@ visibility: visible; white-space: var(--cr-input-error-white-space); } - :host([is_input_invalid_]) #retailer-id-input-display-text { + :host([store_number_input_invalid_]) #store-number-input-display-text { color: var(--cros-textfield-label-color-error); } @@ -33,7 +33,7 @@ [[i18nDynamic(locale, 'demoPreferencesScreenTitle')]] </h1> <span inner-h-t-m-l= - "[[i18nAdvancedDynamic(locale, 'retailerIdInputPrivacyDisclaimer')]]" + "[[i18nAdvancedDynamic(locale, 'retailerPrivacyDisclaimer')]]" slot="subtitle"> </span> <div slot="content" class="landscape-header-aligned"> @@ -52,21 +52,38 @@ justified language-selection-entry"> <div class="language-selection-title layout vertical center-justified"> - <span>[[i18nDynamic(locale, 'retailerIdInputLabel')]]</span> + <span>[[i18nDynamic(locale, 'retailerNameInputLabel')]]</span> </div> <cr-input class="language-selection-title layout horizontal center-justified" - slot="input" id="retailerIdInput" - value="{{retailer_id_input_}}" - on-keydown="onKeydownRetailerIdInput_" + slot="input" id="retailerNameInput" + value="{{retailer_name_input_}}" + on-keydown="onInputKeyDown_" placeholder= - "[[i18nDynamic(locale, 'retailerIdInputPlaceholder')]]" + "[[i18nDynamic(locale, 'retailerNameInputPlaceholder')]]" aria-label= - "[[i18nDynamic(locale, 'retailerIdInputPlaceholder')]]"> + "[[i18nDynamic(locale, 'retailerNameInputPlaceholder')]]"> </cr-input> </div> - <div id="retailer-id-input-display-text"> - [[getRetailerIdInputDisplayText_(locale, is_input_invalid_)]] + <div class="flex layout center horizontal justified + language-selection-entry"> + <div class="language-selection-title layout vertical + center-justified"> + <span>[[i18nDynamic(locale, 'storeNumberInputLabel')]]</span> + </div> + <cr-input class="language-selection-title layout horizontal + center-justified" + slot="input" id="storeNumberInput" + value="{{store_number_input_}}" + on-keydown="onInputKeyDown_" + placeholder= + "[[i18nDynamic(locale, 'storeNumberInputPlaceholder')]]" + aria-label= + "[[i18nDynamic(locale, 'storeNumberInputPlaceholder')]]"> + </cr-input> + </div> + <div id="store-number-input-display-text"> + [[i18nDynamic(locale, 'storeNumberInputHelpText')]] </div> </div> <div slot="back-navigation"> @@ -74,7 +91,7 @@ </div> <div slot="bottom-buttons"> <oobe-text-button id="nextButton" inverse on-click="onNextClicked_" - disabled="[[!is_country_selected_]]" + disabled="[[!user_can_continue_]]" text-key="demoPreferencesNextButtonLabel"> </oobe-text-button> </div>
diff --git a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.js b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.js index eb46bfa4..5d1efef9 100644 --- a/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.js +++ b/chrome/browser/resources/chromeos/login/screens/oobe/demo_preferences.js
@@ -73,24 +73,41 @@ value: false, }, - is_input_invalid_: { + /** + * Indicates whether the next button is enabled and the user can continue. + * @private {boolean} + */ + user_can_continue_: { type: Boolean, value: false, reflectToAttribute: true, - observer: 'isInputInvalidObserver_', + computed: `userCanContinue_(retailer_name_input_, + store_number_input_, + is_country_selected_)`, }, - retailer_id_input_: { + retailer_name_input_: { type: String, value: '', - observer: 'retailerIdObserver_', }, - retailer_id_input_pattern_: { + store_number_input_: { type: String, - value: '^[A-Z]{3}-[0-9]{4}$', + value: '', }, + /** + * Indicates whether the string entered for store_number_input_ is + * invalid. Note that we have to use a negative boolean here so that we + * can style the helper text based on this value. + * @private {boolean} + */ + store_number_input_invalid_: { + type: Boolean, + value: false, + reflectToAttribute: true, + computed: 'isStoreNumberInputInvalid_(store_number_input_)', + }, }; } @@ -189,28 +206,28 @@ } } - getRetailerIdInputDisplayText_() { - if (this.is_input_invalid_) { - return this.i18n('retailerIdInputErrorText'); - } - return this.i18n('retailerIdInputHelpText'); + /** + * Determines whether the Next button is enabled and the user may continue. + * Based on the country, retailer name, and store number preferences being + * correctly set. + * + * @private + */ + userCanContinue_( + retailer_name_input_, store_number_input_, is_country_selected_) { + return retailer_name_input_ && + RegExp('^[0-9]+$').test(store_number_input_) && is_country_selected_; } - retailerIdObserver_() { - if (!this.retailer_id_input_) { - this.is_input_invalid_ = false; - } else { - this.is_input_invalid_ = !RegExp(this.retailer_id_input_pattern_) - .test(this.retailer_id_input_); - } - } - - isInputInvalidObserver_() { - if (this.is_input_invalid_) { - this.$.nextButton.disabled = true; - } else { - this.$.nextButton.disabled = false; - } + /** + * Validates store number input for styling the input helper text. Note we + * only consider the input invalid if it's nonempty, thus the different + * pattern than in {@link userCanContinue_} + * + * @private + */ + isStoreNumberInputInvalid_(store_number_input_) { + return !RegExp('^[0-9]*$').test(store_number_input_); } /** @@ -224,8 +241,11 @@ event.detail.value !== this.country_not_selected_id_; } - onKeydownRetailerIdInput_(e) { - if (e.key == 'Enter') { + onInputKeyDown_(e) { + if (e.key == 'Enter' && + this.userCanContinue_( + this.retailer_name_input_, this.store_number_input_, + this.is_country_selected_)) { this.onNextClicked_(); } } @@ -243,7 +263,11 @@ * @private */ onNextClicked_() { - this.userActed(['continue-setup', this.retailer_id_input_]); + this.userActed([ + 'continue-setup', + this.retailer_name_input_, + this.store_number_input_, + ]); } }
diff --git a/chrome/browser/resources/new_tab_page/app.ts b/chrome/browser/resources/new_tab_page/app.ts index 963d6888..17235ffd 100644 --- a/chrome/browser/resources/new_tab_page/app.ts +++ b/chrome/browser/resources/new_tab_page/app.ts
@@ -61,6 +61,17 @@ CUSTOMIZE_DIALOG = 10, } +/** + * Customize Chrome entry points. This enum must match the numbering for + * NtpCustomizeChromeEntryPoint in enums.xml. These values are persisted to + * logs. Entries should not be renumbered, removed or reused. + */ +export enum NtpCustomizeChromeEntryPoint { + CUSTOMIZE_BUTTON = 0, + MODULE = 1, + URL = 2, +} + const CUSTOMIZE_URL_PARAM: string = 'customize'; const OGB_IFRAME_ORIGIN = 'chrome-untrusted://new-tab-page'; @@ -69,6 +80,12 @@ 'NewTabPage.Click', element, Object.keys(NtpElement).length); } +function recordCustomizeChromeOpen(element: NtpCustomizeChromeEntryPoint) { + chrome.metricsPrivate.recordEnumerationValue( + 'NewTabPage.CustomizeChromeOpened', element, + Object.keys(NtpCustomizeChromeEntryPoint).length); +} + // Adds a <script> tag that holds the lazy loaded code. function ensureLazyLoaded() { const script = document.createElement('script'); @@ -367,6 +384,7 @@ // Open Customize Chrome if there are Customize Chrome URL params. if (this.showCustomize_) { this.pageHandler_.setCustomizeChromeSidePanelVisible(this.showCustomize_); + recordCustomizeChromeOpen(NtpCustomizeChromeEntryPoint.URL); } this.eventTracker_.add(window, 'message', (event: MessageEvent) => { const data = event.data; @@ -508,10 +526,16 @@ if (this.customizeChromeEnabled_) { // TODO(crbug.com/1402251): Scroll to section requested by // |this.selectedCustomizeDialogPage_|. + // Flip customize chrome's visibility e.g. if it is closed, open it. this.pageHandler_.setCustomizeChromeSidePanelVisible( !this.showCustomize_); + if (!this.showCustomize_) { + recordCustomizeChromeOpen( + NtpCustomizeChromeEntryPoint.CUSTOMIZE_BUTTON); + } } else { this.showCustomize_ = true; + recordCustomizeChromeOpen(NtpCustomizeChromeEntryPoint.CUSTOMIZE_BUTTON); } } @@ -709,6 +733,7 @@ this.pageHandler_.setCustomizeChromeSidePanelVisible(this.showCustomize_); } this.selectedCustomizeDialogPage_ = CustomizeDialogPage.MODULES; + recordCustomizeChromeOpen(NtpCustomizeChromeEntryPoint.MODULE); } private printPerformanceDatum_(
diff --git a/chrome/browser/resources/new_tab_page/new_tab_page.ts b/chrome/browser/resources/new_tab_page/new_tab_page.ts index baa42490..0d94998f6 100644 --- a/chrome/browser/resources/new_tab_page/new_tab_page.ts +++ b/chrome/browser/resources/new_tab_page/new_tab_page.ts
@@ -18,7 +18,7 @@ export {MetricsReporterImpl} from 'chrome://resources/js/metrics_reporter/metrics_reporter.js'; export {getTrustedHTML} from 'chrome://resources/js/static_types.js'; export {DomIf} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -export {AppElement, NtpElement} from './app.js'; +export {AppElement, NtpCustomizeChromeEntryPoint, NtpElement} from './app.js'; export {BackgroundManager} from './background_manager.js'; export {CustomizeDialogPage} from './customize_dialog_types.js'; export {DoodleShareDialogElement} from './doodle_share_dialog.js';
diff --git a/chrome/browser/resources/settings/OWNERS b/chrome/browser/resources/settings/OWNERS index a0ea459f..64eb48f 100644 --- a/chrome/browser/resources/settings/OWNERS +++ b/chrome/browser/resources/settings/OWNERS
@@ -5,5 +5,11 @@ # Chrome OS Settings per-file *os_settings*=file://chrome/browser/resources/settings/chromeos/OWNERS +# Reviewers for icon updates related to device subpages (ex. Audio, per-device +# keyboard, etc). +per-file icons.html=ashleydp@google.com +per-file icons.html=gavinwill@chromium.org +per-file icons.html=jimmyxgong@chromium.org + # Happiness Tracking Surveys (HaTS) per-file hats_browser_proxy.ts=sauski@google.com
diff --git a/chrome/browser/resources/settings/chromeos/device_page/audio.html b/chrome/browser/resources/settings/chromeos/device_page/audio.html index 0e5cffe6..8414ef99 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/audio.html +++ b/chrome/browser/resources/settings/chromeos/device_page/audio.html
@@ -3,25 +3,15 @@ margin-inline-end: var(--settings-control-label-spacing); } - .audio-mute-button-container { - border-inline-end: 1px solid var(--cros-app-shield-color); - margin-inline-end: var(--settings-control-label-spacing); - } - - .audio-output-options-container { + .audio-options-container { display: flex; flex-direction: row; } - .audio-output-slider { + .audio-slider { width: 100px; } - .audio-slider-wrapper { - align-items: center; - display: flex; - } - h2 { padding-inline-start: var(--cr-section-padding); } @@ -35,7 +25,7 @@ padding-inline-start: var(--cr-section-indent-padding); } - .subsection > .settings-box { + .subsection > .settings-box { padding-inline-end: 0; padding-inline-start: 0; } @@ -47,21 +37,11 @@ } :host([is-output-muted_]) #audioOutputMuteButton { - --cr-icon-button-fill-color: var(--cros-color-prominent); - background-color: var(--cros-ripple-color-prominent); - } - - :host([is-output-muted_]) #audioOutputMuteButton:hover { - --cr-icon-button-fill-color: var(--cros-color-prominent); - background-color: var(--cros-highlight-color); + --cr-icon-button-fill-color: var(--cros-color-secondary); } :host(:not([is-output-muted_])) #audioOutputMuteButton { - --cr-icon-button-fill-color: var(--cros-color-primary); - } - - :host(:not([is-output-muted_])) #audioOutputMuteButton:hover { - --cr-icon-button-fill-color: var(--cros-color-primary); + --cr-icon-button-fill-color: var(--cros-color-prominent); } :host([is-input-muted_]) #audioInputGainVolumeSlider { @@ -105,68 +85,70 @@ <div class="start settings-box-text" id="audioOutputVolumeLabel"> $i18n{audioVolumeTitle} </div> - <!-- TODO(crbug.com/1092970): Update to new UI once approved. --> - <div class="audio-output-options-container"> - <div class="audio-mute-button-container"> - <cr-icon-button class="audio-mute-button" - id="audioOutputMuteButton" iron-icon="settings:volume-up-off" - on-click="onOutputMuteButtonClicked"> - </cr-icon-button> - </div> - <div class="audio-slider-wrapper" id="audioOutputSliderWrapper"> - <cr-slider class="audio-output-slider" - id ="outputVolumeSlider" - min="0" - max="100" - disabled="[[isOutputVolumeSliderDisabled_( - audioSystemProperties_.outputMuteState - )]]" - value="[[audioSystemProperties_.outputVolumePercent]]" - on-cr-slider-value-changed="onOutputVolumeSliderChanged_"> - </cr-slider> - </div> + <div class="audio-options-container"> + <cr-icon-button class="audio-mute-button" + id="audioOutputMuteButton" + iron-icon="[[getOutputIcon_(isOutputMuted_, outputVolume_)]]" + on-click="onOutputMuteButtonClicked"> + </cr-icon-button> + <cr-slider class="audio-slider" + id ="outputVolumeSlider" + min="0" + max="100" + disabled="[[isOutputVolumeSliderDisabled_( + audioSystemProperties_.outputMuteState + )]]" + value="[[audioSystemProperties_.outputVolumePercent]]" + on-cr-slider-value-changed="onOutputVolumeSliderChanged_"> + </cr-slider> </div> </div> </div> - <!--TODO(b/260277007): Replace placeholder text when localization strings + </div> + <!--TODO(b/260277007): Replace placeholder text when localization strings available. Add styling. --> - <div id="input"> - <h2 id="audioInputTitle">Input</h2> - <div id="audioInputSection"> - <div id="audioInputDeviceSubsection"> - <div id="audioInputDeviceLabel">Device</div> - <select id="audioInputDeviceDropdown" - on-change="onInputDeviceChanged"> - <template is="dom-repeat" + <div id="input"> + <h2 id="audioInputTitle">Input</h2> + <div id="audioInputSection" class="subsection"> + <div id="audioInputDeviceSubsection" class="settings-box"> + <div id="audioInputDeviceLabel" class="start settings-box-text"> + Device + </div> + <select id="audioInputDeviceDropdown" on-change="onInputDeviceChanged"> + <template is="dom-repeat" items="[[audioSystemProperties_.inputDevices]]"> - <option value="[[item.id]]" selected="[[item.isActive]]"> - [[item.displayName]] - </option> - </template> - </select> + <option value="[[item.id]]" selected="[[item.isActive]]"> + [[item.displayName]] + </option> + </template> + </select> + </div> + <div id="audioInputDeviceSubsection" class="settings-box"> + <div id="audioInputGainLabel" class="start settings-box-text"> + Volume </div> - <div id="audioInputDeviceSubsection"> - <div id="audioInputGainLabel">Volume</div> - <div> - <!--TODO(b/260277007): Replace icon once mic-on and mic-off icons - available. --> - <cr-icon-button id="audioInputGainMuteButton" - iron-icon="[[getInputIcon_(isInputMuted_)]]" - on-click="onInputMuteClicked"> - </cr-icon-button> - <cr-slider id ="audioInputGainVolumeSlider" min="0" max="100" - value="[[audioSystemProperties_.inputGainPercent]]" - on-cr-slider-value-changed="onInputVolumeSliderChanged"> - </cr-slider> - </div> + <div class="audio-options-container"> + <cr-icon-button id="audioInputGainMuteButton" + iron-icon="[[getInputIcon_(isInputMuted_)]]" + on-click="onInputMuteClicked"> + </cr-icon-button> + <cr-slider id="audioInputGainVolumeSlider" min="0" max="100" + iron-icon="[[getInputIcon_(isInputMuted_)]]" + value="[[audioSystemProperties_.inputGainPercent]]" + on-cr-slider-value-changed="onInputVolumeSliderChanged" + class="audio-slider"> + </cr-slider> </div> - <div id="audioInputNoiseCancellationSubsection" - hidden="[[!isNoiseCancellationSupported_]]"> - <div id="audioInputNoiseCancellationLabel">Noise Cancellation</div> - <cr-toggle id="audioInputNoiseCancellationToggle" - checked="{{isNoiseCancellationEnabled_}}"> - </cr-toggle> + </div> + <div id="audioInputNoiseCancellationSubsection" class="settings-box" + hidden="[[!isNoiseCancellationSupported_]]"> + <div id="audioInputNoiseCancellationLabel" + class="settings-box-text start"> + Noise Cancellation </div> + <cr-toggle id="audioInputNoiseCancellationToggle" + checked="{{isNoiseCancellationEnabled_}}"> + </cr-toggle> </div> </div> </div>
diff --git a/chrome/browser/resources/settings/chromeos/device_page/audio.ts b/chrome/browser/resources/settings/chromeos/device_page/audio.ts index 4826f943..25cbae3 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/audio.ts +++ b/chrome/browser/resources/settings/chromeos/device_page/audio.ts
@@ -35,6 +35,9 @@ } const SettingsAudioElementBase = RouteObserverMixin(I18nMixin(PolymerElement)); +const VOLUME_ICON_OFF_LEVEL = 0; +const VOLUME_ICON_LOUD_LEVEL = 30; +const SETTINGS_20PX_ICON_PREFIX = 'settings20:'; class SettingsAudioElement extends SettingsAudioElementBase { static get is() { @@ -74,6 +77,10 @@ isNoiseCancellationSupported_: { type: Boolean, }, + + outputVolume_: { + type: Number, + }, }; } @@ -85,6 +92,7 @@ private isInputMuted_: boolean; private isNoiseCancellationEnabled_: boolean; private isNoiseCancellationSupported_: boolean; + private outputVolume_: number; constructor() { super(); @@ -120,6 +128,7 @@ this.isNoiseCancellationSupported_ = !(activeInputDevice?.noiseCancellationState === AudioEffectState.NOT_SUPPORTED); + this.outputVolume_ = this.audioSystemProperties_.outputVolumePercent; } getIsOutputMutedForTest(): boolean { @@ -238,6 +247,26 @@ protected getInputIcon_(): string { return this.isInputMuted_ ? 'settings:mic-off' : 'cr:mic'; } + + /** + * Handles updating the output icon depending on the output mute state and + * volume. + */ + protected getOutputIcon_(): string { + if (this.isOutputMuted_) { + return SETTINGS_20PX_ICON_PREFIX + 'volume-up-off'; + } + + if (this.outputVolume_ === VOLUME_ICON_OFF_LEVEL) { + return SETTINGS_20PX_ICON_PREFIX + 'volume-zero'; + } + + if (this.outputVolume_ < VOLUME_ICON_LOUD_LEVEL) { + return SETTINGS_20PX_ICON_PREFIX + 'volume-down'; + } + + return SETTINGS_20PX_ICON_PREFIX + 'volume-up'; + } } declare global {
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html index e3259109..85d77ab0 100644 --- a/chrome/browser/resources/settings/icons.html +++ b/chrome/browser/resources/settings/icons.html
@@ -37,6 +37,10 @@ <g id="shoppingcart"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.1585 10.8333H12.8502C13.4502 10.8333 14.0002 10.5083 14.3002 9.99167L17.0335 5.20001C17.2502 4.81667 17.2502 4.33334 17.0335 3.95001C16.8168 3.56667 16.3918 3.33334 15.9502 3.33334H4.61683L3.87516 1.66667H0.833496V3.33334H2.79183L5.74183 9.98334L4.85016 11.7583C4.59183 12.275 4.61683 12.8833 4.92516 13.3833C5.2335 13.8833 5.7585 14.175 6.34183 14.175H15.8335V12.5083H6.35016L7.1835 10.8417H12.1585V10.8333ZM7.50016 16.6667C7.50016 17.5871 6.75397 18.3333 5.8335 18.3333C4.91302 18.3333 4.16683 17.5871 4.16683 16.6667C4.16683 15.7462 4.91302 15 5.8335 15C6.75397 15 7.50016 15.7462 7.50016 16.6667ZM15.8335 16.6667C15.8335 17.5871 15.0873 18.3333 14.1668 18.3333C13.2464 18.3333 12.5002 17.5871 12.5002 16.6667C12.5002 15.7462 13.2464 15 14.1668 15C15.0873 15 15.8335 15.7462 15.8335 16.6667ZM12.8502 9.16667L15.2335 5.00001H5.3585L7.2085 9.16667H12.8502Z"></path></g> <g id="spam"><path d="M15.0714 6.66667V3.5H16.5V7.38889H15.0714V6.66667ZM15.0714 9.83333H16.5V8.38889H15.0714V9.83333ZM9.71429 10.9444C11.6214 10.9444 15.4286 11.9122 15.4286 13.8333V16H4V13.8333C4 11.9122 7.80714 10.9444 9.71429 10.9444ZM9.71429 4.44444C10.472 4.44444 11.1988 4.74881 11.7346 5.29058C12.2704 5.83235 12.5714 6.56715 12.5714 7.33333C12.5714 8.09951 12.2704 8.83431 11.7346 9.37609C11.1988 9.91786 10.472 10.2222 9.71429 10.2222C8.95652 10.2222 8.2298 9.91786 7.69398 9.37609C7.15816 8.83431 6.85714 8.09951 6.85714 7.33333C6.85714 6.56715 7.15816 5.83235 7.69398 5.29058C8.2298 4.74881 8.95652 4.44444 9.71429 4.44444ZM9.71429 12.3167C7.59286 12.3167 5.35714 13.3711 5.35714 13.8333V14.6278H14.0714V13.8333C14.0714 13.3711 11.8357 12.3167 9.71429 12.3167ZM9.71429 5.81667C9.31646 5.81667 8.93493 5.97646 8.65363 6.26089C8.37232 6.54532 8.21429 6.93109 8.21429 7.33333C8.21429 7.73558 8.37232 8.12135 8.65363 8.40578C8.93493 8.69021 9.31646 8.85 9.71429 8.85C10.1121 8.85 10.4936 8.69021 10.7749 8.40578C11.0563 8.12135 11.2143 7.73558 11.2143 7.33333C11.2143 6.93109 11.0563 6.54532 10.7749 6.26089C10.4936 5.97646 10.1121 5.81667 9.71429 5.81667Z"></path></g> <g id="undo"><path d="M11.8335 15.8333H5.8335V14.5833H11.8543C12.8266 14.5833 13.6634 14.2604 14.3647 13.6146C15.0661 12.9687 15.4168 12.1666 15.4168 11.2083C15.4168 10.25 15.0661 9.4479 14.3647 8.80206C13.6634 8.15623 12.8266 7.83331 11.8543 7.83331H5.7085L8.0835 10.2083L7.2085 11.0833L3.3335 7.20831L7.2085 3.33331L8.0835 4.20831L5.7085 6.58331H11.8335C13.1529 6.58331 14.2884 7.02776 15.2397 7.91665C16.1911 8.80554 16.6668 9.90276 16.6668 11.2083C16.6668 12.5139 16.1911 13.6111 15.2397 14.5C14.2884 15.3889 13.1529 15.8333 11.8335 15.8333Z"></path></g> + <g id="volume-down"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 13H4.46667L8 16.5V3.5L4.46667 7H1V13ZM10 6.5V13.5C11.776 12.8652 12.5 11.0043 12.5 10C12.5 8.99565 11.776 7.14348 10 6.5Z"></path></g> + <g id="volume-up"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 13H4.46667L8 16.4V3.40002L4.46667 7.00002H1V13ZM10 6.40002V13.4C11.776 12.7652 12.5 10.9044 12.5 9.90002C12.5 8.89568 11.776 7.0435 10 6.40002ZM10 4.16171C12.4771 4.89717 14.5 7.18908 14.5 9.90002C14.5 12.611 12.4771 14.9029 10 15.6383V17.4C13.4371 16.6218 16 13.5602 16 9.90002C16 6.23982 13.4371 3.17825 10 2.40002V4.16171Z"></path></g> + <g id="volume-up-off"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 6.513V7.97617L12.4583 10.5528C12.6093 10.1206 12.5 7.42639 10 6.513ZM13.9946 12.3314L15.1797 13.4534C15.7487 12.3314 16 11.3267 16 9.9645C16 6.07761 13 3.12889 10 2.49896V4.2774C12.6423 5.05842 14.5 7.5 14.5 9.9645C14.5 10.8182 14.3055 11.5867 13.9946 12.3314ZM1 3.12889L4.71387 6.74969L4.5 7H1V13H4.5L8 16.5V10L12.5 14.3494C11.7872 14.8533 11.5515 15.2067 10 15.7357V17.4865C11.4697 17.2198 12.4473 16.5573 13.5598 15.6162L15.8711 18L17 16.8711L2.12889 2L1 3.12889ZM6.573 4.83173L8 6.16345V3.5L6.573 4.83173Z"></g> + <g id="volume-zero"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 13H4.46667L8 16.5V3.5L4.46667 7H1V13Z"></g> <g id="vpn-key"><path d="M10.4727273,8 C9.87272727,6.2525 8.26181818,5 6.36363636,5 C3.95272727,5 2,7.01375 2,9.5 C2,11.98625 3.95272727,14 6.36363636,14 C8.26181818,14 9.87272727,12.7475 10.4727273,11 L13.6363636,11 L13.6363636,14 L16.5454545,14 L16.5454545,11 L18,11 L18,8 L10.4727273,8 Z M6.36363636,11 C5.56,11 4.90909091,10.32875 4.90909091,9.5 C4.90909091,8.67125 5.56,8 6.36363636,8 C7.16727273,8 7.81818182,8.67125 7.81818182,9.5 C7.81818182,10.32875 7.16727273,11 6.36363636,11 Z"></path></g> <g id="cloud-off"><path d="M16.4732571,13.3443682 C16.8002856,12.9882746 17,12.5134184 17,11.9922 C17,10.8882 16.104,9.9922 15,9.9922 L13.494,9.9922 L13.494,9.0002 C13.494,7.0672 11.927,5.5002 9.994,5.5002 C9.5847901,5.5002 9.1930204,5.57089988 8.82954884,5.70065995 L7.33083687,4.20194798 C8.11843435,3.75577808 9.02717677,3.5002 10,3.5002 C12.71,3.5002 14.957,5.4612 15.411,8.0412 C17.424,8.2502 19,9.9312 19,12.0002 C19,13.0718701 18.5784721,14.0451601 17.8921876,14.7632987 L16.4732571,13.3443682 Z M17.8711111,17 L16.8711111,18 L14.8713111,16.0002 L6,16.0002 C3.239,16.0002 1,13.7622 1,11.0002 C1,8.58475294 2.71868905,6.59044755 4.99627833,6.12516722 L2,3.12888889 L3,2.12888889 L17.8711111,17 Z M6.86331111,7.9922 L6,7.9922 C4.343,7.9922 3,9.3352 3,10.9922 C3,12.6492 4.343,13.9922 6,13.9922 L12.8633111,13.9922 L6.86331111,7.9922 Z"></path></g> <!-- The polygon ("+" shape) within this icon will always be filled with
diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc index 809410c3c..0409bf0 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc
@@ -38,8 +38,6 @@ #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/storage_partition.h" #include "mojo/public/cpp/bindings/remote.h" @@ -158,9 +156,6 @@ custom_dictionary_->AddObserver(this); custom_dictionary_->Load(); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllSources()); - #if BUILDFLAG(IS_WIN) if (spellcheck::UseBrowserSpellChecker() && base::FeatureList::IsEnabled( @@ -520,11 +515,9 @@ (!hunspell_dictionaries_.empty() || enable_if_uninitialized); } -void SpellcheckService::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_CREATED, type); - InitForRenderer(content::Source<content::RenderProcessHost>(source).ptr()); +void SpellcheckService::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { + InitForRenderer(host); } void SpellcheckService::OnCustomDictionaryLoaded() {
diff --git a/chrome/browser/spellchecker/spellcheck_service.h b/chrome/browser/spellchecker/spellcheck_service.h index 17b0aae..00e613b 100644 --- a/chrome/browser/spellchecker/spellcheck_service.h +++ b/chrome/browser/spellchecker/spellcheck_service.h
@@ -24,8 +24,7 @@ #include "components/spellcheck/browser/platform_spell_checker.h" #include "components/spellcheck/common/spellcheck.mojom-forward.h" #include "components/spellcheck/spellcheck_buildflags.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/render_process_host_creation_observer.h" #include "mojo/public/cpp/bindings/remote.h" class SpellCheckHostMetrics; @@ -36,8 +35,6 @@ namespace content { class BrowserContext; -class NotificationDetails; -class NotificationSource; class RenderProcessHost; } @@ -51,7 +48,7 @@ // profile and each is created by the SpellCheckServiceFactory. The // SpellcheckService maintains any per-profile information about spellcheck. class SpellcheckService : public KeyedService, - public content::NotificationObserver, + public content::RenderProcessHostCreationObserver, public SpellcheckCustomDictionary::Observer, public SpellcheckHunspellDictionary::Observer { public: @@ -138,10 +135,8 @@ // dictionaries available. bool IsSpellcheckEnabled() const; - // NotificationProfile implementation. - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + // content::RenderProcessHostCreationObserver implementation. + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; // SpellcheckCustomDictionary::Observer implementation. void OnCustomDictionaryLoaded() override; @@ -300,7 +295,6 @@ std::unique_ptr<PlatformSpellChecker> platform_spell_checker_; PrefChangeRegistrar pref_change_registrar_; - content::NotificationRegistrar registrar_; // A pointer to the BrowserContext which this service refers to. raw_ptr<content::BrowserContext> context_;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index f1874215..0297e08 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -832,6 +832,7 @@ "android/tab_model/tab_model_observer_jni_bridge.cc", "android/tab_model/tab_model_observer_jni_bridge.h", "android/toolbar/adaptive_toolbar_bridge.cc", + "android/toolbar/adaptive_toolbar_enums.h", "android/toolbar/location_bar_model_android.cc", "android/toolbar/location_bar_model_android.h", "android/webid/account_selection_view_android.cc", @@ -893,7 +894,6 @@ "//chrome/browser/notifications/scheduler/public", "//chrome/browser/resources/webapks:resources", "//chrome/browser/touch_to_fill/payments/android", - "//chrome/browser/ui:adaptive_toolbar_enums_java", "//chrome/browser/ui/android/autofill/internal:jni_headers", "//chrome/browser/ui/android/toolbar:jni_headers", "//chrome/browser/ui/webui/feed_internals:mojo_bindings",
diff --git a/chrome/browser/ui/android/toolbar/adaptive_toolbar_enums.h b/chrome/browser/ui/android/toolbar/adaptive_toolbar_enums.h index 25c877a..ef695ed 100644 --- a/chrome/browser/ui/android/toolbar/adaptive_toolbar_enums.h +++ b/chrome/browser/ui/android/toolbar/adaptive_toolbar_enums.h
@@ -28,8 +28,7 @@ kPriceTracking = 6, // Reader mode action. kReaderMode = 7, - // Max number of entries. - kNumEntries + kMaxValue = kReaderMode, }; #endif // CHROME_BROWSER_UI_ANDROID_TOOLBAR_ADAPTIVE_TOOLBAR_ENUMS_H_
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarButtonController.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarButtonController.java index 4634655..7ce03c769 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarButtonController.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarButtonController.java
@@ -19,10 +19,13 @@ import org.chromium.base.ObserverList; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; +import org.chromium.base.supplier.ObservableSupplier; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.ConfigurationChangedObserver; import org.chromium.chrome.browser.lifecycle.NativeInitObserver; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; +import org.chromium.chrome.browser.tab.CurrentTabObserver; +import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ButtonData; import org.chromium.chrome.browser.toolbar.ButtonData.ButtonSpec; @@ -32,6 +35,7 @@ import org.chromium.chrome.browser.toolbar.R; import org.chromium.chrome.browser.toolbar.adaptive.settings.AdaptiveToolbarPreferenceFragment; import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.content_public.browser.NavigationHandle; import org.chromium.ui.permissions.AndroidPermissionDelegate; import java.util.HashMap; @@ -74,6 +78,7 @@ @AdaptiveToolbarButtonVariant private int mSessionButtonVariant = AdaptiveToolbarButtonVariant.UNKNOWN; + private CurrentTabObserver mPageLoadMetricsRecorder; /** * Constructs the {@link AdaptiveToolbarButtonController}. @@ -118,7 +123,7 @@ public void addButtonVariant( @AdaptiveToolbarButtonVariant int variant, ButtonDataProvider buttonProvider) { assert variant >= 0 - && variant < AdaptiveToolbarButtonVariant.NUM_ENTRIES + && variant <= AdaptiveToolbarButtonVariant.MAX_VALUE : "invalid adaptive button variant: " + variant; assert variant @@ -184,7 +189,7 @@ RecordHistogram.recordEnumeratedHistogram( "Android.AdaptiveToolbarButton.SessionVariant", receivedButtonData.getButtonSpec().getButtonVariant(), - AdaptiveToolbarButtonVariant.NUM_ENTRIES); + AdaptiveToolbarButtonVariant.MAX_VALUE + 1); } mButtonData.setCanShow(receivedButtonData.canShow() && isScreenWideEnoughForButton()); @@ -215,7 +220,7 @@ @AdaptiveToolbarButtonVariant int buttonVariant) { return view -> { RecordHistogram.recordEnumeratedHistogram("Android.AdaptiveToolbarButton.Clicked", - buttonVariant, AdaptiveToolbarButtonVariant.NUM_ENTRIES); + buttonVariant, AdaptiveToolbarButtonVariant.MAX_VALUE + 1); receivedListener.onClick(view); }; } @@ -290,6 +295,9 @@ public void showDynamicAction(@AdaptiveToolbarButtonVariant int action) { int actionToShow = action != AdaptiveToolbarButtonVariant.UNKNOWN ? action : mSessionButtonVariant; + RecordHistogram.recordEnumeratedHistogram( + "Android.AdaptiveToolbarButton.Variant.OnPageLoad", actionToShow, + AdaptiveToolbarButtonVariant.MAX_VALUE + 1); if (mOriginalButtonSpec != null && mOriginalButtonSpec.getButtonVariant() == actionToShow) { return; } @@ -297,6 +305,33 @@ notifyObservers(true); } + /** + * Creates a metrics recorder that records the button variant shown for every page load. The + * metrics is recorded at the start of a new navigation for the old page being shown. + * + * @param tabSupplier Supplier of current tab. + */ + public void initializePageLoadMetricsRecorder(ObservableSupplier<Tab> tabSupplier) { + if (mPageLoadMetricsRecorder != null) return; + mPageLoadMetricsRecorder = new CurrentTabObserver(tabSupplier, new EmptyTabObserver() { + @Override + public void onDidStartNavigationInPrimaryMainFrame( + Tab tab, NavigationHandle navigationHandle) { + Integer currentVariant = AdaptiveToolbarButtonVariant.UNKNOWN; + for (Integer variant : mButtonDataProviderMap.keySet()) { + if (mSingleProvider == mButtonDataProviderMap.get(variant)) { + currentVariant = variant; + break; + } + } + + RecordHistogram.recordEnumeratedHistogram( + "Android.AdaptiveToolbarButton.Variant.OnStartNavigation", currentVariant, + AdaptiveToolbarButtonVariant.MAX_VALUE + 1); + } + }, null); + } + @Override public void onConfigurationChanged(Configuration newConfig) { if (!mLifecycleDispatcher.isNativeInitializationFinished()
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarStats.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarStats.java index b274d28e..7cb53e5 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarStats.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarStats.java
@@ -69,7 +69,7 @@ adaptiveToolbarStatePredictor.readFromSegmentationPlatform(result -> { RecordHistogram.recordEnumeratedHistogram( "SegmentationPlatform.AdaptiveToolbar.SegmentSelected.Startup", result.second, - AdaptiveToolbarButtonVariant.NUM_ENTRIES); + AdaptiveToolbarButtonVariant.MAX_VALUE + 1); }); }
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/settings/AdaptiveToolbarPreferenceFragmentTest.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/settings/AdaptiveToolbarPreferenceFragmentTest.java index 5cec0dd..7a26cda 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/settings/AdaptiveToolbarPreferenceFragmentTest.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/settings/AdaptiveToolbarPreferenceFragmentTest.java
@@ -157,7 +157,7 @@ } private boolean isRestUnchecked(@AdaptiveToolbarButtonVariant int selectedType) { - for (int i = 0; i < AdaptiveToolbarButtonVariant.NUM_ENTRIES; i++) { + for (int i = 0; i <= AdaptiveToolbarButtonVariant.MAX_VALUE; i++) { RadioButtonWithDescription button = getButton(i); if (i != selectedType && button != null && button.isChecked()) { return false;
diff --git a/chrome/browser/ui/ash/projector/projector_client_impl.cc b/chrome/browser/ui/ash/projector/projector_client_impl.cc index 533ba653..3765381 100644 --- a/chrome/browser/ui/ash/projector/projector_client_impl.cc +++ b/chrome/browser/ui/ash/projector/projector_client_impl.cc
@@ -196,6 +196,10 @@ speech_recognizer_->Stop(); } +void ProjectorClientImpl::ForceEndSpeechRecognition() { + SpeechRecognitionEnded(/*forced=*/true); +} + bool ProjectorClientImpl::GetBaseStoragePath(base::FilePath* result) const { if (!IsDriveFsMounted()) return false; @@ -293,9 +297,7 @@ } void ProjectorClientImpl::OnSpeechRecognitionStopped() { - speech_recognizer_.reset(); - recognizer_status_ = SPEECH_RECOGNIZER_OFF; - controller_->OnSpeechRecognitionStopped(); + SpeechRecognitionEnded(/*forced=*/false); } void ProjectorClientImpl::SetTool(const ash::AnnotatorTool& tool) { @@ -354,6 +356,12 @@ drive_observation_.Observe(drive_service); } +void ProjectorClientImpl::SpeechRecognitionEnded(bool forced) { + speech_recognizer_.reset(); + recognizer_status_ = SPEECH_RECOGNIZER_OFF; + controller_->OnSpeechRecognitionStopped(forced); +} + void ProjectorClientImpl::OnEnablementPolicyChanged() { Profile* profile = ProfileManager::GetActiveUserProfile(); ash::SystemWebAppManager* swa_manager =
diff --git a/chrome/browser/ui/ash/projector/projector_client_impl.h b/chrome/browser/ui/ash/projector/projector_client_impl.h index 4931a89..10709ac3 100644 --- a/chrome/browser/ui/ash/projector/projector_client_impl.h +++ b/chrome/browser/ui/ash/projector/projector_client_impl.h
@@ -51,6 +51,7 @@ const override; void StartSpeechRecognition() override; void StopSpeechRecognition() override; + void ForceEndSpeechRecognition() override; bool GetBaseStoragePath(base::FilePath* result) const override; bool IsDriveFsMounted() const override; bool IsDriveFsMountFailed() const override; @@ -93,6 +94,8 @@ void MaybeSwitchDriveIntegrationServiceObservation(); private: + void SpeechRecognitionEnded(bool forced); + // Called when any of the policies change that control whether the Projector // app is enabled. void OnEnablementPolicyChanged();
diff --git a/chrome/browser/ui/browser_close_unittest.cc b/chrome/browser/ui/browser_close_unittest.cc index 061d63e..06a060b 100644 --- a/chrome/browser/ui/browser_close_unittest.cc +++ b/chrome/browser/ui/browser_close_unittest.cc
@@ -81,8 +81,6 @@ bool IsDownloadUiEnabled() override { return true; } - bool IsDownloadObservedByExtension() override { return false; } - // KeyedService void Shutdown() override {}
diff --git a/chrome/browser/ui/page_info/page_info_unittest.cc b/chrome/browser/ui/page_info/page_info_unittest.cc index cd1faa1..4cf49fa 100644 --- a/chrome/browser/ui/page_info/page_info_unittest.cc +++ b/chrome/browser/ui/page_info/page_info_unittest.cc
@@ -1270,8 +1270,6 @@ const TestCase kTestCases[] = { {{security_state::SafetyTipStatus::kNone, GURL()}, "Security.SafetyTips.PageInfo.Action.SafetyTip_None"}, - {{security_state::SafetyTipStatus::kBadReputation, GURL()}, - "Security.SafetyTips.PageInfo.Action.SafetyTip_BadReputation"}, {{security_state::SafetyTipStatus::kLookalike, GURL()}, "Security.SafetyTips.PageInfo.Action.SafetyTip_Lookalike"}, }; @@ -1319,14 +1317,10 @@ PageInfo::PAGE_INFO_OPENED}, {security_state::SafetyTipStatus::kLookalike, "SafetyTip_Lookalike", PageInfo::PAGE_INFO_OPENED}, - {security_state::SafetyTipStatus::kBadReputation, - "SafetyTip_BadReputation", PageInfo::PAGE_INFO_OPENED}, {security_state::SafetyTipStatus::kNone, "SafetyTip_None", PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED}, {security_state::SafetyTipStatus::kLookalike, "SafetyTip_Lookalike", PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED}, - {security_state::SafetyTipStatus::kBadReputation, - "SafetyTip_BadReputation", PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED}, }; for (const auto& test : kTestCases) {
diff --git a/chrome/browser/ui/side_search/side_search_tab_contents_helper_interactive_uitest.cc b/chrome/browser/ui/side_search/side_search_tab_contents_helper_interactive_uitest.cc index 41bbe60..2f57ee08 100644 --- a/chrome/browser/ui/side_search/side_search_tab_contents_helper_interactive_uitest.cc +++ b/chrome/browser/ui/side_search/side_search_tab_contents_helper_interactive_uitest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/test/bind.h" +#include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/side_search/side_search_tab_contents_helper.h" #include "base/strings/strcat.h" @@ -14,6 +16,7 @@ #include "chrome/browser/ui/ui_features.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "chrome/test/interaction/interactive_browser_test.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/result_codes.h" @@ -26,9 +29,13 @@ #include "extensions/test/test_extension_dir.h" #include "net/dns/mock_host_resolver.h" #include "services/network/test/test_url_loader_factory.h" +#include "ui/base/interaction/element_identifier.h" namespace { +DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kPrimaryTabElementId); +DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kSideSearchElementId); + constexpr char kSearchMatchPath[] = "/search-match"; constexpr char kNonMatchPath[] = "/non-match"; @@ -41,7 +48,7 @@ } // namespace -class SideSearchSideContentsHelperBrowsertest : public InProcessBrowserTest { +class SideSearchSideContentsHelperBrowsertest : public InteractiveBrowserTest { public: // InProcessBrowserTest: void SetUp() override { @@ -57,9 +64,14 @@ base::Unretained(this))); embedded_test_server()->StartAcceptingConnections(); - InProcessBrowserTest::SetUpOnMainThread(); + InteractiveBrowserTest::SetUpOnMainThread(); auto* config = SideSearchConfig::Get(browser()->profile()); + + // TODO(crbug.com/1399570): this is a workaround for a side search bug that + // can randomly close the side panel. + config->set_skip_on_template_url_changed_for_testing(true); + // Basic configuration for testing that allows navigations to URLs with // paths prefixed with `kSearchMatchPath` to proceed within the side panel, // and only allows showing the side panel on non-matching pages. @@ -77,7 +89,7 @@ void TearDownOnMainThread() override { EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); - InProcessBrowserTest::TearDownOnMainThread(); + InteractiveBrowserTest::TearDownOnMainThread(); } // Navigates the active tab to `url`. @@ -107,6 +119,35 @@ } } + auto OpenAndInstrumentSideSearch(GURL url) { + return Steps( + Do(base::BindLambdaForTesting([this, url]() { + GetTabContentsHelper()->OpenSidePanelFromContextMenuSearch(url); + })), + InstrumentNonTabWebView(kSideSearchElementId, + kSideSearchWebViewElementId)); + } + + // Navigates the active tab's side panel web contents. + // Verb version for InteractiveBrowserTests. + auto DoNavigateInSideContents(ui::ElementIdentifier current_tab_id, + const GURL& url) { + return Steps( + std::move(WithElement(kSideSearchElementId, + base::BindOnce( + [](GURL url, ui::TrackedElement* el) { + AsInstrumentedWebContents(el)->LoadPage( + url); + }, + url)) + .SetMustRemainVisible(false)), + WaitForWebContentsNavigation(SideSearchConfig::Get(browser()->profile()) + ->ShouldNavigateInSidePanel(url) + ? kSideSearchElementId + : current_tab_id, + url)); + } + GURL GetMatchingSearchUrl() { // Ensure that each returned matching URL is unique. static int id = 1; @@ -176,43 +217,43 @@ const GURL b1_url = embedded_test_server()->GetURL("/B1.html"); const GURL b2_url = embedded_test_server()->GetURL("/B2.html"); - // Start the tab contents at the initial url. - NavigateTab(initial_url); - auto* tab_contents = GetTabContents(); - EXPECT_EQ(initial_url, tab_contents->GetLastCommittedURL()); + RunTestSequence( + // Start the tab contents at the initial url. + InstrumentTab(kPrimaryTabElementId), + NavigateWebContents(kPrimaryTabElementId, initial_url), - // Have the side panel open page A in the tab contents. - NavigateInSideContents(a_url); - EXPECT_EQ(a_url, tab_contents->GetLastCommittedURL()); + // Make sure the side search is open and instrument it. + OpenAndInstrumentSideSearch(GetMatchingSearchUrl()), - // Have the side panel open page B1 in the tab contents. Immediately redirect - // this to page B2. - NavigateInSideContents(b1_url); - EXPECT_EQ(b1_url, tab_contents->GetLastCommittedURL()); - { - content::TestNavigationObserver tab_observer(tab_contents); - EXPECT_TRUE(content::ExecJs(tab_contents, - "location = '" + b2_url.spec() + "';", - content::EXECUTE_SCRIPT_NO_USER_GESTURE)); - tab_observer.Wait(); - EXPECT_EQ(b2_url, tab_contents->GetLastCommittedURL()); - } + // Have the side panel open page A in the tab contents. + DoNavigateInSideContents(kPrimaryTabElementId, a_url), - // Go back from page B2. B1 should be skippable and we should return to A. - { - content::TestNavigationObserver tab_observer(tab_contents); - tab_contents->GetController().GoBack(); - tab_observer.Wait(); - EXPECT_EQ(a_url, tab_contents->GetLastCommittedURL()); - } + // Have the side panel open page B1 in the tab contents. Immediately + // redirect this to page B2. + DoNavigateInSideContents(kPrimaryTabElementId, b1_url), + CheckElement(kPrimaryTabElementId, + base::BindOnce( + [](GURL url, ui::TrackedElement* el) { + const auto result = content::ExecJs( + AsInstrumentedWebContents(el)->web_contents(), + "location = '" + url.spec() + "';", + content::EXECUTE_SCRIPT_NO_USER_GESTURE); + if (!result) { + LOG(ERROR) << result.failure_message(); + return false; + } + return true; + }, + b2_url)), + WaitForWebContentsNavigation(kPrimaryTabElementId, b2_url), - // Go back from page A. We should return to the initial page. - { - content::TestNavigationObserver tab_observer(tab_contents); - tab_contents->GetController().GoBack(); - tab_observer.Wait(); - EXPECT_EQ(initial_url, tab_contents->GetLastCommittedURL()); - } + // Go back from page B2. B1 should be skippable and we should return to A. + PressButton(kBackButtonElementId), + WaitForWebContentsNavigation(kPrimaryTabElementId, a_url), + + // Go back from page A. We should return to the initial page. + PressButton(kBackButtonElementId), + WaitForWebContentsNavigation(kPrimaryTabElementId, initial_url)); } // This interaction tests that only the final page in the tab frame arrived at
diff --git a/chrome/browser/ui/toolbar/app_menu_fullscreen_interactive_uitest.cc b/chrome/browser/ui/toolbar/app_menu_fullscreen_interactive_uitest.cc index 6fe7ae827..c198578 100644 --- a/chrome/browser/ui/toolbar/app_menu_fullscreen_interactive_uitest.cc +++ b/chrome/browser/ui/toolbar/app_menu_fullscreen_interactive_uitest.cc
@@ -157,19 +157,8 @@ } #endif -// TODO (crbug.com/1408248): This test is failing on Lacros version skew test. -// The BrowserView is not immediately accepting mouse event after fullscreen. -// Trace event showing there were BrowserView::Layout and Composite happened -// after being full screen. And the right mouse click doesn't work during this -// period. -#if BUILDFLAG(IS_CHROMEOS_LACROS) -#define MAYBE_ContextMenu DISABLED_ContextMenu -#else -#define MAYBE_ContextMenu ContextMenu -#endif - // Check Context menu in full screen mode -IN_PROC_BROWSER_TEST_F(AppMenuFullscreenInteractiveTest, MAYBE_ContextMenu) { +IN_PROC_BROWSER_TEST_F(AppMenuFullscreenInteractiveTest, ContextMenu) { DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kPrimaryTabId); RunTestSequence( // 1. Wait for the default page to load.
diff --git a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc index ab78ddd8..9614d3a7 100644 --- a/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_bubble_row_view.cc
@@ -442,9 +442,9 @@ // Empty cell under icon_ AddChildView(std::make_unique<views::FlexLayoutView>()); + // The content of the label will be populated in the `UpdateRow` function. secondary_label_ = AddChildView(std::make_unique<views::Label>( - model_->GetStatusText(), views::style::CONTEXT_LABEL, - views::style::STYLE_SECONDARY)); + u"", views::style::CONTEXT_LABEL, views::style::STYLE_SECONDARY)); secondary_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); // The 2 columns being removed are icon, and padding. secondary_label_->SetProperty(views::kTableColAndRowSpanKey, @@ -675,7 +675,8 @@ void DownloadBubbleRowView::UpdateLabels() { primary_label_->SetText(model_->GetFileNameToReportUser().LossyDisplayName()); - secondary_label_->SetText(model_->GetStatusText()); + secondary_label_->SetText(model_->GetStatusTextForLabel( + secondary_label_->font_list(), secondary_label_->width())); if (ui_info_.has_subpage) { transparent_button_->SetAccessibleName(l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc index e448349..f13857c 100644 --- a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc +++ b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.cc
@@ -4,7 +4,12 @@ #include "chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h" +#include <string> + #include "base/functional/bind.h" +#include "base/i18n/number_formatting.h" +#include "base/strings/strcat.h" +#include "cc/paint/paint_flags.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/download/bubble/download_bubble_controller.h" #include "chrome/browser/download/bubble/download_display_controller.h" @@ -24,11 +29,20 @@ #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/compositor/layer.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/skia_conversions.h" +#include "ui/gfx/image/canvas_image_source.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/gfx/render_text.h" +#include "ui/gfx/text_constants.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/button/button_controller.h" +#include "ui/views/controls/image_view.h" #include "ui/views/controls/progress_ring_utils.h" #include "ui/views/controls/scroll_view.h" #include "ui/views/layout/fill_layout.h" @@ -43,6 +57,46 @@ // 7.5 rows * 60 px per row = 450; constexpr int kMaxHeightForRowList = 450; +// Helper class to draw a circular badge with text. +class CircleBadgeImageSource : public gfx::CanvasImageSource { + public: + CircleBadgeImageSource(const gfx::Size& size, + gfx::RenderText& render_text, + SkColor text_color, + SkColor background_color) + : gfx::CanvasImageSource(size), + render_text_(&render_text), + text_color_(text_color), + background_color_(background_color) {} + + CircleBadgeImageSource(const CircleBadgeImageSource&) = delete; + CircleBadgeImageSource& operator=(const CircleBadgeImageSource&) = delete; + + ~CircleBadgeImageSource() override = default; + + // gfx::CanvasImageSource: + void Draw(gfx::Canvas* canvas) override { + cc::PaintFlags flags; + flags.setStyle(cc::PaintFlags::kFill_Style); + flags.setAntiAlias(true); + flags.setColor(background_color_); + + const gfx::Rect& badge_rect = render_text_->display_rect(); + // Set the corner radius to make the rectangle appear like a circle. + const int corner_radius = badge_rect.height() / 2; + canvas->DrawRoundRect(badge_rect, corner_radius, flags); + + render_text_->SetColor(text_color_); + render_text_->Draw(canvas); + } + + private: + // Pointee may be modified to change the text color upon painting. + gfx::RenderText* const render_text_ = nullptr; + const SkColor text_color_; + const SkColor background_color_; +}; + gfx::Insets GetPrimaryViewMargin() { return gfx::Insets::VH(ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_RELATED_CONTROL_VERTICAL), @@ -67,6 +121,11 @@ SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_DOWNLOAD_ICON)); SetVisible(false); + badge_image_view_ = AddChildView(std::make_unique<views::ImageView>()); + badge_image_view_->SetPaintToLayer(); + badge_image_view_->layer()->SetFillsBoundsOpaquely(false); + badge_image_view_->SetCanProcessEventsWithinSubtree(false); + scanning_animation_.SetSlideDuration(base::Milliseconds(2500)); scanning_animation_.SetTweenType(gfx::Tween::LINEAR); @@ -82,6 +141,49 @@ bubble_controller_.reset(); } +gfx::ImageSkia DownloadToolbarButtonView::GetBadgeImage( + bool is_active, + int progress_download_count, + SkColor badge_text_color, + SkColor badge_background_color) { + // Only display the badge if there are multiple downloads. + if (!is_active || progress_download_count < 2) { + return gfx::ImageSkia(); + } + + const int badge_height = badge_image_view_->bounds().height(); + bool use_placeholder = progress_download_count > kMaxDownloadCountDisplayed; + const int index = use_placeholder ? 0 : progress_download_count - 1; + gfx::RenderText* render_text = render_texts_.at(index).get(); + if (render_text == nullptr) { + ui::ResourceBundle* bundle = &ui::ResourceBundle::GetSharedInstance(); + gfx::FontList font = bundle->GetFontList(ui::ResourceBundle::BaseFont) + .DeriveWithHeightUpperBound(badge_height); + std::u16string text = + use_placeholder + ? base::StrCat( + {base::FormatNumber(kMaxDownloadCountDisplayed), u"+"}) + : base::FormatNumber(progress_download_count); + + std::unique_ptr<gfx::RenderText> new_render_text = + gfx::RenderText::CreateRenderText(); + new_render_text->SetHorizontalAlignment(gfx::ALIGN_CENTER); + new_render_text->SetCursorEnabled(false); + new_render_text->SetFontList(std::move(font)); + new_render_text->SetText(std::move(text)); + new_render_text->SetDisplayRect( + gfx::Rect(gfx::Point(), gfx::Size(badge_height, badge_height))); + // Color is set by the CircleBadgeImageSource when drawing. + + render_text = new_render_text.get(); + render_texts_[index] = std::move(new_render_text); + } + + return gfx::CanvasImageSource::MakeImageSkia<CircleBadgeImageSource>( + gfx::Size(badge_height, badge_height), *render_text, badge_text_color, + badge_background_color); +} + void DownloadToolbarButtonView::PaintButtonContents(gfx::Canvas* canvas) { DownloadDisplayController::ProgressInfo progress_info = controller_->GetProgress(); @@ -96,22 +198,11 @@ bool is_disabled = GetVisualState() == Button::STATE_DISABLED; bool is_active = icon_info.is_active; - SkColor background_color, progress_color; - if (is_disabled) { - background_color = GetForegroundColor(ButtonState::STATE_DISABLED); - progress_color = - icon_color_.value_or(GetForegroundColor(ButtonState::STATE_DISABLED)); - } else if (!is_active) { - background_color = - GetColorProvider()->GetColor(kColorDownloadToolbarButtonRingBackground); - progress_color = icon_color_.value_or( - GetColorProvider()->GetColor(kColorDownloadToolbarButtonInactive)); - } else { - background_color = - GetColorProvider()->GetColor(kColorDownloadToolbarButtonRingBackground); - progress_color = icon_color_.value_or( - GetColorProvider()->GetColor(kColorDownloadToolbarButtonActive)); - } + SkColor background_color = + is_disabled ? GetForegroundColor(ButtonState::STATE_DISABLED) + : GetColorProvider()->GetColor( + kColorDownloadToolbarButtonRingBackground); + SkColor progress_color = GetProgressColor(is_disabled, is_active); int ring_radius = ui::TouchUiController::Get()->touch_ui() ? kProgressRingRadiusTouchMode @@ -221,6 +312,28 @@ Button::STATE_DISABLED, ui::ImageModel::FromVectorIcon( *new_icon, GetForegroundColor(ButtonState::STATE_DISABLED))); + + badge_image_view_->SetImage(GetBadgeImage( + icon_info.is_active, controller_->GetProgress().download_count, + GetProgressColor(GetVisualState() == Button::STATE_DISABLED, + icon_info.is_active), + GetColorProvider()->GetColor(kColorToolbar))); +} + +void DownloadToolbarButtonView::Layout() { + ToolbarButton::Layout(); + gfx::Size size = GetPreferredSize(); + // Badge width and height are the same. + const int badge_height = std::min(size.width(), size.height()) / 2; + const int badge_offset_x = size.width() - badge_height; + const int badge_offset_y = size.height() - badge_height; + // If the badge height has changed, clear the cache of render_texts_. + if (badge_height != badge_image_view_->bounds().height()) { + render_texts_ = std::array<std::unique_ptr<gfx::RenderText>, + kMaxDownloadCountDisplayed>{}; + } + badge_image_view_->SetBoundsRect( + gfx::Rect(badge_offset_x, badge_offset_y, badge_height, badge_height)); } std::unique_ptr<views::View> DownloadToolbarButtonView::GetPrimaryView() { @@ -361,5 +474,18 @@ UpdateIcon(); } +SkColor DownloadToolbarButtonView::GetProgressColor(bool is_disabled, + bool is_active) const { + if (is_disabled) { + return icon_color_.value_or( + GetForegroundColor(ButtonState::STATE_DISABLED)); + } else if (is_active) { + return icon_color_.value_or( + GetColorProvider()->GetColor(kColorDownloadToolbarButtonActive)); + } + return icon_color_.value_or( + GetColorProvider()->GetColor(kColorDownloadToolbarButtonInactive)); +} + BEGIN_METADATA(DownloadToolbarButtonView, ToolbarButton) END_METADATA
diff --git a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h index 865eca8..16cc406 100644 --- a/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h +++ b/chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h
@@ -33,6 +33,8 @@ // Download icon shown in the trusted area of the toolbar. Its lifetime is tied // to that of its parent ToolbarView. The icon is made visible when downloads // are in progress or when a download was initiated in the past 24 hours. +// When there are multiple downloads, a circular badge in the corner of the icon +// displays the number of ongoing downloads. class DownloadToolbarButtonView : public ToolbarButton, public DownloadDisplay, public DownloadBubbleNavigationHandler { @@ -59,6 +61,7 @@ // ToolbarButton: void UpdateIcon() override; void OnThemeChanged() override; + void Layout() override; // DownloadBubbleNavigationHandler: void OpenPrimaryDialog() override; @@ -76,9 +79,18 @@ void SetIconColor(SkColor color); private: + // Max download count to show in the badge. Any higher number of downloads + // results in a placeholder ("9+"). + static constexpr int kMaxDownloadCountDisplayed = 9; + // views::Button overrides: void PaintButtonContents(gfx::Canvas* canvas) override; + gfx::ImageSkia GetBadgeImage(bool is_active, + int progress_download_count, + SkColor badge_text_color, + SkColor badge_background_color); + void ButtonPressed(); void CreateBubbleDialogDelegate(std::unique_ptr<View> bubble_contents_view); void OnBubbleDelegateDeleted(); @@ -89,6 +101,8 @@ std::unique_ptr<View> CreateRowListView( std::vector<DownloadUIModel::DownloadUIModelPtr> model_list); + SkColor GetProgressColor(bool is_disabled, bool is_active) const; + raw_ptr<Browser> browser_; bool is_primary_partial_view_ = false; // Controller for the DownloadToolbarButton UI. @@ -99,6 +113,16 @@ raw_ptr<View> primary_view_ = nullptr; raw_ptr<DownloadBubbleSecurityView> security_view_ = nullptr; + // RenderTexts used for the number in the badge. Stores the text for "n" at + // index n - 1, and stores the text for the placeholder ("9+") at index 0. + // This is done to avoid re-creating the same RenderText on each paint. Text + // color of each RenderText is reset upon each paint. + std::array<std::unique_ptr<gfx::RenderText>, kMaxDownloadCountDisplayed> + render_texts_{}; + // Badge view drawn on top of the rest of the children. It is positioned at + // the bottom right corner of this view's bounds. + raw_ptr<views::ImageView> badge_image_view_ = nullptr; + // Override for the icon color. Used for PWAs, which don't have full // ThemeProvider color support. absl::optional<SkColor> icon_color_;
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 726e05f..9bb3e64 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -1081,17 +1081,8 @@ if (type == DangerType::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS) return {l10n_util::GetStringUTF16(kDangerous), STYLE_RED}; - const GURL url = model_->GetOriginalURL().DeprecatedGetOriginAsURL(); const std::u16string text = - (!model_->ShouldPromoteOrigin() || url.is_empty()) - ? model_->GetStatusText() -#if BUILDFLAG(IS_ANDROID) - // url_formatter::ElideUrl() doesn't exist on Android. - : std::u16string(); -#else - : url_formatter::ElideUrl(url, status_label_->font_list(), - kTextWidth); -#endif + model_->GetStatusTextForLabel(status_label_->font_list(), kTextWidth); return {text, views::style::STYLE_PRIMARY}; }
diff --git a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view.cc b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view.cc index e881b24..958bb85 100644 --- a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view.cc
@@ -105,38 +105,32 @@ views::DISTANCE_BUBBLE_PREFERRED_WIDTH) - insets.left() - insets.right()); - // Suspicious site safety tips don't have a call to action, as they are used - // for drawing users' attention to the omnibox to see if they leave the site - // on their own once they notice the omnibox. (https://crbug.com/1146471) - if (safety_tip_status != security_state::SafetyTipStatus::kBadReputation) { - auto* button_view = AddChildView(std::make_unique<views::BoxLayoutView>()); - button_view->SetCrossAxisAlignment( - views::BoxLayout::CrossAxisAlignment::kCenter); + auto* button_view = AddChildView(std::make_unique<views::BoxLayoutView>()); + button_view->SetCrossAxisAlignment( + views::BoxLayout::CrossAxisAlignment::kCenter); - // Learn more link. - info_link_ = button_view->AddChildView(std::make_unique<views::Link>( - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_MORE_INFO_LINK))); - info_link_->SetCallback(base::BindRepeating( - &SafetyTipPageInfoBubbleView::OpenHelpCenter, base::Unretained(this))); + // Learn more link. + info_link_ = button_view->AddChildView(std::make_unique<views::Link>( + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_MORE_INFO_LINK))); + info_link_->SetCallback(base::BindRepeating( + &SafetyTipPageInfoBubbleView::OpenHelpCenter, base::Unretained(this))); - auto* flex_view = - button_view->AddChildView(std::make_unique<views::View>()); - button_view->SetFlexForView(flex_view, 1); + auto* flex_view = button_view->AddChildView(std::make_unique<views::View>()); + button_view->SetFlexForView(flex_view, 1); - // Leave site button. - leave_button_ = - button_view->AddChildView(std::make_unique<views::MdTextButton>( - base::BindRepeating( - [](SafetyTipPageInfoBubbleView* view) { - view->ExecuteLeaveCommand(); - }, - this), - l10n_util::GetStringUTF16( - GetSafetyTipLeaveButtonId(safety_tip_status)))); - leave_button_->SetProminent(true); - leave_button_->SetID( - PageInfoViewFactory::VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE); - } + // Leave site button. + leave_button_ = + button_view->AddChildView(std::make_unique<views::MdTextButton>( + base::BindRepeating( + [](SafetyTipPageInfoBubbleView* view) { + view->ExecuteLeaveCommand(); + }, + this), + l10n_util::GetStringUTF16( + GetSafetyTipLeaveButtonId(safety_tip_status)))); + leave_button_->SetProminent(true); + leave_button_->SetID( + PageInfoViewFactory::VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE); } SafetyTipPageInfoBubbleView::~SafetyTipPageInfoBubbleView() {}
diff --git a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc index 9a9e824..9174883 100644 --- a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_browsertest.cc
@@ -327,13 +327,6 @@ ASSERT_TRUE(page_info); switch (expected_safety_tip_status) { - case security_state::SafetyTipStatus::kBadReputation: - case security_state::SafetyTipStatus::kBadReputationIgnored: - EXPECT_EQ(GetSafetyTipSummaryText(), - l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE)); - break; - case security_state::SafetyTipStatus::kLookalike: case security_state::SafetyTipStatus::kLookalikeIgnored: EXPECT_EQ(GetSafetyTipSummaryText(), @@ -343,8 +336,6 @@ GetFormattedHostName(expected_safe_url))); break; - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - case security_state::SafetyTipStatus::kBadKeyword: case security_state::SafetyTipStatus::kUnknown: case security_state::SafetyTipStatus::kNone: NOTREACHED(); @@ -1753,10 +1744,9 @@ void ShowUi(const std::string& name) override { auto status = security_state::SafetyTipStatus::kUnknown; - if (name == "BadReputation") - status = security_state::SafetyTipStatus::kBadReputation; - else if (name == "Lookalike") + if (name == "Lookalike") { status = security_state::SafetyTipStatus::kLookalike; + } ShowSafetyTipDialog(browser()->tab_strip_model()->GetActiveWebContents(), status, GURL("https://www.google.tld"), @@ -1765,11 +1755,6 @@ }; IN_PROC_BROWSER_TEST_F(SafetyTipPageInfoBubbleViewDialogTest, - InvokeUi_BadReputation) { - ShowAndVerifyUi(); -} - -IN_PROC_BROWSER_TEST_F(SafetyTipPageInfoBubbleViewDialogTest, InvokeUi_Lookalike) { ShowAndVerifyUi(); }
diff --git a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_unittest.cc index d318b3fc..571ec12 100644 --- a/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/page_info/safety_tip_page_info_bubble_view_unittest.cc
@@ -65,7 +65,7 @@ bubble_ = CreateSafetyTipBubbleForTesting( parent_window_->GetNativeView(), web_contents, - security_state::SafetyTipStatus::kBadReputation, + security_state::SafetyTipStatus::kLookalike, GURL("https://www.google.tld"), base::DoNothing()); }
diff --git a/chrome/browser/ui/web_applications/sub_apps_service_impl.cc b/chrome/browser/ui/web_applications/sub_apps_service_impl.cc index 0c9d73c..4875d64b 100644 --- a/chrome/browser/ui/web_applications/sub_apps_service_impl.cc +++ b/chrome/browser/ui/web_applications/sub_apps_service_impl.cc
@@ -32,7 +32,6 @@ using blink::mojom::SubAppsService; using blink::mojom::SubAppsServiceAddInfoPtr; using blink::mojom::SubAppsServiceAddResult; -using blink::mojom::SubAppsServiceAddResultCode; using blink::mojom::SubAppsServiceAddResultPtr; using blink::mojom::SubAppsServiceListInfo; using blink::mojom::SubAppsServiceListInfoPtr; @@ -174,8 +173,7 @@ std::vector<SubAppsServiceAddResultPtr> result; for (const auto& sub_app : sub_apps_to_add) { result.emplace_back(SubAppsServiceAddResult::New( - sub_app->unhashed_app_id_path, - SubAppsServiceAddResultCode::kParentAppUninstalled)); + sub_app->unhashed_app_id_path, SubAppsServiceResult::kFailure)); } return std::move(result_callback).Run(/*mojom_results=*/std::move(result)); }
diff --git a/chrome/browser/ui/web_applications/sub_apps_service_impl.h b/chrome/browser/ui/web_applications/sub_apps_service_impl.h index 5ad9aa9..3542a42 100644 --- a/chrome/browser/ui/web_applications/sub_apps_service_impl.h +++ b/chrome/browser/ui/web_applications/sub_apps_service_impl.h
@@ -22,8 +22,8 @@ class SubAppsServiceImpl : public content::DocumentService<blink::mojom::SubAppsService> { public: - using AddResults = std::vector< - std::pair<UnhashedAppId, blink::mojom::SubAppsServiceAddResultCode>>; + using AddResults = + std::vector<std::pair<UnhashedAppId, blink::mojom::SubAppsServiceResult>>; using AddResultsMojo = std::vector<blink::mojom::SubAppsServiceAddResultPtr>; SubAppsServiceImpl(const SubAppsServiceImpl&) = delete;
diff --git a/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc b/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc index 84883868..c338e06 100644 --- a/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc +++ b/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc
@@ -36,7 +36,6 @@ using blink::mojom::SubAppsService; using blink::mojom::SubAppsServiceAddInfo; using blink::mojom::SubAppsServiceAddInfoPtr; -using blink::mojom::SubAppsServiceAddResultCode; using blink::mojom::SubAppsServiceListInfo; using blink::mojom::SubAppsServiceListInfoPtr; using blink::mojom::SubAppsServiceListResultPtr; @@ -151,14 +150,12 @@ } void ExpectCallAdd( - base::flat_set<std::pair<std::string, SubAppsServiceAddResultCode>> - expected, + base::flat_set<std::pair<std::string, SubAppsServiceResult>> expected, std::vector<std::pair<std::string, std::string>> subapps) { SubAppsServiceImpl::AddResults actual = CallAdd(subapps); // We need to use a set for comparison because the ordering changes between // invocations (due to embedded test server using a random port each time). - base::flat_set< - std::pair<UnhashedAppId, blink::mojom::SubAppsServiceAddResultCode>> + base::flat_set<std::pair<UnhashedAppId, blink::mojom::SubAppsServiceResult>> actual_set{actual}; EXPECT_EQ(expected, actual_set); } @@ -220,9 +217,8 @@ InstallParentApp(); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id_).size()); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); // Verify a bunch of things for the newly installed sub-app. AppId sub_app_id = GenerateAppIdFromPath(kSubAppPath); @@ -251,9 +247,8 @@ content::WebContents* web_contents = OpenApplication(parent_app_id_); BindRemote(web_contents); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); } // Add call should fail if the parent app isn't installed. @@ -262,9 +257,8 @@ NavigateToParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kParentAppUninstalled}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kFailure}}, + {{kSubAppPath, kSubAppPath}}); } // Add call should fail if the call wasn't made from the context of parent app. @@ -273,9 +267,8 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kParentAppUninstalled}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kFailure}}, + {{kSubAppPath, kSubAppPath}}); } // Verify that Add call rejects a sub-app with the wrong specified app_id. @@ -284,8 +277,7 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd({{kSubAppIdInvalid, - SubAppsServiceAddResultCode::kExpectedAppIdCheckFailed}}, + ExpectCallAdd({{kSubAppIdInvalid, SubAppsServiceResult::kFailure}}, {{kSubAppIdInvalid, kSubAppPath}}); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id_).size()); } @@ -296,9 +288,8 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPathInvalid, SubAppsServiceAddResultCode::kInstallUrlInvalid}}, - {{kSubAppPathInvalid, kSubAppPathInvalid}}); + ExpectCallAdd({{kSubAppPathInvalid, SubAppsServiceResult::kFailure}}, + {{kSubAppPathInvalid, kSubAppPathInvalid}}); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id_).size()); } @@ -333,17 +324,15 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); AppId sub_app_id = GenerateAppIdFromPath(kSubAppPath); EXPECT_EQ( DisplayMode::kStandalone, provider().registrar_unsafe().GetAppEffectiveDisplayMode(sub_app_id)); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessAlreadyInstalled}}, - {{kSubAppPath, kSubAppPathMinimalUi}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPathMinimalUi}}); EXPECT_EQ( DisplayMode::kStandalone, provider().registrar_unsafe().GetAppEffectiveDisplayMode(sub_app_id)); @@ -361,21 +350,18 @@ EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id_).size()); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); EXPECT_EQ(1ul, GetAllSubAppIds(parent_app_id_).size()); // Try to add first sub app again. - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessAlreadyInstalled}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); EXPECT_EQ(1ul, GetAllSubAppIds(parent_app_id_).size()); // Add second sub app. - ExpectCallAdd( - {{kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath2, kSubAppPath2}}); + ExpectCallAdd({{kSubAppPath2, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath2, kSubAppPath2}}); EXPECT_EQ(2ul, GetAllSubAppIds(parent_app_id_).size()); } @@ -385,13 +371,12 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath3, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}, - {kSubAppPath2, kSubAppPath2}, - {kSubAppPath3, kSubAppPath3}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}, + {kSubAppPath2, SubAppsServiceResult::kSuccess}, + {kSubAppPath3, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}, + {kSubAppPath2, kSubAppPath2}, + {kSubAppPath3, kSubAppPath3}}); EXPECT_EQ(3ul, GetAllSubAppIds(parent_app_id_).size()); } @@ -403,13 +388,12 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPathInvalid, SubAppsServiceAddResultCode::kInstallUrlInvalid}, - {kSubAppPath3, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}, - {kSubAppPathInvalid, kSubAppPathInvalid}, - {kSubAppPath3, kSubAppPath3}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}, + {kSubAppPathInvalid, SubAppsServiceResult::kFailure}, + {kSubAppPath3, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}, + {kSubAppPathInvalid, kSubAppPathInvalid}, + {kSubAppPath3, kSubAppPath3}}); EXPECT_EQ(2ul, GetAllSubAppIds(parent_app_id_).size()); } @@ -433,13 +417,12 @@ InstallParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath3, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}, - {kSubAppPath2, kSubAppPath2}, - {kSubAppPath3, kSubAppPath3}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}, + {kSubAppPath2, SubAppsServiceResult::kSuccess}, + {kSubAppPath3, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}, + {kSubAppPath2, kSubAppPath2}, + {kSubAppPath3, kSubAppPath3}}); // Verify that sub-apps are installed. AppId sub_app_id_1 = GenerateAppIdFromPath(kSubAppPath); @@ -479,10 +462,9 @@ AppId sub_app_id_1 = GenerateAppIdFromPath(kSubAppPath); AppId sub_app_id_2 = GenerateAppIdFromPath(kSubAppPath2); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}, {kSubAppPath2, kSubAppPath2}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}, + {kSubAppPath2, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}, {kSubAppPath2, kSubAppPath2}}); // Verify that 2 sub-apps are installed. EXPECT_TRUE(provider().registrar_unsafe().IsInstalled(sub_app_id_1)); @@ -516,18 +498,16 @@ // Add another sub-app to verify standalone app install/uninstall does not // affect normal sub-app uninstalls. - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); AppId sub_app_id = GenerateAppIdFromPath(kSubAppPath); EXPECT_TRUE(provider().registrar_unsafe().IsInstalled(sub_app_id)); // Add standalone app as sub-app. const WebApp* standalone_app = provider().registrar_unsafe().GetAppById(standalone_app_id); - ExpectCallAdd( - {{kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath2, kSubAppPath2}}); + ExpectCallAdd({{kSubAppPath2, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath2, kSubAppPath2}}); // Verify that it is now installed and registered as a sub-app. EXPECT_EQ(parent_app_id_, standalone_app->parent_app_id()); @@ -563,13 +543,12 @@ EXPECT_EQ(SubAppsServiceResult::kSuccess, result->code); EXPECT_EQ(std::vector<SubAppsServiceListInfoPtr>{}, result->sub_apps_list); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}, - {kSubAppPath3, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}, - {kSubAppPath2, kSubAppPath2}, - {kSubAppPath3, kSubAppPath3}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}, + {kSubAppPath2, SubAppsServiceResult::kSuccess}, + {kSubAppPath3, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}, + {kSubAppPath2, kSubAppPath2}, + {kSubAppPath3, kSubAppPath3}}); result = CallList(); @@ -600,9 +579,8 @@ BindRemote(); // Sub-app install. - ExpectCallAdd( - {{kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath2, kSubAppPath2}}); + ExpectCallAdd({{kSubAppPath2, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath2, kSubAppPath2}}); std::vector<SubAppsServiceListInfoPtr> expected_result; expected_result.emplace_back( @@ -633,9 +611,8 @@ NavigateToParentApp(); BindRemote(); - ExpectCallAdd( - {{kSubAppPath, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath, kSubAppPath}}); + ExpectCallAdd({{kSubAppPath, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath, kSubAppPath}}); AppId app_id = GenerateAppIdFromPath(kSubAppPath); EXPECT_EQ(1ul, GetAllSubAppIds(parent_app_id_).size()); @@ -666,9 +643,8 @@ NavigateToPath(kSubAppPath); BindRemote(); - ExpectCallAdd( - {{kSubAppPath2, SubAppsServiceAddResultCode::kSuccessNewInstall}}, - {{kSubAppPath2, kSubAppPath2}}); + ExpectCallAdd({{kSubAppPath2, SubAppsServiceResult::kSuccess}}, + {{kSubAppPath2, kSubAppPath2}}); AppId second_parent_app = InstallPWAFromPath(kSubAppPath3); NavigateToPath(kSubAppPath3);
diff --git a/chrome/browser/ui/webui/ash/login/demo_preferences_screen_handler.cc b/chrome/browser/ui/webui/ash/login/demo_preferences_screen_handler.cc index 98cd0309..365207e 100644 --- a/chrome/browser/ui/webui/ash/login/demo_preferences_screen_handler.cc +++ b/chrome/browser/ui/webui/ash/login/demo_preferences_screen_handler.cc
@@ -28,16 +28,18 @@ IDS_OOBE_DEMO_SETUP_PREFERENCES_SCREEN_NEXT_BUTTON_LABEL); builder->Add("countryDropdownTitle", IDS_COUNTRY_DROPDOWN_TITLE); builder->Add("countryDropdownLabel", IDS_COUNTRY_DROPDOWN_LABEL); - builder->Add("retailerIdInputLabel", - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_LABEL); - builder->Add("retailerIdInputPlaceholder", - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_PLACEHOLDER); - builder->Add("retailerIdInputHelpText", - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_HELP_TEXT); - builder->Add("retailerIdInputPrivacyDisclaimer", - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_PRIVACY_DISCLAIMER); - builder->Add("retailerIdInputErrorText", - IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_ID_INPUT_ERROR_TEXT); + builder->Add("retailerNameInputLabel", + IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_LABEL); + builder->Add("retailerNameInputPlaceholder", + IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_NAME_INPUT_PLACEHOLDER); + builder->Add("retailerPrivacyDisclaimer", + IDS_OOBE_DEMO_SETUP_PREFERENCES_RETAILER_PRIVACY_DISCLAIMER); + builder->Add("storeNumberInputLabel", + IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_LABEL); + builder->Add("storeNumberInputPlaceholder", + IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_PLACEHOLDER); + builder->Add("storeNumberInputHelpText", + IDS_OOBE_DEMO_SETUP_PREFERENCES_STORE_NUMBER_INPUT_HELP_TEXT); } } // namespace ash
diff --git a/chrome/browser/web_applications/commands/sub_app_install_command.cc b/chrome/browser/web_applications/commands/sub_app_install_command.cc index 8aa2e44..3bb89a54 100644 --- a/chrome/browser/web_applications/commands/sub_app_install_command.cc +++ b/chrome/browser/web_applications/commands/sub_app_install_command.cc
@@ -45,28 +45,23 @@ return ss.str(); } -blink::mojom::SubAppsServiceAddResultCode InstallResultCodeToMojo( +blink::mojom::SubAppsServiceResult InstallResultCodeToMojo( webapps::InstallResultCode install_result_code) { switch (install_result_code) { + // Success result codes. case webapps::InstallResultCode::kSuccessNewInstall: - return blink::mojom::SubAppsServiceAddResultCode::kSuccessNewInstall; case webapps::InstallResultCode::kSuccessAlreadyInstalled: - return blink::mojom::SubAppsServiceAddResultCode:: - kSuccessAlreadyInstalled; + return blink::mojom::SubAppsServiceResult::kSuccess; + // Failure result codes. case webapps::InstallResultCode::kUserInstallDeclined: - return blink::mojom::SubAppsServiceAddResultCode::kUserInstallDeclined; case webapps::InstallResultCode::kExpectedAppIdCheckFailed: - return blink::mojom::SubAppsServiceAddResultCode:: - kExpectedAppIdCheckFailed; case webapps::InstallResultCode::kInstallURLRedirected: case webapps::InstallResultCode::kInstallURLLoadTimeOut: case webapps::InstallResultCode::kInstallURLLoadFailed: - return blink::mojom::SubAppsServiceAddResultCode::kInstallUrlInvalid; case webapps::InstallResultCode::kNotValidManifestForWebApp: - return blink::mojom::SubAppsServiceAddResultCode:: - kNotValidManifestForWebApp; + return blink::mojom::SubAppsServiceResult::kFailure; default: - return blink::mojom::SubAppsServiceAddResultCode::kFailure; + return blink::mojom::SubAppsServiceResult::kFailure; } } @@ -165,9 +160,8 @@ base::ranges::transform( requested_installs_, std::inserter(results_, results_.begin()), [](auto const& pair) { - return std::pair{ - pair.first, - blink::mojom::SubAppsServiceAddResultCode::kParentAppUninstalled}; + return std::pair{pair.first, + blink::mojom::SubAppsServiceResult::kFailure}; }); SignalCompletionAndSelfDestruct( CommandResult::kFailure, @@ -432,10 +426,11 @@ // acceptance below with a permissions dialog shown to the user. for (auto& [unhashed_app_id, web_app_info, acceptance_callback] : acceptance_callbacks_) { - if (dialog_not_accepted_for_testing_) + if (dialog_not_accepted_for_testing_) { std::move(acceptance_callback).Run(false, std::move(web_app_info)); - else + } else { std::move(acceptance_callback).Run(true, std::move(web_app_info)); + } } acceptance_callbacks_.clear(); // This needs to happen to measure the state where all acceptance @@ -461,7 +456,8 @@ auto mojo_result = InstallResultCodeToMojo(result); std::pair result_pair(unhashed_app_id, mojo_result); AddResultToDebugData(unhashed_app_id, pending_installs_map_[unhashed_app_id], - GenerateAppIdFromUnhashed(unhashed_app_id), mojo_result); + GenerateAppIdFromUnhashed(unhashed_app_id), result, + mojo_result); results_.emplace_back(result_pair); pending_installs_map_.erase(unhashed_app_id); } @@ -474,10 +470,12 @@ const UnhashedAppId& unhashed_app_id, const GURL& install_url, const AppId& installed_app_id, - const blink::mojom::SubAppsServiceAddResultCode& code) { + webapps::InstallResultCode detailed_code, + const blink::mojom::SubAppsServiceResult& code) { base::Value::Dict install_info; install_info.Set("unhashed_app_id", unhashed_app_id); install_info.Set("install_url", install_url.spec()); + install_info.Set("detailed_result_code", StreamableToString(detailed_code)); install_info.Set("result_code", StreamableToString(code)); debug_install_results_.Set(installed_app_id, base::Value(std::move(install_info)));
diff --git a/chrome/browser/web_applications/commands/sub_app_install_command.h b/chrome/browser/web_applications/commands/sub_app_install_command.h index c4e41aee..797ec91 100644 --- a/chrome/browser/web_applications/commands/sub_app_install_command.h +++ b/chrome/browser/web_applications/commands/sub_app_install_command.h
@@ -39,7 +39,7 @@ class WebAppDataRetriever; using AppInstallResults = - std::vector<std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode>>; + std::vector<std::pair<AppId, blink::mojom::SubAppsServiceResult>>; using SubAppInstallResultCallback = base::OnceCallback<void(AppInstallResults)>; class SubAppInstallCommand @@ -111,11 +111,11 @@ const UnhashedAppId& unhashed_app_id, webapps::InstallResultCode result); bool IsWebContentsDestroyed(); - void AddResultToDebugData( - const UnhashedAppId& unhashed_app_id, - const GURL& url, - const AppId& installed_app_id, - const blink::mojom::SubAppsServiceAddResultCode& code); + void AddResultToDebugData(const UnhashedAppId& unhashed_app_id, + const GURL& url, + const AppId& installed_app_id, + webapps::InstallResultCode detailed_code, + const blink::mojom::SubAppsServiceResult& code); std::unique_ptr<SharedWebContentsWithAppLockDescription> lock_description_; std::unique_ptr<SharedWebContentsWithAppLock> lock_;
diff --git a/chrome/browser/web_applications/commands/sub_app_install_command_unittest.cc b/chrome/browser/web_applications/commands/sub_app_install_command_unittest.cc index d35f334..5b1f352 100644 --- a/chrome/browser/web_applications/commands/sub_app_install_command_unittest.cc +++ b/chrome/browser/web_applications/commands/sub_app_install_command_unittest.cc
@@ -149,9 +149,8 @@ AppInstallResults command_result = InstallSubAppAndWait( parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url())); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kSuccessNewInstall); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kSuccess); // Verify command works fine, single sub_app is installed. EXPECT_EQ(1u, command_result.size()); @@ -177,22 +176,19 @@ // Install first app as sub_app. AppInstallResults command_result = InstallSubAppAndWait( parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url())); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kSuccessNewInstall); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kSuccess); EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result, command_result[0]); EXPECT_EQ(1ul, GetAllSubAppIds(parent_app_id).size()); EXPECT_TRUE(registrar().IsInstalled(sub_app_id)); - // Reinstalling the same app as a sub_app should returns a - // kSuccessAlreadyInstalled. + // Reinstalling the same app as a sub_app should return a kSuccess. command_result = InstallSubAppAndWait( parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url())); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> - expected_result_installed( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kSuccessAlreadyInstalled); + std::pair<AppId, blink::mojom::SubAppsServiceResult> + expected_result_installed(unhashed_sub_app_id, + blink::mojom::SubAppsServiceResult::kSuccess); EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result_installed, command_result[0]); // No extra app is installed, old app is still installed. @@ -216,11 +212,10 @@ parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url()), /*dialog_not_accepted=*/true); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kUserInstallDeclined); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kFailure); - // Verify command works and returns a kUserInstallDeclined. + // Verify command works and returns a kFailure. EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result, command_result[0]); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id).size()); @@ -242,11 +237,10 @@ AppInstallResults command_result = InstallSubAppAndWait( parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url())); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - "http://abc.com/", - blink::mojom::SubAppsServiceAddResultCode::kExpectedAppIdCheckFailed); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + "http://abc.com/", blink::mojom::SubAppsServiceResult::kFailure); - // Verify command works and returns a kExpectedAppIdCheckFailed. + // Verify command works and returns a kFailure. EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result, command_result[0]); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id).size()); @@ -266,11 +260,10 @@ AppInstallResults command_result = InstallSubAppAndWait( parent_app_id, data, GetDataRetrieverWithInfoAndManifest(sub_app_url())); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kParentAppUninstalled); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kFailure); - // Verify command works and returns a kParentAppUninstalled. + // Verify command works and returns a kFailure. EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result, command_result[0]); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id).size()); @@ -294,11 +287,10 @@ /*dialog_not_accepted=*/false, /*url_load_result=*/WebAppUrlLoader::Result::kRedirectedUrlLoaded); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, - blink::mojom::SubAppsServiceAddResultCode::kInstallUrlInvalid); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kFailure); - // Verify command works and returns a kInstallUrlInvalid. + // Verify command works and returns a kFailure. EXPECT_EQ(1u, command_result.size()); EXPECT_EQ(expected_result, command_result[0]); EXPECT_EQ(0ul, GetAllSubAppIds(parent_app_id).size()); @@ -322,8 +314,8 @@ GetDataRetrieverWithInfoAndManifest( sub_app_url(), /*disable_web_app_info=*/true)); - std::pair<AppId, blink::mojom::SubAppsServiceAddResultCode> expected_result( - unhashed_sub_app_id, blink::mojom::SubAppsServiceAddResultCode::kFailure); + std::pair<AppId, blink::mojom::SubAppsServiceResult> expected_result( + unhashed_sub_app_id, blink::mojom::SubAppsServiceResult::kFailure); // Verify command works and returns a kFailure. EXPECT_EQ(1u, command_result.size());
diff --git a/chrome/browser/window_management/window_management_browsertest.cc b/chrome/browser/window_management/window_management_browsertest.cc index df61a41..06c0ddbfa 100644 --- a/chrome/browser/window_management/window_management_browsertest.cc +++ b/chrome/browser/window_management/window_management_browsertest.cc
@@ -39,10 +39,9 @@ public testing::WithParamInterface<PermissionTestParams> { public: WindowManagementTest() { - if (AliasEnabled()) { - scoped_feature_list_.InitWithFeatures( - {permissions::features::kWindowManagementPermissionAlias}, {}); - } + scoped_feature_list_.InitWithFeatureState( + permissions::features::kWindowManagementPermissionAlias, + AliasEnabled()); } void SetUpOnMainThread() override {
diff --git a/chrome/browser/window_management/window_management_permission_context_browsertest.cc b/chrome/browser/window_management/window_management_permission_context_browsertest.cc index 0d1e0c8..88693619 100644 --- a/chrome/browser/window_management/window_management_permission_context_browsertest.cc +++ b/chrome/browser/window_management/window_management_permission_context_browsertest.cc
@@ -63,10 +63,9 @@ public testing::WithParamInterface<PermissionContextTestParams> { public: WindowManagementPermissionContextTest() { - if (AliasEnabled()) { - scoped_feature_list_.InitWithFeatures( - {permissions::features::kWindowManagementPermissionAlias}, {}); - } + scoped_feature_list_.InitWithFeatureState( + permissions::features::kWindowManagementPermissionAlias, + AliasEnabled()); } void SetUpOnMainThread() override { // Support multiple sites on the test server.
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 7548c1cd..34618e53 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1674194329-a059a394219ec513de9f8af42adc791866daee1f.profdata +chrome-linux-main-1674258898-e51ce7a18af175124aee9060161cd22bfc53b401.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index a84ed1f..9633aae 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1674233356-7b13fffe00f4d39f73a9b72d126f8937ae951eab.profdata +chrome-mac-arm-main-1674258898-881341a5011b36d8ea3e48c45b6af4eafa34f766.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 1f28eb4..178b21b 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1674194329-abbee3af1f1074408f559b140f721ffee2a0ee3f.profdata +chrome-mac-main-1674258898-d14eb88f6b1eaa638cf4aa2b1cde339d61b2950f.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 4fdeb70..347441f 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1674215703-b47ae147e5aecff4246619a6038df2e6db7703c5.profdata +chrome-win32-main-1674233356-950956125d6b54eeb8a9d9a03917bb0b09e1a26a.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 34f5f9a..2f0461f 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1674226466-816dd1a964efd52ac94a94e0555829e670e8e857.profdata +chrome-win64-main-1674248070-d9e687ccca341b4bc57adadd2eef6c025409545d.profdata
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 37601fa..5000fc5 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -2505,10 +2505,14 @@ // A string pref holding the value of the current country for demo sessions. const char kDemoModeCountry[] = "demo_mode.country"; -// A string pref holding the value of the retailer id input for demo sessions. +// A string pref holding the value of the retailer name input for demo sessions. +// This is now mostly called "retailer_name" in code other than in this pref and +// in Omaha request attributes const char kDemoModeRetailerId[] = "demo_mode.retailer_id"; -// A string pref holding the value of the store id input for demo sessions. +// A string pref holding the value of the store number input for demo sessions. +// This is now mostly called "store_number" in code other than in this pref and +// in Omaha request attributes const char kDemoModeStoreId[] = "demo_mode.store_id"; // A string pref holding the value of the default locale for demo sessions.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 6df9daef..a098fad 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1387,6 +1387,7 @@ "//components/dom_distiller/content/browser:test_support", "//components/dom_distiller/content/renderer", "//components/dom_distiller/core:test_support", + "//components/domain_reliability:prefs", "//components/drive:test_support", "//components/embedder_support", "//components/embedder_support:browser_util",
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index b9bcf0e..b776ba6 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -21815,5 +21815,50 @@ } } ] + }, + "DomainReliabilityAllowed": { + "os": [ + "win", + "linux", + "mac", + "chromeos_ash", + "chromeos_lacros", + "android" + ], + "official_only": true, + "can_be_recommended": true, + "policy_pref_mapping_tests": [ + { + "policies": {}, + "prefs": { + "domain_reliability.allowed_by_policy": { + "location": "local_state", + "default_value": true + } + } + }, + { + "policies": { + "DomainReliabilityAllowed": true + }, + "prefs": { + "domain_reliability.allowed_by_policy": { + "location": "local_state", + "value": true + } + } + }, + { + "policies": { + "DomainReliabilityAllowed": false + }, + "prefs": { + "domain_reliability.allowed_by_policy": { + "location": "local_state", + "value": false + } + } + } + ] } }
diff --git a/chrome/test/data/webui/bookmarks/BUILD.gn b/chrome/test/data/webui/bookmarks/BUILD.gn index 731a3a8..4a0f615c 100644 --- a/chrome/test/data/webui/bookmarks/BUILD.gn +++ b/chrome/test/data/webui/bookmarks/BUILD.gn
@@ -12,12 +12,12 @@ "app_test.ts", "bookmarks_focus_test.js", "command_manager_test.js", - "dialog_focus_manager_test.js", + "dialog_focus_manager_test.ts", "dnd_manager_test.ts", "edit_dialog_test.ts", "extension_api_test.ts", "extension_api_test_edit_disabled.ts", - "folder_node_focus_test.js", + "folder_node_focus_test.ts", "folder_node_test.ts", "item_test.ts", "list_focus_test.js",
diff --git a/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js b/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js index f14b8796..d4d7830 100644 --- a/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js +++ b/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js
@@ -25,9 +25,7 @@ } }; -// http://crbug.com/1000950 : Flaky. -GEN('#define MAYBE_All DISABLED_All'); -TEST_F('BookmarksFolderNodeFocusTest', 'MAYBE_All', function() { +TEST_F('BookmarksFolderNodeFocusTest', 'All', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js b/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.ts similarity index 60% rename from chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js rename to chrome/test/data/webui/bookmarks/dialog_focus_manager_test.ts index 639196e..1ae2f707 100644 --- a/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.js +++ b/chrome/test/data/webui/bookmarks/dialog_focus_manager_test.ts
@@ -2,24 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {DialogFocusManager, MenuSource} from 'chrome://bookmarks/bookmarks.js'; +import {BookmarksCommandManagerElement, BookmarksItemElement, BookmarksListElement, DialogFocusManager, MenuSource} from 'chrome://bookmarks/bookmarks.js'; +import {getDeepActiveElement} from 'chrome://resources/js/util_ts.js'; import {keyDownOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise} from 'chrome://webui-test/test_util.js'; import {TestCommandManager} from './test_command_manager.js'; import {TestStore} from './test_store.js'; import {createFolder, createItem, getAllFoldersOpenState, replaceBody, testTree} from './test_util.js'; -suite('DialogFocusManager', function() { - let list; - let store; - let items; - let commandManager; - let dialogFocusManager; - function keydown(el, key) { - keyDownOn(el, '', '', key); +suite('DialogFocusManager', function() { + let list: BookmarksListElement; + let store: TestStore; + let items: NodeListOf<BookmarksItemElement>; + let commandManager: BookmarksCommandManagerElement; + let dialogFocusManager: DialogFocusManager; + + function keydown(el: HTMLElement, key: string) { + keyDownOn(el, 0, '', key); } setup(function() { @@ -45,7 +48,7 @@ list.style.position = 'absolute'; replaceBody(list); flush(); - items = list.root.querySelectorAll('bookmarks-item'); + items = list.shadowRoot!.querySelectorAll('bookmarks-item'); commandManager = new TestCommandManager().getCommandManager(); document.body.appendChild(commandManager); @@ -55,68 +58,66 @@ }); test('restores focus on dialog dismissal', async function() { - const focusedItem = items[0]; + const focusedItem = items[0]!; focusedItem.focus(); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM); - const dropdown = commandManager.$.dropdown.getIfExists(); + const dropdown = commandManager.$.dropdown.getIfExists()!; assertTrue(dropdown.open); - assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertNotEquals(focusedItem, getDeepActiveElement()); keydown(dropdown, 'Escape'); assertFalse(dropdown.open); - await Promise.all([ - eventToPromise('close', dropdown), - eventToPromise('focus', focusedItem), - ]); + await eventToPromise('close', dropdown); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); }); test('restores focus after stacked dialogs', async () => { - const focusedItem = items[0]; + const focusedItem = items[0]!; focusedItem.focus(); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM); const dropdown = commandManager.$.dropdown.getIfExists(); - dropdown.close(); - assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertTrue(!!dropdown); const editDialog = commandManager.$.editDialog.get(); - editDialog.showEditDialog(store.data.nodes['2']); + editDialog.showEditDialog(store.data.nodes['2']!); + dropdown.close(); + assertNotEquals(focusedItem, getDeepActiveElement()); await eventToPromise('close', dropdown); - editDialog.onCancelButtonTap_(); - assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + editDialog.$.dialog.cancel(); + assertNotEquals(focusedItem, getDeepActiveElement()); await eventToPromise('close', editDialog); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); }); test('restores focus after multiple shows of same dialog', async () => { - let focusedItem = items[0]; + let focusedItem = items[0]!; focusedItem.focus(); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM); - assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); - const dropdown = commandManager.$.dropdown.getIfExists(); + assertNotEquals(focusedItem, getDeepActiveElement()); + const dropdown = commandManager.$.dropdown.getIfExists()!; dropdown.close(); - focusedItem = items[3]; + focusedItem = items[3]!; focusedItem.focus(); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM); await eventToPromise('close', dropdown); assertTrue(dropdown.open); + assertNotEquals(focusedItem, getDeepActiveElement()); dropdown.close(); - assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); await eventToPromise('close', dropdown); - assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); + assertEquals(focusedItem, getDeepActiveElement()); }); });
diff --git a/chrome/test/data/webui/bookmarks/folder_node_focus_test.js b/chrome/test/data/webui/bookmarks/folder_node_focus_test.ts similarity index 84% rename from chrome/test/data/webui/bookmarks/folder_node_focus_test.js rename to chrome/test/data/webui/bookmarks/folder_node_focus_test.ts index 2201f93b..83402a3 100644 --- a/chrome/test/data/webui/bookmarks/folder_node_focus_test.js +++ b/chrome/test/data/webui/bookmarks/folder_node_focus_test.ts
@@ -2,36 +2,40 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {changeFolderOpen, Command, selectFolder} from 'chrome://bookmarks/bookmarks.js'; +import {BookmarkManagerApiProxyImpl, BookmarksFolderNodeElement, changeFolderOpen, Command, selectFolder, SelectFolderAction} from 'chrome://bookmarks/bookmarks.js'; import {getDeepActiveElement} from 'chrome://resources/js/util_ts.js'; import {keyDownOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assertDeepEquals, assertEquals, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {TestBookmarkManagerApiProxy} from './test_bookmark_manager_api_proxy.js'; import {TestCommandManager} from './test_command_manager.js'; import {TestStore} from './test_store.js'; import {createFolder, createItem, findFolderNode, getAllFoldersOpenState, replaceBody, testTree} from './test_util.js'; suite('<bookmarks-folder-node>', function() { - let rootNode; - let store; + let rootNode: BookmarksFolderNodeElement; + let store: TestStore; - function getFolderNode(id) { - return findFolderNode(rootNode, id); + function getFolderNode(id: string) { + return findFolderNode(rootNode, id) as BookmarksFolderNodeElement; } - function assertHasFocusAndNotSelected(id) { + function assertHasFocusAndNotSelected(id: string) { const node = getFolderNode(id); - const activeElement = node.shadowRoot.activeElement; + const activeElement = node.shadowRoot!.activeElement; assertTrue( activeElement != null && activeElement === getDeepActiveElement()); const badAction = selectFolder(id); + assertTrue(!!badAction); if (store.lastAction != null && badAction.name === store.lastAction.name) { - assertNotEquals(badAction.id, store.lastAction.id); + assertNotEquals( + badAction.id, (store.lastAction as SelectFolderAction).id); } } - function keydown(id, key) { - keyDownOn(getFolderNode(id).$.container, '', [], key); + function keydown(id: string, key: string) { + keyDownOn(getFolderNode(id).$.container, 0, [], key); } setup(function() { @@ -56,6 +60,9 @@ store.setReducersEnabled(true); store.replaceSingleton(); + const proxy = new TestBookmarkManagerApiProxy(); + BookmarkManagerApiProxyImpl.setInstance(proxy); + rootNode = document.createElement('bookmarks-folder-node'); rootNode.itemId = '0'; rootNode.depth = -1; @@ -64,14 +71,14 @@ }); test('keyboard selection', function() { - function assertFocused(oldFocus, newFocus) { + function assertFocused(oldFocus: string, newFocus: string) { assertEquals( '-1', getFolderNode(oldFocus).$.container.getAttribute('tabindex')); assertEquals( '0', getFolderNode(newFocus).$.container.getAttribute('tabindex')); assertEquals( getFolderNode(newFocus).$.container, - getFolderNode(newFocus).root.activeElement); + getFolderNode(newFocus).shadowRoot!.activeElement); } store.data.folderOpenState.set('2', false); @@ -181,12 +188,12 @@ keydown('2', 'ArrowLeft'); assertDeepEquals(changeFolderOpen('2', false), store.lastAction); - // RTL flips left and right. + // RTL does not flip left and right. document.body.style.direction = 'rtl'; - keydown('2', 'ArrowLeft'); + keydown('2', 'ArrowRight'); assertDeepEquals(changeFolderOpen('2', true), store.lastAction); - keydown('2', 'ArrowRight'); + keydown('2', 'ArrowLeft'); assertDeepEquals(changeFolderOpen('2', false), store.lastAction); document.body.style.direction = 'ltr'; @@ -195,7 +202,6 @@ test('keyboard commands are passed to command manager', function() { const testCommandManager = new TestCommandManager(); document.body.appendChild(testCommandManager.getCommandManager()); - chrome.bookmarkManagerPrivate.removeTrees = function() {}; store.data.selection.items = new Set(['3', '4']); store.data.selectedFolder = '2';
diff --git a/chrome/test/data/webui/chromeos/personalization_app/personalization_app_controller_test.ts b/chrome/test/data/webui/chromeos/personalization_app/personalization_app_controller_test.ts index 14dc0cc15..e0e357c 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/personalization_app_controller_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/personalization_app_controller_test.ts
@@ -5,7 +5,7 @@ import 'chrome://personalization/strings.m.js'; import 'chrome://webui-test/mojo_webui_test_support.js'; -import {cancelPreviewWallpaper, DefaultImageSymbol, DisplayableImage, fetchCollections, fetchGooglePhotosAlbum, fetchGooglePhotosAlbums, fetchLocalData, getDefaultImageThumbnail, GooglePhotosAlbum, GooglePhotosEnablementState, GooglePhotosPhoto, initializeBackdropData, initializeGooglePhotosData, isDefaultImage, isFilePath, isGooglePhotosPhoto, isWallpaperImage, kDefaultImageSymbol, selectGooglePhotosAlbum, selectWallpaper, WallpaperType} from 'chrome://personalization/js/personalization_app.js'; +import {cancelPreviewWallpaper, DailyRefreshType, DefaultImageSymbol, DisplayableImage, fetchCollections, fetchGooglePhotosAlbum, fetchGooglePhotosAlbums, fetchLocalData, getDefaultImageThumbnail, GooglePhotosAlbum, GooglePhotosEnablementState, GooglePhotosPhoto, initializeBackdropData, initializeGooglePhotosData, isDefaultImage, isFilePath, isGooglePhotosPhoto, isWallpaperImage, kDefaultImageSymbol, selectGooglePhotosAlbum, selectWallpaper, updateDailyRefreshWallpaper, WallpaperType} from 'chrome://personalization/js/personalization_app.js'; import {assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; import {FilePath} from 'chrome://resources/mojo/mojo/public/mojom/base/file_path.mojom-webui.js'; @@ -551,6 +551,73 @@ .data[kDefaultImageSymbol], 'default image is not loading'); }); + + test('fails to enable Google Photos daily refresh', async () => { + wallpaperProvider.selectGooglePhotosAlbumResponse = { + success: false, + forceRefresh: true, + }; + + wallpaperProvider.albumId = 'albumId'; + wallpaperProvider.collectionId = ''; + + const selectGooglePhotosAlbumPromise = selectGooglePhotosAlbum( + 'albumId', wallpaperProvider, personalizationStore); + + await Promise.all([ + wallpaperProvider.getDailyRefreshCollectionId(), + wallpaperProvider.getGooglePhotosDailyRefreshAlbumId(), + ]); + + await selectGooglePhotosAlbumPromise; + + assertDeepEquals( + [ + // Set error action when daily refresh failed. + { + name: 'set_error', + error: {message: loadTimeData.getString('googlePhotosError')}, + }, + // Set daily refresh enabled for the selected Google Photos album. + { + name: 'set_google_photos_daily_refresh_album_id', + albumId: 'albumId', + }, + ], + personalizationStore.actions); + }); + + test( + 'fails to refresh a new wallpaper in a Google Photos album', async () => { + personalizationStore.data.wallpaper.dailyRefresh = { + id: 'abumId', + type: DailyRefreshType.GOOGLE_PHOTOS, + }; + wallpaperProvider.updateDailyRefreshWallpaperResponse = false; + await updateDailyRefreshWallpaper( + wallpaperProvider, personalizationStore); + assertDeepEquals( + [ + { + name: 'begin_update_daily_refresh_image', + }, + { + name: 'begin_load_selected_image', + }, + { + name: 'set_updated_daily_refreshed_image', + }, + { + name: 'set_selected_image', + image: personalizationStore.data.wallpaper.currentSelected, + }, + { + name: 'set_error', + error: {message: loadTimeData.getString('googlePhotosError')}, + }, + ], + personalizationStore.actions); + }); }); suite('full screen mode', () => {
diff --git a/chrome/test/data/webui/chromeos/personalization_app/test_wallpaper_interface_provider.ts b/chrome/test/data/webui/chromeos/personalization_app/test_wallpaper_interface_provider.ts index 33c52f0..7f3e5e8 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/test_wallpaper_interface_provider.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/test_wallpaper_interface_provider.ts
@@ -105,6 +105,10 @@ key: '1', type: WallpaperType.kOnline, }; + + this.albumId = ''; + + this.collectionId = this.collections_![0]!.id; } private collections_: WallpaperCollection[]|null; @@ -126,6 +130,8 @@ defaultImageThumbnail: Url = {url: 'data:image/png;base64,default_image_thumbnail'}; currentWallpaper: CurrentWallpaper; + albumId: string; + collectionId: string; selectWallpaperResponse = true; selectGooglePhotosPhotoResponse = true; selectGooglePhotosAlbumResponse: SetDailyRefreshResponse = { @@ -257,7 +263,7 @@ getGooglePhotosDailyRefreshAlbumId() { this.methodCalled('getGooglePhotosDailyRefreshAlbumId'); - return Promise.resolve({albumId: ''}); + return Promise.resolve({albumId: this.albumId}); } selectLocalImage( @@ -280,7 +286,7 @@ getDailyRefreshCollectionId() { this.methodCalled('getDailyRefreshCollectionId'); - return Promise.resolve({collectionId: this.collections_![0]!.id}); + return Promise.resolve({collectionId: this.collectionId}); } updateDailyRefreshWallpaper() {
diff --git a/chrome/test/data/webui/chromeos/shortcut_customization/accelerator_lookup_manager_test.ts b/chrome/test/data/webui/chromeos/shortcut_customization/accelerator_lookup_manager_test.ts index 66f63c61..470fa28 100644 --- a/chrome/test/data/webui/chromeos/shortcut_customization/accelerator_lookup_manager_test.ts +++ b/chrome/test/data/webui/chromeos/shortcut_customization/accelerator_lookup_manager_test.ts
@@ -93,6 +93,12 @@ 1, getManager().getSubcategories( AcceleratorCategory.kPageAndWebBrowser)!.size); + + // We expect 1 subcategory for kEventRewriter: kSixPackKeys. + assertEquals( + 1, + getManager().getSubcategories( + AcceleratorCategory.kEventRewriter)!.size); }); });
diff --git a/chrome/test/data/webui/new_tab_page/app_test.ts b/chrome/test/data/webui/new_tab_page/app_test.ts index 993dc17d..b728a5b 100644 --- a/chrome/test/data/webui/new_tab_page/app_test.ts +++ b/chrome/test/data/webui/new_tab_page/app_test.ts
@@ -5,7 +5,7 @@ import 'chrome://webui-test/mojo_webui_test_support.js'; import {counterfactualLoad, LensUploadDialogElement, Module, ModuleDescriptor, ModuleRegistry} from 'chrome://new-tab-page/lazy_load.js'; -import {$$, AppElement, BackgroundManager, BrowserCommandProxy, CustomizeDialogPage, NewTabPageProxy, NtpElement, VoiceAction, WindowProxy} from 'chrome://new-tab-page/new_tab_page.js'; +import {$$, AppElement, BackgroundManager, BrowserCommandProxy, CustomizeDialogPage, NewTabPageProxy, NtpCustomizeChromeEntryPoint, NtpElement, VoiceAction, WindowProxy} from 'chrome://new-tab-page/new_tab_page.js'; import {PageCallbackRouter, PageHandlerRemote, PageRemote} from 'chrome://new-tab-page/new_tab_page.mojom-webui.js'; import {Command, CommandHandlerRemote} from 'chrome://resources/js/browser_command/browser_command.mojom-webui.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.js'; @@ -647,16 +647,31 @@ // Assert. assertTrue(handler.getArgs('setCustomizeChromeSidePanelVisible')[0]); + assertEquals( + 1, + metrics.count( + 'NewTabPage.CustomizeChromeOpened', + NtpCustomizeChromeEntryPoint.CUSTOMIZE_BUTTON)); }); test('clicking customize button hides side panel', async () => { // Act. callbackRouterRemote.setCustomizeChromeSidePanelVisibility(true); + assertEquals( + 0, + metrics.count( + 'NewTabPage.CustomizeChromeOpened', + NtpCustomizeChromeEntryPoint.CUSTOMIZE_BUTTON)); await callbackRouterRemote.$.flushForTesting(); $$<HTMLElement>(app, '#customizeButton')!.click(); // Assert. assertFalse(handler.getArgs('setCustomizeChromeSidePanelVisible')[0]); + assertEquals( + 0, + metrics.count( + 'NewTabPage.CustomizeChromeOpened', + NtpCustomizeChromeEntryPoint.CUSTOMIZE_BUTTON)); }); suite('modules', () => { @@ -672,6 +687,11 @@ // Assert. assertTrue(handler.getArgs('setCustomizeChromeSidePanelVisible')[0]); + assertEquals( + 1, + metrics.count( + 'NewTabPage.CustomizeChromeOpened', + NtpCustomizeChromeEntryPoint.MODULE)); }); }); @@ -685,6 +705,11 @@ test('URL opens side panel', () => { // Assert. assertTrue(handler.getArgs('setCustomizeChromeSidePanelVisible')[0]); + assertEquals( + 1, + metrics.count( + 'NewTabPage.CustomizeChromeOpened', + NtpCustomizeChromeEntryPoint.URL)); }); }); });
diff --git a/chrome/test/data/webui/settings/chromeos/device_page_tests.js b/chrome/test/data/webui/settings/chromeos/device_page_tests.js index 1fab4b66..f476599 100644 --- a/chrome/test/data/webui/settings/chromeos/device_page_tests.js +++ b/chrome/test/data/webui/settings/chromeos/device_page_tests.js
@@ -997,6 +997,8 @@ test('simulate setting output volume slider mojo test', async function() { const sliderSelector = '#outputVolumeSlider'; const outputSlider = audioPage.shadowRoot.querySelector(sliderSelector); + const outputMuteButton = + audioPage.shadowRoot.querySelector('#audioOutputMuteButton'); // Test clicking to min volume case. const minOutputVolumePercent = 0; @@ -1005,6 +1007,7 @@ minOutputVolumePercent, audioPage.audioSystemProperties_.outputVolumePercent, ); + assertEquals('settings20:volume-zero', outputMuteButton.ironIcon); // Test clicking to max volume case. const maxOutputVolumePercent = 100; @@ -1013,14 +1016,17 @@ maxOutputVolumePercent, audioPage.audioSystemProperties_.outputVolumePercent, ); + assertEquals('settings20:volume-up', outputMuteButton.ironIcon); // Test clicking to non-boundary volume case. const nonBoundaryOutputVolumePercent = 50; - await simulateSliderClicked(sliderSelector, 50); + await simulateSliderClicked( + sliderSelector, nonBoundaryOutputVolumePercent); assertEquals( nonBoundaryOutputVolumePercent, audioPage.audioSystemProperties_.outputVolumePercent, ); + assertEquals('settings20:volume-up', outputMuteButton.ironIcon); // Ensure value clamps to min. outputSlider.value = -1; @@ -1030,8 +1036,9 @@ assertEquals( minOutputVolumePercent, audioPage.audioSystemProperties_.outputVolumePercent); + assertEquals('settings20:volume-zero', outputMuteButton.ironIcon); - // Ensure value clamps to min. + // Ensure value clamps to max. outputSlider.value = 101; outputSlider.dispatchEvent(new CustomEvent('cr-slider-value-changed')); await flushTasks(); @@ -1039,6 +1046,16 @@ assertEquals( maxOutputVolumePercent, audioPage.audioSystemProperties_.outputVolumePercent); + assertEquals('settings20:volume-up', outputMuteButton.ironIcon); + + // Test clicking to a small icon volume case. + const smallIconOutputVolumePercent = 10; + await simulateSliderClicked(sliderSelector, smallIconOutputVolumePercent); + assertEquals( + smallIconOutputVolumePercent, + audioPage.audioSystemProperties_.outputVolumePercent, + ); + assertEquals('settings20:volume-down', outputMuteButton.ironIcon); }); test('output mute state changes slider disabled state', async function() { @@ -1185,6 +1202,7 @@ crosAudioConfigMojomWebui.MuteState.kMutedByUser, audioPage.audioSystemProperties_.outputMuteState); assertTrue(audioPage.isOutputMuted_); + assertEquals('settings20:volume-up-off', outputMuteButton.ironIcon); outputMuteButton.click(); await flushTasks();
diff --git a/chrome/updater/app/server/win/BUILD.gn b/chrome/updater/app/server/win/BUILD.gn index 0f91f6a..fa0b027 100644 --- a/chrome/updater/app/server/win/BUILD.gn +++ b/chrome/updater/app/server/win/BUILD.gn
@@ -83,6 +83,7 @@ "PLACEHOLDER-GUID-7A1FDE1F-AAA9-441B-B9AA-95B31D78592B=69464FF0-D9EC-4037-A35F-8AE4358106CC", # UpdaterLegacyLib "PLACEHOLDER-GUID-A0FEB7CB-E0D8-4035-A4C9-5620A8C725AD=22181302-A8A6-4F84-A541-E5CBFC70CC43", # GoogleUpdate3WebUserClass "PLACEHOLDER-GUID-FAC5C548-84EC-474C-A4B3-CD414E09B14C=8A1D4361-2C08-4700-A351-3EAA9CBFF5E4", # GoogleUpdate3WebSystemClass + "PLACEHOLDER-GUID-687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2=534F5323-3569-4F42-919D-1E1CF93E5BF6", # GoogleUpdate3WebServiceClass "PLACEHOLDER-GUID-E432DCFE-6A32-4C07-B038-9D74AC80D6AB=6DDCE70D-A4AE-4E97-908C-BE7B2DB750AD", # PolicyStatusUserClass "PLACEHOLDER-GUID-F675D224-BD54-40E9-AECB-AA3B64EB9863=521FDB42-7130-4806-822A-FC5163FAD983", # PolicyStatusSystemClass "PLACEHOLDER-GUID-CEC2877D-4856-460E-BE73-11DD7CC7C821=ABC01078-F197-4B0B-ADBC-CFE684B39C82", # ProcessLauncherClass @@ -103,6 +104,7 @@ "PLACEHOLDER-GUID-7A1FDE1F-AAA9-441B-B9AA-95B31D78592B=4C61BB05-94D1-4BAB-B69C-C34195AF92CA", # UpdaterLegacyLib "PLACEHOLDER-GUID-A0FEB7CB-E0D8-4035-A4C9-5620A8C725AD=75828ED1-7BE8-45D0-8950-AA85CBF74510", # GoogleUpdate3WebUserClass "PLACEHOLDER-GUID-FAC5C548-84EC-474C-A4B3-CD414E09B14C=283209B7-C761-41CA-BE8D-B5321CD78FD6", # GoogleUpdate3WebSystemClass + "PLACEHOLDER-GUID-687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2=B52C8B56-9541-4B78-9B2F-665366B78A9C", # GoogleUpdate3WebServiceClass "PLACEHOLDER-GUID-E432DCFE-6A32-4C07-B038-9D74AC80D6AB=4DAC24AB-B340-4B7E-AD01-1504A7F59EEA", # PolicyStatusUserClass "PLACEHOLDER-GUID-F675D224-BD54-40E9-AECB-AA3B64EB9863=83FE19AC-72A6-4A72-B136-724444121586", # PolicyStatusSystemClass "PLACEHOLDER-GUID-CEC2877D-4856-460E-BE73-11DD7CC7C821=811A664F-703E-407C-A323-E6E31D1EFFA0", # ProcessLauncherClass
diff --git a/chrome/updater/app/server/win/com_classes_legacy_unittest.cc b/chrome/updater/app/server/win/com_classes_legacy_unittest.cc index ff173e59..d24443e 100644 --- a/chrome/updater/app/server/win/com_classes_legacy_unittest.cc +++ b/chrome/updater/app/server/win/com_classes_legacy_unittest.cc
@@ -251,6 +251,8 @@ L"{22181302-A8A6-4F84-A541-E5CBFC70CC43}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(GoogleUpdate3WebSystemClass)), L"{8A1D4361-2C08-4700-A351-3EAA9CBFF5E4}"); + EXPECT_EQ(base::win::WStringFromGUID(__uuidof(GoogleUpdate3WebServiceClass)), + L"{534F5323-3569-4F42-919D-1E1CF93E5BF6}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(PolicyStatusUserClass)), L"{6DDCE70D-A4AE-4E97-908C-BE7B2DB750AD}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(PolicyStatusSystemClass)), @@ -284,6 +286,8 @@ L"{75828ED1-7BE8-45D0-8950-AA85CBF74510}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(GoogleUpdate3WebSystemClass)), L"{283209B7-C761-41CA-BE8D-B5321CD78FD6}"); + EXPECT_EQ(base::win::WStringFromGUID(__uuidof(GoogleUpdate3WebServiceClass)), + L"{B52C8B56-9541-4B78-9B2F-665366B78A9C}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(PolicyStatusUserClass)), L"{4DAC24AB-B340-4B7E-AD01-1504A7F59EEA}"); EXPECT_EQ(base::win::WStringFromGUID(__uuidof(PolicyStatusSystemClass)),
diff --git a/chrome/updater/app/server/win/updater_legacy_idl.template b/chrome/updater/app/server/win/updater_legacy_idl.template index 97cc6a5..a243190 100644 --- a/chrome/updater/app/server/win/updater_legacy_idl.template +++ b/chrome/updater/app/server/win/updater_legacy_idl.template
@@ -528,6 +528,14 @@ } [ + uuid(PLACEHOLDER-GUID-687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2), + helpstring("GoogleUpdate3WebServiceClass (do not use, for backward compat)") + ] + coclass GoogleUpdate3WebServiceClass { + [default] interface IUnknown; + } + + [ uuid(PLACEHOLDER-GUID-E432DCFE-6A32-4C07-B038-9D74AC80D6AB), helpstring("Policy Status for per-user applications.") ]
diff --git a/chrome/updater/app/server/win/wrl_classes.cc b/chrome/updater/app/server/win/wrl_classes.cc index 5024f12c..d099f22 100644 --- a/chrome/updater/app/server/win/wrl_classes.cc +++ b/chrome/updater/app/server/win/wrl_classes.cc
@@ -37,6 +37,10 @@ Microsoft::WRL::SimpleClassFactory<LegacyOnDemandImpl>, ActiveSystem); CoCreatableClassWithFactoryEx( + GoogleUpdate3WebServiceClass, + Microsoft::WRL::SimpleClassFactory<LegacyOnDemandImpl>, + ActiveSystem); +CoCreatableClassWithFactoryEx( ProcessLauncherClass, Microsoft::WRL::SimpleClassFactory<LegacyProcessLauncherImpl>, ActiveSystem);
diff --git a/chrome/updater/test/integration_tests_win.cc b/chrome/updater/test/integration_tests_win.cc index 0242ed56..3923932 100644 --- a/chrome/updater/test/integration_tests_win.cc +++ b/chrome/updater/test/integration_tests_win.cc
@@ -803,17 +803,23 @@ : __uuidof(IUpdaterUser), IID_PPV_ARGS_Helper(&updater))); - Microsoft::WRL::ComPtr<IUnknown> updater_legacy_server; - ASSERT_HRESULT_SUCCEEDED(CreateLocalServer( - IsSystemInstall(scope) ? __uuidof(GoogleUpdate3WebSystemClass) - : __uuidof(GoogleUpdate3WebUserClass), - updater_legacy_server)); - Microsoft::WRL::ComPtr<IGoogleUpdate3Web> google_update; - ASSERT_HRESULT_SUCCEEDED(updater_legacy_server.As(&google_update)); - Microsoft::WRL::ComPtr<IAppBundleWeb> app_bundle; - Microsoft::WRL::ComPtr<IDispatch> dispatch; - ASSERT_HRESULT_SUCCEEDED(google_update->createAppBundleWeb(&dispatch)); - EXPECT_HRESULT_SUCCEEDED(dispatch.As(&app_bundle)); + for (const CLSID& clsid : [&scope]() -> std::vector<CLSID> { + if (IsSystemInstall(scope)) { + return {__uuidof(GoogleUpdate3WebSystemClass), + __uuidof(GoogleUpdate3WebServiceClass)}; + } else { + return {__uuidof(GoogleUpdate3WebUserClass)}; + } + }()) { + Microsoft::WRL::ComPtr<IUnknown> updater_legacy_server; + ASSERT_HRESULT_SUCCEEDED(CreateLocalServer(clsid, updater_legacy_server)); + Microsoft::WRL::ComPtr<IGoogleUpdate3Web> google_update; + ASSERT_HRESULT_SUCCEEDED(updater_legacy_server.As(&google_update)); + Microsoft::WRL::ComPtr<IAppBundleWeb> app_bundle; + Microsoft::WRL::ComPtr<IDispatch> dispatch; + ASSERT_HRESULT_SUCCEEDED(google_update->createAppBundleWeb(&dispatch)); + EXPECT_HRESULT_SUCCEEDED(dispatch.As(&app_bundle)); + } } {
diff --git a/chrome/updater/win/setup/setup_util.cc b/chrome/updater/win/setup/setup_util.cc index 3f6d4c2..1835d2a 100644 --- a/chrome/updater/win/setup/setup_util.cc +++ b/chrome/updater/win/setup/setup_util.cc
@@ -193,6 +193,7 @@ return { __uuidof(UpdaterSystemClass), __uuidof(GoogleUpdate3WebSystemClass), + __uuidof(GoogleUpdate3WebServiceClass), __uuidof(PolicyStatusSystemClass), __uuidof(ProcessLauncherClass), };
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 91fb22c5..f14585f 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -3716,9 +3716,11 @@ <message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_ACCESSIBILITY" desc="Category named 'Accessibility' shown on the navigation sidebar" translateable="false">Accessibility</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_DEBUG" desc="Category named 'Debug' shown on the navigation sidebar" translateable="false">Debug</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_DEVELOPER" desc="Category named 'Developer' shown on the navigation sidebar" translateable="false">Developer</message> + <message name="IDS_SHORTCUT_CUSTOMIZATION_CATEGORY_EVENT_REWRITER" desc="Category named 'Special Keys' shown on the navigation sidebar" translateable="false">Special Keys</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_GENERAL" desc="Subcategory named 'General' shown within main shortcuts section" translateable="false">General</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SYSTEM_APPS" desc="Subcategory named 'System Apps' shown within main shortcuts section" translateable="false">System Apps</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SYSTEM_CONTROLS" desc="Subcategory named 'System Controls' shown within main shortcuts section" translateable="false">System Controls</message> + <message name="IDS_SHORTCUT_CUSTOMIZATION_SUBCATEGORY_SIX_PACK" desc="Subcategory named 'Six Pack' shown within main shortcuts section" translateable="false">Six Pack</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_KEY_SPACE" desc="Lowercase name of the keyboard key 'Space'" translateable="false">space</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_KEY_TAB" desc="Lowercase name of the keyboard key 'Tab'" translateable="false">tab</message> <message name="IDS_SHORTCUT_CUSTOMIZATION_KEY_ESCAPE" desc="Lowercase name of the keyboard key 'Escape', abbreviated if possible" translateable="false">esc</message>
diff --git a/components/BUILD.gn b/components/BUILD.gn index 1dab6ed..8fd128b 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -377,6 +377,7 @@ "//components/media_router/browser:unit_tests", "//components/media_router/common:unit_tests", "//components/media_router/common/providers/cast/channel:unit_tests", + "//components/mirroring:mirroring_tests", "//components/navigation_interception:unit_tests", "//components/network_hints/renderer:unit_tests", "//components/no_state_prefetch/browser:unit_tests",
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn index 35262681..cd4e271 100644 --- a/components/autofill/core/browser/BUILD.gn +++ b/components/autofill/core/browser/BUILD.gn
@@ -690,8 +690,6 @@ "test_autofill_client.h", "test_autofill_clock.cc", "test_autofill_clock.h", - "test_autofill_download_manager.cc", - "test_autofill_download_manager.h", "test_autofill_driver.cc", "test_autofill_driver.h", "test_autofill_external_delegate.cc",
diff --git a/components/autofill/core/browser/autofill_download_manager.cc b/components/autofill/core/browser/autofill_download_manager.cc index 1c6fc2c..99acefa 100644 --- a/components/autofill/core/browser/autofill_download_manager.cc +++ b/components/autofill/core/browser/autofill_download_manager.cc
@@ -571,8 +571,10 @@ } // namespace struct AutofillDownloadManager::FormRequestData { + base::WeakPtr<Observer> observer; std::vector<FormSignature> form_signatures; RequestType request_type; + absl::optional<net::IsolationInfo> isolation_info; std::string payload; int num_attempts = 0; }; @@ -590,30 +592,20 @@ AutofillDownloadManager::AutofillDownloadManager( AutofillClient* client, - AutofillDriver* driver, - Observer* observer, const std::string& api_key, IsRawMetadataUploadingEnabled is_raw_metadata_uploading_enabled, LogManager* log_manager) : client_(client), - driver_(driver), - observer_(observer), api_key_(api_key), log_manager_(log_manager), autofill_server_url_(GetAutofillServerURL()), throttle_reset_period_(GetThrottleResetPeriod()), max_form_cache_size_(kAutofillDownloadManagerMaxFormCacheSize), loader_backoff_(&kAutofillBackoffPolicy), - is_raw_metadata_uploading_enabled_(is_raw_metadata_uploading_enabled) { - DCHECK(observer_); -} + is_raw_metadata_uploading_enabled_(is_raw_metadata_uploading_enabled) {} -AutofillDownloadManager::AutofillDownloadManager(AutofillClient* client, - AutofillDriver* driver, - Observer* observer) +AutofillDownloadManager::AutofillDownloadManager(AutofillClient* client) : AutofillDownloadManager(client, - driver, - observer, kDefaultAPIKey, IsRawMetadataUploadingEnabled(false), /*log_manager=*/nullptr) {} @@ -621,7 +613,9 @@ AutofillDownloadManager::~AutofillDownloadManager() = default; bool AutofillDownloadManager::StartQueryRequest( - const std::vector<FormStructure*>& forms) { + const std::vector<FormStructure*>& forms, + net::IsolationInfo isolation_info, + base::WeakPtr<Observer> observer) { if (!IsEnabled()) return false; @@ -656,10 +650,13 @@ return false; } - FormRequestData request_data; - request_data.form_signatures = std::move(queried_form_signatures); - request_data.request_type = AutofillDownloadManager::REQUEST_QUERY; - request_data.payload = std::move(payload); + FormRequestData request_data = { + .observer = observer, + .form_signatures = std::move(queried_form_signatures), + .request_type = AutofillDownloadManager::REQUEST_QUERY, + .isolation_info = std::move(isolation_info), + .payload = std::move(payload), + }; AutofillMetrics::LogServerQueryMetric(AutofillMetrics::QUERY_SENT); std::string query_data; @@ -673,8 +670,10 @@ } return form_sigs; }(); - observer_->OnLoadedServerPredictions(std::move(query_data), - request_data.form_signatures); + if (request_data.observer) { + request_data.observer->OnLoadedServerPredictions( + std::move(query_data), request_data.form_signatures); + } return true; } @@ -689,7 +688,8 @@ const ServerFieldTypeSet& available_field_types, const std::string& login_form_signature, bool observed_submission, - PrefService* prefs) { + PrefService* prefs, + base::WeakPtr<Observer> observer) { if (!IsEnabled()) return false; @@ -733,10 +733,13 @@ return false; } - FormRequestData request_data; - request_data.form_signatures = {form.form_signature()}; - request_data.request_type = AutofillDownloadManager::REQUEST_UPLOAD; - request_data.payload = std::move(payload); + FormRequestData request_data = { + .observer = observer, + .form_signatures = {form.form_signature()}, + .request_type = AutofillDownloadManager::REQUEST_UPLOAD, + .isolation_info = absl::nullopt, + .payload = std::move(payload), + }; DVLOG(1) << "Sending Autofill Upload Request:\n" << upload; LOG_AF(log_manager_) << LoggingScope::kAutofillServer @@ -802,6 +805,16 @@ } bool AutofillDownloadManager::StartRequest(FormRequestData request_data) { + // REQUEST_UPLOADs take no IsolationInfo because Password Manager uploads when + // RenderFrameHostImpl::DidCommitNavigation() is called, in which case + // AutofillDriver::IsolationInfo() may crash because there is no committing + // NavigationRequest. Not setting an IsolationInfo is safe because no + // information about the response is passed to the renderer, or is otherwise + // visible to a page. See crbug/1176635#c22. + DCHECK( + (request_data.request_type == AutofillDownloadManager::REQUEST_UPLOAD) == + !request_data.isolation_info); + // Get the URL and method to use for this request. auto [request_url, method] = GetRequestURLAndMethod(request_data); @@ -822,16 +835,11 @@ // As it is shared, it is not trusted and we cannot assign trusted_params // to the network request. #if !BUILDFLAG(IS_IOS) - // Do not call IsolationInfo() for REQUEST_UPLOADs because Password Manager - // uploads when RenderFrameHostImpl::DidCommitNavigation() is called, in which - // case IsolationInfo() may crash because there is no committing - // NavigationRequest. This is safe because no information about the response - // is passed to the renderer, or is otherwise visible to a page. - // crbug/1176635#c22 - if (request_data.request_type != AutofillDownloadManager::REQUEST_UPLOAD) { + if (request_data.isolation_info) { resource_request->trusted_params = network::ResourceRequest::TrustedParams(); - resource_request->trusted_params->isolation_info = driver_->IsolationInfo(); + resource_request->trusted_params->isolation_info = + *request_data.isolation_info; } #endif @@ -967,8 +975,11 @@ << response_code << " and error message from the server " << error_message; - observer_->OnServerRequestError(request_data.form_signatures.front(), - request_data.request_type, response_code); + if (request_data.observer) { + request_data.observer->OnServerRequestError( + request_data.form_signatures.front(), request_data.request_type, + response_code); + } LogFailingPayloadSize(request_data.request_type, request_data.payload.length()); @@ -999,15 +1010,19 @@ CacheQueryRequest(request_data.form_signatures, *response_body); UMA_HISTOGRAM_BOOLEAN("Autofill.Query.WasInCache", simple_loader->LoadedFromCache()); - observer_->OnLoadedServerPredictions(std::move(*response_body), - request_data.form_signatures); + if (request_data.observer) { + request_data.observer->OnLoadedServerPredictions( + std::move(*response_body), request_data.form_signatures); + } return; } DCHECK_EQ(request_data.request_type, AutofillDownloadManager::REQUEST_UPLOAD); DVLOG(1) << "AutofillDownloadManager: upload request has succeeded."; - observer_->OnUploadedPossibleFieldTypes(); + if (request_data.observer) { + request_data.observer->OnUploadedPossibleFieldTypes(); + } } void AutofillDownloadManager::InitActiveExperiments() {
diff --git a/components/autofill/core/browser/autofill_download_manager.h b/components/autofill/core/browser/autofill_download_manager.h index 7667b46..7eeeac5 100644 --- a/components/autofill/core/browser/autofill_download_manager.h +++ b/components/autofill/core/browser/autofill_download_manager.h
@@ -25,7 +25,9 @@ #include "components/autofill/core/browser/form_structure.h" #include "components/autofill/core/common/signatures.h" #include "components/variations/variations_ids_provider.h" +#include "components/version_info/channel.h" #include "net/base/backoff_entry.h" +#include "net/base/isolation_info.h" #include "services/network/public/cpp/simple_url_loader.h" #include "url/gurl.h" @@ -34,10 +36,9 @@ namespace autofill { class AutofillClient; -class AutofillDriver; class LogManager; -const size_t kMaxQueryGetSize = 10240; // 10 KiB +constexpr size_t kMaxQueryGetSize = 10240; // 10 KiB // A helper to make sure that tests which modify the set of active autofill // experiments do not interfere with one another. @@ -70,6 +71,7 @@ // Called when heuristic either successfully considered for upload and // not send or uploaded. virtual void OnUploadedPossibleFieldTypes() {} + // Called when there was an error during the request. // |form_signature| - the signature of the requesting form. // |request_type| - type of request that failed. @@ -79,7 +81,7 @@ int http_error) {} protected: - virtual ~Observer() {} + virtual ~Observer() = default; }; // |driver| must outlive this instance. @@ -88,23 +90,21 @@ // effect if using API. AutofillDownloadManager( AutofillClient* client, - AutofillDriver* driver, - Observer* observer, const std::string& api_key, IsRawMetadataUploadingEnabled is_raw_metadata_uploading_enabled, LogManager* log_manager); // |driver| must outlive this instance. // |observer| - observer to notify on successful completion or error. // Uses an API callback function that gives an empty string. - AutofillDownloadManager(AutofillClient* client, - AutofillDriver* driver, - Observer* observer); + explicit AutofillDownloadManager(AutofillClient* client); virtual ~AutofillDownloadManager(); // Starts a query request to Autofill servers. The observer is called with the // list of the fields of all requested forms. // |forms| - array of forms aggregated in this request. - virtual bool StartQueryRequest(const std::vector<FormStructure*>& forms); + virtual bool StartQueryRequest(const std::vector<FormStructure*>& forms, + net::IsolationInfo isolation_info, + base::WeakPtr<Observer> observer); // Starts an upload request for the given |form|. // |available_field_types| should contain the types for which we have data @@ -123,7 +123,8 @@ const ServerFieldTypeSet& available_field_types, const std::string& login_form_signature, bool observed_submission, - PrefService* pref_service); + PrefService* pref_service, + base::WeakPtr<Observer> observer); // Returns true if the autofill server communication is enabled. bool IsEnabled() const { return autofill_server_url_.is_valid(); } @@ -201,14 +202,6 @@ // outlive this instance. const raw_ptr<AutofillClient> client_; - // The AutofillDriver that this instance will use. Must not be null, and must - // outlive this instance. - const raw_ptr<AutofillDriver> driver_; // WEAK - - // The observer to notify when server predictions are successfully received. - // Must not be null. - const raw_ptr<AutofillDownloadManager::Observer> observer_; // WEAK - // Callback function to retrieve API key. const std::string api_key_;
diff --git a/components/autofill/core/browser/autofill_download_manager_unittest.cc b/components/autofill/core/browser/autofill_download_manager_unittest.cc index cd7d257e..7784b62 100644 --- a/components/autofill/core/browser/autofill_download_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_download_manager_unittest.cc
@@ -157,14 +157,10 @@ : public AutofillDownloadManager { public: AutofillDownloadManagerWithCustomPayloadSize(AutofillClient* client, - AutofillDriver* driver, - Observer* observer, const std::string& api_key, size_t length) : AutofillDownloadManager( client, - driver, - observer, api_key, AutofillDownloadManager::IsRawMetadataUploadingEnabled(false), /*log_manager=*/nullptr), @@ -193,19 +189,58 @@ class AutofillDownloadManagerTest : public AutofillDownloadManager::Observer, public ::testing::Test { public: + enum ResponseType { + QUERY_SUCCESSFULL, + UPLOAD_SUCCESSFULL, + REQUEST_QUERY_FAILED, + REQUEST_UPLOAD_FAILED, + }; + + struct ResponseData { + ResponseType type_of_response = REQUEST_QUERY_FAILED; + int error = 0; + std::string signature; + std::string response; + }; + + class TestAutofillDownloadManager : public AutofillDownloadManager { + public: + explicit TestAutofillDownloadManager( + AutofillClient* client, + std::string api_key = "", + bool is_raw_metadata_uploading_enabled = false) + : AutofillDownloadManager( + client, + /*api_key=*/std::move(api_key), + AutofillDownloadManager::IsRawMetadataUploadingEnabled( + is_raw_metadata_uploading_enabled), + /*log_manager=*/nullptr) {} + }; + AutofillDownloadManagerTest() : test_shared_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_)), - download_manager_(&client_, &driver_, this), + download_manager_(&client_), pref_service_(test::PrefServiceForTesting()) { client_.set_shared_url_loader_factory(test_shared_loader_factory_); } + base::WeakPtr<AutofillDownloadManagerTest> GetWeakPtr() { + return weak_ptr_factory_.GetWeakPtr(); + } + void LimitCache(size_t cache_size) { download_manager_.set_max_form_cache_size(cache_size); } + bool StartQueryRequest( + const std::vector<std::unique_ptr<FormStructure>>& form_structures) { + return download_manager_.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + weak_ptr_factory_.GetWeakPtr()); + } + // AutofillDownloadManager::Observer implementation. void OnLoadedServerPredictions( std::string response_xml, @@ -235,22 +270,6 @@ responses_.push_back(response); } - enum ResponseType { - QUERY_SUCCESSFULL, - UPLOAD_SUCCESSFULL, - REQUEST_QUERY_FAILED, - REQUEST_UPLOAD_FAILED, - }; - - struct ResponseData { - ResponseType type_of_response; - int error; - std::string signature; - std::string response; - - ResponseData() : type_of_response(REQUEST_QUERY_FAILED), error(0) {} - }; - ScopedActiveAutofillExperiments scoped_active_autofill_experiments; base::test::TaskEnvironment task_environment_; variations::ScopedVariationsIdsProvider scoped_variations_ids_provider_{ @@ -262,6 +281,9 @@ TestAutofillDriver driver_; AutofillDownloadManager download_manager_; std::unique_ptr<PrefService> pref_service_; + + private: + base::WeakPtrFactory<AutofillDownloadManagerTest> weak_ptr_factory_{this}; }; TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { @@ -355,14 +377,15 @@ // Make download manager. AutofillDownloadManager download_manager( - &client_, &driver_, this, "dummykey", + &client_, "dummykey", AutofillDownloadManager::IsRawMetadataUploadingEnabled(false), /*log_manager=*/nullptr); // Request with id 0. base::HistogramTester histogram; - EXPECT_TRUE( - download_manager.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + GetWeakPtr())); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 1); histogram.ExpectUniqueSample("Autofill.Query.Method", METHOD_GET, 1); @@ -378,16 +401,16 @@ // Request with id 1. EXPECT_TRUE(download_manager.StartUploadRequest( *(form_structures[0]), true, ServerFieldTypeSet(), std::string(), true, - pref_service_.get())); + pref_service_.get(), GetWeakPtr())); // Request with id 2. EXPECT_TRUE(download_manager.StartUploadRequest( *(form_structures[1]), false, ServerFieldTypeSet(), std::string(), true, - pref_service_.get())); + pref_service_.get(), GetWeakPtr())); // Request with id 3. Upload request with a non-empty additional password form // signature. - EXPECT_TRUE(download_manager.StartUploadRequest(*(form_structures[2]), false, - ServerFieldTypeSet(), "42", - true, pref_service_.get())); + EXPECT_TRUE(download_manager.StartUploadRequest( + *(form_structures[2]), false, ServerFieldTypeSet(), "42", true, + pref_service_.get(), GetWeakPtr())); const char* responses[] = { "<autofillqueryresponse>" @@ -465,8 +488,9 @@ form_structures.push_back(std::make_unique<FormStructure>(form)); // Request with id 4, not successful. - EXPECT_TRUE( - download_manager.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + GetWeakPtr())); request = test_url_loader_factory_.GetPendingRequest(4); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 2); @@ -486,8 +510,9 @@ responses_.pop_front(); // Request with id 5. Let's pretend we hit the cache. - EXPECT_TRUE( - download_manager.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + GetWeakPtr())); histogram.ExpectBucketCount("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 3); histogram.ExpectBucketCount("Autofill.Query.Method", METHOD_GET, 3); @@ -525,15 +550,16 @@ form_structures.push_back(std::make_unique<FormStructure>(form)); AutofillDownloadManager download_manager( - &client_, &driver_, this, "dummykey", + &client_, "dummykey", AutofillDownloadManager::IsRawMetadataUploadingEnabled(false), /*log_manager=*/nullptr); // Start the query request and look if it is successful. No response was // received yet. base::HistogramTester histogram; - EXPECT_TRUE( - download_manager.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + GetWeakPtr())); // Verify if histograms are right. histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", @@ -622,13 +648,14 @@ } AutofillDownloadManagerWithCustomPayloadSize download_manager( - &client_, &driver_, this, "dummykey", kMaxQueryGetSize + 1); + &client_, "dummykey", kMaxQueryGetSize + 1); // Start the query request and look if it is successful. No response was // received yet. base::HistogramTester histogram; - EXPECT_TRUE( - download_manager.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_.IsolationInfo(), + GetWeakPtr())); // Verify request. // Verify if histograms are right. @@ -735,12 +762,12 @@ std::unique_ptr<PrefService> pref_service = test::PrefServiceForTesting(); AutofillDownloadManager download_manager( - &client_, &driver_, this, "dummykey", + &client_, "dummykey", AutofillDownloadManager::IsRawMetadataUploadingEnabled(false), /*log_manager=*/nullptr); - EXPECT_TRUE(download_manager.StartUploadRequest(form_structure, true, - ServerFieldTypeSet(), "", - true, pref_service.get())); + EXPECT_TRUE(download_manager.StartUploadRequest( + form_structure, true, ServerFieldTypeSet(), "", true, pref_service.get(), + GetWeakPtr())); // Inspect the request that the test URL loader sent. network::TestURLLoaderFactory::PendingRequest* request = @@ -814,13 +841,13 @@ std::unique_ptr<PrefService> pref_service = test::PrefServiceForTesting(); AutofillDownloadManager download_manager( - &client_, &driver_, this, "dummykey", + &client_, "dummykey", AutofillDownloadManager::IsRawMetadataUploadingEnabled( is_raw_metadata_uploading_enabled), /*log_manager=*/nullptr); - EXPECT_TRUE(download_manager.StartUploadRequest(form_structure, true, - ServerFieldTypeSet(), "", - true, pref_service.get())); + EXPECT_TRUE(download_manager.StartUploadRequest( + form_structure, true, ServerFieldTypeSet(), "", true, + pref_service.get(), GetWeakPtr())); // Inspect the request that the test URL loader sent. ASSERT_EQ(1, test_url_loader_factory_.NumPending()); @@ -891,8 +918,7 @@ // Request with id 0. base::HistogramTester histogram; - EXPECT_TRUE( - download_manager_.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(StartQueryRequest(form_structures)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 1); @@ -964,7 +990,7 @@ // Request with id 0. EXPECT_TRUE(download_manager_.StartUploadRequest( *form_structure, true, ServerFieldTypeSet(), std::string(), true, - pref_service_.get())); + pref_service_.get(), GetWeakPtr())); auto* request = test_url_loader_factory_.GetPendingRequest(0); @@ -1008,7 +1034,7 @@ base::HistogramTester histogram; EXPECT_TRUE(download_manager_.StartUploadRequest( *form_structure, true, ServerFieldTypeSet(), std::string(), true, - pref_service_.get())); + pref_service_.get(), GetWeakPtr())); request = test_url_loader_factory_.GetPendingRequest(2); test_url_loader_factory_.SimulateResponseWithoutRemovingFromPendingList( request, @@ -1050,8 +1076,7 @@ // Request with id 0. base::HistogramTester histogram; - EXPECT_TRUE( - download_manager_.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(StartQueryRequest(form_structures)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 1); @@ -1133,7 +1158,7 @@ // Request with id 0. EXPECT_TRUE(download_manager_.StartUploadRequest( *form_structure, true, ServerFieldTypeSet(), std::string(), true, - pref_service_.get())); + pref_service_.get(), GetWeakPtr())); const int max_attempts = download_manager_.GetMaxServerAttempts(); int attempt = 0; @@ -1197,8 +1222,7 @@ } // Check whether the query is aborted. - EXPECT_FALSE( - download_manager_.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_FALSE(StartQueryRequest(form_structures)); } TEST_F(AutofillDownloadManagerTest, QueryNotTooManyFieldsTest) { @@ -1218,8 +1242,7 @@ } // Check that the query is not aborted. - EXPECT_TRUE( - download_manager_.StartQueryRequest(ToRawPointerVector(form_structures))); + EXPECT_TRUE(StartQueryRequest(form_structures)); } TEST_F(AutofillDownloadManagerTest, CacheQueryTest) { @@ -1284,8 +1307,7 @@ base::HistogramTester histogram; // Request with id 0. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures0))); + EXPECT_TRUE(StartQueryRequest(form_structures0)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 1); @@ -1301,8 +1323,7 @@ responses_.clear(); // No actual request - should be a cache hit. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures0))); + EXPECT_TRUE(StartQueryRequest(form_structures0)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 2); // Data is available immediately from cache - no over-the-wire trip. @@ -1311,8 +1332,7 @@ responses_.clear(); // Request with id 1. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures1))); + EXPECT_TRUE(StartQueryRequest(form_structures1)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 3); // No responses yet @@ -1327,8 +1347,7 @@ responses_.clear(); // Request with id 2. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures2))); + EXPECT_TRUE(StartQueryRequest(form_structures2)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 4); @@ -1341,13 +1360,11 @@ responses_.clear(); // No actual requests - should be a cache hit. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures1))); + EXPECT_TRUE(StartQueryRequest(form_structures1)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 5); - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures2))); + EXPECT_TRUE(StartQueryRequest(form_structures2)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 6); @@ -1358,8 +1375,7 @@ // The first structure should have expired. // Request with id 3. - EXPECT_TRUE(download_manager_.StartQueryRequest( - ToRawPointerVector(form_structures0))); + EXPECT_TRUE(StartQueryRequest(form_structures0)); histogram.ExpectUniqueSample("Autofill.ServerQueryResponse", AutofillMetrics::QUERY_SENT, 7); // No responses yet @@ -1521,10 +1537,10 @@ run_loop_ = std::make_unique<base::RunLoop>(); ScopedActiveAutofillExperiments scoped_active_autofill_experiments; - AutofillDownloadManager download_manager(client_.get(), driver_.get(), - this); - bool succeeded = - download_manager.StartQueryRequest(ToRawPointerVector(form_structures)); + AutofillDownloadManager download_manager(client_.get()); + bool succeeded = download_manager.StartQueryRequest( + ToRawPointerVector(form_structures), driver_->IsolationInfo(), + weak_ptr_factory_.GetWeakPtr()); if (succeeded) run_loop_->Run(); run_loop_.reset(); @@ -1540,11 +1556,11 @@ run_loop_ = std::make_unique<base::RunLoop>(); ScopedActiveAutofillExperiments scoped_active_autofill_experiments; - AutofillDownloadManager download_manager(client_.get(), driver_.get(), - this); + AutofillDownloadManager download_manager(client_.get()); bool succeeded = download_manager.StartUploadRequest( form, form_was_autofilled, available_field_types, login_form_signature, - observed_submission, pref_service_.get()); + observed_submission, pref_service_.get(), + weak_ptr_factory_.GetWeakPtr()); if (succeeded) run_loop_->Run(); run_loop_.reset(); @@ -1567,12 +1583,13 @@ std::unique_ptr<TestAutofillDriver> driver_; std::unique_ptr<PrefService> pref_service_; std::vector<std::string> payloads_; + base::WeakPtrFactory<AutofillServerCommunicationTest> weak_ptr_factory_{this}; }; } // namespace TEST_P(AutofillServerCommunicationTest, IsEnabled) { - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); EXPECT_EQ(download_manager.IsEnabled(), GetParam() != DISABLED); } @@ -1610,7 +1627,7 @@ field.form_control_type = "text"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); EXPECT_EQ(GetParam() != DISABLED, SendUploadRequest(FormStructure(form), true, {}, "", true)); } @@ -1877,7 +1894,7 @@ form.fields.push_back(field); // Setup the form structures to query. - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); std::vector<std::unique_ptr<FormStructure>> form_structures; form_structures.push_back(std::make_unique<FormStructure>(form)); @@ -1960,7 +1977,7 @@ field.placeholder = u"field-placeholder"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); FormStructure form_structure(form); form_structure.set_current_page_language(LanguageCode("fr")); for (auto& fs_field : form_structure) @@ -2041,7 +2058,7 @@ field.form_control_type = "text"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); FormStructure form_structure(form); for (int i = 0; i <= static_cast<int>(SubmissionSource::kMaxValue); ++i) { base::HistogramTester histogram_tester; @@ -2100,7 +2117,7 @@ field.form_control_type = "text"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); FormStructure form_structure(form); FormStructure small_form_structure(small_form); for (auto& fs_field : form_structure) @@ -2186,7 +2203,7 @@ field.form_control_type = "text"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); SubmissionSource submission_source = SubmissionSource::FORM_SUBMISSION; FormStructure form_structure(form); @@ -2244,7 +2261,7 @@ field.form_control_type = "text"; form.fields.push_back(field); - AutofillDownloadManager download_manager(client_.get(), driver_.get(), this); + AutofillDownloadManager download_manager(client_.get()); SubmissionSource submission_source = SubmissionSource::FORM_SUBMISSION; FormStructure form_structure(form);
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 1e342e9..f6e937a 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -146,7 +146,7 @@ form_interactions_ukm_logger_(CreateFormInteractionsUkmLogger()) { if (enable_download_manager) { download_manager_ = std::make_unique<AutofillDownloadManager>( - client, driver, this, GetAPIKeyForUrl(channel), + client, GetAPIKeyForUrl(channel), AutofillDownloadManager::IsRawMetadataUploadingEnabled( IsRawMetadataUploadingEnabled(channel)), log_manager_); @@ -419,7 +419,8 @@ // Query the server if at least one of the forms was parsed. if (!queryable_forms.empty() && download_manager()) { - download_manager()->StartQueryRequest(queryable_forms); + download_manager()->StartQueryRequest( + queryable_forms, driver()->IsolationInfo(), GetWeakPtr()); } }
diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc index b010dbd..3589b21 100644 --- a/components/autofill/core/browser/browser_autofill_manager.cc +++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -1971,7 +1971,7 @@ download_manager()->StartUploadRequest( *submitted_form, was_autofilled, non_empty_types, /*login_form_signature=*/std::string(), observed_submission, - client()->GetPrefs()); + client()->GetPrefs(), GetWeakPtr()); } const gfx::Image& BrowserAutofillManager::GetCardImage(
diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc index 28ef10d..34df099 100644 --- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc +++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -52,7 +52,6 @@ #include "components/autofill/core/browser/payments/test_payments_client.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/test_autofill_client.h" -#include "components/autofill/core/browser/test_autofill_download_manager.h" #include "components/autofill/core/browser/test_autofill_driver.h" #include "components/autofill/core/browser/test_autofill_external_delegate.h" #include "components/autofill/core/browser/test_autofill_manager_waiter.h" @@ -154,12 +153,15 @@ MOCK_METHOD(void, HideFastCheckout, (bool), (override)); }; -class MockAutofillDownloadManager : public TestAutofillDownloadManager { +class MockAutofillDownloadManager : public AutofillDownloadManager { public: - MockAutofillDownloadManager(AutofillClient* client, - AutofillDriver* driver, - AutofillDownloadManager::Observer* observer) - : TestAutofillDownloadManager(client, driver, observer) {} + explicit MockAutofillDownloadManager(AutofillClient* client) + : AutofillDownloadManager( + client, + /*api_key=*/"", + AutofillDownloadManager::IsRawMetadataUploadingEnabled(false), + /*log_manager=*/nullptr) {} + MockAutofillDownloadManager(const MockAutofillDownloadManager&) = delete; MockAutofillDownloadManager& operator=(const MockAutofillDownloadManager&) = delete; @@ -171,8 +173,28 @@ const ServerFieldTypeSet&, const std::string&, bool, - PrefService*), + PrefService*, + base::WeakPtr<Observer>), (override)); + + bool StartQueryRequest(const std::vector<FormStructure*>& forms, + net::IsolationInfo isolation_info, + base::WeakPtr<Observer> observer) override { + last_queried_forms_ = forms; + return true; + } + + // Verify that the last queried forms equal |expected_forms|. + void VerifyLastQueriedForms(const std::vector<FormData>& expected_forms) { + ASSERT_EQ(expected_forms.size(), last_queried_forms_.size()); + for (size_t i = 0; i < expected_forms.size(); ++i) { + EXPECT_EQ(last_queried_forms_[i]->global_id().renderer_id, + expected_forms[i].global_id().renderer_id); + } + } + + private: + std::vector<FormStructure*> last_queried_forms_; }; class MockTouchToFillDelegateImpl : public TouchToFillDelegateImpl { @@ -433,9 +455,8 @@ browser_autofill_manager_->set_single_field_form_fill_router_for_test( std::move(single_field_form_fill_router)); - auto download_manager = std::make_unique<MockAutofillDownloadManager>( - &autofill_client_, autofill_driver_.get(), - browser_autofill_manager_.get()); + auto download_manager = + std::make_unique<MockAutofillDownloadManager>(&autofill_client_); download_manager_ = download_manager.get(); browser_autofill_manager_->set_download_manager_for_test( std::move(download_manager)); @@ -10584,7 +10605,7 @@ BrowserAutofillManagerTest::SetUp(); // All uploads should be expected explicitly. - EXPECT_CALL(*download_manager_, StartUploadRequest(_, _, _, _, _, _)) + EXPECT_CALL(*download_manager_, StartUploadRequest(_, _, _, _, _, _, _)) .Times(0); form_.name = u"MyForm"; @@ -10630,7 +10651,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(CalculateFormSignature(form_)), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/true, _)) + _, _, _, /*observed_submission=*/true, _, _)) .Times(1); FormSubmitted(form_); } @@ -10657,7 +10678,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(first_form_signature), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/false, _)) + _, _, _, /*observed_submission=*/false, _, _)) .Times(1); } browser_autofill_manager_->OnFocusNoLongerOnForm(true); @@ -10680,7 +10701,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(first_form_signature), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/false, _)) + _, _, _, /*observed_submission=*/false, _, _)) .Times(1); browser_autofill_manager_->OnFocusNoLongerOnForm(true); @@ -10708,7 +10729,7 @@ StartUploadRequest(AllOf(SignatureIs(second_form_signature), UploadedAutofillTypesAre(expected_vote_types)), _, _, _, - /*observed_submission=*/true, _)) + /*observed_submission=*/true, _, _)) .Times(1); FormSubmitted(form_); } @@ -10727,7 +10748,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(CalculateFormSignature(form_)), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/false, _)) + _, _, _, /*observed_submission=*/false, _, _)) .Times(1); browser_autofill_manager_->OnFocusNoLongerOnForm(true); @@ -10755,7 +10776,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(CalculateFormSignature(form_)), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/false, _)) + _, _, _, /*observed_submission=*/false, _, _)) .Times(1); } else { // If kAutofillDelayBlurVotes is enabled, the blur vote will be ignored and @@ -10767,7 +10788,7 @@ *download_manager_, StartUploadRequest(AllOf(SignatureIs(CalculateFormSignature(form_)), UploadedAutofillTypesAre(expected_vote_types)), - _, _, _, /*observed_submission=*/true, _)) + _, _, _, /*observed_submission=*/true, _, _)) .Times(1); FormSubmitted(form_); }
diff --git a/components/autofill/core/browser/test_autofill_download_manager.cc b/components/autofill/core/browser/test_autofill_download_manager.cc deleted file mode 100644 index e850aae..0000000 --- a/components/autofill/core/browser/test_autofill_download_manager.cc +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright 2018 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/autofill/core/browser/test_autofill_download_manager.h" - -#include "components/autofill/core/browser/form_structure.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace autofill { - -TestAutofillDownloadManager::TestAutofillDownloadManager( - AutofillClient* client, - AutofillDriver* driver, - AutofillDownloadManager::Observer* observer) - : AutofillDownloadManager(client, driver, observer) {} - -TestAutofillDownloadManager::~TestAutofillDownloadManager() = default; - -bool TestAutofillDownloadManager::StartQueryRequest( - const std::vector<FormStructure*>& forms) { - last_queried_forms_ = forms; - return true; -} - -void TestAutofillDownloadManager::VerifyLastQueriedForms( - const std::vector<FormData>& expected_forms) { - ASSERT_EQ(expected_forms.size(), last_queried_forms_.size()); - for (size_t i = 0; i < expected_forms.size(); ++i) { - EXPECT_EQ(last_queried_forms_[i]->global_id().renderer_id, - expected_forms[i].global_id().renderer_id); - } -} - -} // namespace autofill
diff --git a/components/autofill/core/browser/test_autofill_download_manager.h b/components/autofill/core/browser/test_autofill_download_manager.h deleted file mode 100644 index 7cd1012..0000000 --- a/components/autofill/core/browser/test_autofill_download_manager.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2018 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_DOWNLOAD_MANAGER_H_ -#define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_DOWNLOAD_MANAGER_H_ - -#include <vector> - -#include "components/autofill/core/browser/autofill_download_manager.h" -#include "components/autofill/core/common/form_data.h" - -namespace autofill { - -class FormStructure; - -class TestAutofillDownloadManager : public AutofillDownloadManager { - public: - TestAutofillDownloadManager(AutofillClient* client, - AutofillDriver* driver, - AutofillDownloadManager::Observer* observer); - - TestAutofillDownloadManager(const TestAutofillDownloadManager&) = delete; - TestAutofillDownloadManager& operator=(const TestAutofillDownloadManager&) = - delete; - - ~TestAutofillDownloadManager() override; - - // AutofillDownloadManager overrides. - bool StartQueryRequest(const std::vector<FormStructure*>& forms) override; - - // Unique to TestAutofillDownloadManager: - - // Verify that the last queried forms equal |expected_forms|. - void VerifyLastQueriedForms(const std::vector<FormData>& expected_forms); - - private: - std::vector<FormStructure*> last_queried_forms_; -}; - -} // namespace autofill - -#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_DOWNLOAD_MANAGER_H_
diff --git a/components/client_hints/README.md b/components/client_hints/README.md index e9bf94a..c6943202 100644 --- a/components/client_hints/README.md +++ b/components/client_hints/README.md
@@ -119,6 +119,7 @@ * Add the feature enum to the map in `MakeClientHintToWebFeatureMap` in [/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc]. * Add the client hint header to the `Accept-CH` header in the appropriate test files in [/chrome/test/data/client_hints/] and [/third_party/blink/web_tests/external/wpt/client-hints]. * Update `expected_client_hints_number` to the current value + 1 in [/chrome/browser/client_hints/client_hints_browsertest.cc]. +* Add an enum value to `WebClientHintsType` in [/tools/metrics/histograms/enums.xml]. **NOTE:** It’s very important that the order of these arrays remain in sync.
diff --git a/components/commerce/core/subscriptions/subscriptions_manager.cc b/components/commerce/core/subscriptions/subscriptions_manager.cc index 36c6478..2d42a6c 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager.cc +++ b/components/commerce/core/subscriptions/subscriptions_manager.cc
@@ -60,24 +60,9 @@ SubscriptionsManager::~SubscriptionsManager() = default; -SubscriptionsManager::Request::Request(SubscriptionType type, - AsyncOperation operation, - SubscriptionsRequestCallback callback) - : type(type), operation(operation), callback(std::move(callback)) { - CHECK(operation == AsyncOperation::kSync); -} -SubscriptionsManager::Request::Request( - SubscriptionType type, - AsyncOperation operation, - std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, - SubscriptionsRequestCallback callback) - : type(type), - operation(operation), - subscriptions(std::move(subscriptions)), - callback(std::move(callback)) { - CHECK(operation == AsyncOperation::kSubscribe || - operation == AsyncOperation::kUnsubscribe); -} +SubscriptionsManager::Request::Request(AsyncOperation operation, + base::OnceCallback<void()> callback) + : operation(operation), callback(std::move(callback)) {} SubscriptionsManager::Request::Request(Request&&) = default; SubscriptionsManager::Request::~Request() = default; @@ -91,27 +76,11 @@ if (!last_sync_succeeded_ && !HasRequestRunning()) { SyncSubscriptions(); } - SubscriptionType type = (*subscriptions)[0].type; - // Make a copy of subscriptions to notify observers later. - std::vector<CommerceSubscription> notified_subscriptions = *subscriptions; pending_requests_.emplace( - type, AsyncOperation::kSubscribe, std::move(subscriptions), - base::BindOnce( - [](base::WeakPtr<SubscriptionsManager> manager, - std::vector<CommerceSubscription> notified_subscriptions, - base::OnceCallback<void(bool)> callback, - SubscriptionsRequestStatus result) { - base::UmaHistogramEnumeration(kTrackResultHistogramName, result); - bool succeeded = result == SubscriptionsRequestStatus::kSuccess || - result == SubscriptionsRequestStatus::kNoOp; - for (SubscriptionsObserver& observer : manager->observers_) { - observer.OnSubscribe(notified_subscriptions, succeeded); - } - std::move(callback).Run(succeeded); - manager->OnRequestCompletion(); - }, - weak_ptr_factory_.GetWeakPtr(), std::move(notified_subscriptions), - std::move(callback))); + AsyncOperation::kSubscribe, + base::BindOnce(&SubscriptionsManager::HandleSubscribe, + weak_ptr_factory_.GetWeakPtr(), std::move(subscriptions), + std::move(callback))); CheckAndProcessRequest(); } @@ -125,46 +94,18 @@ if (!last_sync_succeeded_ && !HasRequestRunning()) { SyncSubscriptions(); } - SubscriptionType type = (*subscriptions)[0].type; - // Make a copy of subscriptions to notify observers later. - std::vector<CommerceSubscription> notified_subscriptions = *subscriptions; pending_requests_.emplace( - type, AsyncOperation::kUnsubscribe, std::move(subscriptions), - base::BindOnce( - [](base::WeakPtr<SubscriptionsManager> manager, - std::vector<CommerceSubscription> notified_subscriptions, - base::OnceCallback<void(bool)> callback, - SubscriptionsRequestStatus result) { - base::UmaHistogramEnumeration(kUntrackResultHistogramName, result); - bool succeeded = result == SubscriptionsRequestStatus::kSuccess || - result == SubscriptionsRequestStatus::kNoOp; - for (SubscriptionsObserver& observer : manager->observers_) { - observer.OnUnsubscribe(notified_subscriptions, succeeded); - } - std::move(callback).Run(succeeded); - manager->OnRequestCompletion(); - }, - weak_ptr_factory_.GetWeakPtr(), std::move(notified_subscriptions), - std::move(callback))); + AsyncOperation::kUnsubscribe, + base::BindOnce(&SubscriptionsManager::HandleUnsubscribe, + weak_ptr_factory_.GetWeakPtr(), std::move(subscriptions), + std::move(callback))); CheckAndProcessRequest(); } void SubscriptionsManager::SyncSubscriptions() { - last_sync_succeeded_ = false; - storage_->DeleteAll(); - if (account_checker_ && account_checker_->IsSignedIn() && - account_checker_->IsAnonymizedUrlDataCollectionEnabled()) { - pending_requests_.emplace( - SubscriptionType::kPriceTrack, AsyncOperation::kSync, - base::BindOnce( - [](base::WeakPtr<SubscriptionsManager> manager, - SubscriptionsRequestStatus result) { - manager->last_sync_succeeded_ = - result == SubscriptionsRequestStatus::kSuccess; - manager->OnRequestCompletion(); - }, - weak_ptr_factory_.GetWeakPtr())); - } + pending_requests_.emplace(AsyncOperation::kSync, + base::BindOnce(&SubscriptionsManager::HandleSync, + weak_ptr_factory_.GetWeakPtr())); CheckAndProcessRequest(); } @@ -178,20 +119,8 @@ last_request_started_time_ = base::Time::Now(); Request request = std::move(pending_requests_.front()); pending_requests_.pop(); - CHECK(request.type != SubscriptionType::kTypeUnspecified); last_request_operation_ = request.operation; - - switch (request.operation) { - case AsyncOperation::kSync: - ProcessSyncRequest(std::move(request)); - break; - case AsyncOperation::kSubscribe: - ProcessSubscribeRequest(std::move(request)); - break; - case AsyncOperation::kUnsubscribe: - ProcessUnsubscribeRequest(std::move(request)); - break; - } + std::move(request.callback).Run(); } void SubscriptionsManager::OnRequestCompletion() { @@ -199,67 +128,131 @@ CheckAndProcessRequest(); } -void SubscriptionsManager::ProcessSyncRequest(Request request) { - GetRemoteSubscriptionsAndUpdateStorage(request.type, - std::move(request.callback)); +void SubscriptionsManager::HandleSync() { + last_sync_succeeded_ = false; + if (account_checker_ && account_checker_->IsSignedIn() && + account_checker_->IsAnonymizedUrlDataCollectionEnabled()) { + GetRemoteSubscriptionsAndUpdateStorage( + SubscriptionType::kPriceTrack, + base::BindOnce(&SubscriptionsManager::OnSyncStatusFetched, + weak_ptr_factory_.GetWeakPtr())); + } } -void SubscriptionsManager::ProcessSubscribeRequest(Request request) { +void SubscriptionsManager::OnSyncStatusFetched( + SubscriptionsRequestStatus result) { + last_sync_succeeded_ = result == SubscriptionsRequestStatus::kSuccess; + OnRequestCompletion(); +} + +void SubscriptionsManager::HandleSubscribe( + std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, + base::OnceCallback<void(bool)> callback) { + SubscriptionType type = (*subscriptions)[0].type; + // Make a copy of subscriptions to notify observers later. + std::vector<CommerceSubscription> notified_subscriptions = *subscriptions; + + SubscriptionsRequestCallback wrapped_callback = + base::BindOnce(&SubscriptionsManager::OnSubscribeStatusFetched, + weak_ptr_factory_.GetWeakPtr(), + std::move(notified_subscriptions), std::move(callback)); + if (!last_sync_succeeded_) { - std::move(request.callback) + std::move(wrapped_callback) .Run(SubscriptionsRequestStatus::kLastSyncFailed); return; } storage_->GetUniqueNonExistingSubscriptions( - std::move(request.subscriptions), + std::move(subscriptions), base::BindOnce( - [](base::WeakPtr<SubscriptionsManager> manager, SubscriptionType type, - SubscriptionsRequestCallback callback, - std::unique_ptr<std::vector<CommerceSubscription>> - unique_subscriptions) { - if (unique_subscriptions->size() == 0) { - base::SequencedTaskRunner::GetCurrentDefault()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), - SubscriptionsRequestStatus::kNoOp)); - return; - } - manager->server_proxy_->Create( - std::move(unique_subscriptions), - base::BindOnce( - &SubscriptionsManager::HandleManageSubscriptionsResponse, - manager, type, std::move(callback))); - }, - weak_ptr_factory_.GetWeakPtr(), request.type, - std::move(request.callback))); + &SubscriptionsManager::OnIncomingSubscriptionsFilteredForSubscribe, + weak_ptr_factory_.GetWeakPtr(), type, std::move(wrapped_callback))); } -void SubscriptionsManager::ProcessUnsubscribeRequest(Request request) { +void SubscriptionsManager::OnSubscribeStatusFetched( + std::vector<CommerceSubscription> notified_subscriptions, + base::OnceCallback<void(bool)> callback, + SubscriptionsRequestStatus result) { + base::UmaHistogramEnumeration(kTrackResultHistogramName, result); + bool succeeded = result == SubscriptionsRequestStatus::kSuccess || + result == SubscriptionsRequestStatus::kNoOp; + for (SubscriptionsObserver& observer : observers_) { + observer.OnSubscribe(notified_subscriptions, succeeded); + } + std::move(callback).Run(succeeded); + OnRequestCompletion(); +} + +void SubscriptionsManager::OnIncomingSubscriptionsFilteredForSubscribe( + SubscriptionType type, + SubscriptionsRequestCallback callback, + std::unique_ptr<std::vector<CommerceSubscription>> unique_subscriptions) { + if (unique_subscriptions->size() == 0) { + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), SubscriptionsRequestStatus::kNoOp)); + return; + } + server_proxy_->Create( + std::move(unique_subscriptions), + base::BindOnce(&SubscriptionsManager::HandleManageSubscriptionsResponse, + weak_ptr_factory_.GetWeakPtr(), type, + std::move(callback))); +} + +void SubscriptionsManager::HandleUnsubscribe( + std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, + base::OnceCallback<void(bool)> callback) { + SubscriptionType type = (*subscriptions)[0].type; + // Make a copy of subscriptions to notify observers later. + std::vector<CommerceSubscription> notified_subscriptions = *subscriptions; + + SubscriptionsRequestCallback wrapped_callback = + base::BindOnce(&SubscriptionsManager::OnUnsubscribeStatusFetched, + weak_ptr_factory_.GetWeakPtr(), + std::move(notified_subscriptions), std::move(callback)); + if (!last_sync_succeeded_) { - std::move(request.callback) + std::move(wrapped_callback) .Run(SubscriptionsRequestStatus::kLastSyncFailed); return; } storage_->GetUniqueExistingSubscriptions( - std::move(request.subscriptions), + std::move(subscriptions), base::BindOnce( - [](base::WeakPtr<SubscriptionsManager> manager, SubscriptionType type, - SubscriptionsRequestCallback callback, - std::unique_ptr<std::vector<CommerceSubscription>> - unique_subscriptions) { - if (unique_subscriptions->size() == 0) { - base::SequencedTaskRunner::GetCurrentDefault()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), - SubscriptionsRequestStatus::kNoOp)); - return; - } - manager->server_proxy_->Delete( - std::move(unique_subscriptions), - base::BindOnce( - &SubscriptionsManager::HandleManageSubscriptionsResponse, - manager, type, std::move(callback))); - }, - weak_ptr_factory_.GetWeakPtr(), request.type, - std::move(request.callback))); + &SubscriptionsManager::OnIncomingSubscriptionsFilteredForUnsubscribe, + weak_ptr_factory_.GetWeakPtr(), type, std::move(wrapped_callback))); +} + +void SubscriptionsManager::OnUnsubscribeStatusFetched( + std::vector<CommerceSubscription> notified_subscriptions, + base::OnceCallback<void(bool)> callback, + SubscriptionsRequestStatus result) { + base::UmaHistogramEnumeration(kUntrackResultHistogramName, result); + bool succeeded = result == SubscriptionsRequestStatus::kSuccess || + result == SubscriptionsRequestStatus::kNoOp; + for (SubscriptionsObserver& observer : observers_) { + observer.OnUnsubscribe(notified_subscriptions, succeeded); + } + std::move(callback).Run(succeeded); + OnRequestCompletion(); +} + +void SubscriptionsManager::OnIncomingSubscriptionsFilteredForUnsubscribe( + SubscriptionType type, + SubscriptionsRequestCallback callback, + std::unique_ptr<std::vector<CommerceSubscription>> unique_subscriptions) { + if (unique_subscriptions->size() == 0) { + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), SubscriptionsRequestStatus::kNoOp)); + return; + } + server_proxy_->Delete( + std::move(unique_subscriptions), + base::BindOnce(&SubscriptionsManager::HandleManageSubscriptionsResponse, + weak_ptr_factory_.GetWeakPtr(), type, + std::move(callback))); } void SubscriptionsManager::GetRemoteSubscriptionsAndUpdateStorage( @@ -324,6 +317,7 @@ void SubscriptionsManager::OnPrimaryAccountChanged( const signin::PrimaryAccountChangeEvent& event_details) { + storage_->DeleteAll(); SyncSubscriptions(); }
diff --git a/components/commerce/core/subscriptions/subscriptions_manager.h b/components/commerce/core/subscriptions/subscriptions_manager.h index b9de4b9..5eb1d8e6 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager.h +++ b/components/commerce/core/subscriptions/subscriptions_manager.h
@@ -126,27 +126,18 @@ }; struct Request { - Request(SubscriptionType type, - AsyncOperation operation, - SubscriptionsRequestCallback callback); - Request(SubscriptionType type, - AsyncOperation operation, - std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, - SubscriptionsRequestCallback callback); + Request(AsyncOperation operation, base::OnceCallback<void()> callback); Request(const Request&) = delete; Request& operator=(const Request&) = delete; Request(Request&&); Request& operator=(Request&&) = default; ~Request(); - SubscriptionType type; AsyncOperation operation; - std::unique_ptr<std::vector<CommerceSubscription>> subscriptions; - SubscriptionsRequestCallback callback; + base::OnceCallback<void()> callback; }; - // Fetch all backend subscriptions and sync with local storage. This should - // only be called on manager instantiation and user primary account changed. + // Fetch all backend subscriptions and sync with local storage. void SyncSubscriptions(); // Check if there is any request running. If not, process the next request in @@ -157,11 +148,37 @@ // request. This is chained to the main callback when Request object is built. void OnRequestCompletion(); - void ProcessSubscribeRequest(Request request); + void HandleSync(); - void ProcessUnsubscribeRequest(Request request); + void OnSyncStatusFetched(SubscriptionsRequestStatus result); - void ProcessSyncRequest(Request request); + void HandleSubscribe( + std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, + base::OnceCallback<void(bool)> callback); + + void OnSubscribeStatusFetched( + std::vector<CommerceSubscription> notified_subscriptions, + base::OnceCallback<void(bool)> callback, + SubscriptionsRequestStatus result); + + void OnIncomingSubscriptionsFilteredForSubscribe( + SubscriptionType type, + SubscriptionsRequestCallback callback, + std::unique_ptr<std::vector<CommerceSubscription>> unique_subscriptions); + + void HandleUnsubscribe( + std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, + base::OnceCallback<void(bool)> callback); + + void OnUnsubscribeStatusFetched( + std::vector<CommerceSubscription> notified_subscriptions, + base::OnceCallback<void(bool)> callback, + SubscriptionsRequestStatus result); + + void OnIncomingSubscriptionsFilteredForUnsubscribe( + SubscriptionType type, + SubscriptionsRequestCallback callback, + std::unique_ptr<std::vector<CommerceSubscription>> unique_subscriptions); void GetRemoteSubscriptionsAndUpdateStorage( SubscriptionType type,
diff --git a/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc b/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc index 6dbae31..b3f34a01 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc +++ b/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc
@@ -278,7 +278,6 @@ SetAccountStatus(true, true); mock_server_proxy_->MockGetResponses("111"); mock_storage_->MockUpdateResponses(true); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))) @@ -291,7 +290,6 @@ SetAccountStatus(true, true); mock_server_proxy_->MockGetResponses("111"); mock_storage_->MockUpdateResponses(false); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))) @@ -304,7 +302,6 @@ SetAccountStatus(true, true); mock_server_proxy_->MockGetResponses("111", false); mock_storage_->MockUpdateResponses(true); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage).Times(0); @@ -315,7 +312,6 @@ SetAccountStatus(false, true); mock_server_proxy_->MockGetResponses("111"); mock_storage_->MockUpdateResponses(true); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(0); EXPECT_CALL(*mock_storage_, UpdateStorage).Times(0); @@ -331,7 +327,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -370,7 +365,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -409,12 +403,10 @@ { InSequence s; // First sync. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); // Re-try the sync when a subscribe request comes. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -447,7 +439,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))) @@ -479,7 +470,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -519,7 +509,6 @@ { InSequence s; // Sync calls. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -590,7 +579,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -625,7 +613,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -664,12 +651,10 @@ { InSequence s; // First sync. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); // Re-try the sync when an unsubscribe request comes. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -703,7 +688,6 @@ // Don't retry the sync if there is any request running. { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))) @@ -735,7 +719,6 @@ { InSequence s; - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -769,7 +752,6 @@ { InSequence s; // First sync on manager instantiation. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -791,7 +773,6 @@ mock_storage_->MockUpdateResponses(true); mock_storage_->MockIsSubscribedResponses(true); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))) @@ -811,12 +792,10 @@ { InSequence s; // First sync on manager instantiation. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); // Second sync since local subscriptions are out of sync. - EXPECT_CALL(*mock_storage_, DeleteAll); EXPECT_CALL(*mock_server_proxy_, Get); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111"))); @@ -834,7 +813,6 @@ mock_storage_->MockUpdateResponses(true); mock_storage_->MockIsSubscribedResponses(false); - EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); EXPECT_CALL(*mock_server_proxy_, Get).Times(1); EXPECT_CALL(*mock_storage_, UpdateStorage(_, _, AreExpectedSubscriptions("111")))
diff --git a/components/crash/content/browser/child_exit_observer_android.cc b/components/crash/content/browser/child_exit_observer_android.cc index 8dd7ff5f..0b9c634 100644 --- a/components/crash/content/browser/child_exit_observer_android.cc +++ b/components/crash/content/browser/child_exit_observer_android.cc
@@ -45,9 +45,6 @@ ChildExitObserver::ChildExitObserver() { DCHECK_CURRENTLY_ON(BrowserThread::UI); notification_registrar_.Add(this, - content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllSources()); - notification_registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::NotificationService::AllSources()); notification_registrar_.Add(this, @@ -76,6 +73,13 @@ DCHECK(result); } +void ChildExitObserver::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { + // The child process pid isn't available when process is gone, keep a mapping + // between process_host_id and pid, so we can find it later. + process_host_id_to_pid_[host->GetID()] = host->GetProcess().Handle(); +} + void ChildExitObserver::OnChildExit(TerminationInfo* info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -178,12 +182,6 @@ PopulateTerminationInfo(content_info, &info); break; } - case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - // The child process pid isn't available when process is gone, keep a - // mapping between process_host_id and pid, so we can find it later. - process_host_id_to_pid_[rph->GetID()] = rph->GetProcess().Handle(); - return; - } default: NOTREACHED(); return;
diff --git a/components/crash/content/browser/child_exit_observer_android.h b/components/crash/content/browser/child_exit_observer_android.h index d59447d..4b80ce64 100644 --- a/components/crash/content/browser/child_exit_observer_android.h +++ b/components/crash/content/browser/child_exit_observer_android.h
@@ -20,6 +20,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_process_host_creation_observer.h" #include "content/public/common/process_type.h" #include "third_party/blink/public/common/oom_intervention/oom_intervention_types.h" @@ -33,6 +34,7 @@ // purpose of reacting to child process crashes. // The ChildExitObserver instance exists on the browser main thread. class ChildExitObserver : public content::BrowserChildProcessObserver, + public content::RenderProcessHostCreationObserver, public content::NotificationObserver, public crashpad::CrashHandlerHost::Observer { public: @@ -120,6 +122,9 @@ // crashpad::CrashHandlerHost::Observer void ChildReceivedCrashSignal(base::ProcessId pid, int signo) override; + // content::RenderProcessHostCreationObserver implementation. + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; + private: // content::BrowserChildProcessObserver implementation: void BrowserChildProcessHostDisconnected(
diff --git a/components/domain_reliability/BUILD.gn b/components/domain_reliability/BUILD.gn index ee1c145..1e61419 100644 --- a/components/domain_reliability/BUILD.gn +++ b/components/domain_reliability/BUILD.gn
@@ -79,6 +79,7 @@ deps = [ ":bake_in_configs", + ":prefs", "//base", "//net", "//url", @@ -108,3 +109,16 @@ "//testing/gtest", ] } + +source_set("prefs") { + sources = [ + "domain_reliability_prefs.cc", + "domain_reliability_prefs.h", + ] + + deps = [ + "//base", + "//components/pref_registry:pref_registry", + "//components/prefs:prefs", + ] +}
diff --git a/components/domain_reliability/DEPS b/components/domain_reliability/DEPS index eb59235..db918fe 100644 --- a/components/domain_reliability/DEPS +++ b/components/domain_reliability/DEPS
@@ -4,5 +4,5 @@ include_rules = [ "+net", + "+components/prefs", ] -
diff --git a/components/domain_reliability/domain_reliability_prefs.cc b/components/domain_reliability/domain_reliability_prefs.cc new file mode 100644 index 0000000..61e65d9 --- /dev/null +++ b/components/domain_reliability/domain_reliability_prefs.cc
@@ -0,0 +1,21 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/domain_reliability/domain_reliability_prefs.h" + +#include "components/prefs/pref_registry_simple.h" + +namespace domain_reliability { +namespace prefs { + +const char kDomainReliabilityAllowedByPolicy[] = + "domain_reliability.allowed_by_policy"; + +} // namespace prefs + +void RegisterPrefs(PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(prefs::kDomainReliabilityAllowedByPolicy, true); +} + +} // namespace domain_reliability
diff --git a/components/domain_reliability/domain_reliability_prefs.h b/components/domain_reliability/domain_reliability_prefs.h new file mode 100644 index 0000000..8efc3cb --- /dev/null +++ b/components/domain_reliability/domain_reliability_prefs.h
@@ -0,0 +1,24 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_DOMAIN_RELIABILITY_DOMAIN_RELIABILITY_PREFS_H_ +#define COMPONENTS_DOMAIN_RELIABILITY_DOMAIN_RELIABILITY_PREFS_H_ + +class PrefRegistrySimple; + +namespace domain_reliability { +namespace prefs { + +// Boolean that specifies whether or not domain reliability diagnostic data +// reporting is allowed by policy to be sent over the network. +extern const char kDomainReliabilityAllowedByPolicy[]; + +} // namespace prefs + +// Registers local state prefs related to Domain Reliability. +void RegisterPrefs(PrefRegistrySimple* registry); + +} // namespace domain_reliability + +#endif // COMPONENTS_DOMAIN_RELIABILITY_DOMAIN_RELIABILITY_PREFS_H_
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc index 6ee9adc..06f8a21 100644 --- a/components/domain_reliability/uploader.cc +++ b/components/domain_reliability/uploader.cc
@@ -112,7 +112,20 @@ "to Google' in Chromium's settings under Privacy. On ChromeOS, " "the setting is named 'Automatically send diagnostic and usage " "data to Google'." - policy_exception_justification: "Not implemented." + chrome_policy { + subProto1 { + DomainReliabilityAllowed { + policy_options {mode: MANDATORY} + DomainReliabilityAllowed: false + } + } + } + chrome_policy { + MetricsReportingEnabled { + policy_options {mode: MANDATORY} + MetricsReportingEnabled: false + } + } })"); std::unique_ptr<net::URLRequest> request = url_request_context_->CreateRequest(
diff --git a/components/heap_profiling/multi_process/client_connection_manager.cc b/components/heap_profiling/multi_process/client_connection_manager.cc index 16759b3..a010c35 100644 --- a/components/heap_profiling/multi_process/client_connection_manager.cc +++ b/components/heap_profiling/multi_process/client_connection_manager.cc
@@ -115,8 +115,6 @@ void ClientConnectionManager::Start() { Add(this); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, @@ -246,6 +244,13 @@ std::move(client), data.GetProcess().Pid(), process_type)); } +void ClientConnectionManager::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { + if (ShouldProfileNewRenderer(host)) { + StartProfilingRenderer(host); + } +} + void ClientConnectionManager::Observe( int type, const content::NotificationSource& source, @@ -263,11 +268,6 @@ type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED)) { profiled_renderers_.erase(host); } - - if (type == content::NOTIFICATION_RENDERER_PROCESS_CREATED && - ShouldProfileNewRenderer(host)) { - StartProfilingRenderer(host); - } } bool ClientConnectionManager::ShouldProfileNewRenderer(
diff --git a/components/heap_profiling/multi_process/client_connection_manager.h b/components/heap_profiling/multi_process/client_connection_manager.h index a62b9a7c..113b13f 100644 --- a/components/heap_profiling/multi_process/client_connection_manager.h +++ b/components/heap_profiling/multi_process/client_connection_manager.h
@@ -13,6 +13,7 @@ #include "content/public/browser/child_process_data.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/render_process_host_creation_observer.h" namespace content { class RenderProcessHost; @@ -41,8 +42,10 @@ // This class can be subclassed for exactly one reason: to allow embedders to // override AllowedToProfileRenderer in order to prevent incognito renderers // from being profiled. -class ClientConnectionManager : public content::BrowserChildProcessObserver, - content::NotificationObserver { +class ClientConnectionManager + : public content::BrowserChildProcessObserver, + public content::RenderProcessHostCreationObserver, + content::NotificationObserver { public: // The owner of this instance must guarantee that |controller_| outlives this // class. @@ -86,6 +89,9 @@ void StartProfilingNonRendererChild(const content::ChildProcessData& data); + // content::RenderProcessHostCreationObserver + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; + // NotificationObserver // Observe connection of renderer child processes. void Observe(int type, @@ -108,11 +114,11 @@ // only be accessed on the UI thread and their values should be considered // opaque. // - // Semantically, the elements must be something that identifies which - // specific RenderProcess is being profiled. When the underlying RenderProcess - // goes away, the element must be removed. The RenderProcessHost - // pointer and the NOTIFICATION_RENDERER_PROCESS_CREATED notification can be - // used to provide these semantics. + // Semantically, the elements must be something that identifies which specific + // RenderProcess is being profiled. When the underlying RenderProcess goes + // away, the element must be removed. The RenderProcessHost pointer and the + // RenderProcessHostCreationObserver notification can be used to provide these + // semantics. // // This variable represents renderers that have been instructed to start // profiling - it does not reflect whether a renderer is currently still being
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index c8e2ca1..390119a 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -2272,6 +2272,12 @@ return cluster; } +int64_t HistoryBackend::GetClusterIdContainingVisit(VisitID visit_id) { + TRACE_EVENT0("browser", "HistoryBackend::GetClusterIdContainingVisit"); + + return db_ ? db_->GetClusterIdContainingVisit(visit_id) : 0; +} + VisitRow HistoryBackend::GetRedirectChainStart(VisitRow visit) { VisitVector redirect_chain = GetRedirectChain(visit); if (redirect_chain.empty())
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h index bccbb5f..1d05b1d7 100644 --- a/components/history/core/browser/history_backend.h +++ b/components/history/core/browser/history_backend.h
@@ -544,6 +544,11 @@ Cluster GetCluster(int64_t cluster_id, bool include_keywords_and_duplicates = true); + // Returns the ID of the cluster containing `visit_id`. Returns 0 if + // `visit_id` is not in a cluster. + // HistoryBackendForSync: + int64_t GetClusterIdContainingVisit(VisitID visit_id) override; + // Finds the 1st visit in the redirect chain containing `visit`. // Unlike `GetRedirectsToSpecificVisit()`, this only considers actual // redirects, not referrals.
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 4cf12b6..21da238 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -4092,7 +4092,9 @@ EXPECT_FALSE(cluster.triggerability_calculated); } -TEST_F(HistoryBackendTest, ReserveNextClusterId_AddVisitsToCluster_GetCluster) { +TEST_F( + HistoryBackendTest, + ReserveNextClusterId_AddVisitsToCluster_GetCluster_GetClusterIdContainingVisit) { int64_t cluster_id = backend_->ReserveNextClusterId(); AddAnnotatedVisit(1); @@ -4106,6 +4108,9 @@ backend_->AddVisitsToCluster(cluster_id, {visit_1, visit_2}); VerifyCluster(backend_->GetCluster(cluster_id, false), {cluster_id, {2, 1}}); + + int64_t received_cluster_id = backend_->GetClusterIdContainingVisit(2); + EXPECT_EQ(received_cluster_id, cluster_id); } TEST_F(
diff --git a/components/history/core/browser/sync/history_backend_for_sync.h b/components/history/core/browser/sync/history_backend_for_sync.h index fb0ce22..a7d0cef92 100644 --- a/components/history/core/browser/sync/history_backend_for_sync.h +++ b/components/history/core/browser/sync/history_backend_for_sync.h
@@ -60,6 +60,7 @@ const history::ClusterVisit& cluster_visit, const std::string& originator_cache_guid, int64_t originator_cluster_id) = 0; + virtual int64_t GetClusterIdContainingVisit(VisitID visit_id) = 0; virtual std::vector<GURL> GetFaviconURLsForURL(const GURL& page_url) = 0;
diff --git a/components/history/core/browser/sync/history_sync_bridge.cc b/components/history/core/browser/sync/history_sync_bridge.cc index 55eccab..5d10c88 100644 --- a/components/history/core/browser/sync/history_sync_bridge.cc +++ b/components/history/core/browser/sync/history_sync_bridge.cc
@@ -281,6 +281,7 @@ bool redirect_chain_middle_trimmed, const GURL& referrer_url, const std::vector<GURL>& favicon_urls, + int64_t local_cluster_id, std::vector<VisitID>* included_visit_ids) { DCHECK(!local_cache_guid.empty()); DCHECK(!redirect_visits.empty()); @@ -405,6 +406,8 @@ } } + history->set_originator_cluster_id(local_cluster_id); + // The entity name is used for debugging purposes; choose something that's a // decent tradeoff between "unique" and "readable". entity_data->name = @@ -996,12 +999,17 @@ // Convert the current subchain into a SyncEntity. GURL referrer_url = GetURLForVisit(annotated_visits.front().visit_row.referring_visit); + // Note: `favicon_urls` may legitimately be empty, that's fine. std::vector<GURL> favicon_urls = history_backend_->GetFaviconURLsForURL( annotated_visits.back().url_row.url()); - // Note: `favicon_urls` may legitimately be empty, that's fine. - entities.push_back(MakeEntityData(GetLocalCacheGuid(), annotated_visits, - chain_middle_trimmed, referrer_url, - favicon_urls, included_visit_ids)); + // Note: `local_cluster_id` can legitimately be 0 and only get it for the + // first visit, as the cluster id for everything in the redirect chain + // should be the same (except potentially in unit tests). + int64_t local_cluster_id = history_backend_->GetClusterIdContainingVisit( + redirect_visits.front().visit_id); + entities.push_back(MakeEntityData( + GetLocalCacheGuid(), annotated_visits, chain_middle_trimmed, + referrer_url, favicon_urls, local_cluster_id, included_visit_ids)); } return entities; }
diff --git a/components/history/core/browser/sync/history_sync_bridge_unittest.cc b/components/history/core/browser/sync/history_sync_bridge_unittest.cc index feaf532e..6584fe2 100644 --- a/components/history/core/browser/sync/history_sync_bridge_unittest.cc +++ b/components/history/core/browser/sync/history_sync_bridge_unittest.cc
@@ -888,6 +888,7 @@ ASSERT_TRUE(entity2.specifics.has_history()); const sync_pb::HistorySpecifics& history2 = entity2.specifics.history(); EXPECT_EQ(history2.originator_referring_visit_id(), visit_row1.visit_id); + EXPECT_NE(history2.originator_cluster_id(), 0); EXPECT_EQ(history2.referrer_url(), url_row1.url()); } @@ -1194,6 +1195,7 @@ EXPECT_EQ(history2.redirect_entries(0).url(), url_row3.url()); EXPECT_EQ(history2.redirect_entries(1).url(), url_row4.url()); EXPECT_EQ(history2.originator_referring_visit_id(), visit_row2.visit_id); + EXPECT_NE(history2.originator_cluster_id(), 0); EXPECT_TRUE(history2.redirect_chain_start_incomplete()); EXPECT_FALSE(history2.redirect_chain_end_incomplete()); }
diff --git a/components/history/core/browser/sync/test_history_backend_for_sync.cc b/components/history/core/browser/sync/test_history_backend_for_sync.cc index eb25e19c..dcbafa78 100644 --- a/components/history/core/browser/sync/test_history_backend_for_sync.cc +++ b/components/history/core/browser/sync/test_history_backend_for_sync.cc
@@ -290,6 +290,12 @@ ++add_visit_to_synced_cluster_count_; } +int64_t TestHistoryBackendForSync::GetClusterIdContainingVisit( + VisitID visit_id) { + // For testing purposes, just put every visit in a different cluster. + return 1000 + static_cast<int64_t>(visit_id); +} + std::vector<GURL> TestHistoryBackendForSync::GetFaviconURLsForURL( const GURL& page_url) { // For the unit tests based on this class, favicon URLs aren't required.
diff --git a/components/history/core/browser/sync/test_history_backend_for_sync.h b/components/history/core/browser/sync/test_history_backend_for_sync.h index a2c369d5..ae7dec5 100644 --- a/components/history/core/browser/sync/test_history_backend_for_sync.h +++ b/components/history/core/browser/sync/test_history_backend_for_sync.h
@@ -72,6 +72,7 @@ void AddVisitToSyncedCluster(const ClusterVisit& cluster_visit, const std::string& originator_cache_guid, int64_t originator_cluster_id) override; + int64_t GetClusterIdContainingVisit(VisitID visit_id) override; std::vector<GURL> GetFaviconURLsForURL(const GURL& page_url) override; void MarkVisitAsKnownToSync(VisitID visit_id) override; void DeleteAllForeignVisitsAndResetIsKnownToSync() override;
diff --git a/components/lookalikes/core/lookalike_url_util.cc b/components/lookalikes/core/lookalike_url_util.cc index e9e8fec..e64c4bc0 100644 --- a/components/lookalikes/core/lookalike_url_util.cc +++ b/components/lookalikes/core/lookalike_url_util.cc
@@ -16,7 +16,6 @@ #include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h" #include "base/values.h" @@ -726,13 +725,12 @@ bool is_new_heuristic) { const char* const kNewHeuristicMessage = "Future Chrome versions will show a warning on this domain name.\n"; - return base::StringPrintf( - "Chrome has determined that %s could be fake or fraudulent.\n\n" - "%s" - "If you believe this is shown in error please visit " - "https://g.co/chrome/lookalike-warnings", - lookalike_url.host().c_str(), - is_new_heuristic ? kNewHeuristicMessage : ""); + return base::StrCat({"Chrome has determined that ", + lookalike_url.host_piece(), + " could be fake or fraudulent.\n\n", + is_new_heuristic ? kNewHeuristicMessage : "", + "If you believe this is shown in error please visit " + "https://g.co/chrome/lookalike-warnings"}); } DomainInfo::DomainInfo(
diff --git a/components/metrics/content/content_stability_metrics_provider.cc b/components/metrics/content/content_stability_metrics_provider.cc index 611dd2c..7e6881a 100644 --- a/components/metrics/content/content_stability_metrics_provider.cc +++ b/components/metrics/content/content_stability_metrics_provider.cc
@@ -36,8 +36,6 @@ content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, content::NotificationService::AllSources()); - registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, - content::NotificationService::AllSources()); #if BUILDFLAG(IS_ANDROID) auto* crash_manager = crash_reporter::CrashMetricsReporter::GetInstance(); @@ -66,6 +64,13 @@ } #endif // BUILDFLAG(IS_ANDROID) +void ContentStabilityMetricsProvider::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { + bool was_extension_process = + extensions_helper_ && extensions_helper_->IsExtensionProcess(host); + helper_.LogRendererLaunched(was_extension_process); +} + void ContentStabilityMetricsProvider::Observe( int type, const content::NotificationSource& source, @@ -91,17 +96,9 @@ break; } - case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: + case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: { helper_.LogRendererHang(); break; - - case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - bool was_extension_process = - extensions_helper_ && - extensions_helper_->IsExtensionProcess( - content::Source<content::RenderProcessHost>(source).ptr()); - helper_.LogRendererLaunched(was_extension_process); - break; } default:
diff --git a/components/metrics/content/content_stability_metrics_provider.h b/components/metrics/content/content_stability_metrics_provider.h index ea40566..8a5560c 100644 --- a/components/metrics/content/content_stability_metrics_provider.h +++ b/components/metrics/content/content_stability_metrics_provider.h
@@ -15,6 +15,7 @@ #include "content/public/browser/browser_child_process_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/render_process_host_creation_observer.h" #if BUILDFLAG(IS_ANDROID) #include "components/crash/content/browser/crash_metrics_reporter_android.h" @@ -34,6 +35,7 @@ #if BUILDFLAG(IS_ANDROID) public crash_reporter::CrashMetricsReporter::Observer, #endif + public content::RenderProcessHostCreationObserver, public content::NotificationObserver { public: // |extensions_helper| is used to determine if a process corresponds to an @@ -70,6 +72,9 @@ FRIEND_TEST_ALL_PREFIXES(ContentStabilityMetricsProviderTest, ExtensionsNotificationObserver); + // content::RenderProcessHostCreationObserver: + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; + // content::NotificationObserver: void Observe(int type, const content::NotificationSource& source,
diff --git a/components/metrics/structured/recorder.cc b/components/metrics/structured/recorder.cc index 24473ef..03a301a 100644 --- a/components/metrics/structured/recorder.cc +++ b/components/metrics/structured/recorder.cc
@@ -13,8 +13,7 @@ #include "components/metrics/structured/structured_metrics_features.h" #include "components/metrics/structured/structured_metrics_validator.h" -namespace metrics { -namespace structured { +namespace metrics::structured { Recorder::Recorder() = default; Recorder::~Recorder() = default; @@ -42,10 +41,13 @@ DCHECK(base::CurrentUIThread::IsSet()); + delegating_events_processor_.OnEventsRecord(&event); + // Make a copy of an event that all observers can share. const auto event_clone = event.Clone(); - for (auto& observer : observers_) + for (auto& observer : observers_) { observer.OnEventRecord(event_clone); + } if (observers_.empty()) { // Other values of EventRecordingState are recorded in @@ -60,14 +62,16 @@ DCHECK(base::CurrentUIThread::IsSet()); // TODO(crbug.com/1016655 ): investigate whether we can verify that // |profile_path| corresponds to a valid (non-guest, non-signin) profile. - for (auto& observer : observers_) + for (auto& observer : observers_) { observer.OnProfileAdded(profile_path); + } } absl::optional<int> Recorder::LastKeyRotation(const Event& event) { auto project_validator = validator::GetProjectValidator(event.project_name()); - if (!project_validator.has_value()) + if (!project_validator.has_value()) { return absl::nullopt; + } auto project_name_hash = project_validator.value()->project_hash(); @@ -105,5 +109,9 @@ observers_.RemoveObserver(observer); } -} // namespace structured -} // namespace metrics +void Recorder::AddEventsProcessor( + std::unique_ptr<EventsProcessorInterface> events_processor) { + delegating_events_processor_.AddEventsProcessor(std::move(events_processor)); +} + +} // namespace metrics::structured
diff --git a/components/metrics/structured/recorder.h b/components/metrics/structured/recorder.h index 7e484b7..703e08bf 100644 --- a/components/metrics/structured/recorder.h +++ b/components/metrics/structured/recorder.h
@@ -19,8 +19,7 @@ class FilePath; } -namespace metrics { -namespace structured { +namespace metrics::structured { // Recorder is a singleton to help communicate with the // StructuredMetricsProvider. It serves three purposes: @@ -88,6 +87,11 @@ void AddObserver(RecorderImpl* observer); void RemoveObserver(RecorderImpl* observer); + // Adds |events_processor| to further add metadata to recorded events or + // listen to recorded events. + void AddEventsProcessor( + std::unique_ptr<EventsProcessorInterface> events_processor); + private: friend class base::NoDestructor<Recorder>; @@ -97,9 +101,10 @@ scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; base::ObserverList<RecorderImpl> observers_; + + DelegatingEventsProcessor delegating_events_processor_; }; -} // namespace structured -} // namespace metrics +} // namespace metrics::structured #endif // COMPONENTS_METRICS_STRUCTURED_RECORDER_H_
diff --git a/components/metrics/structured/structured_metrics_client.cc b/components/metrics/structured/structured_metrics_client.cc index 620f9e0..41f96e13 100644 --- a/components/metrics/structured/structured_metrics_client.cc +++ b/components/metrics/structured/structured_metrics_client.cc
@@ -9,8 +9,7 @@ #include "base/no_destructor.h" #include "components/metrics/structured/event.h" -namespace metrics { -namespace structured { +namespace metrics::structured { StructuredMetricsClient::StructuredMetricsClient() = default; StructuredMetricsClient::~StructuredMetricsClient() = default; @@ -23,16 +22,10 @@ void StructuredMetricsClient::Record(Event&& event) { if (delegate_ && delegate_->IsReadyToRecord()) { - delegating_events_processor_.OnEventsRecord(&event); delegate_->RecordEvent(std::move(event)); } } -void StructuredMetricsClient::AddEventsProcessor( - std::unique_ptr<EventsProcessorInterface> events_processor) { - delegating_events_processor_.AddEventsProcessor(std::move(events_processor)); -} - void StructuredMetricsClient::SetDelegate(RecordingDelegate* delegate) { delegate_ = delegate; } @@ -41,5 +34,4 @@ delegate_ = nullptr; } -} // namespace structured -} // namespace metrics +} // namespace metrics::structured
diff --git a/components/metrics/structured/structured_metrics_client.h b/components/metrics/structured/structured_metrics_client.h index f13051b8..6b534be 100644 --- a/components/metrics/structured/structured_metrics_client.h +++ b/components/metrics/structured/structured_metrics_client.h
@@ -12,8 +12,7 @@ #include "components/metrics/structured/event.h" #include "components/metrics/structured/events_processor_interface.h" -namespace metrics { -namespace structured { +namespace metrics::structured { // Singleton to interact with StructuredMetrics. // @@ -43,11 +42,6 @@ // Forwards to |delegate_|. If no delegate has been set, then no-op. void Record(Event&& event); - // Adds |events_processor| to further add metadata to recorded events or - // listen to recorded events. - void AddEventsProcessor( - std::unique_ptr<EventsProcessorInterface> events_processor); - // Sets the delegate for the client's recording logic. Should be called before // anything else. |this| does not take ownership of |delegate| and assumes // that the caller will properly manage the lifetime of delegate and call @@ -61,13 +55,10 @@ StructuredMetricsClient(); ~StructuredMetricsClient(); - DelegatingEventsProcessor delegating_events_processor_; - // Not owned. Assumes that the delegate's lifetime will exceed |this|. raw_ptr<RecordingDelegate> delegate_ = nullptr; }; -} // namespace structured -} // namespace metrics +} // namespace metrics::structured #endif // COMPONENTS_METRICS_STRUCTURED_STRUCTURED_METRICS_CLIENT_H_
diff --git a/components/mirroring/service/openscreen_session_host_unittest.cc b/components/mirroring/service/openscreen_session_host_unittest.cc index c1f4373..98eddfe 100644 --- a/components/mirroring/service/openscreen_session_host_unittest.cc +++ b/components/mirroring/service/openscreen_session_host_unittest.cc
@@ -789,7 +789,7 @@ TEST_F(OpenscreenSessionHostTest, Av1CodecEnabledInOffer) { // Cast streaming of AV1 is desktop only. -#if !BUILDFLAG(IS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) && defined(ENABLE_LIBAOM) base::test::ScopedFeatureList feature_list(media::kCastStreamingAv1); CreateSession(SessionType::VIDEO_ONLY);
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index f7f8f064..b78887cb 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc
@@ -64,9 +64,9 @@ #include "sandbox/policy/mojom/sandbox.mojom.h" #include "sandbox/policy/switches.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/public/common/zygote/zygote_handle.h" // nogncheck -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_POSIX) @@ -194,11 +194,11 @@ } #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) content::ZygoteCommunication* GetZygote() override { return content::GetGenericZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) sandbox::mojom::Sandbox GetSandboxType() override { return sandbox::mojom::Sandbox::kPpapi;
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc index a0be720..dd72899 100644 --- a/components/omnibox/browser/history_quick_provider_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -1182,10 +1182,11 @@ TEST_F(HQPOrderingTest, TEMatch) { std::vector<std::string> expected_urls; - expected_urls.push_back("http://techmeme.com/"); expected_urls.push_back("http://www.teamliquid.net/"); + expected_urls.push_back("http://techmeme.com/"); expected_urls.push_back("http://www.teamliquid.net/tlpd"); - RunTest(u"te", false, expected_urls, true, u"techmeme.com", u"chmeme.com"); + RunTest(u"te", false, expected_urls, true, u"www.teamliquid.net", + u"amliquid.net"); } TEST_F(HQPOrderingTest, TEAMatch) {
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc index 0c18e529..e0466e17 100644 --- a/components/omnibox/common/omnibox_features.cc +++ b/components/omnibox/common/omnibox_features.cc
@@ -60,7 +60,7 @@ // tweaks specifically are enabled. Enabling this feature without params is a // no-op. // TODO(manukh) Enabled by default on 10/20/22 m109. Clean up feature code -// 2/7/22, when m110 reaches stable. +// 2/7/23, when m110 reaches stable. BASE_FEATURE(kAutocompleteStability, "OmniboxAutocompleteStability", base::FEATURE_ENABLED_BY_DEFAULT); @@ -68,7 +68,7 @@ // Feature to enable memoizing and filtering non-doc hosts for // `DocumentProvider::GetURLForDeduping()`. // TODO(manukh) Enabled by default on 10/20/22 m109. Clean up feature code -// 2/7/22, when m110 reaches stable. +// 2/7/23, when m110 reaches stable. BASE_FEATURE(kDocumentProviderDedupingOptimization, "OmniboxDocumentProviderDedupingOptimization", base::FEATURE_ENABLED_BY_DEFAULT); @@ -110,7 +110,7 @@ // Feature to enable memoizing URLs when replacing search terms in // `AutocompleteMatch::GURLToStrippedGURL()`. // TODO(manukh) Enabled by default on 10/20/22 m109. Clean up feature code -// 2/7/22, when m110 reaches stable. +// 2/7/23, when m110 reaches stable. BASE_FEATURE(kStrippedGurlOptimization, "OmniboxStrippedGurlOptimization", base::FEATURE_ENABLED_BY_DEFAULT); @@ -329,9 +329,10 @@ // HQP scores suggestions higher when it finds fewer matches. When enabled, // HQP will consider the count of unique hosts, rather than the total count of // matches. +// TODO(manukh): Clean up 3/7/23 when m111 reaches stable. BASE_FEATURE(kHistoryQuickProviderSpecificityScoreCountUniqueHosts, "OmniboxHistoryQuickProviderSpecificityScoreCountUniqueHosts", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Feature used to fetch document suggestions. BASE_FEATURE(kDocumentProvider,
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc index 23ee1910..f00c2c6 100644 --- a/components/page_info/page_info_ui.cc +++ b/components/page_info/page_info_ui.cc
@@ -243,18 +243,11 @@ std::make_unique<PageInfoUI::SecurityDescription>(); security_description->summary_style = PageInfoUI::SecuritySummaryColor::RED; - if (safety_tip_status == security_state::SafetyTipStatus::kBadReputation || - safety_tip_status == - security_state::SafetyTipStatus::kBadReputationIgnored) { - security_description->summary = l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE); - } else { - const std::u16string safe_host = - security_interstitials::common_string_util::GetFormattedHostName( - safe_url); - security_description->summary = l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SAFETY_TIP_LOOKALIKE_TITLE, safe_host); - } + const std::u16string safe_host = + security_interstitials::common_string_util::GetFormattedHostName( + safe_url); + security_description->summary = l10n_util::GetStringFUTF16( + IDS_PAGE_INFO_SAFETY_TIP_LOOKALIKE_TITLE, safe_host); security_description->details = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_DESCRIPTION); security_description->type = PageInfoUI::SecurityDescriptionType::SAFETY_TIP; @@ -991,18 +984,10 @@ PageInfoUI::CreateSafetyTipSecurityDescription( const security_state::SafetyTipInfo& info) { switch (info.status) { - case security_state::SafetyTipStatus::kBadReputation: - case security_state::SafetyTipStatus::kBadReputationIgnored: case security_state::SafetyTipStatus::kLookalike: case security_state::SafetyTipStatus::kLookalikeIgnored: return CreateSecurityDescriptionForSafetyTip(info.status, info.safe_url); - case security_state::SafetyTipStatus::kBadKeyword: - // Keyword safety tips are only used to collect metrics for now and are - // not visible to the user, so don't affect Page Info. - break; - - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: case security_state::SafetyTipStatus::kNone: case security_state::SafetyTipStatus::kUnknown: break;
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 09db8855..c68942b 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -45,12 +45,6 @@ </message> <!-- Safety Tip summary strings --> - <message name="IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE" desc="Message to display in the page info bubble when the page you are on triggered a safety tip."> - Suspicious site - </message> - <message name="IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_LEAVE_BUTTON" desc="Text of button to leave a suspicious page. Shown on the safety tip page info bubble."> - Leave site - </message> <message name="IDS_PAGE_INFO_SAFETY_TIP_MORE_INFO_LINK" desc="Text of link to Help Center page on safety tip page info bubble."> Learn more </message>
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_LEAVE_BUTTON.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_LEAVE_BUTTON.png.sha1 deleted file mode 100644 index 4555822..0000000 --- a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_LEAVE_BUTTON.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -7c31bdad65442b5fc6f7ccd1283ab6d54bd5bdd7 \ No newline at end of file
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1 deleted file mode 100644 index f5f4107..0000000 --- a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -a529530d0ddcd81921d7f17316a5ddb453b3aef6 \ No newline at end of file
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 4cbb69a..5bb97f3 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -85,6 +85,7 @@ using testing::DoAll; using testing::ElementsAre; using testing::IsEmpty; +using testing::IsNull; using testing::Mock; using testing::NiceMock; using testing::Pointee; @@ -142,28 +143,21 @@ class MockAutofillDownloadManager : public autofill::AutofillDownloadManager { public: - MockAutofillDownloadManager() - : AutofillDownloadManager(nullptr, nullptr, &fake_observer) {} + MockAutofillDownloadManager() : AutofillDownloadManager(nullptr) {} MockAutofillDownloadManager(const MockAutofillDownloadManager&) = delete; MockAutofillDownloadManager& operator=(const MockAutofillDownloadManager&) = delete; - MOCK_METHOD6(StartUploadRequest, - bool(const FormStructure&, - bool, - const ServerFieldTypeSet&, - const std::string&, - bool, - PrefService*)); - - private: - class StubObserver : public AutofillDownloadManager::Observer { - void OnLoadedServerPredictions( - std::string response, - const std::vector<autofill::FormSignature>& form_signatures) override {} - }; - - StubObserver fake_observer; + MOCK_METHOD(bool, + StartUploadRequest, + (const FormStructure&, + bool, + const ServerFieldTypeSet&, + const std::string&, + bool, + PrefService*, + base::WeakPtr<Observer>), + (override)); }; class MockPasswordManagerClient : public StubPasswordManagerClient { @@ -452,8 +446,7 @@ ON_CALL(*client_.GetPasswordFeatureManager(), ShouldShowAccountStorageBubbleUi) .WillByDefault(Return(true)); - ON_CALL(mock_autofill_download_manager_, - StartUploadRequest(_, _, _, _, _, _)) + ON_CALL(mock_autofill_download_manager_, StartUploadRequest) .WillByDefault(Return(true)); ON_CALL(*client_.GetPasswordFeatureManager(), GetDefaultPasswordStore) .WillByDefault(Return(PasswordForm::Store::kProfileStore)); @@ -1169,13 +1162,14 @@ expected_types[u"password2"] = expected_vote; testing::InSequence in_sequence; - EXPECT_CALL(mock_autofill_download_manager_, - StartUploadRequest(UploadedAutofillTypesAre(expected_types), - false, _, _, true, nullptr)); + EXPECT_CALL( + mock_autofill_download_manager_, + StartUploadRequest(UploadedAutofillTypesAre(expected_types), false, _, + _, true, nullptr, /*observer=*/IsNull())); if (expected_vote == autofill::NEW_PASSWORD) { // An unrelated |FIRST_USE| vote. EXPECT_CALL(mock_autofill_download_manager_, - StartUploadRequest(_, _, _, _, _, _)); + StartUploadRequest(_, _, _, _, _, _, /*observer=*/IsNull())); } if (expected_vote == autofill::NEW_PASSWORD) @@ -1226,12 +1220,12 @@ {u"password", autofill::PASSWORD}}; VoteTypeMap expected_vote_types = { {u"firstname", AutofillUploadContents::Field::USERNAME_EDITED}}; - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest( - AllOf(UploadedAutofillTypesAre(expected_types), - HasGenerationVote(false), VoteTypesAre(expected_vote_types)), - _, Contains(autofill::USERNAME), _, _, nullptr)); + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest(AllOf(UploadedAutofillTypesAre(expected_types), + HasGenerationVote(false), + VoteTypesAre(expected_vote_types)), + _, Contains(autofill::USERNAME), _, _, nullptr, + /*observer=*/IsNull())); form_manager_->Save(); } @@ -1270,7 +1264,7 @@ // TODO(https://crbug.com/928690): implement not sending incorrect votes and // check that StartUploadRequest is not called. EXPECT_CALL(mock_autofill_download_manager_, - StartUploadRequest(_, _, _, _, _, _)) + StartUploadRequest(_, _, _, _, _, _, /*observer=*/IsNull())) .Times(1); form_manager_->Save(); } @@ -1322,9 +1316,10 @@ std::map<std::u16string, ServerFieldType> expected_types; expected_types[expected.password_element] = autofill::PASSWORD; - EXPECT_CALL(mock_autofill_download_manager_, - StartUploadRequest(UploadedAutofillTypesAre(expected_types), - false, _, _, true, nullptr)); + EXPECT_CALL( + mock_autofill_download_manager_, + StartUploadRequest(UploadedAutofillTypesAre(expected_types), false, _, _, + true, nullptr, /*observer=*/IsNull())); // Check that the password which was chosen by the user is saved. MockFormSaver& form_saver = MockFormSaver::Get(form_manager_.get()); @@ -1944,9 +1939,10 @@ if (password_revealed) form_manager_->OnPasswordsRevealed(); - EXPECT_CALL(mock_autofill_download_manager_, - StartUploadRequest(PasswordsWereRevealed(password_revealed), - false, _, _, true, nullptr)); + EXPECT_CALL( + mock_autofill_download_manager_, + StartUploadRequest(PasswordsWereRevealed(password_revealed), false, _, + _, true, nullptr, /*observer=*/IsNull())); form_manager_->Save(); Mock::VerifyAndClearExpectations(&mock_autofill_download_manager_); } @@ -1967,9 +1963,9 @@ EXPECT_TRUE( form_manager_->ProvisionallySave(submitted_form_, &driver_, nullptr)); - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest(HasGenerationVote(true), false, _, _, true, nullptr)) + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest(HasGenerationVote(true), false, _, _, true, + nullptr, /*observer=*/IsNull())) .Times(generation_popup_shown ? 1 : 0); form_manager_->OnNoInteraction(false /*is_update */); Mock::VerifyAndClearExpectations(&mock_autofill_download_manager_); @@ -1991,9 +1987,9 @@ EXPECT_TRUE( form_manager_->ProvisionallySave(submitted_form_, &driver_, nullptr)); - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest(HasGenerationVote(true), false, _, _, true, nullptr)) + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest(HasGenerationVote(true), false, _, _, true, + nullptr, /*observer=*/IsNull())) .Times(generation_popup_shown ? 1 : 0); form_manager_->OnNeverClicked(); Mock::VerifyAndClearExpectations(&mock_autofill_download_manager_); @@ -2336,7 +2332,7 @@ EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(SignatureIs(kSingleUsernameFormSignature), false, ServerFieldTypeSet{SINGLE_USERNAME}, - _, true, nullptr)); + _, true, nullptr, /*observer=*/IsNull())); #endif // !BUILDFLAG(IS_ANDROID) // Upload username first flow votes on the password form. @@ -2364,14 +2360,14 @@ StartUploadRequest( AllOf(SignatureIs(CalculateFormSignature(submitted_form)), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); if (is_password_update) { // Expect another upload for first login votes. This upload is not related // to UFF, so it should not contain single username data. - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest(SingleUsernameDataNotUploaded(), _, _, _, _, _)); + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest(SingleUsernameDataNotUploaded(), _, _, _, + _, _, /*observer=*/IsNull())); } base::HistogramTester histogram_tester; @@ -2426,7 +2422,7 @@ EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(SignatureIs(kSingleUsernameFormSignature), false, ServerFieldTypeSet{SINGLE_USERNAME}, _, - true, nullptr)); + true, nullptr, /*observer=*/IsNull())); #endif // !BUILDFLAG(IS_ANDROID) // Upload username first flow vote on the sign-up form. @@ -2452,7 +2448,7 @@ StartUploadRequest( AllOf(SignatureIs(CalculateFormSignature(submitted_form_)), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); // Simulate showing the prompt and saving the suggested value. form_manager_->SaveSuggestedUsernameValueToVotesUploader(); @@ -2528,10 +2524,10 @@ // Upload for the username form. Ensure that we send `NOT_USERNAME` for the // username field. #if !BUILDFLAG(IS_ANDROID) - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest(SignatureIs(kUsernameFormSignature), false, - ServerFieldTypeSet{NOT_USERNAME}, _, true, nullptr)); + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest(SignatureIs(kUsernameFormSignature), false, + ServerFieldTypeSet{NOT_USERNAME}, _, true, + nullptr, /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -2559,7 +2555,7 @@ StartUploadRequest( AllOf(SignatureIs(CalculateFormSignature(submitted_form)), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); base::HistogramTester histogram_tester; @@ -2613,7 +2609,7 @@ // No single username upload for the username form with a nameless field. EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(SignatureIs(kSingleUsernameFormSignature), _, - _, _, _, _)) + _, _, _, _, /*observer=*/IsNull())) .Times(0); // Upload single username data for the password form. @@ -2626,7 +2622,7 @@ StartUploadRequest( AllOf(SignatureIs(CalculateFormSignature(submitted_form)), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); form_manager_->Save(); }
diff --git a/components/password_manager/core/browser/password_save_manager_impl_unittest.cc b/components/password_manager/core/browser/password_save_manager_impl_unittest.cc index fd1f6d5..c59a89d9 100644 --- a/components/password_manager/core/browser/password_save_manager_impl_unittest.cc +++ b/components/password_manager/core/browser/password_save_manager_impl_unittest.cc
@@ -170,8 +170,7 @@ class MockAutofillDownloadManager : public autofill::AutofillDownloadManager { public: - MockAutofillDownloadManager() - : AutofillDownloadManager(nullptr, nullptr, &fake_observer) {} + MockAutofillDownloadManager() : AutofillDownloadManager(nullptr) {} MockAutofillDownloadManager(const MockAutofillDownloadManager&) = delete; MockAutofillDownloadManager& operator=(const MockAutofillDownloadManager&) = delete; @@ -183,17 +182,9 @@ const autofill::ServerFieldTypeSet&, const std::string&, bool, - PrefService*), + PrefService*, + base::WeakPtr<Observer>), (override)); - - private: - class StubObserver : public AutofillDownloadManager::Observer { - void OnLoadedServerPredictions( - std::string response, - const std::vector<autofill::FormSignature>& form_signatures) override {} - }; - - StubObserver fake_observer; }; } // namespace @@ -959,7 +950,7 @@ EXPECT_CALL(*mock_autofill_download_manager(), StartUploadRequest(UploadedAutofillTypesAre(expected_types), - false, _, _, true, nullptr)); + false, _, _, true, nullptr, _)); // Check that the password which was chosen by the user is saved. PasswordForm saved_form;
diff --git a/components/password_manager/core/browser/votes_uploader.cc b/components/password_manager/core/browser/votes_uploader.cc index ed3c5046..44987024 100644 --- a/components/password_manager/core/browser/votes_uploader.cc +++ b/components/password_manager/core/browser/votes_uploader.cc
@@ -460,8 +460,8 @@ // code duplication. bool success = download_manager->StartUploadRequest( form_structure, false /* was_autofilled */, available_field_types, - login_form_signature, true /* observed_submission */, - nullptr /* prefs */); + login_form_signature, true /* observed_submission */, nullptr /* prefs */, + nullptr /* observer */); UMA_HISTOGRAM_BOOLEAN("PasswordGeneration.UploadStarted", success); return success; @@ -526,7 +526,8 @@ // code duplication. download_manager->StartUploadRequest( form_structure, false /* was_autofilled */, available_field_types, - std::string(), true /* observed_submission */, nullptr /* prefs */); + std::string(), true /* observed_submission */, nullptr /* prefs */, + nullptr); } void VotesUploader::SetInitialHashValueOfUsernameField( @@ -836,7 +837,8 @@ return download_manager->StartUploadRequest( *form_to_upload, false /* was_autofilled */, available_field_types, - std::string(), true /* observed_submission */, nullptr /* prefs */); + std::string(), true /* observed_submission */, nullptr /* prefs */, + nullptr); } void VotesUploader::SaveFieldVote(FormSignature form_signature,
diff --git a/components/password_manager/core/browser/votes_uploader_unittest.cc b/components/password_manager/core/browser/votes_uploader_unittest.cc index 88b752d7..da5cb5c 100644 --- a/components/password_manager/core/browser/votes_uploader_unittest.cc +++ b/components/password_manager/core/browser/votes_uploader_unittest.cc
@@ -59,6 +59,7 @@ using testing::_; using testing::AllOf; using testing::AnyNumber; +using testing::IsNull; using testing::Return; using testing::SaveArg; @@ -101,29 +102,22 @@ class MockAutofillDownloadManager : public AutofillDownloadManager { public: - MockAutofillDownloadManager() - : AutofillDownloadManager(nullptr, nullptr, &fake_observer) {} + MockAutofillDownloadManager() : AutofillDownloadManager(nullptr) {} MockAutofillDownloadManager(const MockAutofillDownloadManager&) = delete; MockAutofillDownloadManager& operator=(const MockAutofillDownloadManager&) = delete; - MOCK_METHOD6(StartUploadRequest, - bool(const FormStructure&, - bool, - const ServerFieldTypeSet&, - const std::string&, - bool, - PrefService*)); - - private: - class StubObserver : public AutofillDownloadManager::Observer { - void OnLoadedServerPredictions( - std::string response, - const std::vector<autofill::FormSignature>& form_signatures) override {} - }; - - StubObserver fake_observer; + MOCK_METHOD(bool, + StartUploadRequest, + (const FormStructure&, + bool, + const ServerFieldTypeSet&, + const std::string&, + bool, + PrefService*, + base::WeakPtr<Observer>), + (override)); }; class MockPasswordManagerClient : public StubPasswordManagerClient { @@ -152,8 +146,7 @@ EXPECT_CALL(client_, GetAutofillDownloadManager()) .WillRepeatedly(Return(&mock_autofill_download_manager_)); - ON_CALL(mock_autofill_download_manager_, - StartUploadRequest(_, _, _, _, _, _)) + ON_CALL(mock_autofill_download_manager_, StartUploadRequest) .WillByDefault(Return(true)); // Create |fields| in |form_to_upload_| and |submitted_form_|. Only |name| @@ -206,13 +199,13 @@ SubmissionIndicatorEvent expected_submission_event = SubmissionIndicatorEvent::HTML_FORM_SUBMISSION; - EXPECT_CALL( - mock_autofill_download_manager_, - StartUploadRequest( - AllOf(SignatureIsSameAs(form_to_upload_), - UploadedAutofillTypesAre(expected_types), - SubmissionEventIsSameAs(expected_submission_event)), - false, expected_field_types, login_form_signature_, true, nullptr)); + EXPECT_CALL(mock_autofill_download_manager_, + StartUploadRequest( + AllOf(SignatureIsSameAs(form_to_upload_), + UploadedAutofillTypesAre(expected_types), + SubmissionEventIsSameAs(expected_submission_event)), + false, expected_field_types, login_form_signature_, true, + nullptr, /*observer=*/IsNull())); EXPECT_TRUE(votes_uploader.UploadPasswordVote( form_to_upload_, submitted_form_, NEW_PASSWORD, login_form_signature_)); @@ -236,7 +229,7 @@ StartUploadRequest( SubmissionEventIsSameAs(expected_submission_event), false, expected_field_types, login_form_signature_, true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, /*observer=*/IsNull())); EXPECT_TRUE(votes_uploader.UploadPasswordVote( form_to_upload_, submitted_form_, PASSWORD, login_form_signature_)); @@ -311,7 +304,8 @@ StartUploadRequest( HasPasswordAttributesVote(expect_password_attributes), false, _, login_form_signature_, true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, + /*observer=*/IsNull())); EXPECT_TRUE(votes_uploader.UploadPasswordVote( form_to_upload_, submitted_form_, autofill_type, @@ -525,7 +519,7 @@ UploadedSingleUsernameVoteTypeIs( autofill::AutofillUploadContents::Field::WEAK)), false, expected_types, std::string(), true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -566,7 +560,7 @@ UploadedSingleUsernameVoteTypeIs( autofill::AutofillUploadContents::Field::STRONG)), false, expected_types, std::string(), true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, /*observer=*/IsNull())); votes_uploader.MaybeSendSingleUsernameVote(); @@ -587,7 +581,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); @@ -628,7 +622,8 @@ /*form_was_autofilled=*/false, expected_types, /*login_form_signature=*/"", /*observed_submission=*/true, - /*pref_service=*/nullptr)); + /*pref_service=*/nullptr, + /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -650,7 +645,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); @@ -693,7 +688,8 @@ /*form_was_autofilled=*/false, expected_types, /*login_form_signature=*/"", /*observed_submission=*/true, - /*pref_service=*/nullptr)); + /*pref_service=*/nullptr, + /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -715,7 +711,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); } @@ -756,7 +752,8 @@ /*form_was_autofilled=*/false, expected_types, /*login_form_signature=*/"", /*observed_submission=*/true, - /*pref_service=*/nullptr)); + /*pref_service=*/nullptr, + /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -778,7 +775,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); } @@ -818,7 +815,8 @@ /*form_was_autofilled=*/false, expected_types, /*login_form_signature=*/"", /*observed_submission=*/true, - /*pref_service=*/nullptr)); + /*pref_service=*/nullptr, + /*observer=*/IsNull())); #else EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest).Times(0); #endif // !BUILDFLAG(IS_ANDROID) @@ -840,7 +838,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); } @@ -873,7 +871,7 @@ // Expect no upload on username form, as th signal is not informative to us. EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(SignatureIs(kSingleUsernameFormSignature), _, - _, _, _, _)) + _, _, _, _, /*observer=*/IsNull())) .Times(0); votes_uploader.MaybeSendSingleUsernameVote(); @@ -887,7 +885,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); } @@ -928,7 +926,7 @@ StartUploadRequest( AllOf(SignatureIsSameAs(submitted_form_), UploadedSingleUsernameDataIs(expected_single_username_data)), - _, _, _, _, _)); + _, _, _, _, _, /*observer=*/IsNull())); votes_uploader.UploadPasswordVote(submitted_form_, submitted_form_, autofill::PASSWORD, std::string()); } @@ -993,7 +991,7 @@ // uploaded. EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(SignatureIs(kSingleUsernameFormSignature), _, - _, _, _, _)) + _, _, _, _, /*observer=*/IsNull())) .Times(0); votes_uploader.MaybeSendSingleUsernameVote(); @@ -1013,7 +1011,8 @@ EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(_, false, expected_field_types, login_form_signature_, true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, + /*observer=*/IsNull())); base::HistogramTester histogram_tester; EXPECT_TRUE(votes_uploader.UploadPasswordVote( @@ -1038,7 +1037,8 @@ EXPECT_CALL(mock_autofill_download_manager_, StartUploadRequest(_, false, expected_field_types, login_form_signature_, true, - /* pref_service= */ nullptr)); + /* pref_service= */ nullptr, + /*observer=*/IsNull())); base::HistogramTester histogram_tester; EXPECT_TRUE(votes_uploader.UploadPasswordVote(
diff --git a/components/performance_manager/graph/frame_node_impl_unittest.cc b/components/performance_manager/graph/frame_node_impl_unittest.cc index 2e775f6..c01c0cc 100644 --- a/components/performance_manager/graph/frame_node_impl_unittest.cc +++ b/components/performance_manager/graph/frame_node_impl_unittest.cc
@@ -70,10 +70,8 @@ TEST_F(FrameNodeImplTest, GetFrameNodeById) { auto process_a = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(RenderProcessHostId(42))); auto process_b = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(RenderProcessHostId(43))); auto page = CreateNode<PageNodeImpl>(); auto frame_a1 = CreateFrameNodeAutoId(process_a.get(), page.get());
diff --git a/components/performance_manager/graph/graph_impl_unittest.cc b/components/performance_manager/graph/graph_impl_unittest.cc index 5ec8336..63a9bd6 100644 --- a/components/performance_manager/graph/graph_impl_unittest.cc +++ b/components/performance_manager/graph/graph_impl_unittest.cc
@@ -33,8 +33,7 @@ } TEST_F(GraphImplTest, GetProcessNodeByPid) { - TestNodeWrapper<ProcessNodeImpl> process = - TestNodeWrapper<ProcessNodeImpl>::Create(graph()); + TestNodeWrapper<ProcessNodeImpl> process = CreateNode<ProcessNodeImpl>(); EXPECT_EQ(base::kNullProcessId, process->process_id()); EXPECT_FALSE(process->process().IsValid()); @@ -64,10 +63,8 @@ // PID has been reused for a new process. static base::Process self = base::Process::Current(); - TestNodeWrapper<ProcessNodeImpl> process1 = - TestNodeWrapper<ProcessNodeImpl>::Create(graph()); - TestNodeWrapper<ProcessNodeImpl> process2 = - TestNodeWrapper<ProcessNodeImpl>::Create(graph()); + TestNodeWrapper<ProcessNodeImpl> process1 = CreateNode<ProcessNodeImpl>(); + TestNodeWrapper<ProcessNodeImpl> process2 = CreateNode<ProcessNodeImpl>(); process1->SetProcess(self.Duplicate(), /* launch_time=*/base::TimeTicks::Now());
diff --git a/components/performance_manager/graph/process_node_impl.cc b/components/performance_manager/graph/process_node_impl.cc index ea2ce92..01791d99 100644 --- a/components/performance_manager/graph/process_node_impl.cc +++ b/components/performance_manager/graph/process_node_impl.cc
@@ -48,10 +48,24 @@ } // namespace -ProcessNodeImpl::ProcessNodeImpl(content::ProcessType process_type, - RenderProcessHostProxy render_process_proxy) - : process_type_(process_type), - render_process_host_proxy_(std::move(render_process_proxy)) { +ProcessNodeImpl::ProcessNodeImpl(BrowserProcessNodeTag tag) + : process_type_(content::PROCESS_TYPE_BROWSER) { + weak_this_ = weak_factory_.GetWeakPtr(); + DETACH_FROM_SEQUENCE(sequence_checker_); +} + +ProcessNodeImpl::ProcessNodeImpl( + RenderProcessHostProxy render_process_host_proxy) + : process_type_(content::PROCESS_TYPE_RENDERER), + render_process_host_proxy_(std::move(render_process_host_proxy)) { + weak_this_ = weak_factory_.GetWeakPtr(); + DETACH_FROM_SEQUENCE(sequence_checker_); +} + +ProcessNodeImpl::ProcessNodeImpl(content::ProcessType process_type) + : process_type_(process_type) { + DCHECK_NE(process_type, content::PROCESS_TYPE_BROWSER); + DCHECK_NE(process_type, content::PROCESS_TYPE_RENDERER); weak_this_ = weak_factory_.GetWeakPtr(); DETACH_FROM_SEQUENCE(sequence_checker_); } @@ -370,10 +384,12 @@ } ProcessNode::ContentTypes ProcessNodeImpl::GetHostedContentTypes() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return hosted_content_types(); } void ProcessNodeImpl::OnAllFramesInProcessFrozen() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto* observer : GetObservers()) observer->OnAllFramesInProcessFrozen(this); }
diff --git a/components/performance_manager/graph/process_node_impl.h b/components/performance_manager/graph/process_node_impl.h index 4296e18a..eeb6b28 100644 --- a/components/performance_manager/graph/process_node_impl.h +++ b/components/performance_manager/graph/process_node_impl.h
@@ -33,7 +33,10 @@ class ProcessNodeImpl; class WorkerNodeImpl; -// A process node follows the lifetime of a RenderProcessHost. +// Tag used to create a process node for the browser process. +struct BrowserProcessNodeTag {}; + +// A process node follows the lifetime of a chrome process. // It may reference zero or one processes at a time, but during its lifetime, it // may reference more than one process. This can happen if the associated // renderer crashes, and an associated frame is then reloaded or re-navigated. @@ -52,8 +55,14 @@ static constexpr NodeTypeEnum Type() { return NodeTypeEnum::kProcess; } - ProcessNodeImpl(content::ProcessType process_type, - RenderProcessHostProxy render_process_proxy); + // Constructor for the browser process. + explicit ProcessNodeImpl(BrowserProcessNodeTag tag); + + // Constructor for a renderer process. + explicit ProcessNodeImpl(RenderProcessHostProxy render_process_host_proxy); + + // Constructor for a non-renderer child process. + explicit ProcessNodeImpl(content::ProcessType process_type); ProcessNodeImpl(const ProcessNodeImpl&) = delete; ProcessNodeImpl& operator=(const ProcessNodeImpl&) = delete;
diff --git a/components/performance_manager/graph/process_node_impl_unittest.cc b/components/performance_manager/graph/process_node_impl_unittest.cc index 212f1ff..e8f1c49 100644 --- a/components/performance_manager/graph/process_node_impl_unittest.cc +++ b/components/performance_manager/graph/process_node_impl_unittest.cc
@@ -199,21 +199,40 @@ graph()->RemoveProcessNodeObserver(&obs); } -TEST_F(ProcessNodeImplTest, ConstructionArguments) { +TEST_F(ProcessNodeImplTest, ConstructionArguments_Browser) { + auto process_node = CreateNode<ProcessNodeImpl>(BrowserProcessNodeTag{}); + + const ProcessNode* public_process_node = process_node.get(); + + EXPECT_EQ(content::PROCESS_TYPE_BROWSER, process_node->process_type()); + EXPECT_EQ(content::PROCESS_TYPE_BROWSER, + public_process_node->GetProcessType()); +} + +TEST_F(ProcessNodeImplTest, ConstructionArguments_Renderer) { constexpr RenderProcessHostId kRenderProcessHostId = RenderProcessHostId(0xF0B); auto process_node = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_GPU, RenderProcessHostProxy::CreateForTesting(kRenderProcessHostId)); const ProcessNode* public_process_node = process_node.get(); + EXPECT_EQ(content::PROCESS_TYPE_RENDERER, process_node->process_type()); + EXPECT_EQ(content::PROCESS_TYPE_RENDERER, + public_process_node->GetProcessType()); + + EXPECT_EQ(kRenderProcessHostId, + public_process_node->GetRenderProcessHostProxy() + .render_process_host_id()); +} + +TEST_F(ProcessNodeImplTest, ConstructionArguments_NonRenderer) { + auto process_node = CreateNode<ProcessNodeImpl>(content::PROCESS_TYPE_GPU); + + const ProcessNode* public_process_node = process_node.get(); + EXPECT_EQ(content::PROCESS_TYPE_GPU, process_node->process_type()); EXPECT_EQ(content::PROCESS_TYPE_GPU, public_process_node->GetProcessType()); - - EXPECT_EQ(kRenderProcessHostId, - public_process_node->GetRenderProcessHostProxy() - .render_process_host_id()); } TEST_F(ProcessNodeImplTest, PublicInterface) {
diff --git a/components/performance_manager/performance_manager_impl.cc b/components/performance_manager/performance_manager_impl.cc index 9de0763..ad5b0d6 100644 --- a/components/performance_manager/performance_manager_impl.cc +++ b/components/performance_manager/performance_manager_impl.cc
@@ -155,10 +155,23 @@ // static std::unique_ptr<ProcessNodeImpl> PerformanceManagerImpl::CreateProcessNode( - content::ProcessType process_type, - RenderProcessHostProxy proxy) { + BrowserProcessNodeTag tag) { return CreateNodeImpl<ProcessNodeImpl>( - base::OnceCallback<void(ProcessNodeImpl*)>(), process_type, proxy); + base::OnceCallback<void(ProcessNodeImpl*)>(), tag); +} + +// static +std::unique_ptr<ProcessNodeImpl> PerformanceManagerImpl::CreateProcessNode( + RenderProcessHostProxy render_process_host_proxy) { + return CreateNodeImpl<ProcessNodeImpl>( + base::OnceCallback<void(ProcessNodeImpl*)>(), render_process_host_proxy); +} + +// static +std::unique_ptr<ProcessNodeImpl> PerformanceManagerImpl::CreateProcessNode( + content::ProcessType process_type) { + return CreateNodeImpl<ProcessNodeImpl>( + base::OnceCallback<void(ProcessNodeImpl*)>(), process_type); } // static
diff --git a/components/performance_manager/performance_manager_impl.h b/components/performance_manager/performance_manager_impl.h index 248876e2f..8e83e75 100644 --- a/components/performance_manager/performance_manager_impl.h +++ b/components/performance_manager/performance_manager_impl.h
@@ -32,6 +32,7 @@ namespace performance_manager { class PageNodeImpl; +struct BrowserProcessNodeTag; // The performance manager is a rendezvous point for binding to performance // manager interfaces. @@ -111,8 +112,11 @@ base::TimeTicks visibility_change_time, PageNode::PageState page_state); static std::unique_ptr<ProcessNodeImpl> CreateProcessNode( - content::ProcessType process_type, + BrowserProcessNodeTag tag); + static std::unique_ptr<ProcessNodeImpl> CreateProcessNode( RenderProcessHostProxy proxy); + static std::unique_ptr<ProcessNodeImpl> CreateProcessNode( + content::ProcessType process_type); static std::unique_ptr<WorkerNodeImpl> CreateWorkerNode( const std::string& browser_context_id, WorkerNode::WorkerType worker_type,
diff --git a/components/performance_manager/performance_manager_impl_unittest.cc b/components/performance_manager/performance_manager_impl_unittest.cc index 5ba0d08..787f15c 100644 --- a/components/performance_manager/performance_manager_impl_unittest.cc +++ b/components/performance_manager/performance_manager_impl_unittest.cc
@@ -55,8 +55,7 @@ int next_render_frame_id = 0; std::unique_ptr<ProcessNodeImpl> process_node = - PerformanceManagerImpl::CreateProcessNode(content::PROCESS_TYPE_RENDERER, - RenderProcessHostProxy()); + PerformanceManagerImpl::CreateProcessNode(RenderProcessHostProxy()); EXPECT_NE(nullptr, process_node.get()); std::unique_ptr<PageNodeImpl> page_node = PerformanceManagerImpl::CreatePageNode( @@ -81,8 +80,7 @@ int next_render_frame_id = 0; // Create a page node and a small hierarchy of frames. std::unique_ptr<ProcessNodeImpl> process_node = - PerformanceManagerImpl::CreateProcessNode(content::PROCESS_TYPE_RENDERER, - RenderProcessHostProxy()); + PerformanceManagerImpl::CreateProcessNode(RenderProcessHostProxy()); std::unique_ptr<PageNodeImpl> page_node = PerformanceManagerImpl::CreatePageNode( WebContentsProxy(), std::string(), GURL(), false, false,
diff --git a/components/performance_manager/render_process_user_data.cc b/components/performance_manager/render_process_user_data.cc index e5c5e85..85ad55b7 100644 --- a/components/performance_manager/render_process_user_data.cc +++ b/components/performance_manager/render_process_user_data.cc
@@ -32,7 +32,6 @@ : host_(render_process_host) { host_->AddObserver(this); process_node_ = PerformanceManagerImpl::CreateProcessNode( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy(RenderProcessHostId(host_->GetID()))); }
diff --git a/components/performance_manager/test_support/graph_test_harness.h b/components/performance_manager/test_support/graph_test_harness.h index c4a3e6c..df9f52f 100644 --- a/components/performance_manager/test_support/graph_test_harness.h +++ b/components/performance_manager/test_support/graph_test_harness.h
@@ -92,14 +92,20 @@ }; // A specialized factory function for ProcessNodes which will provide an empty -// RenderProcessHostProxy when it's not needed. +// proxy when it's not needed. template <> struct TestNodeWrapper<ProcessNodeImpl>::Factory { + static std::unique_ptr<ProcessNodeImpl> Create(BrowserProcessNodeTag tag) { + return std::make_unique<ProcessNodeImpl>(tag); + } static std::unique_ptr<ProcessNodeImpl> Create( - content::ProcessType process_type = content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy proxy = RenderProcessHostProxy()) { // Provide an empty RenderProcessHostProxy by default. - return std::make_unique<ProcessNodeImpl>(process_type, std::move(proxy)); + return std::make_unique<ProcessNodeImpl>(std::move(proxy)); + } + static std::unique_ptr<ProcessNodeImpl> Create( + content::ProcessType process_type) { + return std::make_unique<ProcessNodeImpl>(process_type); } };
diff --git a/components/performance_manager/test_support/mock_graphs.cc b/components/performance_manager/test_support/mock_graphs.cc index d248719..bfc7c97 100644 --- a/components/performance_manager/test_support/mock_graphs.cc +++ b/components/performance_manager/test_support/mock_graphs.cc
@@ -18,8 +18,7 @@ namespace performance_manager { TestProcessNodeImpl::TestProcessNodeImpl() - : ProcessNodeImpl(content::PROCESS_TYPE_RENDERER, - RenderProcessHostProxy()) {} + : ProcessNodeImpl(RenderProcessHostProxy()) {} void TestProcessNodeImpl::SetProcessWithPid(base::ProcessId pid, base::Process process,
diff --git a/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc b/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc index c0c8550..38a703d8 100644 --- a/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc +++ b/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc
@@ -175,7 +175,6 @@ // Create a process node and validate that it gets a request. auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); // Data should not be available until the measurement is taken. @@ -200,7 +199,6 @@ // Instantiate the decorator with an existing process node and validate that // it gets a request. auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); MockV8DetailedMemoryReporter mock_reporter; @@ -237,9 +235,10 @@ // Instantiate a non-renderer process node and validate that it causes no // bind requests. EXPECT_CALL(*this, BindReceiverWithProxyHost(_, _)).Times(0); - auto process = CreateNode<ProcessNodeImpl>( - static_cast<content::ProcessType>(type), - RenderProcessHostProxy::CreateForTesting(kTestProcessID)); + auto process = type == content::PROCESS_TYPE_BROWSER + ? CreateNode<ProcessNodeImpl>(BrowserProcessNodeTag{}) + : CreateNode<ProcessNodeImpl>( + static_cast<content::ProcessType>(type)); task_env().RunUntilIdle(); Mock::VerifyAndClearExpectations(this); @@ -251,11 +250,9 @@ // them, and a one-shot request that measures only one. constexpr RenderProcessHostId kProcessId1 = RenderProcessHostId(0xFAB); auto process1 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kProcessId1)); constexpr RenderProcessHostId kProcessId2 = RenderProcessHostId(0xBAF); auto process2 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kProcessId2)); // Set the all process request to only send once within the test. @@ -309,7 +306,6 @@ TEST_F(V8DetailedMemoryDecoratorTest, OneShotLifetime) { auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); MockV8DetailedMemoryReporter mock_reporter; @@ -393,7 +389,6 @@ TEST_F(V8DetailedMemoryDecoratorTest, OneShotLifetimeAtExit) { auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); // Ensure that resource-owning callbacks are freed when there is no response @@ -435,7 +430,6 @@ TEST_F(V8DetailedMemoryDecoratorTest, QueryRateIsLimited) { auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); MockV8DetailedMemoryReporter mock_reporter; @@ -523,7 +517,6 @@ } auto process1 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(kMinTimeBetweenRequests / 4); @@ -538,7 +531,6 @@ } auto process2 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().RunUntilIdle(); @@ -583,7 +575,6 @@ MockV8DetailedMemoryReporter reporter; auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); // Create a couple of frames with specified IDs. @@ -630,7 +621,6 @@ } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().RunUntilIdle(); @@ -706,7 +696,6 @@ } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(base::Seconds(1)); @@ -816,7 +805,6 @@ } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); EXPECT_FALSE(V8DetailedMemoryProcessData::ForProcessNode(process.get())); @@ -1046,7 +1034,6 @@ ExpectBindAndRespondToQuery(&mock_reporter, std::move(data)); } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(kOneSecond); // All the following FastForwardBy calls will place the clock 1 sec after a @@ -1194,7 +1181,6 @@ ExpectBindAndRespondToQuery(&mock_reporter, std::move(data)); } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(base::Seconds(1)); ASSERT_EQ(1U, V8DetailedMemoryProcessData::ForProcessNode(process.get()) @@ -1226,7 +1212,6 @@ } auto process1 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); observer1.ExpectObservationOnProcess(process1.get(), 1U); @@ -1253,7 +1238,6 @@ } auto process2 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); observer1.ExpectObservationOnProcess(process2.get(), 2U); @@ -1311,7 +1295,6 @@ } auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); observer.ExpectObservationOnProcess(process.get(), 1U); @@ -1347,11 +1330,9 @@ // them, and one request that measures only one. constexpr RenderProcessHostId kProcessId1 = RenderProcessHostId(0xFAB); auto process1 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kProcessId1)); constexpr RenderProcessHostId kProcessId2 = RenderProcessHostId(0xBAF); auto process2 = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kProcessId2)); // Set the all process request to only send once within the test. @@ -1455,7 +1436,6 @@ // Create a single process node so both "all process" and "single process" // requests will have a single expectation, which reduces boilerplate. auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); V8DetailedMemoryRequest lazy_request(kMinTimeBetweenRequests, @@ -1973,7 +1953,6 @@ MockV8DetailedMemoryReporter reporter; auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); // Create a couple of frames with specified IDs. @@ -2017,7 +1996,6 @@ MockV8DetailedMemoryReporter reporter; auto process = CreateNode<ProcessNodeImpl>( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy::CreateForTesting(kTestProcessID)); // Create a couple of frames with specified IDs.
diff --git a/components/performance_manager/worker_watcher_unittest.cc b/components/performance_manager/worker_watcher_unittest.cc index 320e4b80..0db45e69 100644 --- a/components/performance_manager/worker_watcher_unittest.cc +++ b/components/performance_manager/worker_watcher_unittest.cc
@@ -535,8 +535,8 @@ int render_process_id = GenerateNextId(); // Create the process node and insert it into the map. - auto process_node = PerformanceManagerImpl::CreateProcessNode( - content::PROCESS_TYPE_RENDERER, RenderProcessHostProxy()); + auto process_node = + PerformanceManagerImpl::CreateProcessNode(RenderProcessHostProxy()); bool inserted = process_node_map_.insert({render_process_id, std::move(process_node)}) .second;
diff --git a/components/policy/resources/templates/policies.yaml b/components/policy/resources/templates/policies.yaml index a490fc1..0c00b3b 100644 --- a/components/policy/resources/templates/policies.yaml +++ b/components/policy/resources/templates/policies.yaml
@@ -1056,6 +1056,7 @@ 1055: DeviceLoginScreenExtensionManifestV2Availability 1056: KioskTroubleshootingToolsEnabled 1057: ForceEnablePepperVideoDecoderDevAPI + 1058: DomainReliabilityAllowed atomic_groups: 1: Homepage 2: RemoteAccess
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DomainReliabilityAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DomainReliabilityAllowed.yaml new file mode 100644 index 0000000..7cec39e --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DomainReliabilityAllowed.yaml
@@ -0,0 +1,29 @@ +caption: Allow reporting of domain reliability related data +desc: |- + If this policy is set false, domain reliability diagnostic data reporting is disabled and no data is sent to Google. + If this policy is set true or not set, domain reliability diagnostic data reporting will follow the behavior of MetricsReportingEnabled for <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> or DeviceMetricsReportingEnabled for <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph>. +default: true +example_value: true +features: + can_be_recommended: true + dynamic_refresh: false + per_profile: false +future_on: +- fuchsia +items: +- caption: Domain Reliability data may be sent to Google depending on Chrome User Metrics (UMA) policy + value: true +- caption: Never send domain reliability data to Google + value: false +owners: +- alexwchen@chromium.org +- file://components/policy/OWNERS +schema: + type: boolean +supported_on: +- android:111- +- chrome.*:111- +- chrome_os:111- +tags: +- google-sharing +type: main
diff --git a/components/security_state/core/security_state.cc b/components/security_state/core/security_state.cc index 0b1587f..5faa207 100644 --- a/components/security_state/core/security_state.cc +++ b/components/security_state/core/security_state.cc
@@ -45,46 +45,15 @@ return "SafetyTip_Unknown"; case security_state::SafetyTipStatus::kNone: return "SafetyTip_None"; - case security_state::SafetyTipStatus::kBadReputation: - return "SafetyTip_BadReputation"; case security_state::SafetyTipStatus::kLookalike: return "SafetyTip_Lookalike"; - case security_state::SafetyTipStatus::kBadReputationIgnored: - return "SafetyTip_BadReputationIgnored"; case security_state::SafetyTipStatus::kLookalikeIgnored: return "SafetyTip_LookalikeIgnored"; - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - return "SafetyTip_DigitalAssetLinkMatch"; - case security_state::SafetyTipStatus::kBadKeyword: - return "SafetyTip_BadKeyword"; } NOTREACHED(); return std::string(); } -// Returns whether to set the security level based on the safety tip status. -// Sets |level| to the right value if status should be set. -bool ShouldSetSecurityLevelFromSafetyTip(security_state::SafetyTipStatus status, - SecurityLevel* level) { - switch (status) { - case security_state::SafetyTipStatus::kBadReputation: - *level = security_state::NONE; - return true; - case security_state::SafetyTipStatus::kBadReputationIgnored: - case security_state::SafetyTipStatus::kLookalike: - case security_state::SafetyTipStatus::kLookalikeIgnored: - case security_state::SafetyTipStatus::kBadKeyword: - // TODO(crbug/1012982): Decide whether to degrade the indicator once the - // UI lands. - case security_state::SafetyTipStatus::kDigitalAssetLinkMatch: - case security_state::SafetyTipStatus::kUnknown: - case security_state::SafetyTipStatus::kNone: - return false; - } - NOTREACHED(); - return false; -} - } // namespace SecurityLevel GetSecurityLevel( @@ -173,13 +142,6 @@ return NONE; } - // Downgrade the security level for pages that trigger a Safety Tip. - SecurityLevel safety_tip_level; - if (ShouldSetSecurityLevelFromSafetyTip( - visible_security_state.safety_tip_info.status, &safety_tip_level)) { - return safety_tip_level; - } - // In most cases, SHA1 use is treated as a certificate error, in which case // DANGEROUS will have been returned above. If SHA1 was permitted by policy, // downgrade the security level to Neutral.
diff --git a/components/security_state/core/security_state.h b/components/security_state/core/security_state.h index abfed7df..a1399b2 100644 --- a/components/security_state/core/security_state.h +++ b/components/security_state/core/security_state.h
@@ -116,27 +116,27 @@ // histogram enum naming conventions // (https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#usage). enum class SafetyTipStatus { - // Safety tip status is not applicable, e.g. there is no current navigation. + // Safety tip status is not applicable, e.g. there is no current navigation: kUnknown = 0, - // The current page did not trigger any Safety Tip. + // The current page did not trigger any Safety Tip: kNone = 1, - // The current page triggered a Safety Tip because it was bad reputation. - kBadReputation = 2, - // The current page triggered a Safety Tip because it had a lookalike URL. + // The current page triggered a Safety Tip because it was bad reputation: + // kBadReputation = 2, // no longer used, heuristic removed. + // The current page triggered a Safety Tip because it had a lookalike URL: kLookalike = 3, // The current page triggered a Safety Tip because a suspicious keyword was - // found in its hostname. - kBadKeyword = 4, + // found in its hostname: + // kBadKeyword = 4, // no longer used, heuristic removed. // The current page had bad reputation, but a Safety Tip was not shown since - // it had been previously ignored by the user. - kBadReputationIgnored = 5, + // it had been previously ignored by the user: + // kBadReputationIgnored = 5, // no longer used, heuristic removed. // The current page had a lookalike URL, but a Safety Tip was not shown since - // it had been previously ignored by the user. + // it had been previously ignored by the user: kLookalikeIgnored = 6, // Safety tip UI was ignored because of the lookalike's digital asset link - // manifest matched the target's. - kDigitalAssetLinkMatch = 7, - kMaxValue = kDigitalAssetLinkMatch, + // manifest matched the target's: + // kDigitalAssetLinkMatch = 7, // no longer used, DAL checks removed. + kMaxValue = kLookalikeIgnored, }; // Information about the last safety tip shown in the UI. This is used in page
diff --git a/components/security_state/core/security_state_unittest.cc b/components/security_state/core/security_state_unittest.cc index 654f498..8c820cb 100644 --- a/components/security_state/core/security_state_unittest.cc +++ b/components/security_state/core/security_state_unittest.cc
@@ -323,9 +323,7 @@ const SafetyTipCase kTestCases[] = { {SafetyTipStatus::kUnknown, SECURE}, {SafetyTipStatus::kNone, SECURE}, - {SafetyTipStatus::kBadReputation, NONE}, {SafetyTipStatus::kLookalike, SECURE}, - {SafetyTipStatus::kBadKeyword, SECURE}, }; for (auto testcase : kTestCases) {
diff --git a/components/ui_devtools/views/element_utility.cc b/components/ui_devtools/views/element_utility.cc index d09b052..7dc81b65 100644 --- a/components/ui_devtools/views/element_utility.cc +++ b/components/ui_devtools/views/element_utility.cc
@@ -20,7 +20,7 @@ std::string(LayerTypeToString(layer->type()))); ret->emplace_back("has-layer-mask", layer->layer_mask_layer() ? "true" : "false"); - ret->emplace_back("layer-is-drawn", layer->IsDrawn() ? "true" : "false"); + ret->emplace_back("layer-is-visible", layer->IsVisible() ? "true" : "false"); ret->emplace_back("layer-opacity", base::NumberToString((layer->opacity()))); ret->emplace_back("layer-combined-opacity", base::NumberToString(layer->GetCombinedOpacity()));
diff --git a/components/unexportable_keys/BUILD.gn b/components/unexportable_keys/BUILD.gn index cc27357..2794738 100644 --- a/components/unexportable_keys/BUILD.gn +++ b/components/unexportable_keys/BUILD.gn
@@ -13,6 +13,8 @@ "ref_counted_unexportable_signing_key.h", "unexportable_key_task_manager.cc", "unexportable_key_task_manager.h", + "unexportable_key_tasks.cc", + "unexportable_key_tasks.h", ] public_deps = [
diff --git a/components/unexportable_keys/background_task_impl.h b/components/unexportable_keys/background_task_impl.h index 78b5a46..b5656cd 100644 --- a/components/unexportable_keys/background_task_impl.h +++ b/components/unexportable_keys/background_task_impl.h
@@ -16,9 +16,11 @@ // A template class implementing `BackgroundTask`. Background task is // represented by a `task_` callback with a specific `ReturnType` that is passed // from the background thread to a `reply_` callback. -template <typename ReturnType> +template <typename T> class BackgroundTaskImpl : public BackgroundTask { public: + using ReturnType = T; + // `task` is a callback that runs on the background thread and returns a // value. // `reply` is invoked on the posting thread with the return result of
diff --git a/components/unexportable_keys/unexportable_key_task_manager.cc b/components/unexportable_keys/unexportable_key_task_manager.cc index 36a6f02..5107731 100644 --- a/components/unexportable_keys/unexportable_key_task_manager.cc +++ b/components/unexportable_keys/unexportable_key_task_manager.cc
@@ -7,9 +7,15 @@ #include <memory> #include "base/containers/span.h" +#include "base/functional/bind.h" #include "base/memory/scoped_refptr.h" +#include "base/task/single_thread_task_runner_thread_mode.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" +#include "components/unexportable_keys/background_long_task_scheduler.h" #include "components/unexportable_keys/background_task_priority.h" #include "components/unexportable_keys/ref_counted_unexportable_signing_key.h" +#include "components/unexportable_keys/unexportable_key_tasks.h" #include "crypto/signature_verifier.h" #include "crypto/unexportable_key.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -27,7 +33,15 @@ } } // namespace -UnexportableKeyTaskManager::UnexportableKeyTaskManager() = default; +UnexportableKeyTaskManager::UnexportableKeyTaskManager() + : task_scheduler_(base::ThreadPool::CreateSingleThreadTaskRunner( + {base::MayBlock(), base::TaskPriority::USER_BLOCKING, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::SingleThreadTaskRunnerThreadMode:: + DEDICATED // Using a dedicated thread to run long and blocking + // TPM tasks. + )) {} + UnexportableKeyTaskManager::~UnexportableKeyTaskManager() = default; void UnexportableKeyTaskManager::GenerateSigningKeySlowlyAsync( @@ -44,9 +58,10 @@ return; } - // TODO(b/263249728): run this on a background thread. - std::move(callback).Run(MakeSigningKeyRefCounted( - key_provider->GenerateSigningKeySlowly(acceptable_algorithms))); + auto task = std::make_unique<GenerateKeyTask>( + std::move(key_provider), acceptable_algorithms, + base::BindOnce(&MakeSigningKeyRefCounted).Then(std::move(callback))); + task_scheduler_.PostTask(std::move(task), priority); } void UnexportableKeyTaskManager::FromWrappedSigningKeySlowlyAsync( @@ -62,9 +77,10 @@ return; } - // TODO(b/263249728): run this on a background thread. - std::move(callback).Run(MakeSigningKeyRefCounted( - key_provider->FromWrappedSigningKeySlowly(wrapped_key))); + auto task = std::make_unique<FromWrappedKeyTask>( + std::move(key_provider), wrapped_key, + base::BindOnce(&MakeSigningKeyRefCounted).Then(std::move(callback))); + task_scheduler_.PostTask(std::move(task), priority); } void UnexportableKeyTaskManager::SignSlowlyAsync( @@ -72,15 +88,11 @@ base::span<const uint8_t> data, BackgroundTaskPriority priority, base::OnceCallback<void(absl::optional<std::vector<uint8_t>>)> callback) { - // TODO(b/263249728): run this on a background thread. // TODO(b/263249728): deduplicate tasks with the same parameters. // TODO(b/263249728): implement a cache of recent signings. - if (!signing_key) { - std::move(callback).Run(absl::nullopt); - return; - } - - std::move(callback).Run(signing_key->key().SignSlowly(data)); + auto task = std::make_unique<SignTask>(std::move(signing_key), data, + std::move(callback)); + task_scheduler_.PostTask(std::move(task), priority); } } // namespace unexportable_keys
diff --git a/components/unexportable_keys/unexportable_key_task_manager.h b/components/unexportable_keys/unexportable_key_task_manager.h index 6e777b1a..556a68c 100644 --- a/components/unexportable_keys/unexportable_key_task_manager.h +++ b/components/unexportable_keys/unexportable_key_task_manager.h
@@ -10,6 +10,7 @@ #include "base/containers/span.h" #include "base/functional/callback.h" #include "base/memory/scoped_refptr.h" +#include "components/unexportable_keys/background_long_task_scheduler.h" #include "components/unexportable_keys/background_task_priority.h" #include "components/unexportable_keys/ref_counted_unexportable_signing_key.h" #include "crypto/signature_verifier.h" @@ -32,6 +33,9 @@ // WARNING: This might break the assumption about the signature being // non-deterministic for some algorithms (like ECDSA). Let the OWNERS know if // you want to disable this feature for your use case. +// +// Read documentation to `BackgroundLongTaskScheduler` for details on how the +// tasks are getting scheduled. class UnexportableKeyTaskManager { public: UnexportableKeyTaskManager(); @@ -75,6 +79,10 @@ base::span<const uint8_t> data, BackgroundTaskPriority priority, base::OnceCallback<void(absl::optional<std::vector<uint8_t>>)> callback); + + private: + // Scheduler to run long tasks in background. + BackgroundLongTaskScheduler task_scheduler_; }; } // namespace unexportable_keys
diff --git a/components/unexportable_keys/unexportable_key_task_manager_unittest.cc b/components/unexportable_keys/unexportable_key_task_manager_unittest.cc index 48943e0..66814fbb 100644 --- a/components/unexportable_keys/unexportable_key_task_manager_unittest.cc +++ b/components/unexportable_keys/unexportable_key_task_manager_unittest.cc
@@ -20,10 +20,15 @@ UnexportableKeyTaskManagerTest() = default; ~UnexportableKeyTaskManagerTest() override = default; + void RunBackgroundTasks() { task_environment_.RunUntilIdle(); } + UnexportableKeyTaskManager& task_manager() { return task_manager_; } private: - base::test::TaskEnvironment task_environment_; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::ThreadPoolExecutionMode:: + QUEUED}; // QUEUED - tasks don't run until `RunUntilIdle()` is + // called. crypto::ScopedMockUnexportableKeyProvider scoped_mock_key_provider_; UnexportableKeyTaskManager task_manager_; }; @@ -35,6 +40,9 @@ task_manager().GenerateSigningKeySlowlyAsync( supported_algorithm, BackgroundTaskPriority::kBestEffort, future.GetCallback()); + EXPECT_FALSE(future.IsReady()); + RunBackgroundTasks(); + EXPECT_TRUE(future.IsReady()); EXPECT_NE(future.Get(), nullptr); } @@ -47,6 +55,7 @@ task_manager().GenerateSigningKeySlowlyAsync( unsupported_algorithm, BackgroundTaskPriority::kBestEffort, future.GetCallback()); + RunBackgroundTasks(); EXPECT_EQ(future.Get(), nullptr); } @@ -58,6 +67,7 @@ task_manager().GenerateSigningKeySlowlyAsync( supported_algorithm, BackgroundTaskPriority::kBestEffort, generate_key_future.GetCallback()); + RunBackgroundTasks(); auto key = generate_key_future.Get(); std::vector<uint8_t> wrapped_key = key->key().GetWrappedKey(); @@ -67,6 +77,9 @@ task_manager().FromWrappedSigningKeySlowlyAsync( wrapped_key, BackgroundTaskPriority::kBestEffort, unwrap_key_future.GetCallback()); + EXPECT_FALSE(unwrap_key_future.IsReady()); + RunBackgroundTasks(); + EXPECT_TRUE(unwrap_key_future.IsReady()); auto unwrapped_key = unwrap_key_future.Get(); EXPECT_NE(unwrapped_key, nullptr); // Keys should have different ids since they point to different objects. @@ -83,6 +96,7 @@ task_manager().FromWrappedSigningKeySlowlyAsync( empty_wrapped_key, BackgroundTaskPriority::kBestEffort, future.GetCallback()); + RunBackgroundTasks(); EXPECT_EQ(future.Get(), nullptr); } @@ -94,6 +108,7 @@ task_manager().GenerateSigningKeySlowlyAsync( supported_algorithm, BackgroundTaskPriority::kBestEffort, generate_key_future.GetCallback()); + RunBackgroundTasks(); auto key = generate_key_future.Get(); // Second, sign some data with the key. @@ -101,6 +116,9 @@ std::vector<const uint8_t> data = {4, 8, 15, 16, 23, 42}; task_manager().SignSlowlyAsync(key, data, BackgroundTaskPriority::kBestEffort, sign_future.GetCallback()); + EXPECT_FALSE(sign_future.IsReady()); + RunBackgroundTasks(); + EXPECT_TRUE(sign_future.IsReady()); const auto& signed_data = sign_future.Get(); ASSERT_TRUE(signed_data.has_value()); @@ -118,6 +136,7 @@ task_manager().SignSlowlyAsync(nullptr, data, BackgroundTaskPriority::kBestEffort, sign_future.GetCallback()); + RunBackgroundTasks(); EXPECT_FALSE(sign_future.Get().has_value()); }
diff --git a/components/unexportable_keys/unexportable_key_tasks.cc b/components/unexportable_keys/unexportable_key_tasks.cc new file mode 100644 index 0000000..6f70f6cb --- /dev/null +++ b/components/unexportable_keys/unexportable_key_tasks.cc
@@ -0,0 +1,63 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/unexportable_keys/unexportable_key_tasks.h" + +#include "base/memory/scoped_refptr.h" +#include "components/unexportable_keys/ref_counted_unexportable_signing_key.h" +#include "crypto/signature_verifier.h" +#include "crypto/unexportable_key.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace unexportable_keys { + +namespace { + +absl::optional<std::vector<uint8_t>> SignSlowlyWithRefCountedKey( + scoped_refptr<RefCountedUnexportableSigningKey> signing_key, + base::span<const uint8_t> data) { + if (!signing_key) { + return absl::nullopt; + } + + return signing_key->key().SignSlowly(data); +} + +} // namespace + +GenerateKeyTask::GenerateKeyTask( + std::unique_ptr<crypto::UnexportableKeyProvider> key_provider, + base::span<const crypto::SignatureVerifier::SignatureAlgorithm> + acceptable_algorithms, + base::OnceCallback<void(GenerateKeyTask::ReturnType)> callback) + : internal::BackgroundTaskImpl<GenerateKeyTask::ReturnType>( + base::BindOnce( + &crypto::UnexportableKeyProvider::GenerateSigningKeySlowly, + std::move(key_provider), + std::vector<const crypto::SignatureVerifier::SignatureAlgorithm>( + acceptable_algorithms.begin(), + acceptable_algorithms.end())), + std::move(callback)) {} + +FromWrappedKeyTask::FromWrappedKeyTask( + std::unique_ptr<crypto::UnexportableKeyProvider> key_provider, + base::span<const uint8_t> wrapped_key, + base::OnceCallback<void(FromWrappedKeyTask::ReturnType)> callback) + : internal::BackgroundTaskImpl<FromWrappedKeyTask::ReturnType>( + base::BindOnce( + &crypto::UnexportableKeyProvider::FromWrappedSigningKeySlowly, + std::move(key_provider), + std::vector<uint8_t>(wrapped_key.begin(), wrapped_key.end())), + std::move(callback)) {} + +SignTask::SignTask(scoped_refptr<RefCountedUnexportableSigningKey> signing_key, + base::span<const uint8_t> data, + base::OnceCallback<void(SignTask::ReturnType)> callback) + : internal::BackgroundTaskImpl<SignTask::ReturnType>( + base::BindOnce(&SignSlowlyWithRefCountedKey, + std::move(signing_key), + std::vector<uint8_t>(data.begin(), data.end())), + std::move(callback)) {} + +} // namespace unexportable_keys
diff --git a/components/unexportable_keys/unexportable_key_tasks.h b/components/unexportable_keys/unexportable_key_tasks.h new file mode 100644 index 0000000..e109089a --- /dev/null +++ b/components/unexportable_keys/unexportable_key_tasks.h
@@ -0,0 +1,61 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASKS_H_ +#define COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASKS_H_ + +#include <cstdint> +#include <memory> + +#include "base/containers/span.h" +#include "base/functional/callback_forward.h" +#include "base/memory/scoped_refptr.h" +#include "components/unexportable_keys/background_task_impl.h" +#include "crypto/signature_verifier.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace crypto { +class UnexportableSigningKey; +class UnexportableKeyProvider; +} // namespace crypto + +namespace unexportable_keys { + +class RefCountedUnexportableSigningKey; + +// A `BackgroundTask` to generate a new `crypto::UnexportableSigningKey`. +class GenerateKeyTask : public internal::BackgroundTaskImpl< + std::unique_ptr<crypto::UnexportableSigningKey>> { + public: + GenerateKeyTask( + std::unique_ptr<crypto::UnexportableKeyProvider> key_provider, + base::span<const crypto::SignatureVerifier::SignatureAlgorithm> + acceptable_algorithms, + base::OnceCallback<void(GenerateKeyTask::ReturnType)> callback); +}; + +// A `BackgroundTask` to create a `crypto::UnexportableSigningKey` from a +// wrapped key. +class FromWrappedKeyTask + : public internal::BackgroundTaskImpl< + std::unique_ptr<crypto::UnexportableSigningKey>> { + public: + FromWrappedKeyTask( + std::unique_ptr<crypto::UnexportableKeyProvider> key_provider, + base::span<const uint8_t> wrapped_key, + base::OnceCallback<void(FromWrappedKeyTask::ReturnType)> callback); +}; + +// A `BackgroundTask` to sign data with `crypto::UnexportableSigningKey`. +class SignTask : public internal::BackgroundTaskImpl< + absl::optional<std::vector<uint8_t>>> { + public: + SignTask(scoped_refptr<RefCountedUnexportableSigningKey> signing_key, + base::span<const uint8_t> data, + base::OnceCallback<void(SignTask::ReturnType)> callback); +}; + +} // namespace unexportable_keys + +#endif // COMPONENTS_UNEXPORTABLE_KEYS_UNEXPORTABLE_KEY_TASKS_H_
diff --git a/components/update_client/protocol_parser_json.cc b/components/update_client/protocol_parser_json.cc index 012c983e..2b0574c 100644 --- a/components/update_client/protocol_parser_json.cc +++ b/components/update_client/protocol_parser_json.cc
@@ -4,6 +4,7 @@ #include "components/update_client/protocol_parser_json.h" +#include <string> #include <utility> #include "base/json/json_reader.h" @@ -13,29 +14,32 @@ #include "base/values.h" #include "base/version.h" #include "components/update_client/protocol_definition.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace update_client { namespace { -std::string GetValueString(const base::Value& node, const char* key) { - const auto* value = node.FindKey(key); - return (value && value->is_string()) ? value->GetString() : std::string(); +std::string GetValueString(const base::Value::Dict& node, const char* key) { + const std::string* value = node.FindString(key); + return value ? *value : std::string(); } -bool ParseManifest(const base::Value& manifest_node, +bool ParseManifest(const base::Value& manifest_node_val, ProtocolParser::Result* result, std::string* error) { - if (!manifest_node.is_dict()) { + if (!manifest_node_val.is_dict()) { *error = "'manifest' is not a dictionary."; + return false; } - const auto* version = manifest_node.FindKey("version"); - if (!version || !version->is_string()) { + const base::Value::Dict& manifest_node = manifest_node_val.GetDict(); + const std::string* version = manifest_node.FindString("version"); + if (!version) { *error = "Missing version for manifest."; return false; } - result->manifest.version = version->GetString(); + result->manifest.version = *version; if (!base::Version(result->manifest.version).IsValid()) { *error = base::StrCat({"Invalid version: '", result->manifest.version, "'."}); @@ -43,9 +47,10 @@ } // Get the optional minimum browser version. - const auto* browser_min_version = manifest_node.FindKey("prodversionmin"); - if (browser_min_version && browser_min_version->is_string()) { - result->manifest.browser_min_version = browser_min_version->GetString(); + const std::string* browser_min_version = + manifest_node.FindString("prodversionmin"); + if (browser_min_version) { + result->manifest.browser_min_version = *browser_min_version; if (!base::Version(result->manifest.browser_min_version).IsValid()) { *error = base::StrCat({"Invalid prodversionmin: '", result->manifest.browser_min_version, "'."}); @@ -56,47 +61,48 @@ result->manifest.run = GetValueString(manifest_node, "run"); result->manifest.arguments = GetValueString(manifest_node, "arguments"); - const auto* packages_node = manifest_node.FindKey("packages"); - if (!packages_node || !packages_node->is_dict()) { + const base::Value::Dict* packages_node = manifest_node.FindDict("packages"); + if (!packages_node) { *error = "Missing packages in manifest or 'packages' is not a dictionary."; return false; } - const auto* package_node = packages_node->FindKey("package"); - if (!package_node || !package_node->is_list()) { + const base::Value::List* package_node = packages_node->FindList("package"); + if (!package_node) { *error = "Missing package in packages."; return false; } - for (const auto& package : package_node->GetList()) { - if (!package.is_dict()) { + for (const auto& package_val : *package_node) { + if (!package_val.is_dict()) { *error = "'package' is not a dictionary."; return false; } + const base::Value::Dict& package = package_val.GetDict(); ProtocolParser::Result::Manifest::Package p; - const auto* name = package.FindKey("name"); - if (!name || !name->is_string()) { + const std::string* name = package.FindString("name"); + if (!name) { *error = "Missing name for package."; return false; } - p.name = name->GetString(); + p.name = *name; p.namediff = GetValueString(package, "namediff"); p.fingerprint = GetValueString(package, "fp"); p.hash_sha256 = GetValueString(package, "hash_sha256"); p.hashdiff_sha256 = GetValueString(package, "hashdiff_sha256"); - const auto* size = package.FindKey("size"); - if (size && (size->is_int() || size->is_double())) { - const auto val = size->GetDouble(); + const absl::optional<double> size = package.FindDouble("size"); + if (size) { + const double val = size.value(); if (0 <= val && val < kProtocolMaxInt) - p.size = size->GetDouble(); + p.size = val; } - const auto* sizediff = package.FindKey("sizediff"); - if (sizediff && (sizediff->is_int() || sizediff->is_double())) { - const auto val = sizediff->GetDouble(); + const absl::optional<double> sizediff = package.FindDouble("sizediff"); + if (sizediff) { + const double val = sizediff.value(); if (0 <= val && val < kProtocolMaxInt) - p.sizediff = sizediff->GetDouble(); + p.sizediff = val; } result->manifest.packages.push_back(std::move(p)); @@ -110,44 +116,51 @@ if (!actions_node.is_dict()) return; - const auto* action_node = actions_node.FindKey("action"); - if (!action_node || !action_node->is_list()) + const base::Value::List* action_node = + actions_node.GetDict().FindList("action"); + if (!action_node) { return; + } - const auto& action_list = action_node->GetList(); + const base::Value::List& action_list = *action_node; if (action_list.empty() || !action_list[0].is_dict()) return; - result->action_run = GetValueString(action_list[0], "run"); + result->action_run = GetValueString(action_list[0].GetDict(), "run"); } -bool ParseUrls(const base::Value& urls_node, +bool ParseUrls(const base::Value& urls_node_val, ProtocolParser::Result* result, std::string* error) { - if (!urls_node.is_dict()) { + if (!urls_node_val.is_dict()) { *error = "'urls' is not a dictionary."; return false; } - const auto* url_node = urls_node.FindKey("url"); - if (!url_node || !url_node->is_list()) { + const base::Value::Dict& urls_node = urls_node_val.GetDict(); + const base::Value::List* url_node = urls_node.FindList("url"); + if (!url_node) { *error = "Missing url on urls."; return false; } - for (const auto& url : url_node->GetList()) { - if (!url.is_dict()) + for (const base::Value& url_val : *url_node) { + if (!url_val.is_dict()) { continue; - const auto* codebase = url.FindKey("codebase"); - if (codebase && codebase->is_string()) { - GURL crx_url(codebase->GetString()); - if (crx_url.is_valid()) - result->crx_urls.push_back(std::move(crx_url)); } - const auto* codebasediff = url.FindKey("codebasediff"); - if (codebasediff && codebasediff->is_string()) { - GURL crx_diffurl(codebasediff->GetString()); - if (crx_diffurl.is_valid()) + const base::Value::Dict& url = url_val.GetDict(); + const std::string* codebase = url.FindString("codebase"); + if (codebase) { + GURL crx_url(*codebase); + if (crx_url.is_valid()) { + result->crx_urls.push_back(std::move(crx_url)); + } + } + const std::string* codebasediff = url.FindString("codebasediff"); + if (codebasediff) { + GURL crx_diffurl(*codebasediff); + if (crx_diffurl.is_valid()) { result->crx_diffurls.push_back(std::move(crx_diffurl)); + } } } @@ -160,49 +173,53 @@ return true; } -void ParseData(const base::Value& data_node, ProtocolParser::Result* result) { - if (!data_node.is_dict()) +void ParseData(const base::Value& data_node_val, + ProtocolParser::Result* result) { + if (!data_node_val.is_dict()) { return; + } + const base::Value::Dict& data_node = data_node_val.GetDict(); result->data.emplace_back(ProtocolParser::Result::Data( GetValueString(data_node, "status"), GetValueString(data_node, "name"), GetValueString(data_node, "index"), GetValueString(data_node, "#text"))); } -bool ParseUpdateCheck(const base::Value& updatecheck_node, +bool ParseUpdateCheck(const base::Value& updatecheck_node_val, ProtocolParser::Result* result, std::string* error) { - if (!updatecheck_node.is_dict()) { + if (!updatecheck_node_val.is_dict()) { *error = "'updatecheck' is not a dictionary."; return false; } + const base::Value::Dict& updatecheck_node = updatecheck_node_val.GetDict(); - for (auto kv : updatecheck_node.DictItems()) { + for (auto kv : updatecheck_node) { if (kv.first.front() == '_' && kv.second.is_string()) { result->custom_attributes[kv.first] = kv.second.GetString(); } } - const auto* status = updatecheck_node.FindKey("status"); - if (!status || !status->is_string()) { + const std::string* status = updatecheck_node.FindString("status"); + if (!status) { *error = "Missing status on updatecheck node"; return false; } - result->status = status->GetString(); + result->status = *status; if (result->status == "noupdate") { - const auto* actions_node = updatecheck_node.FindKey("actions"); + const auto* actions_node = updatecheck_node.Find("actions"); if (actions_node) ParseActions(*actions_node, result); return true; } if (result->status == "ok") { - const auto* actions_node = updatecheck_node.FindKey("actions"); + const auto* actions_node = updatecheck_node.Find("actions"); if (actions_node) ParseActions(*actions_node, result); - const auto* urls_node = updatecheck_node.FindKey("urls"); + const auto* urls_node = updatecheck_node.Find("urls"); if (!urls_node) { *error = "Missing urls on updatecheck."; return false; @@ -211,7 +228,7 @@ if (!ParseUrls(*urls_node, result, error)) return false; - const auto* manifest_node = updatecheck_node.FindKey("manifest"); + const auto* manifest_node = updatecheck_node.Find("manifest"); if (!manifest_node) { *error = "Missing manifest on updatecheck."; return false; @@ -224,23 +241,26 @@ return false; } -bool ParseApp(const base::Value& app_node, +bool ParseApp(const base::Value& app_node_val, ProtocolParser::Result* result, std::string* error) { - if (!app_node.is_dict()) { + if (!app_node_val.is_dict()) { *error = "'app' is not a dictionary."; return false; } + const base::Value::Dict& app_node = app_node_val.GetDict(); for (const auto* cohort_key : {ProtocolParser::Result::kCohort, ProtocolParser::Result::kCohortHint, ProtocolParser::Result::kCohortName}) { - const auto* cohort_value = app_node.FindKey(cohort_key); - if (cohort_value && cohort_value->is_string()) - result->cohort_attrs[cohort_key] = cohort_value->GetString(); + const std::string* cohort_value = app_node.FindString(cohort_key); + if (cohort_value) { + result->cohort_attrs[cohort_key] = *cohort_value; + } } - const auto* appid = app_node.FindKey("appid"); - if (appid && appid->is_string()) - result->extension_id = appid->GetString(); + const std::string* appid = app_node.FindString("appid"); + if (appid) { + result->extension_id = *appid; + } if (result->extension_id.empty()) { *error = "Missing appid on app node"; return false; @@ -250,9 +270,9 @@ // If the status is one of the defined app status error literals, then return // it in the result as if it were an updatecheck status, then stop parsing, // and return success. - const auto* status = app_node.FindKey("status"); - if (status && status->is_string()) { - result->status = status->GetString(); + const std::string* status = app_node.FindString("status"); + if (status) { + result->status = *status; if (result->status == "restricted" || result->status == "error-unknownApplication" || result->status == "error-invalidAppId") @@ -268,15 +288,13 @@ DCHECK(result->status.empty() || result->status == "ok"); - if (const auto* data_node = app_node.FindKey("data")) { - if (const auto* data_list = data_node->GetIfList()) { - base::ranges::for_each(*data_list, [&result](const base::Value& data) { - ParseData(data, result); - }); - } + if (const base::Value::List* data_node = app_node.FindList("data")) { + base::ranges::for_each(*data_node, [&result](const base::Value& data) { + ParseData(data, result); + }); } - const auto* updatecheck_node = app_node.FindKey("updatecheck"); + const auto* updatecheck_node = app_node.Find("updatecheck"); if (!updatecheck_node) { *error = "Missing updatecheck on app."; return false; @@ -314,50 +332,58 @@ ParseError("JSON document is not a dictionary."); return false; } - const auto* response_node = doc->FindKey("response"); - if (!response_node || !response_node->is_dict()) { + const base::Value::Dict* response_node = doc->GetDict().FindDict("response"); + if (!response_node) { ParseError("Missing 'response' element or 'response' is not a dictionary."); return false; } - const auto* protocol = response_node->FindKey("protocol"); - if (!protocol || !protocol->is_string()) { + const std::string* protocol = response_node->FindString("protocol"); + if (!protocol) { ParseError("Missing/non-string protocol."); return false; } - if (protocol->GetString() != kProtocolVersion) { + if (*protocol != kProtocolVersion) { ParseError("Incorrect protocol. (expected '%s', found '%s')", - kProtocolVersion, protocol->GetString().c_str()); + kProtocolVersion, protocol->c_str()); return false; } - const auto* daystart_node = response_node->FindKey("daystart"); - if (daystart_node && daystart_node->is_dict()) { - const auto* elapsed_seconds = daystart_node->FindKey("elapsed_seconds"); - if (elapsed_seconds && elapsed_seconds->is_int()) - results->daystart_elapsed_seconds = elapsed_seconds->GetInt(); - const auto* elapsed_days = daystart_node->FindKey("elapsed_days"); - if (elapsed_days && elapsed_days->is_int()) - results->daystart_elapsed_days = elapsed_days->GetInt(); + const base::Value::Dict* daystart_node = response_node->FindDict("daystart"); + if (daystart_node) { + const absl::optional<int> elapsed_seconds = + daystart_node->FindInt("elapsed_seconds"); + if (elapsed_seconds) { + results->daystart_elapsed_seconds = elapsed_seconds.value(); + } + const absl::optional<int> elapsed_days = + daystart_node->FindInt("elapsed_days"); + if (elapsed_days) { + results->daystart_elapsed_days = elapsed_days.value(); + } } - const auto* systemrequirements_node = - response_node->FindKey("systemrequirements"); - if (systemrequirements_node && systemrequirements_node->is_dict()) { - const auto* platform = systemrequirements_node->FindKey("platform"); - if (platform && platform->is_string()) - results->system_requirements.platform = platform->GetString(); - const auto* arch = systemrequirements_node->FindKey("arch"); - if (arch && arch->is_string()) - results->system_requirements.arch = arch->GetString(); - const auto* min_os_version = - systemrequirements_node->FindKey("min_os_version"); - if (min_os_version && min_os_version->is_string()) - results->system_requirements.min_os_version = min_os_version->GetString(); + const base::Value::Dict* systemrequirements_node = + response_node->FindDict("systemrequirements"); + if (systemrequirements_node) { + const std::string* platform = + systemrequirements_node->FindString("platform"); + if (platform) { + results->system_requirements.platform = *platform; + } + const std::string* arch = systemrequirements_node->FindString("arch"); + if (arch) { + results->system_requirements.arch = *arch; + } + const std::string* min_os_version = + systemrequirements_node->FindString("min_os_version"); + if (min_os_version) { + results->system_requirements.min_os_version = *min_os_version; + } } - const auto* app_node = response_node->FindKey("app"); - if (app_node && app_node->is_list()) { - for (const auto& app : app_node->GetList()) { + const base::Value::List* app_node = response_node->FindList("app"); + if (app_node) { + for (const auto& app : *app_node) { Result result; std::string error; if (ParseApp(app, &result, &error))
diff --git a/components/update_client/protocol_parser_json_unittest.cc b/components/update_client/protocol_parser_json_unittest.cc index 2e51a79..606c6dd 100644 --- a/components/update_client/protocol_parser_json_unittest.cc +++ b/components/update_client/protocol_parser_json_unittest.cc
@@ -114,6 +114,23 @@ ] }})"; +// `manifest` is supposed to be a dictionary. It is a list here. +const char* kJSONInvalidManifest = R"()]}' + {"response":{ + "protocol":"3.1", + "app":[ + { + "appid":"12345", + "status":"ok", + "updatecheck":{ + "status":"ok", + "urls":{"url":[{"codebase":"http://localhost/download/"}]}, + "manifest": [] + } + } + ] + }})"; + const char* kJSONMissingAppId = R"()]}' {"response":{ "protocol":"3.1", @@ -407,6 +424,10 @@ EXPECT_TRUE(parser->results().list.empty()); EXPECT_FALSE(parser->errors().empty()); + EXPECT_TRUE(parser->Parse(kJSONInvalidManifest)); + EXPECT_TRUE(parser->results().list.empty()); + EXPECT_FALSE(parser->errors().empty()); + { // Parse some valid XML, and check that all params came out as expected. EXPECT_TRUE(parser->Parse(kJSONValid));
diff --git a/components/viz/service/display_embedder/skia_output_device_dawn.cc b/components/viz/service/display_embedder/skia_output_device_dawn.cc index b0f6545..ca5a631 100644 --- a/components/viz/service/display_embedder/skia_output_device_dawn.cc +++ b/components/viz/service/display_embedder/skia_output_device_dawn.cc
@@ -32,15 +32,13 @@ SkiaOutputDeviceDawn::SkiaOutputDeviceDawn( DawnContextProvider* context_provider, - gfx::AcceleratedWidget widget, gfx::SurfaceOrigin origin, gpu::MemoryTracker* memory_tracker, DidSwapBufferCompleteCallback did_swap_buffer_complete_callback) : SkiaOutputDevice(context_provider->GetGrContext(), memory_tracker, did_swap_buffer_complete_callback), - context_provider_(context_provider), - child_window_(widget) { + context_provider_(context_provider) { capabilities_.output_surface_origin = origin; capabilities_.uses_default_gl_framebuffer = false; capabilities_.supports_post_sub_buffer = false; @@ -54,8 +52,9 @@ kSurfaceColorType; capabilities_.sk_color_types[static_cast<int>(gfx::BufferFormat::BGRX_8888)] = kSurfaceColorType; - vsync_provider_ = std::make_unique<gl::VSyncProviderWin>(widget); child_window_.Initialize(); + vsync_provider_ = + std::make_unique<gl::VSyncProviderWin>(child_window_.window()); } SkiaOutputDeviceDawn::~SkiaOutputDeviceDawn() = default;
diff --git a/components/viz/service/display_embedder/skia_output_device_dawn.h b/components/viz/service/display_embedder/skia_output_device_dawn.h index 57537e3..29acbc8 100644 --- a/components/viz/service/display_embedder/skia_output_device_dawn.h +++ b/components/viz/service/display_embedder/skia_output_device_dawn.h
@@ -27,7 +27,6 @@ public: SkiaOutputDeviceDawn( DawnContextProvider* context_provider, - gfx::AcceleratedWidget widget, gfx::SurfaceOrigin origin, gpu::MemoryTracker* memory_tracker, DidSwapBufferCompleteCallback did_swap_buffer_complete_callback);
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc index 5ede388..2c722f9 100644 --- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc +++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
@@ -1922,8 +1922,8 @@ #elif BUILDFLAG(IS_WIN) std::unique_ptr<SkiaOutputDeviceDawn> output_device = std::make_unique<SkiaOutputDeviceDawn>( - dawn_context_provider_, dependency_->GetSurfaceHandle(), - gfx::SurfaceOrigin::kTopLeft, shared_gpu_deps_->memory_tracker(), + dawn_context_provider_, gfx::SurfaceOrigin::kTopLeft, + shared_gpu_deps_->memory_tracker(), GetDidSwapBuffersCompleteCallback()); const gpu::SurfaceHandle child_window_handle = output_device->GetChildSurfaceHandle();
diff --git a/content/BUILD.gn b/content/BUILD.gn index d9cec3bd..0514409 100644 --- a/content/BUILD.gn +++ b/content/BUILD.gn
@@ -119,7 +119,6 @@ deps = [ "//content/browser/resources/gpu:html_wrapper_files", "//content/browser/resources/process:build_ts", - "//storage/browser/quota:mojo_bindings_js__generator", ] }
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc index 842d157..05c2a08 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc
@@ -173,7 +173,7 @@ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "base/stack_canary_linux.h" #include "content/browser/sandbox_host_linux.h" #include "content/browser/zygote_host/zygote_host_impl_linux.h" @@ -291,7 +291,7 @@ #endif // V8_USE_EXTERNAL_STARTUP_DATA } -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) pid_t LaunchZygoteHelper(base::CommandLine* cmd_line, base::ScopedFD* control_fd) { // Append any switches from the browser process that need to be forwarded on @@ -368,7 +368,7 @@ ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus( generic_zygote->GetSandboxStatus()); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) @@ -406,7 +406,7 @@ } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) void PreSandboxInit() { // Pre-acquire resources needed by BoringSSL. See // https://boringssl.googlesource.com/boringssl/+/HEAD/SANDBOXING.md @@ -472,7 +472,7 @@ base::internal::CanUseBackgroundThreadTypeForWorkerThread(); base::internal::CanUseUtilityThreadTypeForWorkerThread(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) @@ -599,7 +599,7 @@ int (*function)(MainFunctionParams); }; -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // On platforms that use the zygote, we have a special subset of // subprocesses that are launched via the zygote. This function // fills in some process-launching bits around ZygoteMain(). @@ -683,7 +683,7 @@ DCHECK_GE(absl::get<int>(exit_code), 0); return absl::get<int>(exit_code); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) static void RegisterMainThreadFactories() { UtilityProcessHost::RegisterUtilityMainThreadFactory( @@ -753,12 +753,12 @@ } } -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // Zygote startup is special -- see RunZygote comments above // for why we don't use ZygoteMain directly. if (process_type == switches::kZygoteProcess) return RunZygote(delegate); -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) // If it's a process we don't know about, the embedder should know. auto exit_code = @@ -889,13 +889,13 @@ // Startup tracing flags are not (and should not be) passed to Zygote // processes. We will enable tracing when forked, if needed. bool enable_startup_tracing = process_type != switches::kZygoteProcess; -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // In the browser process, we have to enable startup tracing after // InitializeZygoteSandboxForBrowserProcess() is run below, because that // function forks and may call trace macros in the forked process. if (process_type.empty()) enable_startup_tracing = false; -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) if (enable_startup_tracing) tracing::EnableStartupTracingIfNeeded(); @@ -1005,7 +1005,7 @@ delegate_->SandboxInitialized(process_type); -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) if (process_type.empty()) { // The sandbox host needs to be initialized before forking a thread to // start IPC support, and after setting up the sandbox and invoking @@ -1020,7 +1020,7 @@ // from two processes). tracing::EnableStartupTracingIfNeeded(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) // Return -1 to indicate no early termination. return -1;
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index d47cee5..fee2788e 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -2237,6 +2237,8 @@ "webid/federated_auth_request_impl.h", "webid/federated_auth_request_page_data.cc", "webid/federated_auth_request_page_data.h", + "webid/federated_auth_user_info_request.cc", + "webid/federated_auth_user_info_request.h", "webid/federated_provider_fetcher.cc", "webid/federated_provider_fetcher.h", "webid/flags.cc",
diff --git a/content/browser/aggregation_service/BUILD.gn b/content/browser/aggregation_service/BUILD.gn index fd08bf8e..6e4d4f8 100644 --- a/content/browser/aggregation_service/BUILD.gn +++ b/content/browser/aggregation_service/BUILD.gn
@@ -11,6 +11,7 @@ "//url/mojom:url_mojom_origin", ] webui_module_path = "/" + use_typescript_sources = true cpp_typemaps = [ {
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc b/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc index 678d2f10..5ecb9d73 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl.cc
@@ -212,7 +212,13 @@ // Input event associated with the navigation. AttributionInputEvent input_event; + + // Will not change over the course of the redirect chain. AttributionNavigationType nav_type; + + // Whether the navigation is initiated within a fenced frame. Will not + // change over the course of the redirect chain. + bool is_within_fenced_frame; }; AttributionDataHostManagerImpl::AttributionDataHostManagerImpl( @@ -287,11 +293,13 @@ } auto [it, inserted] = redirect_registrations_.try_emplace( - attribution_src_token, NavigationRedirectSourceRegistrations{ - .source_origin = source_origin, - .register_time = base::TimeTicks::Now(), - .input_event = input_event, - .nav_type = nav_type}); + attribution_src_token, + NavigationRedirectSourceRegistrations{ + .source_origin = source_origin, + .register_time = base::TimeTicks::Now(), + .input_event = input_event, + .nav_type = nav_type, + .is_within_fenced_frame = is_within_fenced_frame}); DCHECK(!it->second.navigation_complete); // Treat ongoing redirect registrations within a chain as a data host for the @@ -308,8 +316,7 @@ header_value, base::BindOnce(&AttributionDataHostManagerImpl::OnRedirectSourceParsed, weak_factory_.GetWeakPtr(), attribution_src_token, - std::move(reporting_origin), header_value, nav_type, - is_within_fenced_frame)); + std::move(reporting_origin), header_value)); } void AttributionDataHostManagerImpl::NotifyNavigationForDataHost( @@ -569,8 +576,6 @@ const blink::AttributionSrcToken& attribution_src_token, const SuitableOrigin& reporting_origin, const std::string& header_value, - AttributionNavigationType nav_type, - bool is_within_fenced_frame, data_decoder::DataDecoder::ValueOrError result) { auto it = redirect_registrations_.find(attribution_src_token); @@ -591,7 +596,8 @@ source = ParseSourceRegistration( std::move(*result).TakeDict(), /*source_time=*/base::Time::Now(), reporting_origin, registrations.source_origin, - AttributionSourceType::kNavigation, is_within_fenced_frame); + AttributionSourceType::kNavigation, + registrations.is_within_fenced_frame); } else { source = base::unexpected(SourceRegistrationError::kRootWrongType); } @@ -599,7 +605,8 @@ if (source.has_value()) { base::UmaHistogramEnumeration( - "Conversions.SourceRegistration.NavigationType.Foreground", nav_type); + "Conversions.SourceRegistration.NavigationType.Foreground", + registrations.nav_type); attribution_manager_->HandleSource(std::move(*source)); } else { attribution_manager_->NotifyFailedSourceRegistration(
diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl.h b/content/browser/attribution_reporting/attribution_data_host_manager_impl.h index 62ca9f6d..ca40066 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl.h +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl.h
@@ -108,8 +108,6 @@ const blink::AttributionSrcToken& attribution_src_token, const attribution_reporting::SuitableOrigin& reporting_origin, const std::string& header_value, - blink::mojom::AttributionNavigationType nav_type, - bool is_within_fenced_frame, data_decoder::DataDecoder::ValueOrError result); void SetTriggerTimer(base::TimeDelta delay);
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 4b934cbf..e74c2209 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -531,7 +531,7 @@ int BrowserMainLoop::EarlyInitialization() { TRACE_EVENT0("startup", "BrowserMainLoop::EarlyInitialization"); -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // The initialization of the sandbox host ends up with forking the Zygote // process and requires no thread been forked. The initialization has happened // by now since a thread to start the ServiceManager has been created
diff --git a/content/browser/child_process_launcher_helper.cc b/content/browser/child_process_launcher_helper.cc index e77e8729..29c887c 100644 --- a/content/browser/child_process_launcher_helper.cc +++ b/content/browser/child_process_launcher_helper.cc
@@ -55,7 +55,7 @@ ChildProcessLauncherHelper::Process::Process(Process&& other) : process(std::move(other.process)) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) , zygote(other.zygote) #endif
diff --git a/content/browser/child_process_launcher_helper.h b/content/browser/child_process_launcher_helper.h index 67aa157..e475cfd 100644 --- a/content/browser/child_process_launcher_helper.h +++ b/content/browser/child_process_launcher_helper.h
@@ -52,7 +52,7 @@ #include "sandbox/policy/fuchsia/sandbox_policy_fuchsia.h" #endif -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/public/common/zygote/zygote_handle.h" // nogncheck #endif @@ -97,9 +97,9 @@ base::Process process; -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* zygote = nullptr; -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_FUCHSIA) // Store `sandbox_policy` within `Process` to ensure that the sandbox policy @@ -232,10 +232,10 @@ void LaunchOnLauncherThread(); -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // Returns the zygote handle for this particular launch, if any. ZygoteCommunication* GetZygoteForLaunch(); -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) base::CommandLine* command_line() { return command_line_.get(); } int child_process_id() const { return child_process_id_; }
diff --git a/content/browser/form_controls_browsertest.cc b/content/browser/form_controls_browsertest.cc index ff3c5cc..263244a 100644 --- a/content/browser/form_controls_browsertest.cc +++ b/content/browser/form_controls_browsertest.cc
@@ -100,11 +100,11 @@ #if BUILDFLAG(IS_MAC) // This fuzzy pixel comparator handles several mac behaviors: // - Different font rendering after 10.14 - // - 10.12 subpixel rendering differences: crbug.com/1037971 // - Slight differences in radio and checkbox rendering in 10.15 + // - Tiny errors (difference <= 1) are ignored for more pixels cc::FuzzyPixelComparator comparator( /* discard_alpha */ true, - /* error_pixels_percentage_limit */ 18.f, + /* error_pixels_percentage_limit */ 26.f, /* small_error_pixels_percentage_limit */ 0.f, /* avg_abs_error_limit */ 20.f, /* max_abs_error_limit */ 120.f,
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index ab01d16..9f1efcd 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -107,7 +107,7 @@ #include "ui/ozone/public/ozone_switches.h" #endif -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/common/zygote/zygote_handle_impl_linux.h" #endif @@ -464,7 +464,7 @@ void DisableAppContainer() { enable_appcontainer_ = false; } #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* GetZygote() override { if (sandbox::policy::IsUnsandboxedSandboxType(GetSandboxType())) return nullptr; @@ -473,7 +473,7 @@ // zygote and then apply the actual sandboxes in the forked process. return GetUnsandboxedZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) sandbox::mojom::Sandbox GetSandboxType() override { if (cmd_line_.HasSwitch(sandbox::policy::switches::kDisableGpuSandbox)) {
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 5a02bbe1..059dca91 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -1032,6 +1032,15 @@ FrameTreeNode* frame_tree_node = FrameTreeNode::GloballyFindByID(frame_tree_node_id_); DCHECK(frame_tree_node); + // Log each hint requested via an ACCEPT_CH Frame whether or not this caused + // the connection to be restarted. + auto* ukm_recorder = ukm::UkmRecorder::Get(); + for (const auto& hint : accept_ch_frame) { + ukm::builders::ClientHints_AcceptCHFrameUsage(ukm_source_id_) + .SetType(static_cast<int64_t>(hint)) + .Record(ukm_recorder->Get()); + } + ClientHintsControllerDelegate* client_hint_delegate = browser_context_->GetClientHintsControllerDelegate();
diff --git a/content/browser/loader/navigation_url_loader_impl.h b/content/browser/loader/navigation_url_loader_impl.h index 055106b4..edfdd68 100644 --- a/content/browser/loader/navigation_url_loader_impl.h +++ b/content/browser/loader/navigation_url_loader_impl.h
@@ -94,6 +94,8 @@ StoragePartitionImpl* partition); private: + FRIEND_TEST_ALL_PREFIXES(NavigationURLLoaderImplTest, + OnAcceptCHFrameReceivedUKM); // Starts the loader by finalizing loader factories initialization and // calling Restart(). // This is called only once (while Restart can be called multiple times).
diff --git a/content/browser/loader/navigation_url_loader_impl_unittest.cc b/content/browser/loader/navigation_url_loader_impl_unittest.cc index b384bf0..0a5d9d5 100644 --- a/content/browser/loader/navigation_url_loader_impl_unittest.cc +++ b/content/browser/loader/navigation_url_loader_impl_unittest.cc
@@ -15,6 +15,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/unguessable_token.h" +#include "components/ukm/test_ukm_recorder.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/browser/loader/navigation_url_loader.h" #include "content/browser/renderer_host/frame_tree_node.h" @@ -42,6 +43,7 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" #include "ppapi/buildflags/buildflags.h" +#include "services/metrics/public/cpp/ukm_builders.h" #include "services/network/public/cpp/cors/origin_access_list.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/single_request_url_loader_factory.h" @@ -594,4 +596,75 @@ EXPECT_EQ(net::ERR_TIMED_OUT, delegate.net_error()); } +// Verify that UKMs are recorded when OnAcceptCHFrameReceived is called. +TEST_F(NavigationURLLoaderImplTest, OnAcceptCHFrameReceivedUKM) { + ASSERT_TRUE(http_test_server_.Start()); + const GURL url = http_test_server_.GetURL("/foo"); + const url::Origin origin = url::Origin::Create(url); + TestNavigationURLLoaderDelegate delegate; + std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader( + url, + base::StringPrintf("%s: %s", net::HttpRequestHeaders::kOrigin, + url.DeprecatedGetOriginAsURL().spec().c_str()), + "GET", &delegate, blink::NavigationDownloadPolicy(), + true /*is_main_frame*/, false /*upgrade_if_insecure*/); + loader->Start(); + + // Try recording no hints. + { + ukm::TestAutoSetUkmRecorder ukm_recorder; + static_cast<NavigationURLLoaderImpl*>(loader.get()) + ->OnAcceptCHFrameReceived(origin, {}, + base::BindOnce([](int32_t) { return; })); + auto ukm_entries = ukm_recorder.GetEntriesByName( + ukm::builders::ClientHints_AcceptCHFrameUsage::kEntryName); + ASSERT_EQ(ukm_entries.size(), 0u); + } + + // Try recording one hint. + { + ukm::TestAutoSetUkmRecorder ukm_recorder; + static_cast<NavigationURLLoaderImpl*>(loader.get()) + ->OnAcceptCHFrameReceived(origin, + {network::mojom::WebClientHintsType::kDpr}, + base::BindOnce([](int32_t) { return; })); + auto ukm_entries = ukm_recorder.GetEntriesByName( + ukm::builders::ClientHints_AcceptCHFrameUsage::kEntryName); + ASSERT_EQ(ukm_entries.size(), 1u); + EXPECT_EQ(*ukm_recorder.GetEntryMetric( + ukm_entries[0], + ukm::builders::ClientHints_AcceptCHFrameUsage::kTypeName), + static_cast<int64_t>(network::mojom::WebClientHintsType::kDpr)); + } + + // Try recording all hints. + { + ukm::TestAutoSetUkmRecorder ukm_recorder; + std::vector<network::mojom::WebClientHintsType> accept_ch_frame; + for (int64_t i = 0; i <= static_cast<int64_t>( + network::mojom::WebClientHintsType::kMaxValue); + ++i) { + accept_ch_frame.push_back( + static_cast<network::mojom::WebClientHintsType>(i)); + } + static_cast<NavigationURLLoaderImpl*>(loader.get()) + ->OnAcceptCHFrameReceived(origin, accept_ch_frame, + base::BindOnce([](int32_t) { return; })); + auto ukm_entries = ukm_recorder.GetEntriesByName( + ukm::builders::ClientHints_AcceptCHFrameUsage::kEntryName); + // If you're here because the test is failing when you added a new client + // hint be sure to increment the number below and add your new hint to the + // enum WebClientHintsType in tools/metrics/histograms/enums.xml. + ASSERT_EQ(ukm_entries.size(), 29u); + for (int64_t i = 0; i <= static_cast<int64_t>( + network::mojom::WebClientHintsType::kMaxValue); + ++i) { + EXPECT_EQ(*ukm_recorder.GetEntryMetric( + ukm_entries[i], + ukm::builders::ClientHints_AcceptCHFrameUsage::kTypeName), + i); + } + } +} + } // namespace content
diff --git a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc index 0b9ab56..971044297 100644 --- a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc +++ b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc
@@ -64,7 +64,7 @@ } #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* PpapiPluginSandboxedProcessLauncherDelegate::GetZygote() { const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); @@ -74,7 +74,7 @@ return nullptr; return GetGenericZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) sandbox::mojom::Sandbox PpapiPluginSandboxedProcessLauncherDelegate::GetSandboxType() {
diff --git a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.h b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.h index efe50a9..4f58fc4a 100644 --- a/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.h +++ b/content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.h
@@ -10,7 +10,7 @@ #include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/zygote/zygote_buildflags.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/public/common/zygote/zygote_handle.h" // nogncheck #endif @@ -33,9 +33,9 @@ bool PreSpawnTarget(sandbox::TargetPolicy* policy) override; #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* GetZygote() override; -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) sandbox::mojom::Sandbox GetSandboxType() override;
diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc index ce87fdf..83f3f0d6 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
@@ -24,14 +24,14 @@ #include "third_party/blink/public/common/switches.h" #endif -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/public/common/content_switches.h" #include "content/public/common/zygote/zygote_handle.h" // nogncheck #endif namespace content { -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* RendererSandboxedProcessLauncherDelegate::GetZygote() { const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); @@ -41,7 +41,7 @@ return nullptr; return GetGenericZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_MAC) bool RendererSandboxedProcessLauncherDelegate::EnableCpuSecurityMitigations() {
diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h index 1d011ff..8f6531e 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h
@@ -20,9 +20,9 @@ ~RendererSandboxedProcessLauncherDelegate() override = default; -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* GetZygote() override; -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_MAC) bool EnableCpuSecurityMitigations() override;
diff --git a/content/browser/resources/aggregation_service/BUILD.gn b/content/browser/resources/aggregation_service/BUILD.gn index db6a09e..c1291f3d 100644 --- a/content/browser/resources/aggregation_service/BUILD.gn +++ b/content/browser/resources/aggregation_service/BUILD.gn
@@ -19,6 +19,7 @@ web_component_files = [ "aggregation_service_internals_table.ts" ] + ts_use_local_config = false ts_deps = [ "//ui/webui/resources:library", "//ui/webui/resources/mojo:library", @@ -26,10 +27,10 @@ aggregation_service_content_folder = "content/browser/aggregation_service" - mojo_files = [ "$root_gen_dir/mojom-webui/$aggregation_service_content_folder/aggregation_service_internals.mojom-webui.js" ] + mojo_files = [ "$root_gen_dir/$aggregation_service_content_folder/aggregation_service_internals.mojom-webui.ts" ] mojo_files_deps = - [ "//$aggregation_service_content_folder:mojo_bindings_js__generator" ] + [ "//$aggregation_service_content_folder:mojo_bindings_ts__generator" ] grit_output_dir = "$root_gen_dir/content" html_to_wrapper_template = "native"
diff --git a/content/browser/resources/aggregation_service/aggregation_service_internals.ts b/content/browser/resources/aggregation_service/aggregation_service_internals.ts index 9a05463..06cedf1 100644 --- a/content/browser/resources/aggregation_service/aggregation_service_internals.ts +++ b/content/browser/resources/aggregation_service/aggregation_service_internals.ts
@@ -173,8 +173,6 @@ return 'Failed to assemble'; case ReportStatus.kFailedToSend: return 'Failed to send'; - default: - return status.toString(); } }
diff --git a/content/browser/resources/aggregation_service/tsconfig_base.json b/content/browser/resources/aggregation_service/tsconfig_base.json deleted file mode 100644 index 99a81eca..0000000 --- a/content/browser/resources/aggregation_service/tsconfig_base.json +++ /dev/null
@@ -1,6 +0,0 @@ -{ - "extends": "../../../../tools/typescript/tsconfig_base.json", - "compilerOptions": { - "allowJs": true - } -}
diff --git a/content/browser/resources/quota/BUILD.gn b/content/browser/resources/quota/BUILD.gn index 42dfb4c3..9dde9eb 100644 --- a/content/browser/resources/quota/BUILD.gn +++ b/content/browser/resources/quota/BUILD.gn
@@ -17,8 +17,9 @@ "quota_internals_browser_proxy.ts", ] - mojo_files_deps = [ "//storage/browser/quota:mojo_bindings_js__generator" ] - mojo_files = [ "$root_gen_dir/mojom-webui/storage/browser/quota/quota_internals.mojom-webui.js" ] + mojo_files_deps = [ "//storage/browser/quota:mojo_bindings_ts__generator" ] + mojo_files = + [ "$root_gen_dir/storage/browser/quota/quota_internals.mojom-webui.ts" ] ts_deps = [ "//ui/webui/resources:library",
diff --git a/content/browser/resources/quota/quota_internals.ts b/content/browser/resources/quota/quota_internals.ts index 0624945..82bec66 100644 --- a/content/browser/resources/quota/quota_internals.ts +++ b/content/browser/resources/quota/quota_internals.ts
@@ -6,7 +6,8 @@ import {Time} from 'chrome://resources/mojo/mojo/public/mojom/base/time.mojom-webui.js'; -import {BucketTableEntry, QuotaInternalsBrowserProxy, RetrieveBucketsTableResult, StorageType} from './quota_internals_browser_proxy.js'; +import {BucketTableEntry} from './quota_internals.mojom-webui.js'; +import {QuotaInternalsBrowserProxy, RetrieveBucketsTableResult, StorageType} from './quota_internals_browser_proxy.js'; // Object for constructing the bucket row in the usage table. interface StorageTypeBucketTableEntry {
diff --git a/content/browser/resources/quota/quota_internals_browser_proxy.ts b/content/browser/resources/quota/quota_internals_browser_proxy.ts index 0fa0433..1222979 100644 --- a/content/browser/resources/quota/quota_internals_browser_proxy.ts +++ b/content/browser/resources/quota/quota_internals_browser_proxy.ts
@@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Time} from 'chrome://resources/mojo/mojo/public/mojom/base/time.mojom-webui.js'; import {Origin} from 'chrome://resources/mojo/url/mojom/origin.mojom-webui.js'; -import {QuotaInternalsHandler} from './quota_internals.mojom-webui.js'; +import {BucketTableEntry, QuotaInternalsHandler} from './quota_internals.mojom-webui.js'; export enum StorageType { TEMPORARY = 0, @@ -13,17 +12,6 @@ SYNCABLE = 2, } -export interface BucketTableEntry { - 'bucketId': bigint; - 'storageKey': string; - 'type': StorageType; - 'name': string; - 'usage': bigint; - 'useCount': bigint; - 'lastAccessed': Time; - 'lastModified': Time; -} - interface GetDiskAvailabilityAndTempPoolSizeResult { totalSpace: bigint; availableSpace: bigint; @@ -35,15 +23,6 @@ unlimitedUsage: bigint; } -interface GetStatisticsResult { - evictionStatistics: { - 'errors-on-getting-usage-and-quota': string, - 'evicted-buckets': string, - 'eviction-rounds': string, - 'skipped-eviction-rounds': string, - }; -} - export interface RetrieveBucketsTableResult { entries: BucketTableEntry[]; } @@ -73,7 +52,7 @@ return this.handler.getGlobalUsageForInternals(storageType); } - getStatistics(): Promise<GetStatisticsResult> { + getStatistics(): Promise<{evictionStatistics: {[key: string]: string}}> { return this.handler.getStatistics(); }
diff --git a/content/browser/resources/quota/tsconfig_base.json b/content/browser/resources/quota/tsconfig_base.json index bca43e7..8540637d 100644 --- a/content/browser/resources/quota/tsconfig_base.json +++ b/content/browser/resources/quota/tsconfig_base.json
@@ -1,8 +1,7 @@ { "extends": "../../../../tools/typescript/tsconfig_base.json", "compilerOptions": { - "allowJs": true, "noUncheckedIndexedAccess": false, "noUnusedLocals": false } - } \ No newline at end of file + }
diff --git a/content/browser/theme_helper_mac.h b/content/browser/theme_helper_mac.h index 2ae03f10..ebb8cb55 100644 --- a/content/browser/theme_helper_mac.h +++ b/content/browser/theme_helper_mac.h
@@ -8,8 +8,7 @@ #include "base/containers/span.h" #include "base/memory/read_only_shared_memory_region.h" #include "base/memory/writable_shared_memory_region.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/render_process_host_creation_observer.h" #include "third_party/blink/public/common/sandbox_support/sandbox_support_mac.h" #include "third_party/blink/public/platform/mac/web_scrollbar_theme.h" #include "third_party/skia/include/core/SkColor.h" @@ -25,7 +24,7 @@ // This class is used to monitor macOS system appearance changes and to notify // sandboxed child processes when they change. This class lives on the UI // thread. -class ThemeHelperMac : public NotificationObserver { +class ThemeHelperMac : public content::RenderProcessHostCreationObserver { public: // Return pointer to the singleton instance for the current process, or NULL // if none. @@ -53,10 +52,8 @@ // be stored. void LoadSystemColorsForCurrentAppearance(base::span<SkColor> values); - // Overridden from NotificationObserver: - void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) override; + // Overridden from content::RenderProcessHostCreationObserver: + void OnRenderProcessHostCreated(content::RenderProcessHost* host) override; // ObjC object that observes notifications from the system. SystemThemeObserver* theme_observer_; // strong @@ -69,8 +66,6 @@ // Read-only handle to the |writable_color_map_| that can be duplicated for // sharing to child processes. base::ReadOnlySharedMemoryRegion read_only_color_map_; - - NotificationRegistrar registrar_; }; } // namespace content
diff --git a/content/browser/theme_helper_mac.mm b/content/browser/theme_helper_mac.mm index 3ebc4c8..2dc085a 100644 --- a/content/browser/theme_helper_mac.mm +++ b/content/browser/theme_helper_mac.mm
@@ -284,9 +284,6 @@ initWithColorsChangedCallback:base::BindRepeating( &ThemeHelperMac::LoadSystemColors, base::Unretained(this))]; - registrar_.Add(this, - NOTIFICATION_RENDERER_PROCESS_CREATED, - NotificationService::AllSources()); } ThemeHelperMac::~ThemeHelperMac() { @@ -382,11 +379,8 @@ } } -void ThemeHelperMac::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { - DCHECK_EQ(NOTIFICATION_RENDERER_PROCESS_CREATED, type); - +void ThemeHelperMac::OnRenderProcessHostCreated( + content::RenderProcessHost* host) { // When a new RenderProcess is created, send it the initial preference // parameters. content::mojom::UpdateScrollbarThemeParamsPtr params = @@ -395,7 +389,7 @@ params->redraw = false; RenderProcessHostImpl* rphi = - Source<content::RenderProcessHostImpl>(source).ptr(); + static_cast<content::RenderProcessHostImpl*>(host); content::mojom::Renderer* renderer = rphi->GetRendererInterface(); renderer->UpdateScrollbarTheme(std::move(params)); SendSystemColorsChangedMessage(renderer);
diff --git a/content/browser/utility_sandbox_delegate.cc b/content/browser/utility_sandbox_delegate.cc index 5d7e660..96698103 100644 --- a/content/browser/utility_sandbox_delegate.cc +++ b/content/browser/utility_sandbox_delegate.cc
@@ -14,7 +14,7 @@ #include "printing/buildflags/buildflags.h" #include "sandbox/policy/mojom/sandbox.mojom.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/common/zygote/zygote_handle_impl_linux.h" #include "sandbox/policy/sandbox_type.h" #endif @@ -102,7 +102,7 @@ } #endif // BUILDFLAG(IS_POSIX) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* UtilitySandboxedProcessLauncherDelegate::GetZygote() { // If the sandbox has been disabled for a given type, don't use a zygote. if (sandbox::policy::IsUnsandboxedSandboxType(sandbox_type_)) @@ -139,6 +139,6 @@ // All other types use the pre-sandboxed zygote. return GetGenericZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) } // namespace content
diff --git a/content/browser/utility_sandbox_delegate.h b/content/browser/utility_sandbox_delegate.h index 0d50bd9..4da1405 100644 --- a/content/browser/utility_sandbox_delegate.h +++ b/content/browser/utility_sandbox_delegate.h
@@ -12,9 +12,9 @@ #include "content/public/common/zygote/zygote_buildflags.h" #include "sandbox/policy/mojom/sandbox.mojom.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/common/zygote/zygote_handle_impl_linux.h" -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_WIN) #include "sandbox/win/src/sandbox_policy.h" @@ -41,9 +41,9 @@ bool CetCompatible() override; #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* GetZygote() override; -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_POSIX) base::EnvironmentMap GetEnvironment() override;
diff --git a/content/browser/webid/fedcm_metrics.h b/content/browser/webid/fedcm_metrics.h index 986bb55d..c55db07a 100644 --- a/content/browser/webid/fedcm_metrics.h +++ b/content/browser/webid/fedcm_metrics.h
@@ -90,7 +90,7 @@ kMaxValue = kMismatchWithUnexpectedAccounts }; -class FedCmMetrics { +class CONTENT_EXPORT FedCmMetrics { public: FedCmMetrics(const GURL& provider, const ukm::SourceId page_source_id,
diff --git a/content/browser/webid/federated_auth_request_impl.cc b/content/browser/webid/federated_auth_request_impl.cc index 790b846..5c03b88d 100644 --- a/content/browser/webid/federated_auth_request_impl.cc +++ b/content/browser/webid/federated_auth_request_impl.cc
@@ -18,6 +18,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/webid/fake_identity_request_dialog_controller.h" #include "content/browser/webid/federated_auth_request_page_data.h" +#include "content/browser/webid/federated_auth_user_info_request.h" #include "content/browser/webid/flags.h" #include "content/browser/webid/webid_utils.h" #include "content/public/browser/browser_context.h" @@ -42,6 +43,7 @@ using blink::mojom::IdentityProviderGetParametersPtr; using blink::mojom::LogoutRpsStatus; using blink::mojom::RequestTokenStatus; +using blink::mojom::RequestUserInfoStatus; using FederatedApiPermissionStatus = content::FederatedIdentityApiPermissionContextDelegate::PermissionStatus; using TokenStatus = content::FedCmRequestIdTokenStatus; @@ -213,18 +215,6 @@ return FormatUrlForDisplay(origin.GetURL()); } -bool ShouldFailBecauseNotSignedInWithIdp( - const GURL& idp_url, - FederatedIdentityPermissionContextDelegate* permission_delegate) { - if (GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::DISABLED) - return false; - - const url::Origin idp_origin = url::Origin::Create(idp_url); - const absl::optional<bool> idp_signin_status = - permission_delegate->GetIdpSigninStatus(idp_origin); - return !idp_signin_status.value_or(true); -} - FederatedAuthRequestPageData* GetPageData(RenderFrameHost* render_frame_host) { return FederatedAuthRequestPageData::GetOrCreateForPage( render_frame_host->GetPage()); @@ -265,6 +255,14 @@ } } +std::unique_ptr<FedCmMetrics> CreateFedCmMetrics( + const GURL& provider_config_url, + const ukm::SourceId& source_id, + bool is_disabled) { + return std::make_unique<FedCmMetrics>(provider_config_url, source_id, + base::RandInt(1, 1 << 30), is_disabled); +} + bool HasSingleReturningAccount(const std::vector<IdentityProviderData>& idps) { bool has_single_returning_account = false; for (const auto& idp : idps) { @@ -347,12 +345,19 @@ FederatedAuthRequestImpl::~FederatedAuthRequestImpl() { // Ensures key data members are destructed in proper order and resolves any // pending promise. - if (auth_request_callback_) { + if (auth_request_token_callback_) { DCHECK(!logout_callback_); CompleteRequestWithError(FederatedAuthRequestResult::kError, TokenStatus::kUnhandledRequest, /*should_delay_callback=*/false); } + if (user_info_request_) { + // Calls |FederatedAuthUserInfoRequest|'s destructor to complete the user + // info request. This is needed because otherwise some resources like + // `fedcm_metrics_` may no longer be usable when the destructor get invoked + // naturally. + user_info_request_.reset(); + } if (logout_callback_) { // We do not complete the logout request, so unset the // PendingWebIdentityRequest on the Page so that other frames in the @@ -422,10 +427,10 @@ if (!fedcm_metrics_) { // TODO(crbug.com/1307709): Handle FedCmMetrics for multiple IDPs. - fedcm_metrics_ = std::make_unique<FedCmMetrics>( - idp_get_params_ptrs[0]->providers[0]->config_url, - render_frame_host().GetPageUkmSourceId(), base::RandInt(1, 1 << 30), - /*is_disabled=*/idp_get_params_ptrs.size() > 1); + fedcm_metrics_ = + CreateFedCmMetrics(idp_get_params_ptrs[0]->providers[0]->config_url, + render_frame_host().GetPageUkmSourceId(), + /*is_disabled=*/idp_get_params_ptrs.size() > 1); } if (HasPendingRequest()) { @@ -435,7 +440,7 @@ return; } - auth_request_callback_ = std::move(callback); + auth_request_token_callback_ = std::move(callback); GetPageData(&render_frame_host())->SetHasPendingWebIdentityRequest(true); network_manager_ = CreateNetworkManager(); request_dialog_controller_ = CreateDialogController(); @@ -498,10 +503,12 @@ return; } - // TODO(crbug.com/1382545): Handle ShouldFailIfNotSignedInWithIdp in the - // multi IDP use case. - bool has_failing_idp_signin_status = ShouldFailBecauseNotSignedInWithIdp( - idp_ptr->config_url, permission_delegate_); + // TODO(crbug.com/1382545): Handle + // ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp in the multi + // IDP use case. + bool has_failing_idp_signin_status = + webid::ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + idp_ptr->config_url, permission_delegate_); if (has_failing_idp_signin_status && GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::ENABLED) { @@ -543,9 +550,42 @@ weak_ptr_factory_.GetWeakPtr(), std::move(get_infos))); } -void FederatedAuthRequestImpl::CancelTokenRequest() { - if (!auth_request_callback_) +void FederatedAuthRequestImpl::RequestUserInfo( + blink::mojom::IdentityProviderConfigPtr provider, + RequestUserInfoCallback callback) { + if (!IsFedCmUserInfoEnabled()) { + // This could happen with a compromised renderer. Exit early such that we + // don't proceed when the flag is off or crash the browser. + std::move(callback).Run(RequestUserInfoStatus::kError, absl::nullopt); return; + } + + if (user_info_request_) { + std::move(callback).Run(RequestUserInfoStatus::kErrorTooManyRequests, + absl::nullopt); + return; + } + + if (!fedcm_metrics_) { + fedcm_metrics_ = CreateFedCmMetrics( + provider->config_url, render_frame_host().GetPageUkmSourceId(), + /*is_disabled=*/false); + } + + auto network_manager = IdpNetworkRequestManager::Create( + static_cast<RenderFrameHostImpl*>(&render_frame_host())); + user_info_request_ = FederatedAuthUserInfoRequest::CreateAndStart( + std::move(network_manager), api_permission_delegate_.get(), + permission_delegate_.get(), &render_frame_host(), fedcm_metrics_.get(), + std::move(provider), + base::BindOnce(&FederatedAuthRequestImpl::CompleteUserInfoRequest, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + +void FederatedAuthRequestImpl::CancelTokenRequest() { + if (!auth_request_token_callback_) { + return; + } // Dialog will be hidden by the destructor for request_dialog_controller_, // triggered by CompleteRequest. @@ -632,7 +672,8 @@ bool FederatedAuthRequestImpl::HasPendingRequest() const { bool has_pending_request = GetPageData(&render_frame_host())->HasPendingWebIdentityRequest(); - DCHECK(has_pending_request || (!auth_request_callback_ && !logout_callback_)); + DCHECK(has_pending_request || + (!auth_request_token_callback_ && !logout_callback_)); return has_pending_request; } @@ -677,8 +718,8 @@ // Make sure that we don't fetch accounts if the IDP sign-in bit is reset to // false during the API call. e.g. by the login/logout HEADER. idp_info->has_failing_idp_signin_status = - ShouldFailBecauseNotSignedInWithIdp(identity_provider_config_url, - permission_delegate_); + webid::ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + identity_provider_config_url, permission_delegate_); if (idp_info->has_failing_idp_signin_status && GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::ENABLED) { // Do not send metrics for IDP where the user is not signed-in in order @@ -821,6 +862,7 @@ void FederatedAuthRequestImpl::HandleAccountsFetchFailure( std::unique_ptr<IdentityProviderInfo> idp_info, + absl::optional<bool> old_idp_signin_status, blink::mojom::FederatedAuthRequestResult result, absl::optional<TokenStatus> token_status) { if (GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::DISABLED) { @@ -830,13 +872,8 @@ } url::Origin idp_origin = url::Origin::Create(idp_info->provider->config_url); - const absl::optional<bool> idp_signin_status = - permission_delegate_->GetIdpSigninStatus(idp_origin); - // Ensures that we only fetch accounts unconditionally once. - permission_delegate_->SetIdpSigninStatus(idp_origin, false); - - if (!idp_signin_status.has_value() || + if (!old_idp_signin_status.has_value() || GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::METRICS_ONLY) { OnFetchDataForIdpFailed(std::move(idp_info), result, token_status, /*should_delay_callback=*/true); @@ -874,22 +911,20 @@ std::unique_ptr<IdentityProviderInfo> idp_info, IdpNetworkRequestManager::FetchStatus status, IdpNetworkRequestManager::AccountList accounts) { - url::Origin idp_origin = url::Origin::Create(idp_info->provider->config_url); - - if (GetFedCmIdpSigninStatusMode() != FedCmIdpSigninStatusMode::DISABLED) { - // Record metrics on effect of IDP sign-in status API. - const absl::optional<bool> idp_signin_status = - permission_delegate_->GetIdpSigninStatus(idp_origin); - fedcm_metrics_->RecordIdpSigninMatchStatus(idp_signin_status, - status.parse_status); - } + GURL idp_config_url = idp_info->provider->config_url; + const absl::optional<bool> old_idp_signin_status = + permission_delegate_->GetIdpSigninStatus( + url::Origin::Create(idp_config_url)); + webid::UpdateIdpSigninStatusForAccountsEndpointResponse( + idp_config_url, status, idp_info->has_failing_idp_signin_status, + permission_delegate_, fedcm_metrics_.get()); constexpr char kAccountsUrl[] = "accounts endpoint"; switch (status.parse_status) { case IdpNetworkRequestManager::ParseStatus::kHttpNotFoundError: { MaybeAddResponseCodeToConsole(kAccountsUrl, status.response_code); HandleAccountsFetchFailure( - std::move(idp_info), + std::move(idp_info), old_idp_signin_status, FederatedAuthRequestResult::kErrorFetchingAccountsHttpNotFound, TokenStatus::kAccountsHttpNotFound); return; @@ -897,7 +932,7 @@ case IdpNetworkRequestManager::ParseStatus::kNoResponseError: { MaybeAddResponseCodeToConsole(kAccountsUrl, status.response_code); HandleAccountsFetchFailure( - std::move(idp_info), + std::move(idp_info), old_idp_signin_status, FederatedAuthRequestResult::kErrorFetchingAccountsNoResponse, TokenStatus::kAccountsNoResponse); return; @@ -905,7 +940,7 @@ case IdpNetworkRequestManager::ParseStatus::kInvalidResponseError: { MaybeAddResponseCodeToConsole(kAccountsUrl, status.response_code); HandleAccountsFetchFailure( - std::move(idp_info), + std::move(idp_info), old_idp_signin_status, FederatedAuthRequestResult::kErrorFetchingAccountsInvalidResponse, TokenStatus::kAccountsInvalidResponse); return; @@ -913,7 +948,7 @@ case IdpNetworkRequestManager::ParseStatus::kEmptyListError: { MaybeAddResponseCodeToConsole(kAccountsUrl, status.response_code); HandleAccountsFetchFailure( - std::move(idp_info), + std::move(idp_info), old_idp_signin_status, FederatedAuthRequestResult::kErrorFetchingAccountsListEmpty, TokenStatus::kAccountsListEmpty); return; @@ -926,7 +961,7 @@ // treat this exactly the same as if we had received an empty accounts // list, i.e. IdpNetworkRequestManager::ParseStatus::kEmptyListError. HandleAccountsFetchFailure( - std::move(idp_info), + std::move(idp_info), old_idp_signin_status, FederatedAuthRequestResult::kErrorFetchingAccountsListEmpty, TokenStatus::kAccountsListEmpty); return; @@ -934,13 +969,6 @@ } ComputeLoginStateAndReorderAccounts(idp_info->provider, accounts); - if (!idp_info->has_failing_idp_signin_status) { - // This scenario occurs in FedCmIdpSigninStatusMode::METRICS_ONLY mode. - // Don't set the IDP sign-in status because we would not get here in - // FedCmIdpSigninStatusMode::ENABLED mode. - permission_delegate_->SetIdpSigninStatus(idp_origin, true); - } - bool need_client_metadata = false; for (const IdentityRequestAccount& account : accounts) { // ComputeLoginStateAndReorderAccounts() should have populated @@ -1268,8 +1296,9 @@ bool should_delay_callback) { DCHECK(result == FederatedAuthRequestResult::kSuccess || id_token.empty()); - if (!auth_request_callback_) + if (!auth_request_token_callback_) { return; + } if (token_status) fedcm_metrics_->RecordRequestTokenStatus(*token_status); @@ -1295,9 +1324,9 @@ RequestTokenStatus status = FederatedAuthRequestResultToRequestTokenStatus(result); - std::move(auth_request_callback_) + std::move(auth_request_token_callback_) .Run(status, selected_idp_config_url, id_token); - auth_request_callback_.Reset(); + auth_request_token_callback_.Reset(); } else { base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask( FROM_HERE, @@ -1397,6 +1426,18 @@ } } +void FederatedAuthRequestImpl::CompleteUserInfoRequest( + RequestUserInfoCallback callback, + blink::mojom::RequestUserInfoStatus status, + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> user_info) { + if (!user_info_request_) { + return; + } + + std::move(callback).Run(status, std::move(user_info)); + user_info_request_.reset(); +} + std::unique_ptr<IdpNetworkRequestManager> FederatedAuthRequestImpl::CreateNetworkManager() { if (mock_network_manager_) @@ -1441,7 +1482,7 @@ } void FederatedAuthRequestImpl::OnRejectRequest() { - if (auth_request_callback_) { + if (auth_request_token_callback_) { DCHECK(!logout_callback_); DCHECK(errors_logged_to_console_); CompleteRequestWithError(FederatedAuthRequestResult::kError, absl::nullopt,
diff --git a/content/browser/webid/federated_auth_request_impl.h b/content/browser/webid/federated_auth_request_impl.h index e401c5bc..41aa62d 100644 --- a/content/browser/webid/federated_auth_request_impl.h +++ b/content/browser/webid/federated_auth_request_impl.h
@@ -26,6 +26,7 @@ namespace content { +class FederatedAuthUserInfoRequest; class FederatedIdentityApiPermissionContextDelegate; class FederatedIdentityPermissionContextDelegate; class RenderFrameHost; @@ -58,6 +59,8 @@ void RequestToken(std::vector<blink::mojom::IdentityProviderGetParametersPtr> idp_get_params_ptrs, RequestTokenCallback) override; + void RequestUserInfo(blink::mojom::IdentityProviderConfigPtr provider, + RequestUserInfoCallback) override; void CancelTokenRequest() override; void LogoutRps(std::vector<blink::mojom::LogoutRpsRequestPtr> logout_requests, LogoutRpsCallback) override; @@ -145,6 +148,7 @@ // failure UI if applicable. void HandleAccountsFetchFailure( std::unique_ptr<IdentityProviderInfo> idp_info, + absl::optional<bool> old_idp_signin_status, blink::mojom::FederatedAuthRequestResult result, absl::optional<content::FedCmRequestIdTokenStatus> token_status); @@ -182,6 +186,10 @@ const std::string& token, bool should_delay_callback); void CompleteLogoutRequest(blink::mojom::LogoutRpsStatus); + void CompleteUserInfoRequest( + RequestUserInfoCallback callback, + blink::mojom::RequestUserInfoStatus status, + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> user_info); // Notifies metrics endpoint that either the user did not select the IDP in // the prompt or that there was an error in fetching data for the IDP. @@ -253,10 +261,25 @@ base::TimeTicks token_response_time_; base::TimeDelta token_request_delay_; bool errors_logged_to_console_{false}; - RequestTokenCallback auth_request_callback_; + // While there could be both token request and user info request when a user + // visits a site, it's worth noting that they must be from different render + // frames. e.g. one top frame rp.example and one iframe idp.example. + // Therefore, + // 1. if one of the requests exists, the other one shouldn't. e.g. if the + // iframe requests user info, it cannot request token at the same time. + // 2. the user info request should not set "HasPendingRequest" on the page + // (multiple per page). It's OK to have multiple concurrent user info requests + // since there's no browser UI involved. e.g. rp.example embeds + // iframe1.example and iframe2.example. Both iframes can request user info + // simultaneously. + RequestTokenCallback auth_request_token_callback_; std::unique_ptr<FederatedProviderFetcher> provider_fetcher_; + // Only one user info request allowed at a time per frame. Can be done in + // parallel with token requests. + std::unique_ptr<FederatedAuthUserInfoRequest> user_info_request_; + base::queue<blink::mojom::LogoutRpsRequestPtr> logout_requests_; LogoutRpsCallback logout_callback_;
diff --git a/content/browser/webid/federated_auth_user_info_request.cc b/content/browser/webid/federated_auth_user_info_request.cc new file mode 100644 index 0000000..c602f43 --- /dev/null +++ b/content/browser/webid/federated_auth_user_info_request.cc
@@ -0,0 +1,223 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/webid/federated_auth_user_info_request.h" + +#include "base/functional/callback.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/browser/webid/flags.h" +#include "content/browser/webid/webid_utils.h" +#include "content/public/browser/federated_identity_api_permission_context_delegate.h" +#include "content/public/browser/federated_identity_permission_context_delegate.h" +#include "content/public/browser/render_frame_host.h" +#include "services/network/public/cpp/is_potentially_trustworthy.h" +#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h" +#include "url/url_constants.h" + +namespace content { + +using FederatedApiPermissionStatus = + FederatedIdentityApiPermissionContextDelegate::PermissionStatus; +using LoginState = IdentityRequestAccount::LoginState; + +// static +std::unique_ptr<FederatedAuthUserInfoRequest> +FederatedAuthUserInfoRequest::CreateAndStart( + std::unique_ptr<IdpNetworkRequestManager> network_manager, + FederatedIdentityApiPermissionContextDelegate* api_permission_delegate, + FederatedIdentityPermissionContextDelegate* permission_delegate, + RenderFrameHost* render_frame_host, + FedCmMetrics* metrics, + blink::mojom::IdentityProviderConfigPtr provider, + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback) { + std::unique_ptr<FederatedAuthUserInfoRequest> request = + base::WrapUnique<FederatedAuthUserInfoRequest>( + new FederatedAuthUserInfoRequest( + std::move(network_manager), permission_delegate, + render_frame_host, metrics, std::move(provider), + std::move(callback))); + request->Start(api_permission_delegate); + return request; +} + +FederatedAuthUserInfoRequest::~FederatedAuthUserInfoRequest() { + CompleteWithError(); +} + +FederatedAuthUserInfoRequest::FederatedAuthUserInfoRequest( + std::unique_ptr<IdpNetworkRequestManager> network_manager, + FederatedIdentityPermissionContextDelegate* permission_delegate, + RenderFrameHost* render_frame_host, + FedCmMetrics* metrics, + blink::mojom::IdentityProviderConfigPtr provider, + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback) + : network_manager_(std::move(network_manager)), + permission_delegate_(permission_delegate), + metrics_(metrics), + client_id_(provider->client_id), + idp_config_url_(provider->config_url), + origin_(render_frame_host->GetLastCommittedOrigin()), + callback_(std::move(callback)) { + RenderFrameHost* main_frame = render_frame_host->GetMainFrame(); + DCHECK(main_frame->IsInPrimaryMainFrame()); + embedding_origin_ = main_frame->GetLastCommittedOrigin(); + + RenderFrameHost* parent_frame = render_frame_host->GetParentOrOuterDocument(); + parent_frame_origin_ = + parent_frame ? parent_frame->GetLastCommittedOrigin() : url::Origin(); +} + +void FederatedAuthUserInfoRequest::Start( + FederatedIdentityApiPermissionContextDelegate* api_permission_delegate) { + // Renderer also checks that the origin is same origin with `idp_config_url_`. + // The check is duplicated in case that the renderer is compromised. + if (!origin_.IsSameOriginWith(idp_config_url_)) { + Complete(blink::mojom::RequestUserInfoStatus::kError, absl::nullopt); + return; + } + + // Check that `render_frame_host` is for an iframe. + if (!parent_frame_origin_.GetURL().is_valid()) { + CompleteWithError(); + return; + } + + if (!network::IsOriginPotentiallyTrustworthy( + url::Origin::Create(idp_config_url_))) { + CompleteWithError(); + return; + } + + FederatedApiPermissionStatus permission_status = + api_permission_delegate->GetApiPermissionStatus(embedding_origin_); + if (permission_status != FederatedApiPermissionStatus::GRANTED) { + CompleteWithError(); + return; + } + + if (webid::ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + idp_config_url_, permission_delegate_) && + GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::ENABLED) { + CompleteWithError(); + return; + } + + // FederatedProviderFetcher is stored as a member so that + // FederatedProviderFetcher is destroyed when FederatedAuthRequestImpl is + // destroyed. + provider_fetcher_ = + std::make_unique<FederatedProviderFetcher>(network_manager_.get()); + provider_fetcher_->Start( + {idp_config_url_}, /*icon_ideal_size=*/0, /*icon_minimum_size=*/0, + base::BindOnce( + &FederatedAuthUserInfoRequest::OnAllConfigAndWellKnownFetched, + weak_ptr_factory_.GetWeakPtr())); +} + +void FederatedAuthUserInfoRequest::OnAllConfigAndWellKnownFetched( + std::vector<FederatedProviderFetcher::FetchResult> fetch_results) { + provider_fetcher_.reset(); + + if (fetch_results.size() != 1u) { + // This could happen when the user info request was sent from a compromised + // renderer (>1) or fetch_results is empty (<1). + CompleteWithError(); + return; + } + + if (fetch_results[0].error) { + CompleteWithError(); + return; + } + + // Make sure that we don't fetch accounts if the IDP sign-in bit is reset to + // false during the API call. e.g. by the login/logout HEADER. + does_idp_have_failing_signin_status_ = + webid::ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + idp_config_url_, permission_delegate_); + if (does_idp_have_failing_signin_status_ && + GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::ENABLED) { + CompleteWithError(); + return; + } + + network_manager_->SendAccountsRequest( + fetch_results[0].endpoints.accounts, client_id_, + base::BindOnce(&FederatedAuthUserInfoRequest::OnAccountsResponseReceived, + weak_ptr_factory_.GetWeakPtr())); +} + +void FederatedAuthUserInfoRequest::OnAccountsResponseReceived( + IdpNetworkRequestManager::FetchStatus fetch_status, + IdpNetworkRequestManager::AccountList accounts) { + webid::UpdateIdpSigninStatusForAccountsEndpointResponse( + idp_config_url_, fetch_status, does_idp_have_failing_signin_status_, + permission_delegate_, metrics_); + + if (fetch_status.parse_status != + IdpNetworkRequestManager::ParseStatus::kSuccess) { + CompleteWithError(); + return; + } + MaybeReturnAccounts(std::move(accounts)); +} + +void FederatedAuthUserInfoRequest::MaybeReturnAccounts( + const IdpNetworkRequestManager::AccountList& accounts) { + DCHECK(!accounts.empty()); + + bool has_returning_accounts = false; + for (const auto& account : accounts) { + // The |login_state| will only be |kSignUp| if IDP doesn't provide an + // |approved_clients| or the client id is NOT on the |approved_clients| + // list, in which case we trust the IDP that we should treat the user as a + // new user and shouldn't return the user info. This should override browser + // local stored permission since a user can revoke their account out of + // band. + // Note that we start with the restrictive model and can later evaluate what + // the expected behavior is when |approved_clients| list is not provided. + if (account.login_state == LoginState::kSignUp) { + continue; + } + + if (!permission_delegate_->HasSharingPermission( + parent_frame_origin_, embedding_origin_, + url::Origin::Create(idp_config_url_), account.id)) { + continue; + } + + has_returning_accounts = true; + } + + if (!has_returning_accounts) { + CompleteWithError(); + return; + } + + // The user previously accepted the FedCM prompt for one of the returned IdP + // accounts. Return data for all the IdP accounts. + std::vector<blink::mojom::IdentityUserInfoPtr> user_info; + for (const auto& account : accounts) { + user_info.push_back(blink::mojom::IdentityUserInfo::New( + account.email, account.given_name, account.name, + account.picture.spec())); + } + Complete(blink::mojom::RequestUserInfoStatus::kSuccess, std::move(user_info)); +} + +void FederatedAuthUserInfoRequest::Complete( + blink::mojom::RequestUserInfoStatus status, + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> user_info) { + if (!callback_) { + return; + } + + std::move(callback_).Run(status, std::move(user_info)); +} + +void FederatedAuthUserInfoRequest::CompleteWithError() { + Complete(blink::mojom::RequestUserInfoStatus::kError, absl::nullopt); +} + +} // namespace content
diff --git a/content/browser/webid/federated_auth_user_info_request.h b/content/browser/webid/federated_auth_user_info_request.h new file mode 100644 index 0000000..837259e --- /dev/null +++ b/content/browser/webid/federated_auth_user_info_request.h
@@ -0,0 +1,98 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_WEBID_FEDERATED_AUTH_USER_INFO_REQUEST_H_ +#define CONTENT_BROWSER_WEBID_FEDERATED_AUTH_USER_INFO_REQUEST_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "base/functional/callback_forward.h" +#include "base/memory/raw_ptr.h" +#include "content/browser/webid/federated_provider_fetcher.h" +#include "content/browser/webid/idp_network_request_manager.h" +#include "content/common/content_export.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h" +#include "url/gurl.h" + +namespace content { + +class FedCmMetrics; +class FederatedIdentityApiPermissionContextDelegate; +class FederatedIdentityPermissionContextDelegate; +class FederatedProviderFetcher; +class RenderFrameHost; + +// Fetches data for user-info request. +class CONTENT_EXPORT FederatedAuthUserInfoRequest { + public: + // Returns an object which fetches data for user-info request. Starts fetch. + static std::unique_ptr<FederatedAuthUserInfoRequest> CreateAndStart( + std::unique_ptr<IdpNetworkRequestManager> network_manager, + FederatedIdentityApiPermissionContextDelegate* api_permission_delegate, + FederatedIdentityPermissionContextDelegate* permission_delegate, + RenderFrameHost* render_frame_host, + FedCmMetrics* metrics, + blink::mojom::IdentityProviderConfigPtr provider, + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback); + + FederatedAuthUserInfoRequest(const FederatedAuthUserInfoRequest&) = delete; + FederatedAuthUserInfoRequest& operator=(const FederatedAuthUserInfoRequest&) = + delete; + ~FederatedAuthUserInfoRequest(); + + private: + FederatedAuthUserInfoRequest( + std::unique_ptr<IdpNetworkRequestManager> network_manager, + FederatedIdentityPermissionContextDelegate* permission_delegate, + RenderFrameHost* render_frame_host, + FedCmMetrics* metrics, + blink::mojom::IdentityProviderConfigPtr provider, + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback); + + void Start( + FederatedIdentityApiPermissionContextDelegate* api_permission_delegate); + + void OnAllConfigAndWellKnownFetched( + std::vector<FederatedProviderFetcher::FetchResult> fetch_results); + + void OnAccountsResponseReceived( + IdpNetworkRequestManager::FetchStatus fetch_status, + IdpNetworkRequestManager::AccountList accounts); + + void MaybeReturnAccounts( + const IdpNetworkRequestManager::AccountList& accounts); + + void Complete( + blink::mojom::RequestUserInfoStatus status, + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> user_info); + + void CompleteWithError(); + + std::unique_ptr<IdpNetworkRequestManager> network_manager_; + // Owned by |BrowserContext| + raw_ptr<FederatedIdentityPermissionContextDelegate> permission_delegate_ = + nullptr; + // Owned by |FederatedAuthRequestImpl| + raw_ptr<FedCmMetrics> metrics_; + + std::unique_ptr<FederatedProviderFetcher> provider_fetcher_; + bool does_idp_have_failing_signin_status_{false}; + std::string client_id_; + GURL idp_config_url_; + + url::Origin origin_; + url::Origin embedding_origin_; + url::Origin parent_frame_origin_; + + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback_; + + base::WeakPtrFactory<FederatedAuthUserInfoRequest> weak_ptr_factory_{this}; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_WEBID_FEDERATED_AUTH_USER_INFO_REQUEST_H_
diff --git a/content/browser/webid/federated_auth_user_info_request_unittest.cc b/content/browser/webid/federated_auth_user_info_request_unittest.cc new file mode 100644 index 0000000..16412407 --- /dev/null +++ b/content/browser/webid/federated_auth_user_info_request_unittest.cc
@@ -0,0 +1,382 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/webid/federated_auth_user_info_request.h" + +#include <memory> +#include <set> +#include <string> +#include <vector> + +#include "base/functional/callback_forward.h" +#include "base/run_loop.h" +#include "base/strings/stringprintf.h" +#include "base/task/sequenced_task_runner.h" +#include "base/test/task_environment.h" +#include "content/browser/webid/fedcm_metrics.h" +#include "content/browser/webid/test/mock_api_permission_delegate.h" +#include "content/browser/webid/test/mock_idp_network_request_manager.h" +#include "content/browser/webid/test/mock_permission_delegate.h" +#include "content/public/test/navigation_simulator.h" +#include "content/test/test_render_frame_host.h" +#include "content/test/test_web_contents.h" +#include "net/http/http_status_code.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h" +#include "url/gurl.h" +#include "url/origin.h" + +using ApiPermissionStatus = + content::FederatedIdentityApiPermissionContextDelegate::PermissionStatus; +using FetchStatus = content::IdpNetworkRequestManager::FetchStatus; +using LoginState = content::IdentityRequestAccount::LoginState; +using ParseStatus = content::IdpNetworkRequestManager::ParseStatus; +using blink::mojom::RequestUserInfoStatus; +using ::testing::_; +using ::testing::NiceMock; +using ::testing::Return; + +namespace content { +namespace { + +constexpr char kRpUrl[] = "https://rp.example"; +constexpr char kPersonalizedButtonFrameUrl[] = "https://idp.example/button"; +constexpr char kProviderUrl[] = "https://idp.example/fedcm.json"; +constexpr char kAccountsEndpoint[] = "https://idp.example/accounts"; +constexpr char kTokenEndpoint[] = "https://idp.example/token"; +constexpr char kClientId[] = "client_id_123"; +constexpr char kNonce[] = "nonce123"; + +constexpr char kAccountEmailFormat[] = "%s@foo.com"; +constexpr char kAccountName[] = "The Liliputian"; +constexpr char kAccountGivenName[] = "Julius"; +constexpr char kAccountPicture[] = "https://image.com/yolo"; + +struct AccountConfig { + std::string id; + absl::optional<IdentityRequestAccount::LoginState> login_state; + bool was_granted_sharing_permission; +}; + +struct Config { + absl::optional<bool> idp_signin_status; + std::vector<AccountConfig> accounts; + FetchStatus config_fetch_status; + FetchStatus accounts_fetch_status; +}; + +Config kValidConfig = { + /*idp_signin_status=*/true, + /*accounts=*/ + {{"account1", /*login_state=*/absl::nullopt, + /*was_granted_sharing_permission=*/true}}, + /*config_fetch_status=*/{ParseStatus::kSuccess, net::HTTP_OK}, + /*accounts_fetch_status=*/{ParseStatus::kSuccess, net::HTTP_OK}}; + +std::string GenerateEmailForUserId(const std::string& user_id) { + return base::StringPrintf(kAccountEmailFormat, user_id.c_str()); +} + +// Helper class for blocking till RequestUserInfoCallback is called. +class UserInfoCallbackHelper { + public: + UserInfoCallbackHelper() = default; + ~UserInfoCallbackHelper() = default; + + UserInfoCallbackHelper(const UserInfoCallbackHelper&) = delete; + UserInfoCallbackHelper& operator=(const UserInfoCallbackHelper&) = delete; + + // This can only be called once per lifetime of this object. + blink::mojom::FederatedAuthRequest::RequestUserInfoCallback callback() { + return base::BindOnce(&UserInfoCallbackHelper::Complete, + base::Unretained(this)); + } + + // Returns when callback() is called, which can be immediately if it has + // already been called. + void WaitForCallback() { + if (was_called_) { + return; + } + wait_for_callback_loop_.Run(); + } + + RequestUserInfoStatus user_info_status_; + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> user_info_; + + private: + void Complete(RequestUserInfoStatus user_info_status, + absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>> + user_info) { + CHECK(!was_called_); + user_info_status_ = user_info_status; + user_info_ = std::move(user_info); + was_called_ = true; + wait_for_callback_loop_.Quit(); + } + + bool was_called_{false}; + base::RunLoop wait_for_callback_loop_; +}; + +class TestIdpNetworkRequestManager : public MockIdpNetworkRequestManager { + public: + explicit TestIdpNetworkRequestManager(const Config& config) + : config_(config) {} + ~TestIdpNetworkRequestManager() override = default; + + void FetchWellKnown(const GURL& provider, + FetchWellKnownCallback callback) override { + FetchStatus fetch_status = {ParseStatus::kSuccess, net::HTTP_OK}; + std::set<GURL> well_known_urls = {GURL(kProviderUrl)}; + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), fetch_status, well_known_urls)); + } + + void FetchConfig(const GURL& provider, + int idp_brand_icon_ideal_size, + int idp_brand_icon_minimum_size, + FetchConfigCallback callback) override { + has_fetched_config_ = true; + + IdpNetworkRequestManager::Endpoints endpoints; + endpoints.accounts = GURL(kAccountsEndpoint); + endpoints.token = GURL(kTokenEndpoint); + + IdentityProviderMetadata idp_metadata; + idp_metadata.config_url = GURL(kProviderUrl); + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), config_.config_fetch_status, + endpoints, idp_metadata)); + } + + void SendAccountsRequest(const GURL& accounts_url, + const std::string& client_id, + AccountsRequestCallback callback) override { + has_fetched_accounts_endpoint_ = true; + + std::vector<IdentityRequestAccount> accounts; + for (const AccountConfig& account_config : config_.accounts) { + accounts.emplace_back(account_config.id, + GenerateEmailForUserId(account_config.id), + kAccountName, kAccountGivenName, + GURL(kAccountPicture), account_config.login_state); + } + + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), config_.accounts_fetch_status, + std::move(accounts))); + } + + protected: + bool has_fetched_config_{false}; + bool has_fetched_accounts_endpoint_{false}; + + private: + const Config config_; +}; + +class TestApiPermissionDelegate : public MockApiPermissionDelegate { + public: + ApiPermissionStatus GetApiPermissionStatus( + const url::Origin& origin) override { + return ApiPermissionStatus::GRANTED; + } +}; + +class TestPermissionDelegate : public MockPermissionDelegate { + public: + bool HasSharingPermission(const url::Origin& relying_party_requester, + const url::Origin& relying_party_embedder, + const url::Origin& identity_provider, + const std::string& account_id) override { + url::Origin rp_origin_with_data = url::Origin::Create(GURL(kRpUrl)); + url::Origin idp_origin_with_data = + url::Origin::Create(GURL(kPersonalizedButtonFrameUrl)); + return (relying_party_requester == rp_origin_with_data && + relying_party_embedder == rp_origin_with_data && + identity_provider == idp_origin_with_data && + accounts_with_sharing_permission_.count(account_id)); + } + + absl::optional<bool> GetIdpSigninStatus( + const url::Origin& idp_origin) override { + return idp_signin_status_; + } + + void SetConfig(const Config& config) { + idp_signin_status_ = config.idp_signin_status; + + accounts_with_sharing_permission_.clear(); + for (const AccountConfig& account_config : config.accounts) { + if (account_config.was_granted_sharing_permission) { + accounts_with_sharing_permission_.insert(account_config.id); + } + } + } + + private: + absl::optional<bool> idp_signin_status_; + std::set<std::string> accounts_with_sharing_permission_; +}; + +} // namespace + +class FederatedAuthUserInfoRequestTest : public RenderViewHostImplTestHarness { + public: + ~FederatedAuthUserInfoRequestTest() override = default; + + void SetUp() override { + RenderViewHostImplTestHarness::SetUp(); + + api_permission_delegate_ = std::make_unique<TestApiPermissionDelegate>(); + permission_delegate_ = std::make_unique<TestPermissionDelegate>(); + metrics_ = std::make_unique<NiceMock<FedCmMetrics>>( + GURL(kProviderUrl), ukm::kInvalidSourceId, 0, true); + + static_cast<TestWebContents*>(web_contents()) + ->NavigateAndCommit(GURL(kRpUrl), ui::PAGE_TRANSITION_LINK); + + // Add a subframe that navigates to kPersonalizedButtonFrameUrl. + content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe"); + iframe_render_frame_host_ = + static_cast<TestRenderFrameHost*>(contents() + ->GetPrimaryFrameTree() + .root() + ->child_at(0) + ->current_frame_host()); + iframe_render_frame_host_ = static_cast<TestRenderFrameHost*>( + NavigationSimulator::NavigateAndCommitFromDocument( + GURL(kPersonalizedButtonFrameUrl), iframe_render_frame_host_)); + } + + void RunUserInfoTest( + const Config& config, + RequestUserInfoStatus expected_user_info_status, + const std::vector<std::string>& expected_account_user_ids) { + permission_delegate_->SetConfig(config); + + auto network_manager = + std::make_unique<TestIdpNetworkRequestManager>(config); + + blink::mojom::IdentityProviderConfigPtr idp_ptr = + blink::mojom::IdentityProviderConfig::New( + GURL(kProviderUrl), kClientId, kNonce, /*login_hit=*/nullptr); + + UserInfoCallbackHelper callback_helper; + std::unique_ptr<FederatedAuthUserInfoRequest> request = + FederatedAuthUserInfoRequest::CreateAndStart( + std::move(network_manager), api_permission_delegate_.get(), + permission_delegate_.get(), iframe_render_frame_host_, + metrics_.get(), std::move(idp_ptr), callback_helper.callback()); + callback_helper.WaitForCallback(); + + EXPECT_EQ(expected_user_info_status, callback_helper.user_info_status_); + CheckUserInfo(expected_account_user_ids, callback_helper.user_info_); + } + + void CheckUserInfo( + const std::vector<std::string>& expected_account_ids, + const absl::optional<std::vector<blink::mojom::IdentityUserInfoPtr>>& + actual_user_info) { + if (expected_account_ids.empty()) { + EXPECT_EQ(actual_user_info, absl::nullopt); + return; + } + + EXPECT_EQ(expected_account_ids.size(), actual_user_info->size()); + for (size_t i = 0; i < expected_account_ids.size(); ++i) { + EXPECT_EQ(GenerateEmailForUserId(expected_account_ids[i]), + actual_user_info->at(i)->email); + } + } + + protected: + base::raw_ptr<RenderFrameHost> iframe_render_frame_host_; + std::unique_ptr<TestIdpNetworkRequestManager> network_manager_; + std::unique_ptr<TestApiPermissionDelegate> api_permission_delegate_; + std::unique_ptr<TestPermissionDelegate> permission_delegate_; + std::unique_ptr<NiceMock<FedCmMetrics>> metrics_; +}; + +TEST_F(FederatedAuthUserInfoRequestTest, PreviouslySignedIn) { + const char kAccount1Id[] = "account1"; + const char kAccount2Id[] = "account2"; + + Config config = kValidConfig; + config.accounts = {{kAccount1Id, /*login_state=*/absl::nullopt, + /*was_granted_sharing_permission=*/true}, + {kAccount2Id, /*login_state=*/absl::nullopt, + /*was_granted_sharing_permission=*/false}}; + RunUserInfoTest(config, RequestUserInfoStatus::kSuccess, + {kAccount1Id, kAccount2Id}); +} + +TEST_F(FederatedAuthUserInfoRequestTest, NoSignedInAccount) { + const char kAccount1Id[] = "account1"; + const char kAccount2Id[] = "account2"; + + Config config = kValidConfig; + config.accounts = {{kAccount1Id, /*login_state=*/absl::nullopt, + /*was_granted_sharing_permission=*/false}, + {kAccount2Id, /*login_state=*/absl::nullopt, + /*was_granted_sharing_permission=*/false}}; + RunUserInfoTest(config, RequestUserInfoStatus::kError, {}); +} + +TEST_F(FederatedAuthUserInfoRequestTest, NotInApprovedClientsList) { + const char kAccount1Id[] = "account1"; + const char kAccount2Id[] = "account2"; + + Config config = kValidConfig; + config.accounts = {{kAccount1Id, /*login_state=*/LoginState::kSignUp, + /*was_granted_sharing_permission=*/true}, + {kAccount2Id, /*login_state=*/LoginState::kSignUp, + /*was_granted_sharing_permission=*/true}}; + RunUserInfoTest(config, RequestUserInfoStatus::kError, {}); +} + +TEST_F(FederatedAuthUserInfoRequestTest, InApprovedClientsList) { + const char kAccount1Id[] = "account1"; + const char kAccount2Id[] = "account2"; + + Config config = kValidConfig; + config.accounts = {{kAccount1Id, /*login_state=*/LoginState::kSignIn, + /*was_granted_sharing_permission=*/true}, + {kAccount2Id, /*login_state=*/LoginState::kSignUp, + /*was_granted_sharing_permission=*/true}}; + RunUserInfoTest(config, RequestUserInfoStatus::kSuccess, + {kAccount1Id, kAccount2Id}); +} + +TEST_F(FederatedAuthUserInfoRequestTest, ConfigFetchFailed) { + Config config = kValidConfig; + config.config_fetch_status = {ParseStatus::kHttpNotFoundError, 404}; + + RunUserInfoTest(config, RequestUserInfoStatus::kError, {}); +} + +TEST_F(FederatedAuthUserInfoRequestTest, + IdpSigninStatusClearedWhenAccountsRequestFails) { + std::vector<absl::optional<bool>> kTestCases = {absl::nullopt, true}; + + for (const absl::optional<bool>& test_case : kTestCases) { + EXPECT_CALL(*permission_delegate_, SetIdpSigninStatus(_, false)); + + Config config = kValidConfig; + config.idp_signin_status = test_case; + config.accounts_fetch_status = {ParseStatus::kHttpNotFoundError, 404}; + + RunUserInfoTest(config, RequestUserInfoStatus::kError, {}); + + testing::Mock::VerifyAndClearExpectations(permission_delegate_.get()); + } +} + +} // namespace content
diff --git a/content/browser/webid/webid_utils.cc b/content/browser/webid/webid_utils.cc index 8240cd7..ffb505f4 100644 --- a/content/browser/webid/webid_utils.cc +++ b/content/browser/webid/webid_utils.cc
@@ -5,6 +5,8 @@ #include "content/browser/webid/webid_utils.h" #include "base/strings/stringprintf.h" +#include "content/browser/webid/fedcm_metrics.h" +#include "content/browser/webid/flags.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/federated_identity_permission_context_delegate.h" #include "content/public/common/web_identity.h" @@ -56,6 +58,55 @@ .IsSameOriginWith(endpoint_url); } +bool ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + const GURL& identity_provider_config_url, + FederatedIdentityPermissionContextDelegate* permission_delegate) { + if (GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::DISABLED) { + return false; + } + + const url::Origin idp_origin = + url::Origin::Create(identity_provider_config_url); + const absl::optional<bool> idp_signin_status = + permission_delegate->GetIdpSigninStatus(idp_origin); + return !idp_signin_status.value_or(true); +} + +void UpdateIdpSigninStatusForAccountsEndpointResponse( + const GURL& identity_provider_config_url, + IdpNetworkRequestManager::FetchStatus fetch_status, + bool does_idp_have_failing_signin_status, + FederatedIdentityPermissionContextDelegate* permission_delegate, + FedCmMetrics* metrics) { + if (GetFedCmIdpSigninStatusMode() == FedCmIdpSigninStatusMode::DISABLED) { + return; + } + + url::Origin idp_origin = url::Origin::Create(identity_provider_config_url); + + // Record metrics on effect of IDP sign-in status API. + const absl::optional<bool> idp_signin_status = + permission_delegate->GetIdpSigninStatus(idp_origin); + metrics->RecordIdpSigninMatchStatus(idp_signin_status, + fetch_status.parse_status); + + if (fetch_status.parse_status == + IdpNetworkRequestManager::ParseStatus::kSuccess) { + // `does_idp_have_failing_signin_status` fails the request prior to fetching + // the accounts endpoint for FedCmIdpSigninStatusMode::ENABLED mode but not + // FedCmIdpSigninStatusMode::METRICS_ONLY mode. Do not set the IdP sign-in + // status here if `does_idp_have_failing_signin_status` in + // FedCmIdpSigninStatusMode::METRICS_ONLY mode in order to better emulate + // FedCmIdpSigninStatusMode::ENABLED behavior. + if (!does_idp_have_failing_signin_status) { + permission_delegate->SetIdpSigninStatus(idp_origin, true); + } + } else { + // Ensures that we only fetch accounts unconditionally once. + permission_delegate->SetIdpSigninStatus(idp_origin, false); + } +} + std::string GetConsoleErrorMessageFromResult( FederatedAuthRequestResult status) { switch (status) {
diff --git a/content/browser/webid/webid_utils.h b/content/browser/webid/webid_utils.h index 934031d..65dd074 100644 --- a/content/browser/webid/webid_utils.h +++ b/content/browser/webid/webid_utils.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_WEBID_WEBID_UTILS_H_ #define CONTENT_BROWSER_WEBID_WEBID_UTILS_H_ +#include "content/browser/webid/idp_network_request_manager.h" #include "content/common/content_export.h" #include "url/gurl.h" #include "url/origin.h" @@ -16,6 +17,8 @@ namespace content { class BrowserContext; +class FedCmMetrics; +class FederatedIdentityPermissionContextDelegate; enum class IdpSigninStatus; namespace webid { @@ -37,12 +40,32 @@ bool IsEndpointUrlValid(const GURL& identity_provider_config_url, const GURL& endpoint_url); +// Returns whether FedCM should fail/skip the accounts endpoint request because +// the user is not signed-in to the IdP. +bool ShouldFailAccountsEndpointRequestBecauseNotSignedInWithIdp( + const GURL& identity_provider_config_url, + FederatedIdentityPermissionContextDelegate* permission_delegate); + +// Updates the IdP sign-in status based on the accounts endpoint response. Also +// logs IdP sign-in status related UMA metrics. +// +// `does_idp_have_failing_idp_signin_status` indicates whether the accounts +// endpoint request would have been failed/skipped had the IdP signin-status +// been FedCmIdpSigninStatusMode::ENABLED. +void UpdateIdpSigninStatusForAccountsEndpointResponse( + const GURL& identity_provider_config_url, + IdpNetworkRequestManager::FetchStatus account_endpoint_fetch_status, + bool does_idp_have_failing_idp_signin_status, + FederatedIdentityPermissionContextDelegate* permission_delegate, + FedCmMetrics* metrics); + // Returns a string to be used as the console error message from a // FederatedAuthRequestResult. CONTENT_EXPORT std::string GetConsoleErrorMessageFromResult( blink::mojom::FederatedAuthRequestResult result); } // namespace webid + } // namespace content #endif // CONTENT_BROWSER_WEBID_WEBID_UTILS_H_
diff --git a/content/browser/xr/metrics/webxr_session_tracker.cc b/content/browser/xr/metrics/webxr_session_tracker.cc index 17fe3e7..b0ce36b 100644 --- a/content/browser/xr/metrics/webxr_session_tracker.cc +++ b/content/browser/xr/metrics/webxr_session_tracker.cc
@@ -83,6 +83,7 @@ case XRSessionFeature::HAND_INPUT: case XRSessionFeature::SECONDARY_VIEWS: case XRSessionFeature::LAYERS: + case XRSessionFeature::FRONT_FACING: // Not recording metrics for these features currently. // TODO(https://crbug.com/965729): Add metrics for the AR-related features // that are enabled by default. @@ -127,6 +128,7 @@ case XRSessionFeature::HAND_INPUT: case XRSessionFeature::SECONDARY_VIEWS: case XRSessionFeature::LAYERS: + case XRSessionFeature::FRONT_FACING: // Not recording metrics for these features currently. // TODO(https://crbug.com/965729): Add metrics for the AR-related features // that are enabled by default.
diff --git a/content/browser/zygote_host/zygote_browsertest.cc b/content/browser/zygote_host/zygote_browsertest.cc index 7f0c54c..fca68b9f 100644 --- a/content/browser/zygote_host/zygote_browsertest.cc +++ b/content/browser/zygote_host/zygote_browsertest.cc
@@ -16,7 +16,7 @@ #include "content/shell/browser/shell.h" #include "sandbox/policy/linux/sandbox_linux.h" #include "sandbox/policy/switches.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/browser/zygote_host/zygote_host_impl_linux.h" #include "content/common/zygote/zygote_communication_linux.h" #include "content/common/zygote/zygote_handle_impl_linux.h" @@ -47,7 +47,7 @@ EXPECT_TRUE(parts[2].empty()); } -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) IN_PROC_BROWSER_TEST_F(LinuxZygoteBrowserTest, ZygoteSandboxes) { // We need zygotes and the standard sandbox config to run this test. if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) || @@ -95,7 +95,7 @@ } #endif -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) IN_PROC_BROWSER_TEST_F(LinuxZygoteDisabledBrowserTest, NoZygoteWhenZygoteDisabled) { EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,start page")));
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 5d3a076..474ac38 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -220,7 +220,7 @@ {wf::EnableFedCmMultipleIdentityProviders, features::kFedCmMultipleIdentityProviders, kDefault}, {wf::EnableFedCmRpContext, features::kFedCmRpContext, kDefault}, - {wf::EnableFedCmUserInfo, features::kFedCmUserInfo, kDefault}, + {wf::EnableFedCmUserInfo, features::kFedCmUserInfo, kSetOnlyIfOverridden}, {wf::EnableFedCmSelectiveDisclosure, features::kFedCmSelectiveDisclosure, kDefault}, {wf::EnableFencedFrames, features::kPrivacySandboxAdsAPIsOverride, @@ -284,6 +284,7 @@ features::kWebOTPAssertionFeaturePolicy, kSetOnlyIfOverridden}, {wf::EnableWebUSB, features::kWebUsb}, {wf::EnableWebXR, features::kWebXr}, + {wf::EnableWebXRFrontFacing, device::features::kWebXrIncubations}, {wf::EnableWebXRHandInput, device::features::kWebXrHandInput}, {wf::EnableWebXRImageTracking, device::features::kWebXrIncubations}, {wf::EnableWebXRLayers, device::features::kWebXrLayers},
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index bbe6c2e..86b7baf 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -358,7 +358,7 @@ ] } - if (use_zygote_handle) { + if (use_zygote) { sources += [ "zygote/zygote_handle_impl_linux.h", "zygote/zygote_handle_linux.cc",
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index 53a3c8b49..6d88bcb 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn
@@ -315,7 +315,7 @@ ] } - if (use_zygote_handle) { + if (use_zygote) { sources += [ "zygote/zygote_handle.h" ] }
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index a74d986b..0d5e926 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -413,9 +413,10 @@ base::FEATURE_DISABLED_BY_DEFAULT); // Enables usage of the FedCM API with the User Info API at the same time. -BASE_FEATURE(kFedCmUserInfo, - "FedCmUserInfo", - base::FEATURE_DISABLED_BY_DEFAULT); +// Note that actual exposure of the FedCM API to web content is controlled +// by the flag in RuntimeEnabledFeatures on the blink side. See also +// the use of kSetOnlyIfOverridden in content/child/runtime_features.cc. +BASE_FEATURE(kFedCmUserInfo, "FedCmUserInfo", base::FEATURE_ENABLED_BY_DEFAULT); // Enables usage of the FedCM API with the Selective Disclosure API at the same // time.
diff --git a/content/public/common/sandboxed_process_launcher_delegate.cc b/content/public/common/sandboxed_process_launcher_delegate.cc index 3d4033c..422613b7 100644 --- a/content/public/common/sandboxed_process_launcher_delegate.cc +++ b/content/public/common/sandboxed_process_launcher_delegate.cc
@@ -45,13 +45,13 @@ } #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) ZygoteCommunication* SandboxedProcessLauncherDelegate::GetZygote() { // Default to the sandboxed zygote. If a more lax sandbox is needed, then the // child class should override this method and use the unsandboxed zygote. return GetGenericZygote(); } -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_POSIX) base::EnvironmentMap SandboxedProcessLauncherDelegate::GetEnvironment() {
diff --git a/content/public/common/sandboxed_process_launcher_delegate.h b/content/public/common/sandboxed_process_launcher_delegate.h index 0f21137..ea53423 100644 --- a/content/public/common/sandboxed_process_launcher_delegate.h +++ b/content/public/common/sandboxed_process_launcher_delegate.h
@@ -13,9 +13,9 @@ #include "content/public/common/zygote/zygote_buildflags.h" #include "sandbox/policy/sandbox_delegate.h" -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) #include "content/public/common/zygote/zygote_handle.h" // nogncheck -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) namespace content { @@ -43,10 +43,10 @@ virtual bool ShouldLaunchElevated(); #endif // BUILDFLAG(IS_WIN) -#if BUILDFLAG(USE_ZYGOTE_HANDLE) +#if BUILDFLAG(USE_ZYGOTE) // Returns the zygote used to launch the process. virtual ZygoteCommunication* GetZygote(); -#endif // BUILDFLAG(USE_ZYGOTE_HANDLE) +#endif // BUILDFLAG(USE_ZYGOTE) #if BUILDFLAG(IS_POSIX) // Override this if the process needs a non-empty environment map.
diff --git a/content/public/common/zygote/BUILD.gn b/content/public/common/zygote/BUILD.gn index 258ca5b7..a7b58abf 100644 --- a/content/public/common/zygote/BUILD.gn +++ b/content/public/common/zygote/BUILD.gn
@@ -7,5 +7,5 @@ buildflag_header("buildflags") { header = "zygote_buildflags.h" - flags = [ "USE_ZYGOTE_HANDLE=$use_zygote_handle" ] + flags = [ "USE_ZYGOTE=$use_zygote" ] }
diff --git a/content/public/common/zygote/features.gni b/content/public/common/zygote/features.gni index 547a4e5a..1e4c592 100644 --- a/content/public/common/zygote/features.gni +++ b/content/public/common/zygote/features.gni
@@ -2,4 +2,4 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -use_zygote_handle = is_posix && !is_android && !is_mac +use_zygote = is_posix && !is_android && !is_mac
diff --git a/content/public/common/zygote/zygote_handle.h b/content/public/common/zygote/zygote_handle.h index debd30e..136bed8 100644 --- a/content/public/common/zygote/zygote_handle.h +++ b/content/public/common/zygote/zygote_handle.h
@@ -12,8 +12,8 @@ #include "content/common/content_export.h" #include "content/public/common/zygote/zygote_buildflags.h" -#if !BUILDFLAG(USE_ZYGOTE_HANDLE) -#error "Can not use zygote handles without USE_ZYGOTE_HANDLE" +#if !BUILDFLAG(USE_ZYGOTE) +#error "Can not use zygote without USE_ZYGOTE" #endif namespace content { @@ -21,8 +21,8 @@ #if BUILDFLAG(IS_POSIX) class ZygoteCommunication; #else -// Perhaps other ports may USE_ZYGOTE_HANDLE here somdeday. -#error "Can not use zygote handles on this platform" +// Perhaps other ports may USE_ZYGOTE here somdeday. +#error "Can not use zygote on this platform" #endif // BUILDFLAG(IS_POSIX) // Gets the generic global zygote used to launch sandboxed children.
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 8c6a557..2e90ae7 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -5712,9 +5712,6 @@ // The extra data was created in WillSendRequestInternal if it didn't exist. DCHECK(info->url_request.GetURLRequestExtraData()); - // TODO(clamy): Same-document navigations should not be sent back to the - // browser. - // TODO(clamy): Data urls should not be sent back to the browser either. // These values are assumed on the browser side for navigations. These checks // ensure the renderer has the correct values. DCHECK_EQ(network::mojom::RequestMode::kNavigate, @@ -5753,12 +5750,13 @@ CloneBlobURLToken(info->blob_url_token)); int load_flags = info->url_request.GetLoadFlagsForWebUrlRequest(); - absl::optional<base::Value::Dict> initiator; + absl::optional<base::Value::Dict> devtools_initiator; if (!info->devtools_initiator_info.IsNull()) { - absl::optional<base::Value> initiator_value = + absl::optional<base::Value> devtools_initiator_value = base::JSONReader::Read(info->devtools_initiator_info.Utf8()); - if (initiator_value && initiator_value->is_dict()) - initiator = std::move(*initiator_value).TakeDict(); + if (devtools_initiator_value && devtools_initiator_value->is_dict()) { + devtools_initiator = std::move(*devtools_initiator_value).TakeDict(); + } } absl::optional<network::ResourceRequest::WebBundleTokenParams> @@ -5785,7 +5783,7 @@ blink::GetMixedContentContextTypeForWebURLRequest(info->url_request), is_form_submission, was_initiated_by_link_click, searchable_form_url, searchable_form_encoding, client_side_redirect_url, - std::move(initiator), + std::move(devtools_initiator), info->url_request.TrustTokenParams() ? info->url_request.TrustTokenParams()->Clone() : nullptr,
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 1772376..5a3da1c 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2529,6 +2529,7 @@ "../browser/webid/federated_auth_request_impl_logout_unittest.cc", "../browser/webid/federated_auth_request_impl_multiple_frames_unittest.cc", "../browser/webid/federated_auth_request_impl_unittest.cc", + "../browser/webid/federated_auth_user_info_request_unittest.cc", "../browser/webid/idp_network_request_manager_unittest.cc", "../browser/webid/test/delegated_idp_network_request_manager.cc", "../browser/webid/test/delegated_idp_network_request_manager.h",
diff --git a/content/test/data/forms/form_controls_browsertest_multi_select_chromeos.png b/content/test/data/forms/form_controls_browsertest_multi_select_chromeos.png index c9d2399b..88732b05 100644 --- a/content/test/data/forms/form_controls_browsertest_multi_select_chromeos.png +++ b/content/test/data/forms/form_controls_browsertest_multi_select_chromeos.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_select_chromeos.png b/content/test/data/forms/form_controls_browsertest_select_chromeos.png index f0c0ccae..ad7e471 100644 --- a/content/test/data/forms/form_controls_browsertest_select_chromeos.png +++ b/content/test/data/forms/form_controls_browsertest_select_chromeos.png Binary files differ
diff --git a/content/test/data/forms/form_controls_browsertest_select_mac.png b/content/test/data/forms/form_controls_browsertest_select_mac.png index 6eaafbf..ff59904 100644 --- a/content/test/data/forms/form_controls_browsertest_select_mac.png +++ b/content/test/data/forms/form_controls_browsertest_select_mac.png Binary files differ
diff --git a/content/web_test/renderer/web_test_content_settings_client.cc b/content/web_test/renderer/web_test_content_settings_client.cc index c9f8dfa9..f1814d4 100644 --- a/content/web_test/renderer/web_test_content_settings_client.cc +++ b/content/web_test/renderer/web_test_content_settings_client.cc
@@ -64,8 +64,8 @@ return enabled_per_settings || flags_->running_insecure_content_allowed(); } -bool WebTestContentSettingsClient:: - IncreaseSharedElementTransitionCallbackTimeout() const { +bool WebTestContentSettingsClient::IncreaseViewTransitionCallbackTimeout() + const { // In tests we want larger timeout to account for slower running tests. return true; }
diff --git a/content/web_test/renderer/web_test_content_settings_client.h b/content/web_test/renderer/web_test_content_settings_client.h index 6368b0ad..1b15d42 100644 --- a/content/web_test/renderer/web_test_content_settings_client.h +++ b/content/web_test/renderer/web_test_content_settings_client.h
@@ -35,7 +35,7 @@ bool AllowStorageAccessSync(StorageType storage_type) override; bool AllowRunningInsecureContent(bool enabled_per_settings, const blink::WebURL& url) override; - bool IncreaseSharedElementTransitionCallbackTimeout() const override; + bool IncreaseViewTransitionCallbackTimeout() const override; private: TestRunner* const test_runner_;
diff --git a/device/vr/android/arcore/arcore_device.cc b/device/vr/android/arcore/arcore_device.cc index f2a1b6c..8c1fd87 100644 --- a/device/vr/android/arcore/arcore_device.cc +++ b/device/vr/android/arcore/arcore_device.cc
@@ -42,7 +42,8 @@ mojom::XRSessionFeature::PLANE_DETECTION, mojom::XRSessionFeature::DEPTH, mojom::XRSessionFeature::IMAGE_TRACKING, - mojom::XRSessionFeature::HIT_TEST}}; + mojom::XRSessionFeature::HIT_TEST, + mojom::XRSessionFeature::FRONT_FACING}}; return *kSupportedFeatures; }
diff --git a/device/vr/android/arcore/arcore_gl.cc b/device/vr/android/arcore/arcore_gl.cc index 68c40f1..6727e19 100644 --- a/device/vr/android/arcore/arcore_gl.cc +++ b/device/vr/android/arcore/arcore_gl.cc
@@ -585,6 +585,7 @@ float bottom = depth_near * (projection_.rc(2, 1) - 1.f) / projection_.rc(1, 1); float top = depth_near * (projection_.rc(2, 1) + 1.f) / projection_.rc(1, 1); + DVLOG(3) << __func__ << ": projection_=" << projection_.ToString(); // Also calculate the inverse projection which is needed for converting // screen touches to world rays.
diff --git a/device/vr/android/arcore/arcore_impl.cc b/device/vr/android/arcore/arcore_impl.cc index 1ec5f58..7e49d620 100644 --- a/device/vr/android/arcore/arcore_impl.cc +++ b/device/vr/android/arcore/arcore_impl.cc
@@ -52,9 +52,6 @@ return result; } -// Helper, creates new ArPose* with position and orientation set to match the -// position and orientation of passed in |pose|. - ArTrackableType GetArCoreEntityType( device::mojom::EntityTypeForHitTest entity_type) { switch (entity_type) { @@ -309,260 +306,14 @@ namespace device { -ArCoreImpl::ArCoreImpl() - : gl_thread_task_runner_( - base::SingleThreadTaskRunner::GetCurrentDefault()) {} +namespace { -ArCoreImpl::~ArCoreImpl() { - for (auto& create_anchor : create_anchor_requests_) { - create_anchor.TakeCallback().Run(mojom::CreateAnchorResult::FAILURE, 0); - } - - for (auto& create_anchor : create_plane_attached_anchor_requests_) { - create_anchor.TakeCallback().Run(mojom::CreateAnchorResult::FAILURE, 0); - } -} - -absl::optional<ArCore::InitializeResult> ArCoreImpl::Initialize( - base::android::ScopedJavaLocalRef<jobject> context, - const std::unordered_set<device::mojom::XRSessionFeature>& - required_features, - const std::unordered_set<device::mojom::XRSessionFeature>& - optional_features, - const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images, - absl::optional<ArCore::DepthSensingConfiguration> depth_sensing_config) { - DCHECK(IsOnGlThread()); - DCHECK(!arcore_session_.is_valid()); - - // TODO(https://crbug.com/837944): Notify error earlier if this will fail. - - JNIEnv* env = base::android::AttachCurrentThread(); - if (!env) { - DLOG(ERROR) << "Unable to get JNIEnv for ArCore"; - return absl::nullopt; - } - - // Use a local scoped ArSession for the next steps, we want the - // arcore_session_ member to remain null until we complete successful - // initialization. - internal::ScopedArCoreObject<ArSession*> session; - - ArStatus status = ArSession_create( - env, context.obj(), - internal::ScopedArCoreObject<ArSession*>::Receiver(session).get()); - if (status != AR_SUCCESS) { - DLOG(ERROR) << "ArSession_create failed: " << status; - return absl::nullopt; - } - - // Set incognito mode for ARCore session - this is done unconditionally as we - // always want to limit the amount of logging done by ARCore. - ArSession_enableIncognitoMode_private(session.get()); - DVLOG(1) << __func__ << ": ARCore incognito mode enabled"; - - absl::optional<std::unordered_set<device::mojom::XRSessionFeature>> - maybe_enabled_features = - ConfigureFeatures(session.get(), required_features, optional_features, - tracked_images, depth_sensing_config); - - if (!maybe_enabled_features) { - DLOG(ERROR) << "Failed to configure session features"; - return absl::nullopt; - } - - if (!ConfigureCamera(session.get())) { - DLOG(ERROR) << "Failed to configure session camera"; - return absl::nullopt; - } - - internal::ScopedArCoreObject<ArFrame*> frame; - ArFrame_create(session.get(), - internal::ScopedArCoreObject<ArFrame*>::Receiver(frame).get()); - if (!frame.is_valid()) { - DLOG(ERROR) << "ArFrame_create failed"; - return absl::nullopt; - } - - if (base::Contains(*maybe_enabled_features, - device::mojom::XRSessionFeature::LIGHT_ESTIMATION)) { - internal::ScopedArCoreObject<ArLightEstimate*> light_estimate; - ArLightEstimate_create( - session.get(), - internal::ScopedArCoreObject<ArLightEstimate*>::Receiver(light_estimate) - .get()); - if (!light_estimate.is_valid()) { - DVLOG(1) << "ArLightEstimate_create failed"; - return absl::nullopt; - } - arcore_light_estimate_ = std::move(light_estimate); - } - - // Success, we now have a valid session and a valid frame. - arcore_frame_ = std::move(frame); - arcore_session_ = std::move(session); - - if (base::Contains(*maybe_enabled_features, - device::mojom::XRSessionFeature::ANCHORS)) { - anchor_manager_ = std::make_unique<ArCoreAnchorManager>( - base::PassKey<ArCoreImpl>(), arcore_session_.get()); - } - if (base::Contains(*maybe_enabled_features, - device::mojom::XRSessionFeature::PLANE_DETECTION)) { - plane_manager_ = std::make_unique<ArCorePlaneManager>( - base::PassKey<ArCoreImpl>(), arcore_session_.get()); - } - - return ArCore::InitializeResult(*maybe_enabled_features, - depth_configuration_); -} - -absl::optional<std::unordered_set<device::mojom::XRSessionFeature>> -ArCoreImpl::ConfigureFeatures( +// Helper, returns the best available camera config that is using +// `facing_direction`. +internal::ScopedArCoreObject<ArCameraConfig*> GetBestConfig( ArSession* ar_session, - const std::unordered_set<device::mojom::XRSessionFeature>& - required_features, - const std::unordered_set<device::mojom::XRSessionFeature>& - optional_features, - const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images, - const absl::optional<ArCore::DepthSensingConfiguration>& - depth_sensing_config) { - // Let's assume we will be able to configure a session with all features - - // this will be adjusted if it turns out we can only create a session w/o some - // optional features. Currently, only depth sensing is not supported across - // all the ARCore-capable devices. - std::unordered_set<device::mojom::XRSessionFeature> enabled_features; - enabled_features.insert(required_features.begin(), required_features.end()); - enabled_features.insert(optional_features.begin(), optional_features.end()); - - internal::ScopedArCoreObject<ArConfig*> arcore_config; - ArConfig_create( - ar_session, - internal::ScopedArCoreObject<ArConfig*>::Receiver(arcore_config).get()); - if (!arcore_config.is_valid()) { - DLOG(ERROR) << __func__ << ": ArConfig_create failed"; - return absl::nullopt; - } - - const bool light_estimation_requested = - base::Contains(required_features, - device::mojom::XRSessionFeature::LIGHT_ESTIMATION) || - base::Contains(optional_features, - device::mojom::XRSessionFeature::LIGHT_ESTIMATION); - - if (light_estimation_requested) { - // Enable lighting estimation with spherical harmonics - ArConfig_setLightEstimationMode(ar_session, arcore_config.get(), - AR_LIGHT_ESTIMATION_MODE_ENVIRONMENTAL_HDR); - } - - const bool image_tracking_requested = - base::Contains(required_features, - device::mojom::XRSessionFeature::IMAGE_TRACKING) || - base::Contains(optional_features, - device::mojom::XRSessionFeature::IMAGE_TRACKING); - - if (image_tracking_requested) { - internal::ScopedArCoreObject<ArAugmentedImageDatabase*> image_db; - ArAugmentedImageDatabase_create( - ar_session, - internal::ScopedArCoreObject<ArAugmentedImageDatabase*>::Receiver( - image_db) - .get()); - if (!image_db.is_valid()) { - DLOG(ERROR) << "ArAugmentedImageDatabase creation failed"; - return absl::nullopt; - } - - // Populate the image tracking database and set up data structures, - // this doesn't modify the ArConfig or session yet. - BuildImageDatabase(ar_session, image_db.get(), tracked_images); - - if (!tracked_image_arcore_id_to_index_.empty()) { - // Image tracking with a non-empty image DB adds a few frames of - // synchronization delay internally in ARCore, has a high CPU cost, and - // reconfigures its graphics pipeline. Only activate it if we got images. - // (Apparently an empty image db is equivalent, but that seems fragile.) - ArConfig_setAugmentedImageDatabase(ar_session, arcore_config.get(), - image_db.get()); - // Switch to autofocus mode when tracking images. The default fixed focus - // mode has trouble tracking close images since they end up blurry. - ArConfig_setFocusMode(ar_session, arcore_config.get(), - AR_FOCUS_MODE_AUTO); - } - } - - const bool depth_api_optional = - base::Contains(optional_features, device::mojom::XRSessionFeature::DEPTH); - const bool depth_api_required = - base::Contains(required_features, device::mojom::XRSessionFeature::DEPTH); - const bool depth_api_requested = depth_api_required || depth_api_optional; - - const bool depth_api_configuration_successful = - depth_api_requested && ConfigureDepthSensing(depth_sensing_config); - - if (depth_api_configuration_successful) { - // Don't try to set the depth mode if we know we won't be able to support - // the desired usage and data format. - ArConfig_setDepthMode(ar_session, arcore_config.get(), - AR_DEPTH_MODE_AUTOMATIC); - } - - ArStatus status = ArSession_configure(ar_session, arcore_config.get()); - if (status != AR_SUCCESS && depth_api_requested && - depth_api_configuration_successful && !depth_api_required) { - // Configuring an ARCore session failed for some reason, and we know depth - // API was requested but is not required to be enabled. - // Depth API may not be available on some ARCore-capable devices - since it - // was requested optionally, let's try to request the session w/o it. - // Currently, Depth API is the only feature that is not supported across the - // board, so we speculatively assume that it is the reason why the session - // creation failed. - - DLOG(WARNING) << __func__ - << ": Depth API was optionally requested and the session " - "creation failed, re-trying with depth API disabled"; - - enabled_features.erase(device::mojom::XRSessionFeature::DEPTH); - - ArConfig_setDepthMode(ar_session, arcore_config.get(), - AR_DEPTH_MODE_DISABLED); - - status = ArSession_configure(ar_session, arcore_config.get()); - } - - if (status != AR_SUCCESS) { - DLOG(ERROR) << __func__ << ": ArSession_configure failed: " << status; - return absl::nullopt; - } - - return enabled_features; -} - -bool ArCoreImpl::ConfigureDepthSensing( - const absl::optional<ArCore::DepthSensingConfiguration>& - depth_sensing_config) { - if (!depth_sensing_config) { - return false; - } - - if (!base::Contains(depth_sensing_config->depth_usage_preference, - device::mojom::XRDepthUsage::kCPUOptimized)) { - return false; - } - - if (!base::Contains(depth_sensing_config->depth_data_format_preference, - device::mojom::XRDepthDataFormat::kLuminanceAlpha)) { - return false; - } - - depth_configuration_ = device::mojom::XRDepthConfig( - device::mojom::XRDepthUsage::kCPUOptimized, - device::mojom::XRDepthDataFormat::kLuminanceAlpha); - - return true; -} - -bool ArCoreImpl::ConfigureCamera(ArSession* ar_session) { + ArCameraConfigFacingDirection facing_direction) { + DVLOG(3) << __func__ << ": facing_direction=" << facing_direction; internal::ScopedArCoreObject<ArCameraConfigFilter*> camera_config_filter; ArCameraConfigFilter_create( ar_session, internal::ScopedArCoreObject<ArCameraConfigFilter*>::Receiver( @@ -570,12 +321,16 @@ .get()); if (!camera_config_filter.is_valid()) { DLOG(ERROR) << "ArCameraConfigFilter_create failed"; - return false; + return {}; } + ArCameraConfigFilter_setFacingDirection( + ar_session, camera_config_filter.get(), facing_direction); + // We only want to work at 30fps for now. ArCameraConfigFilter_setTargetFps(ar_session, camera_config_filter.get(), AR_CAMERA_CONFIG_TARGET_FPS_30); + // We do not care if depth sensor is available or not for now. // The default depth sensor usage of the newly created filter is not // documented, so let's set the filter explicitly to accept both cameras with @@ -593,14 +348,14 @@ if (!camera_config_list.is_valid()) { DLOG(ERROR) << "ArCameraConfigList_create failed"; - return false; + return {}; } ArSession_getSupportedCameraConfigsWithFilter( ar_session, camera_config_filter.get(), camera_config_list.get()); if (!camera_config_list.is_valid()) { DLOG(ERROR) << "ArSession_getSupportedCameraConfigsWithFilter failed"; - return false; + return {}; } int32_t available_configs_count; @@ -612,6 +367,7 @@ std::vector<internal::ScopedArCoreObject<ArCameraConfig*>> available_configs; available_configs.reserve(available_configs_count); + for (int32_t i = 0; i < available_configs_count; ++i) { internal::ScopedArCoreObject<ArCameraConfig*> camera_config; ArCameraConfig_create( @@ -629,19 +385,12 @@ ArCameraConfigList_getItem(ar_session, camera_config_list.get(), i, camera_config.get()); - ArCameraConfigFacingDirection facing_direction; - ArCameraConfig_getFacingDirection(ar_session, camera_config.get(), - &facing_direction); + if constexpr (DCHECK_IS_ON()) { + ArCameraConfigFacingDirection camera_facing_direction; + ArCameraConfig_getFacingDirection(ar_session, camera_config.get(), + &camera_facing_direction); + DCHECK_EQ(camera_facing_direction, facing_direction); - if (facing_direction != AR_CAMERA_CONFIG_FACING_DIRECTION_BACK) { - DVLOG(2) - << __func__ - << ": camera config does not refer to back-facing camera, ignoring"; - continue; - } - -#if DCHECK_IS_ON() - { int32_t tex_width, tex_height; ArCameraConfig_getTextureDimensions(ar_session, camera_config.get(), &tex_width, &tex_height); @@ -663,16 +412,16 @@ << tex_width << "x" << tex_height << ", image dimensions= " << img_width << "x" << img_height << ", depth sensor usage=" << depth_sensor_usage - << ", min_fps=" << min_fps << ", max_fps=" << max_fps; + << ", min_fps=" << min_fps << ", max_fps=" << max_fps + << ", camera_facing_direction=" << camera_facing_direction; } -#endif available_configs.push_back(std::move(camera_config)); } if (available_configs.empty()) { DLOG(ERROR) << "No matching configs found"; - return false; + return {}; } auto best_config = std::max_element( @@ -738,14 +487,7 @@ } }); - int32_t fps_min, fps_max; - ArCameraConfig_getFpsRange(ar_session, best_config->get(), &fps_min, - &fps_max); - target_framerate_range_ = {static_cast<float>(fps_min), - static_cast<float>(fps_max)}; - -#if DCHECK_IS_ON() - { + if constexpr (DCHECK_IS_ON()) { int32_t tex_width, tex_height; ArCameraConfig_getTextureDimensions(ar_session, best_config->get(), &tex_width, &tex_height); @@ -757,21 +499,326 @@ uint32_t depth_sensor_usage; ArCameraConfig_getDepthSensorUsage(ar_session, best_config->get(), &depth_sensor_usage); + + int32_t fps_min, fps_max; + ArCameraConfig_getFpsRange(ar_session, best_config->get(), &fps_min, + &fps_max); + DVLOG(3) << __func__ << ": selected camera config with texture dimensions=" << tex_width << "x" << tex_height << ", image dimensions=" << img_width << "x" << img_height << ", depth sensor usage=" << depth_sensor_usage - << ", min_fps=" << target_framerate_range_.min - << ", max_fps=" << target_framerate_range_.max; + << ", fps_min=" << fps_min << ", fps_max=" << fps_max; } -#endif - ArStatus status = ArSession_setCameraConfig(ar_session, best_config->get()); + return std::move(*best_config); +} + +} // namespace + +ArCoreImpl::ArCoreImpl() + : gl_thread_task_runner_( + base::SingleThreadTaskRunner::GetCurrentDefault()) {} + +ArCoreImpl::~ArCoreImpl() { + for (auto& create_anchor : create_anchor_requests_) { + create_anchor.TakeCallback().Run(mojom::CreateAnchorResult::FAILURE, 0); + } + + for (auto& create_anchor : create_plane_attached_anchor_requests_) { + create_anchor.TakeCallback().Run(mojom::CreateAnchorResult::FAILURE, 0); + } +} + +absl::optional<ArCore::InitializeResult> ArCoreImpl::Initialize( + base::android::ScopedJavaLocalRef<jobject> context, + const std::unordered_set<device::mojom::XRSessionFeature>& + required_features, + const std::unordered_set<device::mojom::XRSessionFeature>& + optional_features, + const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images, + absl::optional<ArCore::DepthSensingConfiguration> depth_sensing_config) { + DCHECK(IsOnGlThread()); + DCHECK(!arcore_session_.is_valid()); + + // TODO(https://crbug.com/837944): Notify error earlier if this will fail. + + JNIEnv* env = base::android::AttachCurrentThread(); + if (!env) { + DLOG(ERROR) << "Unable to get JNIEnv for ArCore"; + return absl::nullopt; + } + + // Use a local scoped ArSession for the next steps, we want the + // arcore_session_ member to remain null until we complete successful + // initialization. + internal::ScopedArCoreObject<ArSession*> session; + + ArStatus status = ArSession_create( + env, context.obj(), + internal::ScopedArCoreObject<ArSession*>::Receiver(session).get()); if (status != AR_SUCCESS) { - DLOG(ERROR) << "ArSession_setCameraConfig failed: " << status; + DLOG(ERROR) << "ArSession_create failed: " << status; + return absl::nullopt; + } + + // Set incognito mode for ARCore session - this is done unconditionally as we + // always want to limit the amount of logging done by ARCore. + ArSession_enableIncognitoMode_private(session.get()); + DVLOG(1) << __func__ << ": ARCore incognito mode enabled"; + + // Let's assume we will be able to configure a session with all features - + // this will be adjusted if it turns out we can only create a session w/o some + // optional features. Currently, only depth sensing is not supported across + // all the ARCore-capable devices. Additionally, front-facing camera may + // affect availability of other features. + std::unordered_set<device::mojom::XRSessionFeature> enabled_features; + enabled_features.insert(required_features.begin(), required_features.end()); + enabled_features.insert(optional_features.begin(), optional_features.end()); + + if (!ConfigureCamera(session.get(), required_features, optional_features, + enabled_features)) { + DLOG(ERROR) << "Failed to configure session camera"; + return absl::nullopt; + } + + if (!ConfigureFeatures(session.get(), required_features, optional_features, + tracked_images, depth_sensing_config, + enabled_features)) { + DLOG(ERROR) << "Failed to configure session features"; + return absl::nullopt; + } + + internal::ScopedArCoreObject<ArFrame*> frame; + ArFrame_create(session.get(), + internal::ScopedArCoreObject<ArFrame*>::Receiver(frame).get()); + if (!frame.is_valid()) { + DLOG(ERROR) << "ArFrame_create failed"; + return absl::nullopt; + } + + if (base::Contains(enabled_features, + device::mojom::XRSessionFeature::LIGHT_ESTIMATION)) { + internal::ScopedArCoreObject<ArLightEstimate*> light_estimate; + ArLightEstimate_create( + session.get(), + internal::ScopedArCoreObject<ArLightEstimate*>::Receiver(light_estimate) + .get()); + if (!light_estimate.is_valid()) { + DVLOG(1) << "ArLightEstimate_create failed"; + return absl::nullopt; + } + arcore_light_estimate_ = std::move(light_estimate); + } + + // Success, we now have a valid session and a valid frame. + arcore_frame_ = std::move(frame); + arcore_session_ = std::move(session); + + if (base::Contains(enabled_features, + device::mojom::XRSessionFeature::ANCHORS)) { + anchor_manager_ = std::make_unique<ArCoreAnchorManager>( + base::PassKey<ArCoreImpl>(), arcore_session_.get()); + } + if (base::Contains(enabled_features, + device::mojom::XRSessionFeature::PLANE_DETECTION)) { + plane_manager_ = std::make_unique<ArCorePlaneManager>( + base::PassKey<ArCoreImpl>(), arcore_session_.get()); + } + + return ArCore::InitializeResult(enabled_features, depth_configuration_); +} + +bool ArCoreImpl::ConfigureFeatures( + ArSession* ar_session, + const std::unordered_set<device::mojom::XRSessionFeature>& + required_features, + const std::unordered_set<device::mojom::XRSessionFeature>& + optional_features, + const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images, + const absl::optional<ArCore::DepthSensingConfiguration>& + depth_sensing_config, + std::unordered_set<device::mojom::XRSessionFeature>& enabled_features) { + internal::ScopedArCoreObject<ArConfig*> arcore_config; + ArConfig_create( + ar_session, + internal::ScopedArCoreObject<ArConfig*>::Receiver(arcore_config).get()); + if (!arcore_config.is_valid()) { + DLOG(ERROR) << __func__ << ": ArConfig_create failed"; return false; } + const bool light_estimation_requested = + base::Contains(required_features, + device::mojom::XRSessionFeature::LIGHT_ESTIMATION) || + base::Contains(optional_features, + device::mojom::XRSessionFeature::LIGHT_ESTIMATION); + + if (light_estimation_requested) { + // Enable lighting estimation with spherical harmonics + ArConfig_setLightEstimationMode(ar_session, arcore_config.get(), + AR_LIGHT_ESTIMATION_MODE_ENVIRONMENTAL_HDR); + } + + const bool image_tracking_requested = + base::Contains(required_features, + device::mojom::XRSessionFeature::IMAGE_TRACKING) || + base::Contains(optional_features, + device::mojom::XRSessionFeature::IMAGE_TRACKING); + + if (image_tracking_requested) { + internal::ScopedArCoreObject<ArAugmentedImageDatabase*> image_db; + ArAugmentedImageDatabase_create( + ar_session, + internal::ScopedArCoreObject<ArAugmentedImageDatabase*>::Receiver( + image_db) + .get()); + if (!image_db.is_valid()) { + DLOG(ERROR) << "ArAugmentedImageDatabase creation failed"; + return false; + } + + // Populate the image tracking database and set up data structures, + // this doesn't modify the ArConfig or session yet. + BuildImageDatabase(ar_session, image_db.get(), tracked_images); + + if (!tracked_image_arcore_id_to_index_.empty()) { + // Image tracking with a non-empty image DB adds a few frames of + // synchronization delay internally in ARCore, has a high CPU cost, and + // reconfigures its graphics pipeline. Only activate it if we got images. + // (Apparently an empty image db is equivalent, but that seems fragile.) + ArConfig_setAugmentedImageDatabase(ar_session, arcore_config.get(), + image_db.get()); + // Switch to autofocus mode when tracking images. The default fixed focus + // mode has trouble tracking close images since they end up blurry. + ArConfig_setFocusMode(ar_session, arcore_config.get(), + AR_FOCUS_MODE_AUTO); + } + } + + const bool depth_api_optional = + base::Contains(optional_features, device::mojom::XRSessionFeature::DEPTH); + const bool depth_api_required = + base::Contains(required_features, device::mojom::XRSessionFeature::DEPTH); + const bool depth_api_requested = depth_api_required || depth_api_optional; + + const bool depth_api_configuration_successful = + depth_api_requested && ConfigureDepthSensing(depth_sensing_config); + + if (depth_api_configuration_successful) { + // Don't try to set the depth mode if we know we won't be able to support + // the desired usage and data format. + ArConfig_setDepthMode(ar_session, arcore_config.get(), + AR_DEPTH_MODE_AUTOMATIC); + } + + ArStatus status = ArSession_configure(ar_session, arcore_config.get()); + if (status != AR_SUCCESS && depth_api_requested && + depth_api_configuration_successful && !depth_api_required) { + // Configuring an ARCore session failed for some reason, and we know depth + // API was requested but is not required to be enabled. + // Depth API may not be available on some ARCore-capable devices - since it + // was requested optionally, let's try to request the session w/o it. + // Currently, Depth API is the only feature that is not supported across the + // board, so we speculatively assume that it is the reason why the session + // creation failed. + + DLOG(WARNING) << __func__ + << ": Depth API was optionally requested and the session " + "creation failed, re-trying with depth API disabled"; + + enabled_features.erase(device::mojom::XRSessionFeature::DEPTH); + + ArConfig_setDepthMode(ar_session, arcore_config.get(), + AR_DEPTH_MODE_DISABLED); + + status = ArSession_configure(ar_session, arcore_config.get()); + } + + if (status != AR_SUCCESS) { + DLOG(ERROR) << __func__ << ": ArSession_configure failed: " << status; + return false; + } + + return true; +} + +bool ArCoreImpl::ConfigureDepthSensing( + const absl::optional<ArCore::DepthSensingConfiguration>& + depth_sensing_config) { + if (!depth_sensing_config) { + return false; + } + + if (!base::Contains(depth_sensing_config->depth_usage_preference, + device::mojom::XRDepthUsage::kCPUOptimized)) { + return false; + } + + if (!base::Contains(depth_sensing_config->depth_data_format_preference, + device::mojom::XRDepthDataFormat::kLuminanceAlpha)) { + return false; + } + + depth_configuration_ = device::mojom::XRDepthConfig( + device::mojom::XRDepthUsage::kCPUOptimized, + device::mojom::XRDepthDataFormat::kLuminanceAlpha); + + return true; +} + +bool ArCoreImpl::ConfigureCamera( + ArSession* ar_session, + const std::unordered_set<device::mojom::XRSessionFeature>& + required_features, + const std::unordered_set<device::mojom::XRSessionFeature>& + optional_features, + std::unordered_set<device::mojom::XRSessionFeature>& enabled_features) { + const bool front_facing_camera_required = base::Contains( + required_features, device::mojom::XRSessionFeature::FRONT_FACING); + const bool front_facing_camera_optional = base::Contains( + optional_features, device::mojom::XRSessionFeature::FRONT_FACING); + const bool front_facing_camera_requested = + front_facing_camera_required || front_facing_camera_optional; + + DVLOG(3) << __func__ << ": front_facing_camera_requested=" + << front_facing_camera_requested; + + auto best_config = + GetBestConfig(ar_session, front_facing_camera_requested + ? AR_CAMERA_CONFIG_FACING_DIRECTION_FRONT + : AR_CAMERA_CONFIG_FACING_DIRECTION_BACK); + + ArStatus status = best_config.is_valid() ? ArSession_setCameraConfig( + ar_session, best_config.get()) + : AR_ERROR_CAMERA_NOT_AVAILABLE; + if (status != AR_SUCCESS && front_facing_camera_requested && + !front_facing_camera_required) { + DLOG(WARNING) << "ArSession_setCameraConfig failed, status=" << status + << ", best_config.is_valid()=" << best_config.is_valid(); + + // Front-facing camera was requested but optional and camera configuration + // failed - let's try to configure back-facing camera: + enabled_features.erase(device::mojom::XRSessionFeature::FRONT_FACING); + + best_config = + GetBestConfig(ar_session, AR_CAMERA_CONFIG_FACING_DIRECTION_BACK); + status = best_config.is_valid() + ? ArSession_setCameraConfig(ar_session, best_config.get()) + : AR_ERROR_CAMERA_NOT_AVAILABLE; + } + + if (status != AR_SUCCESS) { + DLOG(ERROR) << "ArSession_setCameraConfig failed, status=" << status + << ", best_config.is_valid()=" << best_config.is_valid(); + return false; + } + + int32_t fps_min, fps_max; + ArCameraConfig_getFpsRange(ar_session, best_config.get(), &fps_min, &fps_max); + target_framerate_range_ = {static_cast<float>(fps_min), + static_cast<float>(fps_max)}; + return true; }
diff --git a/device/vr/android/arcore/arcore_impl.h b/device/vr/android/arcore/arcore_impl.h index 9434b0d..eb85427 100644 --- a/device/vr/android/arcore/arcore_impl.h +++ b/device/vr/android/arcore/arcore_impl.h
@@ -298,15 +298,24 @@ // Helper, attempts to configure ArSession's camera for use. Note that this is // happening during initialization, before arcore_session_ is set. - // Returns true if configuration succeeded, false otherwise. - bool ConfigureCamera(ArSession* ar_session); + // Returns `true` if configuration succeeded, false otherwise. + // It can modify `enabled_features` if the camera was configured such that + // some features have been disabled. + bool ConfigureCamera( + ArSession* ar_session, + const std::unordered_set<device::mojom::XRSessionFeature>& + required_features, + const std::unordered_set<device::mojom::XRSessionFeature>& + optional_features, + std::unordered_set<device::mojom::XRSessionFeature>& enabled_features); // Helper, attempts to configure ArSession's features based on required and // optional features. Note that this is happening during initialization, - // before arcore_session_ is set. Returns a collection of features that were - // successfully enabled on a session or a nullopt on failure. - absl::optional<std::unordered_set<device::mojom::XRSessionFeature>> - ConfigureFeatures( + // before arcore_session_ is set. Returns `true` if feature configuration + // succeeded (i.e. all required features have been configured), `false` + // otherwise. It can modify `enabled_features` if some optional features could + // not have been configured. + bool ConfigureFeatures( ArSession* ar_session, const std::unordered_set<device::mojom::XRSessionFeature>& required_features, @@ -314,7 +323,8 @@ optional_features, const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images, const absl::optional<ArCore::DepthSensingConfiguration>& - depth_sensing_config); + depth_sensing_config, + std::unordered_set<device::mojom::XRSessionFeature>& enabled_features); // Configures depth sensing API - selects depth sensing usage and mode that is // compatible with the device. Returns false if it was unable to pick a
diff --git a/device/vr/android/arcore/arcore_shim.cc b/device/vr/android/arcore/arcore_shim.cc index 9065d5f8..ce8ed14 100644 --- a/device/vr/android/arcore/arcore_shim.cc +++ b/device/vr/android/arcore/arcore_shim.cc
@@ -46,6 +46,7 @@ DO(ArCameraConfigFilter_create) \ DO(ArCameraConfigFilter_destroy) \ DO(ArCameraConfigFilter_setDepthSensorUsage) \ + DO(ArCameraConfigFilter_setFacingDirection) \ DO(ArCameraConfigFilter_setTargetFps) \ DO(ArCameraConfigList_create) \ DO(ArCameraConfigList_destroy) \ @@ -403,6 +404,14 @@ session, filter, depth_sensor_usage_filters); } +void ArCameraConfigFilter_setFacingDirection( + const ArSession* session, + ArCameraConfigFilter* filter, + const ArCameraConfigFacingDirection direction) { + return g_arcore_api->impl_ArCameraConfigFilter_setFacingDirection( + session, filter, direction); +} + void ArCameraConfigFilter_setTargetFps(const ArSession* session, ArCameraConfigFilter* filter, const uint32_t fps_filters) {
diff --git a/device/vr/public/mojom/vr_service.mojom b/device/vr/public/mojom/vr_service.mojom index 702b581f..0b4f612 100644 --- a/device/vr/public/mojom/vr_service.mojom +++ b/device/vr/public/mojom/vr_service.mojom
@@ -68,7 +68,8 @@ IMAGE_TRACKING = 13, HAND_INPUT = 14, SECONDARY_VIEWS = 15, - LAYERS = 16 + LAYERS = 16, + FRONT_FACING = 17, }; // These values are persisted to logs. Entries should not be renumbered and
diff --git a/gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc b/gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc index 5f84bb6..b8ffb585 100644 --- a/gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc +++ b/gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc
@@ -480,7 +480,6 @@ DCompImageBackingFactoryVisualTreeTest() : window_size_(100, 100), window_(&platform_delegate_, gfx::Rect(window_size_)), - child_window_(window_.hwnd()), dcomp_device_(gl::GetDirectCompositionDevice()) {} void SetUp() override { @@ -488,6 +487,10 @@ static_cast<ui::PlatformWindow*>(&window_)->Show(); child_window_.Initialize(); + ::SetWindowPos(child_window_.window(), nullptr, 0, 0, window_size_.width(), + window_size_.height(), + SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | + SWP_NOOWNERZORDER | SWP_NOZORDER); ::SetParent(child_window_.window(), window_.hwnd()); }
diff --git a/gpu/ipc/service/image_transport_surface_win.cc b/gpu/ipc/service/image_transport_surface_win.cc index 210d607..a2434a8 100644 --- a/gpu/ipc/service/image_transport_surface_win.cc +++ b/gpu/ipc/service/image_transport_surface_win.cc
@@ -63,8 +63,8 @@ auto settings = CreateDirectCompositionSurfaceSettings( delegate->GetFeatureInfo()->workarounds()); auto dc_surface = base::MakeRefCounted<gl::DirectCompositionSurfaceWin>( - display->GetAs<gl::GLDisplayEGL>(), surface_handle, - std::move(vsync_callback), settings); + display->GetAs<gl::GLDisplayEGL>(), std::move(vsync_callback), + settings); if (!dc_surface->Initialize(gl::GLSurfaceFormat())) return nullptr;
diff --git a/infra/config/generated/builders/ci/mac10.15-wpt-content-shell-fyi-rel/properties.json b/infra/config/generated/builders/ci/mac10.15-wpt-content-shell-fyi-rel/properties.json new file mode 100644 index 0000000..a121149a --- /dev/null +++ b/infra/config/generated/builders/ci/mac10.15-wpt-content-shell-fyi-rel/properties.json
@@ -0,0 +1,54 @@ +{ + "$build/chromium_tests_builder_config": { + "builder_config": { + "builder_db": { + "entries": [ + { + "builder_id": { + "bucket": "ci", + "builder": "mac10.15-wpt-content-shell-fyi-rel", + "project": "chromium" + }, + "builder_spec": { + "builder_group": "chromium.fyi", + "execution_mode": "COMPILE_AND_TEST", + "legacy_chromium_config": { + "apply_configs": [ + "mb" + ], + "build_config": "Release", + "config": "chromium", + "target_bits": 64, + "target_platform": "mac" + }, + "legacy_gclient_config": { + "config": "chromium" + } + } + } + ] + }, + "builder_ids": [ + { + "bucket": "ci", + "builder": "mac10.15-wpt-content-shell-fyi-rel", + "project": "chromium" + } + ] + } + }, + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 250, + "metrics_project": "chromium-reclient-metrics" + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "chromium.fyi", + "recipe": "chromium" +} \ No newline at end of file
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 0ff6f672..175e146 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -44810,6 +44810,92 @@ } } builders { + name: "mac10.15-wpt-content-shell-fyi-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builder:mac10.15-wpt-content-shell-fyi-rel" + dimensions: "cpu:x86-64" + dimensions: "os:Mac" + dimensions: "pool:luci.chromium.ci" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/ci/mac10.15-wpt-content-shell-fyi-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "chromium.fyi",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium"' + '}' + priority: 35 + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "chromium_swarming.expose_merge_script_failures" + value: 100 + } + experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "mac11-arm64-rel-tests" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1"
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 713a1f6..38f26f9a 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -8876,6 +8876,10 @@ category: "mac" } builders { + name: "buildbucket/luci.chromium.ci/mac10.15-wpt-content-shell-fyi-rel" + category: "mac" + } + builders { name: "buildbucket/luci.chromium.ci/mac12-wpt-content-shell-fyi-rel" category: "mac" }
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index 203533f..5f30226 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -5489,6 +5489,16 @@ } } job { + id: "mac10.15-wpt-content-shell-fyi-rel" + realm: "ci" + schedule: "with 5h interval" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "mac10.15-wpt-content-shell-fyi-rel" + } +} +job { id: "mac11-arm64-rel-tests" realm: "ci" buildbucket {
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index 2543dd4..f9cc00a 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -1947,6 +1947,30 @@ ) fyi_mac_builder( + name = "mac10.15-wpt-content-shell-fyi-rel", + builder_spec = builder_config.builder_spec( + gclient_config = builder_config.gclient_config( + config = "chromium", + ), + chromium_config = builder_config.chromium_config( + config = "chromium", + apply_configs = ["mb"], + build_config = builder_config.build_config.RELEASE, + target_bits = 64, + target_platform = builder_config.target_platform.MAC, + ), + ), + triggered_by = [], + builderless = False, + os = os.MAC_ANY, + cores = None, + console_view_entry = consoles.console_view_entry( + category = "mac", + ), + schedule = "with 5h interval", +) + +fyi_mac_builder( name = "mac12-wpt-content-shell-fyi-rel", builder_spec = builder_config.builder_spec( gclient_config = builder_config.gclient_config(
diff --git a/media/base/audio_encoder.h b/media/base/audio_encoder.h index f60affa..27cd398c 100644 --- a/media/base/audio_encoder.h +++ b/media/base/audio_encoder.h
@@ -69,6 +69,11 @@ bool use_dtx; }; + enum class AacOutputFormat { AAC, ADTS }; + struct MEDIA_EXPORT AacOptions { + AacOutputFormat format; + }; + struct MEDIA_EXPORT Options { Options(); Options(const Options&); @@ -83,6 +88,7 @@ int sample_rate; absl::optional<OpusOptions> opus; + absl::optional<AacOptions> aac; }; // A sequence of codec specific bytes, commonly known as extradata.
diff --git a/mojo/public/cpp/bindings/lib/wtf_hash_util.h b/mojo/public/cpp/bindings/lib/wtf_hash_util.h index 103cc59..6c76a71b 100644 --- a/mojo/public/cpp/bindings/lib/wtf_hash_util.h +++ b/mojo/public/cpp/bindings/lib/wtf_hash_util.h
@@ -76,7 +76,7 @@ static bool IsEmptyValue(const mojo::StructPtr<T>& value) { return value.is_null(); } - static void ConstructDeletedValue(mojo::StructPtr<T>& slot, bool) { + static void ConstructDeletedValue(mojo::StructPtr<T>& slot) { mojo::internal::StructPtrWTFHelper<T>::ConstructDeletedValue(slot); } static bool IsDeletedValue(const mojo::StructPtr<T>& value) { @@ -99,7 +99,7 @@ static bool IsEmptyValue(const mojo::InlinedStructPtr<T>& value) { return value.is_null(); } - static void ConstructDeletedValue(mojo::InlinedStructPtr<T>& slot, bool) { + static void ConstructDeletedValue(mojo::InlinedStructPtr<T>& slot) { mojo::internal::InlinedStructPtrWTFHelper<T>::ConstructDeletedValue(slot); } static bool IsDeletedValue(const mojo::InlinedStructPtr<T>& value) {
diff --git a/remoting/codec/webrtc_video_encoder_av1.cc b/remoting/codec/webrtc_video_encoder_av1.cc index b90c4a5..2a6679f 100644 --- a/remoting/codec/webrtc_video_encoder_av1.cc +++ b/remoting/codec/webrtc_video_encoder_av1.cc
@@ -303,7 +303,7 @@ config_.g_lag_in_frames = 0; config_.g_error_resilient = 0; config_.g_timebase.num = 1; - config_.g_timebase.den = base::Time::kMicrosecondsPerSecond; + config_.g_timebase.den = base::Time::kMillisecondsPerSecond; config_.kf_mode = AOM_KF_DISABLED; @@ -416,24 +416,17 @@ } } - auto duration_us = params.duration.InMicroseconds(); - DCHECK_GT(duration_us, 0); + auto duration_ms = params.duration.InMilliseconds(); + DCHECK_GT(duration_ms, 0); aom_codec_err_t ret = aom_codec_encode( - codec_.get(), image_.get(), artificial_timestamp_us_, duration_us, + codec_.get(), image_.get(), artificial_timestamp_ms_, duration_ms, (params.key_frame) ? AOM_EFLAG_FORCE_KF : 0); - artificial_timestamp_us_ += duration_us; + artificial_timestamp_ms_ += duration_ms; if (ret != AOM_CODEC_OK) { const char* error_detail = aom_codec_error_detail(codec_.get()); LOG(ERROR) << "Encoding error: " << aom_codec_err_to_string(ret) << "\n " << aom_codec_error(codec_.get()) << "\n " << (error_detail ? error_detail : "No error details"); - // There is an issue where the AV1 codec begins returning AOM_CODEC_ERROR - // without any useful error details. This error is not recoverable so no - // frames are encoded during this time. The short-term fix is to reset the - // codec while we investigate the root cause (see b/266098558). - if (ret == AOM_CODEC_ERROR) { - codec_.reset(); - } std::move(done).Run(EncodeResult::UNKNOWN_ERROR, nullptr); return; }
diff --git a/remoting/codec/webrtc_video_encoder_av1.h b/remoting/codec/webrtc_video_encoder_av1.h index 0054547..6440f19 100644 --- a/remoting/codec/webrtc_video_encoder_av1.h +++ b/remoting/codec/webrtc_video_encoder_av1.h
@@ -64,7 +64,7 @@ // This timestamp is monotonically increased using the current frame duration. // It's only used for rate control and is not related to the timestamps on the // incoming frames to encode. - aom_codec_pts_t artificial_timestamp_us_ = 0; + aom_codec_pts_t artificial_timestamp_ms_ = 0; EncoderBitrateFilter bitrate_filter_; };
diff --git a/storage/browser/quota/BUILD.gn b/storage/browser/quota/BUILD.gn index f8ad0cb..06989a8 100644 --- a/storage/browser/quota/BUILD.gn +++ b/storage/browser/quota/BUILD.gn
@@ -7,6 +7,7 @@ mojom("mojo_bindings") { sources = [ "quota_internals.mojom" ] webui_module_path = "/" + use_typescript_sources = true public_deps = [ "//url/mojom:url_mojom_origin" ]
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 38101a2..c16cd8a3 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -94045,6 +94045,38 @@ } ] }, + "mac10.15-wpt-content-shell-fyi-rel": { + "isolated_scripts": [ + { + "args": [ + "--log-wptreport", + "--xvfb" + ], + "experiment_percentage": 100, + "isolate_name": "wpt_tests_isolate_content_shell", + "merge": { + "args": [ + "--verbose" + ], + "script": "//third_party/blink/tools/merge_web_test_results.py" + }, + "name": "wpt_tests_suite", + "results_handler": "layout tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-10.15" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 15 + }, + "test_id_prefix": "ninja://:wpt_tests_isolate_content_shell/" + } + ] + }, "mac12-wpt-content-shell-fyi-rel": { "isolated_scripts": [ {
diff --git a/testing/buildbot/internal.chrome.fyi.json b/testing/buildbot/internal.chrome.fyi.json index 0be76d9..5ff1493 100644 --- a/testing/buildbot/internal.chrome.fyi.json +++ b/testing/buildbot/internal.chrome.fyi.json
@@ -133,7 +133,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Windows-10-19045", + "os": "Windows-10", "pool": "chrome.tests.finch" } ],
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 0c2c5da62..8974f65 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -3645,6 +3645,15 @@ }, 'use_swarming': False, }, + 'mac10.15-wpt-content-shell-fyi-rel': { + 'mixins': [ + 'mac_10.15', + ], + 'test_suites': { + 'isolated_scripts': 'wpt_web_tests_content_shell', + }, + 'os_type': 'mac', + }, 'mac12-wpt-content-shell-fyi-rel': { 'mixins': [ 'mac_12_x64', @@ -6580,7 +6589,7 @@ 'win-finch-smoke-chrome': { 'mixins': [ 'chrome-finch-swarming-pool', - 'win10', + 'win10-any', ], 'test_suites': { 'isolated_scripts': 'chrome_finch_smoke_tests',
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 45b30b5..0aa284c 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -8899,9 +8899,10 @@ ], "experiments": [ { - "name": "Enabled_20220906", + "name": "FixLinkPrefetchDNSAndPreconnectInNetworkService_20230120", "enable_features": [ - "PreconnectInNetworkService" + "PreconnectInNetworkService", + "PrefetchDNSWithURL" ] } ]
diff --git a/third_party/blink/public/mojom/subapps/sub_apps_service.mojom b/third_party/blink/public/mojom/subapps/sub_apps_service.mojom index 841a482..2ffe6334 100644 --- a/third_party/blink/public/mojom/subapps/sub_apps_service.mojom +++ b/third_party/blink/public/mojom/subapps/sub_apps_service.mojom
@@ -19,23 +19,9 @@ string install_url_path; }; -enum SubAppsServiceAddResultCode { - // Success category: - kSuccessNewInstall, - kSuccessAlreadyInstalled, - - // Failure category: - kUserInstallDeclined, - kExpectedAppIdCheckFailed, - kParentAppUninstalled, - kInstallUrlInvalid, - kNotValidManifestForWebApp, - kFailure, -}; - struct SubAppsServiceAddResult { string unhashed_app_id_path; - SubAppsServiceAddResultCode result_code; + SubAppsServiceResult result_code; }; struct SubAppsServiceListResult {
diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom index 3835be04..0a779890 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -3785,6 +3785,10 @@ kDisableThirdPartyStoragePartitioning = 4444, kServiceWorkerFetchHandlerUpdateAfterInitialization = 4445, kObsoleteCreateImageBitmapImageOrientationNone = 4446, + kWindowManagementPermissionDescriptorUsed = 4447, + kWindowPlacementPermissionDescriptorUsed = 4448, + kWindowManagementPermissionPolicyParsed = 4449, + kWindowPlacementPermissionPolicyParsed = 4450, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/mojom/webid/federated_auth_request.mojom b/third_party/blink/public/mojom/webid/federated_auth_request.mojom index c31747a..3f405b8c 100644 --- a/third_party/blink/public/mojom/webid/federated_auth_request.mojom +++ b/third_party/blink/public/mojom/webid/federated_auth_request.mojom
@@ -7,9 +7,9 @@ import "url/mojom/url.mojom"; import "url/mojom/origin.mojom"; -// Implementation of the proposed WebID API. +// Implementation of the proposed FedCM API. // -// Proposal: https://github.com/WICG/WebID +// Proposal: https://fedidcg.github.io/FedCM/ // Represents the fetch result from a federated authentication request. It is // used to determine whether a JavaScript exception should be thrown, and what @@ -24,6 +24,15 @@ kError, }; +// Represents the fetch result from a federated user info request. It is +// used to determine whether a JavaScript exception should be thrown, and what +// the error message of such exception should say. +enum RequestUserInfoStatus { + kSuccess, + kErrorTooManyRequests, + kError, +}; + enum LogoutRpsStatus { kSuccess, kErrorTooManyRequests, @@ -83,6 +92,14 @@ IdentityProviderLoginHint login_hint; }; +// The list of user information that can be returned to an identity provider during a UserInfo API call. +struct IdentityUserInfo { + string email; + string given_name; + string name; + string picture; +}; + // The parameters for a get call for identity provider(s). struct IdentityProviderGetParameters { // Details of identity provider(s). @@ -114,6 +131,11 @@ url.mojom.Url? selected_identity_provider_config_url, string? token); + // Requests user info to be generated, given an IDP config. + // Returns an IdentityUserInfo for each of the user's accounts. + RequestUserInfo(IdentityProviderConfig provider) => + (RequestUserInfoStatus status, array<IdentityUserInfo>? user_info); + // Cancels the pending token request, if any. CancelTokenRequest();
diff --git a/third_party/blink/public/platform/web_content_settings_client.h b/third_party/blink/public/platform/web_content_settings_client.h index 9df45cb1..99f89fa 100644 --- a/third_party/blink/public/platform/web_content_settings_client.h +++ b/third_party/blink/public/platform/web_content_settings_client.h
@@ -114,11 +114,9 @@ // frame. virtual bool ShouldAutoupgradeMixedContent() { return true; } - // Controls whether the SharedElementTransition callback needs to be larger - // than default. - virtual bool IncreaseSharedElementTransitionCallbackTimeout() const { - return false; - } + // Controls whether the ViewTransition callback needs to be larger than + // default. + virtual bool IncreaseViewTransitionCallbackTimeout() const { return false; } virtual ~WebContentSettingsClient() = default; };
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 3ced563d..6e469f1 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -101,6 +101,8 @@ ] generated_dictionary_sources_in_modules = [ + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_aac_encoder_config.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_aac_encoder_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_rtc_codec_specifics_vp_8.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_rtc_codec_specifics_vp_8.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ad_properties.cc", @@ -1060,6 +1062,8 @@ ] generated_enumeration_sources_in_modules = [ + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_aac_bitstream_format.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_aac_bitstream_format.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ad_signals.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ad_signals.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_alpha_option.cc", @@ -1444,8 +1448,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_code.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_durability.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_durability.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_service_add_result_code.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_service_add_result_code.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_result_code.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_result_code.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_surface_switching_preference_enum.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_surface_switching_preference_enum.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_system_audio_preference_enum.cc",
diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni index 7da6295..3c6c69c 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni
@@ -825,6 +825,7 @@ "//third_party/blink/renderer/modules/webaudio/stereo_panner_options.idl", "//third_party/blink/renderer/modules/webaudio/wave_shaper_node.idl", "//third_party/blink/renderer/modules/webaudio/wave_shaper_options.idl", + "//third_party/blink/renderer/modules/webcodecs/aac_encoder_config.idl", "//third_party/blink/renderer/modules/webcodecs/audio_data.idl", "//third_party/blink/renderer/modules/webcodecs/audio_data_copy_to_options.idl", "//third_party/blink/renderer/modules/webcodecs/audio_data_init.idl",
diff --git a/third_party/blink/renderer/build/scripts/templates/element_attribute_name_lookup_trie.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/element_attribute_name_lookup_trie.cc.tmpl index c3bd3ad..15a3275 100644 --- a/third_party/blink/renderer/build/scripts/templates/element_attribute_name_lookup_trie.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/element_attribute_name_lookup_trie.cc.tmpl
@@ -17,7 +17,7 @@ {% macro trie_return_statement(tag) -%} {{namespace|lower}}_names::{{tag|symbol}}Attr {%- endmacro %} - {{ trie_length_switch(length_tries, trie_return_statement, false) | indent(4) }} + {{ trie_length_switch(length_tries, trie_return_statement, false, false) | indent(4) }} return g_null_name; } @@ -28,7 +28,7 @@ {% macro trie_return_statement(tag) -%} {{namespace|lower}}_names::{{tag|symbol}}Attr {%- endmacro %} - {{ trie_length_switch(length_tries, trie_return_statement, false) | indent(4) }} + {{ trie_length_switch(length_tries, trie_return_statement, false, true) | indent(4) }} return g_null_name; } #endif
diff --git a/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl index a1cc203..c0ccd5e1 100644 --- a/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/element_lookup_trie.cc.tmpl
@@ -10,33 +10,29 @@ #include "third_party/blink/renderer/core/{{namespace|lower}}_names.h" namespace blink { -namespace { -template <typename CharType> -{{namespace|lower}}_names::HTMLTag lookup{{namespace}}TagImpl( - const CharType* data, +CORE_EXPORT {{namespace|lower}}_names::HTMLTag lookup{{namespace}}Tag( + const UChar* data, unsigned length) { DCHECK(data); DCHECK(length); {% macro trie_return_statement(tag) -%} {{namespace|lower}}_names::HTMLTag::{{tag|symbol}}; {%- endmacro %} - {{ trie_length_switch(length_tries, trie_return_statement, false) | indent(4) }} + {{ trie_length_switch(length_tries, trie_return_statement, false, false) | indent(4) }} return {{namespace|lower}}_names::HTMLTag::kUnknown; } -} // namespace - -CORE_EXPORT {{namespace|lower}}_names::HTMLTag lookup{{namespace}}Tag( - const UChar* data, - unsigned length) { - return lookupHTMLTagImpl(data, length); -} - CORE_EXPORT {{namespace|lower}}_names::HTMLTag lookup{{namespace}}Tag( const LChar* data, unsigned length) { - return lookupHTMLTagImpl(data, length); + DCHECK(data); + DCHECK(length); + {% macro trie_return_statement(tag) -%} + {{namespace|lower}}_names::HTMLTag::{{tag|symbol}}; + {%- endmacro %} + {{ trie_length_switch(length_tries, trie_return_statement, false, true) | indent(4) }} + return {{namespace|lower}}_names::HTMLTag::kUnknown; } } // namespace blink
diff --git a/third_party/blink/renderer/build/scripts/templates/macros.tmpl b/third_party/blink/renderer/build/scripts/templates/macros.tmpl index 1222269..11c64741 100644 --- a/third_party/blink/renderer/build/scripts/templates/macros.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/macros.tmpl
@@ -24,9 +24,20 @@ {%- endmacro %} -{% macro trie_leaf(index, object, return_macro, lowercase_data) %} +{# + `is_lchar` indicates if the strings are LChars. If false, the string is + UChar. +#} +{% macro trie_leaf(index, object, return_macro, lowercase_data, is_lchar) %} {% set name, value = (object.items()|list)[0] %} -{% if name|length %} +{% set string_prefix = "" if is_lchar else "u" %} +{% set factor = "" if is_lchar else "2 * " %} +{% if name|length > 1 and not lowercase_data %} +if (memcmp(data + {{index}}, {{string_prefix}}"{{name}}", {{factor}}{{name|length}}) == 0) + return {{ return_macro(value) }}; +break; +{% elif name|length %} + if ( {%- for c in name -%} {%- if lowercase_data -%} @@ -44,9 +55,9 @@ {% endmacro %} -{% macro trie_switch(trie, index, return_macro, lowercase_data) %} +{% macro trie_switch(trie, index, return_macro, lowercase_data, is_lchar) %} {% if trie|length == 1 and (trie.values()|list)[0] is string %} -{{ trie_leaf(index, trie, return_macro, lowercase_data) -}} +{{ trie_leaf(index, trie, return_macro, lowercase_data, is_lchar) -}} {% else %} {% if lowercase_data %} switch (ToASCIILower(data[{{index}}])) { @@ -55,7 +66,7 @@ {% endif %} {% for char, value in trie.items()|sort %} case '{{char}}': - {{ trie_switch(value, index + 1, return_macro, lowercase_data) | indent(4) }} + {{ trie_switch(value, index + 1, return_macro, lowercase_data, is_lchar) | indent(4) }} {% endfor %} } break; @@ -63,11 +74,11 @@ {% endmacro %} -{% macro trie_length_switch(length_tries, return_macro, lowercase_data) %} +{% macro trie_length_switch(length_tries, return_macro, lowercase_data, string_prefix) %} switch (length) { {% for length, trie in length_tries %} case {{ length }}: - {{ trie_switch(trie, 0, return_macro, lowercase_data) | indent(4) }} + {{ trie_switch(trie, 0, return_macro, lowercase_data, string_prefix) | indent(4) }} {% endfor %} } {% endmacro %}
diff --git a/third_party/blink/renderer/core/animation/property_handle.h b/third_party/blink/renderer/core/animation/property_handle.h index 0145a7c..a232eea 100644 --- a/third_party/blink/renderer/core/animation/property_handle.h +++ b/third_party/blink/renderer/core/animation/property_handle.h
@@ -138,7 +138,7 @@ return handle.GetHash(); } - static void ConstructDeletedValue(blink::PropertyHandle& slot, bool) { + static void ConstructDeletedValue(blink::PropertyHandle& slot) { new (NotNullTag::kNotNull, &slot) blink::PropertyHandle( blink::PropertyHandle::DeletedValueForHashTraits()); }
diff --git a/third_party/blink/renderer/core/css/container_selector.h b/third_party/blink/renderer/core/css/container_selector.h index 7207c920..80c5c2b 100644 --- a/third_party/blink/renderer/core/css/container_selector.h +++ b/third_party/blink/renderer/core/css/container_selector.h
@@ -26,8 +26,7 @@ public: ContainerSelector() = default; explicit ContainerSelector(WTF::HashTableDeletedValueType) { - WTF::HashTraits<AtomicString>::ConstructDeletedValue( - name_, false /* zero_value */); + WTF::HashTraits<AtomicString>::ConstructDeletedValue(name_); } explicit ContainerSelector(PhysicalAxes physical_axes) : physical_axes_(physical_axes) {}
diff --git a/third_party/blink/renderer/core/css/css_color_mix_value.cc b/third_party/blink/renderer/core/css/css_color_mix_value.cc index 41de8242..ee7a44b 100644 --- a/third_party/blink/renderer/core/css/css_color_mix_value.cc +++ b/third_party/blink/renderer/core/css/css_color_mix_value.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "third_party/blink/renderer/core/css/css_color_mix_value.h" -#include "third_party/blink/renderer/core/css/css_color.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -43,8 +42,8 @@ } } - mix_amount = p1; - if (p2 == 0.0) { + mix_amount = p2; + if (p1 == 0.0) { mix_amount = 1.0; }
diff --git a/third_party/blink/renderer/core/css/css_property_name.h b/third_party/blink/renderer/core/css/css_property_name.h index 37492b7..ac0dd2d 100644 --- a/third_party/blink/renderer/core/css/css_property_name.h +++ b/third_party/blink/renderer/core/css/css_property_name.h
@@ -97,7 +97,7 @@ using CSSPropertyName = blink::CSSPropertyName; static const bool kEmptyValueIsZero = false; - static void ConstructDeletedValue(CSSPropertyName& slot, bool) { + static void ConstructDeletedValue(CSSPropertyName& slot) { new (NotNullTag::kNotNull, &slot) CSSPropertyName(CSSPropertyName::kDeletedValue); }
diff --git a/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc b/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc index b8a45c5..fbc5937 100644 --- a/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc +++ b/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc
@@ -689,6 +689,88 @@ EXPECT_EQ("image-set(url(\"foo\") 1x)", image_set_value.CustomCSSText()); } +TEST(CSSPropertyParserTest, ImageSetUrlFunction) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set(url('foo') 1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_NE(value, nullptr); + + const CSSValueList* val_list = To<CSSValueList>(value); + ASSERT_NE(val_list, nullptr); + ASSERT_EQ(val_list->length(), 1U); + + const CSSImageSetValue& image_set_value = + To<CSSImageSetValue>(val_list->Last()); + EXPECT_EQ("image-set(url(\"foo\") 1x)", image_set_value.CustomCSSText()); +} + +TEST(CSSPropertyParserTest, ImageSetUrlFunctionEmptyStrUrl) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set(url('') 1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_NE(value, nullptr); + + const CSSValueList* val_list = To<CSSValueList>(value); + ASSERT_NE(val_list, nullptr); + ASSERT_EQ(val_list->length(), 1U); + + const CSSImageSetValue& image_set_value = + To<CSSImageSetValue>(val_list->Last()); + EXPECT_EQ("image-set(url(\"\") 1x)", image_set_value.CustomCSSText()); +} + +TEST(CSSPropertyParserTest, ImageSetUrlFunctionNoQuotationMarks) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set(url(foo) 1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_NE(value, nullptr); + + const CSSValueList* val_list = To<CSSValueList>(value); + ASSERT_NE(val_list, nullptr); + ASSERT_EQ(val_list->length(), 1U); + + const CSSImageSetValue& image_set_value = + To<CSSImageSetValue>(val_list->Last()); + EXPECT_EQ("image-set(url(\"foo\") 1x)", image_set_value.CustomCSSText()); +} + +TEST(CSSPropertyParserTest, ImageSetNoUrlFunction) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set('foo' 1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_NE(value, nullptr); + + const CSSValueList* val_list = To<CSSValueList>(value); + ASSERT_NE(val_list, nullptr); + ASSERT_EQ(val_list->length(), 1U); + + const CSSImageSetValue& image_set_value = + To<CSSImageSetValue>(val_list->Last()); + EXPECT_EQ("image-set(url(\"foo\") 1x)", image_set_value.CustomCSSText()); +} + +TEST(CSSPropertyParserTest, ImageSetEmptyStrUrl) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set('' 1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_NE(value, nullptr); + + const CSSValueList* val_list = To<CSSValueList>(value); + ASSERT_NE(val_list, nullptr); + ASSERT_EQ(val_list->length(), 1U); + + const CSSImageSetValue& image_set_value = + To<CSSImageSetValue>(val_list->Last()); + EXPECT_EQ("image-set(url(\"\") 1x)", image_set_value.CustomCSSText()); +} + +TEST(CSSPropertyParserTest, ImageSetMissingUrl) { + const CSSValue* value = CSSParser::ParseSingleValue( + CSSPropertyID::kBackgroundImage, "image-set(1x)", + StrictCSSParserContext(SecureContextMode::kSecureContext)); + ASSERT_EQ(value, nullptr); +} + TEST(CSSPropertyParserTest, InternalLightDarkAuthor) { auto* context = MakeGarbageCollected<CSSParserContext>( kHTMLStandardMode, SecureContextMode::kInsecureContext);
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc index 89f17e23..75982c85 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
@@ -1404,6 +1404,14 @@ range.ConsumeIncludingWhitespace().Value().ToString()); } +StringView ConsumeStringAsStringView(CSSParserTokenRange& range) { + if (range.Peek().GetType() != CSSParserTokenType::kStringToken) { + return StringView(); + } + + return range.ConsumeIncludingWhitespace().Value(); +} + StringView ConsumeUrlAsStringView(CSSParserTokenRange& range, const CSSParserContext& context) { StringView url; @@ -1439,6 +1447,15 @@ return url; } +StringView ConsumeUrlOrStringAsStringView(CSSParserTokenRange& range, + const CSSParserContext& context) { + if (range.Peek().GetType() == CSSParserTokenType::kStringToken) { + return ConsumeStringAsStringView(range); + } + + return ConsumeUrlAsStringView(range, context); +} + cssvalue::CSSURIValue* ConsumeUrl(CSSParserTokenRange& range, const CSSParserContext& context) { StringView url = ConsumeUrlAsStringView(range, context); @@ -3307,7 +3324,10 @@ auto* image_set = MakeGarbageCollected<CSSImageSetValue>(); do { AtomicString url_value = - ConsumeUrlAsStringView(args, context).ToAtomicString(); + (RuntimeEnabledFeatures::CSSImageSetEnabled() + ? ConsumeUrlOrStringAsStringView(args, context) + : ConsumeUrlAsStringView(args, context)) + .ToAtomicString(); if (url_value.IsNull()) { return nullptr; }
diff --git a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h index 836222d..30ab4c82 100644 --- a/third_party/blink/renderer/core/css/properties/css_parsing_utils.h +++ b/third_party/blink/renderer/core/css/properties/css_parsing_utils.h
@@ -158,8 +158,11 @@ CSSCustomIdentValue* ConsumeDashedIdent(CSSParserTokenRange&, const CSSParserContext&); CSSStringValue* ConsumeString(CSSParserTokenRange&); +StringView ConsumeStringAsStringView(CSSParserTokenRange&); StringView ConsumeUrlAsStringView(CSSParserTokenRange&, const CSSParserContext&); +StringView ConsumeUrlOrStringAsStringView(CSSParserTokenRange&, + const CSSParserContext&); cssvalue::CSSURIValue* ConsumeUrl(CSSParserTokenRange&, const CSSParserContext&);
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.cc b/third_party/blink/renderer/core/display_lock/display_lock_context.cc index 4338f07c..7714a2a 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.cc
@@ -69,7 +69,7 @@ DetermineIfSubtreeHasFocus(); DetermineIfSubtreeHasSelection(); DetermineIfSubtreeHasTopLayerElement(); - DetermineIfInSharedElementTransitionChain(); + DetermineIfInViewTransitionElementChain(); } void DisplayLockContext::SetRequestedState(EContentVisibility state, @@ -887,7 +887,7 @@ DetermineIfSubtreeHasFocus(); DetermineIfSubtreeHasSelection(); DetermineIfSubtreeHasTopLayerElement(); - DetermineIfInSharedElementTransitionChain(); + DetermineIfInViewTransitionElementChain(); } void DisplayLockContext::WillStartLifecycleUpdate(const LocalFrameView& view) { @@ -1162,29 +1162,31 @@ } } -void DisplayLockContext::DetermineIfInSharedElementTransitionChain() { - ResetAndDetermineIfAncestorIsSharedElement(); - if (ConnectedToView()) - document_->GetDisplayLockDocumentState().UpdateSharedElementAncestorLocks(); +void DisplayLockContext::DetermineIfInViewTransitionElementChain() { + ResetAndDetermineIfAncestorIsViewTransitionElement(); + if (ConnectedToView()) { + document_->GetDisplayLockDocumentState() + .UpdateViewTransitionElementAncestorLocks(); + } } -void DisplayLockContext::ResetInSharedElementTransitionChain() { - SetRenderAffectingState(RenderAffectingState::kSharedElementTransitionChain, +void DisplayLockContext::ResetInViewTransitionElementChain() { + SetRenderAffectingState(RenderAffectingState::kViewTransitionElementChain, false); } -void DisplayLockContext::SetInSharedElementTransitionChain() { - SetRenderAffectingState(RenderAffectingState::kSharedElementTransitionChain, +void DisplayLockContext::SetInViewTransitionElementChain() { + SetRenderAffectingState(RenderAffectingState::kViewTransitionElementChain, true); } -bool DisplayLockContext::IsInSharedElementAncestorChain() const { +bool DisplayLockContext::IsInViewTransitionElementAncestorChain() const { return render_affecting_state_[static_cast<int>( - RenderAffectingState::kSharedElementTransitionChain)]; + RenderAffectingState::kViewTransitionElementChain)]; } -void DisplayLockContext::ResetAndDetermineIfAncestorIsSharedElement() { - ResetInSharedElementTransitionChain(); +void DisplayLockContext::ResetAndDetermineIfAncestorIsViewTransitionElement() { + ResetInViewTransitionElementChain(); if (!ConnectedToView()) return; @@ -1192,7 +1194,7 @@ if (!transition) return; - bool has_shared_element_ancestor = false; + bool has_view_transition_element_ancestor = false; for (auto* candidate = element_.Get(); candidate; candidate = FlatTreeTraversal::ParentElement(*candidate)) { // We don't care about document element as the ancestor, since it's common @@ -1203,12 +1205,12 @@ if (auto* layout_object = candidate->GetLayoutObject(); layout_object && transition->IsRepresentedViaPseudoElements(*layout_object)) { - has_shared_element_ancestor = true; + has_view_transition_element_ancestor = true; break; } } - SetRenderAffectingState(RenderAffectingState::kSharedElementTransitionChain, - has_shared_element_ancestor); + SetRenderAffectingState(RenderAffectingState::kViewTransitionElementChain, + has_view_transition_element_ancestor); } void DisplayLockContext::ClearHasTopLayerElement() { @@ -1331,7 +1333,7 @@ !state(RenderAffectingState::kAutoStateUnlockedUntilLifecycle) && !state(RenderAffectingState::kAutoUnlockedForPrint) && !state(RenderAffectingState::kSubtreeHasTopLayerElement) && - !state(RenderAffectingState::kSharedElementTransitionChain))); + !state(RenderAffectingState::kViewTransitionElementChain))); if (should_be_locked && !IsLocked()) Lock(); @@ -1365,8 +1367,8 @@ return "AutoUnlockedForPrint"; case RenderAffectingState::kSubtreeHasTopLayerElement: return "SubtreeHasTopLayerElement"; - case RenderAffectingState::kSharedElementTransitionChain: - return "SharedElementTransitionChain"; + case RenderAffectingState::kViewTransitionElementChain: + return "ViewTransitionElementChain"; case RenderAffectingState::kNumRenderAffectingStates: break; }
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.h b/third_party/blink/renderer/core/display_lock/display_lock_context.h index e0388a86..b5492c0e 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.h +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.h
@@ -250,28 +250,29 @@ void ScheduleTopLayerCheck(); // This updates the rendering state to account for the fact that one of the - // ancestor may be a non-root shared element, which should cause the + // ancestor may be a non-root view transition element, which should cause the // content-visibility: auto locks to be unlocked. - // This function is called anytime a descendant or ancestor shared element may - // change. Note that to determine the descendants, this function uses a - // document level function to mark all ancestors of shared elements. This - // updates all display locks on such ancestor chains, but it should be a no-op - // for any lock except this one. This is the most optimal way to do this and - // not a necessary component of the function. - // Note that this function also does not consider the root as a shared element - // (even though it might be). The reason for this is that root is treated - // different in SET: it is clipped by a viewport or some margin around, and - // it's captured by default. This means that it will frequently be in the - // chain of all display locks, and we want to avoid unnecessary unlocks. - void DetermineIfInSharedElementTransitionChain(); + // This function is called anytime a descendant or ancestor view transition + // element may change. Note that to determine the descendants, this function + // uses a document level function to mark all ancestors of view transition + // elements. This updates all display locks on such ancestor chains, but it + // should be a no-op for any lock except this one. This is the most optimal + // way to do this and not a necessary component of the function. + // Note that this function also does not consider the root as a view + // transition element (even though it might be). The reason for this is that + // root is treated different in View Transitions: it is clipped by a viewport + // or some margin around, and it's captured by default. This means that it + // will frequently be in the chain of all display locks, and we want to avoid + // unnecessary unlocks. + void DetermineIfInViewTransitionElementChain(); // Note that the following only checks the ancestor chain, and does not - // consider shared descendants. This is an optimization to be used by the - // document state. - void ResetAndDetermineIfAncestorIsSharedElement(); - // State control for shared element render affecting state. - void ResetInSharedElementTransitionChain(); - void SetInSharedElementTransitionChain(); - bool IsInSharedElementAncestorChain() const; + // consider view transition descendants. This is an optimization to be used by + // the document state. + void ResetAndDetermineIfAncestorIsViewTransitionElement(); + // State control for view transition element render affecting state. + void ResetInViewTransitionElementChain(); + void SetInViewTransitionElementChain(); + bool IsInViewTransitionElementAncestorChain() const; private: // Give access to |NotifyForcedUpdateScopeStarted()| and @@ -520,7 +521,7 @@ kAutoStateUnlockedUntilLifecycle, kAutoUnlockedForPrint, kSubtreeHasTopLayerElement, - kSharedElementTransitionChain, + kViewTransitionElementChain, kNumRenderAffectingStates }; void SetRenderAffectingState(RenderAffectingState state, bool flag);
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc b/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc index 61a8af6..0efcc566 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_document_state.cc
@@ -251,40 +251,44 @@ return had_locked_ancestor; } -void DisplayLockDocumentState::NotifySharedElementPseudoTreeChanged() { +void DisplayLockDocumentState::NotifyViewTransitionPseudoTreeChanged() { // Note that this function doesn't use - // DisplayLockContext::DetermineIfInSharedElementTransitionChain, since that - // would mean we have to call UpdateSharedElementAncestorLocks for each lock. - // This function only calls it once by hoisting it out of the context calls. + // DisplayLockContext::DetermineIfInViewTransitionElementChain, since that + // would mean we have to call UpdateViewTransitionElementAncestorLocks for + // each lock. This function only calls it once by hoisting it out of the + // context calls. + // TODO(crbug.com/1409132): This needs to be updated to match the new desired + // behavior for content-visibility: auto in a snapshot descendent. - // Reset the flag and determine if the ancestor is shared element. + // Reset the flag and determine if the ancestor is a view transition element. for (auto context : display_lock_contexts_) - context->ResetAndDetermineIfAncestorIsSharedElement(); + context->ResetAndDetermineIfAncestorIsViewTransitionElement(); - // Also process the shared elements to check if the shared element's ancestors - // are locks. These two parts give us the full chain (either locks are - // ancestors of shared or shared are ancestor of locks). - UpdateSharedElementAncestorLocks(); + // Also process the view transition elements to check if their ancestors are + // locks. These two parts give us the full chain (either locks are ancestors + // of transition element or transition elements are ancestors of locks). + UpdateViewTransitionElementAncestorLocks(); } -void DisplayLockDocumentState::UpdateSharedElementAncestorLocks() { +void DisplayLockDocumentState::UpdateViewTransitionElementAncestorLocks() { auto* transition = ViewTransitionUtils::GetActiveTransition(*document_); if (!transition) return; - const auto& shared_elements = transition->GetTransitioningElements(); - for (auto element : shared_elements) { + const auto& transitioning_elements = transition->GetTransitioningElements(); + for (auto element : transitioning_elements) { auto* ancestor = element.Get(); - // When the element which has c-v:auto is itself a shared element, marking - // it as such could go in either walk (from the function naming) but it - // happens in the ancestor chain check and skipped here. This DCHECK + // When the element which has c-v:auto is itself a view transition element, + // marking it as such could go in either walk (from the function naming) but + // it happens in the ancestor chain check and skipped here. This DCHECK // verifies this. DCHECK(!element->GetDisplayLockContext() || - element->GetDisplayLockContext()->IsInSharedElementAncestorChain()); + element->GetDisplayLockContext() + ->IsInViewTransitionElementAncestorChain()); while ((ancestor = FlatTreeTraversal::ParentElement(*ancestor))) { if (auto* context = ancestor->GetDisplayLockContext()) - context->SetInSharedElementTransitionChain(); + context->SetInViewTransitionElementChain(); } } }
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_document_state.h b/third_party/blink/renderer/core/display_lock/display_lock_document_state.h index 4ac921cf..cd1bf0c 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_document_state.h +++ b/third_party/blink/renderer/core/display_lock/display_lock_document_state.h
@@ -86,12 +86,13 @@ // Notify the display locks that selection was removed. void NotifySelectionRemoved(); - // Notify the display locks that shared elements have changed. - void NotifySharedElementPseudoTreeChanged(); + // Notify the display locks that view transition pseudo elements have + // changed. + void NotifyViewTransitionPseudoTreeChanged(); - // Updates only the ancestor locks of the view transition elements. - // This is an optimization to be used by the display lock context. - void UpdateSharedElementAncestorLocks(); + // Updates only the ancestor locks of the view transition elements. This is an + // optimization to be used by the display lock context. + void UpdateViewTransitionElementAncestorLocks(); // This is called when the forced scope is created or destroyed in // |ScopedForcedUpdate::Impl|. This is used to ensure that we can create new
diff --git a/third_party/blink/renderer/core/dom/qualified_name.h b/third_party/blink/renderer/core/dom/qualified_name.h index 0ff5a09..c8011f78 100644 --- a/third_party/blink/renderer/core/dom/qualified_name.h +++ b/third_party/blink/renderer/core/dom/qualified_name.h
@@ -235,10 +235,9 @@ return HashTraits<scoped_refptr<QualifiedNameImpl>>::IsDeletedValue( value.impl_); } - static void ConstructDeletedValue(blink::QualifiedName& slot, - bool zero_value) { + static void ConstructDeletedValue(blink::QualifiedName& slot) { HashTraits<scoped_refptr<QualifiedNameImpl>>::ConstructDeletedValue( - slot.impl_, zero_value); + slot.impl_); } };
diff --git a/third_party/blink/renderer/core/execution_context/window_agent_factory.cc b/third_party/blink/renderer/core/execution_context/window_agent_factory.cc index 662629a..44b101e 100644 --- a/third_party/blink/renderer/core/execution_context/window_agent_factory.cc +++ b/third_party/blink/renderer/core/execution_context/window_agent_factory.cc
@@ -135,8 +135,8 @@ // static void WindowAgentFactory::SchemeAndRegistrableDomainTraits:: - ConstructDeletedValue(SchemeAndRegistrableDomain& slot, bool zero_value) { - HashTraits<String>::ConstructDeletedValue(slot.scheme, zero_value); + ConstructDeletedValue(SchemeAndRegistrableDomain& slot) { + HashTraits<String>::ConstructDeletedValue(slot.scheme); } } // namespace blink
diff --git a/third_party/blink/renderer/core/execution_context/window_agent_factory.h b/third_party/blink/renderer/core/execution_context/window_agent_factory.h index d7af66d..2f74cbfd 100644 --- a/third_party/blink/renderer/core/execution_context/window_agent_factory.h +++ b/third_party/blink/renderer/core/execution_context/window_agent_factory.h
@@ -72,8 +72,7 @@ static bool IsEmptyValue(const SchemeAndRegistrableDomain&); static bool IsDeletedValue(const SchemeAndRegistrableDomain& value); - static void ConstructDeletedValue(SchemeAndRegistrableDomain& slot, - bool zero_value); + static void ConstructDeletedValue(SchemeAndRegistrableDomain& slot); }; // Use a shared instance of Agent for all frames if a frame may have the
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 4db8e65f..b3cab45 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2502,8 +2502,8 @@ continue; // ViewTransition mutates the tree and mirrors post layout transform for - // shared elements to UA created elements. This may dirty style/layout - // requiring another lifecycle update. + // transitioning elements to UA created elements. This may dirty + // style/layout requiring another lifecycle update. needs_to_repeat_lifecycle = RunViewTransitionSteps(target_state); if (!needs_to_repeat_lifecycle) break;
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 bbae4083..0c327e9 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -1010,8 +1010,6 @@ // StyleEngine instead of the base background color. bool ShouldUseColorAdjustBackground() const; - // Verifies the shared elements for the view transition on this view. - void VerifySharedElementsForViewTransition(); // Append view transition requests from this view into the given vector. void AppendViewTransitionRequests( WTF::Vector<std::unique_ptr<ViewTransitionRequest>>&);
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_descriptor_hash.h b/third_party/blink/renderer/core/html/custom/custom_element_descriptor_hash.h index 780aee6..1ba29ac 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_descriptor_hash.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_descriptor_hash.h
@@ -27,9 +27,8 @@ return HashTraits<AtomicString>::IsDeletedValue(value.name_); } - static void ConstructDeletedValue(blink::CustomElementDescriptor& slot, - bool zero_value) { - HashTraits<AtomicString>::ConstructDeletedValue(slot.name_, zero_value); + static void ConstructDeletedValue(blink::CustomElementDescriptor& slot) { + HashTraits<AtomicString>::ConstructDeletedValue(slot.name_); } };
diff --git a/third_party/blink/renderer/core/html/parser/OWNERS b/third_party/blink/renderer/core/html/parser/OWNERS index 506b856..dbe45c1 100644 --- a/third_party/blink/renderer/core/html/parser/OWNERS +++ b/third_party/blink/renderer/core/html/parser/OWNERS
@@ -1,4 +1,5 @@ csharrison@chromium.org kouhei@chromium.org masonf@chromium.org +sky@chromium.org yoavweiss@chromium.org
diff --git a/third_party/blink/renderer/core/inspector/legacy_dom_snapshot_agent.cc b/third_party/blink/renderer/core/inspector/legacy_dom_snapshot_agent.cc index b82ea3b..40647d2 100644 --- a/third_party/blink/renderer/core/inspector/legacy_dom_snapshot_agent.cc +++ b/third_party/blink/renderer/core/inspector/legacy_dom_snapshot_agent.cc
@@ -78,7 +78,7 @@ return true; } - static void ConstructDeletedValue(Vector<String>& vec, bool) { + static void ConstructDeletedValue(Vector<String>& vec) { new (NotNullTag::kNotNull, &vec) Vector<String>(WTF::kHashTableDeletedValue); }
diff --git a/third_party/blink/renderer/core/layout/api/line_layout_item.h b/third_party/blink/renderer/core/layout/api/line_layout_item.h index 7e94177c..96043ee26 100644 --- a/third_party/blink/renderer/core/layout/api/line_layout_item.h +++ b/third_party/blink/renderer/core/layout/api/line_layout_item.h
@@ -27,7 +27,7 @@ explicit LineLayoutItem(WTF::HashTableDeletedValueType) { WTF::ConstructHashTraitsDeletedValue<HashTraits<decltype(layout_object_)>>( - layout_object_, false); + layout_object_); } LineLayoutItem(std::nullptr_t) : layout_object_(nullptr) {}
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index affd840e..163e2280 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -105,7 +105,6 @@ void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const mojom::blink::WindowFeatures& window_features, bool consumed_user_gesture) override {} void DidOverscroll(const gfx::Vector2dF&, const gfx::Vector2dF&,
diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index f42e86b..c9f710cf 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h
@@ -117,7 +117,6 @@ namespace mojom { namespace blink { class TextAutosizerPageInfo; -class WindowFeatures; } } // namespace mojom @@ -245,7 +244,6 @@ virtual void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const mojom::blink::WindowFeatures& window_features, bool consumed_user_gesture) = 0; // All the parameters should be in viewport space. That is, if an event
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index f984b55..c1e0b9ef 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -44,7 +44,6 @@ #include "third_party/blink/public/common/page/page_zoom.h" #include "third_party/blink/public/common/widget/constants.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h" -#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/web/blink.h" @@ -57,6 +56,7 @@ #include "third_party/blink/public/web/web_popup_menu_info.h" #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/public/web/web_view_client.h" +#include "third_party/blink/public/web/web_window_features.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node.h" @@ -353,11 +353,12 @@ void ChromeClientImpl::Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const mojom::blink::WindowFeatures& window_features, bool user_gesture) { DCHECK(web_view_); + const WebWindowFeatures& features = frame.GetPage()->GetWindowFeatures(); + gfx::Rect bounds(features.x, features.y, features.width, features.height); const gfx::Rect rect_adjusted_for_minimum = - AdjustWindowRectForMinimum(window_features.bounds); + AdjustWindowRectForMinimum(bounds); const gfx::Rect adjusted_rect = AdjustWindowRectForDisplay(rect_adjusted_for_minimum, frame); // Request the unadjusted rect if the browser may honor cross-screen bounds.
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.h b/third_party/blink/renderer/core/page/chrome_client_impl.h index df67ae7..26f738a 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.h +++ b/third_party/blink/renderer/core/page/chrome_client_impl.h
@@ -38,7 +38,6 @@ #include "cc/input/overscroll_behavior.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink-forward.h" #include "third_party/blink/public/web/web_navigation_policy.h" -#include "third_party/blink/public/web/web_window_features.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/platform/graphics/touch_action.h" @@ -102,7 +101,6 @@ void Show(LocalFrame& frame, LocalFrame& opener_frame, NavigationPolicy navigation_policy, - const mojom::blink::WindowFeatures& window_features, bool user_gesture) override; void DidOverscroll(const gfx::Vector2dF& overscroll_delta, const gfx::Vector2dF& accumulated_overscroll,
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 28edee8c6..40e87ca 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -33,7 +33,6 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/conversions/attribution_reporting.mojom-blink.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink.h" -#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/public/web/web_window_features.h" #include "third_party/blink/renderer/core/core_initializer.h" @@ -373,21 +372,8 @@ frame.View()->SetCanHaveScrollbars(!features.is_popup); - mojom::blink::WindowFeaturesPtr window_features = - mojom::blink::WindowFeatures::New(); - window_features->bounds = page->GetChromeClient().RootWindowRect(frame); - gfx::Rect& window_rect = window_features->bounds; - if (features.x_set) - window_rect.set_x(features.x); - if (features.y_set) - window_rect.set_y(features.y); - if (features.width_set) - window_rect.set_width(features.width); - if (features.height_set) - window_rect.set_height(features.height); - page->GetChromeClient().Show(frame, opener_frame, - request.GetNavigationPolicy(), *window_features, + request.GetNavigationPolicy(), consumed_user_gesture); MaybeLogWindowOpen(opener_frame); return &frame;
diff --git a/third_party/blink/renderer/core/page/page_animator.cc b/third_party/blink/renderer/core/page/page_animator.cc index dd84ca2..ef99bfd 100644 --- a/third_party/blink/renderer/core/page/page_animator.cc +++ b/third_party/blink/renderer/core/page/page_animator.cc
@@ -101,15 +101,14 @@ animation_host->SetHasSmilAnimation(has_smil_animation_); animation_host->SetCurrentFrameHadRaf(current_frame_had_raf_); animation_host->SetNextFrameHasPendingRaf(next_frame_has_pending_raf_); - animation_host->SetHasSharedElementTransition( - has_shared_element_transition_); + animation_host->SetHasViewTransition(has_view_transition_); } has_canvas_invalidation_ = false; has_inline_style_mutation_ = false; has_smil_animation_ = false; current_frame_had_raf_ = false; // next_frame_has_pending_raf_ is reset at PostAnimate(). - // has_shared_element_transition_ is reset when the transition ends. + // has_view_transition_ is reset when the transition ends. } void PageAnimator::SetSuppressFrameRequestsWorkaroundFor704763Only( @@ -137,9 +136,8 @@ next_frame_has_pending_raf_ = true; } -void PageAnimator::SetHasSharedElementTransition( - bool has_shared_element_transition) { - has_shared_element_transition_ = has_shared_element_transition; +void PageAnimator::SetHasViewTransition(bool has_view_transition) { + has_view_transition_ = has_view_transition; } DISABLE_CFI_PERF
diff --git a/third_party/blink/renderer/core/page/page_animator.h b/third_party/blink/renderer/core/page/page_animator.h index 566b828..cd8005a2 100644 --- a/third_party/blink/renderer/core/page/page_animator.h +++ b/third_party/blink/renderer/core/page/page_animator.h
@@ -60,7 +60,7 @@ void SetHasSmilAnimation(); void SetCurrentFrameHadRaf(); void SetNextFrameHasPendingRaf(); - void SetHasSharedElementTransition(bool); + void SetHasViewTransition(bool); void ReportFrameAnimations(cc::AnimationHost* animation_host); private: @@ -81,7 +81,7 @@ // True if there is a raf scheduled for the next frame. bool next_frame_has_pending_raf_ = false; // True if there is an ongoing view transition. - bool has_shared_element_transition_ = false; + bool has_view_transition_ = false; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc b/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc index 1dcc683f..b0dcdff9 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_reason_finder.cc
@@ -346,11 +346,12 @@ if (auto* transition = ViewTransitionUtils::GetActiveTransition(object.GetDocument())) { - // Note that `NeedsSharedElementEffectNode` returns true for values that are - // in the non-transition-pseudo tree DOM. That is, things like layout view - // or the shared elements that we are transitioning. - if (transition->NeedsSharedElementEffectNode(object)) - reasons |= CompositingReason::kViewTransitionSharedElement; + // Note that `NeedsViewTransitionEffectNode` returns true for values that + // are in the non-transition-pseudo tree DOM. That is, things like layout + // view or the view transition elements that we are transitioning. + if (transition->NeedsViewTransitionEffectNode(object)) { + reasons |= CompositingReason::kViewTransitionElement; + } } return reasons;
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 22fcdcef..2b0a957 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
@@ -67,7 +67,7 @@ #include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h" #include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h" -#include "third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h" +#include "third_party/blink/renderer/platform/graphics/view_transition_element_id.h" #include "third_party/blink/renderer/platform/wtf/casting.h" #include "ui/gfx/geometry/outsets_f.h" #include "ui/gfx/geometry/transform.h" @@ -271,7 +271,7 @@ ALWAYS_INLINE void UpdateTransformForSVGChild(CompositingReasons); ALWAYS_INLINE bool NeedsEffect() const; ALWAYS_INLINE bool EffectCanUseCurrentClipAsOutputClip() const; - ALWAYS_INLINE void UpdateSharedElementTransitionEffect(); + ALWAYS_INLINE void UpdateViewTransitionEffect(); ALWAYS_INLINE void UpdateEffect(); ALWAYS_INLINE void UpdateFilter(); ALWAYS_INLINE void UpdateFragmentClip(); @@ -1644,10 +1644,10 @@ } } -void FragmentPaintPropertyTreeBuilder::UpdateSharedElementTransitionEffect() { +void FragmentPaintPropertyTreeBuilder::UpdateViewTransitionEffect() { if (NeedsPaintPropertyUpdate()) { if (full_context_.direct_compositing_reasons & - CompositingReason::kViewTransitionSharedElement) { + CompositingReason::kViewTransitionElement) { auto* transition = ViewTransitionUtils::GetActiveTransition(object_.GetDocument()); DCHECK(transition); @@ -3127,7 +3127,7 @@ UpdateOffset(); UpdateTransform(); } - UpdateSharedElementTransitionEffect(); + UpdateViewTransitionEffect(); UpdateClipPathClip(); UpdateEffect(); UpdateCssClip();
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_printer.cc b/third_party/blink/renderer/core/paint/paint_property_tree_printer.cc index b2e7f2a..380f48d 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_printer.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_printer.cc
@@ -54,7 +54,7 @@ } void CollectNodes(const LayoutObject& object) { - Traits::AddSharedElementTransitionProperties(object, *this); + Traits::AddViewTransitionProperties(object, *this); for (const auto* fragment = &object.FirstFragment(); fragment; fragment = fragment->NextFragment()) { @@ -95,7 +95,7 @@ printer.AddNode(properties.ScrollTranslation()); printer.AddNode(properties.TransformIsolationNode()); } - static void AddSharedElementTransitionProperties( + static void AddViewTransitionProperties( const LayoutObject& object, PropertyTreePrinter<TransformPaintPropertyNodeOrAlias>& printer) {} static void AddOtherProperties( @@ -123,7 +123,7 @@ printer.AddNode(properties.OverflowClip()); printer.AddNode(properties.ClipIsolationNode()); } - static void AddSharedElementTransitionProperties( + static void AddViewTransitionProperties( const LayoutObject& object, PropertyTreePrinter<ClipPaintPropertyNodeOrAlias>& printer) {} static void AddOtherProperties( @@ -150,15 +150,16 @@ printer.AddNode(properties.EffectIsolationNode()); } - static void AddSharedElementTransitionProperties( + static void AddViewTransitionProperties( const LayoutObject& object, PropertyTreePrinter<EffectPaintPropertyNodeOrAlias>& printer) { auto* transition = ViewTransitionUtils::GetActiveTransition(object.GetDocument()); - // `NeedsSharedElementEffectNode` is an indirect way to see if the object is - // participating in the transition. - if (!transition || !transition->NeedsSharedElementEffectNode(object)) + // `NeedsViewTransitionEffectNode` is an indirect way to see if the object + // is participating in the transition. + if (!transition || !transition->NeedsViewTransitionEffectNode(object)) { return; + } printer.AddNode(transition->GetEffect(object)); } @@ -185,7 +186,7 @@ printer.AddNode(properties.Scroll()); } - static void AddSharedElementTransitionProperties( + static void AddViewTransitionProperties( const LayoutObject& object, PropertyTreePrinter<ScrollPaintPropertyNode>& printer) {} static void AddOtherProperties(
diff --git a/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.cc index b8a4c8a..29e5d32a 100644 --- a/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector.cc
@@ -208,9 +208,7 @@ return; added_entry_in_latest_frame_ = false; - // TODO(npm): can we remove this update in favor of updating only during - // presentation callback? - frame_view_->GetPaintTimingDetector().UpdateLargestContentfulPaintCandidate(); + last_registered_frame_index_ = frame_index_++; RegisterNotifyPresentationTime(); }
diff --git a/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector_test.cc index c7d39c7..511c86ac 100644 --- a/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/timing/image_paint_timing_detector_test.cc
@@ -375,7 +375,7 @@ base::Value::Dict arg_dict = events[0]->GetKnownArgAsDict("data"); EXPECT_GT(arg_dict.FindInt("DOMNodeId").value_or(-1), 0); EXPECT_GT(arg_dict.FindInt("size").value_or(-1), 0); - EXPECT_EQ(arg_dict.FindInt("candidateIndex").value_or(-1), 2); + EXPECT_EQ(arg_dict.FindInt("candidateIndex").value_or(-1), 1); absl::optional<bool> isMainFrame = arg_dict.FindBool("isMainFrame"); EXPECT_TRUE(isMainFrame.has_value()); EXPECT_EQ(true, isMainFrame.value()); @@ -428,7 +428,7 @@ base::Value::Dict arg_dict = events[0]->GetKnownArgAsDict("data"); EXPECT_GT(arg_dict.FindInt("DOMNodeId").value_or(-1), 0); EXPECT_GT(arg_dict.FindInt("size").value_or(-1), 0); - EXPECT_EQ(arg_dict.FindInt("candidateIndex").value_or(-1), 2); + EXPECT_EQ(arg_dict.FindInt("candidateIndex").value_or(-1), 1); absl::optional<bool> isMainFrame = arg_dict.FindBool("isMainFrame"); EXPECT_TRUE(isMainFrame.has_value()); EXPECT_EQ(false, isMainFrame.value()); @@ -449,36 +449,6 @@ EXPECT_EQ(arg_dict.FindInt("root_height").value_or(-1), 200); } -TEST_P(ImagePaintTimingDetectorTest, LargestImagePaint_TraceEvent_NoCandidate) { - using trace_analyzer::Query; - trace_analyzer::Start("*"); - { - SetBodyInnerHTML(R"HTML( - <img id="target"></img> - )HTML"); - SetImageAndPaint("target", 5, 5); - UpdateAllLifecyclePhasesAndInvokeCallbackIfAny(); - GetDocument().getElementById("target")->remove(); - UpdateAllLifecyclePhases(); - // LCP size still 25, not affected by removal. - EXPECT_EQ(LargestPaintSize(), 25ul); - } - auto analyzer = trace_analyzer::Stop(); - trace_analyzer::TraceEventVector events; - Query q = Query::EventNameIs("LargestImagePaint::NoCandidate"); - analyzer->FindEvents(q, &events); - EXPECT_EQ(1u, events.size()); - - EXPECT_EQ("loading", events[0]->category); - EXPECT_TRUE(events[0]->HasStringArg("frame")); - ASSERT_TRUE(events[0]->HasDictArg("data")); - base::Value::Dict arg_dict = events[0]->GetKnownArgAsDict("data"); - EXPECT_EQ(arg_dict.FindInt("candidateIndex").value_or(-1), 1); - EXPECT_THAT(arg_dict.FindBool("isMainFrame"), Optional(true)); - EXPECT_THAT(arg_dict.FindBool("isOutermostMainFrame"), Optional(true)); - EXPECT_THAT(arg_dict.FindBool("isEmbeddedFrame"), Optional(false)); -} - TEST_P(ImagePaintTimingDetectorTest, UpdatePerformanceTiming) { EXPECT_EQ( GetPerformanceTimingForReporting().LargestImagePaintSizeForMetrics(), 0u); @@ -496,24 +466,6 @@ 0u); } -TEST_P(ImagePaintTimingDetectorTest, - PerformanceTimingHasZeroTimeNonZeroSizeWhenTheLargestIsNotPainted) { - EXPECT_EQ( - GetPerformanceTimingForReporting().LargestImagePaintSizeForMetrics(), 0u); - EXPECT_EQ(GetPerformanceTimingForReporting().LargestImagePaintForMetrics(), - 0u); - SetBodyInnerHTML(R"HTML( - <img id="target"></img> - )HTML"); - SetImageAndPaint("target", 5, 5); - UpdateAllLifecyclePhases(); - EXPECT_EQ( - GetPerformanceTimingForReporting().LargestImagePaintSizeForMetrics(), - 25u); - EXPECT_EQ(GetPerformanceTimingForReporting().LargestImagePaintForMetrics(), - 0u); -} - TEST_P(ImagePaintTimingDetectorTest, UpdatePerformanceTimingToZero) { SetBodyInnerHTML(R"HTML( <img id="target"></img>
diff --git a/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc b/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc index f2653da..110343c 100644 --- a/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc +++ b/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc
@@ -258,21 +258,31 @@ ParsingContext::ParseFeatureName(const String& feature_name) { DCHECK(!feature_name.empty()); // window-management is an alias for window-placement (crbug.com/1328581). - if (feature_name == "window-management" && - RuntimeEnabledFeatures::WindowManagementPermissionAliasEnabled()) { - return ParseFeatureName("window-placement"); + // Track usage of the alias used. + if (feature_name == "window-placement") { + UseCounter::Count(this->execution_context_, + WebFeature::kWindowPlacementPermissionPolicyParsed); } - if (!feature_names_.Contains(feature_name)) { - logger_.Warn("Unrecognized feature: '" + feature_name + "'."); + if (feature_name == "window-management") { + UseCounter::Count(this->execution_context_, + WebFeature::kWindowManagementPermissionPolicyParsed); + } + const String& effective_feature_name = + (feature_name == "window-management" && + RuntimeEnabledFeatures::WindowManagementPermissionAliasEnabled()) + ? "window-placement" + : feature_name; + if (!feature_names_.Contains(effective_feature_name)) { + logger_.Warn("Unrecognized feature: '" + effective_feature_name + "'."); return absl::nullopt; } - if (DisabledByOriginTrial(feature_name, execution_context_)) { + if (DisabledByOriginTrial(effective_feature_name, execution_context_)) { logger_.Warn("Origin trial controlled feature not enabled: '" + - feature_name + "'."); + effective_feature_name + "'."); return absl::nullopt; } mojom::blink::PermissionsPolicyFeature feature = - feature_names_.at(feature_name); + feature_names_.at(effective_feature_name); // TODO(https://crbug.com/1324111): Remove this after OT. if (feature == mojom::blink::PermissionsPolicyFeature::kUnload) {
diff --git a/third_party/blink/renderer/core/svg/svg_length.cc b/third_party/blink/renderer/core/svg/svg_length.cc index 9c2c6d2..8cffc8fb 100644 --- a/third_party/blink/renderer/core/svg/svg_length.cc +++ b/third_party/blink/renderer/core/svg/svg_length.cc
@@ -164,21 +164,6 @@ } } -void SVGLength::SetUnitType(CSSPrimitiveValue::UnitType type) { - DCHECK(IsSupportedCSSUnitType(type)); - value_ = CSSNumericLiteralValue::Create(value_->GetFloatValue(), type); -} - -float SVGLength::ScaleByPercentage(float input) const { - float result = input * value_->GetFloatValue(); - if (value_->IsPercentage()) { - // Delaying division by 100 as long as possible since it introduces floating - // point errors. - result = result / 100; - } - return result; -} - namespace { const CSSParserContext* GetSVGAttributeParserContext() {
diff --git a/third_party/blink/renderer/core/svg/svg_length.h b/third_party/blink/renderer/core/svg/svg_length.h index b99ce6a..3fe53ba 100644 --- a/third_party/blink/renderer/core/svg/svg_length.h +++ b/third_party/blink/renderer/core/svg/svg_length.h
@@ -71,7 +71,6 @@ return To<CSSNumericLiteralValue>(*value_).GetType(); } - void SetUnitType(CSSPrimitiveValue::UnitType); SVGLengthMode UnitMode() const { return static_cast<SVGLengthMode>(unit_mode_); } @@ -88,9 +87,6 @@ const CSSPrimitiveValue& AsCSSPrimitiveValue() const { return *value_; } - // Scale the input value by this SVGLength. - float ScaleByPercentage(float) const; - String ValueAsString() const override; SVGParsingError SetValueAsString(const String&);
diff --git a/third_party/blink/renderer/core/view_transition/README.md b/third_party/blink/renderer/core/view_transition/README.md index 25a62c0..d6bcb243 100644 --- a/third_party/blink/renderer/core/view_transition/README.md +++ b/third_party/blink/renderer/core/view_transition/README.md
@@ -35,10 +35,11 @@ - The browser executes the Document lifecycle phases (until paint) to generate the state required to render a DOM element as an image (bounding box size, transform mapping the box to viewport space and relative paint order between - elements). This state is tracked for a subset of elements (called shared - elements) which should be animated independently during a transition. + elements). This state is tracked for a subset of elements called "view + transition elements" (or just "transition elements" when the context is clear) + which should be animated independently during a transition. -- A tree of pseudo elements is generated to render the shared elements using +- A tree of pseudo elements is generated to render the transition elements using this state. The pseudo element tree is styled after a style recalc pass is executed on the author DOM during a Document lifecycle update. @@ -58,30 +59,30 @@ The ::view-transition pseudo element is the root of this pseudo element tree. This provides a shared stacking context for painting pseudo elements corresponding to -a shared element. +a transition element. -Each shared element is rendered using the following new pseudo elements : +Each transition element is rendered using the following new pseudo elements : -- ::view-transition-group generates a box which maps to the shared element's quad -in author DOM. +- ::view-transition-group generates a box which maps to the transition element's +quad in author DOM. - ::view-transition-image-pair is a box that contains two images representing -the contents of the old and new shared element. It is isolated to allow for +the contents of the old and new transition element. It is isolated to allow for mix-blend-modes that don't interact with outside content. -- ::view-transition-old is a replaced element displaying the shared element's -cached content from the old DOM. -- ::view-transition-incoming-iage is a replaced element displaying the shared element's -live content from the new DOM. +- ::view-transition-old is a replaced element displaying the transition +element's cached content from the old DOM. +- ::view-transition-new is a replaced element displaying the +transition element's live content from the new DOM. -Each shared element is tagged with a developer provided string which can be used -as a custom ident to uniquely identify and target the corresponding generated -pseudo elements in UA and developer stylesheets. This string is tracked on the -PseudoElement class. +Each transition element is tagged with a developer provided string which can be +used as a custom ident to uniquely identify and target the corresponding +generated pseudo elements in UA and developer stylesheets. This string is +tracked on the PseudoElement class. ## ViewTransitionElementResourceId ViewTransitionElementResourceId is an identifier used to tag the rendered output (called -a snapshot) of shared elements and the root stacking context generated by the +a snapshot) of transition elements and the root stacking context generated by the compositor. The snapshot provides the content for the ::view-transition-old -and ::view-transition-incoming-iage elements referenced above. +and ::view-transition-new elements referenced above. The snapshot can be in 2 states : @@ -102,8 +103,8 @@ * Once the cached version has been saved, the developer can update the DOM to the new state called the start phase. At this point new_snapshot_id is created to tag elements in the new DOM. This ID always refers to a live snapshot and -provides the content for ::view-transition-incoming-iage pseudo elements. -The old_snapshot_id now refers to the cached version displayed by +provides the content for ::view-transition-new pseudo elements. The +old_snapshot_id now refers to the cached version displayed by ::view-transition-old pseudo elements. ## Viewport Sizes @@ -149,8 +150,8 @@ hidden. If the widgets are showing this causes ::view-transition to be positioned at a negative offset relative to the fixed viewport (i.e. it's origin is underneath the mobile URL bar). This creates a stable coordinate space during -the transition. Shared element's viewport transforms account for this and are -computed relative to the snapshot viewport origin. +the transition. Transition elements' viewport transforms account for this and +are computed relative to the snapshot viewport origin. The root snapshot is sized to the snapshot viewport's size, which may be larger than the current fixed viewport. Painting is offset within the snapshot so that
diff --git a/third_party/blink/renderer/core/view_transition/view_transition.cc b/third_party/blink/renderer/core/view_transition/view_transition.cc index ef7a0566..6ec75d8 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition.cc +++ b/third_party/blink/renderer/core/view_transition/view_transition.cc
@@ -500,12 +500,12 @@ break; // Update the lifecycle if needed and discover the elements (deferred to - // AddSharedElementsFromCSS). + // AddTransitionElementsFromCSS). case State::kCaptureTagDiscovery: DCHECK(in_main_lifecycle_update_); DCHECK_GE(document_->Lifecycle().GetState(), DocumentLifecycle::kCompositingInputsClean); - style_tracker_->AddSharedElementsFromCSS(); + style_tracker_->AddTransitionElementsFromCSS(); process_next_state = AdvanceTo(State::kCaptureRequestPending); DCHECK(process_next_state); break; @@ -607,7 +607,7 @@ DocumentUpdateReason::kViewTransition); DCHECK_GE(document_->Lifecycle().GetState(), DocumentLifecycle::kPrePaintClean); - style_tracker_->AddSharedElementsFromCSS(); + style_tracker_->AddTransitionElementsFromCSS(); process_next_state = AdvanceTo(State::kAnimateRequestPending); DCHECK(process_next_state); break; @@ -784,7 +784,7 @@ ProcessCurrentState(); } -bool ViewTransition::NeedsSharedElementEffectNode( +bool ViewTransition::NeedsViewTransitionEffectNode( const LayoutObject& object) const { // Layout view always needs an effect node, even if root itself is not // transitioning. The reason for this is that we want the root to have an @@ -793,9 +793,10 @@ if (IsA<LayoutView>(object)) return !IsTerminalState(state_); - // Otherwise check if the layout object has an active shared element. + // Otherwise check if the layout object has an active transition element. auto* element = DynamicTo<Element>(object.GetNode()); - return element && style_tracker_ && style_tracker_->IsSharedElement(element); + return element && style_tracker_ && + style_tracker_->IsTransitionElement(element); } bool ViewTransition::IsRepresentedViaPseudoElements( @@ -807,7 +808,7 @@ return style_tracker_->IsRootTransitioning(); auto* element = DynamicTo<Element>(object.GetNode()); - return element && style_tracker_->IsSharedElement(element); + return element && style_tracker_->IsTransitionElement(element); } PaintPropertyChangeType ViewTransition::UpdateEffect( @@ -815,35 +816,32 @@ const EffectPaintPropertyNodeOrAlias& current_effect, const ClipPaintPropertyNodeOrAlias* current_clip, const TransformPaintPropertyNodeOrAlias* current_transform) { - DCHECK(NeedsSharedElementEffectNode(object)); + DCHECK(NeedsViewTransitionEffectNode(object)); DCHECK(current_transform); DCHECK(current_clip); EffectPaintPropertyNode::State state; - state.direct_compositing_reasons = - CompositingReason::kViewTransitionSharedElement; + state.direct_compositing_reasons = CompositingReason::kViewTransitionElement; state.local_transform_space = current_transform; state.output_clip = current_clip; - state.view_transition_shared_element_id = - ViewTransitionElementId(document_tag_); + state.view_transition_element_id = ViewTransitionElementId(document_tag_); state.compositor_element_id = CompositorElementIdFromUniqueObjectId( - object.UniqueId(), - CompositorElementIdNamespace::kSharedElementTransition); + object.UniqueId(), CompositorElementIdNamespace::kViewTransitionElement); auto* element = DynamicTo<Element>(object.GetNode()); if (!element) { // The only non-element participant is the layout view. DCHECK(object.IsLayoutView()); style_tracker_->UpdateRootIndexAndSnapshotId( - state.view_transition_shared_element_id, + state.view_transition_element_id, state.view_transition_element_resource_id); - DCHECK(state.view_transition_shared_element_id.valid() || + DCHECK(state.view_transition_element_id.valid() || !style_tracker_->IsRootTransitioning()); return style_tracker_->UpdateRootEffect(std::move(state), current_effect); } style_tracker_->UpdateElementIndicesAndSnapshotId( - element, state.view_transition_shared_element_id, + element, state.view_transition_element_id, state.view_transition_element_resource_id); return style_tracker_->UpdateEffect(element, std::move(state), current_effect); @@ -851,7 +849,7 @@ EffectPaintPropertyNode* ViewTransition::GetEffect( const LayoutObject& object) const { - DCHECK(NeedsSharedElementEffectNode(object)); + DCHECK(NeedsViewTransitionEffectNode(object)); auto* element = DynamicTo<Element>(object.GetNode()); if (!element) @@ -944,8 +942,7 @@ this); const base::TimeDelta kTimeout = [this]() { if (auto* settings = document_->GetFrame()->GetContentSettingsClient(); - settings && - settings->IncreaseSharedElementTransitionCallbackTimeout()) { + settings && settings->IncreaseViewTransitionCallbackTimeout()) { return base::Seconds(15); } else { return base::Seconds(4);
diff --git a/third_party/blink/renderer/core/view_transition/view_transition.h b/third_party/blink/renderer/core/view_transition/view_transition.h index b2993ae4..049a411 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition.h +++ b/third_party/blink/renderer/core/view_transition/view_transition.h
@@ -24,7 +24,7 @@ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/graphics/paint/clip_paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h" -#include "third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h" +#include "third_party/blink/renderer/platform/graphics/view_transition_element_id.h" #include "third_party/blink/renderer/platform/heap/forward.h" #include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" @@ -105,18 +105,18 @@ // ActiveScriptWrappable functionality. bool HasPendingActivity() const override; - // Returns true if this object needs to create an EffectNode for the shared - // element transition. - bool NeedsSharedElementEffectNode(const LayoutObject& object) const; + // Returns true if this object needs to create an EffectNode for its element + // transition. + bool NeedsViewTransitionEffectNode(const LayoutObject& object) const; // Returns true if this object is painted via pseudo elements. Note that this - // is different from NeedsSharedElementFromEffectNode() since the root may not - // be a shared element, but require an effect node. + // is different from NeedsViewTransitionEffectNode() since the root may not + // be a transitioning element, but require an effect node. bool IsRepresentedViaPseudoElements(const LayoutObject& object) const; - // Updates an effect node. This effect populates the shared element id and the - // shared element resource id. The return value is a result of updating the - // effect node. + // Updates an effect node. This effect populates the view transition element + // id and the shared element resource id. The return value is a result of + // updating the effect node. PaintPropertyChangeType UpdateEffect( const LayoutObject& object, const EffectPaintPropertyNodeOrAlias& current_effect,
diff --git a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc index 0914d1f..84b1e9ef 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc +++ b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc
@@ -133,8 +133,8 @@ snapshot_id = it->value->old_snapshot_id; } else { // If we're being called with a name that isn't an old_root name and - // it's not an element shared element, it must mean we have it as a new - // root name. + // it's not a transition element, it must mean we have it as a new root + // name. DCHECK(style_tracker_->new_root_data_); DCHECK(style_tracker_->new_root_data_->names.Contains( view_transition_name())); @@ -151,7 +151,7 @@ snapshot_id = it->value->new_snapshot_id; } else { // If we're being called with a name that isn't a new_root name and it's - // not an element shared element, it must mean we have it as an old root + // not a transition element, it must mean we have it as an old root // name. DCHECK(style_tracker_->old_root_data_); DCHECK(style_tracker_->old_root_data_->names.Contains( @@ -223,13 +223,14 @@ document_->AddConsoleMessage(console_message); } -void ViewTransitionStyleTracker::AddSharedElement(Element* element, - const AtomicString& name) { +void ViewTransitionStyleTracker::AddTransitionElement( + Element* element, + const AtomicString& name) { DCHECK(element); // Insert an empty hash set for the element if it doesn't exist, or get it if // it does. - auto& value = pending_shared_element_names_ + auto& value = pending_transition_element_names_ .insert(element, HashSet<std::pair<AtomicString, int>>()) .stored_value->value; // Find the existing name if one is there. If it is there, do nothing. @@ -297,7 +298,7 @@ return false; } -void ViewTransitionStyleTracker::AddSharedElementsFromCSS() { +void ViewTransitionStyleTracker::AddTransitionElementsFromCSS() { DCHECK(document_ && document_->View()); // We need our paint layers, and z-order lists which is done during @@ -305,13 +306,13 @@ DCHECK_GE(document_->Lifecycle().GetState(), DocumentLifecycle::kCompositingInputsClean); - AddSharedElementsFromCSSRecursive( + AddTransitionElementsFromCSSRecursive( document_->GetLayoutView()->PaintingLayer()); } -void ViewTransitionStyleTracker::AddSharedElementsFromCSSRecursive( +void ViewTransitionStyleTracker::AddTransitionElementsFromCSSRecursive( PaintLayer* root) { - // We want to call AddSharedElements in the order in which + // We want to call AddTransitionElements in the order in which // PaintLayerPaintOrderIterator would cause us to paint the elements. // Specifically, parents are added before their children, and lower z-index // children are added before higher z-index children. Given that, what we @@ -319,17 +320,17 @@ // PaintLayerPaintOrderIterator which will return values in the correct // z-index order. // - // Note that the order of calls to AddSharedElement determines the DOM order - // of pseudo-elements constructed to represent the shared elements, which by - // default will also represent the paint order of the pseudo-elements (unless - // changed by something like z-index on the pseudo-elements). + // Note that the order of calls to AddTransitionElement determines the DOM + // order of pseudo-elements constructed to represent the transition elements, + // which by default will also represent the paint order of the pseudo-elements + // (unless changed by something like z-index on the pseudo-elements). auto& root_object = root->GetLayoutObject(); auto& root_style = root_object.StyleRef(); if (root_style.ViewTransitionName()) { DCHECK(root_object.GetNode()); DCHECK(root_object.GetNode()->IsElementNode()); - AddSharedElement(DynamicTo<Element>(root_object.GetNode()), - root_style.ViewTransitionName()); + AddTransitionElement(DynamicTo<Element>(root_object.GetNode()), + root_style.ViewTransitionName()); } if (root_object.ChildPaintBlockedByDisplayLock()) @@ -337,7 +338,7 @@ PaintLayerPaintOrderIterator child_iterator(root, kAllChildren); while (auto* child = child_iterator.Next()) { - AddSharedElementsFromCSSRecursive(child); + AddTransitionElementsFromCSSRecursive(child); } } @@ -378,7 +379,7 @@ VectorOf<FlatData> flat_list; // Flatten it. - for (auto& [element, names] : pending_shared_element_names_) { + for (auto& [element, names] : pending_transition_element_names_) { DCHECK(element->GetLayoutObject()); const bool is_root = element->IsDocumentElement(); @@ -430,7 +431,7 @@ bool ViewTransitionStyleTracker::Capture() { DCHECK_EQ(state_, State::kIdle); - // Flatten `pending_shared_element_names_` into a vector of names and + // Flatten `pending_transition_element_names_` into a vector of names and // elements. This process also verifies that the name-element combinations are // valid. VectorOf<AtomicString> transition_names; @@ -488,7 +489,7 @@ InvalidateStyle(); set_element_sequence_id_ = 0; - pending_shared_element_names_.clear(); + pending_transition_element_names_.clear(); return true; } @@ -504,8 +505,8 @@ // Since the elements will be unset, we need to invalidate their style first. // TODO(vmpstr): We don't have to invalidate the pseudo styles at this point, - // just the shared elements. We can split InvalidateStyle() into two functions - // as an optimization. + // just the transition elements. We can split InvalidateStyle() into two + // functions as an optimization. InvalidateStyle(); for (auto& entry : element_data_map_) { @@ -517,7 +518,7 @@ } VectorOf<Element> ViewTransitionStyleTracker::GetTransitioningElements() const { - // In stable states, we don't have shared elements. + // In stable states, we don't have transitioning elements. if (state_ == State::kIdle || state_ == State::kCaptured) return {}; @@ -532,7 +533,7 @@ bool ViewTransitionStyleTracker::Start() { DCHECK_EQ(state_, State::kCaptured); - // Flatten `pending_shared_element_names_` into a vector of names and + // Flatten `pending_transition_element_names_` into a vector of names and // elements. This process also verifies that the name-element combinations are // valid. VectorOf<AtomicString> transition_names; @@ -592,8 +593,8 @@ if (!found_new_names && new_root_data_) { DCHECK(old_root_data_); for (const auto& new_name : new_root_data_->names) { - // If the new root name is not also an old root name and it isn't a shared - // element name, then we have a new name. + // If the new root name is not also an old root name and it isn't a + // transition element name, then we have a new name. if (!old_root_data_->names.Contains(new_name) && !element_data_map_.Contains(new_name)) { found_new_names = true; @@ -643,7 +644,7 @@ InvalidateStyle(); if (auto* page = document_->GetPage()) - page->Animator().SetHasSharedElementTransition(true); + page->Animator().SetHasViewTransition(true); return true; } @@ -661,18 +662,18 @@ InvalidateHitTestingCache(); // We need a style invalidation to remove the pseudo element tree. This needs - // to be done before we clear the data, since we need to invalidate the shared - // elements stored in `element_data_map_`. + // to be done before we clear the data, since we need to invalidate the + // transition elements stored in `element_data_map_`. InvalidateStyle(); element_data_map_.clear(); - pending_shared_element_names_.clear(); + pending_transition_element_names_.clear(); set_element_sequence_id_ = 0; old_root_data_.reset(); new_root_data_.reset(); document_->GetStyleEngine().SetViewTransitionNames({}); if (auto* page = document_->GetPage()) - page->Animator().SetHasSharedElementTransition(false); + page->Animator().SetHasViewTransition(false); } void ViewTransitionStyleTracker::UpdateElementIndicesAndSnapshotId( @@ -950,7 +951,7 @@ element_data->effect_node = EffectPaintPropertyNode::Create(current_effect, std::move(state)); #if DCHECK_IS_ON() - element_data->effect_node->SetDebugName("SharedElementTransition"); + element_data->effect_node->SetDebugName("ViewTransition"); #endif return PaintPropertyChangeType::kNodeAddedOrRemoved; } @@ -968,7 +969,7 @@ root_effect_node_ = EffectPaintPropertyNode::Create(current_effect, std::move(state)); #if DCHECK_IS_ON() - root_effect_node_->SetDebugName("SharedElementTransition"); + root_effect_node_->SetDebugName("ViewTransition"); #endif return PaintPropertyChangeType::kNodeAddedOrRemoved; } @@ -993,8 +994,8 @@ return root_effect_node_.get(); } -bool ViewTransitionStyleTracker::IsSharedElement(Node* node) const { - // In stable states, we don't have shared elements. +bool ViewTransitionStyleTracker::IsTransitionElement(Node* node) const { + // In stable states, we don't have transition elements. if (state_ == State::kIdle || state_ == State::kCaptured) return false; @@ -1198,14 +1199,14 @@ if (!object) continue; - // We propagate the shared element id on an effect node for the object. This - // means that we should update the paint properties to update the shared - // element id. + // We propagate the view transition element id on an effect node for the + // object. This means that we should update the paint properties to update + // the view transition element id. object->SetNeedsPaintPropertyUpdate(); } document_->GetDisplayLockDocumentState() - .NotifySharedElementPseudoTreeChanged(); + .NotifyViewTransitionPseudoTreeChanged(); } HashSet<AtomicString> ViewTransitionStyleTracker::AllRootTags() const { @@ -1247,21 +1248,21 @@ // 2. A name is an old root only (exit animation for root). The style is set // up in the AllrootTags loop and fades out through AnimationUAStyles. // - // 3. A name is an old root and a new shared element. The AllRootTags loop + // 3. A name is an old root and a new transition element. The AllRootTags loop // skips this name. The element map loop updates the container for the new - // shared element size and transform. The animation code of that loop adds an - // animation from old root size and identity matrix. + // transition element size and transform. The animation code of that loop adds + // an animation from old root size and identity matrix. // // 4. A name is a new root only (entry animation for root). Its only visited // in AllRootTags and its a default fade-in. // - // 5. A name is a new root and old shared element. We visit it in AllRootTags - // to set up the destination state. We skip setting its styles in the - // `element_data_map_` loop since latest value comes from AllRootTags. We do - // set the animation in that loop since we need the "from" state. + // 5. A name is a new root and old transition element. We visit it in + // AllRootTags to set up the destination state. We skip setting its styles in + // the `element_data_map_` loop since latest value comes from AllRootTags. We + // do set the animation in that loop since we need the "from" state. // - // 6. A name is a new and old shared element (or maybe exit/enter for shared - // element only -- no roots involved. Everything is done in the + // 6. A name is a new and old transition element (or maybe exit/enter for + // transition element only -- no roots involved. Everything is done in the // `element_data_map_` loop. // Size and position the root container behind any viewport insetting widgets @@ -1327,7 +1328,7 @@ element_data->container_properties.back(), element_data->container_writing_mode); - // Incoming inset also only makes sense if the name is a new shared + // Incoming inset also only makes sense if the name is a new transition // element (not a new root). const bool has_new_image = element_data->new_snapshot_id.IsValid(); absl::optional<String> incoming_inset = @@ -1345,8 +1346,8 @@ } } - // Outgoing inset only makes sense if the name is an old shared element (not - // an old root). + // Outgoing inset only makes sense if the name is an old transition element + // (not an old root). const bool has_old_image = element_data->old_snapshot_id.IsValid(); if (has_old_image && !name_is_old_root) { absl::optional<String> outgoing_inset = ComputeInsetDifference( @@ -1398,7 +1399,7 @@ void ViewTransitionStyleTracker::Trace(Visitor* visitor) const { visitor->Trace(document_); visitor->Trace(element_data_map_); - visitor->Trace(pending_shared_element_names_); + visitor->Trace(pending_transition_element_names_); } void ViewTransitionStyleTracker::InvalidateHitTestingCache() { @@ -1417,7 +1418,7 @@ } // TODO(vmpstr): We need to write tests for the following: -// * A local transform on the shared element. +// * A local transform on the transition element. // * A transform on an ancestor which changes its screen space transform. LayoutSize ViewTransitionStyleTracker::ElementData::GetIntrinsicSize( bool use_cached_data) { @@ -1444,7 +1445,7 @@ PhysicalRect ViewTransitionStyleTracker::ComputeVisualOverflowRect( LayoutBoxModelObject& box, LayoutBoxModelObject* ancestor) { - if (ancestor && IsSharedElement(box.GetNode())) { + if (ancestor && IsTransitionElement(box.GetNode())) { return {}; }
diff --git a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.h b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.h index 0c7093b..ebc7ec44 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.h +++ b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.h
@@ -14,7 +14,7 @@ #include "third_party/blink/renderer/platform/allow_discouraged_type.h" #include "third_party/blink/renderer/platform/geometry/layout_size.h" #include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h" -#include "third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h" +#include "third_party/blink/renderer/platform/graphics/view_transition_element_id.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h" #include "third_party/blink/renderer/platform/heap/heap_traits.h" #include "ui/gfx/geometry/transform.h" @@ -31,8 +31,9 @@ // are generated after the new Document has loaded and the transition can be // started. // -// 2) Tracking changes in the state of shared elements that are mirrored in the -// style for their corresponding pseudo element. For example, if a shared +// 2) Tracking changes in the state of transition elements that are mirrored in +// the +// style for their corresponding pseudo element. For example, if a transition // element's size or viewport space transform is updated. This data is used // to generate a dynamic UA stylesheet for these pseudo elements. // @@ -66,7 +67,7 @@ ViewTransitionStyleTracker(Document& document, ViewTransitionState); ~ViewTransitionStyleTracker(); - void AddSharedElementsFromCSS(); + void AddTransitionElementsFromCSS(); // Returns true if the pseudo element corresponding to the given id and name // is the only child. @@ -141,7 +142,7 @@ int CapturedTagCount() const { return captured_name_count_; } - bool IsSharedElement(Node* node) const; + bool IsTransitionElement(Node* node) const; // This function represents whether root itself is participating in the // transition (i.e. it has a name in the current phase). Note that we create @@ -212,7 +213,7 @@ // any of element's own effects, in a pseudo element layer. scoped_refptr<EffectPaintPropertyNode> effect_node; - // Index to add to the view transition shared element id. + // Index to add to the view transition element id. int element_index; // The visual overflow rect for this element. This is used to compute @@ -237,12 +238,12 @@ void EndTransition(); void AddConsoleError(String message, Vector<DOMNodeId> related_nodes = {}); - void AddSharedElement(Element*, const AtomicString&); + void AddTransitionElement(Element*, const AtomicString&); bool FlattenAndVerifyElements(VectorOf<Element>&, VectorOf<AtomicString>&, absl::optional<RootData>&); - void AddSharedElementsFromCSSRecursive(PaintLayer*); + void AddTransitionElementsFromCSSRecursive(PaintLayer*); int OldRootDataTagSize() const { return old_root_data_ ? old_root_data_->names.size() : 0; @@ -301,7 +302,7 @@ // by script for the start phase. int set_element_sequence_id_ = 0; HeapHashMap<Member<Element>, HashSet<std::pair<AtomicString, int>>> - pending_shared_element_names_; + pending_transition_element_names_; // This vector is passed as constructed to cc's view transition request, // so this uses the std::vector for that reason, instead of WTF::Vector.
diff --git a/third_party/blink/renderer/core/view_transition/view_transition_test.cc b/third_party/blink/renderer/core/view_transition/view_transition_test.cc index f788e1c..b62bdd9 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition_test.cc +++ b/third_party/blink/renderer/core/view_transition/view_transition_test.cc
@@ -135,7 +135,7 @@ auto* layout_object = e->GetLayoutObject(); auto* transition = ViewTransitionUtils::GetActiveTransition(GetDocument()); return layout_object && transition && - transition->NeedsSharedElementEffectNode(*layout_object); + transition->NeedsViewTransitionEffectNode(*layout_object); } void ValidatePseudoElementTree( @@ -240,7 +240,7 @@ auto* container_box = To<LayoutBox>(container_pseudo->GetLayoutObject()); EXPECT_EQ(LayoutSize(100, 100), container_box->Size()); - // Shared elements should not cause a layout shift. + // View transition elements should not cause a layout shift. auto* target = To<LayoutBox>(GetDocument().getElementById("target")->GetLayoutObject()); EXPECT_FLOAT_EQ(0, GetLayoutShiftTracker().Score()); @@ -301,7 +301,7 @@ FinishTransition(); } -TEST_P(ViewTransitionTest, PrepareSharedElementsWantToBeComposited) { +TEST_P(ViewTransitionTest, PrepareTransitionElementsWantToBeComposited) { SetHtmlInnerHTML(R"HTML( <style> /* TODO(crbug.com/1336462): html.css is parsed before runtime flags are enabled */ @@ -366,7 +366,7 @@ test::RunPendingTasks(); } -TEST_P(ViewTransitionTest, StartSharedElementsWantToBeComposited) { +TEST_P(ViewTransitionTest, StartTransitionElementsWantToBeComposited) { SetHtmlInnerHTML(R"HTML( <style> /* TODO(crbug.com/1336462): html.css is parsed before runtime flags are enabled */ @@ -625,7 +625,7 @@ kPseudoIdViewTransition)); } -TEST_P(ViewTransitionTest, ViewTransitionSharedElementInvalidation) { +TEST_P(ViewTransitionTest, ViewTransitionElementInvalidation) { SetHtmlInnerHTML(R"HTML( <style> /* TODO(crbug.com/1336462): html.css is parsed before runtime flags are enabled */
diff --git a/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.cc b/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.cc index 484615b..6dc1ae68 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.cc +++ b/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.cc
@@ -25,6 +25,7 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_identity_credential_logout_r_ps_request.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_identity_credential_request_options_context.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_identity_provider_config.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_identity_user_info.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_login_hint.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_creation_options.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_descriptor.h" @@ -62,6 +63,8 @@ using blink::mojom::blink::IdentityProviderConfig; using blink::mojom::blink::IdentityProviderConfigPtr; using blink::mojom::blink::IdentityProviderLoginHint; +using blink::mojom::blink::IdentityUserInfo; +using blink::mojom::blink::IdentityUserInfoPtr; using blink::mojom::blink::LargeBlobSupport; using blink::mojom::blink::LogoutRpsRequest; using blink::mojom::blink::LogoutRpsRequestPtr; @@ -781,6 +784,19 @@ } } +IdentityUserInfoPtr +TypeConverter<IdentityUserInfoPtr, blink::IdentityUserInfo>::Convert( + const blink::IdentityUserInfo& user_info) { + DCHECK(blink::RuntimeEnabledFeatures::FedCmUserInfoEnabled()); + auto mojo_user_info = IdentityUserInfo::New(); + + mojo_user_info->email = user_info.email(); + mojo_user_info->given_name = user_info.givenName(); + mojo_user_info->name = user_info.name(); + mojo_user_info->picture = user_info.picture(); + return mojo_user_info; +} + // static DevicePublicKeyRequestPtr TypeConverter<DevicePublicKeyRequestPtr,
diff --git a/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.h b/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.h index 0ea9774..b009f62 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.h +++ b/third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.h
@@ -25,6 +25,7 @@ class Credential; class IdentityCredentialLogoutRPsRequest; class IdentityProviderConfig; +class IdentityUserInfo; class PublicKeyCredentialCreationOptions; class PublicKeyCredentialDescriptor; class PublicKeyCredentialParameters; @@ -212,6 +213,13 @@ }; template <> +struct TypeConverter<blink::mojom::blink::IdentityUserInfoPtr, + blink::IdentityUserInfo> { + static blink::mojom::blink::IdentityUserInfoPtr Convert( + const blink::IdentityUserInfo&); +}; + +template <> struct TypeConverter<blink::mojom::blink::DevicePublicKeyRequestPtr, blink::AuthenticationExtensionsDevicePublicKeyInputs> { static blink::mojom::blink::DevicePublicKeyRequestPtr Convert(
diff --git a/third_party/blink/renderer/modules/credentialmanagement/identity_provider.cc b/third_party/blink/renderer/modules/credentialmanagement/identity_provider.cc index de8a08b..cddf9c5 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/identity_provider.cc +++ b/third_party/blink/renderer/modules/credentialmanagement/identity_provider.cc
@@ -6,23 +6,123 @@ #include "third_party/blink/public/mojom/webid/federated_auth_request.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_identity_user_info.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/modules/credentialmanagement/credential_manager_proxy.h" +#include "third_party/blink/renderer/modules/credentialmanagement/credential_manager_type_converters.h" +#include "third_party/blink/renderer/modules/credentialmanagement/identity_credential.h" #include "third_party/blink/renderer/modules/credentialmanagement/scoped_promise_resolver.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/heap/garbage_collected.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" namespace blink { +namespace { + +using mojom::blink::RequestUserInfoStatus; + +void OnRequestUserInfo(ScriptPromiseResolver* resolver, + RequestUserInfoStatus status, + absl::optional<Vector<mojom::blink::IdentityUserInfoPtr>> + all_user_info_ptr) { + switch (status) { + case RequestUserInfoStatus::kErrorTooManyRequests: { + resolver->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kAbortError, + "Only one IdentityCredential.getUserInfo request may be outstanding " + "at one time.")); + return; + } + case RequestUserInfoStatus::kError: { + resolver->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kNetworkError, "Error retrieving user info.")); + return; + } + case RequestUserInfoStatus::kSuccess: { + HeapVector<Member<IdentityUserInfo>> all_user_info; + for (const auto& user_info_ptr : all_user_info_ptr.value()) { + IdentityUserInfo* user_info = IdentityUserInfo::Create(); + user_info->setEmail(user_info_ptr->email); + user_info->setGivenName(user_info_ptr->given_name); + user_info->setName(user_info_ptr->name); + user_info->setPicture(user_info_ptr->picture); + all_user_info.push_back(user_info); + } + + DCHECK_GT(all_user_info.size(), 0u); + resolver->Resolve(all_user_info); + return; + } + default: { + NOTREACHED(); + } + } +} + +} // namespace + ScriptPromise IdentityProvider::getUserInfo( ScriptState* script_state, - const blink::IdentityProviderConfig* config, + const blink::IdentityProviderConfig* provider, ExceptionState& exception_state) { auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); ScriptPromise promise = resolver->Promise(); - // TODO(crbug.com/1304402): implement the actual logic. + if (!resolver->GetExecutionContext()->IsFeatureEnabled( + mojom::blink::PermissionsPolicyFeature::kIdentityCredentialsGet)) { + resolver->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kNotAllowedError, + "The 'identity-credentials-get` feature is not enabled in this " + "document.")); + return promise; + } + + DCHECK(provider); + + KURL provider_url(provider->configURL()); + String client_id = provider->clientId(); + + if (!provider_url.IsValid() || client_id == "") { + resolver->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + String::Format("Provider information is incomplete."))); + return promise; + } + + const SecurityOrigin* origin = + resolver->GetExecutionContext()->GetSecurityOrigin(); + if (!SecurityOrigin::CreateFromString(provider_url) + ->IsSameOriginWith(origin)) { + resolver->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, + "UserInfo request must be initiated from a frame that is the same " + "origin with the provider.")); + return promise; + } + + ContentSecurityPolicy* policy = + resolver->GetExecutionContext() + ->GetContentSecurityPolicyForCurrentWorld(); + // We disallow redirects (in idp_network_request_manager.cc), so it is + // sufficient to check the initial URL here. + if (IdentityCredential::IsRejectingPromiseDueToCSP(policy, resolver, + provider_url)) { + return promise; + } + + mojom::blink::IdentityProviderConfigPtr identity_provider = + blink::mojom::blink::IdentityProviderConfig::From(*provider); + + auto* user_info_request = + CredentialManagerProxy::From(script_state)->FederatedAuthRequest(); + user_info_request->RequestUserInfo( + std::move(identity_provider), + WTF::BindOnce(&OnRequestUserInfo, WrapPersistent(resolver))); + return promise; }
diff --git a/third_party/blink/renderer/modules/permissions/permission_utils.cc b/third_party/blink/renderer/modules/permissions/permission_utils.cc index 4069c32..049cbbf 100644 --- a/third_party/blink/renderer/modules/permissions/permission_utils.cc +++ b/third_party/blink/renderer/modules/permissions/permission_utils.cc
@@ -304,6 +304,8 @@ return CreatePermissionDescriptor(PermissionName::TOP_LEVEL_STORAGE_ACCESS); } if (name == "window-management") { + UseCounter::Count(CurrentExecutionContext(script_state->GetIsolate()), + WebFeature::kWindowManagementPermissionDescriptorUsed); if (!RuntimeEnabledFeatures::WindowManagementPermissionAliasEnabled()) { exception_state.ThrowTypeError( "The Window Management alias is not enabled."); @@ -312,6 +314,8 @@ return CreatePermissionDescriptor(PermissionName::WINDOW_MANAGEMENT); } if (name == "window-placement") { + UseCounter::Count(CurrentExecutionContext(script_state->GetIsolate()), + WebFeature::kWindowPlacementPermissionDescriptorUsed); return CreatePermissionDescriptor(PermissionName::WINDOW_MANAGEMENT); } if (name == "local-fonts") {
diff --git a/third_party/blink/renderer/modules/subapps/sub_apps.cc b/third_party/blink/renderer/modules/subapps/sub_apps.cc index f2ec616..eafb44f 100644 --- a/third_party/blink/renderer/modules/subapps/sub_apps.cc +++ b/third_party/blink/renderer/modules/subapps/sub_apps.cc
@@ -12,6 +12,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_add_options.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_list_info.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_result_code.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -28,7 +29,6 @@ using mojom::blink::SubAppsService; using mojom::blink::SubAppsServiceAddInfo; using mojom::blink::SubAppsServiceAddInfoPtr; -using mojom::blink::SubAppsServiceAddResultCode; using mojom::blink::SubAppsServiceAddResultPtr; using mojom::blink::SubAppsServiceListInfoPtr; using mojom::blink::SubAppsServiceListResultPtr; @@ -38,39 +38,15 @@ const int kMaximumNumberOfSubappsPerAddCall = 7; -Vector<std::pair<String, String>> AddResultsFromMojo( +Vector<std::pair<String, V8SubAppsResultCode>> AddResultsFromMojo( Vector<SubAppsServiceAddResultPtr> add_results_mojo) { - Vector<std::pair<String, String>> add_results_idl; + Vector<std::pair<String, V8SubAppsResultCode>> add_results_idl; for (auto& add_result : add_results_mojo) { - std::string result; - - switch (add_result->result_code) { - case SubAppsServiceAddResultCode::kSuccessNewInstall: - result = "success-new-install"; - break; - case SubAppsServiceAddResultCode::kSuccessAlreadyInstalled: - result = "success-already-installed"; - break; - case SubAppsServiceAddResultCode::kUserInstallDeclined: - result = "user-install-declined"; - break; - case SubAppsServiceAddResultCode::kExpectedAppIdCheckFailed: - result = "expected-app-id-check-failed"; - break; - case SubAppsServiceAddResultCode::kParentAppUninstalled: - result = "parent-app-uninstalled"; - break; - case SubAppsServiceAddResultCode::kInstallUrlInvalid: - result = "install-url-invalid"; - break; - case SubAppsServiceAddResultCode::kNotValidManifestForWebApp: - result = "invalid-manifest-for-web-app"; - break; - case SubAppsServiceAddResultCode::kFailure: - result = "failure"; - break; - } - add_results_idl.emplace_back(add_result->unhashed_app_id_path, result); + auto result_code = + add_result->result_code == SubAppsServiceResult::kSuccess + ? V8SubAppsResultCode(V8SubAppsResultCode::Enum::kSuccess) + : V8SubAppsResultCode(V8SubAppsResultCode::Enum::kFailure); + add_results_idl.emplace_back(add_result->unhashed_app_id_path, result_code); } return add_results_idl; } @@ -195,10 +171,7 @@ WTF::BindOnce([](ScriptPromiseResolver* resolver, Vector<SubAppsServiceAddResultPtr> results_mojo) { for (const auto& add_result : results_mojo) { - if (add_result->result_code != - SubAppsServiceAddResultCode::kSuccessNewInstall && - add_result->result_code != - SubAppsServiceAddResultCode::kSuccessAlreadyInstalled) { + if (add_result->result_code == SubAppsServiceResult::kFailure) { return resolver->Reject( AddResultsFromMojo(std::move(results_mojo))); }
diff --git a/third_party/blink/renderer/modules/subapps/sub_apps.idl b/third_party/blink/renderer/modules/subapps/sub_apps.idl index bf210bf..d87f2fb 100644 --- a/third_party/blink/renderer/modules/subapps/sub_apps.idl +++ b/third_party/blink/renderer/modules/subapps/sub_apps.idl
@@ -2,20 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(crbug.com/1408099): Update once we publish the spec. // https://github.com/ivansandrk/multi-apps/blob/main/explainer.md - -enum SubAppsServiceAddResultCode { - // Success category: - "success-new-install", - "success-already-installed", - - // // Failure category: - "user-install-declined", - "expected-app-id-check-failed", - "parent-app-uninstalled", - "install-url-invalid", - "invalid-manifest-for-web-app", +enum SubAppsResultCode { + "success", "failure", }; @@ -24,7 +15,7 @@ SecureContext, RuntimeEnabled=DesktopPWAsSubApps ] interface SubApps { - [CallWith=ScriptState, RaisesException] Promise<record<DOMString, SubAppsServiceAddResultCode>> add(record<DOMString, SubAppsAddOptions> sub_apps_to_add); + [CallWith=ScriptState, RaisesException] Promise<record<DOMString, SubAppsResultCode>> add(record<DOMString, SubAppsAddOptions> sub_apps_to_add); [CallWith=ScriptState, RaisesException] Promise<record<DOMString, SubAppsListInfo>> list(); [CallWith=ScriptState, RaisesException] Promise<void> remove(DOMString app_id); };
diff --git a/third_party/blink/renderer/modules/webcodecs/aac_encoder_config.idl b/third_party/blink/renderer/modules/webcodecs/aac_encoder_config.idl new file mode 100644 index 0000000..bfdedad2 --- /dev/null +++ b/third_party/blink/renderer/modules/webcodecs/aac_encoder_config.idl
@@ -0,0 +1,16 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/w3c/web-codecs + +enum AacBitstreamFormat { + "aac", + "adts", +}; + +// NOTE: Keep this structure in sync with CopyAacConfig() defined in +// audio_encoder.cc. +dictionary AacEncoderConfig { + AacBitstreamFormat format = "aac"; +}; \ No newline at end of file
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc b/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc index d92f0e6..5547a7f 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc +++ b/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc
@@ -28,6 +28,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h" #include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_aac_encoder_config.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_audio_data_init.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_config.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_config.h" @@ -77,6 +78,22 @@ return false; } +AudioEncoderTraits::ParsedConfig* ParseAacConfigStatic( + const AacEncoderConfig* aac_config, + AudioEncoderTraits::ParsedConfig* result, + ExceptionState& exception_state) { + result->options.aac = media::AudioEncoder::AacOptions(); + switch (aac_config->format().AsEnum()) { + case V8AacBitstreamFormat::Enum::kAac: + result->options.aac->format = media::AudioEncoder::AacOutputFormat::AAC; + return result; + case V8AacBitstreamFormat::Enum::kAdts: + result->options.aac->format = media::AudioEncoder::AacOutputFormat::ADTS; + return result; + } + return result; +} + AudioEncoderTraits::ParsedConfig* ParseOpusConfigStatic( const OpusEncoderConfig* opus_config, AudioEncoderTraits::ParsedConfig* result, @@ -200,13 +217,19 @@ result->options.bitrate = static_cast<int>(config->bitrate()); } - // Only Opus supports codec-specific parameters for now. - if (result->options.codec != media::AudioCodec::kOpus) - return result; - - return ParseOpusConfigStatic( - config->hasOpus() ? config->opus() : OpusEncoderConfig::Create(), result, - exception_state); + switch (result->options.codec) { + case media::AudioCodec::kOpus: + return ParseOpusConfigStatic( + config->hasOpus() ? config->opus() : OpusEncoderConfig::Create(), + result, exception_state); + case media::AudioCodec::kAAC: { + auto* aac_config = + config->hasAac() ? config->aac() : AacEncoderConfig::Create(); + return ParseAacConfigStatic(aac_config, result, exception_state); + } + default: + return result; + } } bool VerifyCodecSupportStatic(AudioEncoderTraits::ParsedConfig* config, @@ -272,6 +295,12 @@ } } +AacEncoderConfig* CopyAacConfig(const AacEncoderConfig& config) { + auto* result = AacEncoderConfig::Create(); + result->setFormat(config.format()); + return result; +} + OpusEncoderConfig* CopyOpusConfig(const OpusEncoderConfig& config) { auto* opus_result = OpusEncoderConfig::Create(); opus_result->setFormat(config.format()); @@ -293,6 +322,9 @@ if (config.codec() == String("opus") && config.hasOpus()) result->setOpus(CopyOpusConfig(*config.opus())); + if (config.codec() == String("aac") && config.hasAac()) { + result->setAac(CopyAacConfig(*config.aac())); + } return result; }
diff --git a/third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl b/third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl index 520d333..4c67533 100644 --- a/third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl +++ b/third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl
@@ -18,5 +18,6 @@ [EnforceRange] unsigned long long bitrate; // Codec-specific extensions + AacEncoderConfig aac; OpusEncoderConfig opus; };
diff --git a/third_party/blink/renderer/modules/xr/xr_session.cc b/third_party/blink/renderer/modules/xr/xr_session.cc index 20f25cd..9a8ec09 100644 --- a/third_party/blink/renderer/modules/xr/xr_session.cc +++ b/third_party/blink/renderer/modules/xr/xr_session.cc
@@ -297,6 +297,7 @@ case XRSessionFeature::HAND_INPUT: case XRSessionFeature::SECONDARY_VIEWS: case XRSessionFeature::LAYERS: + case XRSessionFeature::FRONT_FACING: // Not recording metrics for these features currently. break; }
diff --git a/third_party/blink/renderer/modules/xr/xr_system.cc b/third_party/blink/renderer/modules/xr/xr_system.cc index a3fd434f..37f0dc9 100644 --- a/third_party/blink/renderer/modules/xr/xr_system.cc +++ b/third_party/blink/renderer/modules/xr/xr_system.cc
@@ -213,8 +213,7 @@ case device::mojom::XRSessionFeature::LIGHT_ESTIMATION: case device::mojom::XRSessionFeature::CAMERA_ACCESS: case device::mojom::XRSessionFeature::PLANE_DETECTION: - // Fallthrough - light estimation, camera access, and plane detection are - // all valid only for immersive AR mode for now. + case device::mojom::XRSessionFeature::FRONT_FACING: return mode == device::mojom::blink::XRSessionMode::kImmersiveAr; case device::mojom::XRSessionFeature::DEPTH: if (!session_init->hasDepthSensing()) { @@ -250,6 +249,7 @@ case device::mojom::XRSessionFeature::HAND_INPUT: case device::mojom::XRSessionFeature::SECONDARY_VIEWS: case device::mojom::XRSessionFeature::LAYERS: + case device::mojom::XRSessionFeature::FRONT_FACING: return context->IsFeatureEnabled( mojom::blink::PermissionsPolicyFeature::kWebXr, ReportOptions::kReportOnFailure);
diff --git a/third_party/blink/renderer/modules/xr/xr_utils.cc b/third_party/blink/renderer/modules/xr/xr_utils.cc index c03f856..7c7f7a96 100644 --- a/third_party/blink/renderer/modules/xr/xr_utils.cc +++ b/third_party/blink/renderer/modules/xr/xr_utils.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/geometry/dom_point_read_only.h" #include "third_party/blink/renderer/modules/webgl/webgl2_rendering_context.h" #include "third_party/blink/renderer/modules/webgl/webgl_rendering_context.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "ui/gfx/geometry/transform.h" namespace blink { @@ -217,6 +218,9 @@ } else if (RuntimeEnabledFeatures::WebXRLayersEnabled(context) && feature_string == "layers") { return device::mojom::XRSessionFeature::LAYERS; + } else if (RuntimeEnabledFeatures::WebXRFrontFacingEnabled(context) && + feature_string == "front-facing") { + return device::mojom::XRSessionFeature::FRONT_FACING; } return absl::nullopt; @@ -256,6 +260,8 @@ return "secondary-views"; case device::mojom::XRSessionFeature::LAYERS: return "layers"; + case device::mojom::XRSessionFeature::FRONT_FACING: + return "front-facing"; } return "";
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 3509513..5b82a79 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1148,7 +1148,7 @@ "graphics/video_frame_sink_bundle.h", "graphics/video_frame_submitter.cc", "graphics/video_frame_submitter.h", - "graphics/view_transition_shared_element_id.h", + "graphics/view_transition_element_id.h", "graphics/viz_util.cc", "graphics/viz_util.h", "graphics/web_graphics_context_3d_provider_util.cc",
diff --git a/third_party/blink/renderer/platform/graphics/color.cc b/third_party/blink/renderer/platform/graphics/color.cc index d62071ddd..0fc68fa 100644 --- a/third_party/blink/renderer/platform/graphics/color.cc +++ b/third_party/blink/renderer/platform/graphics/color.cc
@@ -249,7 +249,6 @@ DCHECK(value1 >= 0.0f && value1 < 360.0f) << value1; DCHECK(value2 >= 0.0f && value2 < 360.0f) << value2; DCHECK(percentage >= 0.0f && percentage <= 1.0f); - percentage = 1.0f - percentage; // Adapt values of angles if needed, depending on the hue_method. switch (hue_method) { case Color::HueInterpolationMethod::kShorter: { @@ -283,7 +282,7 @@ DCHECK(-360.0f < value2 - value1 && value2 - value1 <= 0.f); break; } - return AngleToUnitCircleDegrees(blink::Blend(value2, value1, percentage)); + return AngleToUnitCircleDegrees(blink::Blend(value1, value2, percentage)); } // static @@ -353,15 +352,21 @@ color2.param0_, color2.param0_is_none_) : (interpolation_space == ColorInterpolationSpace::kHSL || interpolation_space == ColorInterpolationSpace::kHWB) - ? HueInterpolation(color2.param0_, color1.param0_, percentage, - hue_method.value()) - : blink::Blend(color2.param0_, color1.param0_, percentage); + // TODO(aaronhk): Historically we store hue in the range [0, 6] for + // hsl and hwb. This is so that primary and secondary colors are + // integers. With the addition of lch and oklch, this makes less + // sense. We should transform these to degrees [0, 360] which is + // what HueInterpolation() relies on. + ? HueInterpolation(color1.param0_ * 60.f, color2.param0_ * 60.f, + percentage, hue_method.value()) / + 60.f + : blink::Blend(color1.param0_, color2.param0_, percentage); absl::optional<float> param1 = (color1.param1_is_none_ || color2.param1_is_none_) ? HandleNoneInterpolation(color1.param1_, color1.param1_is_none_, color2.param1_, color2.param1_is_none_) - : blink::Blend(color2.param1_, color1.param1_, percentage); + : blink::Blend(color1.param1_, color2.param1_, percentage); absl::optional<float> param2 = (color1.param2_is_none_ || color2.param2_is_none_) @@ -369,15 +374,15 @@ color2.param2_, color2.param2_is_none_) : (interpolation_space == ColorInterpolationSpace::kLch || interpolation_space == ColorInterpolationSpace::kOklch) - ? HueInterpolation(color2.param2_, color1.param2_, percentage, + ? HueInterpolation(color1.param2_, color2.param2_, percentage, hue_method.value()) - : blink::Blend(color2.param2_, color1.param2_, percentage); + : blink::Blend(color1.param2_, color2.param2_, percentage); absl::optional<float> alpha = (color1.alpha_is_none_ && color2.alpha_is_none_) ? HandleNoneInterpolation(alpha1.value(), color1.alpha_is_none_, alpha2.value(), color2.alpha_is_none_) - : blink::Blend(alpha2.value(), alpha1.value(), percentage); + : blink::Blend(alpha1.value(), alpha2.value(), percentage); Color result; ColorSpace result_color_space =
diff --git a/third_party/blink/renderer/platform/graphics/color_test.cc b/third_party/blink/renderer/platform/graphics/color_test.cc index ef88b70f..be92a71 100644 --- a/third_party/blink/renderer/platform/graphics/color_test.cc +++ b/third_party/blink/renderer/platform/graphics/color_test.cc
@@ -46,7 +46,7 @@ absl::optional<Color::HueInterpolationMethod> hue_method; Color color_left; Color color_right; - float percentage_left; + float percentage_right; float alpha_multiplier; Color color_expected; }; @@ -66,9 +66,8 @@ /*percentage =*/0.5f, /*alpha_multiplier=*/1.0f, CreateSRGBColor(0.5f, 0.5f, 0.0f, 1.0f)}, {Color::ColorInterpolationSpace::kSRGB, absl::nullopt, - Color::FromColorSpace(Color::ColorSpace::kRec2020, - 0.7919771358198009f, 0.23097568481079767f, - 0.07376147493817597f, 1.0f), + Color::FromColorSpace(Color::ColorSpace::kRec2020, 0.7919771358198009f, + 0.23097568481079767f, 0.07376147493817597f, 1.0f), Color::FromColorSpace(Color::ColorSpace::kLab, 87.81853633115202f, -79.27108223854806f, 80.99459785152247f, 1.0f), /*percentage =*/0.5f, /*alpha_multiplier=*/1.0f, @@ -76,19 +75,19 @@ {Color::ColorInterpolationSpace::kSRGB, absl::nullopt, CreateSRGBColor(1.0f, 0.0f, 0.0f, 1.0f), CreateSRGBColor(0.0f, 1.0f, 0.0f, 1.0f), - /*percentage =*/0.75f, /*alpha_multiplier=*/0.5f, + /*percentage =*/0.25f, /*alpha_multiplier=*/0.5f, CreateSRGBColor(0.75f, 0.25f, 0.0f, 0.5f)}, // Value obtained form the spec https://www.w3.org/TR/css-color-5/. {Color::ColorInterpolationSpace::kSRGB, absl::nullopt, CreateSRGBColor(1.0f, 0.0f, 0.0f, 0.7f), CreateSRGBColor(0.0f, 1.0f, 0.0f, 0.2f), - /*percentage =*/0.25f, /*alpha_multiplier=*/1.0f, + /*percentage =*/0.75f, /*alpha_multiplier=*/1.0f, CreateSRGBColor(0.53846f, 0.46154f, 0.0f, 0.325f)}}; for (auto& color_mix_test : color_mix_tests) { Color result = Color::FromColorMix( color_mix_test.mix_space, color_mix_test.hue_method, color_mix_test.color_left, color_mix_test.color_right, - color_mix_test.percentage_left, color_mix_test.alpha_multiplier); + color_mix_test.percentage_right, color_mix_test.alpha_multiplier); EXPECT_EQ( result.GetColorSpace(), Color::ColorInterpolationSpaceToColorSpace(color_mix_test.mix_space));
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc index 7049902..c8704dde 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
@@ -735,8 +735,8 @@ if (layer.subtree_property_changed()) root_layer_->SetNeedsCommit(); - auto shared_element_id = layer.ViewTransitionResourceId(); - if (shared_element_id.IsValid()) { + auto transition_resource_id = layer.ViewTransitionResourceId(); + if (transition_resource_id.IsValid()) { host->property_trees() ->effect_tree_mutable() .AddTransitionPseudoElementEffectId(effect_id);
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc index c28545c..647a8d7 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc
@@ -593,17 +593,13 @@ // Apply effects. result_.StartPaint(); if (!has_filter) { - // TODO(ajuma): This should really be rounding instead of flooring the - // alpha value, but that breaks slimming paint reftests. - auto alpha = base::ClampFloor<uint8_t>(255 * effect.Opacity()); if (has_other_effects) { cc::PaintFlags flags; flags.setBlendMode(effect.BlendMode()); - flags.setAlphaf(alpha / 255.0f); + flags.setAlphaf(effect.Opacity()); save_layer_id = push<cc::SaveLayerOp>(flags); } else { - save_layer_id = - push<cc::SaveLayerAlphaOp>(static_cast<float>(alpha / 255.0f)); + save_layer_id = push<cc::SaveLayerAlphaOp>(effect.Opacity()); } } else { // Handle filter effect.
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 745407c2..99cb93ba 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
@@ -124,10 +124,10 @@ EXPECT_THAT( output, ElementsAre(PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 90, 90), - 127 / 255.f)), // <e1> - PaintOpIs<cc::DrawRecordOp>(), // <p0/> - PaintOpIs<cc::DrawRecordOp>(), // <p1/> - PaintOpIs<cc::RestoreOp>())); // </e1> + 0.5f)), // <e1> + PaintOpIs<cc::DrawRecordOp>(), // <p0/> + PaintOpIs<cc::DrawRecordOp>(), // <p1/> + PaintOpIs<cc::RestoreOp>())); // </e1> } TEST_P(PaintChunksToCcLayerTest, EffectGroupingNested) { @@ -145,16 +145,16 @@ output, ElementsAre( PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 444, 666), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e2> - PaintOpIs<cc::DrawRecordOp>(), // <p0/> - PaintOpIs<cc::RestoreOp>(), // </e2> + 0.5f)), // <e2> + PaintOpIs<cc::DrawRecordOp>(), // <p0/> + PaintOpIs<cc::RestoreOp>(), // </e2> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(111, 222, 333, 444), - 127 / 255.f)), // <e3> - PaintOpIs<cc::DrawRecordOp>(), // <p1/> - PaintOpIs<cc::RestoreOp>(), // </e3> - PaintOpIs<cc::RestoreOp>())); // </e1> + 0.5f)), // <e3> + PaintOpIs<cc::DrawRecordOp>(), // <p1/> + PaintOpIs<cc::RestoreOp>(), // </e3> + PaintOpIs<cc::RestoreOp>())); // </e1> } TEST_P(PaintChunksToCcLayerTest, EffectFilterGroupingNestedWithTransforms) { @@ -184,8 +184,8 @@ gfx::TransformToSkM44(t1->Matrix() * t2->Matrix()))), // <t1*t2> // chunk1.bounds + e2(t2^-1(chunk2.bounds)) PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 155, 155), - 127 / 255.f)), // <e1> - PaintOpIs<cc::DrawRecordOp>(), // <p1/> + 0.5f)), // <e1> + PaintOpIs<cc::DrawRecordOp>(), // <p1/> // t2^-1(chunk2.bounds) PaintOpEq(cc::SaveLayerOp(SkRect::MakeXYWH(70, 70, 70, 70), expected_flags)), // <e2> @@ -231,14 +231,14 @@ PaintOpIs<cc::DrawRecordOp>(), // <p1/> PaintOpIs<cc::RestoreOp>(), // </c3> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 90, 90), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpIs<cc::SaveOp>(), PaintOpIs<cc::ClipRectOp>(), // <c3+c4> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 50, 50), - 127 / 255.f)), // <e2> - PaintOpIs<cc::DrawRecordOp>(), // <p2/> - PaintOpIs<cc::RestoreOp>(), // </e2> - PaintOpIs<cc::RestoreOp>(), // </c3+c4> + 0.5f)), // <e2> + PaintOpIs<cc::DrawRecordOp>(), // <p2/> + PaintOpIs<cc::RestoreOp>(), // </e2> + PaintOpIs<cc::RestoreOp>(), // </c3+c4> PaintOpIs<cc::SaveOp>(), PaintOpIs<cc::ClipRectOp>(), // <c3> PaintOpIs<cc::DrawRecordOp>(), // <p3/> @@ -296,7 +296,7 @@ PaintOpIs<cc::SaveOp>(), PaintOpEq(cc::ConcatOp(gfx::TransformToSkM44(t1->Matrix()))), // <t1> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpIs<cc::SaveOp>(), PaintOpEq(cc::ConcatOp(gfx::TransformToSkM44( t1->Matrix().GetCheckedInverse()))), // <t1^-1> @@ -388,7 +388,7 @@ chunks.Build(), PropertyTreeState(t0(), *c1, e0())); EXPECT_THAT(output, ElementsAre(PaintOpEq(cc::SaveLayerAlphaOp( SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpIs<cc::SaveOp>(), PaintOpIs<cc::ClipRectOp>(), // <c2> PaintOpIs<cc::DrawRecordOp>(), // <p0/> @@ -411,9 +411,9 @@ output, ElementsAre( PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpEq(cc::SaveLayerAlphaOp(SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e2> + 0.5f)), // <e2> PaintOpIs<cc::SaveOp>(), PaintOpIs<cc::ClipRectOp>(), // <c1> PaintOpIs<cc::DrawRecordOp>(), // <p0/> @@ -435,7 +435,7 @@ chunks.Build(), PropertyTreeState(t0(), c0(), *e1)); EXPECT_THAT(output, ElementsAre(PaintOpEq(cc::SaveLayerAlphaOp( SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e2> + 0.5f)), // <e2> PaintOpIs<cc::SaveOp>(), PaintOpIs<cc::ClipRectOp>(), // <c1> PaintOpIs<cc::DrawRecordOp>(), // <p0/> @@ -456,7 +456,7 @@ chunks.Build(), PropertyTreeState(t0(), *c1, *e1)); EXPECT_THAT(output, ElementsAre(PaintOpEq(cc::SaveLayerAlphaOp( SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e2> + 0.5f)), // <e2> PaintOpIs<cc::DrawRecordOp>(), // <p0/> PaintOpIs<cc::RestoreOp>())); // </e2> } @@ -566,7 +566,7 @@ EXPECT_THAT(output, ElementsAre(PaintOpEq(cc::SaveLayerAlphaOp( SkRect::MakeXYWH(0, 0, 100, 100), - 127 / 255.f)), // <e1> + 0.5f)), // <e1> PaintOpIs<cc::RestoreOp>() // </e1> )); }
diff --git a/third_party/blink/renderer/platform/graphics/compositing_reasons.cc b/third_party/blink/renderer/platform/graphics/compositing_reasons.cc index c7d55aa5..6175bbda 100644 --- a/third_party/blink/renderer/platform/graphics/compositing_reasons.cc +++ b/third_party/blink/renderer/platform/graphics/compositing_reasons.cc
@@ -115,8 +115,7 @@ "Ancestor in same 3D rendering context has a hidden backface"}, {CompositingReason::kTransform3DSceneLeaf, "Transform3DSceneLeaf", "Leaf of a 3D scene, for flattening its descendants into that scene"}, - {CompositingReason::kViewTransitionSharedElement, - "ViewTransitionSharedElement", + {CompositingReason::kViewTransitionElement, "ViewTransitionElement", "This element is shared during view transition"}, {CompositingReason::kViewTransitionPseudoElement, "ViewTransitionContentElement",
diff --git a/third_party/blink/renderer/platform/graphics/compositing_reasons.h b/third_party/blink/renderer/platform/graphics/compositing_reasons.h index eb910c3..c21c1fa 100644 --- a/third_party/blink/renderer/platform/graphics/compositing_reasons.h +++ b/third_party/blink/renderer/platform/graphics/compositing_reasons.h
@@ -85,9 +85,9 @@ /* Link highlight, frame overlay, etc. */ \ V(LayerForOther) \ \ - /* ViewTransition shared element. \ + /* ViewTransition element. \ See third_party/blink/renderer/core/view_transition/README.md. */ \ - V(ViewTransitionSharedElement) + V(ViewTransitionElement) class PLATFORM_EXPORT CompositingReason { DISALLOW_NEW();
diff --git a/third_party/blink/renderer/platform/graphics/compositor_element_id.h b/third_party/blink/renderer/platform/graphics/compositor_element_id.h index 906c70c..5c8ddf3 100644 --- a/third_party/blink/renderer/platform/graphics/compositor_element_id.h +++ b/third_party/blink/renderer/platform/graphics/compositor_element_id.h
@@ -29,7 +29,7 @@ kTranslateTransform, kVerticalScrollbar, kHorizontalScrollbar, - kSharedElementTransition, + kViewTransitionElement, kDOMNodeId, // The following values are for internal usage only. kMax = kDOMNodeId,
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item.h b/third_party/blink/renderer/platform/graphics/paint/display_item.h index 9b11a08..f5e0bb9 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/display_item.h
@@ -376,7 +376,7 @@ : GenericHashTraits<blink::DisplayItem::Id::HashKey> { using Key = blink::DisplayItem::Id::HashKey; static constexpr bool kEmptyValueIsZero = true; - static void ConstructDeletedValue(Key& slot, bool) { + static void ConstructDeletedValue(Key& slot) { const_cast<wtf_size_t&>(slot.fragment) = kNotFound; } static bool IsDeletedValue(const Key& id) { return id.fragment == kNotFound; }
diff --git a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc index 23506a11..e54a6d4 100644 --- a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc +++ b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.cc
@@ -35,8 +35,7 @@ const AnimationState& animation_state) const { if (local_transform_space != other.local_transform_space || output_clip != other.output_clip || blend_mode != other.blend_mode || - view_transition_shared_element_id != - other.view_transition_shared_element_id || + view_transition_element_id != other.view_transition_element_id || view_transition_element_resource_id != other.view_transition_element_resource_id) { return PaintPropertyChangeType::kChangedOnlyValues;
diff --git a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h index 18ded5e7..42a4f0a 100644 --- a/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h +++ b/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/platform/graphics/compositor_filter_operations.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_property_node.h" #include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h" -#include "third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h" +#include "third_party/blink/renderer/platform/graphics/view_transition_element_id.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/rrect_f.h" @@ -114,12 +114,12 @@ CompositingReasons direct_compositing_reasons = CompositingReason::kNone; CompositorElementId compositor_element_id; - // An identifier for a view transition shared element. `id.valid()` - // returns true if this has been set, and false otherwise. - ViewTransitionElementId view_transition_shared_element_id; + // An identifier for a view transition element. `id.valid()` returns true if + // this has been set, and false otherwise. + ViewTransitionElementId view_transition_element_id; - // An identifier to tag shared element resources generated and cached in the - // Viz process. This generated resource can be used as content for other + // An identifier to tag transition element resources generated and cached in + // the Viz process. This generated resource can be used as content for other // elements. viz::ViewTransitionElementResourceId view_transition_element_resource_id; @@ -306,7 +306,7 @@ } const blink::ViewTransitionElementId& ViewTransitionElementId() const { - return state_.view_transition_shared_element_id; + return state_.view_transition_element_id; } const viz::ViewTransitionElementResourceId& ViewTransitionElementResourceId()
diff --git a/third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h b/third_party/blink/renderer/platform/graphics/view_transition_element_id.h similarity index 73% rename from third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h rename to third_party/blink/renderer/platform/graphics/view_transition_element_id.h index 9d49b50..ff750f1b 100644 --- a/third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h +++ b/third_party/blink/renderer/platform/graphics/view_transition_element_id.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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_ELEMENT_ID_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_ELEMENT_ID_H_ -#include "cc/view_transition/view_transition_shared_element_id.h" +#include "cc/view_transition/view_transition_element_id.h" namespace blink { @@ -13,4 +13,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_SHARED_ELEMENT_ID_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_VIEW_TRANSITION_ELEMENT_ID_H_
diff --git a/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h b/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h index 5c822536e..16a6ae9 100644 --- a/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h +++ b/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h
@@ -236,7 +236,7 @@ sizeof(Value); for (size_t i = 0; i < length; ++i) { internal::ConcurrentBucket<Value> concurrent_bucket( - array[i], Extractor::ExtractSafe); + array[i], Extractor::ExtractKeyToMemory); if (!WTF::IsHashTraitsEmptyOrDeletedValue<typename Table::KeyTraitsType>( *concurrent_bucket.key())) { blink::TraceCollectionIfEnabled<
diff --git a/third_party/blink/renderer/platform/heap/member.h b/third_party/blink/renderer/platform/heap/member.h index 4464b6b..9889627 100644 --- a/third_party/blink/renderer/platform/heap/member.h +++ b/third_party/blink/renderer/platform/heap/member.h
@@ -115,7 +115,7 @@ storage = value; } - static void ConstructDeletedValue(MemberType& slot, bool) { + static void ConstructDeletedValue(MemberType& slot) { slot = cppgc::kSentinelPointer; }
diff --git a/third_party/blink/renderer/platform/heap/persistent.h b/third_party/blink/renderer/platform/heap/persistent.h index aadba9a..6f9d5616f 100644 --- a/third_party/blink/renderer/platform/heap/persistent.h +++ b/third_party/blink/renderer/platform/heap/persistent.h
@@ -117,7 +117,7 @@ static PeekOutType Peek(const PersistentType& value) { return value; } - static void ConstructDeletedValue(PersistentType& slot, bool) { + static void ConstructDeletedValue(PersistentType& slot) { new (&slot) PersistentType(cppgc::kSentinelPointer); }
diff --git a/third_party/blink/renderer/platform/loader/fetch/preload_key.h b/third_party/blink/renderer/platform/loader/fetch/preload_key.h index e31a48b3..ac0adad 100644 --- a/third_party/blink/renderer/platform/loader/fetch/preload_key.h +++ b/third_party/blink/renderer/platform/loader/fetch/preload_key.h
@@ -57,8 +57,8 @@ return HashTraits<blink::KURL>::IsDeletedValue(value.url); } - static void ConstructDeletedValue(blink::PreloadKey& slot, bool zero_value) { - HashTraits<blink::KURL>::ConstructDeletedValue(slot.url, zero_value); + static void ConstructDeletedValue(blink::PreloadKey& slot) { + HashTraits<blink::KURL>::ConstructDeletedValue(slot.url); } };
diff --git a/third_party/blink/renderer/platform/network/blink_schemeful_site.h b/third_party/blink/renderer/platform/network/blink_schemeful_site.h index 1a1849db..bc3d887fd 100644 --- a/third_party/blink/renderer/platform/network/blink_schemeful_site.h +++ b/third_party/blink/renderer/platform/network/blink_schemeful_site.h
@@ -142,10 +142,9 @@ IsDeletedValue(value.site_as_origin_); } - static void ConstructDeletedValue(blink::BlinkSchemefulSite& slot, - bool zero_value) { + static void ConstructDeletedValue(blink::BlinkSchemefulSite& slot) { HashTraits<scoped_refptr<const blink::SecurityOrigin>>:: - ConstructDeletedValue(slot.site_as_origin_, zero_value); + ConstructDeletedValue(slot.site_as_origin_); } };
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index a141fd8d..219b8d5 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1287,6 +1287,7 @@ name: "FedCmUserInfo", depends_on: ["FedCm"], public: true, + status: "test", }, { name: "FencedFrames", @@ -3308,6 +3309,12 @@ base_feature: "WebXREnabledFeatures", }, { + name: "WebXRFrontFacing", + depends_on: ["WebXR"], + public: true, + status: "experimental", + }, + { name: "WebXRHandInput", depends_on: ["WebXR"], public: true, @@ -3354,7 +3361,7 @@ // permission. See crbug.com/1328581 { name: "WindowManagementPermissionAlias", - status: "experimental", + status: "stable", base_feature: "WindowManagementPermissionAlias", }, // Allows sites to request fullscreen when the set of screens change.
diff --git a/third_party/blink/renderer/platform/weborigin/kurl_hash.h b/third_party/blink/renderer/platform/weborigin/kurl_hash.h index 8175df2..bec443e 100644 --- a/third_party/blink/renderer/platform/weborigin/kurl_hash.h +++ b/third_party/blink/renderer/platform/weborigin/kurl_hash.h
@@ -53,8 +53,8 @@ return HashTraits<String>::IsDeletedValue(value.GetString()); } - static void ConstructDeletedValue(blink::KURL& slot, bool zero_value) { - HashTraits<String>::ConstructDeletedValue(slot.string_, zero_value); + static void ConstructDeletedValue(blink::KURL& slot) { + HashTraits<String>::ConstructDeletedValue(slot.string_); } };
diff --git a/third_party/blink/renderer/platform/wtf/hash_map.h b/third_party/blink/renderer/platform/wtf/hash_map.h index 19fc5f85..124e8552 100644 --- a/third_party/blink/renderer/platform/wtf/hash_map.h +++ b/third_party/blink/renderer/platform/wtf/hash_map.h
@@ -26,6 +26,7 @@ #include "base/numerics/safe_conversions.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator/partition_allocator.h" +#include "third_party/blink/renderer/platform/wtf/atomic_operations.h" #include "third_party/blink/renderer/platform/wtf/construct_traits.h" #include "third_party/blink/renderer/platform/wtf/hash_table.h" @@ -37,18 +38,31 @@ template <typename Value, typename Traits, typename Allocator> class HashCountedSet; -struct KeyValuePairKeyExtractor { - STATIC_ONLY(KeyValuePairKeyExtractor); +struct KeyValuePairExtractor { + STATIC_ONLY(KeyValuePairExtractor); template <typename T> - static const typename T::KeyType& Extract(const T& p) { + static const typename T::KeyType& ExtractKey(const T& p) { + return p.key; + } + template <typename T> + static typename T::KeyType& ExtractKey(T& p) { return p.key; } // Assumes out points to a buffer of size at least sizeof(T::KeyType). template <typename T> - static void ExtractSafe(const T& p, void* out) { + static void ExtractKeyToMemory(const T& p, void* out) { AtomicReadMemcpy<sizeof(typename T::KeyType), alignof(typename T::KeyType)>( out, &p.key); } + template <typename T> + static void ClearValue(T& p) { + using ValueType = typename T::ValueType; + if (IsTraceable<ValueType>::value) { + AtomicMemzero<sizeof(ValueType), alignof(ValueType)>(&p.value); + } else { + memset(static_cast<void*>(&p.value), 0, sizeof(p.value)); + } + } }; // Note: empty or deleted key values are not allowed, using them may lead to @@ -82,7 +96,7 @@ typedef HashTable<KeyType, ValueType, - KeyValuePairKeyExtractor, + KeyValuePairExtractor, ValueTraits, KeyTraits, Allocator>
diff --git a/third_party/blink/renderer/platform/wtf/hash_set.h b/third_party/blink/renderer/platform/wtf/hash_set.h index fb6b9a8..cd541ef 100644 --- a/third_party/blink/renderer/platform/wtf/hash_set.h +++ b/third_party/blink/renderer/platform/wtf/hash_set.h
@@ -155,14 +155,20 @@ struct IdentityExtractor { STATIC_ONLY(IdentityExtractor); template <typename T> - static const T& Extract(const T& t) { + static const T& ExtractKey(const T& t) { + return t; + } + template <typename T> + static T& ExtractKey(T& t) { return t; } // Assumes out points to a buffer of size at least sizeof(T). template <typename T> - static void ExtractSafe(const T& t, void* out) { + static void ExtractKeyToMemory(const T& t, void* out) { AtomicReadMemcpy<sizeof(T), alignof(T)>(out, &t); } + template <typename T> + static void ClearValue(const T&) {} }; template <typename Translator>
diff --git a/third_party/blink/renderer/platform/wtf/hash_table.h b/third_party/blink/renderer/platform/wtf/hash_table.h index 87f3046..447302a2 100644 --- a/third_party/blink/renderer/platform/wtf/hash_table.h +++ b/third_party/blink/renderer/platform/wtf/hash_table.h
@@ -701,7 +701,7 @@ template <typename IncomingValueType> AddResult insert(IncomingValueType&& value) { return insert<IdentityTranslatorType>( - Extractor::Extract(value), std::forward<IncomingValueType>(value)); + Extractor::ExtractKey(value), std::forward<IncomingValueType>(value)); } // A special version of insert() that finds the object by hashing and @@ -746,14 +746,14 @@ void clear(); static bool IsEmptyBucket(const ValueType& value) { - return IsHashTraitsEmptyValue<KeyTraits>(Extractor::Extract(value)); + return IsHashTraitsEmptyValue<KeyTraits>(Extractor::ExtractKey(value)); } static bool IsDeletedBucket(const ValueType& value) { - return IsHashTraitsDeletedValue<KeyTraits>(Extractor::Extract(value)); + return IsHashTraitsDeletedValue<KeyTraits>(Extractor::ExtractKey(value)); } static bool IsEmptyOrDeletedBucket(const ValueType& value) { return IsHashTraitsEmptyOrDeletedValue<KeyTraits>( - Extractor::Extract(value)); + Extractor::ExtractKey(value)); } ValueType* Lookup(KeyPeekInType key) { @@ -845,10 +845,19 @@ static void InitializeBucket(ValueType& bucket); static void ReinitializeBucket(ValueType& bucket); - static void DeleteBucket(const ValueType& bucket) { + static void DeleteBucket(ValueType& bucket) { bucket.~ValueType(); - ConstructHashTraitsDeletedValue<Traits>(const_cast<ValueType&>(bucket), - Allocator::kIsGarbageCollected); + ConstructHashTraitsDeletedValue<KeyTraits>(Extractor::ExtractKey(bucket)); + // For GC collections the memory for the backing is zeroed when it is + // allocated, and the constructors may take advantage of that, + // especially if a GC occurs during insertion of an entry into the + // table. This slot is being marked deleted, but If the slot is reused + // at a later point, the same assumptions around memory zeroing must + // hold as they did at the initial allocation. Therefore we zero the + // value part of the slot here for GC collections. + if (Allocator::kIsGarbageCollected) { + Extractor::ClearValue(bucket); + } } FullLookupType MakeLookupResult(ValueType* position, @@ -1047,8 +1056,9 @@ const ValueType* entry = table + i; if (KeyTraits::kSafeToCompareToEmptyOrDeleted) { - if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return entry; + } if (IsEmptyBucket(*entry)) return nullptr; @@ -1057,8 +1067,9 @@ return nullptr; if (!IsDeletedBucket(*entry) && - HashTranslator::Equal(Extractor::Extract(*entry), key)) + HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return entry; + } } ++probe_count; UPDATE_PROBE_COUNTS(); @@ -1098,16 +1109,18 @@ return LookupType(deleted_entry ? deleted_entry : entry, false); if (KeyTraits::kSafeToCompareToEmptyOrDeleted) { - if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return LookupType(entry, true); + } if (IsDeletedBucket(*entry)) deleted_entry = entry; } else { - if (IsDeletedBucket(*entry)) + if (IsDeletedBucket(*entry)) { deleted_entry = entry; - else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + } else if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return LookupType(entry, true); + } } ++probe_count; @@ -1148,16 +1161,18 @@ return MakeLookupResult(deleted_entry ? deleted_entry : entry, false, h); if (KeyTraits::kSafeToCompareToEmptyOrDeleted) { - if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return MakeLookupResult(entry, true, h); + } if (IsDeletedBucket(*entry)) deleted_entry = entry; } else { - if (IsDeletedBucket(*entry)) + if (IsDeletedBucket(*entry)) { deleted_entry = entry; - else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + } else if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return MakeLookupResult(entry, true, h); + } } ++probe_count; UPDATE_PROBE_COUNTS(); @@ -1322,16 +1337,18 @@ break; if (KeyTraits::kSafeToCompareToEmptyOrDeleted) { - if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return AddResult(this, entry, false); + } if (IsDeletedBucket(*entry) && can_reuse_deleted_entry) deleted_entry = entry; } else { - if (IsDeletedBucket(*entry) && can_reuse_deleted_entry) + if (IsDeletedBucket(*entry) && can_reuse_deleted_entry) { deleted_entry = entry; - else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) + } else if (HashTranslator::Equal(Extractor::ExtractKey(*entry), key)) { return AddResult(this, entry, false); + } } ++probe_count; UPDATE_PROBE_COUNTS(); @@ -1435,9 +1452,9 @@ ValueType&& entry) { DCHECK(table_); RegisterModification(); - DCHECK(!LookupForWriting(Extractor::Extract(entry)).second); - DCHECK( - !IsDeletedBucket(*(LookupForWriting(Extractor::Extract(entry)).first))); + DCHECK(!LookupForWriting(Extractor::ExtractKey(entry)).second); + DCHECK(!IsDeletedBucket( + *(LookupForWriting(Extractor::ExtractKey(entry)).first))); #if DUMP_HASHTABLE_STATS HashTableStats::instance().numReinserts.fetch_add(1, std::memory_order_relaxed); @@ -1445,7 +1462,7 @@ #if DUMP_HASHTABLE_STATS_PER_TABLE stats_->numReinserts.fetch_add(1, std::memory_order_relaxed); #endif - Value* new_entry = LookupForWriting(Extractor::Extract(entry)).first; + Value* new_entry = LookupForWriting(Extractor::ExtractKey(entry)).first; Mover<ValueType, Allocator, Traits, Traits::template NeedsToForbidGCOnMove<>::value>::Move(std::move(entry), *new_entry); @@ -1519,7 +1536,7 @@ #endif EnterAccessForbiddenScope(); - DeleteBucket(*pos); + DeleteBucket(const_cast<ValueType&>(*pos)); LeaveAccessForbiddenScope(); ++deleted_count_; --key_count_;
diff --git a/third_party/blink/renderer/platform/wtf/hash_traits.h b/third_party/blink/renderer/platform/wtf/hash_traits.h index 79e9b251..4ddd363 100644 --- a/third_party/blink/renderer/platform/wtf/hash_traits.h +++ b/third_party/blink/renderer/platform/wtf/hash_traits.h
@@ -30,7 +30,6 @@ #include <utility> #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" -#include "third_party/blink/renderer/platform/wtf/atomic_operations.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" #include "third_party/blink/renderer/platform/wtf/hash_table_deleted_value_type.h" @@ -44,15 +43,6 @@ namespace internal { -template <typename T, bool = IsTraceable<T>::value> -struct ClearMemoryAtomicallyIfNeeded { - static void Clear(T* slot) { memset(static_cast<void*>(slot), 0, sizeof(T)); } -}; -template <typename T> -struct ClearMemoryAtomicallyIfNeeded<T, true> { - static void Clear(T* slot) { AtomicMemzero<sizeof(T), alignof(T)>(slot); } -}; - template <typename T> struct GenericHashTraitsBase { STATIC_ONLY(GenericHashTraitsBase); @@ -131,11 +121,10 @@ static bool IsDeletedValue(const T& v) = delete; // Constructs a deleted value in-place in the given memory space. - // |zero_value| is true if the memory has been filled with zero. // This must be defined if IsDeletedValue() is defined, and will be called // through ConstructHashTraitsDeletedValue(). Otherwise // `slot = DeletedValue()` will be used. - static void ConstructDeletedValue(T& slot, bool zero_value) = delete; + static void ConstructDeletedValue(T& slot) = delete; // The starting table size. Can be overridden when we know beforehand that a // hash table will have at least N entries. @@ -291,7 +280,7 @@ reinterpret_cast<const void*>(-1); } - static void ConstructDeletedValue(scoped_refptr<P>& slot, bool zero_value) { + static void ConstructDeletedValue(scoped_refptr<P>& slot) { *reinterpret_cast<void**>(&slot) = reinterpret_cast<void*>(-1); } @@ -346,7 +335,7 @@ return value.get(); } - static void ConstructDeletedValue(std::unique_ptr<T>& slot, bool) { + static void ConstructDeletedValue(std::unique_ptr<T>& slot) { // Dirty trick: implant an invalid pointer to unique_ptr. Destructor isn't // called for deleted buckets, so this is okay. new (NotNullTag::kNotNull, &slot) @@ -387,7 +376,7 @@ struct NeedsToForbidGCOnMove { static constexpr bool value = false; }; - static void ConstructDeletedValue(T& slot, bool) { + static void ConstructDeletedValue(T& slot) { new (NotNullTag::kNotNull, &slot) T(kHashTableDeletedValue); } static bool IsDeletedValue(const T& value) { @@ -428,7 +417,7 @@ return value == Traits::DeletedValue(); } template <typename T> - static void ConstructDeletedValue(T& slot, bool) { + static void ConstructDeletedValue(T& slot) { slot = Traits::DeletedValue(); } }; @@ -446,8 +435,8 @@ // Traits must also define ConstructDeletedValue() if it defines // IsDeletedValue(). template <typename T> - static void ConstructDeletedValue(T& slot, bool zero_value) { - Traits::ConstructDeletedValue(slot, zero_value); + static void ConstructDeletedValue(T& slot) { + Traits::ConstructDeletedValue(slot); } }; @@ -470,9 +459,8 @@ // This function selects either the DeletedValue() function or the // ConstructDeletedValue() function to construct a deleted value. template <typename Traits, typename T> -inline void ConstructHashTraitsDeletedValue(T& slot, bool zero_value) { - internal::HashTraitsDeletedValueHelper<Traits>::ConstructDeletedValue( - slot, zero_value); +inline void ConstructHashTraitsDeletedValue(T& slot) { + internal::HashTraitsDeletedValueHelper<Traits>::ConstructDeletedValue(slot); } template <typename Traits, typename T> @@ -519,19 +507,8 @@ static constexpr unsigned kMinimumTableSize = FirstTraits::kMinimumTableSize; - static void ConstructDeletedValue(TraitType& slot, bool zero_value) { - ConstructHashTraitsDeletedValue<FirstTraits>(slot.*first_field, zero_value); - // For GC collections the memory for the backing is zeroed when it is - // allocated, and the constructors may take advantage of that, - // especially if a GC occurs during insertion of an entry into the - // table. This slot is being marked deleted, but If the slot is reused - // at a later point, the same assumptions around memory zeroing must - // hold as they did at the initial allocation. Therefore we zero the - // value part of the slot here for GC collections. - if (zero_value) { - internal::ClearMemoryAtomicallyIfNeeded< - typename SecondTraits::TraitType>::Clear(&(slot.*second_field)); - } + static void ConstructDeletedValue(TraitType& slot) { + ConstructHashTraitsDeletedValue<FirstTraits>(slot.*first_field); } static bool IsDeletedValue(const TraitType& value) { return IsHashTraitsDeletedValue<FirstTraits>(value.*first_field); @@ -583,6 +560,7 @@ template <typename KeyTypeArg, typename ValueTypeArg> struct KeyValuePair { typedef KeyTypeArg KeyType; + typedef ValueTypeArg ValueType; template <typename IncomingKeyType, typename IncomingValueType> KeyValuePair(IncomingKeyType&& key, IncomingValueType&& value)
diff --git a/third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h b/third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h index 4b9907b..f0a3e28 100644 --- a/third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h +++ b/third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h
@@ -56,8 +56,8 @@ return HashTraits<String>::IsDeletedValue(value.string_); } - static void ConstructDeletedValue(AtomicString& slot, bool zero_value) { - HashTraits<String>::ConstructDeletedValue(slot.string_, zero_value); + static void ConstructDeletedValue(AtomicString& slot) { + HashTraits<String>::ConstructDeletedValue(slot.string_); } };
diff --git a/third_party/blink/renderer/platform/wtf/text/string_hash.h b/third_party/blink/renderer/platform/wtf/text/string_hash.h index bbe0216..e6c3c67 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_hash.h +++ b/third_party/blink/renderer/platform/wtf/text/string_hash.h
@@ -68,9 +68,8 @@ static bool IsDeletedValue(const String& s) { return HashTraits<scoped_refptr<StringImpl>>::IsDeletedValue(s.impl_); } - static void ConstructDeletedValue(String& slot, bool zero_value) { - HashTraits<scoped_refptr<StringImpl>>::ConstructDeletedValue(slot.impl_, - zero_value); + static void ConstructDeletedValue(String& slot) { + HashTraits<scoped_refptr<StringImpl>>::ConstructDeletedValue(slot.impl_); } };
diff --git a/third_party/blink/renderer/platform/wtf/wtf_test_helper.h b/third_party/blink/renderer/platform/wtf/wtf_test_helper.h index 49221fd..b7a1ad1b 100644 --- a/third_party/blink/renderer/platform/wtf/wtf_test_helper.h +++ b/third_party/blink/renderer/platform/wtf/wtf_test_helper.h
@@ -94,7 +94,7 @@ static bool IsEmptyValue(const MoveOnlyHashValue& value) { return value.Value() == MoveOnlyHashValue::kEmpty; } - static void ConstructDeletedValue(MoveOnlyHashValue& slot, bool) { + static void ConstructDeletedValue(MoveOnlyHashValue& slot) { slot = MoveOnlyHashValue(MoveOnlyHashValue::kDeleted); } static bool IsDeletedValue(const MoveOnlyHashValue& value) { @@ -139,7 +139,7 @@ struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { static const bool kEmptyValueIsZero = false; static bool IsEmptyValue(const CountCopy& value) { return !value.Counter(); } - static void ConstructDeletedValue(CountCopy& slot, bool) { + static void ConstructDeletedValue(CountCopy& slot) { slot = CountCopy(CountCopy::kDeletedValue); } static bool IsDeletedValue(const CountCopy& value) { @@ -201,7 +201,7 @@ static bool IsEmptyValue(const ValueInstanceCount<T>& value) { return !value.Counter(); } - static void ConstructDeletedValue(ValueInstanceCount<T>& slot, bool) { + static void ConstructDeletedValue(ValueInstanceCount<T>& slot) { slot = ValueInstanceCount<T>(ValueInstanceCount<T>::kDeletedValue); } static bool IsDeletedValue(const ValueInstanceCount<T>& value) {
diff --git a/third_party/blink/tools/BUILD.gn b/third_party/blink/tools/BUILD.gn index 55e419ac..19aefd6c 100644 --- a/third_party/blink/tools/BUILD.gn +++ b/third_party/blink/tools/BUILD.gn
@@ -26,6 +26,9 @@ # The web_tests/wpt_internal directory contains internal WPTs "//third_party/blink/web_tests/wpt_internal/", + # Chromium-specific automation. + "//third_party/blink/web_tests/resources/testdriver-vendor.js", + # Configuration files "//third_party/blink/web_tests/wptrunner.blink.ini", "//third_party/blink/web_tests/FlagSpecificConfig",
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 1d77544..a557739 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
@@ -1718,7 +1718,7 @@ }, { 'paths': [ - 'third_party/blink/renderer/platform/graphics/view_transition_shared_element_id.h' + 'third_party/blink/renderer/platform/graphics/view_transition_element_id.h' ], 'allowed': ['cc::ViewTransitionElementId'], },
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index f19268c..f5bcf1c 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2308,9 +2308,6 @@ crbug.com/876485 fast/performance/performance-measure-null-exception.html [ Failure ] -# image-set() does not yet support URLs without the url function notation -crbug.com/1400901 external/wpt/css/css-images/image-set/image-set-no-url-rendering.html [ Failure ] - # image-set() does not yet support gradient images crbug.com/1400902 external/wpt/css/css-images/image-set/image-set-linear-gradient-rendering.html [ Failure ] crbug.com/1400902 external/wpt/css/css-images/image-set/image-set-radial-gradient-rendering.html [ Failure ]
diff --git a/third_party/blink/web_tests/css3/blending/background-blend-mode-tiled-gradient-expected.png b/third_party/blink/web_tests/css3/blending/background-blend-mode-tiled-gradient-expected.png index 29395ca..5bb1019 100644 --- a/third_party/blink/web_tests/css3/blending/background-blend-mode-tiled-gradient-expected.png +++ b/third_party/blink/web_tests/css3/blending/background-blend-mode-tiled-gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/css3/blending/effect-background-blend-mode-stacking-expected.png b/third_party/blink/web_tests/css3/blending/effect-background-blend-mode-stacking-expected.png index b78828a..e8f3a8b 100644 --- a/third_party/blink/web_tests/css3/blending/effect-background-blend-mode-stacking-expected.png +++ b/third_party/blink/web_tests/css3/blending/effect-background-blend-mode-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/css3/blending/svg-blend-multiply-alpha-expected.png b/third_party/blink/web_tests/css3/blending/svg-blend-multiply-alpha-expected.png index 6cc28101..a9b6217 100644 --- a/third_party/blink/web_tests/css3/blending/svg-blend-multiply-alpha-expected.png +++ b/third_party/blink/web_tests/css3/blending/svg-blend-multiply-alpha-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/css3/filters/css-opacity-with-drop-shadow-expected.png b/third_party/blink/web_tests/css3/filters/css-opacity-with-drop-shadow-expected.png index 040a92b4..28b6a05 100644 --- a/third_party/blink/web_tests/css3/filters/css-opacity-with-drop-shadow-expected.png +++ b/third_party/blink/web_tests/css3/filters/css-opacity-with-drop-shadow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index 7a6a2efa..6f3ca65 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -220031,7 +220031,7 @@ }, "css-view-transitions": { "3d-transform-incoming.html": [ - "d852108ffa484553ba3d8ed63141df7d751b7ba2", + "0a0497122b185d4ac8d36bd190133c134be8ebb3", [ null, [ @@ -220064,7 +220064,7 @@ ] ], "3d-transform-outgoing.html": [ - "3cb29527c40df8f638ae32712044f39b2c1c098b", + "5cf83e4e672de425087ec0679342b162f89c5559", [ null, [ @@ -220130,7 +220130,7 @@ ] ], "content-smaller-than-box-size.html": [ - "8cd5bc412dcb239bcf04f8b4bb7ef26f1385f8ae", + "d2b8f63ca068ffc744b7b1a7b0ca8d1c25a32854", [ null, [ @@ -220143,7 +220143,7 @@ ] ], "content-visibility-auto-shared-element.html": [ - "b678f485f69f7e5ad3a79f7665f6189f5dc0c63e", + "11b4957fbcca7d1ceb8b151741eba1b86cb5708e", [ null, [ @@ -220156,7 +220156,7 @@ ] ], "content-with-clip-max-texture-size.html": [ - "b1c96382810fa9f61ad8cea3d2d1c003506975f3", + "376ecb6c9b72a2529ac4bd208c9595819182ab4e", [ null, [ @@ -220185,7 +220185,7 @@ ] ], "content-with-clip-root.html": [ - "805610bb078828ba79cf56ed4f1eba7925a57ca2", + "5acd847734db222b50ec2aeef1133e929c132b2d", [ null, [ @@ -220198,7 +220198,7 @@ ] ], "content-with-clip.html": [ - "7354125b303de498d52e45690140ea4cec7f7edf", + "c477540957007622247c1f3d04a636b5a2a927b0", [ null, [ @@ -220211,7 +220211,7 @@ ] ], "content-with-inline-child.html": [ - "6bae020b8d9ff8153ed903417c7c691f0a3ad7a1", + "f1a5ca79af6042c1b5a689617bfd1ec79b584148", [ null, [ @@ -220224,7 +220224,7 @@ ] ], "content-with-transform-new-image.html": [ - "f459742cd0ba30ff0af1c5da4781b6b1fd5f3412", + "9baf9563d19c4f5ac65eb7e1396d37d49639c592", [ null, [ @@ -220257,7 +220257,7 @@ ] ], "content-with-transform-old-image.html": [ - "a31a2745a6766fa07603fa9f23e0fbf5df21bd12", + "e3bd7fff1df5c43f64b928f5df3aedec4ce8e6c2", [ null, [ @@ -220291,7 +220291,7 @@ ] ], "css-tags-paint-order-with-entry.html": [ - "9f79ba25e0805302d579cad21f77e7ad95c01f00", + "703b64f5c68c732d42d5ffeb1bb590f3c8ebf543", [ null, [ @@ -220324,7 +220324,7 @@ ] ], "css-tags-paint-order.html": [ - "2f71a701ee9ae18e9f3a32cc090c4350646ab932", + "ee1d260e1e8d81af559df517d935354c8746f0b9", [ null, [ @@ -220337,7 +220337,7 @@ ] ], "css-tags-shared-element.html": [ - "fad0d3763de13ead6471c4e71be1e726e2e6157e", + "33bbae70fc6b918d12a17c856a3c75c1c0071ff7", [ null, [ @@ -220422,7 +220422,7 @@ ] ], "far-away-capture.html": [ - "f95ec96c7896354caefef5ef88651ffcde9df759", + "bfe0b9fb9484f5984fbea9460d40818a40ab6ddd", [ null, [ @@ -220455,7 +220455,7 @@ ] ], "hit-test-unpainted-element.html": [ - "ef4bc6613a4a50a8e1e9157df135111e3fc442bb", + "68026edfb1f99237a9e905816ef0e424b5be1500", [ null, [ @@ -220468,7 +220468,7 @@ ] ], "hit-test-unrelated-element.html": [ - "188521d5886eabfb8386e5a2bfe55028fec89484", + "dae232b74defa675ca211b3b843a990a3b5ca0c7", [ null, [ @@ -220481,7 +220481,7 @@ ] ], "iframe-transition.sub.html": [ - "914db87a9e817decb7ff3c634aaf18d017a63cff", + "93a5cbed66eb0efac3c68fbed699984556e362b4", [ null, [ @@ -220528,7 +220528,7 @@ ] ], "japanese-tag.html": [ - "6d04155813ef7a74cf637d575959e556efbeb5b9", + "976dcab4fca8f8cf17fbdedbf7af0a162036eb37", [ null, [ @@ -220541,7 +220541,7 @@ ] ], "new-and-old-sizes-match.html": [ - "b80f90fd70502523c20bb520a718dddd23ad7243", + "78efa9d82fa7591f62d855b2fe8ab80c4140f0fe", [ null, [ @@ -220574,7 +220574,7 @@ ] ], "new-content-captures-clip-path.html": [ - "85f29bad1ce80d8d1c348a83cc68ae5b224a1abf", + "4a2dfc78c2746c02ca7aae34685292fbc76aed47", [ null, [ @@ -220607,7 +220607,7 @@ ] ], "new-content-captures-different-size.html": [ - "da9983fc4629da58eef80273c2bac9c33e3288ac", + "a891dec55532d6a740a459772f65acb39136cd9b", [ null, [ @@ -220641,7 +220641,7 @@ ] ], "new-content-captures-opacity.html": [ - "02c43d724b84a8a0c6b9f3ff954c4d569afe0a7b", + "ab4efd1f42478c2fb1c78b224a564623b3197046", [ null, [ @@ -220654,7 +220654,7 @@ ] ], "new-content-captures-root.html": [ - "3b3fe71cebe15af6d6e37b847f7148faed760563", + "84e55de58a79ae2efc205ecb406cc3c4360d5fd7", [ null, [ @@ -220667,7 +220667,7 @@ ] ], "new-content-container-writing-modes.html": [ - "75149ca57d3a98a51b206a163a3c7712135620fd", + "e7ac768e17d6104d0f70cab29a891c8b08b03c8c", [ null, [ @@ -220680,7 +220680,7 @@ ] ], "new-content-element-writing-modes.html": [ - "20d81a67db7b39351763d5b738b6fa2b84ebcdf2", + "84b6fcf517e2c8ab560135919723abc4e0d8db31", [ null, [ @@ -220693,7 +220693,7 @@ ] ], "new-content-has-scrollbars.html": [ - "c21eb0e379656192ded50dd5d0b5f1f0ab469bf3", + "4024952b13ac1953d9874ad08dfcd6bf08edeadd", [ null, [ @@ -220727,7 +220727,7 @@ ] ], "new-content-intrinsic-aspect-ratio.html": [ - "924630f574f4df2ee2ea3fad017fc1ac9bc4ab82", + "53ec94122f06998a01c3b69b47d5c312e15e21d0", [ null, [ @@ -220740,7 +220740,7 @@ ] ], "new-content-is-empty-div.html": [ - "09e09dea6d066ed98d426da3f692b23958865c30", + "bacc63f1945835678628f59c229540e990e6e30e", [ null, [ @@ -220753,7 +220753,7 @@ ] ], "new-content-object-fit-fill.html": [ - "04b404de26ef07bea0caecf17d74c724fbf60add", + "286528305b8c2281e19898df92c0e449d0890458", [ null, [ @@ -220786,7 +220786,7 @@ ] ], "new-content-object-fit-none.html": [ - "eab7a0e2070febc8e8afeb40e8ab04989f4773ee", + "cad836678e94bacbfacc3cd69399ce66ddb1adfa", [ null, [ @@ -220799,7 +220799,7 @@ ] ], "new-content-object-view-box-clip-path-reference.html": [ - "8dd5774ec4e7f001f17a68e7acc6ab3b1f63ee78", + "01a3ed3204fb418947a1d89f237ef918327a394e", [ null, [ @@ -220812,7 +220812,7 @@ ] ], "new-content-object-view-box-clip-path.html": [ - "e1b6c92d2a47e9ce9424ef07a42fb437b633df19", + "dcd5fec70a1c539c65dbd665d13442f0a4725966", [ null, [ @@ -220825,7 +220825,7 @@ ] ], "new-content-object-view-box-overflow-clipped.html": [ - "f856a8943336d1325ff6a0412e90f03a9293c9ed", + "593901529f43b2daa0b02e1e1eb9c9ff0e05d2fd", [ null, [ @@ -220838,7 +220838,7 @@ ] ], "new-content-object-view-box-overflow.html": [ - "08a12c23e553ea7ae207238b0c408ffa4115e7e2", + "2bbea1e1c4c54d5e5e6281de8f14ccc4bae8aad1", [ null, [ @@ -220851,7 +220851,7 @@ ] ], "new-content-scaling.html": [ - "9fc70e39afd4e589b06c13898f4c33ec6207f89d", + "4ea3c2e04a486b74c8c92b2ca473ad9f2a2bfe44", [ null, [ @@ -220884,7 +220884,7 @@ ] ], "new-content-with-overflow-zoomed.html": [ - "1919daafa287cb7690727b1a52d007f672da32f8", + "59170ebf00349710d34c8f5fd2966352b1d23594", [ null, [ @@ -220897,7 +220897,7 @@ ] ], "new-content-with-overflow.html": [ - "2dc0185f70888a839b6664b02465407973bdf757", + "e2dc045089b024fce27e8a1ce1facacbab5ef2aa", [ null, [ @@ -220910,7 +220910,7 @@ ] ], "new-element-on-start.html": [ - "da404a6af6d149ff516859097c416308d1bf86bf", + "e3ec5463bfd3797b18831063253324fdc8fd52c7", [ null, [ @@ -220923,7 +220923,7 @@ ] ], "new-root-vertical-writing-mode.html": [ - "fc7d7de277ecff2e29785abc982b9589fecee481", + "61dc5aca172cb13abfc81b390ddfa6141a0d77be", [ null, [ @@ -220936,7 +220936,7 @@ ] ], "no-root-capture.html": [ - "7856a332970e9d7f7e1107c0d94d254eb100a860", + "9e16d1e447d9e29b639bfc8ba045fd3e6e582bfe", [ null, [ @@ -220949,7 +220949,7 @@ ] ], "nothing-captured.html": [ - "c6d45cec8fbd13101b3b6037da58bf53d6ee9221", + "468cb6e199237123e9b54183c543d3e38cb803c7", [ null, [ @@ -220962,7 +220962,7 @@ ] ], "object-view-box-new-image.html": [ - "c23e65f617a7ab79dd6ac7938450f76dad0e4957", + "3ea7eb96b688f7768d752d18eeff098e7e78fc65", [ null, [ @@ -220975,7 +220975,7 @@ ] ], "object-view-box-old-image.html": [ - "9e4e4b83fb317d99151cbb40e9e3011c001159c7", + "7f6f79ba445b94c0d1aa71aa0d5819f188c0dcd3", [ null, [ @@ -221009,7 +221009,7 @@ ] ], "old-content-captures-clip-path.html": [ - "ac6200da16b27e202adfe79dfe8b1faf9176adcd", + "a2faa7f1575af4c6ac3f65b3fb303f6dbab875d3", [ null, [ @@ -221022,7 +221022,7 @@ ] ], "old-content-captures-different-size.html": [ - "8bfa2407e5110f5014e1b9d4da61636f1d93f61d", + "a8d375f06463eef00ea8bf0d509e0137658c2a88", [ null, [ @@ -221056,7 +221056,7 @@ ] ], "old-content-captures-opacity.html": [ - "a1d976d5f5be33fb1f04d674f4b7dc5c3daa8a4d", + "ee3e3e4cde132895f9e1b4f2a1ca5dcd02710d3d", [ null, [ @@ -221089,7 +221089,7 @@ ] ], "old-content-captures-root.html": [ - "067c049818e0999bdafbb457f8e1df1834a0a897", + "96acb9f45550e9727464ff137b04107d3b07dccf", [ null, [ @@ -221122,7 +221122,7 @@ ] ], "old-content-container-writing-modes.html": [ - "2c487440ac794e138b0cbecb4328d2fc9d3f7671", + "9896c27152746f9598666455d1ffa133026ec1b0", [ null, [ @@ -221135,7 +221135,7 @@ ] ], "old-content-element-writing-modes.html": [ - "87a736d12422e1f058b8979970a6d13892250d95", + "5029c6aaaa362e47033389005ba050993100cfeb", [ null, [ @@ -221148,7 +221148,7 @@ ] ], "old-content-has-scrollbars.html": [ - "f87a4498c17e410efd1c490e3d1adaa300b9ffb5", + "781ff7c125dd524bf3c003e83a1568217852500c", [ null, [ @@ -221182,7 +221182,7 @@ ] ], "old-content-intrinsic-aspect-ratio.html": [ - "8ba2a8f31fade31b88435eb7a8a85ba26ec84a13", + "b46a77821781f857a5fc4742056b296092b1f113", [ null, [ @@ -221195,7 +221195,7 @@ ] ], "old-content-is-empty-div.html": [ - "c6a6655a78b31fb1ccae90971c8588ce678100d2", + "137060c1ddb7ad88da61593238b1b4178f158966", [ null, [ @@ -221208,7 +221208,7 @@ ] ], "old-content-object-fit-fill.html": [ - "a3f146f9fecd7823ad2bc1c2d624facd9d1fe4aa", + "9a660266baade6c1394242f44b35a02987281cf3", [ null, [ @@ -221241,7 +221241,7 @@ ] ], "old-content-object-fit-none.html": [ - "592b89949bdadc6a3f4b5740d577ce4fd93c60ad", + "115fd0611498d4b6215f379824266971e50dc2b8", [ null, [ @@ -221254,7 +221254,7 @@ ] ], "old-content-object-view-box-clip-path-reference.html": [ - "a9bbf0ff247259e9eccb1b9c3c2e20458b4a57f1", + "14a1ee83d9271555f3d85b5e4a73feeb2cf532b2", [ null, [ @@ -221287,7 +221287,7 @@ ] ], "old-content-object-view-box-clip-path.html": [ - "04d4f31670f8ea70728c1da441aa4d2af3b8e4d4", + "dff57c68f6b5f5f6cfa807df9d280d499605fc45", [ null, [ @@ -221320,7 +221320,7 @@ ] ], "old-content-object-view-box-overflow.html": [ - "e5bfee912d993f088aac695e543eeba4158e03a5", + "ff9bb4e7d2be4eb7194b3bbe9730210e105fd089", [ null, [ @@ -221333,7 +221333,7 @@ ] ], "old-content-with-overflow-zoomed.html": [ - "d78c424662a1600ef626d8b51d65096def4c9142", + "10257b761fa639410849e8982e317b38baa0161c", [ null, [ @@ -221346,7 +221346,7 @@ ] ], "old-content-with-overflow.html": [ - "3ddf818c7896646c56a504744191dc4dbbc8c154", + "6ed31d375c6f83f90253e7d4b324d81cb56f87f2", [ null, [ @@ -221359,7 +221359,7 @@ ] ], "old-root-vertical-writing-mode.html": [ - "af4fcf5bb26ebbdd98d0aeccaf88f9001224a6be", + "5f4425f64db92cecef8a9fddebd82aaa31695004", [ null, [ @@ -221372,7 +221372,7 @@ ] ], "root-captured-as-different-tag.html": [ - "a8f3493d67c4620c863406ac0a866d860ce93aed", + "4264db81699c395e9af0a693915b92069df7a93d", [ null, [ @@ -221418,7 +221418,7 @@ ] ], "root-style-change-during-animation.html": [ - "b030d38ab1a68d6172e081ebeb336222bac9972a", + "d1d291124bd6dfa57b36e24072a1be830940753f", [ null, [ @@ -221582,7 +221582,7 @@ ] ], "set-current-time.html": [ - "efb5ffb8ae1b762f163cf3921102dec23d51436b", + "4047623a9af086e76e6234f4617aca6bb4e3729f", [ null, [ @@ -221591,11 +221591,31 @@ "==" ] ], - {} + { + "fuzzy": [ + [ + [ + "/css/css-view-transitions/set-current-time.html", + "/css/css-view-transitions/set-current-time-ref.html", + "==" + ], + [ + [ + 0, + 2 + ], + [ + 0, + 40000 + ] + ] + ] + ] + } ] ], "set-universal-specificity.html": [ - "80dc8272b5427bfa62100fa63eb5fca8e6f369a4", + "ec50b1e4078589752dcc9f887a39f877cd443a40", [ null, [ @@ -221607,6 +221627,19 @@ {} ] ], + "view-transition-name-is-backdrop-filter-root.html": [ + "c4f4d3831396b6e7491f19061e6b8b72347123e9", + [ + null, + [ + [ + "/css/css-view-transitions/view-transition-name-is-backdrop-filter-root-ref.html", + "==" + ] + ], + {} + ] + ], "view-transition-name-is-grouping.html": [ "95739351f0fa508ba3449f104317812acbba89b6", [ @@ -221621,7 +221654,7 @@ ] ], "web-animations-api.html": [ - "b9d62fabc6b3d485e73cdd4708923b4f9821949e", + "e0860b8f519b595af6b532d89d5818a59eab812e", [ null, [ @@ -262785,16 +262818,6 @@ } }, "support": { - ".cache": { - "gitignore2.json": [ - "f1763e8f5a5f20a848cf231471e8fcc27f881ee1", - [] - ], - "mtime.json": [ - "15375046005f225415354e26fcc268c9ef3e7209", - [] - ] - }, ".gitignore": [ "d93e645d547894b50149d3726de2654957b6e06f", [] @@ -270109,10 +270132,14 @@ "token.py": [ "867dab9592f89a36fd2ef6d3656046318673cf5b", [] + ], + "userinfo-iframe.html": [ + "1a38c405af12cf3b42bf3137dab0f15fa1539d6f", + [] ] }, "fedcm-helper.sub.js": [ - "87a1337a06cbd63f7302fd4f93298d9ffcf072ab", + "0b7db94e0a77902a89b0725a89f2d8cc1a2f02f1", [] ], "fedcm-iframe-level2.html": [ @@ -270124,7 +270151,7 @@ [] ], "fedcm-mock.js": [ - "f52bd6e0e70d73782ea1618c3c694599536761e9", + "7b399af2ce3810dc28cbc4715a2f832c01a937e0", [] ], "fedcm-mojojs-helper.js": [ @@ -284337,7 +284364,7 @@ [] ], "color-computed-color-mix-function-expected.txt": [ - "585e3cf29dda255c638e32720e2f1bd4fd76ce65", + "9fc84406d5e1fe4b64e49e150b923684c2419779", [] ], "color-computed-color-mix-function.html.ini": [ @@ -290880,7 +290907,7 @@ [] ], "cjk-kerning.html.ini": [ - "cf10f40714d0b64c83f8037bd93071a2b6b95c94", + "5f57054ae95563dfd924ace4a18776bd51a65c77", [] ], "crash-large-grapheme-cluster.html.ini": [ @@ -301959,7 +301986,7 @@ ], "image-set": { "image-set-computed.sub-expected.txt": [ - "4ba9aa045758d8051ff283d856e7d9306609c043", + "46d6992a524bb73d04ea4be731eef7b0d7da7a92", [] ], "image-set-computed.sub.html.ini": [ @@ -301991,7 +302018,7 @@ [] ], "image-set-parsing-expected.txt": [ - "0039d9dfa0010e4d9dcbd8533cb80dd293f28558", + "c824af728a48ed8bf7287076bae50f8233c3e2d7", [] ], "image-set-parsing.html.ini": [ @@ -324862,6 +324889,10 @@ [] ], "compute-kind-widget-generated": { + "kind-of-widget-fallback-color-input-border-end-end-radius-001.html.ini": [ + "54dfeae07bbd1d4c86eb784cfe0a5ccc8cc78f23", + [] + ], "kind-of-widget-fallback-input-button-border-block-start-color-001.html.ini": [ "2e9c0d5346d0d09211cb81243bf0f825150f0f98", [] @@ -324870,6 +324901,10 @@ "49fa98868a14ee8a7c470d925e835c82897f609c", [] ], + "kind-of-widget-fallback-input-reset-background-clip-001.html.ini": [ + "c3219cfe7561a6d0b5c0c0419b140feaa575c4b1", + [] + ], "kind-of-widget-fallback-input-reset-border-end-end-radius-001.html.ini": [ "cfa46fa9706127e00580cf1e1c5f022bc8563538", [] @@ -324902,6 +324937,10 @@ "75202882a4c3f93f69a7773b78f9f6840d513b1f", [] ], + "kind-of-widget-fallback-input-submit-border-end-start-radius-001.html.ini": [ + "0a103751c35f49aefdaf0284d14ae70ecf9c3907", + [] + ], "kind-of-widget-fallback-input-submit-border-inline-end-width-001.html.ini": [ "2a170629651d9defa1951ceceeab784ca50ea285", [] @@ -324910,6 +324949,10 @@ "57acbdd3666e3a4965d10651a009475c0449b77c", [] ], + "kind-of-widget-fallback-input-submit-border-inline-start-width-001.html.ini": [ + "e22326544e8cda86ac41f55288a45aa2021c907e", + [] + ], "kind-of-widget-fallback-input-text-border-right-color-001.html.ini": [ "5bc373383d5976f2a3ac4ad63256a3003a52ab54", [] @@ -325097,6 +325140,10 @@ "kind-of-widget-fallback-textarea-border-image-outset-001.html.ini": [ "c7113a77e18e06f4043614fb70e43ea3b7c34f93", [] + ], + "kind-of-widget-fallback-textarea-border-top-color-001.html.ini": [ + "9af42e769df5911125cc0aca08424b5836c96aca", + [] ] }, "compute-kind-widget-no-fallback-props-001.html.ini": [ @@ -325929,6 +325976,10 @@ "cdedc10fb52295d0fcc92f72c24c4882f3033b0a", [] ], + "outline-027.html.ini": [ + "2b8d01942e1f1803d316c8076442b593ead729e2", + [] + ], "outline-auto-dynamic-change-ref.html": [ "9128eae260fce19f818a83a7ac3ff11be1a2d36b", [] @@ -325942,14 +325993,6 @@ [] ], "parsing": { - "cursor-valid-expected.txt": [ - "c14f52fc219e5668f1d29b0f3dc0536b84e7029f", - [] - ], - "cursor-valid.html.ini": [ - "91d58955dbe994f10608743a04a00ec39c95727b", - [] - ], "outline-color-valid-optional-expected.txt": [ "ddbde423753384c7fa6f12e96141480222d71ee0", [] @@ -328220,7 +328263,7 @@ }, "css-view-transitions": { "3d-transform-incoming-ref.html": [ - "a789b706efd155a9c66b0907413cab721bb7570a", + "df5eaaca83823999e0dad1890dd706462c077c07", [] ], "3d-transform-incoming.html.ini": [ @@ -328228,7 +328271,7 @@ [] ], "3d-transform-outgoing-ref.html": [ - "0554cd3f4d9a69f06eb0c1e70687f41132d15567", + "eede13140a57a0719d6f658e5d491436954c3337", [] ], "3d-transform-outgoing.html.ini": [ @@ -328244,15 +328287,15 @@ [] ], "content-object-fit-fill-ref.html": [ - "c8ba2ae154bb4bcc56fae3ae6c7a0434fb57ea7c", + "b86e0a95a172bcc191f17d954b2cf6bd710a1fd1", [] ], "content-object-fit-none-ref.html": [ - "61ef73f28cbb0d23bde9e3235ce5ac9c963ad3cf", + "8bd63e9a88ed83da7c24dcdd6de24abb3dbca478", [] ], "content-smaller-than-box-size-ref.html": [ - "836f6cf3abb70650a5742458516d505f639968e8", + "381a311cc4d76e93b04d11f4c0d5faa64bcf8f7f", [] ], "content-smaller-than-box-size.html.ini": [ @@ -328260,7 +328303,7 @@ [] ], "content-visibility-auto-shared-element-ref.html": [ - "36e07d4167a99843ea6fef92769482e29112cfeb", + "5c3fb1616d6e01276eced88d3a97b784ba1deb59", [] ], "content-visibility-auto-shared-element.html.ini": [ @@ -328268,7 +328311,7 @@ [] ], "content-with-clip-max-texture-size-ref.html": [ - "3c66ddbfe701de29b900234c3e9b8ae579c96816", + "ed8998839ded3de854f9d174ca0050bc6f4ee019", [] ], "content-with-clip-max-texture-size.html.ini": [ @@ -328276,11 +328319,11 @@ [] ], "content-with-clip-ref.html": [ - "b265afabc5e7c18b54ecb7f70030b2a1473db95a", + "28d8733e27addde11904cd55485bc0a850a5f602", [] ], "content-with-clip-root-ref.html": [ - "1da6940c902a6164320feca65f9da2e502d54976", + "f81a96370e84212417313078d795e58b6593beb3", [] ], "content-with-clip-root.html.ini": [ @@ -328292,7 +328335,7 @@ [] ], "content-with-inline-child-ref.html": [ - "a805aac64bf02466602340c1fa1a1857310b07ab", + "4bb87f316f96070e8af0794db2d6b8dea2d743b2", [] ], "content-with-inline-child.html.ini": [ @@ -328300,11 +328343,11 @@ [] ], "content-with-overflow-ref.html": [ - "62282bd326a694ff480dc904bbbd5affee6fb4c3", + "a24e30ede964eddef1c996be734478150bfa919b", [] ], "content-with-overflow-zoomed-ref.html": [ - "a55fa30937a37131afdf842880eb72a4ea6d157f", + "a9d873957ac876d5a165de149febbb5b29cd3e0f", [] ], "content-with-transform-new-image.html.ini": [ @@ -328316,15 +328359,15 @@ [] ], "content-with-transform-ref.html": [ - "629c8f0cc901a57b9df00742c3703e5ab056aafa", + "568e040c1e221c4f92391e6466d71287931a1d60", [] ], "css-tags-paint-order-ref.html": [ - "98f26c06df4b5950c238e6dab9a0f7445d8d13a3", + "53f6b380c6300b3dfb75bdddf176573921b1b4e3", [] ], "css-tags-paint-order-with-entry-ref.html": [ - "6a50ecbebf7e56e403ca71726e81f2e6e81023a8", + "e7f62c2346324fe36a2401225f78e244a57106d7", [] ], "css-tags-paint-order-with-entry.html.ini": [ @@ -328336,7 +328379,7 @@ [] ], "css-tags-shared-element-ref.html": [ - "659d1d52786ff8ce473cfdb2a162b9fb612b0544", + "23fa74dd5e665f4b63322b13f24caf9be691c15b", [] ], "css-tags-shared-element.html.ini": [ @@ -328384,7 +328427,7 @@ [] ], "far-away-capture-ref.html": [ - "f5a034328fd7accc148bdbd44f811519b46c2619", + "9e10b9b44e302a32f71c0fa7efac78eca9f0456a", [] ], "far-away-capture.html.ini": [ @@ -328396,7 +328439,7 @@ [] ], "hit-test-unpainted-element-ref.html": [ - "fb73bb91fbc87ec79fa7d9ffee6567eef8f64dfe", + "dce9f27d904d73fb3bc9925d0425ef5e484f516b", [] ], "hit-test-unpainted-element.html.ini": [ @@ -328404,7 +328447,7 @@ [] ], "hit-test-unrelated-element-ref.html": [ - "9d236466d6145e4337147b8393e3fe937a41a2a0", + "bca532b22c6a777108fd7a1ea7b811a73f7cdb17", [] ], "hit-test-unrelated-element.html.ini": [ @@ -328412,7 +328455,7 @@ [] ], "iframe-transition-ref.html": [ - "da1821e1d8323335b829e2e18df9362b3a790c97", + "49394f35f6c4f6c7d6c25e9f4fd61154a708904f", [] ], "iframe-transition.sub.html.ini": [ @@ -328432,11 +328475,11 @@ [] ], "intrinsic-aspect-ratio-ref.html": [ - "b2f63928e4010a78f2b7a77484122f876b3c2795", + "4455ad6172ef93668ab239317a17e33e9b0cb35e", [] ], "japanese-tag-ref.html": [ - "8b351feaed48ab06a5708fc0a9086b0cb6567197", + "8c57dba6588244daa4d3ff8d5daa8a1204563df1", [] ], "japanese-tag.html.ini": [ @@ -328448,7 +328491,7 @@ [] ], "new-and-old-sizes-match-ref.html": [ - "a2f8942fcc36adfb7b283f429a203d469f9cb276", + "b8c3b34c03a693c9f1e71a040a2176dd8dc5413d", [] ], "new-and-old-sizes-match.html.ini": [ @@ -328456,7 +328499,7 @@ [] ], "new-content-captures-clip-path-ref.html": [ - "0275e1a2546b98821a3520aafc37cb61e6764388", + "1b28bbf29b2f4ada6718bffd8a091e34ee7a9993", [] ], "new-content-captures-clip-path.html.ini": [ @@ -328464,7 +328507,7 @@ [] ], "new-content-captures-different-size-ref.html": [ - "88d7f9963f8f4dc52f4893e0e299b0e5da707ab8", + "2a80cf556815b6480c14e6f1d2337c60d5f43883", [] ], "new-content-captures-different-size.html.ini": [ @@ -328472,7 +328515,7 @@ [] ], "new-content-captures-opacity-ref.html": [ - "4fdd41c2d63421872f0a2a85f07c4020baead257", + "deea6d139bc106593089c9f620b9329b344ac441", [] ], "new-content-captures-opacity.html.ini": [ @@ -328480,7 +328523,7 @@ [] ], "new-content-captures-root-ref.html": [ - "5b5842b630221e39ce019ecb2171f593cfe03331", + "2f2e5e769406ffb2b5eb9909a59dc4bb6ebff6be", [] ], "new-content-captures-root.html.ini": [ @@ -328488,7 +328531,7 @@ [] ], "new-content-container-writing-modes-ref.html": [ - "e889195b8ccabc627287ea17ca481a3f0113bf94", + "34e36786f83ee680e8fdef4bfe15645d67587980", [] ], "new-content-container-writing-modes.html.ini": [ @@ -328496,7 +328539,7 @@ [] ], "new-content-element-writing-modes-ref.html": [ - "58bcdc44cc0d5c5d24551fa69d6b07addea49a03", + "94280ae3affc4350e4100d6bd390fb860ffe1a5a", [] ], "new-content-element-writing-modes.html.ini": [ @@ -328504,7 +328547,7 @@ [] ], "new-content-has-scrollbars-ref.html": [ - "e7e2f71b430f44ccaa87c4d5a409cb3ec11099fd", + "eddd7330144b538455e5fa4a3609299dcb3c63c8", [] ], "new-content-has-scrollbars.html.ini": [ @@ -328516,7 +328559,7 @@ [] ], "new-content-is-empty-div-ref.html": [ - "ab70b830a5f58703e2a5f1ada41bb744ca0831d5", + "c85028d3bd9f42c43d46a77c7c937b8cafde11b6", [] ], "new-content-is-empty-div.html.ini": [ @@ -328532,11 +328575,11 @@ [] ], "new-content-object-view-box-clip-path-ref.html": [ - "208284cc712fb81c3f97a6e16a541e9218faea9b", + "28e22b8ca2568a969545848281e18a0b4e8a6a99", [] ], "new-content-object-view-box-clip-path-reference-ref.html": [ - "394a80f3443cd342f995200c71755581058e9d51", + "b1871141c2bac9511b104421789ffc5b66dd8e15", [] ], "new-content-object-view-box-clip-path-reference.html.ini": [ @@ -328548,7 +328591,7 @@ [] ], "new-content-object-view-box-overflow-clipped-ref.html": [ - "2b55f1537d8cca54e259cf19d0313fb9bf945f29", + "d6016c950e437f512571581ec916ac2b04d5c2e6", [] ], "new-content-object-view-box-overflow-clipped.html.ini": [ @@ -328556,7 +328599,7 @@ [] ], "new-content-object-view-box-overflow-ref.html": [ - "2b55f1537d8cca54e259cf19d0313fb9bf945f29", + "d6016c950e437f512571581ec916ac2b04d5c2e6", [] ], "new-content-object-view-box-overflow.html.ini": [ @@ -328564,7 +328607,7 @@ [] ], "new-content-scaling-ref.html": [ - "bcd195fc264de6f194f4f8a48597155a6dc4ac33", + "1ca35f5a425e2986a60d5a5489ecdd5adf274c30", [] ], "new-content-scaling.html.ini": [ @@ -328580,7 +328623,7 @@ [] ], "new-element-on-start-ref.html": [ - "b721b4d54eccf1c7c6fcab9e450d48a75f07bc29", + "b3db1f2e190106b85543d920b1a35c644b76ca4e", [] ], "new-element-on-start.html.ini": [ @@ -328588,7 +328631,7 @@ [] ], "new-root-vertical-writing-mode-ref.html": [ - "6a0f1c4f25ae28b6c2f2950aadca9584cf1a41c5", + "f6b817d92bf89d6cd866b334dca605610979f90a", [] ], "new-root-vertical-writing-mode.html.ini": [ @@ -328620,7 +328663,7 @@ [] ], "no-root-capture-ref.html": [ - "7d735626e06429bf34fb9a37571c2d576a08254a", + "98ac7c9de92d4db435cff824b6539ff693ca52f6", [] ], "no-root-capture.html.ini": [ @@ -328628,7 +328671,7 @@ [] ], "nothing-captured-ref.html": [ - "7d735626e06429bf34fb9a37571c2d576a08254a", + "98ac7c9de92d4db435cff824b6539ff693ca52f6", [] ], "nothing-captured.html.ini": [ @@ -328644,11 +328687,11 @@ [] ], "object-view-box-ref.html": [ - "1451e0d203bf5bcdf02558090064c019e2f81abe", + "9ed1e503094cc4e283f5c6ae989ee36edbe3325c", [] ], "old-content-captures-clip-path-ref.html": [ - "168f4d84090920f9d44334289dfad2528cf39cbe", + "0d9d498b6be0748cfaf919390fda399d507e12c1", [] ], "old-content-captures-clip-path.html.ini": [ @@ -328656,7 +328699,7 @@ [] ], "old-content-captures-different-size-ref.html": [ - "9433681c753ac0c2611e20b3718a08be340b2e9b", + "4fbabd48f7c5696418d23516f2a95ec5af77ae53", [] ], "old-content-captures-different-size.html.ini": [ @@ -328664,7 +328707,7 @@ [] ], "old-content-captures-opacity-ref.html": [ - "10964ce9f1fa93e941ab38bea788d63818f5631d", + "33f7f5b14aba8db3f22e1f735b5dcc494029c58c", [] ], "old-content-captures-opacity.html.ini": [ @@ -328672,7 +328715,7 @@ [] ], "old-content-captures-root-ref.html": [ - "1222d6440b304da2669974369395d3ffb9156f4a", + "92bd70f6f4eb24096392289040d85aca2ae43742", [] ], "old-content-captures-root.html.ini": [ @@ -328680,7 +328723,7 @@ [] ], "old-content-container-writing-modes-ref.html": [ - "e0a18aa6ed1b079ad107e6e789f30e67af0a15ce", + "be264399c86a6e9b182bb81e9f93431b6d7dbc56", [] ], "old-content-container-writing-modes.html.ini": [ @@ -328688,7 +328731,7 @@ [] ], "old-content-element-writing-modes-ref.html": [ - "8b351feaed48ab06a5708fc0a9086b0cb6567197", + "8c57dba6588244daa4d3ff8d5daa8a1204563df1", [] ], "old-content-element-writing-modes.html.ini": [ @@ -328696,7 +328739,7 @@ [] ], "old-content-has-scrollbars-ref.html": [ - "ea7a0f7c149dbf8ec1abbbcf72afdd8a8f7c6103", + "b349e80700d537185173b856020b454c24a9a52e", [] ], "old-content-has-scrollbars.html.ini": [ @@ -328708,7 +328751,7 @@ [] ], "old-content-is-empty-div-ref.html": [ - "b658d565354bd241727df8a31b76872e819d8556", + "b4b17ee780f0484e75d5eb51ce04fcd432a6cdb5", [] ], "old-content-is-empty-div.html.ini": [ @@ -328724,11 +328767,11 @@ [] ], "old-content-object-view-box-clip-path-ref.html": [ - "208284cc712fb81c3f97a6e16a541e9218faea9b", + "28e22b8ca2568a969545848281e18a0b4e8a6a99", [] ], "old-content-object-view-box-clip-path-reference-ref.html": [ - "394a80f3443cd342f995200c71755581058e9d51", + "b1871141c2bac9511b104421789ffc5b66dd8e15", [] ], "old-content-object-view-box-clip-path-reference.html.ini": [ @@ -328740,7 +328783,7 @@ [] ], "old-content-object-view-box-overflow-ref.html": [ - "2b55f1537d8cca54e259cf19d0313fb9bf945f29", + "d6016c950e437f512571581ec916ac2b04d5c2e6", [] ], "old-content-object-view-box-overflow.html.ini": [ @@ -328756,7 +328799,7 @@ [] ], "old-root-vertical-writing-mode-ref.html": [ - "227db8a1327efd1207fee24b2a45a603d09fe6a6", + "bb4f2df0f8124d6f002a233c6af9872a74cc88eb", [] ], "old-root-vertical-writing-mode.html.ini": [ @@ -328810,7 +328853,7 @@ [] ], "root-captured-as-different-tag-ref.html": [ - "1222d6440b304da2669974369395d3ffb9156f4a", + "92bd70f6f4eb24096392289040d85aca2ae43742", [] ], "root-captured-as-different-tag.html.ini": [ @@ -328818,7 +328861,7 @@ [] ], "root-scrollbar-with-fixed-background-ref.html": [ - "d7014c4100963eb91771d6be2f2715523033941b", + "a4010b5f2f8c593f3389b838669e42d80c6fd1b1", [] ], "root-scrollbar-with-fixed-background.html.ini": [ @@ -328826,7 +328869,7 @@ [] ], "root-style-change-during-animation-ref.html": [ - "964b3b8d7e433836b32c70eae4b55aa93fb00fdd", + "c180c384f4e1dae61eef8b982420c79af39e65ab", [] ], "root-style-change-during-animation.html.ini": [ @@ -328898,7 +328941,7 @@ [] ], "set-universal-specificity-ref.html": [ - "e6afd805fbb0167fc9ab7de4417d00ec70c55397", + "4bf2164c7ae078cb48ea3eaf0881434e0f0945dd", [] ], "set-universal-specificity.html.ini": [ @@ -328935,6 +328978,14 @@ "47d69a5cb06400fbd6b8b16ca31136b2f5e84df5", [] ], + "view-transition-name-is-backdrop-filter-root-ref.html": [ + "32aaf55412cada7a5832899fa26418cfd705e909", + [] + ], + "view-transition-name-is-backdrop-filter-root.html.ini": [ + "485ca4cfe3ce652a49f3c8a7251a679d5a34d6da", + [] + ], "view-transition-name-is-grouping-ref.html": [ "add20600f818ee118422c770c0a3f0cd367740b6", [] @@ -328952,7 +329003,7 @@ [] ], "web-animations-api-ref.html": [ - "b97396c491f515885b0cfd1e778ea88cc9c8ea10", + "ab66e7d16df6acf73a4a4b88bd74a727876c966c", [] ], "web-animations-api.html.ini": [ @@ -337702,15 +337753,15 @@ [] ], "fontname.js": [ - "b42be89c66e1794ca301958af420b8b94338cebf", + "8c34a5a759013c2b3d4a7822beca3c8145d24ae7", [] ], "fontsize.js": [ - "bbaa6d8447844b33cd6b9e13da6bf20576d47c31", + "d048375b7a41289334959a73c8c8e5ba90516f9d", [] ], "forecolor.js": [ - "fde8364be234e224460f986636c76a42ed87a6fa", + "efca1970ec9f57da8f8ff544f64d21ca875c965f", [] ], "formatblock.js": [ @@ -338792,11 +338843,11 @@ [] ], "fontname_1001-2000-expected.txt": [ - "c92c694582ced6f895ad7da534c33750a2396f43", + "9a4438582c599010349e995abf25d346bbe38dc4", [] ], "fontname_2001-last-expected.txt": [ - "540717fcda881bd7bb37c33d82ce20ffedfacff4", + "143171bb964dfcf4628de0b81629ebd817d54bc5", [] ], "fontsize-expected.txt": [ @@ -338812,11 +338863,11 @@ [] ], "fontsize_1001-2000-expected.txt": [ - "a1ee1f76f0884649362c0d33d2fbd0c1f7b95851", + "d8455b06ace636d621cca13e551877c5b6b589b6", [] ], "fontsize_2001-last-expected.txt": [ - "1abfb6a6ecbd6b78b60f8affe1d08a269165fd37", + "8e9d63a78aad6ef2791f2327897238dc3e57e0d3", [] ], "forecolor-expected.txt": [ @@ -338832,11 +338883,11 @@ [] ], "forecolor_1001-2000-expected.txt": [ - "0c65e37b9f1dfb4397c107c90fa5a8b168609ab5", + "3b56e4af6633b4e1f3f7d16ba875ede362b08d27", [] ], "forecolor_2001-last-expected.txt": [ - "a2d3bf9c74b68d4c98c6609ef948f78aa7da70d5", + "25cf275a2373c71be58889bf511f86ea68b8c2b5", [] ], "formatblock-expected.txt": [ @@ -341424,10 +341475,6 @@ "89fce3af5f45a24479e5d44a20acf97bb5d594b2", [] ], - "idlharness.any-expected.txt": [ - "6e6763ddef7801866f506fff3ca335ca68fe046b", - [] - ], "idlharness.any.js.ini": [ "10efdbe7dca5f15f365b74ffafa69bb0180eec63", [] @@ -341450,7 +341497,7 @@ [] ], "event-timing-test-utils.js": [ - "fc4d1aee72627644d9257cb7a220b682c0ab4bb4", + "66aa05a165a918dbf34ff2326018a8ca620cb7d1", [] ], "slow-image.py": [ @@ -346956,7 +347003,7 @@ [] ], "embedding.tentative.https.window.js.ini": [ - "f8ddb12b99038415004037d684772e756bd5c20d", + "999554f2099718ec272b59e9d596887a435ddd30", [] ], "fenced-frame-bypass.tentative.https.window-expected.txt": [ @@ -349719,7 +349766,7 @@ [] ], "window-open-windowfeatures-values.html.ini": [ - "ef909a9fbff128dcd041f2de23ab974043d2a261", + "d9e0e4f30172d211e80db333678752d7aedbe94b", [] ], "window-properties.https-expected.txt": [ @@ -353282,7 +353329,7 @@ [] ], "property-top.https.html.ini": [ - "a0f5275d823242458b007c30d0da2799d5633235", + "e56c505e3526e7bab76be20bf7e01d86d445f123", [] ], "property-window.https.html.ini": [ @@ -374715,7 +374762,7 @@ [] ], "pending_beacon-sendondiscard.tentative.https.window.js.ini": [ - "e4af02594621bd6faf52db80666f41fd0187d12f", + "cb4583fac3f05d48ccff1924b1ccbd2e027e64ef", [] ], "pending_beacon-sendonhidden.tentative.https.window.js.ini": [ @@ -374812,7 +374859,7 @@ [] ], "performance-navigation-timing-same-origin-bfcache.tentative.window.js.ini": [ - "2faeab35f7932b2191cc0d963c0bc95d8cdfd868", + "a7414b2e31aaebcdf7373b5217c283682827ab56", [] ], "performance-navigation-timing-same-origin-replace.tentative.window.js.ini": [ @@ -385410,7 +385457,7 @@ ], "resources": { "subapps-helpers.js": [ - "e923db01f3305005f7cf754f3ec2ad7b58b8ef57", + "9158d15c6c89b7cb328ca9a378a7753deb4d5e91", [] ] } @@ -433274,7 +433321,7 @@ ] }, "fedcm-network-requests.https.html": [ - "ebcf61ba18edc008b58678339a6726fb84364e68", + "2212a435377814bf56a4c97b739585b74363f98e", [ null, {} @@ -438961,7 +439008,7 @@ ] ], "content-visibility-068.html": [ - "90762f3345029d7fc88381faca6410f00dbf5c9d", + "844f04e6b26e84546b160297b422f997b323b3e7", [ null, {} @@ -461259,7 +461306,7 @@ ] ], "cursor-valid.html": [ - "8b3c478391b917d7d1233c8a7b49b816100ed1f4", + "a31a7aed519d96ec77a005cd706655b9e065f782", [ null, {} @@ -462590,21 +462637,21 @@ ] ], "event-pseudo-name.html": [ - "b49cde320896692bd90c3c70d53d571d753b5ec6", + "06e1f37db89de9fd89389d2ec99996ecdf918871", [ null, {} ] ], "hit-test-unpainted-element-from-point.html": [ - "ec5e407260500dba61b83cad1dce1f5254887ca4", + "47a8e5fb994d60f02cccf5c786d7a9e3a4ad0d43", [ null, {} ] ], "input-blocked-when-rendering-suppressed.html": [ - "7f550c86550e0164c0e5205fcbe03cbc293e42f4", + "45c811e65b9077aec4f56b82a64088335aa1d907", [ null, { @@ -462641,14 +462688,14 @@ ] ], "no-crash-set-exception.html": [ - "cb8942d11229c3f40c0c54bb8cc8385c757fedfa", + "06e519e447c016cf244cb84bb9c0fdc30771fdd3", [ null, {} ] ], "no-css-animation-while-render-blocked.html": [ - "4bc124ce660be2347da0980b5e50bee59f26c845", + "ae9cfda9bb079da8ea298a43b939b286c93ad3c4", [ null, { @@ -462657,7 +462704,7 @@ ] ], "no-raf-while-render-blocked.html": [ - "566d6f7e3ec95292d0459e043e60b3b70771b2c4", + "52058b7a04b8317d4266aaffa766738aa9611f5c", [ null, { @@ -462738,14 +462785,14 @@ ] ], "pseudo-get-computed-style.html": [ - "45d2559b3e788f893ab8f48a717fca1576fbbcb8", + "8513e8207d37ed5fccaba591dea8ccae8354503c", [ null, {} ] ], "ready_resolves_after_dom_before_raf.html": [ - "40a2ad47670223d5f40ac5b8689e152bff8eba54", + "adf3dc6c161515e8ef0b8476137afc26ea594c16", [ null, {} @@ -489136,6 +489183,33 @@ } ] ], + "interaction-count-click.html": [ + "73d748c7bdadd3f06db3581d8d2513dd29dee731", + [ + null, + { + "testdriver": true + } + ] + ], + "interaction-count-press-key.html": [ + "d0d55321a160188ff5e1fe6d94fd51068df22cd8", + [ + null, + { + "testdriver": true + } + ] + ], + "interaction-count-tap.html": [ + "561bf5f917b6f0dadb247b670cc3152c2a30f934", + [ + null, + { + "testdriver": true + } + ] + ], "interactionid-click.html": [ "1506e31e1d9259d0963378b07ce50e5aaeeb5c25", [ @@ -592871,7 +592945,7 @@ ] ], "view-timeline-range.html": [ - "916b4c12bb770fd87f860e972a6d606f40a5e715", + "4123bda47089ff8d3e0d87a8bf79b2f13c15b4b2", [ null, {} @@ -606565,7 +606639,7 @@ }, "subapps": { "add-error.tentative.https.html": [ - "3dafdcd5aca11819808c393a22bb15fcb14b4e1f", + "8b83afccf2c97854c12eba88bbe6fbc910c97ec9", [ null, { @@ -606574,7 +606648,7 @@ ] ], "add-success.tentative.https.html": [ - "fee7c6605c626c68bc591ce885cadff7cd294ee8", + "b482982f28a8f5d90f5bb2542a57dd5a26306b78", [ null, { @@ -630596,7 +630670,7 @@ ] ], "RTCPeerConnection-insertable-streams-audio.https.html": [ - "60536f39a4c2d9808adec9a2cf8be0cd3428cf64", + "14ae2ad553f67920d5a7bd47169ef28a1cfda5b1", [ null, { @@ -630632,7 +630706,7 @@ ] ], "RTCPeerConnection-insertable-streams-video.https.html": [ - "5a5b65f0c05aa6186034e40e0898a4f4f854b3b7", + "378520c693759bf95d223706a8b3b34988289335", [ null, { @@ -664876,21 +664950,21 @@ }, "css-view-transitions": { "shared-transition-author-style.manual.html": [ - "2e0dc49d781e0ad4bdccb9762b41b8da536f4300", + "d757c8cf0dc3972e360c9e91b2ea900b97a16b47", [ null, {} ] ], "shared-transition-half.manual.html": [ - "d78df70cb88de8b90c347778e9b31c542c6aac77", + "130348cc2008b2de874db5abdec54895cb33ccbf", [ null, {} ] ], "shared-transition-shapes.manual.html": [ - "6b22a53fb425873a33836a8c58e32d6d3f236e06", + "1f666cfe9f4ddb51f92da12564d11c36843161bf", [ null, {}
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/fedcm-network-requests.https.html b/third_party/blink/web_tests/external/wpt/credential-management/fedcm-network-requests.https.html index ebcf61b..2212a43 100644 --- a/third_party/blink/web_tests/external/wpt/credential-management/fedcm-network-requests.https.html +++ b/third_party/blink/web_tests/external/wpt/credential-management/fedcm-network-requests.https.html
@@ -8,7 +8,8 @@ <body> <script type="module"> -import {default_request_options, +import {alt_manifest_origin, + default_request_options, default_alt_request_options, fedcm_test, select_manifest, @@ -23,6 +24,16 @@ }); } +async function createIframeWithPermissionPolicyAndWaitForMessage(test, iframeUrl) { + const messageWatcher = new EventWatcher(test, window, "message"); + let iframe = document.createElement("iframe"); + iframe.src = iframeUrl; + iframe.allow = "identity-credentials-get"; + document.body.appendChild(iframe); + const message = await messageWatcher.wait_for("message"); + return message.data; +} + fedcm_test(async t => { const cred = await navigator.credentials.get(default_request_options()); assert_equals(cred.token, "token"); @@ -189,4 +200,44 @@ assert_equals(query_sw_iframe2.contentDocument.body.textContent, "1"); }, 'Test that service worker cannot observe fetches performed by FedCM API'); +fedcm_test(async t => { + const cred = await navigator.credentials.get(default_alt_request_options()); + assert_equals(cred.token, "token"); + + const iframe_in_idp_scope = `${alt_manifest_origin}/\ +credential-management/support/fedcm/userinfo-iframe.html`; + const message = await createIframeWithPermissionPolicyAndWaitForMessage(t, iframe_in_idp_scope); + assert_equals(message.result, "Pass"); + assert_equals(message.numAccounts, 1); + assert_equals(message.firstAccountEmail, "john_doe@idp.example"); +}, 'Test basic User InFo API flow'); + +fedcm_test(async t => { + const cred = await navigator.credentials.get(default_alt_request_options()); + assert_equals(cred.token, "token"); + + const iframe_in_idp_scope = `support/fedcm/userinfo-iframe.html`; + const message = await createIframeWithPermissionPolicyAndWaitForMessage(t, iframe_in_idp_scope); + assert_equals(message.result, "Fail"); +}, 'Test that User Info API only works when invoked from iframe that is same origin as the IDP'); + +fedcm_test(async t => { + const cred = await navigator.credentials.get(default_alt_request_options()); + assert_equals(cred.token, "token"); + + try { + const manifest_path = `${alt_manifest_origin}/\ +credential-management/support/fedcm/manifest.py`; + const user_info = await IdentityProvider.getUserInfo({ + configURL: manifest_path, + // Approved client + clientId: '123', + }); + assert_unreached("Failure message"); + } catch (error) { + assert_equals(error.message, "UserInfo request must be initiated from a frame that is the same origin with the provider."); + // Expect failure + } +}, 'Test that User Info API does not work in the top frame'); + </script>
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-helper.sub.js b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-helper.sub.js index 87a1337..0b7db94 100644 --- a/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-helper.sub.js +++ b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-helper.sub.js
@@ -1,4 +1,4 @@ -const alt_manifest_origin = 'https://{{hosts[alt][]}}:{{ports[https][0]}}'; +export const alt_manifest_origin = 'https://{{hosts[alt][]}}:{{ports[https][0]}}'; // Set the identity provider cookie. export function set_fedcm_cookie(host) {
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-mock.js b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-mock.js index f52bd6e..7b399af 100644 --- a/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-mock.js +++ b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm-mock.js
@@ -80,6 +80,16 @@ this.pendingPromiseResolve_ = null; } + // Implements + // RequestUserInfo(IdentityProviderGetParameters idp_get_param) => + // (RequestUserInfoStatus status, array<IdentityUserInfo>? user_info); + async requestUserInfo(idp_get_param) { + return Promise.resolve({ + status: "", + user_info: "" + }); + } + async logoutRps(logout_endpoints) { return Promise.resolve({ status: this.logoutRpsStatus_
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm/userinfo-iframe.html b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm/userinfo-iframe.html new file mode 100644 index 0000000..1a38c40 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/credential-management/support/fedcm/userinfo-iframe.html
@@ -0,0 +1,34 @@ +<!doctype html> +<script type="module"> +import {alt_manifest_origin} from './../fedcm-helper.sub.js'; + +// Loading fedcm-iframe.html in the test will make a FedCM call on load, and +// trigger a postMessage upon completion. +// +// message { +// string result: "Pass" | "Fail" +// string token: token.token +// string errorType: error.name +// } +window.onload = async () => { + try { + const manifest_path = `${alt_manifest_origin}/\ +credential-management/support/fedcm/manifest.py`; + const user_info = await IdentityProvider.getUserInfo({ + configURL: manifest_path, + // Approved client + clientId: '123', + }); + let results = { + result: "Pass", + numAccounts: user_info.length, + firstAccountEmail: user_info[0].email + }; + window.top.postMessage(results, '*'); + } catch (error) { + window.top.postMessage({result: "Fail", errorType: error.name}, '*'); + } +}; + +</script> +
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/root-element-opacity.html b/third_party/blink/web_tests/external/wpt/css/compositing/root-element-opacity.html index 4885d805..a8195bc 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/root-element-opacity.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/root-element-opacity.html
@@ -3,6 +3,7 @@ <link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> <link rel="match" href="root-element-opacity-ref.html"> +<meta name="fuzzy" content="0-1;0-480000"> <html style="background: #BBB; opacity: 0.5"> <div id=spacer style="width: 100px; height: 3000px"></div> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed-color-mix-function-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed-color-mix-function-expected.txt index 585e3cf..9fc8440 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed-color-mix-function-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-color/parsing/color-computed-color-mix-function-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 474 tests; 324 PASS, 150 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 474 tests; 400 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS Property color value 'color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))' PASS Property color value 'color-mix(in hsl, hsl(120deg 10% 20%) 25%, hsl(30deg 30% 40%))' PASS Property color value 'color-mix(in hsl, 25% hsl(120deg 10% 20%), hsl(30deg 30% 40%))' @@ -20,34 +20,34 @@ PASS Property color value 'color-mix(in hsl, hsl(120deg 10% 20% / .4) 0%, hsl(30deg 30% 40% / .8))' PASS Property color value 'color-mix(in hsl, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' PASS Property color value 'color-mix(in hsl, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' -FAIL Property color value 'color-mix(in hsl, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 +PASS Property color value 'color-mix(in hsl, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' +PASS Property color value 'color-mix(in hsl, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' +PASS Property color value 'color-mix(in hsl, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' +PASS Property color value 'color-mix(in hsl, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' PASS Property color value 'color-mix(in hsl shorter hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' PASS Property color value 'color-mix(in hsl shorter hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' -FAIL Property color value 'color-mix(in hsl shorter hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl shorter hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl shorter hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl shorter hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 85 +/- 0.0001, expected 85 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 85 +/- 0.0001, expected 85 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 170 +/- 0.0001, expected 170 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 170 +/- 0.0001, expected 170 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl longer hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 64 +/- 0.0001, expected 64 but got 191 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 170 +/- 0.0001, expected 170 but got 64 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl increasing hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 64 +/- 0.0001, expected 64 but got 191 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 170 +/- 0.0001, expected 170 but got 64 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 191 +/- 0.0001, expected 191 but got 64 -FAIL Property color value 'color-mix(in hsl decreasing hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 191 +/- 0.0001, expected 191 but got 64 +PASS Property color value 'color-mix(in hsl shorter hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' +PASS Property color value 'color-mix(in hsl shorter hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' +PASS Property color value 'color-mix(in hsl shorter hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' +PASS Property color value 'color-mix(in hsl shorter hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' +PASS Property color value 'color-mix(in hsl longer hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' +PASS Property color value 'color-mix(in hsl increasing hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))' +PASS Property color value 'color-mix(in hsl decreasing hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))' FAIL Property color value 'color-mix(in hsl specified hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' assert_true: 'color-mix(in hsl specified hue, hsl(40deg 50% 50%), hsl(60deg 50% 50%))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in hsl specified hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' assert_true: 'color-mix(in hsl specified hue, hsl(60deg 50% 50%), hsl(40deg 50% 50%))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in hsl specified hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' assert_true: 'color-mix(in hsl specified hue, hsl(50deg 50% 50%), hsl(330deg 50% 50%))' is a supported value for color. expected true got false @@ -92,34 +92,34 @@ PASS Property color value 'color-mix(in hwb, hwb(120deg 10% 20% / .4) 0%, hwb(30deg 30% 40% / .8))' PASS Property color value 'color-mix(in hwb, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' PASS Property color value 'color-mix(in hwb, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' -FAIL Property color value 'color-mix(in hwb, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 +PASS Property color value 'color-mix(in hwb, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' +PASS Property color value 'color-mix(in hwb, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' +PASS Property color value 'color-mix(in hwb, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' +PASS Property color value 'color-mix(in hwb, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' PASS Property color value 'color-mix(in hwb shorter hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' PASS Property color value 'color-mix(in hwb shorter hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' -FAIL Property color value 'color-mix(in hwb shorter hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb shorter hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb shorter hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb shorter hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 89 +/- 0.0001, expected 89 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 89 +/- 0.0001, expected 89 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 140 +/- 0.0001, expected 140 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 140 +/- 0.0001, expected 140 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb longer hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 77 +/- 0.0001, expected 77 but got 153 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 140 +/- 0.0001, expected 140 but got 77 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb increasing hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 77 +/- 0.0001, expected 77 but got 153 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 140 +/- 0.0001, expected 140 but got 77 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 0, expected 153 +/- 0.0001, expected 153 but got 77 -FAIL Property color value 'color-mix(in hwb decreasing hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' assert_array_approx_equals: Numeric parameters are approximately equal. property 1, expected 153 +/- 0.0001, expected 153 but got 77 +PASS Property color value 'color-mix(in hwb shorter hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' +PASS Property color value 'color-mix(in hwb shorter hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' +PASS Property color value 'color-mix(in hwb shorter hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' +PASS Property color value 'color-mix(in hwb shorter hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' +PASS Property color value 'color-mix(in hwb longer hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' +PASS Property color value 'color-mix(in hwb increasing hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))' +PASS Property color value 'color-mix(in hwb decreasing hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))' FAIL Property color value 'color-mix(in hwb specified hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' assert_true: 'color-mix(in hwb specified hue, hwb(40deg 30% 40%), hwb(60deg 30% 40%))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in hwb specified hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' assert_true: 'color-mix(in hwb specified hue, hwb(60deg 30% 40%), hwb(40deg 30% 40%))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in hwb specified hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' assert_true: 'color-mix(in hwb specified hue, hwb(50deg 30% 40%), hwb(330deg 30% 40%))' is a supported value for color. expected true got false @@ -180,18 +180,18 @@ PASS Property color value 'color-mix(in lch longer hue, lch(100 0 330deg), lch(100 0 50deg))' PASS Property color value 'color-mix(in lch longer hue, lch(100 0 20deg), lch(100 0 320deg))' PASS Property color value 'color-mix(in lch longer hue, lch(100 0 320deg), lch(100 0 20deg))' -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 40deg), lch(100 0 60deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 50 +/- 0.0001, expected 50 but got 230 -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 60deg), lch(100 0 40deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 230 +/- 0.0001, expected 230 but got 50 -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 50deg), lch(100 0 330deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 190 +/- 0.0001, expected 190 but got 10 -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 330deg), lch(100 0 50deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 10 +/- 0.0001, expected 10 but got 190 -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 20deg), lch(100 0 320deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 170 +/- 0.0001, expected 170 but got 350 -FAIL Property color value 'color-mix(in lch increasing hue, lch(100 0 320deg), lch(100 0 20deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 350 +/- 0.0001, expected 350 but got 170 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 40deg), lch(100 0 60deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 230 +/- 0.0001, expected 230 but got 50 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 60deg), lch(100 0 40deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 50 +/- 0.0001, expected 50 but got 230 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 50deg), lch(100 0 330deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 10 +/- 0.0001, expected 10 but got 190 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 330deg), lch(100 0 50deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 190 +/- 0.0001, expected 190 but got 10 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 20deg), lch(100 0 320deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 350 +/- 0.0001, expected 350 but got 170 -FAIL Property color value 'color-mix(in lch decreasing hue, lch(100 0 320deg), lch(100 0 20deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 170 +/- 0.0001, expected 170 but got 350 +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 40deg), lch(100 0 60deg))' +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 60deg), lch(100 0 40deg))' +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 50deg), lch(100 0 330deg))' +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 330deg), lch(100 0 50deg))' +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 20deg), lch(100 0 320deg))' +PASS Property color value 'color-mix(in lch increasing hue, lch(100 0 320deg), lch(100 0 20deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 40deg), lch(100 0 60deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 60deg), lch(100 0 40deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 50deg), lch(100 0 330deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 330deg), lch(100 0 50deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 20deg), lch(100 0 320deg))' +PASS Property color value 'color-mix(in lch decreasing hue, lch(100 0 320deg), lch(100 0 20deg))' FAIL Property color value 'color-mix(in lch specified hue, lch(100 0 40deg), lch(100 0 60deg))' assert_true: 'color-mix(in lch specified hue, lch(100 0 40deg), lch(100 0 60deg))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in lch specified hue, lch(100 0 60deg), lch(100 0 40deg))' assert_true: 'color-mix(in lch specified hue, lch(100 0 60deg), lch(100 0 40deg))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in lch specified hue, lch(100 0 50deg), lch(100 0 330deg))' assert_true: 'color-mix(in lch specified hue, lch(100 0 50deg), lch(100 0 330deg))' is a supported value for color. expected true got false @@ -243,18 +243,18 @@ PASS Property color value 'color-mix(in oklch longer hue, oklch(100 0 330deg), oklch(100 0 50deg))' PASS Property color value 'color-mix(in oklch longer hue, oklch(100 0 20deg), oklch(100 0 320deg))' PASS Property color value 'color-mix(in oklch longer hue, oklch(100 0 320deg), oklch(100 0 20deg))' -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 40deg), oklch(100 0 60deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 50 +/- 0.0001, expected 50 but got 230 -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 60deg), oklch(100 0 40deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 230 +/- 0.0001, expected 230 but got 50 -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 50deg), oklch(100 0 330deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 190 +/- 0.0001, expected 190 but got 10 -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 330deg), oklch(100 0 50deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 10 +/- 0.0001, expected 10 but got 190 -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 20deg), oklch(100 0 320deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 170 +/- 0.0001, expected 170 but got 350 -FAIL Property color value 'color-mix(in oklch increasing hue, oklch(100 0 320deg), oklch(100 0 20deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 350 +/- 0.0001, expected 350 but got 170 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 40deg), oklch(100 0 60deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 230 +/- 0.0001, expected 230 but got 50 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 60deg), oklch(100 0 40deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 50 +/- 0.0001, expected 50 but got 230 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 50deg), oklch(100 0 330deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 10 +/- 0.0001, expected 10 but got 190 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 330deg), oklch(100 0 50deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 190 +/- 0.0001, expected 190 but got 10 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 20deg), oklch(100 0 320deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 350 +/- 0.0001, expected 350 but got 170 -FAIL Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 320deg), oklch(100 0 20deg))' assert_array_approx_equals: Numeric parameters are approximately equal. property 2, expected 170 +/- 0.0001, expected 170 but got 350 +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 40deg), oklch(100 0 60deg))' +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 60deg), oklch(100 0 40deg))' +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 50deg), oklch(100 0 330deg))' +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 330deg), oklch(100 0 50deg))' +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 20deg), oklch(100 0 320deg))' +PASS Property color value 'color-mix(in oklch increasing hue, oklch(100 0 320deg), oklch(100 0 20deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 40deg), oklch(100 0 60deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 60deg), oklch(100 0 40deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 50deg), oklch(100 0 330deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 330deg), oklch(100 0 50deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 20deg), oklch(100 0 320deg))' +PASS Property color value 'color-mix(in oklch decreasing hue, oklch(100 0 320deg), oklch(100 0 20deg))' FAIL Property color value 'color-mix(in oklch specified hue, oklch(100 0 40deg), oklch(100 0 60deg))' assert_true: 'color-mix(in oklch specified hue, oklch(100 0 40deg), oklch(100 0 60deg))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in oklch specified hue, oklch(100 0 60deg), oklch(100 0 40deg))' assert_true: 'color-mix(in oklch specified hue, oklch(100 0 60deg), oklch(100 0 40deg))' is a supported value for color. expected true got false FAIL Property color value 'color-mix(in oklch specified hue, oklch(100 0 50deg), oklch(100 0 330deg))' assert_true: 'color-mix(in oklch specified hue, oklch(100 0 50deg), oklch(100 0 330deg))' is a supported value for color. expected true got false
diff --git a/third_party/blink/web_tests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht b/third_party/blink/web_tests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht index 57e5e3cc..035609e 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht +++ b/third_party/blink/web_tests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht
@@ -7,6 +7,7 @@ <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> <link rel="match" href="t32-opacity-offscreen-with-alpha-c-ref.html" /> <meta name="assert" content="That alpha within the offscreen buffer is composited correctly." /> + <meta name="fuzzy" content="0-1;0-5120" /> <style type="text/css"><![CDATA[ body { background: white; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/content-visibility/content-visibility-068.html b/third_party/blink/web_tests/external/wpt/css/css-contain/content-visibility/content-visibility-068.html index 90762f3..844f04e 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/content-visibility/content-visibility-068.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/content-visibility/content-visibility-068.html
@@ -48,7 +48,7 @@ }); focusable.focus(); - requestAnimationFrame(step2); + step_timeout(step2, 0); } // After focusing the subtree, the container should be somewhere closer than // 3000px (scrolled into view) and the height should be 10px, since it no
diff --git a/third_party/blink/web_tests/external/wpt/css/css-fonts/cjk-kerning.html.ini b/third_party/blink/web_tests/external/wpt/css/css-fonts/cjk-kerning.html.ini index cf10f407..5f57054 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-fonts/cjk-kerning.html.ini +++ b/third_party/blink/web_tests/external/wpt/css/css-fonts/cjk-kerning.html.ini
@@ -6,11 +6,11 @@ [expected match: .default .cjk vs .kernOFF .cjk] expected: - if (processor == "x86_64") and (flag_specific == "") and (product == "content_shell"): FAIL + if (os == "linux") and (flag_specific == "") and (product == "content_shell"): FAIL [expected mismatch: .kernOFF .cjk vs .kernON .cjk] expected: - if (processor == "x86_64") and (flag_specific == "") and (product == "content_shell"): PASS + if (os == "linux") and (flag_specific == "") and (product == "content_shell"): PASS FAIL [expected mismatch: .paltOFFkernON .cjk vs .paltONkernON .cjk]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-computed.sub-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-computed.sub-expected.txt index 4ba9aa0..46d6992 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-computed.sub-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-computed.sub-expected.txt
@@ -1,8 +1,8 @@ This is a testharness.js-based test. FAIL Property background-image value 'image-set(url(http://web-platform.test/example.png) 1x)' assert_equals: expected "image-set(url(\"http://web-platform.test/example.png\") 1dppx)" but got "image-set(url(\"http://web-platform.test/example.png\") 1x)" FAIL Property background-image value '-webkit-image-set(url(http://web-platform.test/example.png) 1x)' assert_equals: expected "image-set(url(\"http://web-platform.test/example.png\") 1dppx)" but got "image-set(url(\"http://web-platform.test/example.png\") 1x)" -FAIL Property background-image value 'image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' assert_true: 'image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' is a supported value for background-image. expected true got false -FAIL Property background-image value '-webkit-image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' assert_true: '-webkit-image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' is a supported value for background-image. expected true got false +FAIL Property background-image value 'image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' assert_equals: expected "image-set(url(\"http://web-platform.test/example.png\") 1dppx, url(\"http://web-platform.test/example.png\") 2dppx)" but got "image-set(url(\"http://web-platform.test/example.png\") 1x, url(\"http://web-platform.test/example.png\") 2x)" +FAIL Property background-image value '-webkit-image-set(url(http://web-platform.test/example.png) 1x, 'http://web-platform.test/example.png' 2x)' assert_equals: expected "image-set(url(\"http://web-platform.test/example.png\") 1dppx, url(\"http://web-platform.test/example.png\") 2dppx)" but got "image-set(url(\"http://web-platform.test/example.png\") 1x, url(\"http://web-platform.test/example.png\") 2x)" FAIL Property background-image value 'image-set(url("http://web-platform.test/example.png") 1dppx)' assert_true: 'image-set(url("http://web-platform.test/example.png") 1dppx)' is a supported value for background-image. expected true got false FAIL Property background-image value '-webkit-image-set(url("http://web-platform.test/example.png") 1dppx)' assert_true: '-webkit-image-set(url("http://web-platform.test/example.png") 1dppx)' is a supported value for background-image. expected true got false FAIL Property background-image value 'image-set(url(http://web-platform.test/example.png) 48dpi)' assert_true: 'image-set(url(http://web-platform.test/example.png) 48dpi)' is a supported value for background-image. expected true got false
diff --git a/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-parsing-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-parsing-expected.txt index 0039d9df..c824af72 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-parsing-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-images/image-set/image-set-parsing-expected.txt
@@ -1,13 +1,13 @@ This is a testharness.js-based test. -Found 60 tests; 34 PASS, 26 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 60 tests; 38 PASS, 22 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS e.style['background-image'] = "image-set(url(example.png) 1x)" should set the property value PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x)" should set the property value PASS e.style['background-image'] = "image-set(url(\"example.png\") 1x)" should set the property value PASS e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 1x)" should set the property value -FAIL e.style['background-image'] = "image-set('example.jpg' 1x)" should set the property value assert_not_equals: property should be set got disallowed value "" -FAIL e.style['background-image'] = "-webkit-image-set('example.jpg' 1x)" should set the property value assert_not_equals: property should be set got disallowed value "" -FAIL e.style['background-image'] = "image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value assert_not_equals: property should be set got disallowed value "" -FAIL e.style['background-image'] = "-webkit-image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value assert_not_equals: property should be set got disallowed value "" +PASS e.style['background-image'] = "image-set('example.jpg' 1x)" should set the property value +PASS e.style['background-image'] = "-webkit-image-set('example.jpg' 1x)" should set the property value +PASS e.style['background-image'] = "image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value +PASS e.style['background-image'] = "-webkit-image-set(url(example.png) 1x, 'example.png' 2x)" should set the property value FAIL e.style['background-image'] = "image-set(url(\"example.png\") 1dppx)" should set the property value assert_not_equals: property should be set got disallowed value "" FAIL e.style['background-image'] = "-webkit-image-set(url(\"example.png\") 1dppx)" should set the property value assert_not_equals: property should be set got disallowed value "" FAIL e.style['background-image'] = "image-set(url(\"example.png\") 1dpi)" should set the property value assert_not_equals: property should be set got disallowed value ""
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/backdrop-animate-002.html b/third_party/blink/web_tests/external/wpt/css/css-pseudo/backdrop-animate-002.html index 6fd153b..910807a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/backdrop-animate-002.html +++ b/third_party/blink/web_tests/external/wpt/css/css-pseudo/backdrop-animate-002.html
@@ -5,7 +5,7 @@ <link rel="match" href="backdrop-animate-002-ref.html"> <dialog id="target">Dialog contents</dialog> <!-- This test fails on WPT.fyi with off-by-one on the green background (Chrome-only): --> -<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-472272"> +<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-472500"> <script> const target = document.getElementById("target"); target.showModal();
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-color-input-border-end-end-radius-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-color-input-border-end-end-radius-001.html.ini new file mode 100644 index 0000000..54dfeae --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-color-input-border-end-end-radius-001.html.ini
@@ -0,0 +1,2 @@ +[kind-of-widget-fallback-color-input-border-end-end-radius-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-reset-background-clip-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-reset-background-clip-001.html.ini new file mode 100644 index 0000000..c3219cf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-reset-background-clip-001.html.ini
@@ -0,0 +1,2 @@ +[kind-of-widget-fallback-input-reset-background-clip-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-end-start-radius-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-end-start-radius-001.html.ini new file mode 100644 index 0000000..0a10375 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-end-start-radius-001.html.ini
@@ -0,0 +1,2 @@ +[kind-of-widget-fallback-input-submit-border-end-start-radius-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-inline-start-width-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-inline-start-width-001.html.ini new file mode 100644 index 0000000..e223265 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-input-submit-border-inline-start-width-001.html.ini
@@ -0,0 +1,2 @@ +[kind-of-widget-fallback-input-submit-border-inline-start-width-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-textarea-border-top-color-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-textarea-border-top-color-001.html.ini new file mode 100644 index 0000000..9af42e76 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/compute-kind-widget-generated/kind-of-widget-fallback-textarea-border-top-color-001.html.ini
@@ -0,0 +1,2 @@ +[kind-of-widget-fallback-textarea-border-top-color-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/outline-027.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/outline-027.html.ini new file mode 100644 index 0000000..2b8d019 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/outline-027.html.ini
@@ -0,0 +1,2 @@ +[outline-027.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid-expected.txt deleted file mode 100644 index c14f52fc..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid-expected.txt +++ /dev/null
@@ -1,45 +0,0 @@ -This is a testharness.js-based test. -PASS e.style['cursor'] = "auto" should set the property value -PASS e.style['cursor'] = "default" should set the property value -PASS e.style['cursor'] = "none" should set the property value -PASS e.style['cursor'] = "context-menu" should set the property value -PASS e.style['cursor'] = "help" should set the property value -PASS e.style['cursor'] = "pointer" should set the property value -PASS e.style['cursor'] = "progress" should set the property value -PASS e.style['cursor'] = "wait" should set the property value -PASS e.style['cursor'] = "cell" should set the property value -PASS e.style['cursor'] = "crosshair" should set the property value -PASS e.style['cursor'] = "text" should set the property value -PASS e.style['cursor'] = "vertical-text" should set the property value -PASS e.style['cursor'] = "alias" should set the property value -PASS e.style['cursor'] = "copy" should set the property value -PASS e.style['cursor'] = "move" should set the property value -PASS e.style['cursor'] = "no-drop" should set the property value -PASS e.style['cursor'] = "not-allowed" should set the property value -PASS e.style['cursor'] = "grab" should set the property value -PASS e.style['cursor'] = "grabbing" should set the property value -PASS e.style['cursor'] = "e-resize" should set the property value -PASS e.style['cursor'] = "n-resize" should set the property value -PASS e.style['cursor'] = "ne-resize" should set the property value -PASS e.style['cursor'] = "nw-resize" should set the property value -PASS e.style['cursor'] = "s-resize" should set the property value -PASS e.style['cursor'] = "se-resize" should set the property value -PASS e.style['cursor'] = "sw-resize" should set the property value -PASS e.style['cursor'] = "w-resize" should set the property value -PASS e.style['cursor'] = "ew-resize" should set the property value -PASS e.style['cursor'] = "ns-resize" should set the property value -PASS e.style['cursor'] = "nesw-resize" should set the property value -PASS e.style['cursor'] = "nwse-resize" should set the property value -PASS e.style['cursor'] = "col-resize" should set the property value -PASS e.style['cursor'] = "row-resize" should set the property value -PASS e.style['cursor'] = "all-scroll" should set the property value -PASS e.style['cursor'] = "zoom-in" should set the property value -PASS e.style['cursor'] = "zoom-out" should set the property value -PASS e.style['cursor'] = "url(\"https://example.com/\"), alias" should set the property value -PASS e.style['cursor'] = "url(\"https://example.com/\") 1 calc(2 + 0), copy" should set the property value -PASS e.style['cursor'] = "url(\"https://example.com/\"), url(\"https://example.com/\") 3 -4, move" should set the property value -PASS e.style['cursor'] = "url(\"https://example.com/\") 5 6, grab" should set the property value -FAIL e.style['cursor'] = "image-set(\"https://example.com/\" 1x) 5 6, grab" should set the property value assert_not_equals: property should be set got disallowed value "" -FAIL e.style['cursor'] = "image-set(\"https://example.com/\" 1x, \"https://example.com/highres\" 2x) 5 6, grab" should set the property value assert_not_equals: property should be set got disallowed value "" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html b/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html index 8b3c4783..a31a7ae 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html +++ b/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html
@@ -49,13 +49,60 @@ test_valid_value("cursor", "zoom-in"); test_valid_value("cursor", "zoom-out"); -test_valid_value("cursor", 'url("https://example.com/"), alias', ['url("https://example.com/"), alias', 'url(https://example.com/), alias']); -test_valid_value("cursor", 'url("https://example.com/") 1 calc(2 + 0), copy', ['url("https://example.com/") 1 calc(2), copy', 'url("https://example.com/") 1 2, copy', 'url(https://example.com/) 1 2, copy']); -test_valid_value("cursor", 'url("https://example.com/"), url("https://example.com/") 3 -4, move', ['url("https://example.com/"), url("https://example.com/") 3 -4, move', 'url(https://example.com/), url(https://example.com/) 3 -4, move']); -test_valid_value("cursor", 'url("https://example.com/") 5 6, grab', ['url("https://example.com/") 5 6, grab', 'url(https://example.com/) 5 6, grab']); +test_valid_value( + "cursor", + 'url("https://example.com/"), alias', + [ + 'url("https://example.com/"), alias', + 'url(https://example.com/), alias' + ] +); -test_valid_value("cursor", 'image-set("https://example.com/" 1x) 5 6, grab', ['image-set("https://example.com/" 1x) 5 6, grab', 'image-set("https://example.com/" 1x) 5 6, grab']); -test_valid_value("cursor", 'image-set("https://example.com/" 1x, "https://example.com/highres" 2x) 5 6, grab', ['image-set("https://example.com/" 1x, "https://example.com/highres" 2x) 5 6, grab', 'image-set("https://example.com/" 1x, "https://example.com/highres" 2x) 5 6, grab']); +test_valid_value( + "cursor", + 'url("https://example.com/") 1 calc(2 + 0), copy', + [ + 'url("https://example.com/") 1 calc(2), copy', + 'url("https://example.com/") 1 2, copy', + 'url(https://example.com/) 1 2, copy' + ] +); + +test_valid_value( + "cursor", + 'url("https://example.com/"), url("https://example.com/") 3 -4, move', + [ + 'url("https://example.com/"), url("https://example.com/") 3 -4, move', + 'url(https://example.com/), url(https://example.com/) 3 -4, move' + ] +); + +test_valid_value( + "cursor", + 'url("https://example.com/") 5 6, grab', + [ + 'url("https://example.com/") 5 6, grab', + 'url(https://example.com/) 5 6, grab' + ] +); + +test_valid_value( + "cursor", + 'image-set("https://example.com/" 1x) 5 6, grab', + [ + 'image-set(url("https://example.com/") 1x) 5 6, grab', + 'image-set(url(https://example.com/) 1x) 5 6, grab' + ] +); + +test_valid_value( + "cursor", + 'image-set("https://example.com/" 1x, "https://example.com/highres" 2x) 5 6, grab', + [ + 'image-set(url("https://example.com/") 1x, url("https://example.com/highres") 2x) 5 6, grab', + 'image-set(url(https://example.com/) 1x, url(https://example.com/highres) 2x) 5 6, grab' + ] +); </script> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html.ini b/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html.ini deleted file mode 100644 index 91d5895..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-ui/parsing/cursor-valid.html.ini +++ /dev/null
@@ -1,6 +0,0 @@ -[cursor-valid.html] - [e.style['cursor'\] = "image-set(\\"https://example.com/\\" 1x) 5 6, grab" should set the property value] - expected: FAIL - - [e.style['cursor'\] = "image-set(\\"https://example.com/\\" 1x, \\"https://example.com/highres\\" 2x) 5 6, grab" should set the property value] - expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-view-transitions/view-transition-name-is-backdrop-filter-root.html.ini b/third_party/blink/web_tests/external/wpt/css/css-view-transitions/view-transition-name-is-backdrop-filter-root.html.ini new file mode 100644 index 0000000..485ca4c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-view-transitions/view-transition-name-is-backdrop-filter-root.html.ini
@@ -0,0 +1,2 @@ +[view-transition-name-is-backdrop-filter-root.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/fontname.js b/third_party/blink/web_tests/external/wpt/editing/data/fontname.js index b42be89c..8c34a5a 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/fontname.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/fontname.js
@@ -492,12 +492,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo<span style=\"font-family: monospace\">b[a]r</span>baz", [["stylewithcss","true"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">b<span style=\"font-family:sans-serif\">[a]</span>r</span>baz", + "foo<span style=\"font-family:monospace\">b</span><span style=\"font-family:sans-serif\">[a]</span><span style=\"font-family:monospace\">r</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo<span style=\"font-family: monospace\">b[a]r</span>baz", [["stylewithcss","false"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">b<font face=\"sans-serif\">[a]</font>r</span>baz", + "foo<span style=\"font-family:monospace\">b</span><font face=\"sans-serif\">[a]</font><span style=\"font-family:monospace\">r</span>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo<tt contenteditable=false>ba[r</tt>b]az", @@ -537,22 +537,22 @@ {"stylewithcss":[false,true,"",false,false,""],"fontname":[true,false,"monospace",false,false,"sans-serif"]}], ["fo[o<span style=font-family:monospace>b]ar</span>baz", [["stylewithcss","true"],["fontname","sans-serif"]], - "fo<span style=\"font-family:sans-serif\">[o</span><span style=\"font-family:monospace\"><span style=\"font-family:sans-serif\">b]</span>ar</span>baz", + "fo<span style=\"font-family:sans-serif\">[ob]</span><span style=\"font-family:monospace\">ar</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[true,false,"serif",false,false,"sans-serif"]}], ["fo[o<span style=font-family:monospace>b]ar</span>baz", [["stylewithcss","false"],["fontname","sans-serif"]], - "fo<font face=\"sans-serif\">[o</font><span style=\"font-family:monospace\"><font face=\"sans-serif\">b]</font>ar</span>baz", + "fo<font face=\"sans-serif\">[ob]</font><span style=\"font-family:monospace\">ar</span>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[true,false,"serif",false,false,"sans-serif"]}], ["foo<span style=font-family:monospace>ba[r</span>b]az", [["stylewithcss","true"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">ba<span style=\"font-family:sans-serif\">[r</span></span><span style=\"font-family:sans-serif\">b]</span>az", + "foo<span style=\"font-family:monospace\">ba</span><span style=\"font-family:sans-serif\">[rb]</span>az", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[true,false,"monospace",false,false,"sans-serif"]}], ["foo<span style=font-family:monospace>ba[r</span>b]az", [["stylewithcss","false"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">ba<font face=\"sans-serif\">[r</font></span><font face=\"sans-serif\">b]</font>az", + "foo<span style=\"font-family:monospace\">ba</span><font face=\"sans-serif\">[rb]</font>az", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[true,false,"monospace",false,false,"sans-serif"]}], ["fo[o<span style=font-family:monospace>bar</span>b]az", @@ -567,22 +567,22 @@ {"stylewithcss":[false,true,"",false,false,""],"fontname":[true,false,"serif",false,false,"sans-serif"]}], ["foo[<span style=font-family:monospace>b]ar</span>baz", [["stylewithcss","true"],["fontname","sans-serif"]], - "foo[<span style=\"font-family:monospace\"><span style=\"font-family:sans-serif\">b]</span>ar</span>baz", + "foo<span style=\"font-family:sans-serif\">[b]</span><span style=\"font-family:monospace\">ar</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo[<span style=font-family:monospace>b]ar</span>baz", [["stylewithcss","false"],["fontname","sans-serif"]], - "foo[<span style=\"font-family:monospace\"><font face=\"sans-serif\">b]</font>ar</span>baz", + "foo<font face=\"sans-serif\">[b]</font><span style=\"font-family:monospace\">ar</span>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo<span style=font-family:monospace>ba[r</span>]baz", [["stylewithcss","true"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">ba<span style=\"font-family:sans-serif\">[r</span></span>]baz", + "foo<span style=\"font-family:monospace\">ba</span><span style=\"font-family:sans-serif\">[r]</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo<span style=font-family:monospace>ba[r</span>]baz", [["stylewithcss","false"],["fontname","sans-serif"]], - "foo<span style=\"font-family:monospace\">ba<font face=\"sans-serif\">[r</font></span>]baz", + "foo<span style=\"font-family:monospace\">ba</span><font face=\"sans-serif\">[r]</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["foo[<span style=font-family:monospace>bar</span>]baz", @@ -697,12 +697,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>", [["stylewithcss","true"],["fontname","sans-serif"]], - "<span style=\"font-family:monospace\">fo<span style=\"font-family:sans-serif\">[o</span></span><kbd><span style=\"font-family:sans-serif\">b]</span>ar</kbd>", + "<span style=\"font-family:monospace\">fo</span><span style=\"font-family:sans-serif\">[o</span><kbd><span style=\"font-family:sans-serif\">b]</span>ar</kbd>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}], ["<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>", [["stylewithcss","false"],["fontname","sans-serif"]], - "<span style=\"font-family:monospace\">fo<font face=\"sans-serif\">[o</font></span><kbd><font face=\"sans-serif\">b]</font>ar</kbd>", + "<span style=\"font-family:monospace\">fo</span><font face=\"sans-serif\">[o</font><kbd><font face=\"sans-serif\">b]</font>ar</kbd>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontname":[false,false,"monospace",false,false,"sans-serif"]}],
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/fontsize.js b/third_party/blink/web_tests/external/wpt/editing/data/fontsize.js index bbaa6d84..d048375 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/fontsize.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/fontsize.js
@@ -372,12 +372,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"1",false,false,"4"]}], ["<font size=1>foo[bar]baz</font>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"1\">foo<span style=\"font-size:large\">[bar]</span>baz</font>", + "<font size=\"1\">foo</font><span style=\"font-size:large\">[bar]</span><font size=\"1\">baz</font>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"1",false,false,"4"]}], ["<font size=1>foo[bar]baz</font>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"1\">foo<font size=\"4\">[bar]</font>baz</font>", + "<font size=\"1\">foo</font><font size=\"4\">[bar]</font><font size=\"1\">baz</font>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"1",false,false,"4"]}], ["foo<font size=3>[bar]</font>baz", @@ -392,12 +392,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<font size=3>foo[bar]baz</font>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"3\">foo<span style=\"font-size:large\">[bar]</span>baz</font>", + "<font size=\"3\">foo</font><span style=\"font-size:large\">[bar]</span><font size=\"3\">baz</font>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<font size=3>foo[bar]baz</font>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"3\">foo<font size=\"4\">[bar]</font>baz</font>", + "<font size=\"3\">foo</font><font size=\"4\">[bar]</font><font size=\"3\">baz</font>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}], ["foo<font size=4>[bar]</font>baz", @@ -452,12 +452,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"1",false,false,"4"]}], ["<span style=\"font-size: xx-small\">foo[bar]baz</span>", [["stylewithcss","true"],["fontsize","4"]], - "<span style=\"font-size:xx-small\">foo<span style=\"font-size:large\">[bar]</span>baz</span>", + "<span style=\"font-size:xx-small\">foo</span><span style=\"font-size:large\">[bar]</span><span style=\"font-size:xx-small\">baz</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"1",false,false,"4"]}], ["<span style=\"font-size: xx-small\">foo[bar]baz</span>", [["stylewithcss","false"],["fontsize","4"]], - "<span style=\"font-size:xx-small\">foo<font size=\"4\">[bar]</font>baz</span>", + "<span style=\"font-size:xx-small\">foo</span><font size=\"4\">[bar]</font><span style=\"font-size:xx-small\">baz</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"1",false,false,"4"]}], ["foo<span style=\"font-size: medium\">[bar]</span>baz", @@ -472,12 +472,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<span style=\"font-size: medium\">foo[bar]baz</span>", [["stylewithcss","true"],["fontsize","4"]], - "<span style=\"font-size:medium\">foo<span style=\"font-size:large\">[bar]</span>baz</span>", + "<span style=\"font-size:medium\">foo</span><span style=\"font-size:large\">[bar]</span><span style=\"font-size:medium\">baz</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<span style=\"font-size: medium\">foo[bar]baz</span>", [["stylewithcss","false"],["fontsize","4"]], - "<span style=\"font-size:medium\">foo<font size=\"4\">[bar]</font>baz</span>", + "<span style=\"font-size:medium\">foo</span><font size=\"4\">[bar]</font><span style=\"font-size:medium\">baz</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}], ["foo<span style=\"font-size: large\">[bar]</span>baz", @@ -517,12 +517,12 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"6",false,false,"4"]}], ["<span style=\"font-size: 2em\">foo[bar]baz</span>", [["stylewithcss","true"],["fontsize","4"]], - "<span style=\"font-size:2em\">foo<span style=\"font-size:large\">[bar]</span>baz</span>", + "<span style=\"font-size:2em\">foo</span><span style=\"font-size:large\">[bar]</span><span style=\"font-size:2em\">baz</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"6",false,false,"4"]}], ["<span style=\"font-size: 2em\">foo[bar]baz</span>", [["stylewithcss","false"],["fontsize","4"]], - "<span style=\"font-size:2em\">foo<font size=\"4\">[bar]</font>baz</span>", + "<span style=\"font-size:2em\">foo</span><font size=\"4\">[bar]</font><span style=\"font-size:2em\">baz</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"6",false,false,"4"]}], ["<p style=\"font-size: xx-small\">foo[bar]baz</p>", @@ -647,22 +647,22 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"2",false,false,"3"]}], ["fo[o<font size=2>b]ar</font>baz", [["stylewithcss","true"],["fontsize","4"]], - "fo<span style=\"font-size:large\">[o</span><font size=\"2\"><span style=\"font-size:large\">b]</span>ar</font>baz", + "fo<span style=\"font-size:large\">[ob]</span><font size=\"2\">ar</font>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[true,false,"3",false,false,"4"]}], ["fo[o<font size=2>b]ar</font>baz", [["stylewithcss","false"],["fontsize","4"]], - "fo<font size=\"4\">[o</font><font size=\"2\"><font size=\"4\">b]</font>ar</font>baz", + "fo<font size=\"4\">[ob]</font><font size=\"2\">ar</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[true,false,"3",false,false,"4"]}], ["foo<font size=2>ba[r</font>b]az", [["stylewithcss","true"],["fontsize","4"]], - "foo<font size=\"2\">ba<span style=\"font-size:large\">[r</span></font><span style=\"font-size:large\">b]</span>az", + "foo<font size=\"2\">ba</font><span style=\"font-size:large\">[rb]</span>az", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[true,false,"2",false,false,"4"]}], ["foo<font size=2>ba[r</font>b]az", [["stylewithcss","false"],["fontsize","4"]], - "foo<font size=\"2\">ba<font size=\"4\">[r</font></font><font size=\"4\">b]</font>az", + "foo<font size=\"2\">ba</font><font size=\"4\">[rb]</font>az", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[true,false,"2",false,false,"4"]}], ["fo[o<font size=2>bar</font>b]az", @@ -677,22 +677,22 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[true,false,"3",false,false,"4"]}], ["foo[<font size=2>b]ar</font>baz", [["stylewithcss","true"],["fontsize","4"]], - "foo[<font size=\"2\"><span style=\"font-size:large\">b]</span>ar</font>baz", + "foo<span style=\"font-size:large\">b</span><font size=\"2\">ar</font>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"2",false,false,"4"]}], ["foo[<font size=2>b]ar</font>baz", [["stylewithcss","false"],["fontsize","4"]], - "foo[<font size=\"2\"><font size=\"4\">b]</font>ar</font>baz", + "foo<font size=\"4\">[b]</font><font size=\"2\">ar</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"2",false,false,"4"]}], ["foo<font size=2>ba[r</font>]baz", [["stylewithcss","true"],["fontsize","4"]], - "foo<font size=\"2\">ba<span style=\"font-size:large\">[r</span></font>]baz", + "foo<font size=\"2\">ba</font><span style=\"font-size:large\">r</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"2",false,false,"4"]}], ["foo<font size=2>ba[r</font>]baz", [["stylewithcss","false"],["fontsize","4"]], - "foo<font size=\"2\">ba<font size=\"4\">[r</font></font>]baz", + "foo<font size=\"2\">ba</font><font size=\"4\">[r]</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"2",false,false,"4"]}], ["foo[<font size=2>bar</font>]baz", @@ -727,32 +727,32 @@ {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"2",false,false,"4"]}], ["<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"1\">fo<span style=\"font-size:large\">[o</span></font><span style=\"font-size:xx-small\"><span style=\"font-size:large\">b]</span>ar</span>", + "<font size=\"1\">fo</font><span style=\"font-size:large\">[ob]</span><span style=\"font-size:xx-small\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[true,false,"1",false,false,"4"]}], ["<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"1\">fo<font size=\"4\">[o</font></font><span style=\"font-size:xx-small\"><font size=\"4\">b]</font>ar</span>", + "<font size=\"1\">fo</font><font size=\"4\">[ob]</font><span style=\"font-size:xx-small\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[true,false,"1",false,false,"4"]}], ["<font size=2>fo[o</font><span style=font-size:small>b]ar</span>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"2\">fo<span style=\"font-size:large\">[o</span></font><span style=\"font-size:small\"><span style=\"font-size:large\">b]</span>ar</span>", + "<font size=\"2\">fo</font><span style=\"font-size:large\">[ob]</span><span style=\"font-size:small\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"2",false,false,"4"]}], ["<font size=2>fo[o</font><span style=font-size:small>b]ar</span>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"2\">fo<font size=\"4\">[o</font></font><span style=\"font-size:small\"><font size=\"4\">b]</font>ar</span>", + "<font size=\"2\">fo</font><font size=\"4\">[ob]</font><span style=\"font-size:small\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"2",false,false,"4"]}], ["<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"3\">fo<span style=\"font-size:large\">[o</span></font><span style=\"font-size:medium\"><span style=\"font-size:large\">b]</span>ar</span>", + "<font size=\"3\">fo</font><span style=\"font-size:large\">[ob]</span><span style=\"font-size:medium\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"3\">fo<font size=\"4\">[o</font></font><span style=\"font-size:medium\"><font size=\"4\">b]</font>ar</span>", + "<font size=\"3\">fo</font><font size=\"4\">ob</font><span style=\"font-size:medium\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"3",false,false,"4"]}], ["<font size=4>fo[o</font><span style=font-size:large>b]ar</span>", @@ -762,22 +762,22 @@ {"fontsize":[false,false,"4",false,false,"4"]}], ["<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"5\">fo<span style=\"font-size:large\">[o</span></font><span style=\"font-size:x-large\"><span style=\"font-size:large\">b]</span>ar</span>", + "<font size=\"5\">fo</font><span style=\"font-size:large\">[ob]</span><span style=\"font-size:x-large\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"5",false,false,"4"]}], ["<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"5\">fo<font size=\"4\">[o</font></font><span style=\"font-size:x-large\"><font size=\"4\">b]</font>ar</span>", + "<font size=\"5\">fo</font><font size=\"4\">[ob]</font><span style=\"font-size:x-large\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"5",false,false,"4"]}], ["<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>", [["stylewithcss","true"],["fontsize","4"]], - "<font size=\"6\">fo<span style=\"font-size:large\">[o</span></font><span style=\"font-size:xx-large\"><span style=\"font-size:large\">b]</span>ar</span>", + "<font size=\"6\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:xx-large\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"fontsize":[false,false,"6",false,false,"4"]}], ["<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>", [["stylewithcss","false"],["fontsize","4"]], - "<font size=\"6\">fo<font size=\"4\">[o</font></font><span style=\"font-size:xx-large\"><font size=\"4\">b]</font>ar</span>", + "<font size=\"6\">fo</font><font size=\"4\">ob</font><span style=\"font-size:xx-large\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"fontsize":[false,false,"6",false,false,"4"]}], @@ -825,4 +825,41 @@ "<font face=\"monospace\">ab<font size=\"7\">[c]</font></font>", [true,true], {}], + +// font-size should be removed when applying fontsize without CSS. +// Blink and WebKit puts <font size="..."> into the <span> element in these +// test cases. However, this behavior may cause the background color is +// partially applied to the text because the height is computed without the +// <font>. Therefore, it may be better to put <font> outside any inline +// ancestors. +["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc]</span>", + [["styleWithCSS","false"],["fontSize","5"]], + ["<span style=\"background-color:rgb(0, 128, 128)\"><font size=\"5\">[abc]</font></span>", + "<font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[abc]</span></font>"], + [true,true], + {}], +["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[a]bc</span>", + [["styleWithCSS","false"],["fontSize","5"]], + ["<span style=\"background-color:rgb(0, 128, 128)\"><font size=\"5\">[a]</font></span><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">bc</span>", + "<font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[a]</span></font><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">bc</span>"], + [true,true], + {}], +["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a[b]c</span>", + [["styleWithCSS","false"],["fontSize","5"]], + ["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a</span><span style=\"background-color:rgb(0, 128, 128)\"><font size=\"5\">[b]</font></span><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">c</span>", + "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a</span><font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[b]</span></font><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">c</span>"], + [true,true], + {}], +["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab[c]</span>", + [["styleWithCSS","false"],["fontSize","5"]], + ["<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab</span><span style=\"background-color:rgb(0, 128, 128)\"><font size=\"5\">[c]</font></span>", + "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab</span><font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[c]</span></font>"], + [true,true], + {}], +["<p><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc</span></p><p><span style=\"font-size:64px; background-color:rgb(128, 128, 0)\">def]</span></p>", + [["styleWithCSS","false"],["fontSize","5"]], + ["<p><span style=\"background-color:rgb(0, 128, 128)\"><font size=\"5\">[abc</font></span></p><p><span style=\"background-color:rgb(128, 128, 0)\"><font size=\"5\">def]</font></span></p>", + "<p><font size=\"5\"><span style=\"background-color:rgb(0, 128, 128)\">[abc</span></font></p><p><font size=\"5\"><span style=\"background-color:rgb(128, 128, 0)\">def]</span></font></p>"], + [true,true], + {}], ]
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/forecolor.js b/third_party/blink/web_tests/external/wpt/editing/data/forecolor.js index fde8364be..efca197 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/forecolor.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/forecolor.js
@@ -372,12 +372,12 @@ {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 255)",false,false,"rgb(0, 0, 255)"]}], ["<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>", [["stylewithcss","true"],["forecolor","#0000FF"]], - "<span style=\"color:rgb(0, 0, 255)\">foo[bar]baz</span>", + "<span style=\"color:rgb(0, 0, 255)\">foo</span><span style=\"color:rgb(0, 0, 255)\">bar</span><span style=\"color:rgb(0, 0, 255)\">baz</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>", [["stylewithcss","false"],["forecolor","#0000FF"]], - "<span style=\"color:rgb(0, 0, 255)\">foo[bar]baz</span>", + "<span style=\"color:rgb(0, 0, 255)\">foo</span><font color=\"#0000ff\">[bar]</font><span style=\"color:rgb(0, 0, 255)\">baz</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<span style=\"color: #00f\">foo<span style=\"color: brown\">[bar]</span>baz</span>", @@ -440,6 +440,8 @@ "foo<span id=\"purple\">ba<font color=\"#0000ff\">[r</font></span><font color=\"#0000ff\">ba]</font>z", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[true,false,"rgb(128, 0, 128)",false,false,"rgb(0, 0, 255)"]}], +// XXX Looks like that there is no good solution for this case because id=purple +// may affect the style, but it's unclear for builtin editors of the browsers. ["<span style=\"color: rgb(0, 0, 255)\">foo<span id=purple>b[a]r</span>baz</span>", [["stylewithcss","true"],["forecolor","#0000FF"]], "<span style=\"color:rgb(0, 0, 255)\">foo<span id=\"purple\">b<span style=\"color:rgb(0, 0, 255)\">[a]</span>r</span>baz</span>", @@ -637,22 +639,22 @@ {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}], ["fo[o<font color=brown>b]ar</font>baz", [["stylewithcss","true"],["forecolor","#0000FF"]], - "fo<span style=\"color:rgb(0, 0, 255)\">[o</span><font color=\"brown\"><span style=\"color:rgb(0, 0, 255)\">b]</span>ar</font>baz", + "fo<span style=\"color:rgb(0, 0, 255)\">[ob]</span><font color=\"brown\">ar</font>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[true,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}], ["fo[o<font color=brown>b]ar</font>baz", [["stylewithcss","false"],["forecolor","#0000FF"]], - "fo<font color=\"#0000ff\">[o</font><font color=\"brown\"><font color=\"#0000ff\">b]</font>ar</font>baz", + "fo<font color=\"#0000ff\">[ob]</font><font color=\"brown\">ar</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[true,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}], ["foo<font color=brown>ba[r</font>b]az", [["stylewithcss","true"],["forecolor","#0000FF"]], - "foo<font color=\"brown\">ba<span style=\"color:rgb(0, 0, 255)\">[r</span></font><span style=\"color:rgb(0, 0, 255)\">b]</span>az", + "foo<font color=\"brown\">ba</font><span style=\"color:rgb(0, 0, 255)\">[rb]</span>az", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[true,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["foo<font color=brown>ba[r</font>b]az", [["stylewithcss","false"],["forecolor","#0000FF"]], - "foo<font color=\"brown\">ba<font color=\"#0000ff\">[r</font></font><font color=\"#0000ff\">b]</font>az", + "foo<font color=\"brown\">ba</font><font color=\"#0000ff\">[rb]</font>az", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[true,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["fo[o<font color=brown>bar</font>b]az", @@ -667,22 +669,22 @@ {"stylewithcss":[false,true,"",false,false,""],"forecolor":[true,false,"rgb(0, 0, 0)",false,false,"rgb(0, 0, 255)"]}], ["foo[<font color=brown>b]ar</font>baz", [["stylewithcss","true"],["forecolor","#0000FF"]], - "foo[<font color=\"brown\"><span style=\"color:rgb(0, 0, 255)\">b]</span>ar</font>baz", + "foo<span style=\"color:rgb(0, 0, 255)\">[b]</span><font color=\"brown\">ar</font>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["foo[<font color=brown>b]ar</font>baz", [["stylewithcss","false"],["forecolor","#0000FF"]], - "foo[<font color=\"brown\"><font color=\"#0000ff\">b]</font>ar</font>baz", + "foo<font color=\"#0000ff\">[b]</font><font color=\"brown\">ar</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["foo<font color=brown>ba[r</font>]baz", [["stylewithcss","true"],["forecolor","#0000FF"]], - "foo<font color=\"brown\">ba<span style=\"color:rgb(0, 0, 255)\">[r</span></font>]baz", + "foo<font color=\"brown\">ba</font><span style=\"color:rgb(0, 0, 255)\">[r]</span>baz", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["foo<font color=brown>ba[r</font>]baz", [["stylewithcss","false"],["forecolor","#0000FF"]], - "foo<font color=\"brown\">ba<font color=\"#0000ff\">[r</font></font>]baz", + "foo<font color=\"brown\">ba</font><font color=\"#0000ff\">[r]</font>baz", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["foo[<font color=brown>bar</font>]baz", @@ -717,22 +719,22 @@ {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<font color=brown>fo[o</font><span style=color:brown>b]ar</span>", [["stylewithcss","true"],["forecolor","#0000FF"]], - "<font color=\"brown\">fo<span style=\"color:rgb(0, 0, 255)\">[o</span></font><span style=\"color:rgb(165, 42, 42)\"><span style=\"color:rgb(0, 0, 255)\">b]</span>ar</span>", + "<font color=\"brown\">fo</font><span style=\"color:rgb(0, 0, 255)\">[ob]</span><span style=\"color:rgb(165, 42, 42)\">ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<font color=brown>fo[o</font><span style=color:brown>b]ar</span>", [["stylewithcss","false"],["forecolor","#0000FF"]], - "<font color=\"brown\">fo<font color=\"#0000ff\">[o</font></font><span style=\"color:rgb(165, 42, 42)\"><font color=\"#0000ff\">b]</font>ar</span>", + "<font color=\"brown\">fo</font><font color=\"#0000ff\">ob</font><span style=\"color:rgb(165, 42, 42)\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[false,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>", [["stylewithcss","true"],["forecolor","#0000FF"]], - "<span style=\"color:rgb(165, 42, 42)\">fo<span style=\"color:rgb(0, 0, 255)\">[o</span></span><span style=\"color:rgb(0, 0, 255)\">b]ar</span>", + "<span style=\"color:rgb(165, 42, 42)\">fo</span><span style=\"color:rgb(0, 0, 255)\">[ob]ar</span>", [true,true], {"stylewithcss":[false,false,"",false,true,""],"forecolor":[true,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}], ["<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>", [["stylewithcss","false"],["forecolor","#0000FF"]], - "<span style=\"color:rgb(165, 42, 42)\">fo<font color=\"#0000ff\">[o</font></span><span style=\"color:rgb(0, 0, 255)\">b]ar</span>", + "<span style=\"color:rgb(165, 42, 42)\">fo</span><font color=\"#0000ff\">[ob]</font><span style=\"color:rgb(0, 0, 255)\">ar</span>", [true,true], {"stylewithcss":[false,true,"",false,false,""],"forecolor":[true,false,"rgb(165, 42, 42)",false,false,"rgb(0, 0, 255)"]}],
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/fontname_1001-2000-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/fontname_1001-2000-expected.txt index c92c694..9a44385 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/fontname_1001-2000-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/fontname_1001-2000-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1000 tests; 926 PASS, 74 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1000 tests; 936 PASS, 64 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS [["stylewithcss","false"],["fontname","sans-serif"]] "[foo<pre>bar</pre>baz]" queryCommandState("fontname") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "[foo<pre>bar</pre>baz]" queryCommandValue("fontname") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "[foo<pre>bar</pre>baz]" queryCommandIndeterm("fontname") after @@ -529,7 +529,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">b<span style=\"font-family:sans-serif\">a</span>r</span>baz" but got "foo<span style=\"font-family:monospace\">b</span><span style=\"font-family:sans-serif\">a</span><span style=\"font-family:monospace\">r</span>baz" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandValue("stylewithcss") before @@ -545,7 +545,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">b<font face=\"sans-serif\">a</font>r</span>baz" but got "foo<span style=\"font-family:monospace\">b</span><font face=\"sans-serif\">a</font><span style=\"font-family:monospace\">r</span>baz" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=\"font-family: monospace\">b[a]r</span>baz" queryCommandValue("stylewithcss") before @@ -652,7 +652,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<span style=\"font-family:sans-serif\">o</span><span style=\"font-family:monospace\"><span style=\"font-family:sans-serif\">b</span>ar</span>baz" but got "fo<span style=\"font-family:sans-serif\">ob</span><span style=\"font-family:monospace\">ar</span>baz" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandValue("stylewithcss") before @@ -668,7 +668,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<font face=\"sans-serif\">o</font><span style=\"font-family:monospace\"><font face=\"sans-serif\">b</font>ar</span>baz" but got "fo<font face=\"sans-serif\">ob</font><span style=\"font-family:monospace\">ar</span>baz" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<span style=font-family:monospace>b]ar</span>baz" queryCommandValue("stylewithcss") before @@ -684,7 +684,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">ba<span style=\"font-family:sans-serif\">r</span></span><span style=\"font-family:sans-serif\">b</span>az" but got "foo<span style=\"font-family:monospace\">ba</span><span style=\"font-family:sans-serif\">rb</span>az" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandValue("stylewithcss") before @@ -700,7 +700,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">ba<font face=\"sans-serif\">r</font></span><font face=\"sans-serif\">b</font>az" but got "foo<span style=\"font-family:monospace\">ba</span><font face=\"sans-serif\">rb</font>az" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>b]az" queryCommandValue("stylewithcss") before @@ -748,7 +748,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\"><span style=\"font-family:sans-serif\">b</span>ar</span>baz" but got "foo<span style=\"font-family:sans-serif\">b</span><span style=\"font-family:monospace\">ar</span>baz" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandValue("stylewithcss") before @@ -764,7 +764,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\"><font face=\"sans-serif\">b</font>ar</span>baz" but got "foo<font face=\"sans-serif\">b</font><span style=\"font-family:monospace\">ar</span>baz" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo[<span style=font-family:monospace>b]ar</span>baz" queryCommandValue("stylewithcss") before @@ -780,7 +780,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">ba<span style=\"font-family:sans-serif\">r</span></span>baz" but got "foo<span style=\"font-family:monospace\">ba</span><span style=\"font-family:sans-serif\">r</span>baz" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandValue("stylewithcss") before @@ -796,7 +796,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<span style=\"font-family:monospace\">ba<font face=\"sans-serif\">r</font></span>baz" but got "foo<span style=\"font-family:monospace\">ba</span><font face=\"sans-serif\">r</font>baz" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "foo<span style=font-family:monospace>ba[r</span>]baz" queryCommandValue("stylewithcss") before
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/fontname_2001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/fontname_2001-last-expected.txt index 540717f..143171bb 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/fontname_2001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/fontname_2001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 221 tests; 211 PASS, 10 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 221 tests; 213 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "fo[o<listing>b]ar</listing>" queryCommandValue("fontname") after assert_equals: Wrong result returned expected "sans-serif" but got "serif" PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<pre>b]ar</pre>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "fo[o<pre>b]ar</pre>": execCommand("fontname", false, "sans-serif") return value @@ -164,7 +164,7 @@ PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-family:monospace\">fo<span style=\"font-family:sans-serif\">o</span></span><kbd><span style=\"font-family:sans-serif\">b</span>ar</kbd>" but got "<span style=\"font-family:monospace\">fo</span><span style=\"font-family:sans-serif\">o</span><kbd><span style=\"font-family:sans-serif\">b</span>ar</kbd>" +PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" compare innerHTML PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandValue("stylewithcss") before @@ -180,7 +180,7 @@ PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>": execCommand("fontname", false, "sans-serif") return value PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-family:monospace\">fo<font face=\"sans-serif\">o</font></span><kbd><font face=\"sans-serif\">b</font>ar</kbd>" but got "<span style=\"font-family:monospace\">fo</span><font face=\"sans-serif\">o</font><kbd><font face=\"sans-serif\">b</font>ar</kbd>" +PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" compare innerHTML PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontname","sans-serif"]] "<span style=font-family:monospace>fo[o</span><kbd>b]ar</kbd>" queryCommandValue("stylewithcss") before
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/fontsize_1001-2000-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/fontsize_1001-2000-expected.txt index a1ee1f7..d8455b0 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/fontsize_1001-2000-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/fontsize_1001-2000-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1000 tests; 944 PASS, 56 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1000 tests; 958 PASS, 42 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS [["stylewithcss","false"],["fontsize","4"]] "<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>" queryCommandValue("fontsize") before PASS [["stylewithcss","false"],["fontsize","4"]] "<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>" queryCommandIndeterm("fontsize") after PASS [["stylewithcss","false"],["fontsize","4"]] "<table><tbody data-start=0 data-end=1><tr><td>foo<td>bar<td>baz</table>" queryCommandState("fontsize") after @@ -103,7 +103,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"1\">foo<span style=\"font-size:large\">bar</span>baz</font>" but got "<font size=\"1\">foo</font><span style=\"font-size:large\">bar</span><font size=\"1\">baz</font>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandValue("stylewithcss") before @@ -119,7 +119,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"1\">foo<font size=\"4\">bar</font>baz</font>" but got "<font size=\"1\">foo</font><font size=\"4\">bar</font><font size=\"1\">baz</font>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>foo[bar]baz</font>" queryCommandValue("stylewithcss") before @@ -167,7 +167,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"3\">foo<span style=\"font-size:large\">bar</span>baz</font>" but got "<font size=\"3\">foo</font><span style=\"font-size:large\">bar</span><font size=\"3\">baz</font>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandValue("stylewithcss") before @@ -183,7 +183,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"3\">foo<font size=\"4\">bar</font>baz</font>" but got "<font size=\"3\">foo</font><font size=\"4\">bar</font><font size=\"3\">baz</font>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>foo[bar]baz</font>" queryCommandValue("stylewithcss") before @@ -345,7 +345,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:xx-small\">foo<span style=\"font-size:large\">bar</span>baz</span>" but got "<span style=\"font-size:xx-small\">foo</span><span style=\"font-size:large\">bar</span><span style=\"font-size:xx-small\">baz</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -361,7 +361,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:xx-small\">foo<font size=\"4\">bar</font>baz</span>" but got "<span style=\"font-size:xx-small\">foo</span><font size=\"4\">bar</font><span style=\"font-size:xx-small\">baz</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: xx-small\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -409,7 +409,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:medium\">foo<span style=\"font-size:large\">bar</span>baz</span>" but got "<span style=\"font-size:medium\">foo</span><span style=\"font-size:large\">bar</span><span style=\"font-size:medium\">baz</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -425,7 +425,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:medium\">foo<font size=\"4\">bar</font>baz</span>" but got "<span style=\"font-size:medium\">foo</span><font size=\"4\">bar</font><span style=\"font-size:medium\">baz</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: medium\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -546,7 +546,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:2em\">foo<span style=\"font-size:large\">bar</span>baz</span>" but got "<span style=\"font-size:2em\">foo</span><span style=\"font-size:large\">bar</span><span style=\"font-size:2em\">baz</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -562,7 +562,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"font-size:2em\">foo<font size=\"4\">bar</font>baz</span>" but got "<span style=\"font-size:2em\">foo</span><font size=\"4\">bar</font><span style=\"font-size:2em\">baz</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<span style=\"font-size: 2em\">foo[bar]baz</span>" queryCommandValue("stylewithcss") before @@ -948,7 +948,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<span style=\"font-size:large\">o</span><font size=\"2\"><span style=\"font-size:large\">b</span>ar</font>baz" but got "fo<span style=\"font-size:large\">ob</span><font size=\"2\">ar</font>baz" +PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -964,7 +964,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<font size=\"4\">o</font><font size=\"2\"><font size=\"4\">b</font>ar</font>baz" but got "fo<font size=\"4\">ob</font><font size=\"2\">ar</font>baz" +PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "fo[o<font size=2>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -980,7 +980,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\">ba<span style=\"font-size:large\">r</span></font><span style=\"font-size:large\">b</span>az" but got "foo<font size=\"2\">ba</font><span style=\"font-size:large\">rb</span>az" +PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandValue("stylewithcss") before @@ -996,7 +996,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\">ba<font size=\"4\">r</font></font><font size=\"4\">b</font>az" but got "foo<font size=\"2\">ba</font><font size=\"4\">rb</font>az" +PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandValue("stylewithcss") before
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/fontsize_2001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/fontsize_2001-last-expected.txt index 1abfb6a..8e9d63a 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/fontsize_2001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/fontsize_2001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 398 tests; 375 PASS, 23 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 418 tests; 409 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandIndeterm("stylewithcss") after FAIL [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandState("stylewithcss") after assert_equals: Wrong result returned expected false but got true PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>b]az" queryCommandValue("stylewithcss") after @@ -44,7 +44,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\"><span style=\"font-size:large\">b</span>ar</font>baz" but got "foo<span style=\"font-size:large\">b</span><font size=\"2\">ar</font>baz" +PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -60,7 +60,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\"><font size=\"4\">b</font>ar</font>baz" but got "foo<font size=\"4\">b</font><font size=\"2\">ar</font>baz" +PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo[<font size=2>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -76,7 +76,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\">ba<span style=\"font-size:large\">r</span></font>baz" but got "foo<font size=\"2\">ba</font><span style=\"font-size:large\">r</span>baz" +PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandValue("stylewithcss") before @@ -92,7 +92,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font size=\"2\">ba<font size=\"4\">r</font></font>baz" but got "foo<font size=\"2\">ba</font><font size=\"4\">r</font>baz" +PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "foo<font size=2>ba[r</font>]baz" queryCommandValue("stylewithcss") before @@ -204,7 +204,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"1\">fo<span style=\"font-size:large\">o</span></font><span style=\"font-size:xx-small\"><span style=\"font-size:large\">b</span>ar</span>" but got "<font size=\"1\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:xx-small\">ar</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandValue("stylewithcss") before @@ -220,7 +220,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"1\">fo<font size=\"4\">o</font></font><span style=\"font-size:xx-small\"><font size=\"4\">b</font>ar</span>" but got "<font size=\"1\">fo</font><font size=\"4\">ob</font><span style=\"font-size:xx-small\">ar</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=1>fo[o</font><span style=font-size:xx-small>b]ar</span>" queryCommandValue("stylewithcss") before @@ -236,7 +236,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"2\">fo<span style=\"font-size:large\">o</span></font><span style=\"font-size:small\"><span style=\"font-size:large\">b</span>ar</span>" but got "<font size=\"2\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:small\">ar</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandValue("stylewithcss") before @@ -252,7 +252,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"2\">fo<font size=\"4\">o</font></font><span style=\"font-size:small\"><font size=\"4\">b</font>ar</span>" but got "<font size=\"2\">fo</font><font size=\"4\">ob</font><span style=\"font-size:small\">ar</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=2>fo[o</font><span style=font-size:small>b]ar</span>" queryCommandValue("stylewithcss") before @@ -268,7 +268,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"3\">fo<span style=\"font-size:large\">o</span></font><span style=\"font-size:medium\"><span style=\"font-size:large\">b</span>ar</span>" but got "<font size=\"3\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:medium\">ar</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandValue("stylewithcss") before @@ -284,7 +284,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"3\">fo<font size=\"4\">o</font></font><span style=\"font-size:medium\"><font size=\"4\">b</font>ar</span>" but got "<font size=\"3\">fo</font><font size=\"4\">ob</font><span style=\"font-size:medium\">ar</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=3>fo[o</font><span style=font-size:medium>b]ar</span>" queryCommandValue("stylewithcss") before @@ -309,7 +309,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"5\">fo<span style=\"font-size:large\">o</span></font><span style=\"font-size:x-large\"><span style=\"font-size:large\">b</span>ar</span>" but got "<font size=\"5\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:x-large\">ar</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandValue("stylewithcss") before @@ -325,7 +325,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"5\">fo<font size=\"4\">o</font></font><span style=\"font-size:x-large\"><font size=\"4\">b</font>ar</span>" but got "<font size=\"5\">fo</font><font size=\"4\">ob</font><span style=\"font-size:x-large\">ar</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=5>fo[o</font><span style=font-size:x-large>b]ar</span>" queryCommandValue("stylewithcss") before @@ -341,7 +341,7 @@ PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"6\">fo<span style=\"font-size:large\">o</span></font><span style=\"font-size:xx-large\"><span style=\"font-size:large\">b</span>ar</span>" but got "<font size=\"6\">fo</font><span style=\"font-size:large\">ob</span><span style=\"font-size:xx-large\">ar</span>" +PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandValue("stylewithcss") before @@ -357,7 +357,7 @@ PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>": execCommand("fontsize", false, "4") return value PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font size=\"6\">fo<font size=\"4\">o</font></font><span style=\"font-size:xx-large\"><font size=\"4\">b</font>ar</span>" but got "<font size=\"6\">fo</font><font size=\"4\">ob</font><span style=\"font-size:xx-large\">ar</span>" +PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["fontsize","4"]] "<font size=6>fo[o</font><span style=font-size:xx-large>b]ar</span>" queryCommandValue("stylewithcss") before @@ -398,5 +398,25 @@ PASS [["styleWithCSS","false"],["fontSize","7"]] "<font face=monospace>ab[c]</font>": execCommand("fontSize", false, "7") return value PASS [["styleWithCSS","false"],["fontSize","7"]] "<font face=monospace>ab[c]</font>" checks for modifications to non-editable content PASS [["styleWithCSS","false"],["fontSize","7"]] "<font face=monospace>ab[c]</font>" compare innerHTML +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc]</span>": execCommand("styleWithCSS", false, "false") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc]</span>": execCommand("fontSize", false, "5") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc]</span>" checks for modifications to non-editable content +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc]</span>" compare innerHTML +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[a]bc</span>": execCommand("styleWithCSS", false, "false") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[a]bc</span>": execCommand("fontSize", false, "5") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[a]bc</span>" checks for modifications to non-editable content +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[a]bc</span>" compare innerHTML +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a[b]c</span>": execCommand("styleWithCSS", false, "false") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a[b]c</span>": execCommand("fontSize", false, "5") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a[b]c</span>" checks for modifications to non-editable content +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">a[b]c</span>" compare innerHTML +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab[c]</span>": execCommand("styleWithCSS", false, "false") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab[c]</span>": execCommand("fontSize", false, "5") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab[c]</span>" checks for modifications to non-editable content +PASS [["styleWithCSS","false"],["fontSize","5"]] "<span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">ab[c]</span>" compare innerHTML +PASS [["styleWithCSS","false"],["fontSize","5"]] "<p><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc</span></p><p><span style=\"font-size:64px; background-color:rgb(128, 128, 0)\">def]</span></p>": execCommand("styleWithCSS", false, "false") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<p><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc</span></p><p><span style=\"font-size:64px; background-color:rgb(128, 128, 0)\">def]</span></p>": execCommand("fontSize", false, "5") return value +PASS [["styleWithCSS","false"],["fontSize","5"]] "<p><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc</span></p><p><span style=\"font-size:64px; background-color:rgb(128, 128, 0)\">def]</span></p>" checks for modifications to non-editable content +PASS [["styleWithCSS","false"],["fontSize","5"]] "<p><span style=\"font-size:32px; background-color:rgb(0, 128, 128)\">[abc</span></p><p><span style=\"font-size:64px; background-color:rgb(128, 128, 0)\">def]</span></p>" compare innerHTML Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/forecolor_1001-2000-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/forecolor_1001-2000-expected.txt index 0c65e37b..3b56e4a 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/forecolor_1001-2000-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/forecolor_1001-2000-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1000 tests; 972 PASS, 28 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1000 tests; 977 PASS, 23 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>" queryCommandValue("forecolor") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>" queryCommandIndeterm("forecolor") after PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<table data-start=0 data-end=1><tbody><tr><td>foo<td>bar<td>baz</table>" queryCommandState("forecolor") after @@ -103,7 +103,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(0, 0, 255)\">foobarbaz</span>" but got "<span style=\"color:rgb(0, 0, 255)\">foo</span><span style=\"color:rgb(0, 0, 255)\">bar</span><span style=\"color:rgb(0, 0, 255)\">baz</span>" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandValue("stylewithcss") before @@ -119,7 +119,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(0, 0, 255)\">foobarbaz</span>" but got "<font color=\"#0000ff\">foobarbaz</font>" +FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(0, 0, 255)\">foo</span><font color=\"#0000ff\">bar</font><span style=\"color:rgb(0, 0, 255)\">baz</span>" but got "<font color=\"#0000ff\">foobarbaz</font>" PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=\"color: blue\">foo<span style=\"color: brown\">[bar]</span>baz</span>" queryCommandValue("stylewithcss") before @@ -930,7 +930,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<span style=\"color:rgb(0, 0, 255)\">o</span><font color=\"brown\"><span style=\"color:rgb(0, 0, 255)\">b</span>ar</font>baz" but got "fo<span style=\"color:rgb(0, 0, 255)\">ob</span><font color=\"brown\">ar</font>baz" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -946,7 +946,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "fo<font color=\"#0000ff\">o</font><font color=\"brown\"><font color=\"#0000ff\">b</font>ar</font>baz" but got "fo<font color=\"#0000ff\">ob</font><font color=\"brown\">ar</font>baz" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "fo[o<font color=brown>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -962,7 +962,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\">ba<span style=\"color:rgb(0, 0, 255)\">r</span></font><span style=\"color:rgb(0, 0, 255)\">b</span>az" but got "foo<font color=\"brown\">ba</font><span style=\"color:rgb(0, 0, 255)\">rb</span>az" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandValue("stylewithcss") before @@ -978,7 +978,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\">ba<font color=\"#0000ff\">r</font></font><font color=\"#0000ff\">b</font>az" but got "foo<font color=\"brown\">ba</font><font color=\"#0000ff\">rb</font>az" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>b]az" queryCommandValue("stylewithcss") before
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/forecolor_2001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/forecolor_2001-last-expected.txt index a2d3bf9c..25cf275 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/forecolor_2001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/forecolor_2001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 275 tests; 262 PASS, 13 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 275 tests; 269 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>bar</font>b]az" queryCommandValue("stylewithcss") after FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>bar</font>b]az" queryCommandIndeterm("forecolor") before assert_equals: Wrong result returned expected true but got false PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "fo[o<font color=brown>bar</font>b]az" queryCommandState("forecolor") before @@ -26,7 +26,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\"><span style=\"color:rgb(0, 0, 255)\">b</span>ar</font>baz" but got "foo<span style=\"color:rgb(0, 0, 255)\">b</span><font color=\"brown\">ar</font>baz" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -42,7 +42,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\"><font color=\"#0000ff\">b</font>ar</font>baz" but got "foo<font color=\"#0000ff\">b</font><font color=\"brown\">ar</font>baz" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo[<font color=brown>b]ar</font>baz" queryCommandValue("stylewithcss") before @@ -58,7 +58,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\">ba<span style=\"color:rgb(0, 0, 255)\">r</span></font>baz" but got "foo<font color=\"brown\">ba</font><span style=\"color:rgb(0, 0, 255)\">r</span>baz" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandValue("stylewithcss") before @@ -74,7 +74,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<font color=\"brown\">ba<font color=\"#0000ff\">r</font></font>baz" but got "foo<font color=\"brown\">ba</font><font color=\"#0000ff\">r</font>baz" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "foo<font color=brown>ba[r</font>]baz" queryCommandValue("stylewithcss") before @@ -186,7 +186,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font color=\"brown\">fo<span style=\"color:rgb(0, 0, 255)\">o</span></font><span style=\"color:rgb(165, 42, 42)\"><span style=\"color:rgb(0, 0, 255)\">b</span>ar</span>" but got "<font color=\"brown\">fo</font><span style=\"color:rgb(0, 0, 255)\">ob</span><span style=\"color:rgb(165, 42, 42)\">ar</span>" +PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" compare innerHTML PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandValue("stylewithcss") before @@ -202,7 +202,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<font color=\"brown\">fo<font color=\"#0000ff\">o</font></font><span style=\"color:rgb(165, 42, 42)\"><font color=\"#0000ff\">b</font>ar</span>" but got "<font color=\"brown\">fo</font><font color=\"#0000ff\">ob</font><span style=\"color:rgb(165, 42, 42)\">ar</span>" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<font color=brown>fo[o</font><span style=color:brown>b]ar</span>" queryCommandValue("stylewithcss") before @@ -218,7 +218,7 @@ PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>": execCommand("stylewithcss", false, "true") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(165, 42, 42)\">fo<span style=\"color:rgb(0, 0, 255)\">o</span></span><span style=\"color:rgb(0, 0, 255)\">bar</span>" but got "<span style=\"color:rgb(165, 42, 42)\">fo</span><span style=\"color:rgb(0, 0, 255)\">ob</span><span style=\"color:rgb(0, 0, 255)\">ar</span>" +FAIL [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(165, 42, 42)\">fo</span><span style=\"color:rgb(0, 0, 255)\">obar</span>" but got "<span style=\"color:rgb(165, 42, 42)\">fo</span><span style=\"color:rgb(0, 0, 255)\">ob</span><span style=\"color:rgb(0, 0, 255)\">ar</span>" PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","true"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandValue("stylewithcss") before @@ -234,7 +234,7 @@ PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>": execCommand("stylewithcss", false, "false") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>": execCommand("forecolor", false, "#0000FF") return value PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" checks for modifications to non-editable content -FAIL [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<span style=\"color:rgb(165, 42, 42)\">fo<font color=\"#0000ff\">o</font></span><span style=\"color:rgb(0, 0, 255)\">bar</span>" but got "<span style=\"color:rgb(165, 42, 42)\">fo</span><font color=\"#0000ff\">ob</font><span style=\"color:rgb(0, 0, 255)\">ar</span>" +PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" compare innerHTML PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandIndeterm("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandState("stylewithcss") before PASS [["stylewithcss","false"],["forecolor","#0000FF"]] "<span style=color:brown>fo[o</span><span style=color:#0000ff>b]ar</span>" queryCommandValue("stylewithcss") before
diff --git a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/embedding.tentative.https.window.js.ini b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/embedding.tentative.https.window.js.ini index f8ddb12b..999554f 100644 --- a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/embedding.tentative.https.window.js.ini +++ b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/embedding.tentative.https.window.js.ini
@@ -17,3 +17,6 @@ [embedding.tentative.https.window.html?3-3] expected: if product == "chrome": [ERROR, OK] + +[embedding.tentative.https.window.html?12-12] + expected: [ERROR, OK]
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/the-window-object/window-open-windowfeatures-values.html.ini b/third_party/blink/web_tests/external/wpt/html/browsers/the-window-object/window-open-windowfeatures-values.html.ini index ef909a9..d9e0e4f 100644 --- a/third_party/blink/web_tests/external/wpt/html/browsers/the-window-object/window-open-windowfeatures-values.html.ini +++ b/third_party/blink/web_tests/external/wpt/html/browsers/the-window-object/window-open-windowfeatures-values.html.ini
@@ -1,3 +1,3 @@ [window-open-windowfeatures-values.html] expected: - if product == "chrome": TIMEOUT + if product == "chrome": [ERROR, TIMEOUT]
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-top.https.html.ini b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-top.https.html.ini index a0f5275..e56c505 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-top.https.html.ini +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-top.https.html.ini
@@ -1,4 +1,6 @@ [property-top.https.html] + expected: + if product == "chrome": [ERROR, OK] [same-origin > w => w.top] expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/pending-beacon/pending_beacon-sendondiscard.tentative.https.window.js.ini b/third_party/blink/web_tests/external/wpt/pending-beacon/pending_beacon-sendondiscard.tentative.https.window.js.ini index e4af0259..cb4583fa 100644 --- a/third_party/blink/web_tests/external/wpt/pending-beacon/pending_beacon-sendondiscard.tentative.https.window.js.ini +++ b/third_party/blink/web_tests/external/wpt/pending-beacon/pending_beacon-sendondiscard.tentative.https.window.js.ini
@@ -3,9 +3,9 @@ if product == "chrome": ERROR [A discarded document does not send an already sent beacon.] expected: - if (flag_specific == "") and (os == "linux") and (version == "Ubuntu 18.04"): [PASS, FAIL] - if (flag_specific == "") and (os == "win"): FAIL + if (os == "linux") and (version == "Ubuntu 18.04"): [FAIL, PASS] + if os == "win": FAIL [A discarded document sends all its beacons of which backgroundTimeouts are\n not default.] expected: - if (flag_specific == "") and (os == "linux") and (version == "Ubuntu 18.04"): [PASS, FAIL] + if flag_specific == "disable-site-isolation-trials": [PASS, FAIL]
diff --git a/third_party/blink/web_tests/external/wpt/performance-timeline/not-restored-reasons/performance-navigation-timing-same-origin-bfcache.tentative.window.js.ini b/third_party/blink/web_tests/external/wpt/performance-timeline/not-restored-reasons/performance-navigation-timing-same-origin-bfcache.tentative.window.js.ini index 2faeab3..a7414b2 100644 --- a/third_party/blink/web_tests/external/wpt/performance-timeline/not-restored-reasons/performance-navigation-timing-same-origin-bfcache.tentative.window.js.ini +++ b/third_party/blink/web_tests/external/wpt/performance-timeline/not-restored-reasons/performance-navigation-timing-same-origin-bfcache.tentative.window.js.ini
@@ -1,5 +1,5 @@ [performance-navigation-timing-same-origin-bfcache.tentative.window.html] [RemoteContextHelper navigation using BFCache] expected: - if (os == "linux") and (version == "trusty") and (product == "chrome"): FAIL - if (os == "linux") and (version == "Ubuntu 18.04"): FAIL + if (processor == "x86_64") and (os == "linux") and (product == "chrome"): FAIL + if (processor == "x86_64") and (os == "win"): FAIL
diff --git a/third_party/blink/web_tests/external/wpt/subapps/add-error.tentative.https.html b/third_party/blink/web_tests/external/wpt/subapps/add-error.tentative.https.html index 3dafdcd..8b83afcc 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/add-error.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/subapps/add-error.tentative.https.html
@@ -82,13 +82,13 @@ }; let mocked_response = [ - { unhashedAppIdPath: url_1, resultCode: AddCallResultCode.EXPECTED_APP_ID_CHECK_FAILED }, - { unhashedAppIdPath: url_2, resultCode: AddCallResultCode.INSTALL_URL_INVALID } + { unhashedAppIdPath: url_1, resultCode: Status.FAILURE }, + { unhashedAppIdPath: url_2, resultCode: Status.FAILURE } ]; let expected_results = { - [url_1]: "expected-app-id-check-failed", - [url_2]: "install-url-invalid", + [url_1]: "failure", + [url_2]: "failure", }; await test_driver.bless("installing a subapp", async function () { @@ -106,13 +106,13 @@ }; let mocked_response = [ - { unhashedAppIdPath: url_1, resultCode: AddCallResultCode.SUCCESS_NEW_INSTALL }, - { unhashedAppIdPath: url_2, resultCode: AddCallResultCode.EXPECTED_APP_ID_CHECK_FAILED } + { unhashedAppIdPath: url_1, resultCode: Status.SUCCESS }, + { unhashedAppIdPath: url_2, resultCode: Status.FAILURE } ]; let expected_results = { - [url_1]: "success-new-install", - [url_2]: "expected-app-id-check-failed", + [url_1]: "success", + [url_2]: "failure", }; await test_driver.bless("installing a subapp", async function () {
diff --git a/third_party/blink/web_tests/external/wpt/subapps/add-success.tentative.https.html b/third_party/blink/web_tests/external/wpt/subapps/add-success.tentative.https.html index fee7c660..b482982f 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/add-success.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/subapps/add-success.tentative.https.html
@@ -16,11 +16,11 @@ }; let mocked_response = [ - { unhashedAppIdPath: install_url, resultCode: AddCallResultCode.SUCCESS_NEW_INSTALL } + { unhashedAppIdPath: install_url, resultCode: Status.SUCCESS } ]; let expected_results = { - [install_url]: "success-new-install" + [install_url]: "success" }; await test_driver.bless("installing a subapp", async function () { @@ -38,13 +38,13 @@ }; let mocked_response = [ - { unhashedAppIdPath: url_1, resultCode: AddCallResultCode.SUCCESS_NEW_INSTALL }, - { unhashedAppIdPath: url_2, resultCode: AddCallResultCode.SUCCESS_NEW_INSTALL } + { unhashedAppIdPath: url_1, resultCode: Status.SUCCESS }, + { unhashedAppIdPath: url_2, resultCode: Status.SUCCESS } ]; let expected_results = { - [url_1]: "success-new-install", - [url_2]: "success-new-install", + [url_1]: "success", + [url_2]: "success", };
diff --git a/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js b/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js index e923db0..9158d15 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js +++ b/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js
@@ -8,22 +8,13 @@ let mockSubAppsService = null; +// TODO(crbug.com/1408101): Figure out how to export SubAppsServiceResult (and +// get rid of this). const Status = { SUCCESS: 0, FAILURE: 1, }; -const AddCallResultCode = { - SUCCESS_NEW_INSTALL: 0, - SUCCESS_ALREADY_INSTALLED: 1, - USER_INSTALL_DECLINED: 2, - EXPECTED_APP_ID_CHECK_FAILED: 3, - PARENT_APP_UNINSTALLED: 4, - INSTALL_URL_INVALID: 5, - NOT_VALID_MANIFEST_FOR_WEB_APP: 6, - FAILURE: 7, -} - async function createMockSubAppsService(service_result_code, add_call_return_value, list_call_return_value) { if (typeof SubAppsServiceTest === 'undefined') { // Load test-only API helpers. @@ -70,14 +61,14 @@ }); await createMockSubAppsService(Status.FAILURE, mocked_response, []); - await navigator.subApps.add(add_call_params) - .then(result => { - assert_unreached("Should have rejected."); - }) - .catch(result => { + await navigator.subApps.add(add_call_params).then( + result => { + assert_unreached("Should have rejected: ", result); + }, + error => { for (const app_id in expected_results) { - assert_own_property(result, app_id, "Return results are missing entry for subapp.") - assert_equals(result[app_id], expected_results[app_id], "Return results are not as expected.") + assert_own_property(error, app_id, "Return results are missing entry for subapp.") + assert_equals(error[app_id], expected_results[app_id], "Return results are not as expected.") } }); } @@ -89,11 +80,10 @@ }); await createMockSubAppsService(Status.SUCCESS, mocked_response); - await navigator.subApps.add(add_call_params) - .then(result => { - for (const app_id in expected_results) { - assert_own_property(result, app_id, "Return results are missing entry for subapp.") - assert_equals(result[app_id], expected_results[app_id], "Return results are not as expected.") - } - }) + await navigator.subApps.add(add_call_params).then(result => { + for (const app_id in expected_results) { + assert_own_property(result, app_id, "Return results are missing entry for subapp.") + assert_equals(result[app_id], expected_results[app_id], "Return results are not as expected.") + } + }); }
diff --git a/third_party/blink/web_tests/fast/backgrounds/svg-as-mask-expected.png b/third_party/blink/web_tests/fast/backgrounds/svg-as-mask-expected.png index 2cea9b1..9370d2f 100644 --- a/third_party/blink/web_tests/fast/backgrounds/svg-as-mask-expected.png +++ b/third_party/blink/web_tests/fast/backgrounds/svg-as-mask-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/css/image-set-parsing-invalid-expected.txt b/third_party/blink/web_tests/fast/css/image-set-parsing-invalid-expected.txt index 7ebca1f..b744ccc 100644 --- a/third_party/blink/web_tests/fast/css/image-set-parsing-invalid-expected.txt +++ b/third_party/blink/web_tests/fast/css/image-set-parsing-invalid-expected.txt
@@ -42,14 +42,6 @@ Scale factor is 0 : -webkit-image-set(url('#a') 0x PASS cssRule is "" - - -No url function : image-set('#a' 1x -PASS cssRule is "" - - -No url function : -webkit-image-set('#a' 1x -PASS cssRule is "" PASS successfullyParsed is true TEST COMPLETE
diff --git a/third_party/blink/web_tests/fast/css/script-tests/image-set-parsing-invalid.js b/third_party/blink/web_tests/fast/css/script-tests/image-set-parsing-invalid.js index 4df5bf0a..aa1176f 100644 --- a/third_party/blink/web_tests/fast/css/script-tests/image-set-parsing-invalid.js +++ b/third_party/blink/web_tests/fast/css/script-tests/image-set-parsing-invalid.js
@@ -37,6 +37,4 @@ testInvalidImageSets('Scale factor is 0', 'url(\'#a\') 0x'); -testInvalidImageSets('No url function', '\'#a\' 1x'); - successfullyParsed = true;
diff --git a/third_party/blink/web_tests/fast/dynamic/anonymous-block-layer-lost-expected.png b/third_party/blink/web_tests/fast/dynamic/anonymous-block-layer-lost-expected.png index 16b3506..f87d11b 100644 --- a/third_party/blink/web_tests/fast/dynamic/anonymous-block-layer-lost-expected.png +++ b/third_party/blink/web_tests/fast/dynamic/anonymous-block-layer-lost-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/layers/add-layer-with-nested-stacking-expected.png b/third_party/blink/web_tests/fast/layers/add-layer-with-nested-stacking-expected.png index 130b991b..6cda17ad 100644 --- a/third_party/blink/web_tests/fast/layers/add-layer-with-nested-stacking-expected.png +++ b/third_party/blink/web_tests/fast/layers/add-layer-with-nested-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/layers/opacity-stacking-expected.png b/third_party/blink/web_tests/fast/layers/opacity-stacking-expected.png index 7832ca71..f04e03df 100644 --- a/third_party/blink/web_tests/fast/layers/opacity-stacking-expected.png +++ b/third_party/blink/web_tests/fast/layers/opacity-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/multicol/transform-inside-opacity-expected.png b/third_party/blink/web_tests/fast/multicol/transform-inside-opacity-expected.png index 2d6765af..5e34c7e3 100644 --- a/third_party/blink/web_tests/fast/multicol/transform-inside-opacity-expected.png +++ b/third_party/blink/web_tests/fast/multicol/transform-inside-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/reflections/reflection-masks-opacity-expected.png b/third_party/blink/web_tests/fast/reflections/reflection-masks-opacity-expected.png index 8982998..a494426 100644 --- a/third_party/blink/web_tests/fast/reflections/reflection-masks-opacity-expected.png +++ b/third_party/blink/web_tests/fast/reflections/reflection-masks-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap-expected.html b/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap-expected.html index b5ffb23..9e29dc74 100644 --- a/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap-expected.html +++ b/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap-expected.html
@@ -1,2 +1,2 @@ <!DOCTYPE html> -<div style="width:100px; height:100px; background:rgb(128,192,128);"></div> +<div style="width:100px; height:100px; background:green; opacity:0.5;"></div>
diff --git a/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap.html b/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap.html index 8f7db59..d1cd48c 100644 --- a/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap.html +++ b/third_party/blink/web_tests/fast/sub-pixel/save-layer-bounds-should-snap.html
@@ -1,4 +1,4 @@ <!DOCTYPE html> <div style="transform:scale(2); transform-origin:0 0; width:99px; height:99px;"> - <div style="width:50%; height:50%; background:green; opacity:0.5;"></div> + <div style="width:50%; height:50%; background:green; opacity:0.501;"></div> </div>
diff --git a/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/fast/sub-pixel/save-layer-bounds-should-snap-expected.png b/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/fast/sub-pixel/save-layer-bounds-should-snap-expected.png new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/disable-site-isolation-trials/fast/sub-pixel/save-layer-bounds-should-snap-expected.png
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/block/float/float-in-float-painting-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/block/float/float-in-float-painting-expected.png index 26ed246..6056e3c 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/block/float/float-in-float-painting-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/block/float/float-in-float-painting-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/select/basic-selects-expected.png index b3668e22..4c1cdcf 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 4b1abbec..9d91a47 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/svg/foreignObject/filter-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/svg/foreignObject/filter-expected.png index 0c4580e..d126177 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/svg/foreignObject/filter-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/svg/foreignObject/filter-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/transforms/transform-on-inline-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/transforms/transform-on-inline-expected.png index b51c39bc..3cb2b6ac 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/transforms/transform-on-inline-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/transforms/transform-on-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/virtual/text-antialias/complex-text-opacity-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/virtual/text-antialias/complex-text-opacity-expected.png index 89821c0a7..149f4a70 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/virtual/text-antialias/complex-text-opacity-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/virtual/text-antialias/complex-text-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/skia-vulkan-swiftshader/css3/blending/effect-background-blend-mode-stacking-expected.png b/third_party/blink/web_tests/flag-specific/skia-vulkan-swiftshader/css3/blending/effect-background-blend-mode-stacking-expected.png index 4b9e61e..186469b 100644 --- a/third_party/blink/web_tests/flag-specific/skia-vulkan-swiftshader/css3/blending/effect-background-blend-mode-stacking-expected.png +++ b/third_party/blink/web_tests/flag-specific/skia-vulkan-swiftshader/css3/blending/effect-background-blend-mode-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/devtools/layers/layer-canvas-log-expected.txt b/third_party/blink/web_tests/http/tests/devtools/layers/layer-canvas-log-expected.txt index c458c28..9a38b0c6 100644 --- a/third_party/blink/web_tests/http/tests/devtools/layers/layer-canvas-log-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/layers/layer-canvas-log-expected.txt
@@ -44,7 +44,7 @@ method : "drawRect" params : { paint : { - color : "#7F000000" + color : "#80000000" flags : "AntiAlias" strokeCap : "Butt" strokeJoin : "Miter"
diff --git a/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.png b/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.png index 32a197c..dc85ee8b 100644 --- a/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.png +++ b/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.txt b/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.txt index f289ace..377e689 100644 --- a/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/compositing/new-stacking-context-expected.txt
@@ -1,7 +1,7 @@ { "layers": [ { - "name": "Scrolling background of LayoutView #document", + "name": "Scrolling background of LayoutNGView #document", "bounds": [800, 600], "contentsOpaque": true, "backgroundColor": "#FFFFFF"
diff --git a/third_party/blink/web_tests/paint/invalidation/multicol/column-float-under-stacked-inline-expected.png b/third_party/blink/web_tests/paint/invalidation/multicol/column-float-under-stacked-inline-expected.png index c6cabcbb..a92e6a8 100644 --- a/third_party/blink/web_tests/paint/invalidation/multicol/column-float-under-stacked-inline-expected.png +++ b/third_party/blink/web_tests/paint/invalidation/multicol/column-float-under-stacked-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.png b/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.png index 7c45db8b..ec6131b 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.png +++ b/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.txt b/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.txt index 94d1a9a..6f2c37f9 100644 --- a/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/svg/js-update-bounce-expected.txt
@@ -1,7 +1,7 @@ { "layers": [ { - "name": "Scrolling background of LayoutView #document", + "name": "Scrolling background of LayoutNGView #document", "bounds": [800, 600], "contentsOpaque": true, "backgroundColor": "#FFFFFF",
diff --git a/third_party/blink/web_tests/paint/transparency/compositing-alpha-fold-crash-expected.png b/third_party/blink/web_tests/paint/transparency/compositing-alpha-fold-crash-expected.png index f9f0ec5c..401c9e0 100644 --- a/third_party/blink/web_tests/paint/transparency/compositing-alpha-fold-crash-expected.png +++ b/third_party/blink/web_tests/paint/transparency/compositing-alpha-fold-crash-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/compositing/transitions/scale-transition-no-start-expected.png b/third_party/blink/web_tests/platform/linux/compositing/transitions/scale-transition-no-start-expected.png index 6512bdce..5f93470 100644 --- a/third_party/blink/web_tests/platform/linux/compositing/transitions/scale-transition-no-start-expected.png +++ b/third_party/blink/web_tests/platform/linux/compositing/transitions/scale-transition-no-start-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/compositing/video/video-controls-layer-creation-expected.png b/third_party/blink/web_tests/platform/linux/compositing/video/video-controls-layer-creation-expected.png index 08cfc0f..10c5c95b 100644 --- a/third_party/blink/web_tests/platform/linux/compositing/video/video-controls-layer-creation-expected.png +++ b/third_party/blink/web_tests/platform/linux/compositing/video/video-controls-layer-creation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/css3/blending/background-blend-mode-tiled-gradient-expected.png b/third_party/blink/web_tests/platform/linux/css3/blending/background-blend-mode-tiled-gradient-expected.png new file mode 100644 index 0000000..d3e3d2b --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/css3/blending/background-blend-mode-tiled-gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-expected.png b/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-expected.png index fb1aa1d..d703a14 100644 --- a/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-expected.png +++ b/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-tiled-expected.png b/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-tiled-expected.png index c60ce74..d2e9d1e 100644 --- a/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-tiled-expected.png +++ b/third_party/blink/web_tests/platform/linux/css3/blending/effect-background-blend-mode-tiled-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/backgrounds/opacity-on-document-element-expected.png b/third_party/blink/web_tests/platform/linux/fast/backgrounds/opacity-on-document-element-expected.png index ea63cff..11d8f13 100644 --- a/third_party/blink/web_tests/platform/linux/fast/backgrounds/opacity-on-document-element-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/backgrounds/opacity-on-document-element-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/block/float/float-in-float-painting-expected.png b/third_party/blink/web_tests/platform/linux/fast/block/float/float-in-float-painting-expected.png index ca050cb..8cfb9b1 100644 --- a/third_party/blink/web_tests/platform/linux/fast/block/float/float-in-float-painting-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/block/float/float-in-float-painting-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers-expected.png b/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers-expected.png index 199463e4..317086eb 100644 --- a/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers2-expected.png b/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers2-expected.png index 86e2c30..8fda8f4 100644 --- a/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers2-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/css/ZeroOpacityLayers2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-appearance-expected.png index f1f8931..cfa28df9a 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png index fbfeaac..d8141490 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index 61ae5d3c..f8854bd3 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index a0c45fe..7cf4eee 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index aa55c445..832e404e 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/indeterminate-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/indeterminate-expected.png index 4aaed41ca..63ffb59 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/indeterminate-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/indeterminate-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/select/basic-selects-expected.png index 212ae019..b8c234f 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/select/disabled-select-change-index-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/select/disabled-select-change-index-expected.png index 90a2c00c..c0964101 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/select/disabled-select-change-index-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/select/disabled-select-change-index-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png index 77b1f27..de1ccc5 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/select/select-disabled-appearance-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/select/select-disabled-appearance-expected.png index 8cf2461..89ae6b61 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/select/select-disabled-appearance-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/select/select-disabled-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/layers/opacity-outline-expected.png b/third_party/blink/web_tests/platform/linux/fast/layers/opacity-outline-expected.png index a18ab6d..75d08d4 100644 --- a/third_party/blink/web_tests/platform/linux/fast/layers/opacity-outline-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/layers/opacity-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/layers/opacity-transforms-expected.png b/third_party/blink/web_tests/platform/linux/fast/layers/opacity-transforms-expected.png index 0933ee6..3979ff18 100644 --- a/third_party/blink/web_tests/platform/linux/fast/layers/opacity-transforms-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/layers/opacity-transforms-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/multicol/layers-in-multicol-expected.png b/third_party/blink/web_tests/platform/linux/fast/multicol/layers-in-multicol-expected.png index ee4d480..cb5d630 100644 --- a/third_party/blink/web_tests/platform/linux/fast/multicol/layers-in-multicol-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/multicol/layers-in-multicol-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/overflow/007-expected.png b/third_party/blink/web_tests/platform/linux/fast/overflow/007-expected.png index d60f328..6ebcab2 100644 --- a/third_party/blink/web_tests/platform/linux/fast/overflow/007-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/overflow/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/linux/fast/overflow/overflow-of-video-outline-expected.png index e5c635b..433576f 100644 --- a/third_party/blink/web_tests/platform/linux/fast/overflow/overflow-of-video-outline-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/overflow/overflow-of-video-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-collapsed-border-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-collapsed-border-expected.png index 9f41f1d..89aa8b1a 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-expected.png index 9f41f1d..89aa8b1a 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/dynamic-caption-add-before-child-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/dynamic-caption-add-before-child-expected.png index 0e7c8e3..9ed07d15 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/dynamic-caption-add-before-child-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/dynamic-caption-add-before-child-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/multiple-captions-display-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/multiple-captions-display-expected.png index 3a3808f9..a0f7699 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/multiple-captions-display-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/multiple-captions-display-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/overflowHidden-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/overflowHidden-expected.png index d92bf244..a1e978f 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/overflowHidden-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/overflowHidden-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png index b9aaf65..65e38142 100644 --- a/third_party/blink/web_tests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/linux/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/linux/media/audio-controls-rendering-expected.png index a11bb1a..35bd351 100644 --- a/third_party/blink/web_tests/platform/linux/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/linux/media/audio-repaint-expected.png index cb995706..0d13811b 100644 --- a/third_party/blink/web_tests/platform/linux/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/linux/media/controls-layout-direction-expected.png index 80407565..f71f74a 100644 --- a/third_party/blink/web_tests/platform/linux/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/controls/paint-controls-webkit-appearance-none-expected.png b/third_party/blink/web_tests/platform/linux/media/controls/paint-controls-webkit-appearance-none-expected.png index 19d72bc..37844fec 100644 --- a/third_party/blink/web_tests/platform/linux/media/controls/paint-controls-webkit-appearance-none-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/controls/paint-controls-webkit-appearance-none-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/linux/media/media-controls-clone-expected.png index 85f53456..fc7b4d9 100644 --- a/third_party/blink/web_tests/platform/linux/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/media-controls-grey-scrubber-expected.png b/third_party/blink/web_tests/platform/linux/media/media-controls-grey-scrubber-expected.png index 15ac2a0..e09cba5 100644 --- a/third_party/blink/web_tests/platform/linux/media/media-controls-grey-scrubber-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/media-controls-grey-scrubber-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/linux/media/media-document-audio-repaint-expected.png index 70b8bec8..bb5d327 100644 --- a/third_party/blink/web_tests/platform/linux/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/video-empty-source-expected.png b/third_party/blink/web_tests/platform/linux/media/video-empty-source-expected.png index ce26faf..094aa3a 100644 --- a/third_party/blink/web_tests/platform/linux/media/video-empty-source-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/video-empty-source-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/media/video-no-audio-expected.png b/third_party/blink/web_tests/platform/linux/media/video-no-audio-expected.png index 7aece49..a9f955af 100644 --- a/third_party/blink/web_tests/platform/linux/media/video-no-audio-expected.png +++ b/third_party/blink/web_tests/platform/linux/media/video-no-audio-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/compositing/become-overlay-composited-layer-expected.png b/third_party/blink/web_tests/platform/linux/paint/invalidation/compositing/become-overlay-composited-layer-expected.png index 363f3b0..6dacadd 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/compositing/become-overlay-composited-layer-expected.png +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/compositing/become-overlay-composited-layer-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png b/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png index 841db752..39108ea 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.txt b/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.txt index 640a607..ecd2a38b 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.txt +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.txt
@@ -1,7 +1,7 @@ { "layers": [ { - "name": "Scrolling background of LayoutView #document", + "name": "Scrolling background of LayoutNGView #document", "bounds": [1026, 1012], "contentsOpaque": true, "backgroundColor": "#FFFFFF", @@ -27,7 +27,7 @@ "contentsOpaque": true }, { - "name": "Scroll corner of LayoutView #document", + "name": "Scroll corner of LayoutNGView #document", "position": [785, 585], "bounds": [15, 15], "contentsOpaque": true
diff --git a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png index ec3b0cdb..afc9adc 100644 --- a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png index bcd57c4b..4fed618e 100644 --- a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png index b4067043..48fc93fd 100644 --- a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/render-groups-01-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/render-groups-01-b-expected.png index 7b4591b..6e683abc 100644 --- a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/render-groups-01-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/render-groups-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/text-text-08-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/text-text-08-b-expected.png index e98d4af5..fa202d9 100644 --- a/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/text-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/W3C-SVG-1.1/text-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-5-expected.png index 29c48dd..bcb28ef 100644 --- a/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-5-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-6-expected.png index 93b9d5e..62fb5ae9c 100644 --- a/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-6-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/batik/text/smallFonts-expected.png b/third_party/blink/web_tests/platform/linux/svg/batik/text/smallFonts-expected.png index 24f7389..0232567d 100644 --- a/third_party/blink/web_tests/platform/linux/svg/batik/text/smallFonts-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/batik/text/smallFonts-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/batik/text/textAnchor-expected.png b/third_party/blink/web_tests/platform/linux/svg/batik/text/textAnchor-expected.png index 3a0cfa4e..87797f6f 100644 --- a/third_party/blink/web_tests/platform/linux/svg/batik/text/textAnchor-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/batik/text/textAnchor-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/batik/text/textFeatures-expected.png b/third_party/blink/web_tests/platform/linux/svg/batik/text/textFeatures-expected.png index c3c206a3..97278b2 100644 --- a/third_party/blink/web_tests/platform/linux/svg/batik/text/textFeatures-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/batik/text/textFeatures-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/batik/text/textProperties-expected.png b/third_party/blink/web_tests/platform/linux/svg/batik/text/textProperties-expected.png index b1f102c7..a41f0d2 100644 --- a/third_party/blink/web_tests/platform/linux/svg/batik/text/textProperties-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/batik/text/textProperties-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/batik/text/verticalText-expected.png b/third_party/blink/web_tests/platform/linux/svg/batik/text/verticalText-expected.png index afa4d9a1..6357454d 100644 --- a/third_party/blink/web_tests/platform/linux/svg/batik/text/verticalText-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/batik/text/verticalText-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/container-opacity-clip-viewBox-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/container-opacity-clip-viewBox-expected.png index f54ebb7..c0d3597 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/container-opacity-clip-viewBox-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/container-opacity-clip-viewBox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/dominant-baseline-hanging-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/dominant-baseline-hanging-expected.png index 344727b..a90f818936 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/dominant-baseline-hanging-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/dominant-baseline-hanging-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/non-opaque-filters-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/non-opaque-filters-expected.png index 8e9e0934..65f63e5 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/non-opaque-filters-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/non-opaque-filters-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/text-image-opacity-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/text-image-opacity-expected.png index 1c26e2b..6a1bcfe 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/text-image-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/text-image-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-container-in-target-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-container-in-target-expected.png index b7083b4e..ad3fec3 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-container-in-target-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-container-in-target-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-target-container-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-target-container-expected.png index 9e78d7a..6c22953 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-target-container-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-modify-target-container-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-containing-use-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-containing-use-expected.png index 3d0e84f..e8ab952c 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-containing-use-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-containing-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-expected.png index 6b37f1c..a3a4fa85 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-g-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-use-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-use-expected.png index 6b37f1c..a3a4fa85 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-on-use-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-on-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/use-transform-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/use-transform-expected.png index ceba02a..9d2d04c 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/use-transform-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/use-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-08-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-08-b-expected.png index 22f2ef29..d0659a68 100644 --- a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/transforms/2d/hindi-rotated-expected.png b/third_party/blink/web_tests/platform/linux/transforms/2d/hindi-rotated-expected.png index 64a946b..480a081 100644 --- a/third_party/blink/web_tests/platform/linux/transforms/2d/hindi-rotated-expected.png +++ b/third_party/blink/web_tests/platform/linux/transforms/2d/hindi-rotated-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/transforms/transform-on-inline-expected.png b/third_party/blink/web_tests/platform/linux/transforms/transform-on-inline-expected.png index 3dfbe67..cd821ed 100644 --- a/third_party/blink/web_tests/platform/linux/transforms/transform-on-inline-expected.png +++ b/third_party/blink/web_tests/platform/linux/transforms/transform-on-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/transforms/transform-table-row-expected.png b/third_party/blink/web_tests/platform/linux/transforms/transform-table-row-expected.png index 64e3a69..82a65c77 100644 --- a/third_party/blink/web_tests/platform/linux/transforms/transform-table-row-expected.png +++ b/third_party/blink/web_tests/platform/linux/transforms/transform-table-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/transforms/transforms-with-opacity-expected.png b/third_party/blink/web_tests/platform/linux/transforms/transforms-with-opacity-expected.png index 1a338261..0816f9b1 100644 --- a/third_party/blink/web_tests/platform/linux/transforms/transforms-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/transforms/transforms-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png index 0c6f599..a93a6c4 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png index 0f7228d..522b29f 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index ba4a32eed..e39f8308 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 5d12efd..9e3db5b9 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 5034705..d18985a 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 70629127..51d5267 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index 3a5a617..f3be14b44 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/video-focus-ring-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/video-focus-ring-expected.png index bb8ea03..3d1c4e4 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/video-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-color-scheme/media/video-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/complex-text-opacity-expected.png b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/complex-text-opacity-expected.png index 60e20707..2adb9255 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/complex-text-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/complex-text-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/letter-spacing-negative-opacity-expected.png b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/letter-spacing-negative-opacity-expected.png index 983c618..2fcdc57 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/letter-spacing-negative-opacity-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/letter-spacing-negative-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index 61ae5d3c..f8854bd3 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png deleted file mode 100644 index a0c45fe..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index aa55c445..0000000 --- a/third_party/blink/web_tests/platform/linux/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/video/video-controls-layer-creation-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/video/video-controls-layer-creation-expected.png index 80922ca7..644cbe67 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/video/video-controls-layer-creation-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/video/video-controls-layer-creation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index a67653f..bb8f4b7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index ef39896d..689f2d7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index da00da5..704cdab98 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/basic-selects-expected.png index 9c8ace3..cbe3a457 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/disabled-select-change-index-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/disabled-select-change-index-expected.png index 2a2d3d37..309c038 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/disabled-select-change-index-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/disabled-select-change-index-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/listbox-appearance-basic-expected.png index 32ccd9a..da98ad2b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/listbox-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/listbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/select-disabled-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/select-disabled-appearance-expected.png index fd3a3704..f6cd1e06 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/select-disabled-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/select-disabled-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/layers/opacity-outline-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/layers/opacity-outline-expected.png index d717d8cc..85a18b6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/layers/opacity-outline-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/layers/opacity-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-of-video-outline-expected.png index 3ade45d7..002d2d7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-of-video-outline-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-of-video-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/http/tests/media/video-buffered-range-contains-currentTime-expected.png index cb8803f6..e94bdd3 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/audio-controls-rendering-expected.png index 4fcf781..a0f5476 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/controls-layout-direction-expected.png index 08041b1..f558ddfa 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-clone-expected.png index 4ed86f0..f3d69ab 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-grey-scrubber-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-grey-scrubber-expected.png index 3c487c3..7c5097a 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-grey-scrubber-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-controls-grey-scrubber-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-document-audio-repaint-expected.png index 421f698..8eac3f0 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/media/video-empty-source-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/media/video-empty-source-expected.png index 661420c..9b3d7c4 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/media/video-empty-source-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/media/video-empty-source-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png index 26f668ac..7a4ee54 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png index 4b0c88a..61cd13d 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/batik/text/verticalText-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/batik/text/verticalText-expected.png index 57fe3d0..efe07cf 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/batik/text/verticalText-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/batik/text/verticalText-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/container-opacity-clip-viewBox-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/container-opacity-clip-viewBox-expected.png index ac0e003..014d5c6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/container-opacity-clip-viewBox-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/container-opacity-clip-viewBox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-08-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-08-b-expected.png index a2f0148..50b94f82 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/transforms/2d/hindi-rotated-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/transforms/2d/hindi-rotated-expected.png index ce866d95..664764b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/transforms/2d/hindi-rotated-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/transforms/2d/hindi-rotated-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 04e7c6b..36b02d6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index bb1ee73..3d9caab 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index a69c195..560e82f 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/video-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/video-focus-ring-expected.png index 96e7947..8551786 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/video-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/media/video-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..4fcf781 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..4fcf781 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/complex-text-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/complex-text-opacity-expected.png index 444d132a..1962968 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/complex-text-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/complex-text-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/letter-spacing-negative-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/letter-spacing-negative-opacity-expected.png index bbd70e5..9480313b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/letter-spacing-negative-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/letter-spacing-negative-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index a67653f..bb8f4b7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index ef39896d..689f2d7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index da00da5..704cdab98 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/compositing/video/video-controls-layer-creation-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/compositing/video/video-controls-layer-creation-expected.png index d15ea22..8db83934 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/compositing/video/video-controls-layer-creation-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/compositing/video/video-controls-layer-creation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/fast/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/fast/overflow/overflow-of-video-outline-expected.png index 01a68aab..6318de1d 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/fast/overflow/overflow-of-video-outline-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/fast/overflow/overflow-of-video-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 5266e67..c2e0432 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-controls-rendering-expected.png index 7f4d45d2..b176d868 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-repaint-expected.png index a34023c56..bb37ef2 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/controls-layout-direction-expected.png index 59af3c57..7630524 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/controls/paint-controls-webkit-appearance-none-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/controls/paint-controls-webkit-appearance-none-expected.png index 556f6ae9..34f04d6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/controls/paint-controls-webkit-appearance-none-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/controls/paint-controls-webkit-appearance-none-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-clone-expected.png index b0fedd4..99de66a 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-grey-scrubber-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-grey-scrubber-expected.png index 7d4a240..3d19053 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-grey-scrubber-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-grey-scrubber-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-document-audio-repaint-expected.png index e525e33..9177533 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/video-empty-source-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/video-empty-source-expected.png index d10f5ab..4705938 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/video-empty-source-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/video-empty-source-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/media/video-no-audio-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/video-no-audio-expected.png index 60f4a63..efbefe7 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/media/video-no-audio-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/media/video-no-audio-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 0c704c7..bc68c56e 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index f5cf1e4..630b4e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/video-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/video-focus-ring-expected.png index b1f3a84..31bd24e5 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/video-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/dark-color-scheme/media/video-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..7f4d45d2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png new file mode 100644 index 0000000..a34023c56 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..e525e33 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..7f4d45d2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png new file mode 100644 index 0000000..a34023c56 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..e525e33 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png index edc719a..02cce93c 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-expected.png index 9231b63..336b69e 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png index 4c98dca..e09a109 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png index d2fec75..bfb8d65a2 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/svg-blend-multiply-alpha-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/svg-blend-multiply-alpha-expected.png index 180fdc3..bc15d4b 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/svg-blend-multiply-alpha-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/css3/blending/svg-blend-multiply-alpha-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index fabf60d..49cc223 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/reflections/opacity-reflection-transform-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/reflections/opacity-reflection-transform-expected.png index 37295a3..57c4e15 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/reflections/opacity-reflection-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/fast/reflections/opacity-reflection-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 1250a3f..18c7f11 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-controls-rendering-expected.png index cfa241e..2eb1e6f 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-repaint-expected.png index f7b44c5f..6ca9546 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/controls-layout-direction-expected.png index 2d8285e..046bacd 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-controls-clone-expected.png index 83bf7f7..492d145 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-document-audio-repaint-expected.png index 8874a70..9a12ca95 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png index 8b9af94..67bb53f 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/as-background-image/svg-as-background-6-expected.png index b5b4ac0..a65a271 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/as-background-image/svg-as-background-6-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/custom/marker-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/custom/marker-opacity-expected.png index baf71a09..f1b0d96 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/custom/marker-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/custom/marker-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png new file mode 100644 index 0000000..97cc331 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png new file mode 100644 index 0000000..97cc331 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 38adcf5..b3f7a4ee 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index 3bd95da..0000000 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 1f391b8..a75e60f 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index f371cbb..2fe5baf9 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..cfa241e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png new file mode 100644 index 0000000..f7b44c5f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..8874a70 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..cfa241e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png new file mode 100644 index 0000000..f7b44c5f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..8874a70 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index fabf60d..49cc223 100644 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac11-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png index edc719a..02cce93c 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/background-blend-mode-tiled-gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-expected.png index 9231b63..336b69e 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png index 4c98dca..e09a109 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-stacking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png index d2fec75..bfb8d65a2 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/effect-background-blend-mode-tiled-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/svg-blend-multiply-alpha-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/svg-blend-multiply-alpha-expected.png index 180fdc3..bc15d4b 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/svg-blend-multiply-alpha-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/css3/blending/svg-blend-multiply-alpha-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index fabf60d..49cc223 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/reflections/opacity-reflection-transform-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/reflections/opacity-reflection-transform-expected.png index 37295a3..57c4e15 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/reflections/opacity-reflection-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/fast/reflections/opacity-reflection-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 1250a3f..18c7f11 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-controls-rendering-expected.png index cfa241e..2eb1e6f 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-repaint-expected.png index f7b44c5f..6ca9546 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/controls-layout-direction-expected.png index 2d8285e..046bacd 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-controls-clone-expected.png index 83bf7f7..492d145 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-document-audio-repaint-expected.png index 8874a70..9a12ca95 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png index 8b9af94..67bb53f 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/as-background-image/svg-as-background-6-expected.png index b5b4ac0..a65a271 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/as-background-image/svg-as-background-6-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/custom/marker-opacity-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/custom/marker-opacity-expected.png index baf71a09..f1b0d96 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/custom/marker-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/custom/marker-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png index 55cd33a..1dc65e3 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png new file mode 100644 index 0000000..97cc331 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png new file mode 100644 index 0000000..97cc331 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png new file mode 100644 index 0000000..e62a63c2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 38adcf5..b3f7a4ee 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index 3bd95da..0000000 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 1f391b8..a75e60f 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index f371cbb..2fe5baf9 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..cfa241e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png new file mode 100644 index 0000000..f7b44c5f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..8874a70 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-dcomp/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png new file mode 100644 index 0000000..cfa241e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png new file mode 100644 index 0000000..f7b44c5f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png new file mode 100644 index 0000000..8874a70 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/media-foundation-for-clear-frameserver/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index fabf60d..49cc223 100644 --- a/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac12-arm64/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png b/third_party/blink/web_tests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png index 0067925..d8b394d 100644 --- a/third_party/blink/web_tests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png +++ b/third_party/blink/web_tests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/compositing/video/video-controls-layer-creation-expected.png b/third_party/blink/web_tests/platform/mac/compositing/video/video-controls-layer-creation-expected.png index 0141e0a7..7c9cfaa0 100644 --- a/third_party/blink/web_tests/platform/mac/compositing/video/video-controls-layer-creation-expected.png +++ b/third_party/blink/web_tests/platform/mac/compositing/video/video-controls-layer-creation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/css3/blending/background-blend-mode-tiled-gradient-expected.png b/third_party/blink/web_tests/platform/mac/css3/blending/background-blend-mode-tiled-gradient-expected.png new file mode 100644 index 0000000..d3e3d2b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/css3/blending/background-blend-mode-tiled-gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-expected.png b/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-expected.png index fb1aa1d..d703a14 100644 --- a/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-expected.png +++ b/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-tiled-expected.png b/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-tiled-expected.png index c60ce74..d2e9d1e 100644 --- a/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-tiled-expected.png +++ b/third_party/blink/web_tests/platform/mac/css3/blending/effect-background-blend-mode-tiled-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png b/third_party/blink/web_tests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png index c5aca45..eadc5cc 100644 --- a/third_party/blink/web_tests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/block/float/float-in-float-painting-expected.png b/third_party/blink/web_tests/platform/mac/fast/block/float/float-in-float-painting-expected.png index f56bd7a4..44d4b5a 100644 --- a/third_party/blink/web_tests/platform/mac/fast/block/float/float-in-float-painting-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/block/float/float-in-float-painting-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers-expected.png b/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers-expected.png index acc49674..8651d9a2 100644 --- a/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers2-expected.png b/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers2-expected.png index 65d9d831..52000bc2 100644 --- a/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers2-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/css/ZeroOpacityLayers2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index e58bdf2f..13ca99d 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 9e1970d2..de599ca 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 0b0d8db..a6372d3 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/indeterminate-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/indeterminate-expected.png index 5a8c3fa4..e36236e9 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/indeterminate-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/indeterminate-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/select/basic-selects-expected.png index ef801e8..36678f03 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/select/disabled-select-change-index-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/select/disabled-select-change-index-expected.png index 352f206..f138c8c 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/select/disabled-select-change-index-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/select/disabled-select-change-index-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png index 0aa04df..27bb60b 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/select/select-disabled-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/select/select-disabled-appearance-expected.png index 2d042fe..22a5036f 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/select/select-disabled-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/select/select-disabled-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/layers/opacity-outline-expected.png b/third_party/blink/web_tests/platform/mac/fast/layers/opacity-outline-expected.png index 14b3afc..d8a2a2263 100644 --- a/third_party/blink/web_tests/platform/mac/fast/layers/opacity-outline-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/layers/opacity-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/layers/opacity-transforms-expected.png b/third_party/blink/web_tests/platform/mac/fast/layers/opacity-transforms-expected.png index 08af2ff..86338cad 100644 --- a/third_party/blink/web_tests/platform/mac/fast/layers/opacity-transforms-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/layers/opacity-transforms-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/multicol/layers-in-multicol-expected.png b/third_party/blink/web_tests/platform/mac/fast/multicol/layers-in-multicol-expected.png index 9243efa..5ef8f01 100644 --- a/third_party/blink/web_tests/platform/mac/fast/multicol/layers-in-multicol-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/multicol/layers-in-multicol-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/overflow/007-expected.png b/third_party/blink/web_tests/platform/mac/fast/overflow/007-expected.png index fc661192..ac3b288a 100644 --- a/third_party/blink/web_tests/platform/mac/fast/overflow/007-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/overflow/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-of-video-outline-expected.png index 013178c..f61ee3b 100644 --- a/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-of-video-outline-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-of-video-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png b/third_party/blink/web_tests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png index 00e3acd..cf8f69a 100644 --- a/third_party/blink/web_tests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/reflections/opacity-reflection-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-collapsed-border-expected.png index 1ef44320..012e4c6f 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-expected.png index 1ef44320..012e4c6f 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.png index 59715b19..e29ab70e 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/multiple-captions-display-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/multiple-captions-display-expected.png index ab164595..25c18fd 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/multiple-captions-display-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/multiple-captions-display-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/overflowHidden-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/overflowHidden-expected.png index d21e749..017447e7 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/overflowHidden-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/overflowHidden-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png index b3936e83..1a661790 100644 --- a/third_party/blink/web_tests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/mac/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac/media/audio-controls-rendering-expected.png index e89c20c1..b7ecf363 100644 --- a/third_party/blink/web_tests/platform/mac/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac/media/audio-repaint-expected.png index 7695770..65d103b8a 100644 --- a/third_party/blink/web_tests/platform/mac/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac/media/controls-layout-direction-expected.png index e8b3f44..c6c98d403 100644 --- a/third_party/blink/web_tests/platform/mac/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/controls/paint-controls-webkit-appearance-none-expected.png b/third_party/blink/web_tests/platform/mac/media/controls/paint-controls-webkit-appearance-none-expected.png index 57f567f..fa740de 100644 --- a/third_party/blink/web_tests/platform/mac/media/controls/paint-controls-webkit-appearance-none-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/controls/paint-controls-webkit-appearance-none-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac/media/media-controls-clone-expected.png index 2aefb5f..487499a 100644 --- a/third_party/blink/web_tests/platform/mac/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/media-controls-grey-scrubber-expected.png b/third_party/blink/web_tests/platform/mac/media/media-controls-grey-scrubber-expected.png index f8171f4..e8477f3 100644 --- a/third_party/blink/web_tests/platform/mac/media/media-controls-grey-scrubber-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/media-controls-grey-scrubber-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/mac/media/media-document-audio-repaint-expected.png index 3231d6e8..72b51c8 100644 --- a/third_party/blink/web_tests/platform/mac/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/video-empty-source-expected.png b/third_party/blink/web_tests/platform/mac/media/video-empty-source-expected.png index fb63ea40..bf010383 100644 --- a/third_party/blink/web_tests/platform/mac/media/video-empty-source-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/video-empty-source-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/media/video-no-audio-expected.png b/third_party/blink/web_tests/platform/mac/media/video-no-audio-expected.png index 3da9638..7e37038 100644 --- a/third_party/blink/web_tests/platform/mac/media/video-no-audio-expected.png +++ b/third_party/blink/web_tests/platform/mac/media/video-no-audio-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/become-overlay-composited-layer-expected.png b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/become-overlay-composited-layer-expected.png index 693ca5f..dd46ae6 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/become-overlay-composited-layer-expected.png +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/become-overlay-composited-layer-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png b/third_party/blink/web_tests/platform/mac/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png index 824bc653..3fe60b5 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png index 00326e9..93032e4b 100644 --- a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png index 154c0132..c01eec9 100644 --- a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png index b75ddac..9e7c1912 100644 --- a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.png index 5b147da..613d88a4 100644 --- a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/text-text-08-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/text-text-08-b-expected.png index 20709a0..f297698 100644 --- a/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/text-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/W3C-SVG-1.1/text-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-5-expected.png index a7019dc9..9506892 100644 --- a/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-5-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-6-expected.png index 124199a..5acd36a 100644 --- a/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-6-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/batik/text/smallFonts-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/smallFonts-expected.png index 94189aa..e3839ac 100644 --- a/third_party/blink/web_tests/platform/mac/svg/batik/text/smallFonts-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/batik/text/smallFonts-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/batik/text/textAnchor-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/textAnchor-expected.png index db5aa346..e18c9e3 100644 --- a/third_party/blink/web_tests/platform/mac/svg/batik/text/textAnchor-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/batik/text/textAnchor-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/batik/text/textFeatures-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/textFeatures-expected.png index 6ae10a6..e2235e5 100644 --- a/third_party/blink/web_tests/platform/mac/svg/batik/text/textFeatures-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/batik/text/textFeatures-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/batik/text/textProperties-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/textProperties-expected.png index cfedc3c..3a67a598 100644 --- a/third_party/blink/web_tests/platform/mac/svg/batik/text/textProperties-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/batik/text/textProperties-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/batik/text/verticalText-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/verticalText-expected.png index ca30a27..a8d3484 100644 --- a/third_party/blink/web_tests/platform/mac/svg/batik/text/verticalText-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/batik/text/verticalText-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/container-opacity-clip-viewBox-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/container-opacity-clip-viewBox-expected.png index 172e1de..5a97bf1 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/container-opacity-clip-viewBox-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/container-opacity-clip-viewBox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/dominant-baseline-hanging-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/dominant-baseline-hanging-expected.png index 81f57ff1..915cbe98 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/dominant-baseline-hanging-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/dominant-baseline-hanging-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/non-opaque-filters-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/non-opaque-filters-expected.png index 86d7115..9155e6e 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/non-opaque-filters-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/non-opaque-filters-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/text-image-opacity-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/text-image-opacity-expected.png index 0587824..264c19c 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/text-image-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/text-image-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-container-in-target-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-container-in-target-expected.png index 8d73aa6..6e44302 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-container-in-target-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-container-in-target-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-target-container-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-target-container-expected.png index e752c114..ed65e53 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-target-container-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-modify-target-container-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-containing-use-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-containing-use-expected.png index c9ba215c..c74116a 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-containing-use-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-containing-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-expected.png index ea32bd1..a8b32e6 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-g-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-use-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-use-expected.png index ea32bd1..a8b32e6 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-on-use-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-on-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/use-transform-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/use-transform-expected.png index 7d14180..40af6944 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/use-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/use-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-08-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-08-b-expected.png index 610ae77..1ad277dc 100644 --- a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/transforms/2d/hindi-rotated-expected.png b/third_party/blink/web_tests/platform/mac/transforms/2d/hindi-rotated-expected.png index 1ce9b39..bc17ac2 100644 --- a/third_party/blink/web_tests/platform/mac/transforms/2d/hindi-rotated-expected.png +++ b/third_party/blink/web_tests/platform/mac/transforms/2d/hindi-rotated-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/transforms/transform-on-inline-expected.png b/third_party/blink/web_tests/platform/mac/transforms/transform-on-inline-expected.png index bd5999b..9885212 100644 --- a/third_party/blink/web_tests/platform/mac/transforms/transform-on-inline-expected.png +++ b/third_party/blink/web_tests/platform/mac/transforms/transform-on-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/transforms/transform-table-row-expected.png b/third_party/blink/web_tests/platform/mac/transforms/transform-table-row-expected.png index 61d19bf..3292044d 100644 --- a/third_party/blink/web_tests/platform/mac/transforms/transform-table-row-expected.png +++ b/third_party/blink/web_tests/platform/mac/transforms/transform-table-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/transforms/transforms-with-opacity-expected.png b/third_party/blink/web_tests/platform/mac/transforms/transforms-with-opacity-expected.png index b6ad1bc..5147027 100644 --- a/third_party/blink/web_tests/platform/mac/transforms/transforms-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac/transforms/transforms-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png index cb8efa6..d39e1dca 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png index 4a32480..038c7c3 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 188e8b3..b9e4613 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 3bd95da..59581e1 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 5da3c2f..17d0760b 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index 5946bb7..9173ea0 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/video-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/video-focus-ring-expected.png index 2fd291d..52a0595 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/video-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/dark-color-scheme/media/video-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/complex-text-opacity-expected.png b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/complex-text-opacity-expected.png index befe4c2d..3bb9fd1e 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/complex-text-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/complex-text-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/letter-spacing-negative-opacity-expected.png b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/letter-spacing-negative-opacity-expected.png index 2a6aeab2..20a43e9 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/letter-spacing-negative-opacity-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/letter-spacing-negative-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/compositing/transitions/scale-transition-no-start-expected.png b/third_party/blink/web_tests/platform/win/compositing/transitions/scale-transition-no-start-expected.png index ba342f94..5ec2f87 100644 --- a/third_party/blink/web_tests/platform/win/compositing/transitions/scale-transition-no-start-expected.png +++ b/third_party/blink/web_tests/platform/win/compositing/transitions/scale-transition-no-start-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/backgrounds/opacity-on-document-element-expected.png b/third_party/blink/web_tests/platform/win/fast/backgrounds/opacity-on-document-element-expected.png index 9747f57..5a673e14 100644 --- a/third_party/blink/web_tests/platform/win/fast/backgrounds/opacity-on-document-element-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/backgrounds/opacity-on-document-element-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/block/float/float-in-float-painting-expected.png b/third_party/blink/web_tests/platform/win/fast/block/float/float-in-float-painting-expected.png index bdf0d1d..64cf90b 100644 --- a/third_party/blink/web_tests/platform/win/fast/block/float/float-in-float-painting-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/block/float/float-in-float-painting-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers-expected.png b/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers-expected.png index bdb3ec29..e74c8df4 100644 --- a/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers2-expected.png b/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers2-expected.png index 8b2342f..b0fdea8 100644 --- a/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers2-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/css/ZeroOpacityLayers2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index a1f4c8a4..f2940d3 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index add7f3e..7f3c21ef 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 826fe95..60cbf92 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/indeterminate-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/indeterminate-expected.png index 200990c..13839c3 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/indeterminate-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/indeterminate-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/select/basic-selects-expected.png index f1acb10..2d49530 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/select/disabled-select-change-index-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/select/disabled-select-change-index-expected.png index c4b6024..68d5b87b 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/select/disabled-select-change-index-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/select/disabled-select-change-index-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png index 106ca1dc..40487c0 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/select/select-disabled-appearance-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/select/select-disabled-appearance-expected.png index dcf5405..adb6ab47 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/select/select-disabled-appearance-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/select/select-disabled-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/layers/opacity-outline-expected.png b/third_party/blink/web_tests/platform/win/fast/layers/opacity-outline-expected.png index 0665e08..8b65132 100644 --- a/third_party/blink/web_tests/platform/win/fast/layers/opacity-outline-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/layers/opacity-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/layers/opacity-transforms-expected.png b/third_party/blink/web_tests/platform/win/fast/layers/opacity-transforms-expected.png index e8c858a..bb3e23ce 100644 --- a/third_party/blink/web_tests/platform/win/fast/layers/opacity-transforms-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/layers/opacity-transforms-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/multicol/layers-in-multicol-expected.png b/third_party/blink/web_tests/platform/win/fast/multicol/layers-in-multicol-expected.png index 62b98ea..c4448e1 100644 --- a/third_party/blink/web_tests/platform/win/fast/multicol/layers-in-multicol-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/multicol/layers-in-multicol-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/overflow/007-expected.png b/third_party/blink/web_tests/platform/win/fast/overflow/007-expected.png index 58f301d..282116cb 100644 --- a/third_party/blink/web_tests/platform/win/fast/overflow/007-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/overflow/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/win/fast/overflow/overflow-of-video-outline-expected.png index b00fcf7..882072bf 100644 --- a/third_party/blink/web_tests/platform/win/fast/overflow/overflow-of-video-outline-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/overflow/overflow-of-video-outline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/reflections/opacity-reflection-transform-expected.png b/third_party/blink/web_tests/platform/win/fast/reflections/opacity-reflection-transform-expected.png index 49eb015..beeff6d 100644 --- a/third_party/blink/web_tests/platform/win/fast/reflections/opacity-reflection-transform-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/reflections/opacity-reflection-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-collapsed-border-expected.png b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-collapsed-border-expected.png index ec6a410..baaa365 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-expected.png b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-expected.png index ec6a410..baaa365 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/dynamic-caption-add-before-child-expected.png b/third_party/blink/web_tests/platform/win/fast/table/dynamic-caption-add-before-child-expected.png index a3ad924..9635330 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/dynamic-caption-add-before-child-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/dynamic-caption-add-before-child-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/multiple-captions-display-expected.png b/third_party/blink/web_tests/platform/win/fast/table/multiple-captions-display-expected.png index 5d42064..89a602de 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/multiple-captions-display-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/multiple-captions-display-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/overflowHidden-expected.png b/third_party/blink/web_tests/platform/win/fast/table/overflowHidden-expected.png index 03e045c..c1958c4 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/overflowHidden-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/overflowHidden-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png b/third_party/blink/web_tests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png index 6b9ac5e..fc802cf 100644 --- a/third_party/blink/web_tests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png +++ b/third_party/blink/web_tests/platform/win/http/tests/media/video-buffered-range-contains-currentTime-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/win/media/audio-controls-rendering-expected.png index 844fb6a..da02658 100644 --- a/third_party/blink/web_tests/platform/win/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/win/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/audio-repaint-expected.png b/third_party/blink/web_tests/platform/win/media/audio-repaint-expected.png index 762754e..25b07db4 100644 --- a/third_party/blink/web_tests/platform/win/media/audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/win/media/audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/win/media/controls-layout-direction-expected.png index 9fdf0d0a..e2e05d38 100644 --- a/third_party/blink/web_tests/platform/win/media/controls-layout-direction-expected.png +++ b/third_party/blink/web_tests/platform/win/media/controls-layout-direction-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/controls/paint-controls-webkit-appearance-none-expected.png b/third_party/blink/web_tests/platform/win/media/controls/paint-controls-webkit-appearance-none-expected.png index 9250d78c..45523bbc 100644 --- a/third_party/blink/web_tests/platform/win/media/controls/paint-controls-webkit-appearance-none-expected.png +++ b/third_party/blink/web_tests/platform/win/media/controls/paint-controls-webkit-appearance-none-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/win/media/media-controls-clone-expected.png index a47ccc3..b6a87a6 100644 --- a/third_party/blink/web_tests/platform/win/media/media-controls-clone-expected.png +++ b/third_party/blink/web_tests/platform/win/media/media-controls-clone-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/media-controls-grey-scrubber-expected.png b/third_party/blink/web_tests/platform/win/media/media-controls-grey-scrubber-expected.png index ce318fd1..e4f0e7d3 100644 --- a/third_party/blink/web_tests/platform/win/media/media-controls-grey-scrubber-expected.png +++ b/third_party/blink/web_tests/platform/win/media/media-controls-grey-scrubber-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/media-document-audio-repaint-expected.png b/third_party/blink/web_tests/platform/win/media/media-document-audio-repaint-expected.png index ce5124d..474da4b4 100644 --- a/third_party/blink/web_tests/platform/win/media/media-document-audio-repaint-expected.png +++ b/third_party/blink/web_tests/platform/win/media/media-document-audio-repaint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/video-empty-source-expected.png b/third_party/blink/web_tests/platform/win/media/video-empty-source-expected.png index f6ee66b..cb6e108 100644 --- a/third_party/blink/web_tests/platform/win/media/video-empty-source-expected.png +++ b/third_party/blink/web_tests/platform/win/media/video-empty-source-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/media/video-no-audio-expected.png b/third_party/blink/web_tests/platform/win/media/video-no-audio-expected.png index 65d4ce7..e819ae4d 100644 --- a/third_party/blink/web_tests/platform/win/media/video-no-audio-expected.png +++ b/third_party/blink/web_tests/platform/win/media/video-no-audio-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/paint/invalidation/compositing/become-overlay-composited-layer-expected.png b/third_party/blink/web_tests/platform/win/paint/invalidation/compositing/become-overlay-composited-layer-expected.png index e19b323a..ba54015 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/compositing/become-overlay-composited-layer-expected.png +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/compositing/become-overlay-composited-layer-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png b/third_party/blink/web_tests/platform/win/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png index 1b5bd12..a798712 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/svg/scrolling-embedded-svg-file-image-repaint-problem-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png index c38d4928..c463bf4 100644 --- a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/animate-elem-22-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png index e359034..dacee76 100644 --- a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png index fea2c473..14767ab 100644 --- a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/masking-opacity-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/render-groups-01-b-expected.png b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/render-groups-01-b-expected.png index 8d88bae6..649f0b9f 100644 --- a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/render-groups-01-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/render-groups-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/text-text-08-b-expected.png b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/text-text-08-b-expected.png index 1c68e42d..61210efa 100644 --- a/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/text-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/W3C-SVG-1.1/text-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-5-expected.png b/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-5-expected.png index 23c82431..6092be3 100644 --- a/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-5-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-5-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-6-expected.png b/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-6-expected.png index 7aa5733..cc268560 100644 --- a/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-6-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/as-background-image/svg-as-background-6-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/batik/text/smallFonts-expected.png b/third_party/blink/web_tests/platform/win/svg/batik/text/smallFonts-expected.png index c34cad7..c0f8338f 100644 --- a/third_party/blink/web_tests/platform/win/svg/batik/text/smallFonts-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/batik/text/smallFonts-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/batik/text/textAnchor-expected.png b/third_party/blink/web_tests/platform/win/svg/batik/text/textAnchor-expected.png index b59653eb..d4075d0 100644 --- a/third_party/blink/web_tests/platform/win/svg/batik/text/textAnchor-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/batik/text/textAnchor-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/batik/text/textFeatures-expected.png b/third_party/blink/web_tests/platform/win/svg/batik/text/textFeatures-expected.png index 0d4a2f7..3b37f36 100644 --- a/third_party/blink/web_tests/platform/win/svg/batik/text/textFeatures-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/batik/text/textFeatures-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/batik/text/textProperties-expected.png b/third_party/blink/web_tests/platform/win/svg/batik/text/textProperties-expected.png index c84989f..f57a321 100644 --- a/third_party/blink/web_tests/platform/win/svg/batik/text/textProperties-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/batik/text/textProperties-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/batik/text/verticalText-expected.png b/third_party/blink/web_tests/platform/win/svg/batik/text/verticalText-expected.png index 625163d..dae9fba 100644 --- a/third_party/blink/web_tests/platform/win/svg/batik/text/verticalText-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/batik/text/verticalText-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/container-opacity-clip-viewBox-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/container-opacity-clip-viewBox-expected.png index a4baca7..6aaa787 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/container-opacity-clip-viewBox-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/container-opacity-clip-viewBox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/dominant-baseline-hanging-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/dominant-baseline-hanging-expected.png index c6478373..92a59e9b 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/dominant-baseline-hanging-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/dominant-baseline-hanging-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/non-opaque-filters-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/non-opaque-filters-expected.png index f09068f8..6d6b443 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/non-opaque-filters-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/non-opaque-filters-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/text-image-opacity-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/text-image-opacity-expected.png index b139a65..e840fe6 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/text-image-opacity-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/text-image-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-modify-container-in-target-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-modify-container-in-target-expected.png index 2481e20..752cbf31 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-modify-container-in-target-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-modify-container-in-target-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-modify-target-container-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-modify-target-container-expected.png index 7a22566b..a44a7f6c 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-modify-target-container-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-modify-target-container-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-containing-use-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-containing-use-expected.png index 95940b8..9fb95a6 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-containing-use-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-containing-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-expected.png index be2f09d..9a138a9 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-on-g-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-on-use-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-on-use-expected.png index be2f09d..9a138a9 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-on-use-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-on-use-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/use-transform-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/use-transform-expected.png index c07b5335..20f1d7d 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/use-transform-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/use-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-08-b-expected.png b/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-08-b-expected.png index 396b36a0..4df2bed 100644 --- a/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-08-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-08-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/transforms/2d/hindi-rotated-expected.png b/third_party/blink/web_tests/platform/win/transforms/2d/hindi-rotated-expected.png index 7a9bba8..8a89787 100644 --- a/third_party/blink/web_tests/platform/win/transforms/2d/hindi-rotated-expected.png +++ b/third_party/blink/web_tests/platform/win/transforms/2d/hindi-rotated-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/transforms/transform-on-inline-expected.png b/third_party/blink/web_tests/platform/win/transforms/transform-on-inline-expected.png index 363f65ba..5aa1e5c 100644 --- a/third_party/blink/web_tests/platform/win/transforms/transform-on-inline-expected.png +++ b/third_party/blink/web_tests/platform/win/transforms/transform-on-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/transforms/transform-table-row-expected.png b/third_party/blink/web_tests/platform/win/transforms/transform-table-row-expected.png index 0400927..b672010 100644 --- a/third_party/blink/web_tests/platform/win/transforms/transform-table-row-expected.png +++ b/third_party/blink/web_tests/platform/win/transforms/transform-table-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/transforms/transforms-with-opacity-expected.png b/third_party/blink/web_tests/platform/win/transforms/transforms-with-opacity-expected.png index eb1301c0..905bc920 100644 --- a/third_party/blink/web_tests/platform/win/transforms/transforms-with-opacity-expected.png +++ b/third_party/blink/web_tests/platform/win/transforms/transforms-with-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png index 4f6e863..6b21f0f 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png index ef2ec41..57edcb9 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png index 5301e48..9ec54d7e 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-disabled-multiple-hover-focused-unselected-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 05647eac..49f20260 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index 4e616fa..2f0714b1 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png index 3191694..046cf3ec 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-controls-rendering-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-focus-ring-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-focus-ring-expected.png index c0cea46..8f26a75 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/audio-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/video-focus-ring-expected.png b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/video-focus-ring-expected.png index dd749e9..e04cd5aa 100644 --- a/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/video-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/dark-color-scheme/media/video-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/text-antialias/complex-text-opacity-expected.png b/third_party/blink/web_tests/platform/win/virtual/text-antialias/complex-text-opacity-expected.png index 31a16b7..9fa8e1f 100644 --- a/third_party/blink/web_tests/platform/win/virtual/text-antialias/complex-text-opacity-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/text-antialias/complex-text-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/text-antialias/letter-spacing-negative-opacity-expected.png b/third_party/blink/web_tests/platform/win/virtual/text-antialias/letter-spacing-negative-opacity-expected.png index 8f41d22..d2b040dc 100644 --- a/third_party/blink/web_tests/platform/win/virtual/text-antialias/letter-spacing-negative-opacity-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/text-antialias/letter-spacing-negative-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/resources/testdriver-vendor.js b/third_party/blink/web_tests/resources/testdriver-vendor.js index cf4307a..42cc093 100644 --- a/third_party/blink/web_tests/resources/testdriver-vendor.js +++ b/third_party/blink/web_tests/resources/testdriver-vendor.js
@@ -1,5 +1,12 @@ (function() { "use strict"; + + if (navigator.webdriver) { + // Only add the bespoke automation below when running with `content_shell` + // in protocol mode (i.e., not webdriver). + return; + } + // Define functions one by one and do not override the whole // test_driver_internal as it masks the new testing fucntions // that will be added in the future.
diff --git a/third_party/blink/web_tests/svg/custom/group-opacity-expected.png b/third_party/blink/web_tests/svg/custom/group-opacity-expected.png index f1a5b9d3..eca9f5c3 100644 --- a/third_party/blink/web_tests/svg/custom/group-opacity-expected.png +++ b/third_party/blink/web_tests/svg/custom/group-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/custom/marker-opacity-expected.png b/third_party/blink/web_tests/svg/custom/marker-opacity-expected.png index 29aad87..cea8b9a 100644 --- a/third_party/blink/web_tests/svg/custom/marker-opacity-expected.png +++ b/third_party/blink/web_tests/svg/custom/marker-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/custom/marker-zero-length-linecaps-expected.png b/third_party/blink/web_tests/svg/custom/marker-zero-length-linecaps-expected.png index 5952106d..9210d18 100644 --- a/third_party/blink/web_tests/svg/custom/marker-zero-length-linecaps-expected.png +++ b/third_party/blink/web_tests/svg/custom/marker-zero-length-linecaps-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/custom/root-container-opacity-clip-viewBox-expected.png b/third_party/blink/web_tests/svg/custom/root-container-opacity-clip-viewBox-expected.png index b506046..74c7211 100644 --- a/third_party/blink/web_tests/svg/custom/root-container-opacity-clip-viewBox-expected.png +++ b/third_party/blink/web_tests/svg/custom/root-container-opacity-clip-viewBox-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-dom-mode-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-in2-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png index a7602b0..d3083ae7 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGFEBlendElement-svgdom-mode-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-height-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png index 2292c99..4bf20c1 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-width-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-x-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-dom-y-attr-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-height-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskContentUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png index 2292c99..4bf20c1 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-maskUnits-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-width-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-x-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png index 2b62614..c7f575b 100644 --- a/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png +++ b/third_party/blink/web_tests/svg/dynamic-updates/SVGMaskElement-svgdom-y-prop-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/foreignObject/clip-expected.png b/third_party/blink/web_tests/svg/foreignObject/clip-expected.png index 2ad1e2d..f42980c 100644 --- a/third_party/blink/web_tests/svg/foreignObject/clip-expected.png +++ b/third_party/blink/web_tests/svg/foreignObject/clip-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/foreignObject/filter-expected.png b/third_party/blink/web_tests/svg/foreignObject/filter-expected.png index ef4492f..6927d79 100644 --- a/third_party/blink/web_tests/svg/foreignObject/filter-expected.png +++ b/third_party/blink/web_tests/svg/foreignObject/filter-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/svg/foreignObject/mask-expected.png b/third_party/blink/web_tests/svg/foreignObject/mask-expected.png index ef4492f..6927d79 100644 --- a/third_party/blink/web_tests/svg/foreignObject/mask-expected.png +++ b/third_party/blink/web_tests/svg/foreignObject/mask-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt b/third_party/blink/web_tests/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt deleted file mode 100644 index c458c28..0000000 --- a/third_party/blink/web_tests/virtual/plz-dedicated-worker/http/tests/devtools/layers/layer-canvas-log-expected.txt +++ /dev/null
@@ -1,177 +0,0 @@ -Tests layer command log - -Canvas log: -{ - 0 : { - commandIndex : 0 - method : "drawPaint" - params : { - paint : { - blendMode : "Src" - color : "#00000000" - flags : "none" - strokeCap : "Butt" - strokeJoin : "Miter" - strokeMiter : 4 - strokeWidth : 0 - styleName : "Fill" - } - } - } - 1 : { - commandIndex : 1 - method : "drawRect" - params : { - paint : { - color : "#FF0000FF" - flags : "AntiAlias" - strokeCap : "Butt" - strokeJoin : "Miter" - strokeMiter : 4 - strokeWidth : 0 - styleName : "Fill" - } - rect : { - bottom : 100 - left : 0 - right : 100 - top : 0 - } - } - } - 10 : { - commandIndex : 10 - method : "drawRect" - params : { - paint : { - color : "#7F000000" - flags : "AntiAlias" - strokeCap : "Butt" - strokeJoin : "Miter" - strokeMiter : 4 - strokeWidth : 0 - styleName : "Fill" - } - rect : { - bottom : 10 - left : 0 - right : 10 - top : 0 - } - } - } - 11 : { - commandIndex : 11 - method : "restore" - params : undefined - } - 2 : { - commandIndex : 2 - method : "drawRect" - params : { - paint : { - color : "#FFFF0000" - flags : "AntiAlias" - strokeCap : "Butt" - strokeJoin : "Miter" - strokeMiter : 4 - strokeWidth : 0 - styleName : "Fill" - } - rect : { - bottom : 50 - left : 0 - right : 50 - top : 0 - } - } - } - 3 : { - commandIndex : 3 - method : "save" - params : undefined - } - 4 : { - commandIndex : 4 - method : "concat44" - params : { - matrix44 : [ - 1 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 50 - 0 - 1 - ] - } - } - 5 : { - commandIndex : 5 - method : "drawImage" - params : { - image : { - height : 21 - opaque : false - width : 19 - } - left : 0 - paint : { - color : "#FF000000" - flags : "AntiAlias" - strokeCap : "Butt" - strokeJoin : "Miter" - strokeMiter : 4 - strokeWidth : 0 - styleName : "Fill" - } - sampling : { - filter : "kLinear" - mipmap : "kNearest" - } - top : 0 - } - } - 6 : { - commandIndex : 6 - method : "restore" - params : undefined - } - 7 : { - commandIndex : 7 - method : "save" - params : undefined - } - 8 : { - commandIndex : 8 - method : "translate" - params : { - dx : 0 - dy : 71 - } - } - 9 : { - commandIndex : 9 - method : "clipRect" - params : { - SkRegion::Op : "kIntersect_Op" - rect : { - bottom : 150 - left : 0 - right : 300 - top : 0 - } - softClipEdgeStyle : true - } - } -} -
diff --git a/third_party/blink/web_tests/virtual/scalefactor200/css3/filters/css-opacity-with-drop-shadow-expected.png b/third_party/blink/web_tests/virtual/scalefactor200/css3/filters/css-opacity-with-drop-shadow-expected.png index 5cd9b2b7..02399e8 100644 --- a/third_party/blink/web_tests/virtual/scalefactor200/css3/filters/css-opacity-with-drop-shadow-expected.png +++ b/third_party/blink/web_tests/virtual/scalefactor200/css3/filters/css-opacity-with-drop-shadow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index b82d1aef..b9f1ce15c1 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -4892,6 +4892,7 @@ getter token method constructor interface IdentityProvider + static method getUserInfo static method login static method logout attribute @@toStringTag
diff --git a/third_party/nearby/BUILD.gn b/third_party/nearby/BUILD.gn index 9570983..7300798 100644 --- a/third_party/nearby/BUILD.gn +++ b/third_party/nearby/BUILD.gn
@@ -768,7 +768,6 @@ "src/presence/data_types.h", "src/presence/device_motion.h", "src/presence/discovery_filter.h", - "src/presence/listeners.h", "src/presence/power_mode.h", "src/presence/presence_action.h", "src/presence/presence_device.h",
diff --git a/third_party/nearby/README.chromium b/third_party/nearby/README.chromium index 90713d1..31f32da6 100644 --- a/third_party/nearby/README.chromium +++ b/third_party/nearby/README.chromium
@@ -1,7 +1,7 @@ Name: Nearby Connections Library Short Name: Nearby URL: https://github.com/google/nearby -Version: ea3fa0e3924c9e4be23504cbde398cef305d3197 +Version: 43ec97b13bdaf7cb90941a87b0457948d4a0410d License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-depth-gpu.html b/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-depth-gpu.html index 8a670ee7..9ee7609 100644 --- a/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-depth-gpu.html +++ b/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-depth-gpu.html
@@ -58,6 +58,12 @@ This sample demonstrates use of a depth API in immersive-ar session. The data will be uploaded to the GPU & accessed from a shader. <a class="back" href="./index.html">Back</a> + + <br/> + <hr/> + + <input id="useFrontFacing" type="checkbox"> + <label for="useFrontFacing">Enable front-facing camera</label> </p> </details> </header> @@ -82,6 +88,8 @@ <script type="module"> import {mat4, vec3, mat3, vec2} from '../js/cottontail/src/math/gl-matrix.js'; + const useFrontFacing = document.getElementById('useFrontFacing'); + // XR globals. let xrButton = null; let xrRefSpace = null; @@ -126,6 +134,7 @@ let options = { requiredFeatures: ['depth-sensing', 'dom-overlay'], + optionalFeatures: [], domOverlay: { root: textOverlayElement }, depthSensing: { usagePreference: ["cpu-optimized"], @@ -133,6 +142,10 @@ } }; + if (useFrontFacing.checked) { + options.optionalFeatures.push('front-facing'); + } + navigator.xr.requestSession('immersive-ar', options).then((session) => { session.mode = 'immersive-ar'; xrButton.setSession(session); @@ -144,6 +157,8 @@ } function onSessionStarted(session) { + useFrontFacing.disabled = true; + session.addEventListener('end', onSessionEnded); let canvas = document.createElement('canvas'); @@ -173,6 +188,7 @@ } function onSessionEnded(event) { + useFrontFacing.disabled = false; xrButton.setSession(null); }
diff --git a/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-hit-test.html b/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-hit-test.html index 9a7d714..cf5e7ef7 100644 --- a/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-hit-test.html +++ b/third_party/webxr_test_pages/webxr-samples/proposals/phone-ar-hit-test.html
@@ -48,13 +48,18 @@ <p> This sample demonstrates use of hit testing to place AR objects on real-world surfaces. <a class="back" href="./index.html">Back</a> + <br/> <hr/> + <input id="useReticle" type="checkbox" checked> <label for="useReticle">Use reticle for placement</label><br/> <input id="useDomOverlay" type="checkbox" checked> <label for="useDomOverlay">Enable DOM Overlay</label><br/> + + <input id="useFrontFacing" type="checkbox"> + <label for="useFrontFacing">Enable front-facing camera</label> </p> </details> </header> @@ -90,6 +95,7 @@ let useReticle = document.getElementById('useReticle'); const useDomOverlay = document.getElementById('useDomOverlay'); + const useFrontFacing = document.getElementById('useFrontFacing'); // Debugging constants. const unsubscribeAfterTouch = false; // unsubscribe from hit test after first touch if in reticle mode? @@ -106,6 +112,7 @@ // XR globals. let xrSession = null; + let xrFrontFacingEnabled = null; let xrButton = null; let xrRefSpace = null; let xrLocalFloor = null; @@ -211,10 +218,16 @@ requiredFeatures: ['local-floor', 'hit-test'], optionalFeatures: ['anchors'], }; + if (useDomOverlay.checked) { options.optionalFeatures.push('dom-overlay'); options.domOverlay = {root: document.body}; } + + if (useFrontFacing.checked) { + options.optionalFeatures.push('front-facing'); + } + navigator.xr.requestSession('immersive-ar', options).then((session) => { session.mode = 'immersive-ar'; xrButton.setSession(session); @@ -240,7 +253,11 @@ function onSessionStarted(session) { useDomOverlay.disabled = true; + useFrontFacing.disabled = true; + xrSession = session; + xrFrontFacingEnabled = xrSession.enabledFeatures.includes("front-facing"); + session.addEventListener('end', onSessionEnded); session.addEventListener('select', onSelect); session.addEventListener('inputsourceschange', onInputSourcesChange); @@ -295,6 +312,7 @@ function onSessionEnded(event) { useDomOverlay.disabled = false; + useFrontFacing.disabled = false; xrButton.setSession(null); xrSession = null; } @@ -504,6 +522,10 @@ scene.startFrame(); + if (xrFrontFacingEnabled) { + gl.frontFace(gl.CW); + } + scene.drawXRFrame(frame, pose); scene.endFrame();
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.h b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.h index f611e638..43307442 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.h +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.h
@@ -154,6 +154,18 @@ #endif /* __GoogleUpdate3WebSystemClass_FWD_DEFINED__ */ +#ifndef __GoogleUpdate3WebServiceClass_FWD_DEFINED__ +#define __GoogleUpdate3WebServiceClass_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#else +typedef struct GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#endif /* __cplusplus */ + +#endif /* __GoogleUpdate3WebServiceClass_FWD_DEFINED__ */ + + #ifndef __PolicyStatusUserClass_FWD_DEFINED__ #define __PolicyStatusUserClass_FWD_DEFINED__ @@ -2773,6 +2785,14 @@ GoogleUpdate3WebSystemClass; #endif +EXTERN_C const CLSID CLSID_GoogleUpdate3WebServiceClass; + +#ifdef __cplusplus + +class DECLSPEC_UUID("687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2") +GoogleUpdate3WebServiceClass; +#endif + EXTERN_C const CLSID CLSID_PolicyStatusUserClass; #ifdef __cplusplus
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.tlb b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.tlb index eb7ebd55..4313862 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.tlb +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl.tlb Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl_i.c b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl_i.c index be777ac..37068aa 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl_i.c +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/arm64/updater_legacy_idl_i.c
@@ -109,6 +109,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebSystemClass,0xFAC5C548,0x84EC,0x474C,0xA4,0xB3,0xCD,0x41,0x4E,0x09,0xB1,0x4C); +MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebServiceClass,0x687DCE9A,0x57BE,0x4026,0xBE,0xC4,0xC0,0xA9,0xAC,0xBB,0xCA,0xF2); + + MIDL_DEFINE_GUID(CLSID, CLSID_PolicyStatusUserClass,0xE432DCFE,0x6A32,0x4C07,0xB0,0x38,0x9D,0x74,0xAC,0x80,0xD6,0xAB);
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.h b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.h index ea37044..9ec3afe 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.h +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.h
@@ -154,6 +154,18 @@ #endif /* __GoogleUpdate3WebSystemClass_FWD_DEFINED__ */ +#ifndef __GoogleUpdate3WebServiceClass_FWD_DEFINED__ +#define __GoogleUpdate3WebServiceClass_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#else +typedef struct GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#endif /* __cplusplus */ + +#endif /* __GoogleUpdate3WebServiceClass_FWD_DEFINED__ */ + + #ifndef __PolicyStatusUserClass_FWD_DEFINED__ #define __PolicyStatusUserClass_FWD_DEFINED__ @@ -2773,6 +2785,14 @@ GoogleUpdate3WebSystemClass; #endif +EXTERN_C const CLSID CLSID_GoogleUpdate3WebServiceClass; + +#ifdef __cplusplus + +class DECLSPEC_UUID("687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2") +GoogleUpdate3WebServiceClass; +#endif + EXTERN_C const CLSID CLSID_PolicyStatusUserClass; #ifdef __cplusplus
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.tlb b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.tlb index eb7ebd55..4313862 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.tlb +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl.tlb Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl_i.c b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl_i.c index ae60ac4..af06e66d 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl_i.c +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x64/updater_legacy_idl_i.c
@@ -109,6 +109,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebSystemClass,0xFAC5C548,0x84EC,0x474C,0xA4,0xB3,0xCD,0x41,0x4E,0x09,0xB1,0x4C); +MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebServiceClass,0x687DCE9A,0x57BE,0x4026,0xBE,0xC4,0xC0,0xA9,0xAC,0xBB,0xCA,0xF2); + + MIDL_DEFINE_GUID(CLSID, CLSID_PolicyStatusUserClass,0xE432DCFE,0x6A32,0x4C07,0xB0,0x38,0x9D,0x74,0xAC,0x80,0xD6,0xAB);
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.h b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.h index 7a34a92..5857e98 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.h +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.h
@@ -154,6 +154,18 @@ #endif /* __GoogleUpdate3WebSystemClass_FWD_DEFINED__ */ +#ifndef __GoogleUpdate3WebServiceClass_FWD_DEFINED__ +#define __GoogleUpdate3WebServiceClass_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#else +typedef struct GoogleUpdate3WebServiceClass GoogleUpdate3WebServiceClass; +#endif /* __cplusplus */ + +#endif /* __GoogleUpdate3WebServiceClass_FWD_DEFINED__ */ + + #ifndef __PolicyStatusUserClass_FWD_DEFINED__ #define __PolicyStatusUserClass_FWD_DEFINED__ @@ -2773,6 +2785,14 @@ GoogleUpdate3WebSystemClass; #endif +EXTERN_C const CLSID CLSID_GoogleUpdate3WebServiceClass; + +#ifdef __cplusplus + +class DECLSPEC_UUID("687DCE9A-57BE-4026-BEC4-C0A9ACBBCAF2") +GoogleUpdate3WebServiceClass; +#endif + EXTERN_C const CLSID CLSID_PolicyStatusUserClass; #ifdef __cplusplus
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.tlb b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.tlb index 7091148..12927c6d 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.tlb +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl.tlb Binary files differ
diff --git a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl_i.c b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl_i.c index 3531a187..a2f894e 100644 --- a/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl_i.c +++ b/third_party/win_build_output/midl/chrome/updater/app/server/win/x86/updater_legacy_idl_i.c
@@ -109,6 +109,9 @@ MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebSystemClass,0xFAC5C548,0x84EC,0x474C,0xA4,0xB3,0xCD,0x41,0x4E,0x09,0xB1,0x4C); +MIDL_DEFINE_GUID(CLSID, CLSID_GoogleUpdate3WebServiceClass,0x687DCE9A,0x57BE,0x4026,0xBE,0xC4,0xC0,0xA9,0xAC,0xBB,0xCA,0xF2); + + MIDL_DEFINE_GUID(CLSID, CLSID_PolicyStatusUserClass,0xE432DCFE,0x6A32,0x4C07,0xB0,0x38,0x9D,0x74,0xAC,0x80,0xD6,0xAB);
diff --git a/tools/clang/plugins/CMakeLists.txt b/tools/clang/plugins/CMakeLists.txt index daf84e8..a320280 100644 --- a/tools/clang/plugins/CMakeLists.txt +++ b/tools/clang/plugins/CMakeLists.txt
@@ -7,6 +7,7 @@ CheckIPCVisitor.cpp CheckLayoutObjectMethodsVisitor.cpp RawPtrHelpers.cpp + StackAllocatedChecker.cpp Util.cpp )
diff --git a/tools/clang/plugins/FindBadConstructsAction.cpp b/tools/clang/plugins/FindBadConstructsAction.cpp index a8094ee..0500db1 100644 --- a/tools/clang/plugins/FindBadConstructsAction.cpp +++ b/tools/clang/plugins/FindBadConstructsAction.cpp
@@ -83,6 +83,8 @@ options_.check_bad_raw_ptr_cast = true; } else if (arg == "check-raw-ptr-fields") { options_.check_raw_ptr_fields = true; + } else if (arg == "check-stack-allocated") { + options_.check_stack_allocated = true; } else { llvm::errs() << "Unknown clang plugin argument: " << arg << "\n"; return false;
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp index 5a5cf5d..49abc8aa5 100644 --- a/tools/clang/plugins/FindBadConstructsConsumer.cpp +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
@@ -129,6 +129,9 @@ if (options.check_layout_object_methods) { layout_visitor_.reset(new CheckLayoutObjectMethodsVisitor(instance)); } + if (options.check_stack_allocated) { + stack_allocated_checker_.reset(new StackAllocatedChecker(instance)); + } // Messages for virtual methods. diag_method_requires_override_ = diagnostic().getCustomDiagID( @@ -243,6 +246,14 @@ return result; } +bool FindBadConstructsConsumer::VisitCXXRecordDecl( + clang::CXXRecordDecl* cxx_record_decl) { + if (stack_allocated_checker_) { + stack_allocated_checker_->Check(cxx_record_decl); + } + return true; +} + bool FindBadConstructsConsumer::VisitEnumDecl(clang::EnumDecl* decl) { CheckEnumMaxValue(decl); return true;
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.h b/tools/clang/plugins/FindBadConstructsConsumer.h index 5f20257..4ce8c62d 100644 --- a/tools/clang/plugins/FindBadConstructsConsumer.h +++ b/tools/clang/plugins/FindBadConstructsConsumer.h
@@ -36,6 +36,7 @@ #include "CheckLayoutObjectMethodsVisitor.h" #include "ChromeClassTester.h" #include "Options.h" +#include "StackAllocatedChecker.h" #include "SuppressibleDiagnosticBuilder.h" namespace chrome_checker { @@ -52,6 +53,7 @@ // RecursiveASTVisitor: bool TraverseDecl(clang::Decl* decl); + bool VisitCXXRecordDecl(clang::CXXRecordDecl* cxx_record_decl); bool VisitEnumDecl(clang::EnumDecl* enum_decl); bool VisitTagDecl(clang::TagDecl* tag_decl); bool VisitVarDecl(clang::VarDecl* var_decl); @@ -139,6 +141,7 @@ std::unique_ptr<BlinkDataMemberTypeChecker> blink_data_member_type_checker_; std::unique_ptr<CheckIPCVisitor> ipc_visitor_; std::unique_ptr<CheckLayoutObjectMethodsVisitor> layout_visitor_; + std::unique_ptr<StackAllocatedChecker> stack_allocated_checker_; }; } // namespace chrome_checker
diff --git a/tools/clang/plugins/Options.h b/tools/clang/plugins/Options.h index 4174138..e70afe7 100644 --- a/tools/clang/plugins/Options.h +++ b/tools/clang/plugins/Options.h
@@ -17,6 +17,7 @@ bool raw_ref_template_as_trivial_member = false; bool check_bad_raw_ptr_cast = false; bool check_raw_ptr_fields = false; + bool check_stack_allocated = false; std::string exclude_fields_file; std::string exclude_paths_file; };
diff --git a/tools/clang/plugins/StackAllocatedChecker.cpp b/tools/clang/plugins/StackAllocatedChecker.cpp new file mode 100644 index 0000000..e94b5ec --- /dev/null +++ b/tools/clang/plugins/StackAllocatedChecker.cpp
@@ -0,0 +1,142 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "StackAllocatedChecker.h" + +#include "clang/AST/Attr.h" +#include "clang/AST/DeclCXX.h" +#include "clang/AST/DeclTemplate.h" +#include "clang/Frontend/CompilerInstance.h" + +namespace chrome_checker { + +namespace { + +const char kStackAllocatedFieldError[] = + "Non-stack-allocated type '%0' has a field '%1' which is a stack-allocated " + "type, pointer/reference to a stack-allocated type, or template " + "instantiation with a stack-allocated type as template parameter."; + +const clang::Type* StripReferences(const clang::Type* type) { + while (type) { + if (type->isArrayType()) { + type = type->getPointeeOrArrayElementType(); + } else if (type->isPointerType() || type->isReferenceType()) { + type = type->getPointeeType().getTypePtrOrNull(); + } else { + break; + } + } + return type; +} + +} // namespace + +StackAllocatedChecker::StackAllocatedChecker(clang::CompilerInstance& compiler) + : compiler_(compiler), + stack_allocated_field_error_signature_( + compiler.getDiagnostics().getCustomDiagID( + clang::DiagnosticsEngine::Error, + kStackAllocatedFieldError)) {} + +bool StackAllocatedChecker::IsStackAllocated(clang::CXXRecordDecl* record) { + if (!record) { + return false; + } + auto iter = cache_.find(record); + if (iter != cache_.end()) { + return iter->second; + } + + bool stack_allocated = false; + + // Check member fields + for (clang::Decl* decl : record->decls()) { + clang::TypeAliasDecl* alias = clang::dyn_cast<clang::TypeAliasDecl>(decl); + if (!alias) { + continue; + } + if (alias->getName() == "IsStackAllocatedTypeMarker") { + stack_allocated = true; + break; + } + } + + // Check base classes + if (record->hasDefinition()) { + for (clang::CXXRecordDecl::base_class_iterator it = record->bases_begin(); + !stack_allocated && it != record->bases_end(); ++it) { + clang::CXXRecordDecl* parent_record = + it->getType().getTypePtr()->getAsCXXRecordDecl(); + stack_allocated = IsStackAllocated(parent_record); + } + } + + // If we don't create a cache record now, it's possible to get into infinite + // mutual recursion between the base class check (above) and the template + // parameter check (below). + iter = cache_.insert({record, stack_allocated}).first; + + // Check template parameters. This is aggressive and can cause false positives + // -- a templated class doesn't necessarily store instances of its type + // parameters, in which case it need not be stack-allocated. In practice, + // though, this kind of false positive is rare; and conservatively marking + // this type as stack-allocated will catch cases where a type parameter + // doesn't have a full type definition in the translation unit. + if (auto* field_record_template = + clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(record)) { + const auto& template_args = field_record_template->getTemplateArgs(); + for (unsigned i = 0; i < template_args.size(); i++) { + if (template_args[i].getKind() == clang::TemplateArgument::Type) { + const auto* type = + StripReferences(template_args[i].getAsType().getTypePtrOrNull()); + if (type && IsStackAllocated(type->getAsCXXRecordDecl())) { + stack_allocated = true; + } + } + } + } + + iter->second = stack_allocated; + return stack_allocated; +} + +void StackAllocatedChecker::Check(clang::CXXRecordDecl* record) { + // If this type is stack allocated, no need to check fields. + if (IsStackAllocated(record)) { + return; + } + for (clang::RecordDecl::field_iterator it = record->field_begin(); + it != record->field_end(); ++it) { + clang::FieldDecl* field = *it; + bool ignore = false; + for (auto annotation : field->specific_attrs<clang::AnnotateAttr>()) { + if (annotation->getAnnotation() == "stack_allocated_ignore") { + ignore = true; + break; + } + } + if (ignore) { + continue; + } + const clang::Type* type = + StripReferences(field->getType().getTypePtrOrNull()); + if (!type) { + continue; + } + + auto* field_record = type->getAsCXXRecordDecl(); + if (!field_record) { + continue; + } + + if (IsStackAllocated(field_record)) { + compiler_.getDiagnostics().Report(field->getLocation(), + stack_allocated_field_error_signature_) + << record->getName() << field->getNameAsString(); + } + } +} + +} // namespace chrome_checker
diff --git a/tools/clang/plugins/StackAllocatedChecker.h b/tools/clang/plugins/StackAllocatedChecker.h new file mode 100644 index 0000000..432999c6 --- /dev/null +++ b/tools/clang/plugins/StackAllocatedChecker.h
@@ -0,0 +1,38 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TOOLS_CLANG_PLUGINS_STACKALLOCATEDCHECKER_H_ +#define TOOLS_CLANG_PLUGINS_STACKALLOCATEDCHECKER_H_ + +#include <map> +#include <vector> + +namespace clang { +class CompilerInstance; +class CXXRecordDecl; +class FieldDecl; +} // namespace clang + +namespace chrome_checker { + +// This verifies usage of classes annotated with STACK_ALLOCATED(). +// Specifically, it ensures that an instance of such a class cannot be used as a +// member variable in a non-STACK_ALLOCATED() class. +class StackAllocatedChecker { + public: + explicit StackAllocatedChecker(clang::CompilerInstance& compiler); + + void Check(clang::CXXRecordDecl* record); + + private: + bool IsStackAllocated(clang::CXXRecordDecl* record); + + clang::CompilerInstance& compiler_; + unsigned stack_allocated_field_error_signature_; + std::map<clang::CXXRecordDecl*, bool> cache_; +}; + +} // namespace chrome_checker + +#endif // TOOLS_CLANG_PLUGINS_STACKALLOCATEDCHECKER_H_
diff --git a/tools/clang/plugins/tests/stack_allocated.cpp b/tools/clang/plugins/tests/stack_allocated.cpp new file mode 100644 index 0000000..9179140 --- /dev/null +++ b/tools/clang/plugins/tests/stack_allocated.cpp
@@ -0,0 +1,107 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> +#include <vector> + +struct StackAllocatedType { + using IsStackAllocatedTypeMarker [[maybe_unused]] = int; + int i; +}; + +struct InheritsFromStackAllocatedType : public StackAllocatedType { + char* s; +}; + +struct StackAllocatedClassWithStackAllocatedMember { + using IsStackAllocatedTypeMarker [[maybe_unused]] = int; + // Stack-allocated member in stack-allocated class is OK. + StackAllocatedType stack_allocated; + // Stack-allocated member in stack-allocated class is OK. + InheritsFromStackAllocatedType stack_allocated_subclass; +}; + +struct StackAllocatedField { + // Stack-allocated member variable in non-stack-allocated class. + StackAllocatedType stack_allocated; // Error 1 + // Stack-allocated member variable in non-stack-allocated class. + InheritsFromStackAllocatedType stack_allocated_subclass; // Error 2 +}; + +struct IgnoreStackAllocatedField { + // Explicitly ignore stack-allocated field in non-stack-allocated class. + __attribute__((annotate("stack_allocated_ignore"))) + StackAllocatedType stack_allocated; +}; + +template <typename T> +struct TemplatedClass {}; + +template <> +struct TemplatedClass<char> { + using IsStackAllocatedTypeMarker [[maybe_unused]] = int; + // Stack-allocated member variable in stack-allocated template + // specialization class is OK. + StackAllocatedType stack_allocated; +}; + +template <> +struct TemplatedClass<int> { + // Stack-allocated member variable in non-stack-allocated template + // specialization class. + StackAllocatedType stack_allocated; // Error 3 +}; + +struct StackAllocatedNestedField { + struct { + // Stack-allocated member in anonymous nested struct within + // non-stack-allocated class. + StackAllocatedType stack_allocated; // Error 4 + } nested_stack_allocated; +}; + +struct StackAllocatedPointerField { + // Pointer to stack-allocated type member variable in non-stack-allocated + // class. + StackAllocatedType* stack_allocated; // Error 5 +}; + +struct StackAllocatedReferenceField { + // Reference to stack-allocated type member variable in non-stack-allocated + // class. + StackAllocatedType& stack_allocated; // Error 6 +}; + +struct StackAllocatedUnionField { + union { + int foo; + // Stack-allocated member of union within non-stack-allocated class. + StackAllocatedType stack_allocated; // Error 7 + } stack_allocated_union; +}; + +struct StackAllocatedSharedPointerField { + // Member variable is a template instantiation with stack-allocated-type + // as template parameter, within a non-stack-allocated class. + std::shared_ptr<StackAllocatedType> stack_allocated; // Error 8 +}; + +struct StackAllocatedPointerVectorField { + // Member variable is a template instantiation with pointer to + // stack-allocated-type as template parameter, within a non-stack-allocated + // class. + std::vector<StackAllocatedType*> stack_allocated; // Error 9 +}; + +struct NestedTemplateParameter { + // Stack-allocated type as nested template parameter for member variable + // inside non-stack-allocated class. + std::shared_ptr<std::vector<StackAllocatedType>> stack_allocated; // Error 10 +}; + +struct StackAllocatedArrayField { + // Array of stack-allocated type as member variable in non-stack-allocated + // class. + StackAllocatedType stack_allocated[2]; // Error 11 +};
diff --git a/tools/clang/plugins/tests/stack_allocated.flags b/tools/clang/plugins/tests/stack_allocated.flags new file mode 100644 index 0000000..87a58e1c --- /dev/null +++ b/tools/clang/plugins/tests/stack_allocated.flags
@@ -0,0 +1 @@ +-Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated
diff --git a/tools/clang/plugins/tests/stack_allocated.txt b/tools/clang/plugins/tests/stack_allocated.txt new file mode 100644 index 0000000..696e66d --- /dev/null +++ b/tools/clang/plugins/tests/stack_allocated.txt
@@ -0,0 +1,34 @@ +stack_allocated.cpp:27:22: error: Non-stack-allocated type 'StackAllocatedField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType stack_allocated; // Error 1 + ^ +stack_allocated.cpp:29:34: error: Non-stack-allocated type 'StackAllocatedField' has a field 'stack_allocated_subclass' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + InheritsFromStackAllocatedType stack_allocated_subclass; // Error 2 + ^ +stack_allocated.cpp:53:22: error: Non-stack-allocated type 'TemplatedClass' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType stack_allocated; // Error 3 + ^ +stack_allocated.cpp:60:24: error: Non-stack-allocated type '' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType stack_allocated; // Error 4 + ^ +stack_allocated.cpp:67:23: error: Non-stack-allocated type 'StackAllocatedPointerField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType* stack_allocated; // Error 5 + ^ +stack_allocated.cpp:73:23: error: Non-stack-allocated type 'StackAllocatedReferenceField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType& stack_allocated; // Error 6 + ^ +stack_allocated.cpp:80:24: error: Non-stack-allocated type '' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType stack_allocated; // Error 7 + ^ +stack_allocated.cpp:87:39: error: Non-stack-allocated type 'StackAllocatedSharedPointerField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + std::shared_ptr<StackAllocatedType> stack_allocated; // Error 8 + ^ +stack_allocated.cpp:94:36: error: Non-stack-allocated type 'StackAllocatedPointerVectorField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + std::vector<StackAllocatedType*> stack_allocated; // Error 9 + ^ +stack_allocated.cpp:100:52: error: Non-stack-allocated type 'NestedTemplateParameter' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + std::shared_ptr<std::vector<StackAllocatedType>> stack_allocated; // Error 10 + ^ +stack_allocated.cpp:106:22: error: Non-stack-allocated type 'StackAllocatedArrayField' has a field 'stack_allocated' which is a stack-allocated type, pointer/reference to a stack-allocated type, or template instantiation with a stack-allocated type as template parameter. + StackAllocatedType stack_allocated[2]; // Error 11 + ^ +11 errors generated.
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index 0f12f396..8e768ca 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -378,6 +378,7 @@ 'lib/clang/$V/lib/i386-unknown-linux-gnu/libclang_rt.profile.a', 'lib/clang/$V/lib/x86_64-unknown-linux-gnu/libclang_rt.profile.a', 'lib/clang/$V/lib/linux/libclang_rt.profile-i686-android.a', + 'lib/clang/$V/lib/linux/libclang_rt.profile-x86_64-android.a', 'lib/clang/$V/lib/linux/libclang_rt.profile-aarch64-android.a', 'lib/clang/$V/lib/linux/libclang_rt.profile-arm-android.a',
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 87fdb9577..7cad059 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -36,7 +36,7 @@ # Reverting problematic clang rolls is safe, though. # This is the output of `git describe` and is usable as a commit-ish. CLANG_REVISION = 'llvmorg-16-init-17653-g39da55e8' -CLANG_SUB_REVISION = 1 +CLANG_SUB_REVISION = 2 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) RELEASE_VERSION = '16'
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 5447b0b2..cc1ecf4 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -455,6 +455,7 @@ 'mac-hermetic-upgrade-rel': 'release_bot_reclient', 'mac-perfetto-rel': 'perfetto_release_bot_reclient', 'mac-upload-perfetto': 'release_bot_perfetto_zlib_reclient', + 'mac10.15-wpt-content-shell-fyi-rel': 'release_trybot_minimal_symbols_reclient', 'mac12-wpt-content-shell-fyi-rel': 'release_trybot_minimal_symbols_reclient', 'win-annotator-rel': 'release_bot_reclient', 'win-backuprefptr-x64-fyi-rel': 'release_trybot_backuprefptr_x64_reclient',
diff --git a/tools/mb/mb_config_expectations/chromium.fyi.json b/tools/mb/mb_config_expectations/chromium.fyi.json index 87cdb5dd..ca521aa 100644 --- a/tools/mb/mb_config_expectations/chromium.fyi.json +++ b/tools/mb/mb_config_expectations/chromium.fyi.json
@@ -1405,6 +1405,15 @@ "use_remoteexec": true } }, + "mac10.15-wpt-content-shell-fyi-rel": { + "gn_args": { + "dcheck_always_on": true, + "is_component_build": false, + "is_debug": false, + "symbol_level": 1, + "use_remoteexec": true + } + }, "mac12-wpt-content-shell-fyi-rel": { "gn_args": { "dcheck_always_on": true,
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 2178281c..1d03999 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -32395,6 +32395,7 @@ <int value="1055" label="DeviceLoginScreenExtensionManifestV2Availability"/> <int value="1056" label="KioskTroubleshootingToolsEnabled"/> <int value="1057" label="ForceEnablePepperVideoDecoderDevAPI"/> + <int value="1058" label="DomainReliabilityAllowed"/> </enum> <enum name="EnterprisePoliciesSources"> @@ -41821,6 +41822,10 @@ <int value="4444" label="DisableThirdPartyStoragePartitioning"/> <int value="4445" label="ServiceWorkerFetchHandlerUpdateAfterInitialization"/> <int value="4446" label="ObsoleteCreateImageBitmapImageOrientationNone"/> + <int value="4447" label="WindowManagementPermissionDescriptorUsed"/> + <int value="4448" label="WindowPlacementPermissionDescriptorUsed"/> + <int value="4449" label="WindowManagementPermissionPolicyParsed"/> + <int value="4450" label="WindowPlacementPermissionPolicyParsed"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -55688,10 +55693,10 @@ <int value="1003" label="LAUNCH_RESULT_FAILURE"/> </enum> -<enum name="LauncherSearchSessionResult"> +<enum name="LauncherSearchSessionConclusion"> <int value="0" label="Quit"/> <int value="1" label="Launch"/> - <int value="2" label="AnswerCardImpression"/> + <int value="2" label="AnswerCardSeen"/> </enum> <enum name="LauncherUserAction"> @@ -58154,6 +58159,7 @@ <int value="-1639631778" label="EnableWebHidOnExtensionServiceWorker:enabled"/> <int value="-1639534120" label="VaapiVp9kSVCHWEncoding:enabled"/> + <int value="-1639522154" label="GoogleOneOfferFilesBanner:enabled"/> <int value="-1639211162" label="CodeBasedRBD:enabled"/> <int value="-1639050182" label="NavigationPredictorRendererWarmup:enabled"/> <int value="-1638815914" label="enable-experimental-productivity-features"/> @@ -61024,6 +61030,7 @@ <int value="-13918890" label="disable-download-notification"/> <int value="-13180015" label="WebUsbDeviceDetection:disabled"/> <int value="-13062128" label="IsolateSandboxedIframes:disabled"/> + <int value="-12338441" label="GoogleOneOfferFilesBanner:disabled"/> <int value="-12225998" label="ShareButtonInTopToolbar:disabled"/> <int value="-11983392" label="MagnifierContinuousMouseFollowingModeSetting:enabled"/> @@ -73340,6 +73347,12 @@ label="Image set as background (through double-click or 'Done')."/> </enum> +<enum name="NTPCustomizeChromeEntryPoint"> + <int value="0" label="Customize Chrome button clicked."/> + <int value="1" label="Customize module clicked."/> + <int value="2" label="NTP URL has customize chrome parameters."/> +</enum> + <enum name="NTPCustomizedFeatures"> <int value="0" label="Background customized"/> <int value="1" label="Shortcut customized"/> @@ -89430,15 +89443,19 @@ <enum name="SafetyTipStatus"> <int value="0" label="Safety Tip status unknown/not applicable"/> <int value="1" label="No Safety Tip"/> - <int value="2" label="Safety Tip for bad reputation"/> + <int value="2" label="Safety Tip for bad reputation (deprecated)"/> <int value="3" label="Safety Tip for lookalike URL"/> - <int value="4" label="Safety Tip for a URL with a suspicious keyword"/> + <int value="4" + label="Safety Tip for a URL with a suspicious keyword (deprecated)"/> <int value="5" label="Safety Tip for bad reputation, but the user has explicitly - dismissed the Safety Tip on a previous navigation"/> + dismissed the Safety Tip on a previous navigation (deprecated)"/> <int value="6" label="Safety Tip for a lookalike URL, but the user has explicitly dismissed the Safety Tip on a previous navigation"/> + <int value="7" + label="The lookalike URL for the Safety Tip has a Digital Asset Link + match (deprecated)"/> </enum> <enum name="SameSiteCookieContext"> @@ -106774,6 +106791,44 @@ <int value="3" label="Accepted only by NSS (rejected by iOS)."/> </enum> +<!-- +This must be kept in sync with services/network/public/mojom/web_client_hints_types.mojom +DO NOT REMOVE TYPES THAT MADE IT TO STABLE AT ANY POINT! +This is true even if the type has been removed from the mojom file. +--> + +<enum name="WebClientHintsType"> + <int value="0" label="DeviceMemory_DEPRECATED"/> + <int value="1" label="Dpr_DEPRECATED"/> + <int value="2" label="ResourceWidth_DEPRECATED"/> + <int value="3" label="ViewportWidth_DEPRECATED"/> + <int value="4" label="Rtt_DEPRECATED"/> + <int value="5" label="Downlink_DEPRECATED"/> + <int value="6" label="Ect_DEPRECATED"/> + <int value="7" label="Lang"/> + <int value="8" label="UA"/> + <int value="9" label="UAArch"/> + <int value="10" label="UAPlatform"/> + <int value="11" label="UAModel"/> + <int value="12" label="UAMobile"/> + <int value="13" label="UAFullVersion"/> + <int value="14" label="UAPlatformVersion"/> + <int value="15" label="PrefersColorScheme"/> + <int value="16" label="UABitness"/> + <int value="17" label="UAReduced"/> + <int value="18" label="ViewportHeight"/> + <int value="19" label="DeviceMemory"/> + <int value="20" label="Dpr"/> + <int value="21" label="ResourceWidth"/> + <int value="22" label="ViewportWidth"/> + <int value="23" label="UAFullVersionList"/> + <int value="24" label="FullUserAgent"/> + <int value="25" label="UAWoW64"/> + <int value="26" label="PartitionedCookies"/> + <int value="27" label="SaveData"/> + <int value="28" label="PrefersReducedMotion"/> +</enum> + <enum name="WebContentsAudioState"> <int value="0" label="Never played audio"/> <int value="1" label="Currently playing audio"/>
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index 75f57bd..591090a 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -251,6 +251,32 @@ </summary> </histogram> +<histogram name="Android.AdaptiveToolbarButton.Variant.OnPageLoad" + enum="AdaptiveToolbarButtonVariant" expires_after="2023-06-30"> + <owner>shaktisahu@chromium.org</owner> + <owner>chrome-segmentation-platform@google.com</owner> + <summary> + Reports the variant of the optional toolbar button that was shown after a + page load. Reports only when a page is loaded or a tab is switched. Reports + only when the contextual page actions feature is enabled and after all the + action providers have responded or the request has timed out. Only reported + for pages in the regular profile. + </summary> +</histogram> + +<histogram name="Android.AdaptiveToolbarButton.Variant.OnStartNavigation" + enum="AdaptiveToolbarButtonVariant" expires_after="2023-06-30"> + <owner>shaktisahu@chromium.org</owner> + <owner>chrome-segmentation-platform@google.com</owner> + <summary> + Reports the variant of the optional toolbar button being shown during the + start of a new navigation. Reports whenever + TabObserver.onDidStartNavigationInPrimaryMainFrame() is called which then + records the button variant currently being shown on the toolbar. Recorded + for both regular and incognito profiles. + </summary> +</histogram> + <histogram name="Android.AppLaunch.BlockDrawForInitialTabAccuracy" enum="AppLaunchBlockDrawForInitialTabAccuracy" expires_after="2022-10-16"> <owner>sinansahin@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/apps/histograms.xml b/tools/metrics/histograms/metadata/apps/histograms.xml index fdac0d2..20b6435b 100644 --- a/tools/metrics/histograms/metadata/apps/histograms.xml +++ b/tools/metrics/histograms/metadata/apps/histograms.xml
@@ -878,20 +878,20 @@ </summary> </histogram> -<histogram name="Apps.AppList.Search.Session.Error" +<histogram name="Apps.AppList.Search.Session2.Error" enum="AppListUserEventError" expires_after="2024-01-31"> <owner>yulunwu@chromium.org</owner> <owner>tby@chromium.org</owner> <owner>wrong@chromium.org</owner> <owner>tbarzic@chromium.org</owner> <summary> - Records errors in processing other Apps.AppList.Search.Session.* metrics. + Records errors in processing other Apps.AppList.Search.Session2.* metrics. These are expected to be rare and bucket proportion is not meaningful. </summary> </histogram> -<histogram name="Apps.AppList.Search.Session.{LauncherSearchEntryPoint}" - enum="LauncherSearchSessionResult" expires_after="2024-01-31"> +<histogram name="Apps.AppList.Search.Session2.{LauncherSearchEntryPoint}" + enum="LauncherSearchSessionConclusion" expires_after="2024-01-31"> <owner>yulunwu@chromium.org</owner> <owner>tby@chromium.org</owner> <owner>wrong@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/ios/histograms.xml b/tools/metrics/histograms/metadata/ios/histograms.xml index ab4253f..cdaf111f 100644 --- a/tools/metrics/histograms/metadata/ios/histograms.xml +++ b/tools/metrics/histograms/metadata/ios/histograms.xml
@@ -850,9 +850,11 @@ </histogram> <histogram name="IOS.Incognito.BiometricAuthEnabled" enum="Boolean" - expires_after="2022-09-20"> - <owner>stkhapugin@chromium.org</owner> - <owner>gambard@chromium.org</owner> + expires_after="never"> +<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) --> + + <owner>andrewkamau@google.com</owner> + <owner>arabm@google.com</owner> <summary> Logged once per app launch. Logs whether the biometric incognito authentication setting is enabled. This metric is designed to measure % of @@ -862,9 +864,11 @@ </histogram> <histogram name="IOS.Incognito.BiometricReauthAttemptSuccessful" enum="Boolean" - expires_after="2022-09-20"> - <owner>stkhapugin@chromium.org</owner> - <owner>gambard@chromium.org</owner> + expires_after="never"> +<!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) --> + + <owner>andrewkamau@google.com</owner> + <owner>arabm@google.com</owner> <summary> Logged when the user attempt to reauthenticate to display the incognito tabs. This metric is designed to measure the success of the reauth.
diff --git a/tools/metrics/histograms/metadata/new_tab_page/histograms.xml b/tools/metrics/histograms/metadata/new_tab_page/histograms.xml index 2320707e..24e0dda 100644 --- a/tools/metrics/histograms/metadata/new_tab_page/histograms.xml +++ b/tools/metrics/histograms/metadata/new_tab_page/histograms.xml
@@ -823,6 +823,19 @@ </summary> </histogram> +<histogram name="NewTabPage.CustomizeChromeOpened" + enum="NTPCustomizeChromeEntryPoint" expires_after="2023-07-30"> + <owner>pauladedeji@chromium.org</owner> + <owner>danpeng@google.com</owner> + <owner>chrome-desktop-ntp@google.com</owner> + <summary> + Captures calls to open Customize Chrome on the NTP. Calls can be made to + open Customize Chrome while it is already open. Opening Customize Chrome + from inside the side panel is tracked by + "SidePanel.CustomizeChrome.ShowTriggered". + </summary> +</histogram> + <histogram name="NewTabPage.Customized" enum="NTPCustomizedFeatures" expires_after="2023-06-18"> <owner>tiborg@chromium.org</owner>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index d9760b2..f8a66bc 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -5738,6 +5738,27 @@ </metric> </event> +<event name="ClientHints.AcceptCHFrameUsage"> + <owner>arichiv@chromium.org</owner> + <owner>victortan@chromium.org</owner> + <summary> + Record when a Client Hint is requested in an ACCEPT_CH TLS Frame. + </summary> + <metric name="Type" enum="WebClientHintsType"> + <summary> + Records an enum representing the specific Client Hint type that was + requested. + </summary> + <aggregation> + <history> + <statistics> + <enumeration/> + </statistics> + </history> + </aggregation> + </metric> +</event> + <event name="ClientRenderingAPI"> <owner>aaronhk@chromium.org</owner> <owner>cwallez@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 4b053b9b..34e2c04 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,16 +5,16 @@ "full_remote_path": "perfetto-luci-artifacts/v31.0/linux-arm64/trace_processor_shell" }, "win": { - "hash": "c15018ebfa18305e77591643500530cf82bc6ab5", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/53971a4039d33587dcf88762c85c92b0faab412b/trace_processor_shell.exe" + "hash": "9f9590c00b2f11f7b0e5fe571460aadfbc485caa", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/61f6f28a07752c9a38fa2309d20557d5d8647eaf/trace_processor_shell.exe" }, "linux_arm": { "hash": "6373f26144aad58f230d11d6a91efda5a09c9873", "full_remote_path": "perfetto-luci-artifacts/v31.0/linux-arm/trace_processor_shell" }, "mac": { - "hash": "23ebd3be5e889a7bed6a5452e5baf031095f963e", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/53971a4039d33587dcf88762c85c92b0faab412b/trace_processor_shell" + "hash": "69203849a5dd2ad4ba1b3abe28144ab3b2763f7f", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/61f6f28a07752c9a38fa2309d20557d5d8647eaf/trace_processor_shell" }, "mac_arm64": { "hash": "5f47ee79e59d00bf3889d30ca52315522c158040", @@ -22,7 +22,7 @@ }, "linux": { "hash": "c9ac6c1f86ceeaaaa8b5636e113645a21839ddaa", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/776a2df0bc5e5162ac0008009e896e0907fd56af/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/61f6f28a07752c9a38fa2309d20557d5d8647eaf/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 65d9e70c..5fc474a 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -66,7 +66,7 @@ <item id="dns_over_https" added_in_milestone="66" content_hash_code="02b087b6" os_list="linux,windows,chromeos,android" file_path="net/dns/dns_transaction.cc" /> <item id="dns_transaction" added_in_milestone="65" content_hash_code="07e14f9f" os_list="linux,windows,chromeos,android" file_path="net/dns/dns_transaction.cc" /> <item id="dom_distiller" added_in_milestone="62" content_hash_code="0653c7f2" os_list="linux,windows,chromeos,android" file_path="components/dom_distiller/core/distiller_url_fetcher.cc" /> - <item id="domain_reliability_report_upload" added_in_milestone="62" content_hash_code="0223d254" os_list="linux,windows,chromeos,android" file_path="components/domain_reliability/uploader.cc" /> + <item id="domain_reliability_report_upload" added_in_milestone="62" content_hash_code="005de12f" os_list="linux,windows,chromeos,android" file_path="components/domain_reliability/uploader.cc" /> <item id="domain_security_policy" added_in_milestone="62" content_hash_code="01d7c177" os_list="linux,windows,chromeos,android" file_path="services/network/network_context.cc" /> <item id="download_internals_webui_source" added_in_milestone="66" content_hash_code="07b659d0" os_list="linux,windows,chromeos,android" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc" /> <item id="download_manager_resume" added_in_milestone="62" content_hash_code="0275159a" os_list="linux,windows,chromeos,android" file_path="components/download/internal/common/download_item_impl.cc" />
diff --git a/ui/accessibility/ax_tree_serializer.h b/ui/accessibility/ax_tree_serializer.h index b8324f1..0eef24a 100644 --- a/ui/accessibility/ax_tree_serializer.h +++ b/ui/accessibility/ax_tree_serializer.h
@@ -539,6 +539,11 @@ template <typename AXSourceNode> void AXTreeSerializer<AXSourceNode>::InvalidateClientSubtree( ClientTreeNode* client_node) { + // Return early if already marked invalid, in order to avoid duplicate work in + // subtree, as the only method that marks nodes invalid is this one. + if (client_node->invalid) { + return; + } client_node->invalid = true; for (size_t i = 0; i < client_node->children.size(); ++i) InvalidateClientSubtree(client_node->children[i]);
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 357099d..194b445f 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc
@@ -370,7 +370,7 @@ // when a Window is hidden, we want this function to return false immediately // after, even though the client may decide to animate the hide effect (and // so the layer will be visible for some time after Hide() is called). - return visible_ ? layer()->IsDrawn() : false; + return visible_ ? layer()->IsVisible() : false; } Window::OcclusionState Window::GetOcclusionState() const {
diff --git a/ui/color/BUILD.gn b/ui/color/BUILD.gn index 3c15e89..a0a7737 100644 --- a/ui/color/BUILD.gn +++ b/ui/color/BUILD.gn
@@ -129,6 +129,8 @@ "color_provider_manager.h", "core_default_color_mixer.cc", "core_default_color_mixer.h", + "material_ui_color_mixer.cc", + "material_ui_color_mixer.h", "native_color_mixers.cc", "native_color_mixers.h", "ref_color_mixer.cc", @@ -146,6 +148,7 @@ ":color_headers", "//skia", "//third_party/material_color_utilities", + "//ui/base:features", "//ui/gfx:color_utils", ]
diff --git a/ui/color/DEPS b/ui/color/DEPS index d9358cc..8aa4d01d 100644 --- a/ui/color/DEPS +++ b/ui/color/DEPS
@@ -2,5 +2,6 @@ "+third_party/material_color_utilities", "+third_party/skia/include", "+skia/ext", + "+ui/base", "+ui/gfx", ]
diff --git a/ui/color/color_mixers.cc b/ui/color/color_mixers.cc index 46278b9..a89f9079 100644 --- a/ui/color/color_mixers.cc +++ b/ui/color/color_mixers.cc
@@ -4,7 +4,9 @@ #include "ui/color/color_mixers.h" +#include "ui/base/ui_base_features.h" #include "ui/color/core_default_color_mixer.h" +#include "ui/color/material_ui_color_mixer.h" #include "ui/color/native_color_mixers.h" #include "ui/color/ref_color_mixer.h" #include "ui/color/sys_color_mixer.h" @@ -21,6 +23,11 @@ AddNativeCoreColorMixer(provider, key); AddUiColorMixer(provider, key); AddNativeUiColorMixer(provider, key); + if (features::IsChromeRefresh2023()) { + // This must come after the UI and native UI mixers to ensure leaf node + // colors are overridden with GM3 recipes when the refresh flag is enabled. + AddMaterialUiColorMixer(provider, key); + } AddNativePostprocessingMixer(provider, key); }
diff --git a/ui/color/material_ui_color_mixer.cc b/ui/color/material_ui_color_mixer.cc new file mode 100644 index 0000000..f021b5e --- /dev/null +++ b/ui/color/material_ui_color_mixer.cc
@@ -0,0 +1,51 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/color/material_ui_color_mixer.h" + +#include <utility> + +#include "base/logging.h" +#include "ui/color/color_id.h" +#include "ui/color/color_mixer.h" +#include "ui/color/color_provider.h" +#include "ui/color/color_provider_manager.h" +#include "ui/color/color_recipe.h" + +namespace ui { + +void AddMaterialUiColorMixer(ColorProvider* provider, + const ColorProviderManager::Key& key) { + const bool dark_mode = + key.color_mode == ColorProviderManager::ColorMode::kDark; + DVLOG(2) << "Adding MaterialUiColorMixer to ColorProvider for " + << (dark_mode ? "Dark" : "Light") << " window."; + ColorMixer& mixer = provider->AddMixer(); + + mixer[kColorButtonBackground] = {SK_ColorTRANSPARENT}; + mixer[kColorButtonBackgroundPressed] = + GetResultingPaintColor({kColorSysStatePressed}, {kColorButtonBackground}); + mixer[kColorButtonBackgroundProminent] = {kColorSysPrimary}; + mixer[kColorButtonBackgroundProminentDisabled] = {kColorSysDisabledContainer}; + mixer[kColorButtonBackgroundProminentFocused] = {GetResultingPaintColor( + {kColorSysStateFocus}, {kColorButtonBackgroundProminent})}; + mixer[kColorButtonBorder] = {kColorSysOutline}; + mixer[kColorButtonBorderDisabled] = {kColorSysOnSurfaceDisabled}; + mixer[kColorButtonForeground] = {kColorSysOnSurfacePrimary}; + mixer[kColorButtonForegroundChecked] = {kColorButtonForeground}; + mixer[kColorButtonForegroundDisabled] = {kColorSysOnSurfaceDisabled}; + mixer[kColorButtonForegroundProminent] = {kColorSysOnPrimary}; + mixer[kColorButtonForegroundUnchecked] = {kColorSysOnSurfaceVariant}; + mixer[kColorSliderThumb] = {kColorSysPrimary}; + mixer[kColorSliderThumbMinimal] = {kColorSysSecondary}; + mixer[kColorSliderTrack] = {kColorSysOnPrimary}; + mixer[kColorSliderTrackMinimal] = {kColorSysOnSecondary}; + mixer[kColorToggleButtonShadow] = {kColorSysOutline}; + mixer[kColorToggleButtonThumbOff] = {kColorSysOutline}; + mixer[kColorToggleButtonThumbOn] = {kColorSysOnPrimary}; + mixer[kColorToggleButtonTrackOff] = {kColorSysSurfaceVariant}; + mixer[kColorToggleButtonTrackOn] = {kColorSysPrimary}; +} + +} // namespace ui
diff --git a/ui/color/material_ui_color_mixer.h b/ui/color/material_ui_color_mixer.h new file mode 100644 index 0000000..9f37fa28 --- /dev/null +++ b/ui/color/material_ui_color_mixer.h
@@ -0,0 +1,20 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_COLOR_MATERIAL_UI_COLOR_MIXER_H_ +#define UI_COLOR_MATERIAL_UI_COLOR_MIXER_H_ + +#include "ui/color/color_provider_manager.h" + +namespace ui { + +class ColorProvider; + +// Adds a color mixer to `provider` for material mappings. +void AddMaterialUiColorMixer(ColorProvider* provider, + const ColorProviderManager::Key& key); + +} // namespace ui + +#endif // UI_COLOR_MATERIAL_UI_COLOR_MIXER_H_
diff --git a/ui/color/win/accent_color_observer.cc b/ui/color/win/accent_color_observer.cc index 6845d90..7de55ad 100644 --- a/ui/color/win/accent_color_observer.cc +++ b/ui/color/win/accent_color_observer.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/no_destructor.h" -#include "base/win/windows_version.h" #include "skia/ext/skia_utils_win.h" #include "ui/gfx/color_utils.h" @@ -20,13 +19,12 @@ } AccentColorObserver::AccentColorObserver() { - if (base::win::GetVersion() >= base::win::Version::WIN8) { - dwm_key_ = std::make_unique<base::win::RegKey>( - HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ); - if (dwm_key_->Valid()) - OnDwmKeyUpdated(); - else - dwm_key_.reset(); + dwm_key_ = std::make_unique<base::win::RegKey>( + HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ); + if (dwm_key_->Valid()) { + OnDwmKeyUpdated(); + } else { + dwm_key_.reset(); } } @@ -67,20 +65,18 @@ accent_color_ = absl::nullopt; accent_color_inactive_ = absl::nullopt; - if (base::win::GetVersion() >= base::win::Version::WIN10) { - DWORD accent_color, color_prevalence; - bool use_dwm_frame_color = - dwm_key_->ReadValueDW(L"AccentColor", &accent_color) == ERROR_SUCCESS && - dwm_key_->ReadValueDW(L"ColorPrevalence", &color_prevalence) == - ERROR_SUCCESS && - color_prevalence == 1; - if (use_dwm_frame_color) { - accent_color_ = skia::COLORREFToSkColor(accent_color); - DWORD accent_color_inactive; - if (dwm_key_->ReadValueDW(L"AccentColorInactive", - &accent_color_inactive) == ERROR_SUCCESS) { - accent_color_inactive_ = skia::COLORREFToSkColor(accent_color_inactive); - } + DWORD accent_color, color_prevalence; + bool use_dwm_frame_color = + dwm_key_->ReadValueDW(L"AccentColor", &accent_color) == ERROR_SUCCESS && + dwm_key_->ReadValueDW(L"ColorPrevalence", &color_prevalence) == + ERROR_SUCCESS && + color_prevalence == 1; + if (use_dwm_frame_color) { + accent_color_ = skia::COLORREFToSkColor(accent_color); + DWORD accent_color_inactive; + if (dwm_key_->ReadValueDW(L"AccentColorInactive", &accent_color_inactive) == + ERROR_SUCCESS) { + accent_color_inactive_ = skia::COLORREFToSkColor(accent_color_inactive); } }
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index fed2d73..10df2319 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc
@@ -773,7 +773,7 @@ return visible_; } -bool Layer::IsDrawn() const { +bool Layer::IsVisible() const { const Layer* layer = this; while (layer && layer->visible_) layer = layer->parent_; @@ -1515,7 +1515,7 @@ if (bounds.size() == old_bounds.size()) { // Don't schedule a draw if we're invisible. We'll schedule one // automatically when we get visible. - if (IsDrawn()) { + if (IsVisible()) { ScheduleDraw(); } } else {
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index ac58e8cf..9464971f85 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h
@@ -329,10 +329,10 @@ Layer* layer_mask_layer() { return layer_mask_; } const Layer* layer_mask_layer() const { return layer_mask_; } - // Sets the visibility of the Layer. A Layer may be visible but not drawn. - // This happens if any ancestor of a Layer is not visible. - // Any changes made to this in the source layer will override the visibility - // of its mirror layer. + // Sets the visibility of the Layer. A Layer itself may be visible but not + // fully visible in the layer tree. This happens if any ancestor of a + // Layer is not visible. Any changes made to this in the source layer will + // override the visibility of its mirror layer. void SetVisible(bool visible); bool visible() const { return visible_; } @@ -340,9 +340,9 @@ // returns the current visibility. bool GetTargetVisibility() const; - // Returns true if this Layer is drawn. A Layer is drawn only if all ancestors - // are visible. - bool IsDrawn() const; + // Returns true if this Layer is visible. A Layer is visible only if + // all ancestors are visible. + bool IsVisible() const; // If set to true, this layer can receive hit test events, this property does // not affect the layer's descendants. @@ -720,7 +720,7 @@ std::unique_ptr<SubpixelPositionOffsetCache> subpixel_position_offset_; - // Visibility of this layer. See SetVisible/IsDrawn for more details. + // Visibility of this layer. See SetVisible/IsVisible for more details. bool visible_; // Whether or not the layer wants to receive hit testing events. When set to
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index 6f12be0c..44e5a8e 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -1209,9 +1209,9 @@ l3->set_delegate(&delegate); // Layers should initially be drawn. - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_TRUE(l3->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_TRUE(l3->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1221,25 +1221,25 @@ Draw(); l1->SetVisible(false); - EXPECT_FALSE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_FALSE(l3->IsDrawn()); + EXPECT_FALSE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_FALSE(l3->IsVisible()); EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); l3->SetVisible(false); - EXPECT_FALSE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_FALSE(l3->IsDrawn()); + EXPECT_FALSE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_FALSE(l3->IsVisible()); EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); l1->SetVisible(true); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_FALSE(l3->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_FALSE(l3->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1259,9 +1259,9 @@ l2_mirror->set_delegate(&delegate); // Layers should initially be drawn. - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_TRUE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_TRUE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1274,9 +1274,9 @@ l1->SetVisible(false); // Since the entire subtree is hidden, no layer should be drawn. - EXPECT_FALSE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_FALSE(l2_mirror->IsDrawn()); + EXPECT_FALSE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_FALSE(l2_mirror->IsVisible()); // The visibitily property for the subtree is rooted at |l1|. EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1288,9 +1288,9 @@ l2->SetVisible(false); // None of the layers are drawn since the visibility is false at every node. - EXPECT_FALSE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_FALSE(l2_mirror->IsDrawn()); + EXPECT_FALSE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_FALSE(l2_mirror->IsVisible()); // Visibility property is set on every node and hence their subtree is also // hidden. @@ -1301,9 +1301,9 @@ // Setting visibility on the root layer should make that layer visible and its // subtree ready for visibility. l1->SetVisible(true); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_FALSE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_FALSE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1311,9 +1311,9 @@ // Setting visibility on the mirrored layer should not effect its source // layer. l2_mirror->SetVisible(true); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_FALSE(l2->IsDrawn()); - EXPECT_TRUE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_FALSE(l2->IsVisible()); + EXPECT_TRUE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1321,9 +1321,9 @@ // Setting visibility on the source layer should keep the mirror layer in // sync and not cause any invalid state. l2->SetVisible(true); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_TRUE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_TRUE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1331,9 +1331,9 @@ // Setting visibility on the mirrored layer should not effect its source // layer. l2_mirror->SetVisible(false); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_FALSE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_FALSE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_TRUE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1341,9 +1341,9 @@ // Setting source layer's visibility to true should update the mirror layer // even if the source layer did not change in the process. l2->SetVisible(true); - EXPECT_TRUE(l1->IsDrawn()); - EXPECT_TRUE(l2->IsDrawn()); - EXPECT_TRUE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l1->IsVisible()); + EXPECT_TRUE(l2->IsVisible()); + EXPECT_TRUE(l2_mirror->IsVisible()); EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); EXPECT_FALSE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); @@ -1352,9 +1352,9 @@ // shouldn't affect the visibility of |l2_mirror|. l2_mirror->set_sync_visibility_with_source(false); l2->SetVisible(false); - EXPECT_FALSE(l2->IsDrawn()); + EXPECT_FALSE(l2->IsVisible()); EXPECT_TRUE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); - EXPECT_TRUE(l2_mirror->IsDrawn()); + EXPECT_TRUE(l2_mirror->IsVisible()); EXPECT_FALSE(l2_mirror->cc_layer_for_testing()->hide_layer_and_subtree()); }
diff --git a/ui/display/win/uwp_text_scale_factor.cc b/ui/display/win/uwp_text_scale_factor.cc index 02b20a1..2d2d18c 100644 --- a/ui/display/win/uwp_text_scale_factor.cc +++ b/ui/display/win/uwp_text_scale_factor.cc
@@ -10,6 +10,8 @@ #include <wrl/client.h> #include <wrl/event.h> +#include <memory> + #include "base/lazy_instance.h" #include "base/logging.h" #include "base/strings/string_piece.h" @@ -17,10 +19,8 @@ #include "base/win/core_winrt_util.h" #include "base/win/scoped_com_initializer.h" #include "base/win/scoped_hstring.h" -#include "base/win/windows_version.h" -namespace display { -namespace win { +namespace display::win { namespace { @@ -89,11 +89,6 @@ public: UwpTextScaleFactorImpl() : text_scale_factor_changed_token_(kInvalidEventRegistrationToken) { - // There's no point in doing this initialization if we're earlier than - // Windows 10, since UWP is a Win10 feature. - if (base::win::GetVersion() < base::win::Version::WIN10) - return; - // We want to bracket all use of our COM object with COM initialization // in order to be sure we don't leak COM listeners into the OS. This may // extend the lifetime of COM on this thread but we do not expect it to be @@ -233,5 +228,4 @@ source->RemoveObserver(this); } -} // namespace win -} // namespace display +} // namespace display::win
diff --git a/ui/gfx/font_fallback_unittest.cc b/ui/gfx/font_fallback_unittest.cc index 62558cc5..d662ab1 100644 --- a/ui/gfx/font_fallback_unittest.cc +++ b/ui/gfx/font_fallback_unittest.cc
@@ -19,10 +19,6 @@ #include "ui/gfx/platform_font.h" #include "ui/gfx/test/font_fallback_test_data.h" -#if BUILDFLAG(IS_WIN) -#include "base/win/windows_version.h" -#endif - namespace gfx { namespace { @@ -170,15 +166,6 @@ base_font_option_.weight); } -#if BUILDFLAG(IS_WIN) - // Skip testing this call to GetFallbackFont on older windows versions. Some - // fonts only got introduced on windows 10 and the test will fail on previous - // versions. - const bool is_win10 = base::win::GetVersion() >= base::win::Version::WIN10; - if (test_case_.is_win10 && !is_win10) - return; -#endif - // Retrieve the name of the current script. script_name_ = uscript_getName(test_case_.script);
diff --git a/ui/gfx/font_fallback_win_unittest.cc b/ui/gfx/font_fallback_win_unittest.cc index 76a2f76f..880bc89 100644 --- a/ui/gfx/font_fallback_win_unittest.cc +++ b/ui/gfx/font_fallback_win_unittest.cc
@@ -6,7 +6,6 @@ #include "base/strings/string_piece.h" #include "base/test/task_environment.h" -#include "base/win/windows_version.h" #include "testing/gtest/include/gtest/gtest.h" namespace gfx { @@ -106,10 +105,6 @@ } TEST_F(FontFallbackWinTest, CJKLocaleFallback) { - // The uniscribe fallback used by win7 does not support locale. - if (base::win::GetVersion() < base::win::Version::WIN10) - return; - // Han unification is an effort to map multiple character sets of the CJK // languages into a single set of unified characters. Han characters are a // common feature of written Chinese (hanzi), Japanese (kanji), and Korean
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index 67fbf12..68a3c1f 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc
@@ -42,10 +42,6 @@ #include "ui/gfx/text_utils.h" #include "ui/gfx/utf16_indexing.h" -#if BUILDFLAG(IS_WIN) -#include "base/win/windows_version.h" -#endif - namespace gfx { namespace { @@ -257,25 +253,23 @@ // Support Microsoft defined PUA on Windows. // see: // https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font - if (base::win::GetVersion() >= base::win::Version::WIN10) { - switch (codepoint) { - case 0xF093: // ButtonA - case 0xF094: // ButtonB - case 0xF095: // ButtonY - case 0xF096: // ButtonX - case 0xF108: // LeftStick - case 0xF109: // RightStick - case 0xF10A: // TriggerLeft - case 0xF10B: // TriggerRight - case 0xF10C: // BumperLeft - case 0xF10D: // BumperRight - case 0xF10E: // Dpad - case 0xEECA: // ButtonView2 - case 0xEDE3: // ButtonMenu - return codepoint; - default: - break; - } + switch (codepoint) { + case 0xF093: // ButtonA + case 0xF094: // ButtonB + case 0xF095: // ButtonY + case 0xF096: // ButtonX + case 0xF108: // LeftStick + case 0xF109: // RightStick + case 0xF10A: // TriggerLeft + case 0xF10B: // TriggerRight + case 0xF10C: // BumperLeft + case 0xF10D: // BumperRight + case 0xF10E: // Dpad + case 0xEECA: // ButtonView2 + case 0xEDE3: // ButtonMenu + return codepoint; + default: + break; } #endif const int8_t codepoint_category = u_charType(codepoint);
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 206c521..0a9ecc9 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -10,6 +10,8 @@ #include <memory> #include <numeric> +#include <set> +#include <tuple> #include "base/format_macros.h" #include "base/i18n/break_iterator.h" @@ -55,8 +57,6 @@ #if BUILDFLAG(IS_WIN) #include <windows.h> - -#include "base/win/windows_version.h" #endif #if BUILDFLAG(IS_APPLE) @@ -3451,7 +3451,8 @@ for (size_t j = 0; j < std::size(cases); j++) { render_text->SetText(cases[j].text); render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_TEXT); - EXPECT_EQ(render_text->GetDisplayTextDirection(),cases[j].text_direction); + EXPECT_EQ(render_text->GetDisplayTextDirection(), + cases[j].text_direction); render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_UI); EXPECT_EQ(render_text->GetDisplayTextDirection(), ui_direction); render_text->SetDirectionalityMode(DIRECTIONALITY_FORCE_LTR); @@ -6442,11 +6443,7 @@ RenderText* render_text = GetRenderText(); render_text->SetText(codepoint); #if BUILDFLAG(IS_WIN) - if (base::win::GetVersion() >= base::win::Version::WIN10) { - EXPECT_EQ(codepoint, render_text->GetDisplayText()); - } else { - EXPECT_EQ(u"\uFFFD", render_text->GetDisplayText()); - } + EXPECT_EQ(codepoint, render_text->GetDisplayText()); #else EXPECT_EQ(u"\uFFFD", render_text->GetDisplayText()); #endif @@ -6932,11 +6929,8 @@ EXPECT_EQ("[0->2][3][4->6]", GetRunListStructureString()); #if BUILDFLAG(IS_WIN) - std::vector<std::string> expected_fonts; - if (base::win::GetVersion() < base::win::Version::WIN10) - expected_fonts = {"Segoe UI", "Segoe UI", "Segoe UI Symbol"}; - else - expected_fonts = {"Segoe UI Emoji", "Segoe UI", "Segoe UI Symbol"}; + const std::vector<std::string> expected_fonts = {"Segoe UI Emoji", "Segoe UI", + "Segoe UI Symbol"}; std::vector<std::string> mapped_fonts; for (const auto& font_span : GetFontSpans())
diff --git a/ui/gfx/test/font_fallback_test_data.cc b/ui/gfx/test/font_fallback_test_data.cc index b968b878..1087cd15 100644 --- a/ui/gfx/test/font_fallback_test_data.cc +++ b/ui/gfx/test/font_fallback_test_data.cc
@@ -10,10 +10,6 @@ namespace gfx { -#if BUILDFLAG(IS_WIN) -constexpr bool kWin10Only = true; -#endif - FallbackFontTestCase::FallbackFontTestCase() = default; FallbackFontTestCase::FallbackFontTestCase(const FallbackFontTestCase& other) = default; @@ -22,13 +18,11 @@ UScriptCode script_arg, std::string language_tag_arg, std::u16string text_arg, - std::vector<std::string> fallback_fonts_arg, - bool is_win10_arg) + std::vector<std::string> fallback_fonts_arg) : script(script_arg), language_tag(language_tag_arg), text(text_arg), - fallback_fonts(fallback_fonts_arg), - is_win10(is_win10_arg) {} + fallback_fonts(fallback_fonts_arg) {} FallbackFontTestCase::~FallbackFontTestCase() = default; @@ -39,7 +33,7 @@ // TODO(drott): Some of the test cases lack a valid language tag as it's unclear // which language in particular would be expressed with the respective ancient // script. Ideally we'd find a meaningful language tag for those. -std::vector<FallbackFontTestCase> kGetFontFallbackTests = { +const std::vector<FallbackFontTestCase> kGetFontFallbackTests = { {USCRIPT_ARABIC, "ar", u"\u062A\u062D", @@ -50,55 +44,31 @@ {"Segoe UI", "Tahoma", "Sylfaen", "Times New Roman"}}, {USCRIPT_BENGALI, "bn", u"\u09B8\u09AE", {"Nirmala UI", "Vrinda"}}, {USCRIPT_BRAILLE, "en-us-brai", u"\u2870\u2871", {"Segoe UI Symbol"}}, - {USCRIPT_BUGINESE, "bug", u"\u1A00\u1A01", {"Leelawadee UI"}, kWin10Only}, + {USCRIPT_BUGINESE, "bug", u"\u1A00\u1A01", {"Leelawadee UI"}}, {USCRIPT_CANADIAN_ABORIGINAL, "cans", u"\u1410\u1411", {"Gadugi", "Euphemia"}}, - {USCRIPT_CARIAN, - "xcr", - u"\U000102A0\U000102A1", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_CARIAN, "xcr", u"\U000102A0\U000102A1", {"Segoe UI Historic"}}, {USCRIPT_CHEROKEE, "chr", u"\u13A1\u13A2", {"Gadugi", "Plantagenet Cherokee"}}, - {USCRIPT_COPTIC, - "copt", - u"\u2C81\u2C82", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_COPTIC, "copt", u"\u2C81\u2C82", {"Segoe UI Historic"}}, - {USCRIPT_CUNEIFORM, - "akk", - u"\U00012000\U0001200C", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_CUNEIFORM, "akk", u"\U00012000\U0001200C", {"Segoe UI Historic"}}, - {USCRIPT_CYPRIOT, - "ecy", - u"\U00010800\U00010801", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_CYPRIOT, "ecy", u"\U00010800\U00010801", {"Segoe UI Historic"}}, {USCRIPT_CYRILLIC, "ru", u"\u0410\u0411\u0412", {"Times New Roman"}}, - {USCRIPT_DESERET, - "en", - u"\U00010400\U00010401", - {"Segoe UI Symbol"}, - kWin10Only}, + {USCRIPT_DESERET, "en", u"\U00010400\U00010401", {"Segoe UI Symbol"}}, {USCRIPT_ETHIOPIC, "am", u"\u1201\u1202", {"Ebrima", "Nyala"}}, - {USCRIPT_GEORGIAN, - "ka", - u"\u10A0\u10A1", - {"Sylfaen", "Segoe UI"}, - kWin10Only}, + {USCRIPT_GEORGIAN, "ka", u"\u10A0\u10A1", {"Sylfaen", "Segoe UI"}}, {USCRIPT_GREEK, "el", u"\u0391\u0392", {"Times New Roman"}}, {USCRIPT_GURMUKHI, "pa", u"\u0A21\u0A22", {"Raavi", "Nirmala UI"}}, {USCRIPT_HAN, @@ -118,11 +88,7 @@ u"\u6211", {"Microsoft JhengHei", "Microsoft JhengHei UI"}}, {USCRIPT_HAN, "ja", u"\u6211", {"Meiryo UI", "Yu Gothic UI", "Yu Gothic"}}, - {USCRIPT_HANGUL, - "ko", - u"\u1100\u1101", - {"Malgun Gothic", "Gulim"}, - kWin10Only}, + {USCRIPT_HANGUL, "ko", u"\u1100\u1101", {"Malgun Gothic", "Gulim"}}, {USCRIPT_HEBREW, "he", u"\u05D1\u05D2", @@ -135,57 +101,39 @@ {USCRIPT_IMPERIAL_ARAMAIC, "arc", u"\U00010841\U00010842", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, {USCRIPT_INSCRIPTIONAL_PAHLAVI, "pal", u"\U00010B61\U00010B62", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, {USCRIPT_INSCRIPTIONAL_PARTHIAN, "xpr", u"\U00010B41\U00010B42", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, - {USCRIPT_JAVANESE, "jv", u"\uA991\uA992", {"Javanese Text"}, kWin10Only}, - {USCRIPT_KANNADA, "kn", u"\u0CA1\u0CA2", {"Nirmala UI", "Tunga"}}, - - {USCRIPT_KHAROSHTHI, - "sa", - u"\U00010A10\U00010A11", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_JAVANESE, "jv", u"\uA991\uA992", {"Javanese Text"}}, + {USCRIPT_KHAROSHTHI, "sa", u"\U00010A10\U00010A11", {"Segoe UI Historic"}}, {USCRIPT_LAO, "lo", u"\u0ED0\u0ED1", {"Lao UI", "Leelawadee UI", "Segoe UI"}}, - {USCRIPT_LISU, "lis", u"\uA4D0\uA4D1", {"Segoe UI"}, kWin10Only}, + {USCRIPT_LISU, "lis", u"\uA4D0\uA4D1", {"Segoe UI"}}, - {USCRIPT_LYCIAN, - "xlc", - u"\U00010281\U00010282", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_LYCIAN, "xlc", u"\U00010281\U00010282", {"Segoe UI Historic"}}, - {USCRIPT_LYDIAN, - "xld", - u"\U00010921\U00010922", - {"Segoe UI Historic"}, - kWin10Only}, + {USCRIPT_LYDIAN, "xld", u"\U00010921\U00010922", {"Segoe UI Historic"}}, {USCRIPT_MALAYALAM, "ml", u"\u0D21\u0D22", {"Kartika", "Nirmala UI"}}, {USCRIPT_MEROITIC_CURSIVE, "", u"\U000109A1\U000109A2", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, - {USCRIPT_MYANMAR, "my", u"\u1000\u1001", {"Myanmar Text"}, kWin10Only}, + {USCRIPT_MYANMAR, "my", u"\u1000\u1001", {"Myanmar Text"}}, {USCRIPT_NEW_TAI_LUE, "", u"\u1981\u1982", {"Microsoft New Tai Lue"}}, {USCRIPT_NKO, "nko", u"\u07C1\u07C2", {"Ebrima", "Segoe UI"}}, @@ -194,7 +142,7 @@ u"\u1680\u1681", {"Segoe UI Symbol", "Segoe UI Historic"}}, - {USCRIPT_OL_CHIKI, "", u"\u1C51\u1C52", {"Nirmala UI"}, kWin10Only}, + {USCRIPT_OL_CHIKI, "", u"\u1C51\u1C52", {"Nirmala UI"}}, {USCRIPT_OLD_ITALIC, "", @@ -204,14 +152,12 @@ {USCRIPT_OLD_PERSIAN, "peo", u"\U000103A1\U000103A2", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, {USCRIPT_OLD_SOUTH_ARABIAN, "", u"\U00010A61\U00010A62", - {"Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI Historic"}}, {USCRIPT_ORIYA, "or", u"\u0B21\u0B22", {"Kalinga", "Nirmala UI"}}, {USCRIPT_PHAGS_PA, "", u"\uA841\uA842", {"Microsoft PhagsPa"}}, @@ -224,16 +170,11 @@ {USCRIPT_SHAVIAN, "", u"\U00010451\U00010452", - {"Segoe UI", "Segoe UI Historic"}, - kWin10Only}, + {"Segoe UI", "Segoe UI Historic"}}, {USCRIPT_SINHALA, "si", u"\u0D91\u0D92", {"Iskoola Pota", "Nirmala UI"}}, - {USCRIPT_SORA_SOMPENG, - "", - u"\U000110D1\U000110D2", - {"Nirmala UI"}, - kWin10Only}, + {USCRIPT_SORA_SOMPENG, "", u"\U000110D1\U000110D2", {"Nirmala UI"}}, {USCRIPT_SYRIAC, "syr", @@ -247,8 +188,7 @@ {USCRIPT_THAI, "th", u"\u0e01\u0e02", - {"Tahoma", "Leelawadee UI", "Leelawadee"}, - kWin10Only}, + {"Tahoma", "Leelawadee UI", "Leelawadee"}}, {USCRIPT_TIBETAN, "bo", u"\u0F01\u0F02", {"Microsoft Himalaya"}}, {USCRIPT_TIFINAGH, "", u"\u2D31\u2D32", {"Ebrima"}}, {USCRIPT_VAI, "vai", u"\uA501\uA502", {"Ebrima"}}, @@ -260,7 +200,7 @@ // On linux, font-config configuration and fonts are mock. The config // can be found in '${build}/etc/fonts/fonts.conf' and the test fonts // can be found in '${build}/test_fonts/*'. -std::vector<FallbackFontTestCase> kGetFontFallbackTests = { +const std::vector<FallbackFontTestCase> kGetFontFallbackTests = { {USCRIPT_BENGALI, "bn", u"\u09B8\u09AE", {"Mukti Narrow"}}, {USCRIPT_DEVANAGARI, "hi", u"\u0905\u0906", {"Lohit Devanagari"}}, {USCRIPT_GURMUKHI, "pa", u"\u0A21\u0A22", {"Lohit Gurmukhi"}}, @@ -273,7 +213,7 @@ #else // No fallback font tests are defined on that platform. -std::vector<FallbackFontTestCase> kGetFontFallbackTests = {}; +const std::vector<FallbackFontTestCase> kGetFontFallbackTests = {}; #endif
diff --git a/ui/gfx/test/font_fallback_test_data.h b/ui/gfx/test/font_fallback_test_data.h index c4bf426..24bf19f 100644 --- a/ui/gfx/test/font_fallback_test_data.h +++ b/ui/gfx/test/font_fallback_test_data.h
@@ -18,18 +18,16 @@ FallbackFontTestCase(UScriptCode script_arg, std::string language_tag_arg, std::u16string text_arg, - std::vector<std::string> fallback_fonts_arg, - bool is_win10_arg = false); + std::vector<std::string> fallback_fonts_arg); FallbackFontTestCase(const FallbackFontTestCase& other); ~FallbackFontTestCase(); UScriptCode script; std::string language_tag; std::u16string text; std::vector<std::string> fallback_fonts; - bool is_win10 = false; }; -extern std::vector<FallbackFontTestCase> kGetFontFallbackTests; +extern const std::vector<FallbackFontTestCase> kGetFontFallbackTests; } // namespace gfx
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc index 089a6bc5..bc17d6e 100644 --- a/ui/gfx/win/direct_write.cc +++ b/ui/gfx/win/direct_write.cc
@@ -9,11 +9,9 @@ #include <string> #include "base/debug/alias.h" -#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h" -#include "base/win/windows_version.h" #include "skia/ext/fontmgr_default.h" #include "third_party/skia/include/core/SkFontMgr.h" #include "third_party/skia/include/ports/SkTypeface_win.h" @@ -62,37 +60,11 @@ CHECK(!!factory); SetDirectWriteFactory(factory.Get()); - // The skia call to create a new DirectWrite font manager instance can fail - // if we are unable to get the system font collection from the DirectWrite - // factory. The GetSystemFontCollection method in the IDWriteFactory - // interface fails with E_INVALIDARG on certain Windows 7 gold versions - // (6.1.7600.*). sk_sp<SkFontMgr> direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.Get()); - int iteration = 0; - if (!direct_write_font_mgr && - base::win::GetVersion() == base::win::Version::WIN7) { - // Windows (win7_rtm) may fail to map the service sections - // (crbug.com/956064). - constexpr int kMaxRetries = 5; - constexpr base::TimeDelta kRetrySleepTime = base::Microseconds(500); - while (iteration < kMaxRetries) { - base::PlatformThread::Sleep(kRetrySleepTime); - direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.Get()); - if (direct_write_font_mgr) - break; - ++iteration; - } - } - if (!direct_write_font_mgr) - iteration = -1; - base::UmaHistogramSparse("DirectWrite.Fonts.Gfx.InitializeLoopCount", - iteration); - // TODO(crbug.com/956064): Move to a CHECK when the cause of the crash is - // fixed and remove the if statement that fallback to GDI font manager. - DCHECK(!!direct_write_font_mgr); - if (!direct_write_font_mgr) + if (!direct_write_font_mgr) { direct_write_font_mgr = SkFontMgr_New_GDI(); + } // Override the default skia font manager. This must be called before any // use of the skia font manager is done (e.g. before any call to
diff --git a/ui/gl/child_window_win.cc b/ui/gl/child_window_win.cc index 950e8aa4..2c94d1afb 100644 --- a/ui/gl/child_window_win.cc +++ b/ui/gl/child_window_win.cc
@@ -79,8 +79,7 @@ }; // This runs on the window owner thread. -void CreateWindowsOnThread(const gfx::Size& size, - base::WaitableEvent* event, +void CreateWindowsOnThread(base::WaitableEvent* event, HWND* child_window, HWND* parent_window) { InitializeWindowClass(); @@ -93,12 +92,14 @@ // input. WS_EX_NOREDIRECTIONBITMAP avoids allocating a // bitmap that would otherwise be allocated with WS_EX_LAYERED, the bitmap is // only necessary if using Gdi objects with the window. - HWND window = CreateWindowEx( + // Using a size of 1x1 is fine because the window will be subsequently resized + // using SetWindowPos whenever the parent window size changes. + const HWND window = CreateWindowEx( WS_EX_NOPARENTNOTIFY | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_NOREDIRECTIONBITMAP, reinterpret_cast<wchar_t*>(g_window_class), L"", - WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE, 0, 0, size.width(), - size.height(), *parent_window, nullptr, nullptr, nullptr); + WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE, 0, 0, /*width*/ 1, + /*height*/ 1, *parent_window, nullptr, nullptr, nullptr); if (!window) { logging::SystemErrorCode error = logging::GetLastSystemErrorCode(); base::debug::Alias(&error); @@ -122,8 +123,7 @@ } // namespace -ChildWindowWin::ChildWindowWin(HWND parent_window) - : parent_window_(parent_window) {} +ChildWindowWin::ChildWindowWin() = default; void ChildWindowWin::Initialize() { if (window_) @@ -136,13 +136,9 @@ base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); - RECT window_rect; - GetClientRect(parent_window_, &window_rect); - thread_->task_runner()->PostTask( - FROM_HERE, - base::BindOnce(&CreateWindowsOnThread, gfx::Rect(window_rect).size(), - &event, &window_, &initial_parent_window_)); + FROM_HERE, base::BindOnce(&CreateWindowsOnThread, &event, &window_, + &initial_parent_window_)); event.Wait(); }
diff --git a/ui/gl/child_window_win.h b/ui/gl/child_window_win.h index 9989f0d..abae226 100644 --- a/ui/gl/child_window_win.h +++ b/ui/gl/child_window_win.h
@@ -19,8 +19,7 @@ // which is reparented by the browser to be a child of its window. class GL_EXPORT ChildWindowWin { public: - explicit ChildWindowWin(HWND parent_window); - + ChildWindowWin(); ChildWindowWin(const ChildWindowWin&) = delete; ChildWindowWin& operator=(const ChildWindowWin&) = delete; @@ -34,8 +33,6 @@ private: // The window owner thread. std::unique_ptr<base::Thread> thread_; - // The eventual parent of the window living in the browser process. - const HWND parent_window_; HWND window_ = nullptr; // The window is initially created with this parent window. We need to keep it // around so that we can destroy it at the end.
diff --git a/ui/gl/dcomp_presenter.cc b/ui/gl/dcomp_presenter.cc index ac54766e..d2cccfba 100644 --- a/ui/gl/dcomp_presenter.cc +++ b/ui/gl/dcomp_presenter.cc
@@ -43,11 +43,9 @@ DCompPresenter::DCompPresenter( GLDisplayEGL* display, - HWND parent_window, VSyncCallback vsync_callback, const DirectCompositionSurfaceWin::Settings& settings) : SurfacelessEGL(display, gfx::Size(1, 1)), - child_window_(parent_window), vsync_callback_(std::move(vsync_callback)), vsync_thread_(VSyncThreadWin::GetInstance()), task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()), @@ -72,10 +70,9 @@ child_window_.Initialize(); - window_ = child_window_.window(); - - if (!layer_tree_->Initialize(window_)) + if (!layer_tree_->Initialize(window())) { return false; + } return true; } @@ -112,7 +109,7 @@ } // Force a resize and redraw (but not a move, activate, etc.). - if (!SetWindowPos(window_, nullptr, 0, 0, size.width(), size.height(), + if (!SetWindowPos(window(), nullptr, 0, 0, size.width(), size.height(), SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOZORDER)) { return false;
diff --git a/ui/gl/dcomp_presenter.h b/ui/gl/dcomp_presenter.h index 5191cb0..367da96 100644 --- a/ui/gl/dcomp_presenter.h +++ b/ui/gl/dcomp_presenter.h
@@ -48,7 +48,6 @@ using OverlayHDRInfoUpdateCallback = base::RepeatingClosure; DCompPresenter(GLDisplayEGL* display, - HWND parent_window, VSyncCallback vsync_callback, const DirectCompositionSurfaceWin::Settings& settings); @@ -97,7 +96,7 @@ mojo::PendingReceiver<gfx::mojom::DelegatedInkPointRenderer> pending_receiver) override; - HWND window() const { return window_; } + HWND window() const { return child_window_.window(); } scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); @@ -139,7 +138,6 @@ void HandleVSyncOnMainThread(base::TimeTicks vsync_time, base::TimeDelta interval); - HWND window_ = nullptr; ChildWindowWin child_window_; Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device_;
diff --git a/ui/gl/dcomp_presenter_unittest.cc b/ui/gl/dcomp_presenter_unittest.cc index b5e16de7..1374534b 100644 --- a/ui/gl/dcomp_presenter_unittest.cc +++ b/ui/gl/dcomp_presenter_unittest.cc
@@ -152,7 +152,7 @@ DirectCompositionSurfaceWin::Settings settings; scoped_refptr<DCompPresenter> surface = base::MakeRefCounted<DCompPresenter>( - gl::GLSurfaceEGL::GetGLDisplayEGL(), parent_window_, + gl::GLSurfaceEGL::GetGLDisplayEGL(), DCompPresenter::VSyncCallback(), settings); EXPECT_TRUE(surface->Initialize(GLSurfaceFormat()));
diff --git a/ui/gl/delegated_ink_point_renderer_gpu_unittest.cc b/ui/gl/delegated_ink_point_renderer_gpu_unittest.cc index 88b43ca..d02c7db5e 100644 --- a/ui/gl/delegated_ink_point_renderer_gpu_unittest.cc +++ b/ui/gl/delegated_ink_point_renderer_gpu_unittest.cc
@@ -134,7 +134,7 @@ void CreateDirectCompositionSurfaceWin() { DirectCompositionSurfaceWin::Settings settings; surface_ = base::MakeRefCounted<DirectCompositionSurfaceWin>( - gl::GLSurfaceEGL::GetGLDisplayEGL(), parent_window_, + gl::GLSurfaceEGL::GetGLDisplayEGL(), DirectCompositionSurfaceWin::VSyncCallback(), settings); EXPECT_TRUE(surface_->Initialize(GLSurfaceFormat()));
diff --git a/ui/gl/direct_composition_child_surface_win.cc b/ui/gl/direct_composition_child_surface_win.cc index b2094da1..72a07a7 100644 --- a/ui/gl/direct_composition_child_surface_win.cc +++ b/ui/gl/direct_composition_child_surface_win.cc
@@ -16,7 +16,6 @@ #include "base/synchronization/waitable_event.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/traced_value.h" -#include "base/win/windows_version.h" #include "ui/gfx/color_space_win.h" #include "ui/gfx/native_widget_types.h" #include "ui/gl/direct_composition_support.h" @@ -53,9 +52,7 @@ } bool IsWaitableSwapChainEnabled() { - // Waitable swap chains were first enabled in Win 8.1/DXGI 1.3 - return (base::win::GetVersion() >= base::win::Version::WIN8_1) && - base::FeatureList::IsEnabled(features::kDXGIWaitableSwapChain); + return base::FeatureList::IsEnabled(features::kDXGIWaitableSwapChain); } UINT GetMaxWaitableQueuedFrames() {
diff --git a/ui/gl/direct_composition_surface_win.cc b/ui/gl/direct_composition_surface_win.cc index 44c7803..4db92d7d 100644 --- a/ui/gl/direct_composition_surface_win.cc +++ b/ui/gl/direct_composition_surface_win.cc
@@ -44,11 +44,9 @@ DirectCompositionSurfaceWin::DirectCompositionSurfaceWin( GLDisplayEGL* display, - HWND parent_window, VSyncCallback vsync_callback, const Settings& settings) : GLSurfaceEGL(display), - child_window_(parent_window), vsync_callback_(std::move(vsync_callback)), vsync_thread_(VSyncThreadWin::GetInstance()), task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()), @@ -76,10 +74,9 @@ child_window_.Initialize(); - window_ = child_window_.window(); - - if (!layer_tree_->Initialize(window_)) + if (!layer_tree_->Initialize(window())) { return false; + } if (!root_surface_->Initialize(GLSurfaceFormat())) return false; @@ -124,7 +121,7 @@ const gfx::ColorSpace& color_space, bool has_alpha) { // Force a resize and redraw (but not a move, activate, etc.). - if (!SetWindowPos(window_, nullptr, 0, 0, size.width(), size.height(), + if (!SetWindowPos(window(), nullptr, 0, 0, size.width(), size.height(), SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOZORDER)) { return false;
diff --git a/ui/gl/direct_composition_surface_win.h b/ui/gl/direct_composition_surface_win.h index 446f50d..6dd63112 100644 --- a/ui/gl/direct_composition_surface_win.h +++ b/ui/gl/direct_composition_surface_win.h
@@ -57,7 +57,6 @@ DirectCompositionSurfaceWin( GLDisplayEGL* display, - HWND parent_window, VSyncCallback vsync_callback, const DirectCompositionSurfaceWin::Settings& settings); @@ -113,7 +112,7 @@ mojo::PendingReceiver<gfx::mojom::DelegatedInkPointRenderer> pending_receiver) override; - HWND window() const { return window_; } + HWND window() const { return child_window_.window(); } scoped_refptr<base::TaskRunner> GetWindowTaskRunnerForTesting(); @@ -161,7 +160,6 @@ void HandleVSyncOnMainThread(base::TimeTicks vsync_time, base::TimeDelta interval); - HWND window_ = nullptr; ChildWindowWin child_window_; Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device_;
diff --git a/ui/gl/direct_composition_surface_win_unittest.cc b/ui/gl/direct_composition_surface_win_unittest.cc index 03d075b..e4a1f18a 100644 --- a/ui/gl/direct_composition_surface_win_unittest.cc +++ b/ui/gl/direct_composition_surface_win_unittest.cc
@@ -154,7 +154,7 @@ DirectCompositionSurfaceWin::Settings settings; scoped_refptr<DirectCompositionSurfaceWin> surface = base::MakeRefCounted<DirectCompositionSurfaceWin>( - gl::GLSurfaceEGL::GetGLDisplayEGL(), parent_window_, + gl::GLSurfaceEGL::GetGLDisplayEGL(), DirectCompositionSurfaceWin::VSyncCallback(), settings); EXPECT_TRUE(surface->Initialize(GLSurfaceFormat()));
diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc index 1ec57a14..a60d6e3 100644 --- a/ui/gtk/native_theme_gtk.cc +++ b/ui/gtk/native_theme_gtk.cc
@@ -323,8 +323,10 @@ ? GTK_STATE_FLAG_NORMAL : GTK_STATE_FLAG_BACKDROP); - SkBitmap bitmap = - GetWidgetBitmap(rect.size(), context, BG_RENDER_NORMAL, false); + SkBitmap bitmap = GetWidgetBitmap( + rect.size(), context, + frame_top_area.use_custom_frame ? BG_RENDER_NORMAL : BG_RENDER_RECURSIVE, + false); bitmap.setImmutable(); canvas->drawImage(cc::PaintImage::CreateFromBitmap(std::move(bitmap)), rect.x(), rect.y());
diff --git a/ui/native_theme/caption_style_win.cc b/ui/native_theme/caption_style_win.cc index a8b745c9..31fda250 100644 --- a/ui/native_theme/caption_style_win.cc +++ b/ui/native_theme/caption_style_win.cc
@@ -280,12 +280,10 @@ } // namespace absl::optional<CaptionStyle> CaptionStyle::FromSystemSettings() { - if (base::win::GetVersion() >= base::win::Version::WIN10 && - base::FeatureList::IsEnabled(features::kSystemCaptionStyle)) { + if (base::FeatureList::IsEnabled(features::kSystemCaptionStyle)) { return InitializeFromSystemSettings(); } - // Return default CaptionStyle for pre Win10 versions since system settings - // don't allow caption styling. + // Return default CaptionStyle if kSystemCaptionStyle is not enabled. return absl::nullopt; }
diff --git a/ui/native_theme/caption_style_win_unittest.cc b/ui/native_theme/caption_style_win_unittest.cc index 6364d352..53a70a33 100644 --- a/ui/native_theme/caption_style_win_unittest.cc +++ b/ui/native_theme/caption_style_win_unittest.cc
@@ -6,35 +6,32 @@ #include "base/test/scoped_feature_list.h" #include "base/win/scoped_com_initializer.h" -#include "base/win/windows_version.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/ui_base_features.h" namespace ui { // Test to ensure closed caption styling from system settings can be obtained -// (we obtain a CaptionStyle) on Windows 10. +// (we obtain a CaptionStyle). TEST(CaptionStyleWinTest, TestWinCaptionStyle) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeature(features::kSystemCaptionStyle); - if (base::win::GetVersion() >= base::win::Version::WIN10) { - base::win::ScopedCOMInitializer com_initializer; - ASSERT_TRUE(com_initializer.Succeeded()); + base::win::ScopedCOMInitializer com_initializer; + ASSERT_TRUE(com_initializer.Succeeded()); - absl::optional<ui::CaptionStyle> caption_style = - ui::CaptionStyle::FromSystemSettings(); - // On Windows out of the box, all caption style properties are set to - // Default. In which case, each of these should be empty. - ASSERT_TRUE(caption_style.has_value()); - EXPECT_TRUE(caption_style->background_color.empty()); - EXPECT_TRUE(caption_style->font_family.empty()); - EXPECT_TRUE(caption_style->font_variant.empty()); - EXPECT_TRUE(caption_style->text_color.empty()); - EXPECT_TRUE(caption_style->text_shadow.empty()); - EXPECT_TRUE(caption_style->text_size.empty()); - EXPECT_TRUE(caption_style->window_color.empty()); - } + absl::optional<ui::CaptionStyle> caption_style = + ui::CaptionStyle::FromSystemSettings(); + // On Windows out of the box, all caption style properties are set to + // Default. In which case, each of these should be empty. + ASSERT_TRUE(caption_style.has_value()); + EXPECT_TRUE(caption_style->background_color.empty()); + EXPECT_TRUE(caption_style->font_family.empty()); + EXPECT_TRUE(caption_style->font_variant.empty()); + EXPECT_TRUE(caption_style->text_color.empty()); + EXPECT_TRUE(caption_style->text_shadow.empty()); + EXPECT_TRUE(caption_style->text_size.empty()); + EXPECT_TRUE(caption_style->window_color.empty()); } } // namespace ui
diff --git a/ui/shell_dialogs/select_file_dialog_win_unittest.cc b/ui/shell_dialogs/select_file_dialog_win_unittest.cc index 4527e1f..8465e5e 100644 --- a/ui/shell_dialogs/select_file_dialog_win_unittest.cc +++ b/ui/shell_dialogs/select_file_dialog_win_unittest.cc
@@ -21,7 +21,6 @@ #include "base/test/test_timeouts.h" #include "base/threading/platform_thread.h" #include "base/win/scoped_com_initializer.h" -#include "base/win/windows_version.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" #include "ui/shell_dialogs/select_file_dialog.h" @@ -199,10 +198,6 @@ }; TEST_F(SelectFileDialogWinTest, CancelAllDialogs) { - // TODO(crbug.com/1265379): Flaky on Windows 7. - if (base::win::GetVersion() <= base::win::Version::WIN7) - GTEST_SKIP() << "Skipping test for Windows 7"; - // Intentionally not testing SELECT_UPLOAD_FOLDER because the dialog is // customized for that case. struct {
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc index d595d249..ce57e77 100644 --- a/ui/snapshot/snapshot_aura_unittest.cc +++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -212,10 +212,10 @@ // BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif SetupTestWindow(root_window()->bounds()); WaitForDraw(); @@ -228,10 +228,10 @@ TEST_F(SnapshotAuraTest, PartialBounds) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif gfx::Rect test_bounds(100, 100, 300, 200); SetupTestWindow(test_bounds); @@ -244,10 +244,10 @@ TEST_F(SnapshotAuraTest, Rotated) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif test_screen()->SetDisplayRotation(display::Display::ROTATE_90); @@ -262,10 +262,10 @@ TEST_F(SnapshotAuraTest, UIScale) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif const float kUIScale = 0.5f; test_screen()->SetUIScale(kUIScale); @@ -286,10 +286,10 @@ TEST_F(SnapshotAuraTest, DeviceScaleFactor) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif test_screen()->SetDeviceScaleFactor(2.0f); @@ -309,10 +309,10 @@ TEST_F(SnapshotAuraTest, RotateAndUIScale) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif const float kUIScale = 0.5f; test_screen()->SetUIScale(kUIScale); @@ -334,10 +334,10 @@ TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) { #if BUILDFLAG(IS_WIN) - // TODO(https://crbug.com/850556): Make work on Win10. - base::win::Version version = base::win::GetVersion(); - if (version >= base::win::Version::WIN10) - return; + // TODO(https://crbug.com/850556): Make work on Windows. + if (::testing::internal::AlwaysTrue()) { + GTEST_SKIP(); + } #endif test_screen()->SetDeviceScaleFactor(2.0f); const float kUIScale = 0.5f;
diff --git a/ui/snapshot/snapshot_win.cc b/ui/snapshot/snapshot_win.cc index c7afae3d..74d600db 100644 --- a/ui/snapshot/snapshot_win.cc +++ b/ui/snapshot/snapshot_win.cc
@@ -5,6 +5,7 @@ #include "ui/snapshot/snapshot_win.h" #include <memory> +#include <utility> #include "base/functional/callback.h" #include "base/win/windows_version.h" @@ -20,17 +21,6 @@ #include "ui/snapshot/snapshot.h" #include "ui/snapshot/snapshot_aura.h" -namespace { - -// Windows 8.1 is the first version that supports PW_RENDERFULLCONTENT. -// Without that flag PrintWindow may not correctly capture what's actually -// onscreen. -bool UseAuraSnapshot() { - return (base::win::GetVersion() < base::win::Version::WIN8_1); -} - -} // namespace - namespace ui { namespace internal { @@ -95,11 +85,6 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle, const gfx::Rect& snapshot_bounds, gfx::Image* image) { - if (UseAuraSnapshot()) { - // Not supported in Aura. Callers should fall back to the async version. - return false; - } - DCHECK(window_handle); gfx::Rect window_bounds = window_handle->GetBoundsInRootWindow(); aura::WindowTreeHost* host = window_handle->GetHost(); @@ -124,10 +109,6 @@ void GrabWindowSnapshotAsync(gfx::NativeWindow window, const gfx::Rect& source_rect, GrabWindowSnapshotAsyncCallback callback) { - if (UseAuraSnapshot()) { - GrabWindowSnapshotAsyncAura(window, source_rect, std::move(callback)); - return; - } gfx::Image image; GrabWindowSnapshot(window, source_rect, &image); std::move(callback).Run(image); @@ -136,10 +117,6 @@ void GrabViewSnapshotAsync(gfx::NativeView view, const gfx::Rect& source_rect, GrabWindowSnapshotAsyncCallback callback) { - if (UseAuraSnapshot()) { - GrabWindowSnapshotAsyncAura(view, source_rect, std::move(callback)); - return; - } NOTIMPLEMENTED(); std::move(callback).Run(gfx::Image()); } @@ -148,11 +125,6 @@ const gfx::Rect& source_rect, const gfx::Size& target_size, GrabWindowSnapshotAsyncCallback callback) { - if (UseAuraSnapshot()) { - GrabWindowSnapshotAndScaleAsyncAura(window, source_rect, target_size, - std::move(callback)); - return; - } NOTIMPLEMENTED(); std::move(callback).Run(gfx::Image()); }
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index c62cfc65..7a413ac 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc
@@ -145,12 +145,7 @@ SetFocusBehavior(FocusBehavior::ALWAYS); #endif - if (features::IsChromeRefresh2023()) { - // TODO(crbug.com/1392549): Replace placeholder color id. - SetBackgroundColorId(ui::kColorSubtleAccent); - } else { - SetBackgroundColorId(ui::kColorTextfieldBackground); - } + SetBackgroundColorId(ui::kColorTextfieldBackground); UpdateBorder(); arrow_button_ = @@ -601,16 +596,10 @@ // ChromeRefresh2023. if (should_show_arrow_) { gfx::Rect arrow_bounds(width() - GetComboboxArrowContainerWidthAndMargins(), - 0, kComboboxArrowContainerWidth, height()); + 0, GetComboboxArrowContainerWidth(), height()); arrow_bounds.ClampToCenteredSize(ComboboxArrowSize()); AdjustBoundsForRTLUI(&arrow_bounds); - if (features::IsChromeRefresh2023()) { - PaintComboboxArrowBackground( - GetColorProvider()->GetColor(ui::kColorAlertHighSeverity), canvas, - gfx::PointF(width() - GetComboboxArrowContainerWidthAndMargins(), - (height() - kComboboxArrowContainerWidth) / 2.0f)); - } PaintComboboxArrow(text_color, arrow_bounds, canvas); } }
diff --git a/ui/views/controls/combobox/combobox_util.cc b/ui/views/controls/combobox/combobox_util.cc index 60b73be..d050086 100644 --- a/ui/views/controls/combobox/combobox_util.cc +++ b/ui/views/controls/combobox/combobox_util.cc
@@ -16,36 +16,23 @@ namespace views { const int kComboboxArrowPaddingWidth = 8; -const int kComboboxArrowContainerWidth = - ComboboxArrowSize().width() + kComboboxArrowPaddingWidth * 2; +const int kComboboxArrowPaddingWidthChromeRefresh2023 = 4; int GetComboboxArrowContainerWidthAndMargins() { - // Since the container will be visible, we need some extra margins for the - // ChromeRefresh case. - // TODO(crbug.com/1392549): Replace placeholder values and potentially combine - // use cases with INSETS_VECTOR_IMAGE_BUTTON. - gfx::Insets margins_chromerefresh2023 = - LayoutProvider::Get()->GetInsetsMetric(INSETS_VECTOR_IMAGE_BUTTON); + // For ChromeRefresh2023, add extra margins between combobox arrow container + // and edge of the combobox. return features::IsChromeRefresh2023() - ? kComboboxArrowContainerWidth + margins_chromerefresh2023.left() + - margins_chromerefresh2023.right() - : kComboboxArrowContainerWidth; + ? GetComboboxArrowContainerWidth() + + LayoutProvider::Get()->GetDistanceMetric( + DISTANCE_TEXTFIELD_HORIZONTAL_TEXT_PADDING) + : GetComboboxArrowContainerWidth(); } -void PaintComboboxArrowBackground(SkColor color, - gfx::Canvas* canvas, - gfx::PointF origin) { - cc::PaintFlags flags; - gfx::RectF background_bounds( - origin, - gfx::SizeF(kComboboxArrowContainerWidth, kComboboxArrowContainerWidth)); - flags.setColor(color); - // TODO(crbug.com/1392549): Replace placeholder value for corner radius. - int background_corner_radius_chromerefresh2023 = - views::LayoutProvider::Get()->GetCornerRadiusMetric( - views::Emphasis::kLow); - canvas->DrawRoundRect(background_bounds, - background_corner_radius_chromerefresh2023, flags); +int GetComboboxArrowContainerWidth() { + int padding = features::IsChromeRefresh2023() + ? kComboboxArrowPaddingWidthChromeRefresh2023 * 2 + : kComboboxArrowPaddingWidth * 2; + return ComboboxArrowSize().width() + padding; } void PaintComboboxArrow(SkColor color,
diff --git a/ui/views/controls/combobox/combobox_util.h b/ui/views/controls/combobox/combobox_util.h index 2e45066..5d035cd 100644 --- a/ui/views/controls/combobox/combobox_util.h +++ b/ui/views/controls/combobox/combobox_util.h
@@ -14,7 +14,6 @@ namespace gfx { class Canvas; class Rect; -class PointF; } // namespace gfx namespace views { @@ -24,20 +23,17 @@ return gfx::Size(/*width=*/8, /*height=*/4); } extern const int kComboboxArrowPaddingWidth; -extern const int kComboboxArrowContainerWidth; +extern const int kComboboxArrowPaddingWidthChromeRefresh2023; int GetComboboxArrowContainerWidthAndMargins(); +int GetComboboxArrowContainerWidth(); + // Paints the arrow for a combobox. void PaintComboboxArrow(SkColor color, const gfx::Rect& bounds, gfx::Canvas* canvas); -// Draws a background around the combobox arrow. -void PaintComboboxArrowBackground(SkColor color, - gfx::Canvas* canvas, - gfx::PointF origin); - } // namespace views #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_UTIL_H_
diff --git a/ui/views/controls/editable_combobox/editable_combobox.cc b/ui/views/controls/editable_combobox/editable_combobox.cc index 2a1c6eb..1c54f7f1 100644 --- a/ui/views/controls/editable_combobox/editable_combobox.cc +++ b/ui/views/controls/editable_combobox/editable_combobox.cc
@@ -108,12 +108,6 @@ canvas->ClipRect(GetContentsBounds()); gfx::Rect arrow_bounds = GetLocalBounds(); arrow_bounds.ClampToCenteredSize(ComboboxArrowSize()); - if (features::IsChromeRefresh2023()) { - PaintComboboxArrowBackground( - GetColorProvider()->GetColor(ui::kColorAlertHighSeverity), canvas, - gfx::PointF(arrow_bounds.x() - kComboboxArrowPaddingWidth, - (height() - kComboboxArrowContainerWidth) / 2.0f)); - } // Make sure the arrow use the same color as the text in the combobox. PaintComboboxArrow(style::GetColor(*this, style::CONTEXT_TEXTFIELD, GetEnabled() ? style::STYLE_PRIMARY @@ -367,8 +361,12 @@ : ui::TEXT_INPUT_TYPE_TEXT); AddChildView(textfield_.get()); if (display_arrow) { - textfield_->SetExtraInsets(gfx::Insets::TLBR( - 0, 0, 0, kComboboxArrowContainerWidth - kComboboxArrowPaddingWidth)); + textfield_->SetExtraInsets( + gfx::Insets::TLBR(0, 0, 0, + GetComboboxArrowContainerWidthAndMargins() - + (features::IsChromeRefresh2023() + ? kComboboxArrowPaddingWidthChromeRefresh2023 + : kComboboxArrowPaddingWidth))); arrow_ = AddChildView(std::make_unique<Arrow>(base::BindRepeating( &EditableCombobox::ArrowButtonPressed, base::Unretained(this)))); } @@ -431,7 +429,7 @@ if (arrow_) { gfx::Rect arrow_bounds( /*x=*/width() - GetComboboxArrowContainerWidthAndMargins(), - /*y=*/0, kComboboxArrowContainerWidth, height()); + /*y=*/0, GetComboboxArrowContainerWidth(), height()); arrow_->SetBoundsRect(arrow_bounds); } }
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc index 32c77f8..349bce94 100644 --- a/ui/views/layout/layout_provider.cc +++ b/ui/views/layout/layout_provider.cc
@@ -117,7 +117,7 @@ case DISTANCE_TABLE_CELL_HORIZONTAL_MARGIN: return 12; case DISTANCE_TEXTFIELD_HORIZONTAL_TEXT_PADDING: - return 8; + return features::IsChromeRefresh2023() ? 10 : 8; case DISTANCE_UNRELATED_CONTROL_VERTICAL: return 16; case VIEWS_DISTANCE_END:
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index a9295dd..ae7b6e7 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc
@@ -133,13 +133,13 @@ return false; // Check if the visibility states of the View and the Layer are in sync. - EXPECT_EQ(l->IsDrawn(), v->IsDrawn()); - if (v->IsDrawn() != l->IsDrawn()) { + EXPECT_EQ(l->IsVisible(), v->IsDrawn()); + if (v->IsDrawn() != l->IsVisible()) { for (const views::View* vv = v; vv; vv = vv->parent()) LOG(ERROR) << "V: " << vv << " " << vv->GetVisible() << " " << vv->IsDrawn() << " " << vv->layer(); for (const ui::Layer* ll = l; ll; ll = ll->parent()) - LOG(ERROR) << "L: " << ll << " " << ll->IsDrawn(); + LOG(ERROR) << "L: " << ll << " " << ll->IsVisible(); return false; } @@ -4304,19 +4304,19 @@ content_view->AddChildView(v1); EXPECT_TRUE( LayerIsAncestor(widget()->GetCompositor()->root_layer(), v1->layer())); - EXPECT_TRUE(v1->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); v1->SetVisible(false); - EXPECT_FALSE(v1->layer()->IsDrawn()); + EXPECT_FALSE(v1->layer()->IsVisible()); v1->SetVisible(true); - EXPECT_TRUE(v1->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); widget()->Hide(); - EXPECT_FALSE(v1->layer()->IsDrawn()); + EXPECT_FALSE(v1->layer()->IsVisible()); widget()->Show(); - EXPECT_TRUE(v1->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); } // Tests that the layers in the subtree are orphaned after a View is removed @@ -4332,7 +4332,7 @@ v2->SetPaintToLayer(); EXPECT_TRUE( LayerIsAncestor(widget()->GetCompositor()->root_layer(), v2->layer())); - EXPECT_TRUE(v2->layer()->IsDrawn()); + EXPECT_TRUE(v2->layer()->IsVisible()); content_view->RemoveChildView(v1); @@ -4346,7 +4346,7 @@ v1 = nullptr; EXPECT_TRUE( LayerIsAncestor(widget()->GetCompositor()->root_layer(), v2->layer())); - EXPECT_TRUE(v2->layer()->IsDrawn()); + EXPECT_TRUE(v2->layer()->IsVisible()); } class PaintTrackingView : public View { @@ -4447,32 +4447,32 @@ View* v4 = v3->AddChildView(std::make_unique<View>()); v4->SetPaintToLayer(); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_FALSE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_FALSE(v4->layer()->IsVisible()); v2->SetVisible(false); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_FALSE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_FALSE(v4->layer()->IsVisible()); v2->SetVisible(true); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_FALSE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_FALSE(v4->layer()->IsVisible()); v2->SetVisible(false); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_FALSE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_FALSE(v4->layer()->IsVisible()); EXPECT_TRUE(ViewAndLayerTreeAreConsistent(v1, v1->layer())); v3->SetVisible(true); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_FALSE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_FALSE(v4->layer()->IsVisible()); EXPECT_TRUE(ViewAndLayerTreeAreConsistent(v1, v1->layer())); // Reparent |v3| to |v1|. v2->RemoveChildView(v3); v1->AddChildView(v3); - EXPECT_TRUE(v1->layer()->IsDrawn()); - EXPECT_TRUE(v4->layer()->IsDrawn()); + EXPECT_TRUE(v1->layer()->IsVisible()); + EXPECT_TRUE(v4->layer()->IsVisible()); EXPECT_TRUE(ViewAndLayerTreeAreConsistent(v1, v1->layer())); }
diff --git a/ui/views/widget/native_widget_mac_unittest.mm b/ui/views/widget/native_widget_mac_unittest.mm index 06881896a..013dcbd8 100644 --- a/ui/views/widget/native_widget_mac_unittest.mm +++ b/ui/views/widget/native_widget_mac_unittest.mm
@@ -1364,7 +1364,7 @@ sheet_widget->SetBounds(gfx::Rect(50, 50, 200, 150)); EXPECT_FALSE(sheet_widget->IsVisible()); - EXPECT_FALSE(sheet_widget->GetLayer()->IsDrawn()); + EXPECT_FALSE(sheet_widget->GetLayer()->IsVisible()); NSButton* parent_close_button = [native_parent standardWindowButton:NSWindowCloseButton]; @@ -1381,7 +1381,7 @@ // Ensure that before the sheet runs, the window contents would // be drawn. EXPECT_TRUE(sheet_widget->IsVisible()); - EXPECT_TRUE(sheet_widget->GetLayer()->IsDrawn()); + EXPECT_TRUE(sheet_widget->GetLayer()->IsVisible()); *did_observe_ptr = true; }];