diff --git a/.gitignore b/.gitignore index 884d1ca..d54f60e4 100644 --- a/.gitignore +++ b/.gitignore
@@ -163,6 +163,7 @@ /chrome/test/data/plugin/ /chrome/test/data/vr/ /chrome/test/data/webrtc/resources +/chrome/test/data/webui/tab_search /chrome/test/data/xr/ar_playback_datasets/*.mp4 /chrome/test/data/xr/webvr_info/ /chrome/test/media_router/internal
diff --git a/AUTHORS b/AUTHORS index 72e3262..bcb2ab9 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -1134,6 +1134,7 @@ Code Aurora Forum <*@codeaurora.org> Collabora Limited <*@collabora.com> Comodo CA Limited +CoSMo Software pvt ltd <*@cosmosoftware.io> Cosium <*@cosium.com> Dell Technologies Inc. <*@dell.corp-partner.google.com> Duck Duck Go, Inc. <*@duckduckgo.com>
diff --git a/DEPS b/DEPS index b9e36da7..57d4b75 100644 --- a/DEPS +++ b/DEPS
@@ -194,11 +194,11 @@ # 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': '041796e60364e3024acdeb7b3fb511c9d7f9e743', + 'skia_revision': '3b5a4fac1e5e5c15af2adc56aa7c19d6f6043274', # 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': '9329d03063bad3e90efc78062e27bc0cd6b9841d', + 'v8_revision': '38ef299a11b6e592fe59429ff70efc3d4e1720c4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -206,11 +206,11 @@ # 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': 'f3f891c5147106b84198e08975a09be1b2404c42', + 'angle_revision': '92ffd40efaacc78671f409fa7611ebdec22de2bb', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'ad65826a2ab181592473fb54ab78025771f4caf6', + 'swiftshader_revision': '522b34c810c51048102f4f667ecc2d895760a6e6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -245,7 +245,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': 'b1286b32a9f2bcba3f22c9857ba6df30733b7845', + 'freetype_revision': 'c922ffa5d2fe359d5e0d788f3a0850a59da4ae20', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling HarfBuzz # and whatever else without interference from each other. @@ -257,7 +257,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': '570934c3dab2753d075f3f4912a53a377537eb91', + 'catapult_revision': 'c4187c19b8f83d2f71e63bfa00b8ffba90691517', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -265,7 +265,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': 'c28f64b4b6d043ec396082ca55190cff560d4ddb', + 'devtools_frontend_revision': '5f4c6e5b4c8917338765d92f210206e26c1eb7b8', # 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. @@ -313,7 +313,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. - 'shaderc_revision': 'fdad1302b17ba4ad40187fe9322c730f919573a1', + 'shaderc_revision': '15f98cdafa047cae9c965fd2bad032a8deb9a586', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -1241,7 +1241,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '7d22cca0b49fb57933e504aed51f2fa600d4006e', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '85cf057d6c800c6722161c2e190ee082f0262adb', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1319,7 +1319,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'sEIWEEBZyN1iUaHvf48Bb0mwnMNqsP5nhzU2nGektcsC' + 'version': '6bZN4TqtfLba0SiJItNPHZ3i_ngPcqPGRjBKVYDRdkIC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1541,7 +1541,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@91d4008f64e2a1d4a60bcf25d26548f463ea0778', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@ecc9f3494ee98ccd39f00a424a7412c0acaa77cb', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/aw_browser_policy_connector.cc b/android_webview/browser/aw_browser_policy_connector.cc index 0d1c107..3501719 100644 --- a/android_webview/browser/aw_browser_policy_connector.cc +++ b/android_webview/browser/aw_browser_policy_connector.cc
@@ -11,6 +11,7 @@ #include "components/policy/core/browser/android/android_combined_policy_provider.h" #include "components/policy/core/browser/configuration_policy_handler_list.h" #include "components/policy/core/browser/url_blacklist_policy_handler.h" +#include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/policy_constants.h" #include "components/version_info/android/channel_getter.h" @@ -25,11 +26,6 @@ void PopulatePolicyHandlerParameters( policy::PolicyHandlerParameters* parameters) {} -// Used to check if a policy is deprecated. Currently bypasses that check. -const policy::PolicyDetails* GetChromePolicyDetails(const std::string& policy) { - return nullptr; -} - // Factory for the handlers that will be responsible for converting the policies // to the associated preferences. std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildHandlerList( @@ -38,7 +34,9 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> handlers( new policy::ConfigurationPolicyHandlerList( base::BindRepeating(&PopulatePolicyHandlerParameters), - base::BindRepeating(&GetChromePolicyDetails), + // Used to check if a policy is deprecated. Currently bypasses that + // check. + policy::GetChromePolicyDetailsCallback(), channel != version_info::Channel::STABLE && channel != version_info::Channel::BETA));
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index ee81a4c0..7a81068 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -190,6 +190,8 @@ "ambient/ui/ambient_assistant_container_view.h", "ambient/ui/ambient_assistant_dialog_plate.cc", "ambient/ui/ambient_assistant_dialog_plate.h", + "ambient/ui/ambient_background_image_view.cc", + "ambient/ui/ambient_background_image_view.h", "ambient/ui/ambient_container_view.cc", "ambient/ui/ambient_container_view.h", "ambient/ui/ambient_view_delegate.h",
diff --git a/ash/ambient/ambient_photo_controller.h b/ash/ambient/ambient_photo_controller.h index 58c41c0..dea9dde 100644 --- a/ash/ambient/ambient_photo_controller.h +++ b/ash/ambient/ambient_photo_controller.h
@@ -146,6 +146,10 @@ image_decoder_ = std::move(image_decoder); } + AmbientImageDecoder* get_image_decoder_for_testing() { + return image_decoder_.get(); + } + AmbientBackendModel ambient_backend_model_; // The timer to refresh photos.
diff --git a/ash/ambient/test/ambient_ash_test_base.cc b/ash/ambient/test/ambient_ash_test_base.cc index 07b226d..3cd026d 100644 --- a/ash/ambient/test/ambient_ash_test_base.cc +++ b/ash/ambient/test/ambient_ash_test_base.cc
@@ -8,10 +8,13 @@ #include <utility> #include <vector> +#include "ash/ambient/ambient_constants.h" #include "ash/ambient/ambient_photo_controller.h" #include "ash/ambient/fake_ambient_backend_controller_impl.h" +#include "ash/ambient/ui/ambient_background_image_view.h" #include "ash/ambient/ui/ambient_container_view.h" #include "ash/ambient/ui/photo_view.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/shell.h" #include "base/callback.h" #include "base/memory/ptr_util.h" @@ -53,10 +56,19 @@ base::OnceCallback<void(const gfx::ImageSkia&)> callback) override { // Pretend to respond asynchronously. base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(callback), gfx::test::CreateImageSkia( - /*width=*/10, /*height=*/10))); + FROM_HERE, base::BindOnce(std::move(callback), + gfx::test::CreateImageSkia(width_, height_))); } + + void SetImageSize(int width, int height) { + width_ = width; + height_ = height; + } + + private: + // Width and height of test images. + int width_ = 10; + int height_ = 20; }; AmbientAshTestBase::AmbientAshTestBase() @@ -126,10 +138,23 @@ base::RunLoop().RunUntilIdle(); } -const gfx::ImageSkia& AmbientAshTestBase::GetImageInPhotoView() { - return container_view() - ->photo_view_for_testing() - ->GetCurrentImagesForTesting(); +void AmbientAshTestBase::SetPhotoViewImageSize(int width, int height) { + auto* image_decoder = static_cast<TestAmbientImageDecoderImpl*>( + ambient_controller() + ->get_ambient_photo_controller_for_testing() + ->get_image_decoder_for_testing()); + + image_decoder->SetImageSize(width, height); +} + +AmbientBackgroundImageView* +AmbientAshTestBase::GetAmbientBackgroundImageView() { + return static_cast<AmbientBackgroundImageView*>(container_view()->GetViewByID( + AssistantViewID::kAmbientBackgroundImageView)); +} + +void AmbientAshTestBase::FastForwardToNextImage() { + task_environment()->FastForwardBy(1.2 * kPhotoRefreshInterval); } int AmbientAshTestBase::GetNumOfActiveWakeLocks(
diff --git a/ash/ambient/test/ambient_ash_test_base.h b/ash/ambient/test/ambient_ash_test_base.h index 64abfdd6..bfaa676 100644 --- a/ash/ambient/test/ambient_ash_test_base.h +++ b/ash/ambient/test/ambient_ash_test_base.h
@@ -9,6 +9,7 @@ #include <string> #include "ash/ambient/ambient_controller.h" +#include "ash/ambient/ui/ambient_background_image_view.h" #include "ash/public/cpp/test/test_ambient_client.h" #include "ash/public/cpp/test/test_image_downloader.h" #include "ash/test/ash_test_base.h" @@ -16,10 +17,6 @@ #include "services/device/public/cpp/test/test_wake_lock_provider.h" #include "ui/views/widget/widget.h" -namespace gfx { -class ImageSkia; -} // namespace gfx - namespace ash { class AmbientContainerView; @@ -60,7 +57,11 @@ // Wait until the event has been processed. void SimulateSystemResumeAndWait(); - const gfx::ImageSkia& GetImageInPhotoView(); + // Set the size of the next image that will be loaded. + void SetPhotoViewImageSize(int width, int height); + + // Advance the task environment timer to load the next photo. + void FastForwardToNextImage(); // Returns the number of active wake locks of type |type|. int GetNumOfActiveWakeLocks(device::mojom::WakeLockType type); @@ -71,6 +72,8 @@ bool IsAccessTokenRequestPending() const; + AmbientBackgroundImageView* GetAmbientBackgroundImageView(); + AmbientController* ambient_controller(); AmbientPhotoController* photo_controller();
diff --git a/ash/ambient/ui/ambient_assistant_container_view.cc b/ash/ambient/ui/ambient_assistant_container_view.cc index 1956318..d430d6d 100644 --- a/ash/ambient/ui/ambient_assistant_container_view.cc +++ b/ash/ambient/ui/ambient_assistant_container_view.cc
@@ -13,6 +13,7 @@ #include "ash/assistant/model/assistant_ui_model.h" #include "ash/assistant/ui/assistant_ui_constants.h" #include "ash/assistant/ui/assistant_view_delegate.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/assistant/util/assistant_util.h" #include "ash/public/cpp/assistant/controller/assistant_ui_controller.h" #include "ash/session/session_controller_impl.h" @@ -45,6 +46,7 @@ AmbientAssistantContainerView::AmbientAssistantContainerView() : delegate_(Shell::Get()->assistant_controller()->view_delegate()) { DCHECK(delegate_); + SetID(AssistantViewID::kAmbientAssistantContainerView); InitLayout(); assistant_controller_observer_.Add(AssistantController::Get());
diff --git a/ash/ambient/ui/ambient_assistant_dialog_plate.cc b/ash/ambient/ui/ambient_assistant_dialog_plate.cc index 1832a9f..667e7174 100644 --- a/ash/ambient/ui/ambient_assistant_dialog_plate.cc +++ b/ash/ambient/ui/ambient_assistant_dialog_plate.cc
@@ -9,6 +9,7 @@ #include "ash/assistant/model/assistant_interaction_model.h" #include "ash/assistant/model/assistant_ui_model.h" #include "ash/assistant/ui/assistant_view_delegate.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/assistant/ui/dialog_plate/mic_view.h" #include "ash/assistant/ui/main_stage/assistant_query_view.h" #include "ash/public/cpp/assistant/controller/assistant_interaction_controller.h" @@ -21,6 +22,7 @@ AmbientAssistantDialogPlate::AmbientAssistantDialogPlate( AssistantViewDelegate* delegate) : delegate_(delegate) { + SetID(AssistantViewID::kAmbientAssistantDialogPlate); InitLayout(); assistant_controller_observer_.Add(AssistantController::Get());
diff --git a/ash/ambient/ui/ambient_background_image_view.cc b/ash/ambient/ui/ambient_background_image_view.cc new file mode 100644 index 0000000..d954b92 --- /dev/null +++ b/ash/ambient/ui/ambient_background_image_view.cc
@@ -0,0 +1,41 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/ambient/ui/ambient_background_image_view.h" + +#include "ash/assistant/ui/assistant_view_ids.h" +#include "ui/events/event.h" +#include "ui/views/controls/image_view.h" +#include "ui/views/metadata/metadata_impl_macros.h" + +namespace ash { + +AmbientBackgroundImageView::AmbientBackgroundImageView( + AmbientViewDelegate* delegate) + : delegate_(delegate) { + DCHECK(delegate_); + SetID(AssistantViewID::kAmbientBackgroundImageView); +} + +AmbientBackgroundImageView::~AmbientBackgroundImageView() = default; + +// views::View: +bool AmbientBackgroundImageView::OnMousePressed(const ui::MouseEvent& event) { + delegate_->OnBackgroundPhotoEvents(); + return true; +} + +// views::View: +void AmbientBackgroundImageView::OnGestureEvent(ui::GestureEvent* event) { + if (event->type() == ui::ET_GESTURE_TAP) { + delegate_->OnBackgroundPhotoEvents(); + event->SetHandled(); + } +} + +BEGIN_METADATA(AmbientBackgroundImageView) +METADATA_PARENT_CLASS(views::ImageView) +END_METADATA() + +} // namespace ash
diff --git a/ash/ambient/ui/ambient_background_image_view.h b/ash/ambient/ui/ambient_background_image_view.h new file mode 100644 index 0000000..6b7cfc9 --- /dev/null +++ b/ash/ambient/ui/ambient_background_image_view.h
@@ -0,0 +1,38 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_AMBIENT_UI_AMBIENT_BACKGROUND_IMAGE_VIEW_H_ +#define ASH_AMBIENT_UI_AMBIENT_BACKGROUND_IMAGE_VIEW_H_ + +#include "ash/ambient/ui/ambient_view_delegate.h" +#include "ash/ash_export.h" +#include "ui/views/controls/image_view.h" +#include "ui/views/metadata/metadata_header_macros.h" +#include "ui/views/view.h" + +namespace ash { + +// AmbientBackgroundImageView-------------------------------------------------- +// A custom ImageView for ambient mode to handle specific mouse/gesture events +// when the user interacts with the background photos. +class ASH_EXPORT AmbientBackgroundImageView : public views::ImageView { + public: + METADATA_HEADER(AmbientBackgroundImageView); + + explicit AmbientBackgroundImageView(AmbientViewDelegate* delegate); + AmbientBackgroundImageView(const AmbientBackgroundImageView&) = delete; + AmbientBackgroundImageView& operator=(AmbientBackgroundImageView&) = delete; + ~AmbientBackgroundImageView() override; + + // views::View + bool OnMousePressed(const ui::MouseEvent& event) override; + void OnGestureEvent(ui::GestureEvent* event) override; + + private: + // Owned by |AmbientController| and should always outlive |this|. + AmbientViewDelegate* delegate_ = nullptr; +}; +} // namespace ash + +#endif // ASH_AMBIENT_UI_AMBIENT_BACKGROUND_IMAGE_VIEW_H_
diff --git a/ash/ambient/ui/ambient_container_view.cc b/ash/ambient/ui/ambient_container_view.cc index a0964be0..525a79a 100644 --- a/ash/ambient/ui/ambient_container_view.cc +++ b/ash/ambient/ui/ambient_container_view.cc
@@ -12,6 +12,7 @@ #include "ash/ambient/ui/glanceable_info_view.h" #include "ash/ambient/ui/photo_view.h" #include "ash/ambient/util/ambient_util.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/assistant/util/animation_util.h" #include "ash/login/ui/lock_screen.h" #include "ash/public/cpp/ambient/ambient_ui_model.h" @@ -110,6 +111,7 @@ AmbientContainerView::AmbientContainerView(AmbientViewDelegate* delegate) : delegate_(delegate) { + SetID(AssistantViewID::kAmbientContainerView); Init(); }
diff --git a/ash/ambient/ui/ambient_container_view.h b/ash/ambient/ui/ambient_container_view.h index 9807c18..78f815e 100644 --- a/ash/ambient/ui/ambient_container_view.h +++ b/ash/ambient/ui/ambient_container_view.h
@@ -45,8 +45,6 @@ // Invoked on specific types of events. void HandleEvent(); - PhotoView* photo_view_for_testing() { return photo_view_; } - AmbientViewDelegate* delegate_ = nullptr; // Owned by view hierarchy.
diff --git a/ash/ambient/ui/assistant_response_container_view.cc b/ash/ambient/ui/assistant_response_container_view.cc index 829388f..020e198 100644 --- a/ash/ambient/ui/assistant_response_container_view.cc +++ b/ash/ambient/ui/assistant_response_container_view.cc
@@ -9,6 +9,7 @@ #include "ash/assistant/model/ui/assistant_text_element.h" #include "ash/assistant/model/ui/assistant_ui_element.h" #include "ash/assistant/ui/assistant_view_delegate.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/assistant/ui/main_stage/assistant_text_element_view.h" #include "ash/assistant/ui/main_stage/element_animator.h" #include "ui/views/layout/box_layout.h" @@ -25,6 +26,7 @@ AssistantResponseContainerView::AssistantResponseContainerView( AssistantViewDelegate* delegate) : AnimatedContainerView(delegate) { + SetID(AssistantViewID::kAmbientAssistantResponseContainerView); InitLayout(); }
diff --git a/ash/ambient/ui/glanceable_info_view.cc b/ash/ambient/ui/glanceable_info_view.cc index 4b6dad9..c93a61c 100644 --- a/ash/ambient/ui/glanceable_info_view.cc +++ b/ash/ambient/ui/glanceable_info_view.cc
@@ -10,6 +10,7 @@ #include "ash/ambient/model/ambient_backend_model.h" #include "ash/ambient/ui/ambient_view_delegate.h" #include "ash/ambient/util/ambient_util.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/model/clock_model.h" @@ -72,6 +73,7 @@ GlanceableInfoView::GlanceableInfoView(AmbientViewDelegate* delegate) : delegate_(delegate) { DCHECK(delegate); + SetID(AssistantViewID::kAmbientGlanceableInfoView); delegate_->GetAmbientBackendModel()->AddObserver(this); InitLayout();
diff --git a/ash/ambient/ui/photo_view.cc b/ash/ambient/ui/photo_view.cc index 1433a5e..37bb6217 100644 --- a/ash/ambient/ui/photo_view.cc +++ b/ash/ambient/ui/photo_view.cc
@@ -9,7 +9,9 @@ #include "ash/ambient/ambient_constants.h" #include "ash/ambient/model/ambient_backend_model.h" +#include "ash/ambient/ui/ambient_background_image_view.h" #include "ash/ambient/ui/ambient_view_delegate.h" +#include "ash/assistant/ui/assistant_view_ids.h" #include "base/metrics/histogram_macros.h" #include "ui/aura/window.h" #include "ui/compositor/animation_metrics_reporter.h" @@ -55,47 +57,13 @@ } // namespace -// AmbientBackgroundImageView-------------------------------------------------- -// A custom ImageView for ambient mode to handle specific mouse/gesture events -// when user interacting with the background photos. -class AmbientBackgroundImageView : public views::ImageView { - public: - explicit AmbientBackgroundImageView(AmbientViewDelegate* delegate) - : delegate_(delegate) { - DCHECK(delegate_); - } - AmbientBackgroundImageView(const AmbientBackgroundImageView&) = delete; - AmbientBackgroundImageView& operator=(AmbientBackgroundImageView&) = delete; - ~AmbientBackgroundImageView() override = default; - - // views::View: - const char* GetClassName() const override { - return "AmbientBackgroundImageView"; - } - - bool OnMousePressed(const ui::MouseEvent& event) override { - delegate_->OnBackgroundPhotoEvents(); - return true; - } - - void OnGestureEvent(ui::GestureEvent* event) override { - if (event->type() == ui::ET_GESTURE_TAP) { - delegate_->OnBackgroundPhotoEvents(); - event->SetHandled(); - } - } - - private: - // Owned by |AmbientController| and should always outlive |this|. - AmbientViewDelegate* delegate_ = nullptr; -}; - // PhotoView ------------------------------------------------------------------ PhotoView::PhotoView(AmbientViewDelegate* delegate) : delegate_(delegate), metrics_reporter_(std::make_unique<ui::HistogramPercentageMetricsReporter< kPhotoTransitionSmoothness>>()) { DCHECK(delegate_); + SetID(AssistantViewID::kAmbientPhotoView); Init(); }
diff --git a/ash/ambient/ui/photo_view.h b/ash/ambient/ui/photo_view.h index 0e98e67e1..bb00b54e0 100644 --- a/ash/ambient/ui/photo_view.h +++ b/ash/ambient/ui/photo_view.h
@@ -8,6 +8,7 @@ #include <memory> #include "ash/ambient/model/ambient_backend_model_observer.h" +#include "ash/ambient/ui/ambient_background_image_view.h" #include "ash/ash_export.h" #include "base/macros.h" #include "ui/compositor/layer_animation_observer.h"
diff --git a/ash/ambient/ui/photo_view_unittest.cc b/ash/ambient/ui/photo_view_unittest.cc index 364c58d..fbd96a8 100644 --- a/ash/ambient/ui/photo_view_unittest.cc +++ b/ash/ambient/ui/photo_view_unittest.cc
@@ -7,46 +7,94 @@ #include "ash/ambient/ambient_constants.h" #include "ash/ambient/ambient_controller.h" #include "ash/ambient/test/ambient_ash_test_base.h" +#include "ash/ambient/ui/ambient_container_view.h" +#include "ash/assistant/ui/assistant_view_ids.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/views/controls/image_view.h" namespace ash { using AmbientPhotoViewTest = AmbientAshTestBase; -// TODO(b/158617675): test is flaky. -// Test that image is scaled to fill full screen when image and display are in -// the same orientation. -TEST_F(AmbientPhotoViewTest, DISABLED_ShouldResizeImageToFillFullScreen) { - // Start Ambient mode. - ShowAmbientScreen(); - // Fastforward enough time to update the photo. - task_environment()->FastForwardBy(1.2 * kPhotoRefreshInterval); +// Test that image is scaled to fill screen width when image is portrait and +// screen is portrait. The top and bottom of the image will be cut off, as +// the height of the image is taller than the height of the screen. +TEST_F(AmbientPhotoViewTest, ShouldResizePortraitImageForPortraitScreen) { + SetPhotoViewImageSize(/*width=*/10, /*height=*/20); UpdateDisplay("600x800"); - const auto& image = GetImageInPhotoView(); - // Test image size in test is "10x20". Scaled image should fill the full - // screen. - // The expected size is "600x1200". - EXPECT_EQ(image.size().width(), 600); - EXPECT_EQ(image.size().height(), 1200); + + ShowAmbientScreen(); + + FastForwardToNextImage(); + + auto* image_view = GetAmbientBackgroundImageView(); + + // Image should be full width. Image height should extend above and below the + // visible part of the screen. + ASSERT_EQ(image_view->GetImageBounds(), + gfx::Rect(/*x=*/0, /*y=*/-200, /*width=*/600, /*height=*/1200)); } -// TODO(b/158617675): test is flaky. -// Test that image is scaled to fill one direction of the screen when image and -// display are in different orientations. -TEST_F(AmbientPhotoViewTest, - DISABLED_ShouldResizeImageToFillOneDirectionOfScreen) { - // Start Ambient mode. +// Test that image is scaled to fill screen width when the image is landscape +// and the screen is portrait. There will be black bars to the top and bottom of +// the image, as the height of the image is less than the height of the screen. +TEST_F(AmbientPhotoViewTest, ShouldResizeLandscapeImageForPortraitScreen) { + SetPhotoViewImageSize(/*width=*/30, /*height=*/20); + + UpdateDisplay("600x800"); + ShowAmbientScreen(); - // Fastforward enough time to update the photo. - task_environment()->FastForwardBy(1.2 * kPhotoRefreshInterval); + + FastForwardToNextImage(); + + auto* image_view = GetAmbientBackgroundImageView(); + + // Image should be full width. Image should have equal empty space top and + // bottom. + ASSERT_EQ(image_view->GetImageBounds(), + gfx::Rect(/*x=*/0, /*y=*/200, /*width=*/600, /*height=*/400)); +} + +// Test that image is scaled to fill screen height when the image is portrait +// and screen is landscape. There will be black bars to the left and right of +// the image, as the width of the image is less than the width of the screen. +TEST_F(AmbientPhotoViewTest, ShouldResizePortraitImageForLandscapeScreen) { + SetPhotoViewImageSize(/*width=*/10, /*height=*/20); UpdateDisplay("800x600"); - const auto& image = GetImageInPhotoView(); - // Test image size in test is "10x20". Scaled image should fill one direction - // of the screen. - // The expected size is "300x600". - EXPECT_EQ(image.size().width(), 300); - EXPECT_EQ(image.size().height(), 600); + + ShowAmbientScreen(); + + FastForwardToNextImage(); + + auto* image_view = GetAmbientBackgroundImageView(); + + // Image should be full height. Image width should have equal empty space on + // left and right. + ASSERT_EQ(image_view->GetImageBounds(), + gfx::Rect(/*x=*/250, /*y=*/0, /*width=*/300, /*height=*/600)); +} + +// Test that image is scaled to fill screen height when the image is landscape +// and the screen is landscape. The image will be zoomed in and the left and +// right will be cut off, as the width of the image is greater than the width of +// the screen. +TEST_F(AmbientPhotoViewTest, ShouldResizeLandscapeImageForFillLandscapeScreen) { + SetPhotoViewImageSize(/*width=*/30, /*height=*/20); + + UpdateDisplay("800x600"); + + ShowAmbientScreen(); + + FastForwardToNextImage(); + + auto* image_view = GetAmbientBackgroundImageView(); + + // Image should be full height. Image width should extend equally to the left + // and right of the visible part of the screen. + ASSERT_EQ(image_view->GetImageBounds(), + gfx::Rect(/*x=*/-50, /*y=*/0, /*width=*/900, /*height=*/600)); } } // namespace ash
diff --git a/ash/app_list/views/app_list_item_view.cc b/ash/app_list/views/app_list_item_view.cc index 3fbe934c..335f8811 100644 --- a/ash/app_list/views/app_list_item_view.cc +++ b/ash/app_list/views/app_list_item_view.cc
@@ -783,7 +783,7 @@ } break; case ui::ET_GESTURE_TAP_DOWN: - if (state() != STATE_DISABLED) { + if (GetState() != STATE_DISABLED) { SetState(STATE_PRESSED); touch_drag_timer_.Start( FROM_HERE, @@ -796,7 +796,7 @@ break; case ui::ET_GESTURE_TAP: case ui::ET_GESTURE_TAP_CANCEL: - if (state() != STATE_DISABLED) { + if (GetState() != STATE_DISABLED) { touch_drag_timer_.Stop(); SetState(STATE_NORMAL); }
diff --git a/ash/assistant/assistant_controller_impl.cc b/ash/assistant/assistant_controller_impl.cc index 61f5821..c694604 100644 --- a/ash/assistant/assistant_controller_impl.cc +++ b/ash/assistant/assistant_controller_impl.cc
@@ -204,6 +204,10 @@ case DeepLinkType::kFeedback: NewWindowDelegate::GetInstance()->OpenFeedbackPage( /*from_assistant=*/true); + + // Close the assistant UI so that the feedback page is visible. + assistant_ui_controller_.CloseUi( + chromeos::assistant::AssistantExitPoint::kUnspecified); break; case DeepLinkType::kScreenshot: // We close the UI before taking the screenshot as it's probably not the
diff --git a/ash/assistant/assistant_controller_impl_unittest.cc b/ash/assistant/assistant_controller_impl_unittest.cc index 281675b..9f4f277 100644 --- a/ash/assistant/assistant_controller_impl_unittest.cc +++ b/ash/assistant/assistant_controller_impl_unittest.cc
@@ -50,6 +50,20 @@ (override)); }; +class MockAssistantUiModelObserver : public AssistantUiModelObserver { + public: + MockAssistantUiModelObserver() = default; + ~MockAssistantUiModelObserver() override = default; + + MOCK_METHOD(void, + OnUiVisibilityChanged, + (AssistantVisibility new_visibility, + AssistantVisibility old_visibility, + base::Optional<AssistantEntryPoint> entry_point, + base::Optional<AssistantExitPoint> exit_point), + (override)); +}; + // MockNewWindowDelegate ------------------------------------------------------- class MockNewWindowDelegate : public testing::NiceMock<TestNewWindowDelegate> { @@ -59,6 +73,8 @@ NewTabWithUrl, (const GURL& url, bool from_user_interaction), (override)); + + MOCK_METHOD(void, OpenFeedbackPage, (bool from_assistant), (override)); }; // AssistantControllerImplTest ------------------------------------------------- @@ -67,6 +83,9 @@ public: AssistantController* controller() { return AssistantController::Get(); } MockNewWindowDelegate& new_window_delegate() { return new_window_delegate_; } + const AssistantUiModel* ui_model() { + return AssistantUiController::Get()->GetModel(); + } private: MockNewWindowDelegate new_window_delegate_; @@ -78,11 +97,12 @@ // Tests that AssistantController observers are notified of deep link received. TEST_F(AssistantControllerImplTest, NotifiesDeepLinkReceived) { - testing::NiceMock<MockAssistantControllerObserver> mock; - ScopedObserver<AssistantController, AssistantControllerObserver> obs{&mock}; - obs.Add(controller()); + testing::NiceMock<MockAssistantControllerObserver> controller_observer_mock; + ScopedObserver<AssistantController, AssistantControllerObserver> + scoped_controller_obs{&controller_observer_mock}; + scoped_controller_obs.Add(controller()); - EXPECT_CALL(mock, OnDeepLinkReceived) + EXPECT_CALL(controller_observer_mock, OnDeepLinkReceived) .WillOnce( testing::Invoke([](assistant::util::DeepLinkType type, const std::map<std::string, std::string>& params) { @@ -101,14 +121,15 @@ // having been opened. Note that it is important that these events be notified // before and after the URL is actually opened respectively. TEST_F(AssistantControllerImplTest, NotifiesOpeningUrlAndUrlOpened) { - testing::NiceMock<MockAssistantControllerObserver> mock; - ScopedObserver<AssistantController, AssistantControllerObserver> obs{&mock}; - obs.Add(controller()); + testing::NiceMock<MockAssistantControllerObserver> controller_observer_mock; + ScopedObserver<AssistantController, AssistantControllerObserver> + scoped_controller_obs{&controller_observer_mock}; + scoped_controller_obs.Add(controller()); // Enforce ordering of events. testing::InSequence sequence; - EXPECT_CALL(mock, OnOpeningUrl) + EXPECT_CALL(controller_observer_mock, OnOpeningUrl) .WillOnce(testing::Invoke( [](const GURL& url, bool in_background, bool from_server) { EXPECT_EQ(GURL("https://g.co/"), url); @@ -122,7 +143,7 @@ EXPECT_TRUE(from_user_interaction); }); - EXPECT_CALL(mock, OnUrlOpened) + EXPECT_CALL(controller_observer_mock, OnUrlOpened) .WillOnce(testing::Invoke([](const GURL& url, bool from_server) { EXPECT_EQ(GURL("https://g.co/"), url); EXPECT_TRUE(from_server); @@ -132,4 +153,49 @@ /*from_server=*/true); } +TEST_F(AssistantControllerImplTest, OpensFeedbackPageForFeedbackDeeplink) { + testing::NiceMock<MockAssistantControllerObserver> controller_observer_mock; + ScopedObserver<AssistantController, AssistantControllerObserver> + scoped_controller_obs{&controller_observer_mock}; + scoped_controller_obs.Add(controller()); + + EXPECT_CALL(controller_observer_mock, OnDeepLinkReceived) + .WillOnce( + testing::Invoke([](assistant::util::DeepLinkType type, + const std::map<std::string, std::string>& params) { + EXPECT_EQ(assistant::util::DeepLinkType::kFeedback, type); + std::map<std::string, std::string> expected_params; + EXPECT_EQ(params, expected_params); + })); + + EXPECT_CALL(new_window_delegate(), OpenFeedbackPage) + .WillOnce([](bool from_assistant) { EXPECT_TRUE(from_assistant); }); + + controller()->OpenUrl(GURL("googleassistant://send-feedback"), + /*in_background=*/false, /*from_server=*/true); +} + +TEST_F(AssistantControllerImplTest, ClosesAssistantUiForFeedbackDeeplink) { + ShowAssistantUi(); + + testing::NiceMock<MockAssistantUiModelObserver> ui_model_observer_mock; + ui_model()->AddObserver(&ui_model_observer_mock); + + EXPECT_CALL(ui_model_observer_mock, OnUiVisibilityChanged) + .WillOnce([](AssistantVisibility new_visibility, + AssistantVisibility old_visibility, + base::Optional<AssistantEntryPoint> entry_point, + base::Optional<AssistantExitPoint> exit_point) { + EXPECT_EQ(old_visibility, AssistantVisibility::kVisible); + EXPECT_EQ(new_visibility, AssistantVisibility::kClosed); + EXPECT_FALSE(entry_point.has_value()); + EXPECT_EQ(exit_point.value(), AssistantExitPoint::kUnspecified); + }); + + controller()->OpenUrl(GURL("googleassistant://send-feedback"), + /*in_background=*/false, /*from_server=*/true); + + ui_model()->RemoveObserver(&ui_model_observer_mock); +} + } // namespace ash
diff --git a/ash/assistant/ui/assistant_view_ids.h b/ash/assistant/ui/assistant_view_ids.h index 1c11d86..9f1fab4 100644 --- a/ash/assistant/ui/assistant_view_ids.h +++ b/ash/assistant/ui/assistant_view_ids.h
@@ -34,6 +34,15 @@ kUiElementContainer, kZeroStateView, kOnboardingView, + + // Ambient mode and its components. + kAmbientContainerView, + kAmbientAssistantContainerView, + kAmbientAssistantResponseContainerView, + kAmbientPhotoView, + kAmbientBackgroundImageView, + kAmbientGlanceableInfoView, + kAmbientAssistantDialogPlate, }; } // namespace ash
diff --git a/ash/frame/caption_buttons/frame_size_button_unittest.cc b/ash/frame/caption_buttons/frame_size_button_unittest.cc index c18fe58..93daaee2 100644 --- a/ash/frame/caption_buttons/frame_size_button_unittest.cc +++ b/ash/frame/caption_buttons/frame_size_button_unittest.cc
@@ -97,9 +97,9 @@ // Returns true if all three buttons are in the normal state. bool AllButtonsInNormalState() const { - return minimize_button_->state() == views::Button::STATE_NORMAL && - size_button_->state() == views::Button::STATE_NORMAL && - close_button_->state() == views::Button::STATE_NORMAL; + return minimize_button_->GetState() == views::Button::STATE_NORMAL && + size_button_->GetState() == views::Button::STATE_NORMAL && + close_button_->GetState() == views::Button::STATE_NORMAL; } // Creates a widget with |delegate|. The returned widget takes ownership of @@ -160,17 +160,17 @@ ui::test::EventGenerator* generator = GetEventGenerator(); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); generator->ReleaseLeftButton(); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->GetState()); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressTouchId(3); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); generator->ReleaseTouchId(3); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->GetState()); } // Tests that clicking on the size button toggles between the maximized and @@ -287,7 +287,7 @@ // Test that during the waiting to snap mode, if the window's state is changed, // or the window is put in overview, we should cancel the waiting to snap mode. TEST_F(FrameSizeButtonTest, CancelSnapTest) { - EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->GetState()); // Press on the size button and drag toward to close buton to enter waiting- // for-snap mode. @@ -295,12 +295,12 @@ generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); generator->MoveMouseTo(CenterPointInScreen(close_button())); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); EXPECT_TRUE( static_cast<FrameSizeButton*>(size_button())->in_snap_mode_for_testing()); // Maximize the window. window_state()->Maximize(); - EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->GetState()); EXPECT_FALSE( static_cast<FrameSizeButton*>(size_button())->in_snap_mode_for_testing()); generator->ReleaseLeftButton(); @@ -309,11 +309,11 @@ generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); generator->MoveMouseTo(CenterPointInScreen(close_button())); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); EXPECT_TRUE( static_cast<FrameSizeButton*>(size_button())->in_snap_mode_for_testing()); window_state()->window()->SetProperty(kIsShowingInOverviewKey, true); - EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, size_button()->GetState()); EXPECT_FALSE( static_cast<FrameSizeButton*>(size_button())->in_snap_mode_for_testing()); generator->ReleaseLeftButton(); @@ -333,18 +333,18 @@ ui::test::EventGenerator* generator = GetEventGenerator(); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); // Dragging the mouse over the minimize button should hover the minimize // button and the minimize and close button icons should stay changed. generator->MoveMouseTo(CenterPointInScreen(minimize_button())); - EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); @@ -363,9 +363,9 @@ // because the code path is different. generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); @@ -404,18 +404,18 @@ ui::test::EventGenerator* generator = GetEventGenerator(); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); // Dragging the mouse over the minimize button (snap left button) should hover // the minimize button and keep the size button pressed. generator->MoveMouseTo(CenterPointInScreen(minimize_button())); - EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); // Moving the mouse far away from the caption buttons and then moving it over // the close button (snap right button) should hover the close button and @@ -425,9 +425,9 @@ generator->MoveMouseTo(work_area_bounds_in_screen.bottom_left()); EXPECT_TRUE(AllButtonsInNormalState()); generator->MoveMouseTo(CenterPointInScreen(close_button())); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->GetState()); } class FrameSizeButtonTestRTL : public FrameSizeButtonTest { @@ -474,18 +474,18 @@ ui::test::EventGenerator* generator = GetEventGenerator(); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_LEFT_SNAPPED, close_button()->icon()); // Dragging over to the minimize button should press it. generator->MoveMouseTo(CenterPointInScreen(minimize_button())); - EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); // Releasing should snap the window right. generator->ReleaseLeftButton(); @@ -522,9 +522,9 @@ ui::test::EventGenerator* generator = GetEventGenerator(); generator->MoveMouseTo(CenterPointInScreen(size_button())); generator->PressLeftButton(); - EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->GetState()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); EXPECT_EQ(views::CAPTION_BUTTON_ICON_CLOSE, close_button()->icon());
diff --git a/ash/login/ui/login_password_view.cc b/ash/login/ui/login_password_view.cc index 378a285..1e49114 100644 --- a/ash/login/ui/login_password_view.cc +++ b/ash/login/ui/login_password_view.cc
@@ -274,12 +274,12 @@ // Stop showing tooltip, as we most likely exited hover state. invoke_hover_.Stop(); - if (state() == ButtonState::STATE_DISABLED) + if (GetState() == ButtonState::STATE_DISABLED) return; UpdateImage(false /*changed_states*/); - if (state() == ButtonState::STATE_HOVERED) { + if (GetState() == ButtonState::STATE_HOVERED) { if (immediately_hover_for_test_) { on_hovered_.Run(); } else { @@ -318,7 +318,7 @@ int active_resource = resources.normal; if (IsMouseHovered()) active_resource = resources.hover; - if (state() == ButtonState::STATE_PRESSED) + if (GetState() == ButtonState::STATE_PRESSED) active_resource = resources.pressed; // Image to show. It may or may not be an animation, depending on
diff --git a/ash/login/ui/note_action_launch_button.cc b/ash/login/ui/note_action_launch_button.cc index e5ad50ac0..e70f44b5 100644 --- a/ash/login/ui/note_action_launch_button.cc +++ b/ash/login/ui/note_action_launch_button.cc
@@ -286,8 +286,8 @@ // Updates the background view size and opacity depending on the current note // action button state. void UpdateBubbleRadiusAndOpacity() { - bool show_large_bubble = HasFocus() || state() == STATE_HOVERED || - state() == STATE_PRESSED || + bool show_large_bubble = HasFocus() || GetState() == STATE_HOVERED || + GetState() == STATE_PRESSED || tracking_activation_gesture_; background_->SetBubbleRadiusAndOpacity( show_large_bubble ? kLargeBubbleRadiusDp : kSmallBubbleRadiusDp,
diff --git a/ash/public/cpp/caption_buttons/frame_size_button.cc b/ash/public/cpp/caption_buttons/frame_size_button.cc index f7c9106c..1d9374f 100644 --- a/ash/public/cpp/caption_buttons/frame_size_button.cc +++ b/ash/public/cpp/caption_buttons/frame_size_button.cc
@@ -35,8 +35,8 @@ bool HitTestButton(const views::FrameCaptionButton* button, const gfx::Point& location_in_screen) { gfx::Rect expanded_bounds_in_screen = button->GetBoundsInScreen(); - if (button->state() == views::Button::STATE_HOVERED || - button->state() == views::Button::STATE_PRESSED) { + if (button->GetState() == views::Button::STATE_HOVERED || + button->GetState() == views::Button::STATE_PRESSED) { expanded_bounds_in_screen.Inset(-kMaxOvershootX, -kMaxOvershootY); } return expanded_bounds_in_screen.Contains(location_in_screen);
diff --git a/ash/quick_answers/ui/quick_answers_view.cc b/ash/quick_answers/ui/quick_answers_view.cc index 39056a0..5017376 100644 --- a/ash/quick_answers/ui/quick_answers_view.cc +++ b/ash/quick_answers/ui/quick_answers_view.cc
@@ -216,8 +216,8 @@ void QuickAnswersView::StateChanged(views::Button::ButtonState old_state) { Button::StateChanged(old_state); - const bool hovered = state() == Button::STATE_HOVERED; - if (hovered || (state() == Button::STATE_NORMAL)) + const bool hovered = GetState() == Button::STATE_HOVERED; + if (hovered || (GetState() == Button::STATE_NORMAL)) SetBackgroundState(hovered); }
diff --git a/ash/shelf/home_to_overview_nudge_controller.cc b/ash/shelf/home_to_overview_nudge_controller.cc index ac59226..a4eff9f 100644 --- a/ash/shelf/home_to_overview_nudge_controller.cc +++ b/ash/shelf/home_to_overview_nudge_controller.cc
@@ -119,6 +119,25 @@ views::Widget* const widget_; }; +void RecordNudgeMetrics( + HomeToOverviewNudgeController::HideTransition transition) { + switch (transition) { + case (HomeToOverviewNudgeController::HideTransition::kUserTap): + LogNudgeDismissedMetrics(contextual_tooltip::TooltipType::kHomeToOverview, + contextual_tooltip::DismissNudgeReason::kTap); + break; + case (HomeToOverviewNudgeController::HideTransition::kNudgeTimeout): + LogNudgeDismissedMetrics( + contextual_tooltip::TooltipType::kHomeToOverview, + contextual_tooltip::DismissNudgeReason::kTimeout); + break; + case (HomeToOverviewNudgeController::HideTransition::kShelfStateChange): + LogNudgeDismissedMetrics(contextual_tooltip::TooltipType::kHomeToOverview, + contextual_tooltip::DismissNudgeReason::kOther); + break; + } +} + } // namespace HomeToOverviewNudgeController::HomeToOverviewNudgeController( @@ -306,6 +325,8 @@ if (!nudge_) return; + RecordNudgeMetrics(transition); + auto animate_hide_transform = [](HideTransition transition, ui::Layer* layer) { ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
diff --git a/ash/shelf/home_to_overview_nudge_controller_unittest.cc b/ash/shelf/home_to_overview_nudge_controller_unittest.cc index e0c2435..ff8be7d 100644 --- a/ash/shelf/home_to_overview_nudge_controller_unittest.cc +++ b/ash/shelf/home_to_overview_nudge_controller_unittest.cc
@@ -20,6 +20,7 @@ #include "ash/wm/overview/overview_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h" #include "ash/wm/window_state.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/simple_test_clock.h" #include "ui/compositor/layer.h" @@ -226,6 +227,7 @@ // first time, nudge should remain visible until the hotseat state changes. On // subsequent shows, the nudge should be hidden after a timeout. TEST_F(HomeToOverviewNudgeControllerTest, ShownOnHomeScreen) { + base::HistogramTester histogram_tester; CreateUserSessions(1); // The nudge should not be shown in clamshell. @@ -291,6 +293,9 @@ GetNudgeController()->FireHideTimerForTesting(); EXPECT_FALSE(GetNudgeController()->nudge_for_testing()); EXPECT_EQ(gfx::Transform(), GetHotseatWidget()->GetLayer()->transform()); + histogram_tester.ExpectBucketCount( + "Ash.ContextualNudgeDismissContext.HomeToOverview", + contextual_tooltip::DismissNudgeReason::kTimeout, 1); } // Tests that the nudge eventually stops showing. @@ -325,6 +330,7 @@ // Tests that the nudge is hidden when tablet mode exits. TEST_F(HomeToOverviewNudgeControllerTest, HiddenOnTabletModeExit) { + base::HistogramTester histogram_tester; TabletModeControllerTestApi().EnterTabletMode(); CreateUserSessions(1); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); @@ -338,6 +344,10 @@ EXPECT_FALSE(GetNudgeController()->nudge_for_testing()); EXPECT_EQ(gfx::Transform(), GetHotseatWidget()->GetLayer()->GetTargetTransform()); + + histogram_tester.ExpectBucketCount( + "Ash.ContextualNudgeDismissContext.HomeToOverview", + contextual_tooltip::DismissNudgeReason::kOther, 1); } // Tests that the nudge show is canceled when tablet mode exits. @@ -502,6 +512,7 @@ // Tests that tapping on the nudge hides the nudge. TEST_F(HomeToOverviewNudgeControllerTest, TapOnTheNudgeClosesTheNudge) { + base::HistogramTester histogram_tester; TabletModeControllerTestApi().EnterTabletMode(); CreateUserSessions(1); ScopedWindowList windows = CreateAndMinimizeWindows(2); @@ -523,6 +534,10 @@ EXPECT_EQ(gfx::Transform(), GetHotseatWidget()->GetLayer()->GetTargetTransform()); + + histogram_tester.ExpectBucketCount( + "Ash.ContextualNudgeDismissContext.HomeToOverview", + contextual_tooltip::DismissNudgeReason::kTap, 1); } TEST_F(HomeToOverviewNudgeControllerTest, TapOnTheNudgeDuringShowAnimation) { @@ -622,7 +637,7 @@ transition_timer->FireNow(); })); - // No point oof continuing the test if transition to overview failed. + // No point in continuing the test if transition to overview failed. ASSERT_TRUE(Shell::Get()->overview_controller()->InOverviewSession()); }
diff --git a/ash/shelf/scrollable_shelf_view.cc b/ash/shelf/scrollable_shelf_view.cc index fac85d9f..349310ce 100644 --- a/ash/shelf/scrollable_shelf_view.cc +++ b/ash/shelf/scrollable_shelf_view.cc
@@ -757,6 +757,10 @@ return activated_corner_buttons_ > 0; } +float ScrollableShelfView::GetScrollUpperBoundForTest() const { + return CalculateScrollUpperBound(GetSpaceForIcons()); +} + int ScrollableShelfView::GetSumOfButtonSizeAndSpacing() const { return shelf_view_->GetButtonSize() + ShelfConfig::Get()->button_spacing(); }
diff --git a/ash/shelf/scrollable_shelf_view.h b/ash/shelf/scrollable_shelf_view.h index 2b2128a..d1756a21 100644 --- a/ash/shelf/scrollable_shelf_view.h +++ b/ash/shelf/scrollable_shelf_view.h
@@ -118,6 +118,9 @@ // Returns true if any shelf corner button has ripple ring activated. bool IsAnyCornerButtonInkDropActivatedForTest() const; + // Returns the maximum scroll distance for the current layout. + float GetScrollUpperBoundForTest() const; + ShelfView* shelf_view() { return shelf_view_; } ShelfContainerView* shelf_container_view() { return shelf_container_view_; } const ShelfContainerView* shelf_container_view() const {
diff --git a/ash/shelf/scrollable_shelf_view_unittest.cc b/ash/shelf/scrollable_shelf_view_unittest.cc index 57871f3..4762bc16 100644 --- a/ash/shelf/scrollable_shelf_view_unittest.cc +++ b/ash/shelf/scrollable_shelf_view_unittest.cc
@@ -1015,8 +1015,7 @@ // Verifies that presentation time for shelf gesture scroll is recorded as // expected (https://crbug.com/1095259). -TEST_F(ScrollableShelfViewTest, - DISABLED_PresentationTimeMetricsForGestureScroll) { +TEST_F(ScrollableShelfViewTest, PresentationTimeMetricsForGestureScroll) { PresentationTimeRecorder::SetReportPresentationTimeImmediatelyForTest(true); AddAppShortcutsUntilOverflow(); @@ -1078,7 +1077,8 @@ // Scroll the shelf rightward. Verify that shelf should be scrolled to the // right end. The bucket number changes as expected. - GetEventGenerator()->MoveTouchBy(-50, 0); + GetEventGenerator()->MoveTouchBy( + -scrollable_shelf_view_->GetScrollUpperBoundForTest() - 5, 0); EXPECT_TRUE(shelf_scrolled()); ASSERT_EQ(ScrollableShelfView::kShowLeftArrowButton, scrollable_shelf_view_->layout_strategy_for_test());
diff --git a/ash/system/accessibility/tray_accessibility_unittest.cc b/ash/system/accessibility/tray_accessibility_unittest.cc index 7f0aff77..0cd883ae 100644 --- a/ash/system/accessibility/tray_accessibility_unittest.cc +++ b/ash/system/accessibility/tray_accessibility_unittest.cc
@@ -251,13 +251,14 @@ // In material design we show the help button but theme it as disabled if // it is not possible to load the help page. bool IsHelpAvailableOnDetailMenu() { - return detailed_menu_->help_view_->state() == views::Button::STATE_NORMAL; + return detailed_menu_->help_view_->GetState() == + views::Button::STATE_NORMAL; } // In material design we show the settings button but theme it as disabled if // it is not possible to load the settings page. bool IsSettingsAvailableOnDetailMenu() { - return detailed_menu_->settings_view_->state() == + return detailed_menu_->settings_view_->GetState() == views::Button::STATE_NORMAL; }
diff --git a/ash/system/tray/actionable_view.cc b/ash/system/tray/actionable_view.cc index 84665ba..3870df2 100644 --- a/ash/system/tray/actionable_view.cc +++ b/ash/system/tray/actionable_view.cc
@@ -52,7 +52,7 @@ } bool ActionableView::OnKeyPressed(const ui::KeyEvent& event) { - if (state() != STATE_DISABLED && event.key_code() == ui::VKEY_SPACE) { + if (GetState() != STATE_DISABLED && event.key_code() == ui::VKEY_SPACE) { NotifyClick(event); return true; }
diff --git a/ash/system/unified/top_shortcuts_view_unittest.cc b/ash/system/unified/top_shortcuts_view_unittest.cc index 6930d42..3e26da2 100644 --- a/ash/system/unified/top_shortcuts_view_unittest.cc +++ b/ash/system/unified/top_shortcuts_view_unittest.cc
@@ -180,13 +180,13 @@ GetSessionControllerClient()->AddUserSession( "foo@example.com", user_manager::USER_TYPE_REGULAR, enable_settings); SetUpView(); - EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->GetState()); local_state()->SetBoolean(prefs::kOsSettingsEnabled, false); - EXPECT_EQ(views::Button::STATE_DISABLED, GetSettingsButton()->state()); + EXPECT_EQ(views::Button::STATE_DISABLED, GetSettingsButton()->GetState()); local_state()->SetBoolean(prefs::kOsSettingsEnabled, true); - EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->GetState()); } } // namespace ash
diff --git a/ash/wm/desks/desks_unittests.cc b/ash/wm/desks/desks_unittests.cc index bd613b23..e40457d 100644 --- a/ash/wm/desks/desks_unittests.cc +++ b/ash/wm/desks/desks_unittests.cc
@@ -427,7 +427,7 @@ EXPECT_FALSE(controller->CanCreateDesks()); EXPECT_TRUE(controller->CanRemoveDesks()); EXPECT_FALSE(new_desk_button->GetEnabled()); - EXPECT_EQ(views::Button::STATE_DISABLED, new_desk_button->state()); + EXPECT_EQ(views::Button::STATE_DISABLED, new_desk_button->GetState()); // Hover over one of the mini_views, and expect that the close button becomes // visible. @@ -448,7 +448,7 @@ EXPECT_EQ(controller->desks().size(), desks_bar_view->mini_views().size()); EXPECT_TRUE(controller->CanCreateDesks()); EXPECT_TRUE(new_desk_button->GetEnabled()); - EXPECT_EQ(views::Button::STATE_NORMAL, new_desk_button->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, new_desk_button->GetState()); // Exit overview mode and re-enter. Since we have more than one pre-existing // desks, their mini_views should be created upon construction of the desks @@ -492,7 +492,7 @@ GestureTapOnView(new_desk_button, event_generator); EXPECT_FALSE(new_desk_button->GetEnabled()); - EXPECT_EQ(views::Button::STATE_DISABLED, new_desk_button->state()); + EXPECT_EQ(views::Button::STATE_DISABLED, new_desk_button->GetState()); } TEST_F(DesksTest, DesksBarViewScreenLayoutTest) {
diff --git a/base/android/java/src/org/chromium/base/PathUtils.java b/base/android/java/src/org/chromium/base/PathUtils.java index eb46b29..29d5154 100644 --- a/base/android/java/src/org/chromium/base/PathUtils.java +++ b/base/android/java/src/org/chromium/base/PathUtils.java
@@ -195,7 +195,7 @@ @SuppressWarnings("unused") @CalledByNative private static @NonNull String getDownloadsDirectory() { - // TODO(crbug.com/508615): Temporarily allowing disk access until more permanent fix is in. + // TODO(crbug.com/508615): Move calls to getDownloadsDirectory() to background thread. try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { if (BuildInfo.isAtLeastQ()) { // https://developer.android.com/preview/privacy/scoped-storage
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index a9389530..4ac5b0f 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc
@@ -1084,12 +1084,19 @@ CHECK_EQ(static_cast<Sample>(bucket_count), maximum - minimum + 2) << " ScaledLinearHistogram requires buckets of size 1"; + // Normally, |histogram_| should have type LINEAR_HISTOGRAM or be + // inherited from it. However, if it's expired, it will be DUMMY_HISTOGRAM. + if (histogram_->GetHistogramType() == DUMMY_HISTOGRAM) + return; + remainders_.resize(histogram_->bucket_count(), 0); } ScaledLinearHistogram::~ScaledLinearHistogram() = default; void ScaledLinearHistogram::AddScaledCount(Sample value, int count) { + if (histogram_->GetHistogramType() == DUMMY_HISTOGRAM) + return; if (count == 0) return; if (count < 0) {
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc index d7addaa..7ab3302 100644 --- a/base/metrics/histogram_unittest.cc +++ b/base/metrics/histogram_unittest.cc
@@ -872,6 +872,13 @@ samples = linear_expired->SnapshotDelta(); EXPECT_EQ(0, samples->TotalCount()); + ScaledLinearHistogram scaled_linear_expired(kExpiredHistogramName, 1, 5, 6, + 100, HistogramBase::kNoFlags); + scaled_linear_expired.AddScaledCount(0, 1); + scaled_linear_expired.AddScaledCount(1, 49); + samples = scaled_linear_expired.histogram()->SnapshotDelta(); + EXPECT_EQ(0, samples->TotalCount()); + std::vector<int> custom_ranges; custom_ranges.push_back(1); custom_ranges.push_back(5);
diff --git a/build/android/gyp/compile_java.py b/build/android/gyp/compile_java.py index 2c93451b..5c695d2 100755 --- a/build/android/gyp/compile_java.py +++ b/build/android/gyp/compile_java.py
@@ -469,15 +469,21 @@ input_srcjars_dir) logging.info('Done extracting srcjars') - if options.header_jar: + if classpath or options.header_jar: logging.info('Extracting transitive classes to %s', transitive_classes) - # Without the META-INF pattern prefix, it takes more than 4 seconds to - # extract all the .class files from chrome_java's header jar. With the - # prefix it takes 0.6 seconds. - build_utils.ExtractAll(options.header_jar, - no_clobber=True, - path=transitive_classes, - pattern='META-INF*.class') + # All classes under META-INF/TRANSITIVE of all direct dependencies and the + # current target's META-INF/TRANSITIVE can be required during compile. + for path in classpath + [options.header_jar]: + if path.endswith('.turbine.jar'): + # Without the META-INF pattern prefix, it takes more than 4 seconds to + # extract all the .class files from chrome_java's header jar. With the + # prefix it takes less than 0.6 seconds. + # Set no_clobber=False since there are some overlaps in base classes + # from various header jars. + build_utils.ExtractAll(path, + no_clobber=False, + path=transitive_classes, + pattern='META-INF*.class') # Specifying the root directory is required, see: # https://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html#userclass classpath.append(
diff --git a/build/android/pylib/local/emulator/avd.py b/build/android/pylib/local/emulator/avd.py index 5a8cc13..168fbdd3 100644 --- a/build/android/pylib/local/emulator/avd.py +++ b/build/android/pylib/local/emulator/avd.py
@@ -524,6 +524,8 @@ '-report-console', 'unix:%s' % socket_path, '-no-boot-anim', + # crbug.com/1093602: Disable GLDMA to see if it can fix timeout issue + '-feature', '-GLDMA', ] if read_only:
diff --git a/build/android/pylib/local/emulator/local_emulator_environment.py b/build/android/pylib/local/emulator/local_emulator_environment.py index 15f3c92..d91d894 100644 --- a/build/android/pylib/local/emulator/local_emulator_environment.py +++ b/build/android/pylib/local/emulator/local_emulator_environment.py
@@ -68,7 +68,9 @@ return timeout_retry.Run( impl, - timeout=120 if self._writable_system else 30, + # TODO(crbug.com/1093602): Temporarily increase the default timeout + # to make sure emulators can start successfully with GLDMA disabled. + timeout=120 if self._writable_system else 90, retries=2, args=[e], retry_if_func=retry_on_timeout)
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 3e5658da0..a60eee6 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -3709,8 +3709,7 @@ ]) test_name = invoker.target_name test_type = "instrumentation" - _apk_target_name = - get_label_info(invoker.android_test_apk, "name") + "__apk" + _apk_target_name = get_label_info(invoker.android_test_apk, "name") apk_target = ":$_apk_target_name" test_jar = "$root_build_dir/test.lib.java/" + invoker.android_test_apk_name + ".jar" @@ -3753,34 +3752,29 @@ # ] # } template("android_test_apk") { - _apk_target_name = "${target_name}__apk" - android_apk(_apk_target_name) { - forward_variables_from(invoker, "*") - + android_apk(target_name) { testonly = true - if (!defined(deps)) { - deps = [] + deps = [ "//testing/android/broker:broker_java" ] + if (defined(invoker.deps)) { + deps += invoker.deps } - if (!defined(data_deps)) { - data_deps = [] - } - deps += [ "//testing/android/broker:broker_java" ] - data_deps += [ + data_deps = [ + # Ensure unstripped libraries are included in runtime deps so that + # symbolization can be done. + ":${target_name}__secondary_abi_shared_library_list", + ":${target_name}__shared_library_list", "//build/android/pylib/device/commands", "//tools/android/forwarder2", ] + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } if (defined(invoker.apk_under_test)) { data_deps += [ invoker.apk_under_test ] } else { enable_native_mocks = true } - # Ensure unstripped libraries are included in runtime deps so that - # symbolization can be done. - data_deps += [ - ":${_apk_target_name}__secondary_abi_shared_library_list", - ":${_apk_target_name}__shared_library_list", - ] if (defined(invoker.apk_under_test)) { _under_test_label = get_label_info(invoker.apk_under_test, "label_no_toolchain") @@ -3790,13 +3784,17 @@ ] } - if (defined(additional_apks)) { - data_deps += additional_apks + if (defined(invoker.additional_apks)) { + data_deps += invoker.additional_apks } - if (defined(use_webview_provider)) { - data_deps += [ use_webview_provider ] + if (defined(invoker.use_webview_provider)) { + data_deps += [ invoker.use_webview_provider ] } + data = [] + if (defined(invoker.data)) { + data += invoker.data + } if (defined(invoker.proguard_enabled) && invoker.proguard_enabled && !incremental_install) { # When ProGuard is on, we use ProGuard to combine the under test java @@ -3804,21 +3802,30 @@ # optimizations that we ship with, but not have them break tests. The # apk under test will still have the same resources, assets, and # manifest, all of which are the ones used in the tests. - if (!defined(invoker.proguard_configs)) { - proguard_configs = [] + proguard_configs = [ "//testing/android/proguard_for_test.flags" ] + if (defined(invoker.proguard_configs)) { + proguard_configs += invoker.proguard_configs } - proguard_configs += [ "//testing/android/proguard_for_test.flags" ] disable_checkdiscard = true - if (defined(final_apk_path)) { + if (defined(invoker.final_apk_path)) { _final_apk_path = final_apk_path } else { - _final_apk_path = "$root_build_dir/apks/${apk_name}.apk" + _final_apk_path = "$root_build_dir/apks/${invoker.apk_name}.apk" } - data = [ "$_final_apk_path.mapping" ] + data += [ "$_final_apk_path.mapping" ] } dist_ijar_path = "$root_build_dir/test.lib.java/${invoker.apk_name}.jar" create_apk_script = false + + forward_variables_from(invoker, + "*", + [ + "data", + "data_deps", + "deps", + "proguard_configs", + ]) } }
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index b172278..35b0f8f 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1073,7 +1073,10 @@ ] } - asmflags = cflags + # TODO(thakis): Remove `if (!is_win)` after next clang roll. + if (!is_win) { + asmflags = cflags + } } # This provides options that make the build deterministic, so that the same
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 1e6ed8e..1807e7a6 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20200713.0.1 +0.20200713.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 1e6ed8e..1807e7a6 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20200713.0.1 +0.20200713.1.1
diff --git a/build/mac_toolchain.py b/build/mac_toolchain.py index bfd3c5f..beb6aad 100755 --- a/build/mac_toolchain.py +++ b/build/mac_toolchain.py
@@ -63,7 +63,7 @@ if sys.platform != 'darwin': return True needed = MAC_MINIMUM_OS_VERSION[version] - major_version = map(int, platform.release().split('.')[:len(needed)]) + major_version = [int(v) for v in platform.release().split('.')[:len(needed)]] return major_version >= needed
diff --git a/cc/OWNERS b/cc/OWNERS index 682d6e8..c9cc8d29 100644 --- a/cc/OWNERS +++ b/cc/OWNERS
@@ -18,7 +18,6 @@ # tiles, tile management, and raster work vmpstr@chromium.org -ericrk@chromium.org # texture uploading sunnyps@chromium.org @@ -37,13 +36,11 @@ smcgruer@chromium.org # images -ericrk@chromium.org khushalsagar@chromium.org vmpstr@chromium.org # surfaces kylechar@chromium.org -samans@chromium.org jonross@chromium.org # input, scrolling
diff --git a/cc/animation/keyframe_model.cc b/cc/animation/keyframe_model.cc index d3819070..9c47d989 100644 --- a/cc/animation/keyframe_model.cc +++ b/cc/animation/keyframe_model.cc
@@ -4,7 +4,11 @@ #include "cc/animation/keyframe_model.h" +#include <algorithm> #include <cmath> +#include <limits> +#include <string> +#include <utility> #include "base/memory/ptr_util.h" #include "base/stl_util.h"
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc index 373fed6c..e7d3834 100644 --- a/cc/test/layer_tree_pixel_resource_test.cc +++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -19,7 +19,9 @@ LayerTreeHostPixelResourceTest::LayerTreeHostPixelResourceTest( PixelResourceTestCase test_case) - : LayerTreePixelTest(test_case.renderer_type), test_case_(test_case) {} + : LayerTreePixelTest(test_case.renderer_type), test_case_(test_case) { + set_raster_type(test_case_.raster_type); +} const char* LayerTreeHostPixelResourceTest::GetRendererSuffix() const { switch (renderer_type_) { @@ -35,13 +37,6 @@ } } -void LayerTreeHostPixelResourceTest::InitializeSettings( - LayerTreeSettings* settings) { - LayerTreePixelTest::InitializeSettings(settings); - if (raster_type() != GPU) - settings->gpu_rasterization_disabled = true; -} - std::unique_ptr<RasterBufferProvider> LayerTreeHostPixelResourceTest::CreateRasterBufferProvider( LayerTreeHostImpl* host_impl) { @@ -75,21 +70,22 @@ } } switch (raster_type()) { - case SOFTWARE: + case TestRasterType::kBitmap: EXPECT_FALSE(compositor_context_provider); EXPECT_TRUE(use_software_renderer()); return std::make_unique<BitmapRasterBufferProvider>( host_impl->layer_tree_frame_sink()); - case GPU: { + case TestRasterType::kGpu: + case TestRasterType::kOop: EXPECT_TRUE(compositor_context_provider); EXPECT_TRUE(worker_context_provider); EXPECT_FALSE(use_software_renderer()); return std::make_unique<GpuRasterBufferProvider>( compositor_context_provider, worker_context_provider, false, - gpu_raster_format, gfx::Size(), true, use_oopr()); - } - case ZERO_COPY: + gpu_raster_format, gfx::Size(), true, + /*enable_oop_rasterization=*/raster_type() == TestRasterType::kOop); + case TestRasterType::kZeroCopy: EXPECT_TRUE(compositor_context_provider); EXPECT_TRUE(gpu_memory_buffer_manager); EXPECT_FALSE(use_software_renderer()); @@ -97,7 +93,7 @@ return std::make_unique<ZeroCopyRasterBufferProvider>( gpu_memory_buffer_manager, compositor_context_provider, sw_raster_format); - case ONE_COPY: + case TestRasterType::kOneCopy: EXPECT_TRUE(compositor_context_provider); EXPECT_TRUE(worker_context_provider); EXPECT_FALSE(use_software_renderer());
diff --git a/cc/test/layer_tree_pixel_resource_test.h b/cc/test/layer_tree_pixel_resource_test.h index f1d1de4..7f545dff 100644 --- a/cc/test/layer_tree_pixel_resource_test.h +++ b/cc/test/layer_tree_pixel_resource_test.h
@@ -5,21 +5,16 @@ #ifndef CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ #define CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ +#include <memory> + #include "base/memory/ref_counted.h" #include "cc/test/layer_tree_pixel_test.h" namespace cc { -enum RasterType { - SOFTWARE, - GPU, - ONE_COPY, - ZERO_COPY, -}; - struct PixelResourceTestCase { LayerTreeTest::RendererType renderer_type; - RasterType raster_type; + TestRasterType raster_type; }; class LayerTreeHostPixelResourceTest : public LayerTreePixelTest { @@ -28,12 +23,8 @@ RendererType renderer_type() const { return test_case_.renderer_type; } - RasterType raster_type() const { return test_case_.raster_type; } - const char* GetRendererSuffix() const; - void InitializeSettings(LayerTreeSettings* settings) override; - std::unique_ptr<RasterBufferProvider> CreateRasterBufferProvider( LayerTreeHostImpl* host_impl) override;
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index fa4b3a9..a8c5102 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -37,9 +37,26 @@ namespace cc { +namespace { + +TestRasterType GetDefaultRasterType(LayerTreeTest::RendererType renderer_type) { + switch (renderer_type) { + case LayerTreeTest::RENDERER_SOFTWARE: + return TestRasterType::kBitmap; + case LayerTreeTest::RENDERER_SKIA_VK: + case LayerTreeTest::RENDERER_SKIA_DAWN: + return TestRasterType::kOop; + default: + return TestRasterType::kOneCopy; + } +} + +} // namespace + LayerTreePixelTest::LayerTreePixelTest( LayerTreeTest::RendererType renderer_type) : LayerTreeTest(renderer_type), + raster_type_(GetDefaultRasterType(renderer_type)), pixel_comparator_(new ExactPixelComparator(true)), pending_texture_mailbox_callbacks_(0) {} @@ -54,18 +71,14 @@ scoped_refptr<viz::TestInProcessContextProvider> compositor_context_provider; scoped_refptr<viz::TestInProcessContextProvider> worker_context_provider; if (!use_software_renderer()) { - // Use gpu rasterization when using vulkan. - if (use_oopr()) - DCHECK(gpu_rasterization_); compositor_context_provider = base::MakeRefCounted<viz::TestInProcessContextProvider>( - /*enable_gpu_rasterization=*/gpu_rasterization_, + /*enable_gpu_rasterization=*/use_accelerated_raster(), /*enable_oop_rasterization=*/false, /*support_locking=*/false); - // With vulkan, OOPR has to be enabled. worker_context_provider = base::MakeRefCounted<viz::TestInProcessContextProvider>( - /*enable_gpu_rasterization=*/gpu_rasterization_, - /*enable_oop_rasterization=*/use_oopr(), + /*enable_gpu_rasterization=*/use_accelerated_raster(), + /*enable_oop_rasterization=*/raster_type() == TestRasterType::kOop, /*support_locking=*/true); // Bind worker context to main thread like it is in production. This is // needed to fully initialize the context. Compositor context is bound to @@ -98,16 +111,25 @@ host_impl->layer_tree_frame_sink()->context_provider(); viz::RasterContextProvider* worker_context_provider = host_impl->layer_tree_frame_sink()->worker_context_provider(); - EXPECT_EQ(gpu_rasterization_, + EXPECT_EQ(use_accelerated_raster(), context_provider->ContextCapabilities().gpu_rasterization); - EXPECT_EQ(gpu_rasterization_, + EXPECT_EQ(use_accelerated_raster(), worker_context_provider->ContextCapabilities().gpu_rasterization); + EXPECT_EQ( + raster_type() == TestRasterType::kOop, + worker_context_provider->ContextCapabilities().supports_oop_raster); } else { - EXPECT_FALSE(gpu_rasterization_); + EXPECT_EQ(TestRasterType::kBitmap, raster_type()); } LayerTreeTest::DrawLayersOnThread(host_impl); } +void LayerTreePixelTest::InitializeSettings(LayerTreeSettings* settings) { + LayerTreeTest::InitializeSettings(settings); + settings->gpu_rasterization_disabled = !use_accelerated_raster(); + settings->use_zero_copy = raster_type() == TestRasterType::kZeroCopy; +} + std::unique_ptr<viz::SkiaOutputSurface> LayerTreePixelTest::CreateDisplaySkiaOutputSurfaceOnThread() { // Set up the SkiaOutputSurfaceImpl.
diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index f43b488..6868d47 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h
@@ -41,6 +41,14 @@ class SolidColorLayer; class TextureLayer; +enum class TestRasterType { + kBitmap, + kGpu, + kOop, + kOneCopy, + kZeroCopy, +}; + class LayerTreePixelTest : public LayerTreeTest { protected: explicit LayerTreePixelTest(RendererType renderer_type); @@ -58,6 +66,7 @@ std::unique_ptr<viz::OutputSurface> CreateDisplayOutputSurfaceOnThread( scoped_refptr<viz::ContextProvider> compositor_context_provider) override; void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override; + void InitializeSettings(LayerTreeSettings* settings) override; virtual std::unique_ptr<viz::CopyOutputRequest> CreateCopyOutputRequest(); @@ -114,9 +123,18 @@ enlarge_texture_amount_ = enlarge_texture_amount; } - // Gpu rasterization is not used in pixel tests by default, except on Vulkan - // where it is required. Tests may opt into using it. - void set_gpu_rasterization() { gpu_rasterization_ = true; } + // Gpu rasterization is not used in pixel tests by default, and OOP + // rasterization is used by default only for Vulkan and Skia Dawn. Tests may + // opt into using a different raster mode. + void set_raster_type(TestRasterType raster_type) { + raster_type_ = raster_type; + } + + TestRasterType raster_type() const { return raster_type_; } + bool use_accelerated_raster() const { + return raster_type_ == TestRasterType::kGpu || + raster_type_ == TestRasterType::kOop; + } // Common CSS colors defined for tests to use. static const SkColor kCSSOrange = 0xffffa500; @@ -125,7 +143,7 @@ static const SkColor kCSSLime = 0xff00ff00; static const SkColor kCSSBlack = 0xff000000; - bool gpu_rasterization_ = use_oopr(); + TestRasterType raster_type_; gl::DisableNullDrawGLBindings enable_pixel_output_; std::unique_ptr<PixelComparator> pixel_comparator_; scoped_refptr<Layer> content_root_; // Not used in layer list mode.
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 94fbc81..f8cfb762 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h
@@ -5,6 +5,9 @@ #ifndef CC_TEST_LAYER_TREE_TEST_H_ #define CC_TEST_LAYER_TREE_TEST_H_ +#include <memory> +#include <string> + #include "base/memory/ref_counted.h" #include "base/test/scoped_feature_list.h" #include "base/threading/thread.h" @@ -223,10 +226,6 @@ return renderer_type_ == RENDERER_SOFTWARE; } bool use_skia_vulkan() const { return renderer_type_ == RENDERER_SKIA_VK; } - bool use_oopr() const { - return renderer_type_ == RENDERER_SKIA_VK || - renderer_type_ == RENDERER_SKIA_DAWN; - } bool use_d3d12() const { #if defined(OS_WIN) return renderer_type_ == RENDERER_SKIA_DAWN;
diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc index 0a6809e..954d34d 100644 --- a/cc/trees/layer_tree_host_pixeltest_blending.cc +++ b/cc/trees/layer_tree_host_pixeltest_blending.cc
@@ -260,11 +260,11 @@ }; std::vector<PixelResourceTestCase> const kTestCases = { - {LayerTreeTest::RENDERER_SOFTWARE, SOFTWARE}, - {LayerTreeTest::RENDERER_GL, ZERO_COPY}, - {LayerTreeTest::RENDERER_SKIA_GL, GPU}, + {LayerTreeTest::RENDERER_SOFTWARE, TestRasterType::kBitmap}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kGpu}, #if defined(ENABLE_CC_VULKAN_TESTS) - {LayerTreeTest::RENDERER_SKIA_VK, GPU}, + {LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kOop}, #endif // defined(ENABLE_CC_VULKAN_TESTS) };
diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index 702d4e5d..bb35765 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc
@@ -29,15 +29,16 @@ // TODO(penghuang): Fix vulkan with one copy or zero copy // https://crbug.com/979703 std::vector<PixelResourceTestCase> const kTestCases = { - {LayerTreeTest::RENDERER_SOFTWARE, SOFTWARE}, - {LayerTreeTest::RENDERER_GL, GPU}, - {LayerTreeTest::RENDERER_GL, ONE_COPY}, - {LayerTreeTest::RENDERER_GL, ZERO_COPY}, - {LayerTreeTest::RENDERER_SKIA_GL, GPU}, - {LayerTreeTest::RENDERER_SKIA_GL, ONE_COPY}, - {LayerTreeTest::RENDERER_SKIA_GL, ZERO_COPY}, + {LayerTreeTest::RENDERER_SOFTWARE, TestRasterType::kBitmap}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kGpu}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kOneCopy}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kGpu}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kOneCopy}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kZeroCopy}, #if defined(ENABLE_CC_VULKAN_TESTS) - {LayerTreeTest::RENDERER_SKIA_VK, GPU}, + {LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kOop}, + {LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kZeroCopy}, #endif // defined(ENABLE_CC_VULKAN_TESTS) }; @@ -575,14 +576,14 @@ TEST_P(LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerList, Test) { base::FilePath image_name = - (raster_type() == GPU) + (raster_type() == TestRasterType::kGpu) ? base::FilePath(FILE_PATH_LITERAL("mask_of_backdrop_filter_gpu.png")) : base::FilePath(FILE_PATH_LITERAL("mask_of_backdrop_filter.png")); - if (use_skia_vulkan() && raster_type() == GPU) { - // Vulkan with GPU raster has 4 pixels errors (the circle mask shape is - // slight different). - float percentage_pixels_large_error = 0.04f; // 4px / (100*100) + if (use_skia_vulkan() && raster_type() == TestRasterType::kOop) { + // Vulkan with OOP raster has 3 pixels errors (the circle mask shape is + // slightly different). + float percentage_pixels_large_error = 0.031f; // 3px / (100*100) float percentage_pixels_small_error = 0.0f; float average_error_allowed_in_bad_pixels = 182.f; int large_error_allowed = 182; @@ -634,14 +635,14 @@ blur->SetMaskLayer(mask); base::FilePath image_name = - (raster_type() == GPU) + (raster_type() == TestRasterType::kGpu) ? base::FilePath(FILE_PATH_LITERAL("mask_of_backdrop_filter_gpu.png")) : base::FilePath(FILE_PATH_LITERAL("mask_of_backdrop_filter.png")); - if (use_skia_vulkan() && raster_type() == GPU) { - // Vulkan with GPU raster has 4 pixels errors (the circle mask shape is - // slight different). - float percentage_pixels_large_error = 0.04f; // 4px / (100*100) + if (use_skia_vulkan() && raster_type() == TestRasterType::kOop) { + // Vulkan with OOP raster has 3 pixels errors (the circle mask shape is + // slightly different). + float percentage_pixels_large_error = 0.031f; // 3px / (100*100) float percentage_pixels_small_error = 0.0f; float average_error_allowed_in_bad_pixels = 182.f; int large_error_allowed = 182; @@ -867,18 +868,23 @@ }; MaskTestConfig const kTestConfigs[] = { - MaskTestConfig{{LayerTreeTest::RENDERER_SOFTWARE, SOFTWARE}, 0}, - MaskTestConfig{{LayerTreeTest::RENDERER_GL, ZERO_COPY}, 0}, - MaskTestConfig{{LayerTreeTest::RENDERER_GL, ZERO_COPY}, kUseAntialiasing}, - MaskTestConfig{{LayerTreeTest::RENDERER_GL, ZERO_COPY}, kForceShaders}, - MaskTestConfig{{LayerTreeTest::RENDERER_GL, ZERO_COPY}, + MaskTestConfig{{LayerTreeTest::RENDERER_SOFTWARE, TestRasterType::kBitmap}, + 0}, + MaskTestConfig{{LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, 0}, + MaskTestConfig{{LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, + kUseAntialiasing}, + MaskTestConfig{{LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, + kForceShaders}, + MaskTestConfig{{LayerTreeTest::RENDERER_GL, TestRasterType::kZeroCopy}, kUseAntialiasing | kForceShaders}, - MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_GL, ZERO_COPY}, 0}, - MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_GL, ZERO_COPY}, + MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kZeroCopy}, + 0}, + MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kZeroCopy}, kUseAntialiasing}, #if defined(ENABLE_CC_VULKAN_TESTS) - MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_VK, ZERO_COPY}, 0}, - MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_VK, ZERO_COPY}, + MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kZeroCopy}, + 0}, + MaskTestConfig{{LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kZeroCopy}, kUseAntialiasing}, #endif // defined(ENABLE_CC_VULKAN_TESTS) }; @@ -1021,7 +1027,7 @@ mask_isolation->AddChild(mask_layer); base::FilePath image_name = - (raster_type() == SOFTWARE) + (raster_type() == TestRasterType::kBitmap) ? base::FilePath( FILE_PATH_LITERAL("mask_as_blending_rotated_circle.png")) : base::FilePath( @@ -1067,7 +1073,7 @@ mask_isolation->AddChild(mask_layer); base::FilePath image_name = - (raster_type() == SOFTWARE) + (raster_type() == TestRasterType::kBitmap) ? base::FilePath(FILE_PATH_LITERAL( "mask_as_blending_rotated_circle_underflow.png")) : base::FilePath(FILE_PATH_LITERAL( @@ -1135,7 +1141,7 @@ TEST_P(LayerTreeHostMasksForBackdropFiltersAndBlendPixelTest, Test) { base::FilePath result_path( FILE_PATH_LITERAL("mask_of_backdrop_filter_and_blend_.png")); - if (raster_type() != GPU) { + if (!use_accelerated_raster()) { result_path = result_path.InsertBeforeExtensionASCII("sw"); } else { result_path = result_path.InsertBeforeExtensionASCII(GetRendererSuffix());
diff --git a/cc/trees/layer_tree_host_pixeltest_synchronous.cc b/cc/trees/layer_tree_host_pixeltest_synchronous.cc index 34d9ef1..e85b3f30 100644 --- a/cc/trees/layer_tree_host_pixeltest_synchronous.cc +++ b/cc/trees/layer_tree_host_pixeltest_synchronous.cc
@@ -24,7 +24,6 @@ void InitializeSettings(LayerTreeSettings* settings) override { LayerTreePixelTest::InitializeSettings(settings); settings->single_thread_proxy_scheduler = false; - settings->use_zero_copy = use_zero_copy_; } RendererType renderer_type() const { return GetParam(); } @@ -49,8 +48,6 @@ RunSingleThreadedPixelTest(root, base::FilePath(FILE_PATH_LITERAL("green.png"))); } - - bool use_zero_copy_ = false; }; LayerTreeTest::RendererType const kRendererTypesGpu[] = { @@ -66,12 +63,12 @@ ::testing::ValuesIn(kRendererTypesGpu)); TEST_P(LayerTreeHostSynchronousPixelTest, OneContentLayerZeroCopy) { - use_zero_copy_ = true; + set_raster_type(TestRasterType::kZeroCopy); DoContentLayerTest(); } TEST_P(LayerTreeHostSynchronousPixelTest, OneContentLayerGpuRasterization) { - set_gpu_rasterization(); + set_raster_type(TestRasterType::kGpu); DoContentLayerTest(); }
diff --git a/cc/trees/layer_tree_host_pixeltest_tiles.cc b/cc/trees/layer_tree_host_pixeltest_tiles.cc index 6cf495f..55c8e4f 100644 --- a/cc/trees/layer_tree_host_pixeltest_tiles.cc +++ b/cc/trees/layer_tree_host_pixeltest_tiles.cc
@@ -20,16 +20,9 @@ namespace cc { namespace { -enum RasterMode { - BITMAP, - ONE_COPY, - GPU, - GPU_LOW_BIT_DEPTH, -}; - struct TilesTestConfig { LayerTreeTest::RendererType renderer_type; - RasterMode raster_mode; + TestRasterType raster_type; }; class LayerTreeHostTilesPixelTest @@ -37,33 +30,13 @@ public ::testing::WithParamInterface<TilesTestConfig> { protected: LayerTreeHostTilesPixelTest() : LayerTreePixelTest(renderer_type()) { - switch (raster_mode()) { - case GPU: - case GPU_LOW_BIT_DEPTH: - set_gpu_rasterization(); - break; - default: - break; - } + set_raster_type(GetParam().raster_type); } RendererType renderer_type() const { return GetParam().renderer_type; } - RasterMode raster_mode() const { return GetParam().raster_mode; } - void InitializeSettings(LayerTreeSettings* settings) override { LayerTreePixelTest::InitializeSettings(settings); - switch (raster_mode()) { - case ONE_COPY: - settings->use_zero_copy = false; - break; - case GPU_LOW_BIT_DEPTH: - settings->use_rgba_4444 = true; - settings->unpremultiply_and_dither_low_bit_depth_tiles = true; - break; - default: - break; - } settings->use_partial_raster = use_partial_raster_; } @@ -180,14 +153,13 @@ }; std::vector<TilesTestConfig> const kTestCases = { - {LayerTreeTest::RENDERER_SOFTWARE, BITMAP}, - {LayerTreeTest::RENDERER_GL, ONE_COPY}, - {LayerTreeTest::RENDERER_GL, GPU}, - {LayerTreeTest::RENDERER_SKIA_GL, ONE_COPY}, - {LayerTreeTest::RENDERER_SKIA_GL, GPU}, + {LayerTreeTest::RENDERER_SOFTWARE, TestRasterType::kBitmap}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kOneCopy}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kGpu}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kOneCopy}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kGpu}, #if defined(ENABLE_CC_VULKAN_TESTS) - {LayerTreeTest::RENDERER_SKIA_VK, ONE_COPY}, - {LayerTreeTest::RENDERER_SKIA_VK, GPU}, + {LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kOop}, #endif // defined(ENABLE_CC_VULKAN_TESTS) }; @@ -216,10 +188,12 @@ } std::vector<TilesTestConfig> const kTestCasesMultiThread = { - {LayerTreeTest::RENDERER_GL, ONE_COPY}, - {LayerTreeTest::RENDERER_SKIA_GL, ONE_COPY}, + {LayerTreeTest::RENDERER_GL, TestRasterType::kOneCopy}, + {LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kOneCopy}, #if defined(ENABLE_CC_VULKAN_TESTS) - {LayerTreeTest::RENDERER_SKIA_VK, ONE_COPY}, + // TODO(sgilhuly): Switch this to one copy raster once is is supported for + // Vulkan in these tests. + {LayerTreeTest::RENDERER_SKIA_VK, TestRasterType::kOop}, #endif // defined(ENABLE_CC_VULKAN_TESTS) }; @@ -253,8 +227,15 @@ base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); } -using LayerTreeHostTilesTestPartialInvalidationLowBitDepth = - LayerTreeHostTilesTestPartialInvalidation; +class LayerTreeHostTilesTestPartialInvalidationLowBitDepth + : public LayerTreeHostTilesTestPartialInvalidation { + protected: + void InitializeSettings(LayerTreeSettings* settings) override { + LayerTreeHostTilesPixelTest::InitializeSettings(settings); + settings->use_rgba_4444 = true; + settings->unpremultiply_and_dither_low_bit_depth_tiles = true; + } +}; // This test doesn't work on Vulkan because on our hardware we can't render to // RGBA4444 format using either SwiftShader or native Vulkan. See @@ -263,8 +244,8 @@ All, LayerTreeHostTilesTestPartialInvalidationLowBitDepth, ::testing::Values( - TilesTestConfig{LayerTreeTest::RENDERER_SKIA_GL, GPU_LOW_BIT_DEPTH}, - TilesTestConfig{LayerTreeTest::RENDERER_GL, GPU_LOW_BIT_DEPTH})); + TilesTestConfig{LayerTreeTest::RENDERER_SKIA_GL, TestRasterType::kGpu}, + TilesTestConfig{LayerTreeTest::RENDERER_GL, TestRasterType::kGpu})); TEST_P(LayerTreeHostTilesTestPartialInvalidationLowBitDepth, PartialRaster) { use_partial_raster_ = true;
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 2ee2dbf..b3ac8ae6a 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -326,6 +326,7 @@ "//chrome/browser/safe_browsing/android:java", "//chrome/browser/safety_check/android:java", "//chrome/browser/settings:java", + "//chrome/browser/share:java", "//chrome/browser/share/android:java_resources", "//chrome/browser/tab:java", "//chrome/browser/tabmodel:java", @@ -788,6 +789,7 @@ "//chrome/browser/profiles/android:java", "//chrome/browser/safety_check/android:java", "//chrome/browser/safety_check/android:junit", + "//chrome/browser/share:java", "//chrome/browser/tab:java", "//chrome/browser/tabmodel:java", "//chrome/browser/thumbnail:java", @@ -974,6 +976,7 @@ "//chrome/browser/settings:java", "//chrome/browser/settings:javatests", "//chrome/browser/settings:test_support_java", + "//chrome/browser/share:java", "//chrome/browser/tab:java", "//chrome/browser/tabmodel:java", "//chrome/browser/tabpersistence:java",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index cd620ac..5658c6c 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -938,11 +938,10 @@ "java/src/org/chromium/chrome/browser/night_mode/settings/RadioButtonGroupThemePreference.java", "java/src/org/chromium/chrome/browser/night_mode/settings/ThemeSettingsFragment.java", "java/src/org/chromium/chrome/browser/notifications/ActionInfo.java", + "java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperCompatBuilder.java", + "java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperStandardBuilder.java", "java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java", - "java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java", "java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java", - "java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java", - "java/src/org/chromium/chrome/browser/notifications/NotificationCompatBuilder.java", "java/src/org/chromium/chrome/browser/notifications/NotificationConstants.java", "java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptor.java", "java/src/org/chromium/chrome/browser/notifications/NotificationJobService.java", @@ -953,6 +952,7 @@ "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTask.java", "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java", "java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java", + "java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactory.java", "java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java", "java/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdater.java", "java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java", @@ -1373,7 +1373,6 @@ "java/src/org/chromium/chrome/browser/settings/MainSettings.java", "java/src/org/chromium/chrome/browser/settings/SettingsActivity.java", "java/src/org/chromium/chrome/browser/settings/SettingsLauncherImpl.java", - "java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java", "java/src/org/chromium/chrome/browser/share/LensUtils.java", "java/src/org/chromium/chrome/browser/share/OptionalShareTargetsManager.java", "java/src/org/chromium/chrome/browser/share/ShareButtonController.java",
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index 43b622b7..c373db2b2 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -265,11 +265,11 @@ "javatests/src/org/chromium/chrome/browser/night_mode/settings/ThemeSettingsFragmentTest.java", "javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java", "javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java", - "javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactoryTest.java", "javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeIntentTest.java", "javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java", "javatests/src/org/chromium/chrome/browser/notifications/NotificationTestRule.java", "javatests/src/org/chromium/chrome/browser/notifications/NotificationTestUtil.java", + "javatests/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactoryTest.java", "javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java", "javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java", "javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java",
diff --git a/chrome/android/features/tab_ui/BUILD.gn b/chrome/android/features/tab_ui/BUILD.gn index 4fd7152..c8601bf 100644 --- a/chrome/android/features/tab_ui/BUILD.gn +++ b/chrome/android/features/tab_ui/BUILD.gn
@@ -189,6 +189,7 @@ "//chrome/browser/browser_controls/android:java", "//chrome/browser/flags:java", "//chrome/browser/profiles/android:java", + "//chrome/browser/share:java", "//chrome/browser/tab:java", "//chrome/browser/tabmodel:java", "//chrome/browser/ui/android/favicon:java",
diff --git a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrFallbackUtils.java b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrFallbackUtils.java index ea63c4f..787a84f 100644 --- a/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrFallbackUtils.java +++ b/chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrFallbackUtils.java
@@ -11,8 +11,8 @@ import org.chromium.base.task.PostTask; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; @@ -29,8 +29,8 @@ NotificationManagerProxy notificationManager = new NotificationManagerProxyImpl(context); Notification notification = - NotificationBuilderFactory - .createChromeNotificationBuilder( + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder( true, ChromeChannelDefinitions.ChannelId.VR) .setContentTitle(context.getResources().getString( R.string.vr_preparing_vr_notification_title))
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java index 2272f94..79372481 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java
@@ -497,8 +497,6 @@ @Override public void sendFeedback(Map<String, String> productSpecificDataMap) { - HashMap<String, String> feedContext = new HashMap<String, String>(); - Profile profile = Profile.getLastUsedRegularProfile(); if (profile == null) { return; @@ -509,7 +507,7 @@ return; } - convertNameFormat(productSpecificDataMap, feedContext); + Map<String, String> feedContext = convertNameFormat(productSpecificDataMap); // FEEDBACK_CONTEXT: This identifies this feedback as coming from Chrome for Android (as // opposed to desktop). @@ -524,8 +522,7 @@ // name from the XSurface format to the format that can be handled by the feedback system. Any // new strings that are added on the XSurface side will need a code change here, and adding the // PSD to the allow list. - private void convertNameFormat( - Map<String, String> xSurfaceMap, Map<String, String> feedbackMap) { + private Map<String, String> convertNameFormat(Map<String, String> xSurfaceMap) { Map<String, String> feedbackNameConversionMap = new HashMap<>(); feedbackNameConversionMap.put("Card URL", "CardUrl"); feedbackNameConversionMap.put("Card Title", "CardTitle"); @@ -535,10 +532,21 @@ // For each <name, value> entry in the input map, convert the name to the new name, and // write the new <name, value> pair into the output map. + Map<String, String> feedbackMap = new HashMap<>(); for (Map.Entry<String, String> entry : xSurfaceMap.entrySet()) { String newName = feedbackNameConversionMap.get(entry.getKey()); - feedbackMap.put(newName, entry.getValue()); + if (newName != null) { + feedbackMap.put(newName, entry.getValue()); + } else { + Log.v(TAG, "Found an entry with no conversion available."); + // We will put the entry into the map if untranslatable. It will be discarded + // unless it matches an allow list on the server, though. This way we can choose + // to allow it on the server if desired. + feedbackMap.put(entry.getKey(), entry.getValue()); + } } + + return feedbackMap; } @Override
diff --git a/chrome/android/java/src/PRESUBMIT.py b/chrome/android/java/src/PRESUBMIT.py index 3576157..ebbd009 100644 --- a/chrome/android/java/src/PRESUBMIT.py +++ b/chrome/android/java/src/PRESUBMIT.py
@@ -9,7 +9,7 @@ This presubmit checks for the following: - No new calls to Notification.Builder or NotificationCompat.Builder - constructors. Callers should use ChromeNotificationBuilder instead. + constructors. Callers should use NotificationWrapperBuilder instead. - No new calls to AlertDialog.Builder. Callers should use ModalDialogView instead. """ @@ -55,9 +55,9 @@ # "Blacklist" because the following files are excluded from the check. blacklist = ( 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' - 'NotificationBuilder.java', + 'ChromeNotificationWrapperBuilder.java', 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' - 'NotificationCompatBuilder.java' + 'ChromeNotificationWrapperCompatBuilder.java' ) error_msg = ''' Android Notification Construction Check failed: @@ -65,7 +65,7 @@ NotificationCompat.Builder constructors, listed below. This is banned, please construct notifications using - NotificationBuilderFactory.createChromeNotificationBuilder instead, + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder instead, specifying a channel for use on Android O. See https://crbug.com/678670 for more information.
diff --git a/chrome/android/java/src/PRESUBMIT_test.py b/chrome/android/java/src/PRESUBMIT_test.py index 959f31d..154d189 100755 --- a/chrome/android/java/src/PRESUBMIT_test.py +++ b/chrome/android/java/src/PRESUBMIT_test.py
@@ -37,16 +37,16 @@ mock_input.files = [ MockFile( 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' - 'NotificationBuilder.java', + 'ChromeNotificationWrapperBuilder.java', ['new Notification.Builder()']), MockFile( 'chrome/android/java/src/org/chromium/chrome/browser/notifications/' - 'NotificationCompatBuilder.java', + 'ChromeNotificationWrapperCompatBuilder.java', ['new NotificationCompat.Builder()']), MockFile('path/One.java', ['Notification.Builder']), MockFile('path/Two.java', ['// do not: new Notification.Builder()']), MockFile('path/Three.java', - ['/** ChromeNotificationBuilder', + ['/** NotificationWrapperBuilder', ' * replaces: new Notification.Builder()']), MockFile('path/PRESUBMIT.py', ['new Notification.Builder()']), MockFile('path/Four.java', ['new NotificationCompat.Builder()'],
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/announcement/AnnouncementNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/announcement/AnnouncementNotificationManager.java index 114bd623..5f2c25c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/announcement/AnnouncementNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/announcement/AnnouncementNotificationManager.java
@@ -21,14 +21,14 @@ import org.chromium.chrome.browser.init.BrowserParts; import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.EmptyBrowserParts; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import java.lang.annotation.Retention; @@ -126,9 +126,9 @@ @CalledByNative private static void showNotification(String url) { Context context = ContextUtils.getApplicationContext(); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.ANNOUNCEMENT, null /* remoteAppPackageName */, new NotificationMetadata( @@ -151,7 +151,7 @@ NotificationUmaTracker.ActionType.ANNOUNCEMENT_OPEN); NotificationManagerProxy nm = new NotificationManagerProxyImpl(context); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); nm.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotification.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotification.java index fc15677..4c5e519 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotification.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotification.java
@@ -27,12 +27,12 @@ import org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyObservable; @@ -70,7 +70,8 @@ boolean firstTime = mModel.get(DISCLOSURE_FIRST_TIME); String packageName = mModel.get(PACKAGE_NAME); - ChromeNotification notification = createNotification(firstTime, mCurrentScope, packageName); + NotificationWrapper notification = + createNotification(firstTime, mCurrentScope, packageName); mNotificationManager.notify(notification); mModel.get(DISCLOSURE_EVENTS_CALLBACK).onDisclosureShown(); @@ -82,7 +83,7 @@ mCurrentScope = null; } - private ChromeNotification createNotification( + private NotificationWrapper createNotification( boolean firstTime, String scope, String packageName) { int umaType; int preOPriority; @@ -118,8 +119,8 @@ // We don't have an icon to display. int icon = 0; - return NotificationBuilderFactory - .createChromeNotificationBuilder( + return NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder( preferCompat, channelId, remoteAppPackageName, metadata) .setSmallIcon(R.drawable.ic_chrome) .setContentTitle(title) @@ -133,7 +134,7 @@ .setStyle(new Notification.BigTextStyle().bigText(text)) .setOngoing(!firstTime) .setPriorityBeforeO(preOPriority) - .buildChromeNotification(); + .buildNotificationWrapper(); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java index 6ebf164..e2b4610 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationFactory.java
@@ -34,12 +34,12 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.media.MediaViewerUtils; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.offline_items_collection.ContentId; @@ -93,9 +93,9 @@ && ChromeFeatureList.isEnabled(ChromeFeatureList.DOWNLOAD_NOTIFICATION_BADGE)) { channelId = ChromeChannelDefinitions.ChannelId.COMPLETED_DOWNLOADS; } - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, channelId, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, channelId, null /* remoteAppPackageName */, new NotificationMetadata(LegacyHelpers.isLegacyDownload( downloadUpdate.getContentId()) @@ -383,7 +383,7 @@ * @param builder The builder to build notification. * @param subText A string shown as sub text on the notification. */ - private static void setSubText(ChromeNotificationBuilder builder, String subText) { + private static void setSubText(NotificationWrapperBuilder builder, String subText) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { builder.setSubText(subText); } else {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java index c7aecfd..ff968bb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java
@@ -5,18 +5,13 @@ package org.chromium.chrome.browser.externalnav; import android.app.Activity; -import android.content.ActivityNotFoundException; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; import android.provider.Browser; import android.text.TextUtils; -import android.view.WindowManager.BadTokenException; import androidx.annotation.Nullable; @@ -24,7 +19,6 @@ import org.chromium.base.ApplicationStatus; import org.chromium.base.ContextUtils; import org.chromium.base.PackageManagerUtils; -import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeTabbedActivity2; import org.chromium.chrome.browser.IntentHandler; @@ -47,7 +41,6 @@ import org.chromium.components.webapk.lib.client.WebApkValidator; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.WebContents; -import org.chromium.ui.UiUtils; import org.chromium.ui.base.WindowAndroid; import org.chromium.url.Origin; @@ -159,17 +152,6 @@ } @Override - public boolean startIncognitoIntent(final Intent intent, final String referrerUrl, - final String fallbackUrl, final boolean needsToCloseTab, final boolean proxy) { - try { - return startIncognitoIntentInternal( - intent, referrerUrl, fallbackUrl, needsToCloseTab, proxy); - } catch (BadTokenException e) { - return false; - } - } - - @Override public @OverrideUrlLoadingResult int handleIncognitoIntentTargetingSelf( final Intent intent, final String referrerUrl, final String fallbackUrl) { String primaryUrl = intent.getDataString(); @@ -179,58 +161,6 @@ : OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT; } - private boolean startIncognitoIntentInternal(final Intent intent, final String referrerUrl, - final String fallbackUrl, final boolean needsToCloseTab, final boolean proxy) { - if (!hasValidTab()) return false; - Context context = mTab.getWindowAndroid().getContext().get(); - if (ContextUtils.activityFromContext(context) == null) return false; - - new UiUtils.CompatibleAlertDialogBuilder(context, R.style.Theme_Chromium_AlertDialog) - .setTitle(R.string.external_app_leave_incognito_warning_title) - .setMessage(R.string.external_app_leave_incognito_warning) - .setPositiveButton(R.string.external_app_leave_incognito_leave, - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - try { - ExternalNavigationHandler.startActivity( - intent, proxy, ExternalNavigationDelegateImpl.this); - if (mTab != null && !mTab.isClosing() && mTab.isInitialized() - && needsToCloseTab) { - closeTab(); - } - } catch (ActivityNotFoundException e) { - // The activity that we thought was going to handle the intent - // no longer exists, so catch the exception and assume Chrome - // can handle it. - ExternalNavigationHandler.loadUrlFromIntent(referrerUrl, - fallbackUrl, intent.getDataString(), - ExternalNavigationDelegateImpl.this, needsToCloseTab, - true); - } - } - }) - .setNegativeButton(R.string.external_app_leave_incognito_stay, - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - ExternalNavigationHandler.loadUrlFromIntent(referrerUrl, - fallbackUrl, intent.getDataString(), - ExternalNavigationDelegateImpl.this, needsToCloseTab, true); - } - }) - .setOnCancelListener(new OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - ExternalNavigationHandler.loadUrlFromIntent(referrerUrl, fallbackUrl, - intent.getDataString(), ExternalNavigationDelegateImpl.this, - needsToCloseTab, true); - } - }) - .show(); - return true; - } - @Override public boolean supportsCreatingNewTabs() { return true; @@ -386,6 +316,11 @@ } @Override + public boolean canCloseTabOnIncognitoIntentLaunch() { + return (mTab != null && !mTab.isClosing() && mTab.isInitialized()); + } + + @Override public boolean isIntentForTrustedCallingApp(Intent intent) { return false; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java index d1525d0..046731c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java
@@ -11,15 +11,15 @@ import org.chromium.base.ContextUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** * Manages the notification indicating that there are incognito tabs opened in Document mode. @@ -42,9 +42,9 @@ ? context.getResources().getString(R.string.close_all_incognito_notification_title) : context.getResources().getString(R.string.app_name); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.INCOGNITO, null /* remoteAppPackageName */, new NotificationMetadata( @@ -63,7 +63,7 @@ .setLocalOnly(true) .setGroup(NotificationConstants.GROUP_INCOGNITO); NotificationManagerProxy nm = new NotificationManagerProxyImpl(context); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); nm.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown( NotificationUmaTracker.SystemNotificationType.CLOSE_INCOGNITO,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java index 33a1436..4c5fc23 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java
@@ -16,18 +16,18 @@ import org.chromium.base.ContextUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.document.ChromeIntentUtil; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabWindowManager; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.webrtc.MediaCaptureNotificationUtil; import org.chromium.components.webrtc.MediaCaptureNotificationUtil.MediaType; @@ -166,9 +166,9 @@ : ChromeChannelDefinitions.ChannelId.WEBRTC_CAM_AND_MIC; Context appContext = ContextUtils.getApplicationContext(); - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(true /* preferCompat */, - channelId, null /*remoteAppPackageName*/, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + true /* preferCompat */, channelId, null /*remoteAppPackageName*/, new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.MEDIA_CAPTURE, NOTIFICATION_NAMESPACE, notificationId)); @@ -182,7 +182,7 @@ PendingIntent stopIntent = mediaType == MediaType.SCREEN_CAPTURE ? buildStopCapturePendingIntent(notificationId) : null; - ChromeNotification notification = MediaCaptureNotificationUtil.createNotification(builder, + NotificationWrapper notification = MediaCaptureNotificationUtil.createNotification(builder, mediaType, isIncognito ? null : url, appContext.getString(R.string.app_name), contentIntent, stopIntent);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerDelegate.java index a4c7f9e..c950673 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerDelegate.java
@@ -20,15 +20,15 @@ import org.chromium.base.ContextUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.components.browser_ui.media.MediaNotificationController; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.ForegroundServiceUtils; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** A class that provides Chrome-specific behavior to {@link MediaNotificationController}. */ class ChromeMediaNotificationControllerDelegate implements MediaNotificationController.Delegate { @@ -97,7 +97,8 @@ // notification hasn't been shown. On O it will lead to the app crash. // So show an empty notification before stopping the service. MediaNotificationController.finishStartingForegroundServiceOnO(this, - createChromeNotificationBuilder(mNotificationId).buildChromeNotification()); + createNotificationWrapperBuilder(mNotificationId) + .buildNotificationWrapper()); stopListenerService(); } return START_NOT_STICKY; @@ -211,8 +212,8 @@ } @Override - public ChromeNotificationBuilder createChromeNotificationBuilder() { - return createChromeNotificationBuilder(mNotificationId); + public NotificationWrapperBuilder createNotificationWrapperBuilder() { + return createNotificationWrapperBuilder(mNotificationId); } @Override @@ -230,19 +231,19 @@ } @Override - public void logNotificationShown(ChromeNotification notification) { + public void logNotificationShown(NotificationWrapper notification) { NotificationUmaTracker.getInstance().onNotificationShown( NotificationUmaTracker.SystemNotificationType.MEDIA, notification.getNotification()); } - private static ChromeNotificationBuilder createChromeNotificationBuilder(int notificationId) { + private static NotificationWrapperBuilder createNotificationWrapperBuilder(int notificationId) { NotificationMetadata metadata = new NotificationMetadata(NotificationUmaTracker.SystemNotificationType.MEDIA, null /* notificationTag */, notificationId); - return NotificationBuilderFactory.createChromeNotificationBuilder(true /* preferCompat */, - ChromeChannelDefinitions.ChannelId.MEDIA_PLAYBACK, null /* remoteAppPackageName*/, - metadata); + return NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + true /* preferCompat */, ChromeChannelDefinitions.ChannelId.MEDIA_PLAYBACK, + null /* remoteAppPackageName*/, metadata); } private static Context getContext() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationCompatBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperCompatBuilder.java similarity index 73% rename from chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationCompatBuilder.java rename to chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperCompatBuilder.java index 55047c3..52c16226 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationCompatBuilder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperCompatBuilder.java
@@ -7,18 +7,18 @@ import android.app.PendingIntent; import android.content.Context; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; +import org.chromium.components.browser_ui.notifications.NotificationWrapperCompatBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.browser_ui.notifications.channels.ChannelsInitializer; /** - * Extends the base NotificationCompatBuilder to add UMA by way of + * Extends the base NotificationWrapperCompatBuilder to add UMA by way of * {@link NotificationIntentInterceptor}. */ -public class NotificationCompatBuilder - extends org.chromium.components.browser_ui.notifications.NotificationCompatBuilder { - NotificationCompatBuilder(Context context, String channelId, +public class ChromeNotificationWrapperCompatBuilder extends NotificationWrapperCompatBuilder { + ChromeNotificationWrapperCompatBuilder(Context context, String channelId, ChannelsInitializer channelsInitializer, NotificationMetadata metadata) { super(context, channelId, channelsInitializer, metadata); if (metadata != null) { @@ -28,7 +28,7 @@ } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntentProvider contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntentProvider contentIntent) { PendingIntent pendingIntent = NotificationIntentInterceptor.createInterceptPendingIntent( NotificationIntentInterceptor.IntentType.CONTENT_INTENT, 0 /* intentId */, getMetadata(), contentIntent); @@ -36,7 +36,7 @@ } @Override - public ChromeNotificationBuilder addAction(int icon, CharSequence title, + public NotificationWrapperBuilder addAction(int icon, CharSequence title, PendingIntentProvider pendingIntentProvider, @NotificationUmaTracker.ActionType int actionType) { PendingIntent pendingIntent = NotificationIntentInterceptor.createInterceptPendingIntent( @@ -46,7 +46,7 @@ } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntentProvider intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntentProvider intent) { return setDeleteIntent(NotificationIntentInterceptor.createInterceptPendingIntent( NotificationIntentInterceptor.IntentType.DELETE_INTENT, 0 /* intentId */, getMetadata(), intent));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperStandardBuilder.java similarity index 71% rename from chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java rename to chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperStandardBuilder.java index 170d3e5..a0f49f3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperStandardBuilder.java
@@ -8,18 +8,19 @@ import android.app.PendingIntent; import android.content.Context; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; +import org.chromium.components.browser_ui.notifications.NotificationWrapperStandardBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.browser_ui.notifications.channels.ChannelsInitializer; /** - * Extends the base NotificationBuilder to add UMA by way of {@link NotificationIntentInterceptor}. + * Extends the base {@link NotificationWrapperStandardBuilder} to add UMA by way of {@link + * NotificationIntentInterceptor}. */ -public class NotificationBuilder - extends org.chromium.components.browser_ui.notifications.NotificationBuilder { - NotificationBuilder(Context context, String channelId, ChannelsInitializer channelsInitializer, - NotificationMetadata metadata) { +public class ChromeNotificationWrapperStandardBuilder extends NotificationWrapperStandardBuilder { + ChromeNotificationWrapperStandardBuilder(Context context, String channelId, + ChannelsInitializer channelsInitializer, NotificationMetadata metadata) { super(context, channelId, channelsInitializer, metadata); if (metadata != null) { getBuilder().setDeleteIntent( @@ -28,7 +29,7 @@ } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntentProvider contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntentProvider contentIntent) { PendingIntent pendingIntent = NotificationIntentInterceptor.createInterceptPendingIntent( NotificationIntentInterceptor.IntentType.CONTENT_INTENT, 0 /* intentId */, getMetadata(), contentIntent); @@ -36,7 +37,7 @@ } @Override - public ChromeNotificationBuilder addAction(int icon, CharSequence title, + public NotificationWrapperBuilder addAction(int icon, CharSequence title, PendingIntentProvider pendingIntentProvider, @NotificationUmaTracker.ActionType int actionType) { PendingIntent pendingIntent = NotificationIntentInterceptor.createInterceptPendingIntent( @@ -46,7 +47,7 @@ } @Override - public ChromeNotificationBuilder addAction(Notification.Action action, int flags, + public NotificationWrapperBuilder addAction(Notification.Action action, int flags, @NotificationUmaTracker.ActionType int actionType) { PendingIntent pendingIntent = NotificationIntentInterceptor.createInterceptPendingIntent( NotificationIntentInterceptor.IntentType.ACTION_INTENT, actionType, getMetadata(), @@ -57,7 +58,7 @@ } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntentProvider intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntentProvider intent) { return setDeleteIntent(NotificationIntentInterceptor.createInterceptPendingIntent( NotificationIntentInterceptor.IntentType.DELETE_INTENT, 0 /* intentId */, getMetadata(), intent));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java index af13040a..b3b9435 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java
@@ -23,9 +23,9 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.StrictModeContext; import org.chromium.chrome.R; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.ui.base.LocalizationUtils; import java.util.Date; @@ -85,7 +85,7 @@ } @Override - public ChromeNotification build(NotificationMetadata metadata) { + public NotificationWrapper build(NotificationMetadata metadata) { // A note about RemoteViews and updating notifications. When a notification is passed to the // {@code NotificationManager} with the same tag and id as a previous notification, an // in-place update will be performed. In that case, the actions of all new @@ -133,9 +133,10 @@ // Note: under the hood this is not a NotificationCompat builder so be mindful of the // API level of methods you call on the builder. // TODO(crbug.com/697104) We should probably use a Compat builder. - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(false /* preferCompat */, - mChannelId, mRemotePackageForBuilderContext, metadata); + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + false /* preferCompat */, mChannelId, mRemotePackageForBuilderContext, + metadata); builder.setTicker(mTickerText); builder.setContentIntent(mContentIntent); builder.setDeleteIntent(mDeleteIntent);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java index 1195ba6..65dea7ff 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java
@@ -25,9 +25,9 @@ import androidx.annotation.VisibleForTesting; import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.browser_ui.widget.RoundedIconGenerator; @@ -166,7 +166,7 @@ /** * Combines all of the options that have been set and returns a new Notification object. */ - public abstract ChromeNotification build(NotificationMetadata metadata); + public abstract NotificationWrapper build(NotificationMetadata metadata); /** * Sets the title text of the notification. @@ -473,9 +473,9 @@ @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected Notification createPublicNotification(Context context) { // Use a non-compat builder because we want the default small icon behaviour. - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(false /* preferCompat */, mChannelId) + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(false /* preferCompat */, mChannelId) .setContentText(context.getString( org.chromium.chrome.R.string.notification_hidden_text)) .setSmallIcon(org.chromium.chrome.R.drawable.ic_chrome); @@ -523,7 +523,7 @@ */ @TargetApi(Build.VERSION_CODES.M) // For the Icon class. protected static void setStatusBarIcon( - ChromeNotificationBuilder builder, int iconId, @Nullable Bitmap iconBitmap) { + NotificationWrapperBuilder builder, int iconId, @Nullable Bitmap iconBitmap) { if (iconBitmap != null) { assert deviceSupportsBitmapStatusBarIcons(); builder.setSmallIcon(Icon.createWithBitmap(iconBitmap)); @@ -562,7 +562,7 @@ * level is high enough, otherwise a resource id is used. */ @SuppressWarnings("deprecation") // For addAction(int, CharSequence, PendingIntent) - protected static void addActionToBuilder(ChromeNotificationBuilder builder, Action action) { + protected static void addActionToBuilder(NotificationWrapperBuilder builder, Action action) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { // Notification.Action.Builder and RemoteInput were added in KITKAT_WATCH. Notification.Action.Builder actionBuilder = getActionBuilder(action); @@ -591,7 +591,7 @@ * posted for notifications in the group to appear grouped in the notification shade. */ @SuppressLint("NewApi") // For setGroup - static void setGroupOnBuilder(ChromeNotificationBuilder builder, CharSequence origin) { + static void setGroupOnBuilder(NotificationWrapperBuilder builder, CharSequence origin) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT_WATCH || origin == null) return; builder.setGroup(NotificationConstants.GROUP_WEB_PREFIX + origin); // TODO(crbug.com/674927) Post a group summary notification.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java index c0a8efd91..39ba8171 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -43,10 +43,10 @@ import org.chromium.chrome.browser.usage_stats.NotificationSuspender; import org.chromium.chrome.browser.webapps.ChromeWebApkHost; import org.chromium.chrome.browser.webapps.WebApkServiceClient; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; import org.chromium.components.browser_ui.site_settings.SingleWebsiteSettings; @@ -546,7 +546,7 @@ return; } - ChromeNotification notification = buildNotification( + NotificationWrapper notification = buildNotificationWrapper( notificationBuilder, notificationType, notificationId, origin, actions, image); // Store notification if its origin is suspended. @@ -642,9 +642,9 @@ return notificationBuilder; } - private ChromeNotification buildNotification(NotificationBuilderBase notificationBuilder, - @NotificationType int notificationType, String notificationId, String origin, - ActionInfo[] actions, Bitmap image) { + private NotificationWrapper buildNotificationWrapper( + NotificationBuilderBase notificationBuilder, @NotificationType int notificationType, + String notificationId, String origin, ActionInfo[] actions, Bitmap image) { Context context = ContextUtils.getApplicationContext(); Resources res = context.getResources();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactory.java similarity index 75% rename from chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java rename to chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactory.java index 2ccf25a..cf33525 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactory.java
@@ -14,16 +14,16 @@ import org.chromium.base.ContextUtils; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.channels.ChannelsInitializer; /** * Factory which supplies the appropriate type of notification builder based on Android version. * Should be used for all notifications we create, to ensure a notification channel is set on O. */ -public class NotificationBuilderFactory { +public class NotificationWrapperBuilderFactory { /** * Creates either a Notification.Builder or NotificationCompat.Builder under the hood, wrapped * in our own common interface, and ensures the notification channel has been initialized. @@ -35,18 +35,18 @@ * will be created if it did not already exist. Must be a known channel within * {@link ChannelsInitializer#ensureInitialized(String)}. */ - public static ChromeNotificationBuilder createChromeNotificationBuilder( + public static NotificationWrapperBuilder createNotificationWrapperBuilder( boolean preferCompat, String channelId) { - return createChromeNotificationBuilder( + return createNotificationWrapperBuilder( preferCompat, channelId, null /* remoteAppPackageName */, null /* metadata */); } /** - * See {@link #createChromeNotificationBuilder(boolean, String, String, NotificationMetadata)}. + * See {@link #createNotificationWrapperBuilder(boolean, String, String, NotificationMetadata)}. */ - public static ChromeNotificationBuilder createChromeNotificationBuilder( + public static NotificationWrapperBuilder createNotificationWrapperBuilder( boolean preferCompat, String channelId, @Nullable String remoteAppPackageName) { - return createChromeNotificationBuilder( + return createNotificationWrapperBuilder( preferCompat, channelId, remoteAppPackageName, null /* metadata */); } @@ -56,7 +56,7 @@ * and passes it to the builder. * @param metadata Metadata contains notification id, tag, etc. */ - public static ChromeNotificationBuilder createChromeNotificationBuilder(boolean preferCompat, + public static NotificationWrapperBuilder createNotificationWrapperBuilder(boolean preferCompat, String channelId, @Nullable String remoteAppPackageName, @Nullable NotificationMetadata metadata) { Context context = ContextUtils.getApplicationContext(); @@ -65,8 +65,8 @@ try { context = context.createPackageContext(remoteAppPackageName, 0); } catch (PackageManager.NameNotFoundException e) { - throw new RuntimeException("Failed to create context for package " - + remoteAppPackageName, e); + throw new RuntimeException( + "Failed to create context for package " + remoteAppPackageName, e); } } @@ -76,8 +76,9 @@ ChannelsInitializer channelsInitializer = new ChannelsInitializer(notificationManagerProxy, ChromeChannelDefinitions.getInstance(), context.getResources()); - return preferCompat - ? new NotificationCompatBuilder(context, channelId, channelsInitializer, metadata) - : new NotificationBuilder(context, channelId, channelsInitializer, metadata); + return preferCompat ? new ChromeNotificationWrapperCompatBuilder( + context, channelId, channelsInitializer, metadata) + : new ChromeNotificationWrapperStandardBuilder( + context, channelId, channelsInitializer, metadata); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java index f21e14e4..cb7588f2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java
@@ -8,9 +8,9 @@ import android.content.Context; import android.os.Build; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** * Builds a notification using the standard Notification.BigTextStyle layout. @@ -24,13 +24,14 @@ } @Override - public ChromeNotification build(NotificationMetadata metadata) { + public NotificationWrapper build(NotificationMetadata metadata) { // Note: this is not a NotificationCompat builder so be mindful of the // API level of methods you call on the builder. // TODO(crbug.com/697104) We should probably use a Compat builder. - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(false /* preferCompat */, - mChannelId, mRemotePackageForBuilderContext, metadata); + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + false /* preferCompat */, mChannelId, mRemotePackageForBuilderContext, + metadata); builder.setContentTitle(mTitle); builder.setContentText(mBody); @@ -70,6 +71,6 @@ // Public versions only supported since L, and createPublicNotification requires L+. builder.setPublicVersion(createPublicNotification(mContext)); } - return builder.buildChromeNotification(); + return builder.buildNotificationWrapper(); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/README.md b/chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/README.md index a2f7924a..d84182c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/README.md +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/README.md
@@ -8,7 +8,7 @@ Starting with Android O, all notifications must be assigned to a registered notification channel. We enforce this in the codebase by requiring all notifications to be constructed using -`NotificationBuilderFactory.createChromeNotificationBuilder`, which requires a +`NotificationWrapperBuilderFactory.createNotificationWrapperBuilder`, which requires a valid `ChannelId`. For an up-to-date enumeration of what channels exist, see the @@ -52,7 +52,7 @@ 3. To make the test pass (yay TDD), add a corresponding entry to `PredefinedChannels.MAP` in `ChromeChannelDefinitions.java` with the correct channel properties 4. Create notifications via -`NotificationBuilderFactory.createChromeNotificationBuilder`, passing the new +`NotificationWrapperBuilderFactory.createNotificationWrapperBuilder`, passing the new channel id (the custom builder will set the channel on the notification for you, and ensure the channel is initialized before building it) 5. After posting a notification, call `NotificationUmaTracker.onNotificationShown`, passing the new
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/scheduler/DisplayAgent.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/scheduler/DisplayAgent.java index 3ab866b..2658f65a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/scheduler/DisplayAgent.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/scheduler/DisplayAgent.java
@@ -20,15 +20,15 @@ import org.chromium.chrome.browser.init.BrowserParts; import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.EmptyBrowserParts; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationIntentInterceptor; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.chrome.browser.notifications.NotificationUmaTracker.SystemNotificationType; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions.ChannelId; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import java.util.ArrayList; @@ -234,9 +234,10 @@ // mode and provide correct notification id. Support buttons. Context context = ContextUtils.getApplicationContext(); - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(true /* preferCompat */, - platformData.channel, null /* remoteAppPackageName */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + true /* preferCompat */, platformData.channel, + null /* remoteAppPackageName */, new NotificationMetadata(platformData.systemNotificationType, DISPLAY_AGENT_TAG, systemData.guid.hashCode())); builder.setContentTitle(notificationData.title); @@ -297,7 +298,7 @@ NotificationUmaTracker.ActionType.UNKNOWN); } - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); new NotificationManagerProxyImpl(ContextUtils.getApplicationContext()).notify(notification); NotificationUmaTracker.getInstance().onNotificationShown( platformData.systemNotificationType, notification.getNotification());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java index 083a8b3d..c0dc0fc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java
@@ -27,18 +27,18 @@ import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.IntentHandler.TabOpenType; import org.chromium.chrome.browser.init.ChromeBrowserInitializer; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.TabLaunchType; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.offline_items_collection.LaunchLocation; import org.chromium.content_public.browser.LoadUrlParams; @@ -159,9 +159,9 @@ R.plurals.offline_pages_auto_fetch_in_progress_notification_text, inProgressCount); // Create the notification. - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS) .setContentTitle(title) .setGroup(COMPLETE_NOTIFICATION_TAG) @@ -312,9 +312,9 @@ NotificationMetadata metadata = new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.OFFLINE_PAGES, COMPLETE_NOTIFICATION_TAG, notificationId); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS, null /* remoteAppPackageName */, metadata) .setAutoCancel(true) @@ -328,7 +328,7 @@ .setDeleteIntent(PendingIntentProvider.getBroadcast( context, 0 /* requestCode */, deleteIntent, 0 /* flags */)); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); NotificationManagerProxy manager = new NotificationManagerProxyImpl(context); manager.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchedPagesNotifier.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchedPagesNotifier.java index 1b198d39..a98a1de 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchedPagesNotifier.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchedPagesNotifier.java
@@ -17,17 +17,17 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.download.DownloadOpenSource; import org.chromium.chrome.browser.download.DownloadUtils; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.notifications.settings.NotificationSettings; import org.chromium.chrome.browser.settings.SettingsLauncher; import org.chromium.chrome.browser.settings.SettingsLauncherImpl; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.content_public.browser.BrowserStartupController; import org.chromium.content_public.browser.BrowserStartupController.StartupCallback; @@ -122,9 +122,9 @@ NotificationMetadata metadata = new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.OFFLINE_CONTENT_SUGGESTION, NOTIFICATION_TAG, notificationId); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.CONTENT_SUGGESTIONS, null /* remoteAppPackageName */, metadata) .setAutoCancel(true) @@ -142,7 +142,7 @@ NotificationUmaTracker.ActionType.OFFLINE_CONTENT_SUGGESTION_SETTINGS); } - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); NotificationManagerProxy manager = new NotificationManagerProxyImpl(context); manager.notify(notification);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/notification/UpdateNotificationControllerImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/notification/UpdateNotificationControllerImpl.java index 9a3f3045..42a1710 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/notification/UpdateNotificationControllerImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/notification/UpdateNotificationControllerImpl.java
@@ -30,18 +30,18 @@ import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.EmptyBrowserParts; import org.chromium.chrome.browser.lifecycle.Destroyable; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.omaha.OmahaBase; import org.chromium.chrome.browser.omaha.UpdateStatusProvider; import org.chromium.chrome.browser.omaha.UpdateStatusProvider.UpdateStatus; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import java.lang.annotation.Retention; @@ -121,9 +121,9 @@ private void scheduleUpdateNotification() { if (!shouldPushNotification()) return; - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true, ChromeChannelDefinitions.ChannelId.UPDATES, null, new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.UPDATES, @@ -135,7 +135,7 @@ .setContentText(getUpdateNotificationTextBody()); builder.setContentIntent(createContentIntent(mUpdateStatus)); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); NotificationManagerProxy notificationManager = new NotificationManagerProxyImpl(mActivity); notificationManager.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/page_info/OWNERS new file mode 100644 index 0000000..5dcd284d --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/OWNERS
@@ -0,0 +1 @@ +file://components/page_info/android/OWNERS
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java index 013719e..126f670 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
@@ -106,8 +106,13 @@ * Production implementation of the PaymentRequestImpl's Delegate. Gives true answers * about the system. */ - public class PaymentRequestDelegateImpl implements PaymentRequestImpl.Delegate { + public static class PaymentRequestDelegateImpl implements PaymentRequestImpl.Delegate { private final TwaPackageManagerDelegate mPackageManager = new TwaPackageManagerDelegate(); + private final RenderFrameHost mRenderFrameHost; + + /* package */ PaymentRequestDelegateImpl(RenderFrameHost renderFrameHost) { + mRenderFrameHost = renderFrameHost; + } @Override public boolean isOffTheRecord(@Nullable ChromeActivity activity) { @@ -145,6 +150,10 @@ public String getTwaPackageName(@Nullable ChromeActivity activity) { return activity != null ? mPackageManager.getTwaPackageName(activity) : null; } + + private WebContents getWebContents() { + return WebContentsStatics.fromRenderFrameHost(mRenderFrameHost); + } } /** @@ -174,14 +183,14 @@ if (sDelegateForTest != null) { delegate = sDelegateForTest; } else { - delegate = new PaymentRequestDelegateImpl(); + delegate = new PaymentRequestDelegateImpl(mRenderFrameHost); } return new ComponentPaymentRequestImpl( new PaymentRequestImpl(mRenderFrameHost, delegate, sNativeObserverForTest)); } - WebContents getWebContents() { + private WebContents getWebContents() { return WebContentsStatics.fromRenderFrameHost(mRenderFrameHost); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/send_tab_to_self/NotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/send_tab_to_self/NotificationManager.java index 36f6f62..c650df6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/send_tab_to_self/NotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/send_tab_to_self/NotificationManager.java
@@ -25,16 +25,16 @@ import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.ShortcutHelper; import org.chromium.chrome.browser.document.ChromeLauncherActivity; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; /** @@ -151,9 +151,9 @@ String contextText = res.getString( R.string.send_tab_to_self_notification_context_text, uri.getHost(), deviceName); // Build the notification itself. - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.SHARING, null /* remoteAppPackageName */, new NotificationMetadata( @@ -169,7 +169,7 @@ .setVibrate(new long[0]) .setSmallIcon(R.drawable.ic_chrome) .setDefaults(Notification.DEFAULT_ALL); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); manager.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/share/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/share/OWNERS index f27b4834..2bd9cbe 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/share/OWNERS +++ b/chrome/android/java/src/org/chromium/chrome/browser/share/OWNERS
@@ -1,8 +1,5 @@ dtrainor@chromium.org -per-file ChromeProvidedSharingOptionsProvider.java=file://components/send_tab_to_self/OWNERS -per-file ChromeShareExtras.java=file://components/send_tab_to_self/OWNERS -per-file ShareSheet*=file://components/send_tab_to_self/OWNERS per-file ShareDelegate*=file://components/send_tab_to_self/OWNERS per-file ShareButtonController*=file://components/send_tab_to_self/OWNERS
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sharing/SharingNotificationUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/sharing/SharingNotificationUtil.java index 258e1487..2e6d61dd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sharing/SharingNotificationUtil.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sharing/SharingNotificationUtil.java
@@ -17,14 +17,14 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ContextUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.chrome.browser.notifications.NotificationUmaTracker.SystemNotificationType; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; /** @@ -51,9 +51,9 @@ @DrawableRes int smallIconId, @DrawableRes int largeIconId, int color) { Context context = ContextUtils.getApplicationContext(); Resources resources = context.getResources(); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(/*preferCompat=*/true, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(/*preferCompat=*/true, ChromeChannelDefinitions.ChannelId.SHARING, /*remoteAppPackageName=*/null, new NotificationMetadata(type, group, id)) @@ -70,7 +70,7 @@ Bitmap largeIcon = BitmapFactory.decodeResource(resources, largeIconId); if (largeIcon != null) builder.setLargeIcon(largeIcon); } - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); new NotificationManagerProxyImpl(context).notify(notification); NotificationUmaTracker.getInstance().onNotificationShown( @@ -96,9 +96,9 @@ Resources resources = context.getResources(); String contentTitle = resources.getString(R.string.sharing_sending_notification_title, targetName); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(/*preferCompat=*/true, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(/*preferCompat=*/true, ChromeChannelDefinitions.ChannelId.SHARING, /*remoteAppPackageName=*/null, new NotificationMetadata(type, group, id)) @@ -111,7 +111,7 @@ .setProgress(/*max=*/0, /*percentage=*/0, true) .setOngoing(true) .setDefaults(Notification.DEFAULT_ALL); - ChromeNotification notification = builder.buildChromeNotification(); + NotificationWrapper notification = builder.buildNotificationWrapper(); new NotificationManagerProxyImpl(context).notify(notification); NotificationUmaTracker.getInstance().onNotificationShown( @@ -133,9 +133,9 @@ @Nullable PendingIntentProvider tryAgainIntent) { Context context = ContextUtils.getApplicationContext(); Resources resources = context.getResources(); - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(/*preferCompat=*/true, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(/*preferCompat=*/true, ChromeChannelDefinitions.ChannelId.SHARING, /*remoteAppPackageName=*/null, new NotificationMetadata(type, group, id)) @@ -154,7 +154,7 @@ tryAgainIntent, NotificationUmaTracker.ActionType.SHARING_TRY_AGAIN); } - ChromeNotification notification = builder.buildWithBigTextStyle(contentText); + NotificationWrapper notification = builder.buildWithBigTextStyle(contentText); new NotificationManagerProxyImpl(context).notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java index 0c336de..f424cc4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java
@@ -15,9 +15,9 @@ import org.chromium.base.Log; import org.chromium.base.ThreadUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.SettingsLauncher; @@ -27,11 +27,11 @@ import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.chrome.browser.sync.ui.PassphraseActivity; import org.chromium.chrome.browser.sync.ui.TrustedVaultKeyRetrievalProxyActivity; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.signin.base.CoreAccountInfo; import org.chromium.components.signin.identitymanager.ConsentLevel; @@ -131,9 +131,9 @@ // There is no need to provide a group summary notification because the NOTIFICATION_ID_SYNC // notification id ensures there's only one sync notification at a time. - ChromeNotificationBuilder builder = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.BROWSER, null /*remoteAppPackageName*/, new NotificationMetadata( @@ -148,7 +148,7 @@ .setLocalOnly(true) .setGroup(NotificationConstants.GROUP_SYNC); - ChromeNotification notification = builder.buildWithBigTextStyle(text); + NotificationWrapper notification = builder.buildWithBigTextStyle(text); mNotificationManager.notify(notification); NotificationUmaTracker.getInstance().onNotificationShown(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tracing/TracingNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/tracing/TracingNotificationManager.java index 8c3d03bc..5172b4e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tracing/TracingNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tracing/TracingNotificationManager.java
@@ -16,11 +16,11 @@ import org.chromium.base.ContextUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** * Manages notifications displayed while tracing and once tracing is complete. @@ -30,7 +30,7 @@ private static final int TRACING_NOTIFICATION_ID = 100; private static NotificationManagerProxy sNotificationManagerOverride; - private static ChromeNotificationBuilder sTracingActiveNotificationBuilder; + private static NotificationWrapperBuilder sTracingActiveNotificationBuilder; private static int sTracingActiveNotificationBufferPercentage; // Non-translated strings: @@ -115,7 +115,7 @@ } sTracingActiveNotificationBuilder = - createNotificationBuilder() + createNotificationWrapperBuilder() .setContentTitle(title) .setContentText(message) .setOngoing(true) @@ -159,10 +159,10 @@ String title = MSG_STOPPING_NOTIFICATION_TITLE; String message = MSG_STOPPING_NOTIFICATION_MESSAGE; - ChromeNotificationBuilder builder = createNotificationBuilder() - .setContentTitle(title) - .setContentText(message) - .setOngoing(true); + NotificationWrapperBuilder builder = createNotificationWrapperBuilder() + .setContentTitle(title) + .setContentText(message) + .setOngoing(true); showNotification(builder.build()); } @@ -174,8 +174,8 @@ String title = MSG_COMPLETE_NOTIFICATION_TITLE; String message = MSG_COMPLETE_NOTIFICATION_MESSAGE; - ChromeNotificationBuilder builder = - createNotificationBuilder() + NotificationWrapperBuilder builder = + createNotificationWrapperBuilder() .setContentTitle(title) .setContentText(message) .setOngoing(false) @@ -195,9 +195,9 @@ sTracingActiveNotificationBuilder = null; } - private static ChromeNotificationBuilder createNotificationBuilder() { - return NotificationBuilderFactory - .createChromeNotificationBuilder( + private static NotificationWrapperBuilder createNotificationWrapperBuilder() { + return NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder( true /* preferCompat */, ChromeChannelDefinitions.ChannelId.BROWSER) .setVisibility(Notification.VISIBILITY_PUBLIC) .setSmallIcon(R.drawable.ic_chrome)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/usage_stats/NotificationSuspender.java b/chrome/android/java/src/org/chromium/chrome/browser/usage_stats/NotificationSuspender.java index c6e24689..0538e5ac 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/usage_stats/NotificationSuspender.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/usage_stats/NotificationSuspender.java
@@ -26,8 +26,8 @@ import org.chromium.chrome.browser.notifications.NotificationPlatformBridge; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.content_public.browser.BrowserStartupController; import org.chromium.content_public.browser.BrowserStartupController.StartupCallback; @@ -54,7 +54,7 @@ * @param notification The notification to suspend. * @return A {@link Promise} that resolves to whether the given notification got suspended. */ - public static Promise<Boolean> maybeSuspendNotification(ChromeNotification notification) { + public static Promise<Boolean> maybeSuspendNotification(NotificationWrapper notification) { // No need to initialize UsageStatsService if it is disabled. if (!isEnabled()) return Promise.fulfilled(false); return waitForChromeStartup() @@ -84,7 +84,7 @@ } } - private void storeNotificationResources(List<ChromeNotification> notifications) { + private void storeNotificationResources(List<NotificationWrapper> notifications) { if (notifications.isEmpty()) return; String[] ids = new String[notifications.size()]; @@ -118,8 +118,8 @@ } @TargetApi(Build.VERSION_CODES.M) - private List<ChromeNotification> getActiveNotificationsForFqdns(List<String> fqdns) { - List<ChromeNotification> notifications = new ArrayList<>(); + private List<NotificationWrapper> getActiveNotificationsForFqdns(List<String> fqdns) { + List<NotificationWrapper> notifications = new ArrayList<>(); for (StatusBarNotification notification : mNotificationManager.getActiveNotifications()) { if (notification.getId() != NotificationPlatformBridge.PLATFORM_ID) continue; @@ -130,7 +130,7 @@ NotificationMetadata metadata = new NotificationMetadata(NotificationUmaTracker.SystemNotificationType.SITES, tag, NotificationPlatformBridge.PLATFORM_ID); - notifications.add(new ChromeNotification(notification.getNotification(), metadata)); + notifications.add(new NotificationWrapper(notification.getNotification(), metadata)); } return notifications; @@ -156,7 +156,7 @@ return (Bitmap) notification.extras.get(Notification.EXTRA_PICTURE); } - private static String getValidFqdnOrEmptyString(ChromeNotification notification) { + private static String getValidFqdnOrEmptyString(NotificationWrapper notification) { String tag = notification.getMetadata().tag; String origin = NotificationPlatformBridge.getOriginFromNotificationTag(tag); if (TextUtils.isEmpty(origin)) return "";
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java index cc8464fe..b8805bd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java
@@ -16,9 +16,9 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.R; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.url_formatter.SchemeDisplay; import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.webapk.lib.client.WebApkNavigationClient; @@ -67,8 +67,8 @@ private static void showNotification(String notificationId, String shortName, String url, Bitmap icon, String message, PendingIntent clickPendingIntent) { Context context = ContextUtils.getApplicationContext(); - ChromeNotificationBuilder notificationBuilder = - NotificationBuilderFactory.createChromeNotificationBuilder( + NotificationWrapperBuilder notificationBuilder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( false /* preferCompat */, ChromeChannelDefinitions.ChannelId.BROWSER); notificationBuilder.setContentTitle(shortName) .setContentText(message)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java index 40c0d23a..d8d45ef 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActionsNotificationManager.java
@@ -23,15 +23,15 @@ import org.chromium.chrome.browser.dependency_injection.ActivityScope; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.PauseResumeWithNativeObserver; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; import org.chromium.chrome.browser.notifications.NotificationConstants; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.ui.base.Clipboard; @@ -88,7 +88,7 @@ } Context appContext = ContextUtils.getApplicationContext(); - ChromeNotification notification = createNotification(appContext, tab, webappExtras); + NotificationWrapper notification = createNotification(appContext, tab, webappExtras); NotificationManagerProxy nm = new NotificationManagerProxyImpl(appContext); nm.notify(notification); @@ -97,7 +97,7 @@ notification.getNotification()); } - private static ChromeNotification createNotification( + private static NotificationWrapper createNotification( Context appContext, Tab tab, @NonNull WebappExtras webappExtras) { // The pending intents target an activity (instead of a service or a broadcast receiver) so // that the notification tray closes when a user taps the one of the notification action @@ -112,8 +112,8 @@ NotificationMetadata metadata = new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.WEBAPP_ACTIONS, null /* notificationTag */, NotificationConstants.NOTIFICATION_ID_WEBAPP_ACTIONS); - return NotificationBuilderFactory - .createChromeNotificationBuilder(true /* prefer compat */, + return NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* prefer compat */, ChromeChannelDefinitions.ChannelId.WEBAPP_ACTIONS, null /* remoteAppPackageName */, metadata) .setSmallIcon(R.drawable.ic_chrome) @@ -131,7 +131,7 @@ appContext.getResources().getString(R.string.menu_open_in_chrome), openInChromeIntent, NotificationUmaTracker.ActionType.WEB_APP_ACTION_OPEN_IN_CHROME) - .buildChromeNotification(); + .buildNotificationWrapper(); } /** Creates an intent which targets {@link WebappLauncherActivity} with the passed-in action. */
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java index 8cc1d0f..77754a3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java
@@ -23,7 +23,7 @@ import org.chromium.base.test.util.AdvancedMockContext; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -117,8 +117,8 @@ mDownloadServiceManager = new MockDownloadForegroundServiceManager(); mNotification = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS) .setSmallIcon(org.chromium.chrome.R.drawable.ic_file_download_white_24dp) .setContentTitle(FAKE_NOTIFICATION_CHANNEL)
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java index 62e24c4..f746c2c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java
@@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.notifications.NotificationBuilderFactory; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -105,8 +105,8 @@ public void setUp() { mForegroundService = new MockDownloadForegroundService(); mNotification = - NotificationBuilderFactory - .createChromeNotificationBuilder(true /* preferCompat */, + NotificationWrapperBuilderFactory + .createNotificationWrapperBuilder(true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS) .setSmallIcon(org.chromium.chrome.R.drawable.ic_file_download_white_24dp) .setContentTitle("fakeContentTitle")
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java index a8655e9..e480aca 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java
@@ -25,7 +25,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -168,7 +167,6 @@ @Test @LargeTest - @DisabledTest(message = "https://crbug.com/1102755") @UseMethodParameter(AllTypesToAllTypes.class) public void testTabNavigationHistoryDoNotLeakBetweenActivities( String activityType1, String activityType2) throws TimeoutException { @@ -177,14 +175,13 @@ Tab tab1 = activity1.launchUrl( mChromeActivityTestRule, mCustomTabActivityTestRule, mTestPage1); - Tab tab2 = activity2.launchUrl( - mChromeActivityTestRule, mCustomTabActivityTestRule, mTestPage2); - CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab1.getWebContents(), Matchers.notNullValue())); NavigationHistory navigationHistory1 = tab1.getWebContents().getNavigationController().getNavigationHistory(); + Tab tab2 = activity2.launchUrl( + mChromeActivityTestRule, mCustomTabActivityTestRule, mTestPage2); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab2.getWebContents(), Matchers.notNullValue())); NavigationHistory navigationHistory2 =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java index 19c36083..03ee9177 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java
@@ -58,6 +58,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -107,7 +108,9 @@ mTestServer.stopAndDestroyServer(); } - private void requestLocationPermission(Tab tab) throws TimeoutException { + private void requestLocationPermission(Tab tab) throws TimeoutException, ExecutionException { + // If tab is frozen then getWebContents may return null + TestThreadUtils.runOnUiThreadBlocking(() -> tab.loadIfNeeded()); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab.getWebContents(), Matchers.notNullValue())); JavaScriptUtils.executeJavaScriptAndWaitForResult(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java index 9c12650..7ae5e29 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java
@@ -43,6 +43,7 @@ import java.util.Arrays; import java.util.List; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; /** @@ -129,8 +130,8 @@ @Test @LargeTest @UseMethodParameter(TestParams.AllTypesToAllTypes.class) - public void testStorageDoesNotLeakFromActivityToActivity( - String activityType1, String activityType2) throws TimeoutException { + public void testStorageDoesNotLeakFromActivityToActivity(String activityType1, + String activityType2) throws ExecutionException, TimeoutException { ActivityType activity1 = ActivityType.valueOf(activityType1); ActivityType activity2 = ActivityType.valueOf(activityType2); @@ -155,18 +156,24 @@ expected = "true"; } + // Since the test required launching tab2 right after launching tab1 + // it may happen that these tabs were fired in different Activities. + // Due to which tab1 could potentially be marked as frozen and invoking + // getWebContents on it may return null. Please see the javadoc for + // TabImpl#getWebContents. + TestThreadUtils.runOnUiThreadBlocking(() -> tab1.loadIfNeeded()); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab1.getWebContents(), Matchers.notNullValue())); // Set the storage in tab1 assertEquals("true", JavaScriptUtils.runJavascriptWithAsyncResult( tab1.getWebContents(), "set" + type + "()")); - // Checks the storage is set in tab1 assertEquals("true", JavaScriptUtils.runJavascriptWithAsyncResult( tab1.getWebContents(), "has" + type + "()")); + TestThreadUtils.runOnUiThreadBlocking(() -> tab2.loadIfNeeded()); CriteriaHelper.pollUiThread( () -> Criteria.checkThat(tab2.getWebContents(), Matchers.notNullValue())); // Access the storage from tab2
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java index ff0de77..7c1751f9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java
@@ -20,8 +20,8 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; @@ -68,7 +68,7 @@ NotificationBuilderBase notificationBuilder = new NotificationBuilderBase(resources) { @Override - public ChromeNotification build(NotificationMetadata metadata) { + public NotificationWrapper build(NotificationMetadata metadata) { return null; } };
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactoryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactoryTest.java similarity index 74% rename from chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactoryTest.java rename to chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactoryTest.java index 301c25e..ad02a612 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactoryTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactoryTest.java
@@ -22,20 +22,21 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** - * Tests that ChromeNotificationBuilders created using - * {@link NotificationBuilderFactory#createChromeNotificationBuilder(boolean, String)} can be built - * and the notifications they build don't cause a crash when passed to NotificationManager#notify. + * Tests that NotificationWrapperBuilders created using + * {@link NotificationWrapperBuilderFactory#createNotificationWrapperBuilder(boolean, String)} can + * be built and the notifications they build don't cause a crash when passed to + * NotificationManager#notify. */ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) -public class NotificationBuilderFactoryTest { +public class NotificationWrapperBuilderFactoryTest { private static final int TEST_NOTIFICATION_ID = 101; private NotificationManagerProxy mNotificationManager; @@ -69,8 +70,8 @@ @MediumTest @Test public void buildNotificationAndNotifyDoesNotCrash() { - ChromeNotificationBuilder notificationBuilder = - NotificationBuilderFactory.createChromeNotificationBuilder( + NotificationWrapperBuilder notificationBuilder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( false, ChromeChannelDefinitions.ChannelId.BROWSER); Notification notification = notificationBuilder.setContentTitle("Title") @@ -82,8 +83,8 @@ @MediumTest @Test public void buildCompatNotificationAndNotifyDoesNotCrash() { - ChromeNotificationBuilder notificationBuilder = - NotificationBuilderFactory.createChromeNotificationBuilder( + NotificationWrapperBuilder notificationBuilder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( true, ChromeChannelDefinitions.ChannelId.BROWSER); Notification notification = notificationBuilder.setContentTitle("Title") @@ -95,17 +96,17 @@ @MediumTest @Test - public void buildChromeNotification() { - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(true, + public void buildNotificationWrapper() { + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder(true, ChromeChannelDefinitions.ChannelId.BROWSER, null, new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.BROWSER_ACTIONS, null, TEST_NOTIFICATION_ID)); - ChromeNotification notification = builder.setContentTitle("Title") - .setSmallIcon(R.drawable.ic_chrome) - .buildChromeNotification(); + NotificationWrapper notification = builder.setContentTitle("Title") + .setSmallIcon(R.drawable.ic_chrome) + .buildNotificationWrapper(); mNotificationManager.notify(notification); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/OWNERS b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/OWNERS new file mode 100644 index 0000000..5dcd284d --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/OWNERS
@@ -0,0 +1 @@ +file://components/page_info/android/OWNERS
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java index 7e40f3f..668e76e 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java
@@ -39,7 +39,7 @@ import org.chromium.chrome.browser.browserservices.permissiondelegation.TrustedWebActivityPermissionManager; import org.chromium.chrome.browser.notifications.NotificationBuilderBase; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; -import org.chromium.components.browser_ui.notifications.ChromeNotification; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import java.util.ArrayList; import java.util.HashSet; @@ -63,7 +63,8 @@ @Mock private NotificationUmaTracker mNotificationUmaTracker; @Mock private Bitmap mServiceSmallIconBitmap; - @Mock private ChromeNotification mChromeNotification; + @Mock + private NotificationWrapper mNotificationWrapper; @Mock private TrustedWebActivityPermissionManager mDelegatesManager; private TrustedWebActivityClient mClient; @@ -84,7 +85,7 @@ when(mService.getSmallIconBitmap()).thenReturn(mServiceSmallIconBitmap); when(mService.getComponentName()).thenReturn(new ComponentName(CLIENT_PACKAGE_NAME, "")); when(mService.areNotificationsEnabled(any())).thenReturn(true); - when(mNotificationBuilder.build(any())).thenReturn(mChromeNotification); + when(mNotificationBuilder.build(any())).thenReturn(mNotificationWrapper); Set<Token> delegateApps = new HashSet<>(); delegateApps.add(Mockito.mock(Token.class));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotificationTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotificationTest.java index aab5496..10b1469a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotificationTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/ui/view/trustedwebactivity/DisclosureNotificationTest.java
@@ -32,8 +32,8 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityModel; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; /** * Tests for {@link DisclosureNotification}. @@ -77,7 +77,7 @@ public void displaysNotification_highPriority() { mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); - ChromeNotification notification = verifyAndGetNotification(); + NotificationWrapper notification = verifyAndGetNotification(); assertEquals(TWA_DISCLOSURE_INITIAL, notification.getNotification().getChannelId()); } @@ -86,7 +86,7 @@ mModel.set(DISCLOSURE_FIRST_TIME, false); mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); - ChromeNotification notification = verifyAndGetNotification(); + NotificationWrapper notification = verifyAndGetNotification(); assertEquals(TWA_DISCLOSURE_SUBSEQUENT, notification.getNotification().getChannelId()); } @@ -94,7 +94,7 @@ public void dismissesNotification_onStateChange() { mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); - ChromeNotification notification = verifyAndGetNotification(); + NotificationWrapper notification = verifyAndGetNotification(); String tag = notification.getMetadata().tag; int id = notification.getMetadata().id; @@ -106,7 +106,7 @@ public void dismissesNotification_onStop() { mModel.set(DISCLOSURE_STATE, DISCLOSURE_STATE_SHOWN); - ChromeNotification notification = verifyAndGetNotification(); + NotificationWrapper notification = verifyAndGetNotification(); String tag = notification.getMetadata().tag; int id = notification.getMetadata().id; @@ -114,9 +114,9 @@ verify(mNotificationManager).cancel(eq(tag), eq(id)); } - private ChromeNotification verifyAndGetNotification() { - ArgumentCaptor<ChromeNotification> captor = - ArgumentCaptor.forClass(ChromeNotification.class); + private NotificationWrapper verifyAndGetNotification() { + ArgumentCaptor<NotificationWrapper> captor = + ArgumentCaptor.forClass(NotificationWrapper.class); verify(mNotificationManager).notify(captor.capture()); return captor.getValue();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestBase.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestBase.java index 88a471d..69b00d7a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestBase.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestBase.java
@@ -39,8 +39,8 @@ import org.chromium.components.browser_ui.media.MediaNotificationController; import org.chromium.components.browser_ui.media.MediaNotificationInfo; import org.chromium.components.browser_ui.media.MediaNotificationListener; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.ForegroundServiceUtils; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.media_session.mojom.MediaSessionAction; import org.chromium.services.media_session.MediaMetadata; @@ -108,7 +108,7 @@ spy(new MockMediaNotificationController( new ChromeMediaNotificationControllerDelegate(getNotificationId()) { @Override - public void logNotificationShown(ChromeNotification notification) { + public void logNotificationShown(NotificationWrapper notification) { mMockUmaTracker.onNotificationShown( NotificationUmaTracker.SystemNotificationType.MEDIA, notification.getNotification());
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorTest.java index 9d83fb7..126b687 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorTest.java
@@ -33,10 +33,10 @@ import org.chromium.base.metrics.test.ShadowRecordHistogram; import org.chromium.chrome.R; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.testing.local.LocalRobolectricTestRunner; @@ -98,12 +98,12 @@ } // Builds a simple notification used in tests. - private ChromeNotification buildSimpleNotification(String title) { + private NotificationWrapper buildSimpleNotification(String title) { NotificationMetadata metaData = new NotificationMetadata( NotificationUmaTracker.SystemNotificationType.DOWNLOAD_FILES, null, 0); - ChromeNotificationBuilder builder = - NotificationBuilderFactory.createChromeNotificationBuilder(true /* preferCompat */, - ChromeChannelDefinitions.ChannelId.DOWNLOADS, + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS, null /* remoteAppPackageName */, metaData); // Set content intent. @@ -128,7 +128,7 @@ builder.addAction(0, TEST_NOTIFICATION_ACTION_TITLE, actionPendingIntent, NotificationUmaTracker.ActionType.DOWNLOAD_PAUSE); - return builder.buildChromeNotification(); + return builder.buildNotificationWrapper(); } /**
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/page_info/OWNERS b/chrome/android/junit/src/org/chromium/chrome/browser/page_info/OWNERS new file mode 100644 index 0000000..5dcd284d --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/page_info/OWNERS
@@ -0,0 +1 @@ +file://components/page_info/android/OWNERS
diff --git a/chrome/android/trichrome.gni b/chrome/android/trichrome.gni index d11eeb9..21d5a551 100644 --- a/chrome/android/trichrome.gni +++ b/chrome/android/trichrome.gni
@@ -216,7 +216,8 @@ ssargs_lines = [ "# Written by build target \"${target_name}.\"", "Library -f ${invoker.trichrome_library_basename}", - "Chrome -f ${invoker.trichrome_chrome_basename}", + "# Add --no-native to Chrome as workaround for crbug.com/1103271.", + "Chrome -f ${invoker.trichrome_chrome_basename} --no-native", "WebView -f ${invoker.trichrome_webview_basename}", ]
diff --git a/chrome/android/webapk/shell_apk/AndroidManifest.xml b/chrome/android/webapk/shell_apk/AndroidManifest.xml index 52d3b20..a1d47fd 100644 --- a/chrome/android/webapk/shell_apk/AndroidManifest.xml +++ b/chrome/android/webapk/shell_apk/AndroidManifest.xml
@@ -26,6 +26,14 @@ android:minSdkVersion="21" android:targetSdkVersion="29" /> + <queries> + <intent> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data android:scheme="https" /> + </intent> + </queries> + <application android:icon="@mipmap/ic_launcher" android:label="@string/short_name"
diff --git a/chrome/android/webapk/shell_apk/current_version/current_version.gni b/chrome/android/webapk/shell_apk/current_version/current_version.gni index 0736e76..92feb52 100644 --- a/chrome/android/webapk/shell_apk/current_version/current_version.gni +++ b/chrome/android/webapk/shell_apk/current_version/current_version.gni
@@ -12,4 +12,4 @@ # //chrome/android/webapk/shell_apk:webapk is changed. This includes # Java files, Android resource files and AndroidManifest.xml. Does not affect # Chrome.apk -current_shell_apk_version = 130 +current_shell_apk_version = 131
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 4e092e6..6ee6c01 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5937,7 +5937,10 @@ other {Successfully changed the compromised password. You have # more compromised passwords. Chrome recommends checking these passwords now.}} </message> <message name="IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE" desc="The content of the bubble notifying that there are more problems to fix after the user changed a compromised password."> - Successfully changed the compromised password. Check your passwords anytime in Settings. + Successfully changed the compromised password. Check your passwords anytime in <ph name="SETTINGS">$1<ex>Settings</ex></ph>. + </message> + <message name="IDS_PASSWORD_MANAGER_SAFE_STATE_SETTINGS" meaning="The hyperlink text referring to Chrome settings. It replaces the placeholder in 'Check your passwords anytime in $1' string"> + Settings </message> <message name="IDS_PASSWORD_MANAGER_UNSAFE_STATE_BODY_MESSAGE" desc="The content of the bubble notifying that there are problems to fix after the user saved a password."> {COUNT, plural,
diff --git a/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE.png.sha1 b/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE.png.sha1 index 167f37f..b327f2b 100644 --- a/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE.png.sha1
@@ -1 +1 @@ -9fe0106484ed13d5df7e4731dbdb41ea77360ff9 \ No newline at end of file +5f13f448b0799bdac7fd5be668b0cfcacb2ec32b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_SETTINGS.png.sha1 b/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_SETTINGS.png.sha1 new file mode 100644 index 0000000..b327f2b --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_PASSWORD_MANAGER_SAFE_STATE_SETTINGS.png.sha1
@@ -0,0 +1 @@ +5f13f448b0799bdac7fd5be668b0cfcacb2ec32b \ No newline at end of file
diff --git a/chrome/app/nearby_share_strings.grdp b/chrome/app/nearby_share_strings.grdp index 8007f6c..6d55d10 100644 --- a/chrome/app/nearby_share_strings.grdp +++ b/chrome/app/nearby_share_strings.grdp
@@ -31,6 +31,9 @@ </message> <!-- Notification strings --> + <message name="IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE" desc="Text shown as the title of a notfication when receiving data via Nearby Share."> + Receiving <ph name="ATTACHMENTS">$1<ex>3 items</ex></ph> from <ph name="DEVICE_NAME">$2<ex>Ted's Pixel 2</ex></ph> + </message> <message name="IDS_NEARBY_NOTIFICATION_SEND_PROGRESS_TITLE" desc="Text shown as the title of a notfication when sending data via Nearby Share."> Sending <ph name="ATTACHMENTS">$1<ex>3 items</ex></ph> to <ph name="DEVICE_NAME">$2<ex>Ted's Pixel 2</ex></ph> </message>
diff --git a/chrome/app/nearby_share_strings_grdp/IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE.png.sha1 b/chrome/app/nearby_share_strings_grdp/IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE.png.sha1 new file mode 100644 index 0000000..2b793b7 --- /dev/null +++ b/chrome/app/nearby_share_strings_grdp/IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE.png.sha1
@@ -0,0 +1 @@ +b33ed87de53a989f6ad4edbe1fcc4bd73239a1b7 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index b611a78..f0bd78977 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2894,6 +2894,7 @@ "//chrome/browser/offline_pages/prefetch/notifications", "//chrome/browser/optimization_guide/android:jni_headers", "//chrome/browser/password_check/android", + "//chrome/browser/password_check/android/internal", "//chrome/browser/payments/android:jni_headers", "//chrome/browser/safety_check/android", "//chrome/browser/share", @@ -3127,8 +3128,6 @@ "enterprise/reporting/notification/extension_request_observer_factory.h", "enterprise/reporting/prefs.cc", "enterprise/reporting/prefs.h", - "enterprise/reporting/profile_report_generator.cc", - "enterprise/reporting/profile_report_generator.h", "enterprise/reporting/profile_report_generator_desktop.cc", "enterprise/reporting/profile_report_generator_desktop.h", "enterprise/reporting/report_generator.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index a2324653..63920c9 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -5832,6 +5832,9 @@ flag_descriptions::kNewDragSpecInLauncherName, flag_descriptions::kNewDragSpecInLauncherDescription, kOsCrOS, FEATURE_VALUE_TYPE(app_list_features::kNewDragSpecInLauncher)}, + {"cdm-factory-daemon", flag_descriptions::kCdmFactoryDaemonName, + flag_descriptions::kCdmFactoryDaemonDescription, kOsCrOS, + FEATURE_VALUE_TYPE(chromeos::features::kCdmFactoryDaemon)}, #endif // OS_CHROMEOS {"autofill-enable-offers-in-downstream",
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 62c66d2..11f12554 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -1360,6 +1360,16 @@ return service_manager::RESULT_CODE_NORMAL_EXIT; #if defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) + if (first_run::IsChromeFirstRun()) { + // The installed Windows language packs aren't determined until + // the spellcheck service is initialized. Make sure the primary + // preferred language is enabled for spellchecking until the user + // opts out later. If there is no dictionary support for the language + // then it will later be automatically disabled. + SpellcheckService::EnableFirstUserLanguageForSpellcheck( + profile_->GetPrefs()); + } + // Create the spellcheck service. This will asynchronously retrieve the // Windows platform spellcheck dictionary language tags used to populate the // context menu for editable content.
diff --git a/chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_data.cc index 17a18fb..399b4bc 100644 --- a/chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_data.cc +++ b/chrome/browser/chromeos/app_mode/web_app/web_kiosk_app_data.cc
@@ -210,8 +210,8 @@ if (delegate_) delegate_->GetKioskAppIconCacheDir(&cache_dir); - auto it = app_info->icon_bitmaps.find(kIconSize); - if (it != app_info->icon_bitmaps.end()) { + auto it = app_info->icon_bitmaps_any.find(kIconSize); + if (it != app_info->icon_bitmaps_any.end()) { const SkBitmap& bitmap = it->second; icon_ = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); icon_.MakeThreadSafe();
diff --git a/chrome/browser/chromeos/apps/apk_web_app_installer.cc b/chrome/browser/chromeos/apps/apk_web_app_installer.cc index b76b421..9576875 100644 --- a/chrome/browser/chromeos/apps/apk_web_app_installer.cc +++ b/chrome/browser/chromeos/apps/apk_web_app_installer.cc
@@ -145,7 +145,7 @@ DCHECK(web_app_info_); if (decoded_image.width() == decoded_image.height()) - web_app_info_->icon_bitmaps[decoded_image.width()] = decoded_image; + web_app_info_->icon_bitmaps_any[decoded_image.width()] = decoded_image; if (!weak_owner_.get()) { // Assume |profile_| is no longer valid - destroy this object and
diff --git a/chrome/browser/chromeos/apps/apk_web_app_installer_unittest.cc b/chrome/browser/chromeos/apps/apk_web_app_installer_unittest.cc index cca5f15..3f84345 100644 --- a/chrome/browser/chromeos/apps/apk_web_app_installer_unittest.cc +++ b/chrome/browser/chromeos/apps/apk_web_app_installer_unittest.cc
@@ -122,9 +122,9 @@ static_cast<int32_t>( apk_web_app_installer.web_app_info().theme_color.value())); - EXPECT_EQ(1u, apk_web_app_installer.web_app_info().icon_bitmaps.size()); + EXPECT_EQ(1u, apk_web_app_installer.web_app_info().icon_bitmaps_any.size()); EXPECT_FALSE(apk_web_app_installer.web_app_info() - .icon_bitmaps.at(kGeneratedIconSize) + .icon_bitmaps_any.at(kGeneratedIconSize) .drawsNothing()); }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc index 723f63f3..4185fda 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc
@@ -389,11 +389,14 @@ return false; } + SelectFileDialogExtension::Owner owner; + owner.window = owner_window; + owner.android_task_id = task_id; select_file_dialog_->SelectFileWithFileManagerParams( type, /*title=*/base::string16(), default_path, file_types, - /*file_type_index=*/0, owner_window, - /*params=*/nullptr, task_id, show_android_picker_apps); + /*file_type_index=*/0, + /*params=*/nullptr, owner, show_android_picker_apps); return true; }
diff --git a/chrome/browser/chromeos/crosapi/DEPS b/chrome/browser/chromeos/crosapi/DEPS index b5f0770..c995110 100644 --- a/chrome/browser/chromeos/crosapi/DEPS +++ b/chrome/browser/chromeos/crosapi/DEPS
@@ -6,5 +6,7 @@ "select_file_crosapi\.cc": [ # For window parenting. "+ash/shell.h", + # For Chrome OS-specific file manager parameters. + "+chrome/browser/ui/views/select_file_dialog_extension.h", ], }
diff --git a/chrome/browser/chromeos/crosapi/select_file_crosapi.cc b/chrome/browser/chromeos/crosapi/select_file_crosapi.cc index bd2dde84..984db74 100644 --- a/chrome/browser/chromeos/crosapi/select_file_crosapi.cc +++ b/chrome/browser/chromeos/crosapi/select_file_crosapi.cc
@@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/numerics/ranges.h" +#include "chrome/browser/ui/views/select_file_dialog_extension.h" #include "chromeos/crosapi/mojom/select_file.mojom.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_policy.h" @@ -20,6 +21,9 @@ namespace { +// TODO(https://crbug.com/1090587): Replace with window ID from Wayland client. +int g_next_window_id = 0; + ui::SelectFileDialog::Type GetUiType( crosapi::mojom::SelectFileDialogType type) { switch (type) { @@ -60,13 +64,16 @@ // Policy is null because showing the file-dialog-blocked infobar is handled // client-side in lacros-chrome. select_file_dialog_ = - ui::SelectFileDialog::Create(this, /*policy=*/nullptr); + SelectFileDialogExtension::Create(this, /*policy=*/nullptr); + SelectFileDialogExtension::Owner owner; // TODO(https://crbug.com/1090587): Parent to the ShellSurface that spawned // the dialog. For now, just put it on the default desktop. - aura::Window* owning_window = ash::Shell::GetContainer( + owner.window = ash::Shell::GetContainer( ash::Shell::GetRootWindowForNewWindows(), ash::kShellWindowId_DefaultContainerDeprecated); + // TODO(https://crbug.com/1090587): Replace with ID from Wayland client. + owner.lacros_window_id = g_next_window_id++; int file_type_index = 0; if (options->file_types) { @@ -88,11 +95,11 @@ GetUiAllowedPaths(options->file_types->allowed_paths); } // |default_extension| is unused on Chrome OS. - select_file_dialog_->SelectFile( + select_file_dialog_->SelectFileWithFileManagerParams( GetUiType(options->type), options->title, options->default_path, - file_types_.get(), file_type_index, /*default_extension=*/std::string(), - owning_window, - /*params=*/nullptr); + file_types_.get(), file_type_index, + /*params=*/nullptr, owner, + /*show_android_picker_apps=*/false); } SelectFileDialogHolder(const SelectFileDialogHolder&) = delete; @@ -154,7 +161,7 @@ crosapi::mojom::SelectFile::SelectCallback select_callback_; // The file select dialog. - scoped_refptr<ui::SelectFileDialog> select_file_dialog_; + scoped_refptr<SelectFileDialogExtension> select_file_dialog_; // Optional file type extension filters. std::unique_ptr<ui::SelectFileDialog::FileTypeInfo> file_types_;
diff --git a/chrome/browser/chromeos/input_method/ui/candidate_view.cc b/chrome/browser/chromeos/input_method/ui/candidate_view.cc index e5f6b264..c5c517c9 100644 --- a/chrome/browser/chromeos/input_method/ui/candidate_view.cc +++ b/chrome/browser/chromeos/input_method/ui/candidate_view.cc
@@ -201,11 +201,11 @@ void CandidateView::StateChanged(ButtonState old_state) { Button::StateChanged(old_state); - int text_style = state() == STATE_DISABLED ? views::style::STYLE_DISABLED - : views::style::STYLE_PRIMARY; + int text_style = GetState() == STATE_DISABLED ? views::style::STYLE_DISABLED + : views::style::STYLE_PRIMARY; shortcut_label_->SetEnabledColor(views::style::GetColor( *shortcut_label_, views::style::CONTEXT_LABEL, text_style)); - if (state() == STATE_PRESSED) + if (GetState() == STATE_PRESSED) SetHighlighted(true); }
diff --git a/chrome/browser/chromeos/input_method/ui/suggestion_window_view.cc b/chrome/browser/chromeos/input_method/ui/suggestion_window_view.cc index 6ce8b9cde..a087e62 100644 --- a/chrome/browser/chromeos/input_method/ui/suggestion_window_view.cc +++ b/chrome/browser/chromeos/input_method/ui/suggestion_window_view.cc
@@ -46,8 +46,8 @@ namespace { bool ShouldHighlight(const views::Button& button) { - return button.state() == views::Button::STATE_HOVERED || - button.state() == views::Button::STATE_PRESSED; + return button.GetState() == views::Button::STATE_HOVERED || + button.GetState() == views::Button::STATE_PRESSED; } // TODO(b/1101669): Create abstract HighlightableButton for learn_more button,
diff --git a/chrome/browser/chromeos/login/kiosk_launch_controller.cc b/chrome/browser/chromeos/login/kiosk_launch_controller.cc index 39ea5b47..33f5276 100644 --- a/chrome/browser/chromeos/login/kiosk_launch_controller.cc +++ b/chrome/browser/chromeos/login/kiosk_launch_controller.cc
@@ -194,6 +194,8 @@ if (KioskAppManager::Get()->GetDisableBailoutShortcut()) return; + SYSLOG(INFO) << "Canceling kiosk app launch."; + KioskAppLaunchError::Save(KioskAppLaunchError::USER_CANCEL); CleanUp(); chrome::AttemptUserExit(); @@ -262,6 +264,7 @@ } void KioskLaunchController::OnAppInstalling() { + SYSLOG(INFO) << "Kiosk app started installing."; app_state_ = AppState::INSTALLING; if (!splash_screen_view_) return; @@ -273,6 +276,7 @@ } void KioskLaunchController::OnAppPrepared() { + SYSLOG(INFO) << "Kiosk app is ready to launch."; app_state_ = AppState::INSTALLED; if (!splash_screen_view_) @@ -460,6 +464,7 @@ } void KioskLaunchController::MaybeShowNetworkConfigureUI() { + SYSLOG(INFO) << "Network configure UI was requested to be shown."; if (!splash_screen_view_) return; @@ -480,6 +485,7 @@ void KioskLaunchController::ShowNetworkConfigureUI() { if (!profile_) { + SYSLOG(INFO) << "Postponing network dialog till profile is loaded."; splash_screen_view_->UpdateAppLaunchState( AppLaunchSplashScreenView:: APP_LAUNCH_STATE_SHOWING_NETWORK_CONFIGURE_UI); @@ -493,8 +499,10 @@ network_ui_state_ = NetworkUIState::SHOWING; splash_screen_view_->ShowNetworkConfigureUI(); } + void KioskLaunchController::CloseNetworkConfigureScreenIfTimedout() { if (network_ui_state_ == NetworkUIState::SHOWING && network_wait_timedout_) { + SYSLOG(INFO) << "We are back online, closing network configure screen."; splash_screen_view_->ToggleNetworkConfig(false); network_ui_state_ = NetworkUIState::NOT_SHOWING; } @@ -543,6 +551,8 @@ } if (app_state_ == AppState::INSTALLING && !online) { + SYSLOG(WARNING) + << "Connection lost during installation, restarting launcher."; app_state_ = AppState::INIT_NETWORK; app_launcher_->RestartLauncher(); MaybeShowNetworkConfigureUI();
diff --git a/chrome/browser/chromeos/login/security_token_login_browsertest.cc b/chrome/browser/chromeos/login/security_token_login_browsertest.cc index 851ba40..498c7336 100644 --- a/chrome/browser/chromeos/login/security_token_login_browsertest.cc +++ b/chrome/browser/chromeos/login/security_token_login_browsertest.cc
@@ -194,7 +194,8 @@ /*load_extension_immediately=*/true}; }; -IN_PROC_BROWSER_TEST_F(SecurityTokenLoginTest, Basic) { +// TODO(crbug.com/1033936): Disabled due to flakiness. +IN_PROC_BROWSER_TEST_F(SecurityTokenLoginTest, DISABLED_Basic) { // The user pod is displayed with the challenge-response "start" button // instead of the password input field. EXPECT_TRUE(
diff --git a/chrome/browser/chromeos/policy/status_collector/activity_storage.cc b/chrome/browser/chromeos/policy/status_collector/activity_storage.cc index 11d638c8..928bb39 100644 --- a/chrome/browser/chromeos/policy/status_collector/activity_storage.cc +++ b/chrome/browser/chromeos/policy/status_collector/activity_storage.cc
@@ -10,6 +10,7 @@ #include "base/base64.h" #include "base/bind.h" +#include "base/check.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" @@ -39,6 +40,7 @@ ActivityStorage::~ActivityStorage() = default; base::Time ActivityStorage::GetBeginningOfDay(base::Time timestamp) const { + DCHECK(!timestamp.is_max()); return timestamp.LocalMidnight() + day_start_offset_; } @@ -157,6 +159,8 @@ base::Time end, const std::string& activity_id) { DCHECK(start <= end); + DCHECK(!start.is_max()); + DCHECK(!end.is_max()); DictionaryPrefUpdate update(pref_service_, pref_name_); base::Value* activity_times = update.Get(); @@ -198,6 +202,14 @@ } int64_t ActivityStorage::LocalTimeToUtcDayStart(base::Time timestamp) const { + if (timestamp.is_max()) { + // If timestamp is base::Time::Max(), trying to calculate day start + // is not needed, just keep it as is. timestamp like this cannot be part + // of an actual activity interval, it only happens as a threshold for + // activities report. + return timestamp.ToJavaTime(); + } + base::Time::Exploded exploded; base::Time day_start = GetBeginningOfDay(timestamp); // TODO(crbug.com/827386): directly test this time change. Currently it is
diff --git a/chrome/browser/downgrade/snapshot_file_collector.cc b/chrome/browser/downgrade/snapshot_file_collector.cc index 1a8b969..92654da 100644 --- a/chrome/browser/downgrade/snapshot_file_collector.cc +++ b/chrome/browser/downgrade/snapshot_file_collector.cc
@@ -93,14 +93,21 @@ ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS, SnapshotItemId::kBookmarks), // Tab Restore and sessions - SnapshotItemDetails(base::FilePath(sessions::kCurrentTabSessionFileName), - SnapshotItemDetails::ItemType::kFile, + // TODO(crbug.com/1103458): Remove legacy snapshots in M89 + SnapshotItemDetails( + base::FilePath(sessions::kLegacyCurrentTabSessionFileName), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, + SnapshotItemId::kLegacyCurrentTabSession), + SnapshotItemDetails( + base::FilePath(sessions::kLegacyCurrentSessionFileName), + SnapshotItemDetails::ItemType::kFile, + ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, + SnapshotItemId::kLegacyCurrentSession), + SnapshotItemDetails(base::FilePath(sessions::kSessionsDirectory), + SnapshotItemDetails::ItemType::kDirectory, ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, - SnapshotItemId::kCurrentTabSession), - SnapshotItemDetails(base::FilePath(sessions::kCurrentSessionFileName), - SnapshotItemDetails::ItemType::kFile, - ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, - SnapshotItemId::kCurrentSession), + SnapshotItemId::kSessions), // Sign-in state SnapshotItemDetails(base::FilePath(profiles::kGAIAPictureFileName), SnapshotItemDetails::ItemType::kFile, 0,
diff --git a/chrome/browser/downgrade/snapshot_file_collector.h b/chrome/browser/downgrade/snapshot_file_collector.h index d39591e..04fb9a4 100644 --- a/chrome/browser/downgrade/snapshot_file_collector.h +++ b/chrome/browser/downgrade/snapshot_file_collector.h
@@ -23,8 +23,8 @@ kFavicons = 6, kTopSites = 7, kBookmarks = 8, - kCurrentTabSession = 9, - kCurrentSession = 10, + kLegacyCurrentTabSession = 9, // TODO(crbug.com/1103458): Remove in M89 + kLegacyCurrentSession = 10, // TODO(crbug.com/1103458): Remove in M89 kGAIAPicture = 11, kAffiliationDatabase = 12, kLoginDataForProfile = 13, @@ -34,7 +34,8 @@ kCookie = 17, kProfileIcon = 18, kLastVersion = 19, - kMaxValue = kLastVersion + kSessions = 20, + kMaxValue = kSessions }; struct SnapshotItemDetails {
diff --git a/chrome/browser/enterprise/connectors/common.cc b/chrome/browser/enterprise/connectors/common.cc index de1abe0d..c5d5daf4 100644 --- a/chrome/browser/enterprise/connectors/common.cc +++ b/chrome/browser/enterprise/connectors/common.cc
@@ -41,4 +41,51 @@ } } +ContentAnalysisResponse::Result::TriggeredRule::Action +GetHighestPrecedenceAction(const ContentAnalysisResponse& response) { + auto action = + ContentAnalysisResponse::Result::TriggeredRule::ACTION_UNSPECIFIED; + + for (const auto& result : response.results()) { + if (!result.has_status() || + result.status() != ContentAnalysisResponse::Result::SUCCESS) { + continue; + } + + for (const auto& rule : result.triggered_rules()) + action = GetHighestPrecedenceAction(action, rule.action()); + } + return action; +} + +ContentAnalysisResponse::Result::TriggeredRule::Action +GetHighestPrecedenceAction( + const ContentAnalysisResponse::Result::TriggeredRule::Action& action_1, + const ContentAnalysisResponse::Result::TriggeredRule::Action& action_2) { + // Don't use the enum's int values to determine precedence since that + // may introduce bugs for new actions later. + // + // The current precedence is BLOCK > WARN > REPORT_ONLY > UNSPECIFIED + if (action_1 == ContentAnalysisResponse::Result::TriggeredRule::BLOCK || + action_2 == ContentAnalysisResponse::Result::TriggeredRule::BLOCK) { + return ContentAnalysisResponse::Result::TriggeredRule::BLOCK; + } + if (action_1 == ContentAnalysisResponse::Result::TriggeredRule::WARN || + action_2 == ContentAnalysisResponse::Result::TriggeredRule::WARN) { + return ContentAnalysisResponse::Result::TriggeredRule::WARN; + } + if (action_1 == ContentAnalysisResponse::Result::TriggeredRule::REPORT_ONLY || + action_2 == ContentAnalysisResponse::Result::TriggeredRule::REPORT_ONLY) { + return ContentAnalysisResponse::Result::TriggeredRule::REPORT_ONLY; + } + if (action_1 == + ContentAnalysisResponse::Result::TriggeredRule::ACTION_UNSPECIFIED || + action_2 == + ContentAnalysisResponse::Result::TriggeredRule::ACTION_UNSPECIFIED) { + return ContentAnalysisResponse::Result::TriggeredRule::ACTION_UNSPECIFIED; + } + NOTREACHED(); + return ContentAnalysisResponse::Result::TriggeredRule::ACTION_UNSPECIFIED; +} + } // namespace enterprise_connectors
diff --git a/chrome/browser/enterprise/connectors/common.h b/chrome/browser/enterprise/connectors/common.h index ff73682f..5bd43c8e 100644 --- a/chrome/browser/enterprise/connectors/common.h +++ b/chrome/browser/enterprise/connectors/common.h
@@ -70,6 +70,14 @@ const char* ConnectorPref(AnalysisConnector connector); const char* ConnectorPref(ReportingConnector connector); +// Returns the highest precedence action in the given parameters. +ContentAnalysisResponse::Result::TriggeredRule::Action +GetHighestPrecedenceAction(const ContentAnalysisResponse& response); +ContentAnalysisResponse::Result::TriggeredRule::Action +GetHighestPrecedenceAction( + const ContentAnalysisResponse::Result::TriggeredRule::Action& action_1, + const ContentAnalysisResponse::Result::TriggeredRule::Action& action_2); + } // namespace enterprise_connectors #endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_COMMON_H_
diff --git a/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc index 5cdd13e3..d1700e6 100644 --- a/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc +++ b/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc
@@ -12,7 +12,6 @@ #include "base/test/bind_test_util.h" #include "base/version.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" #include "chrome/browser/enterprise/reporting/reporting_delegate_factory_desktop.h" #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/upgrade_detector/build_state.h" @@ -20,6 +19,7 @@ #include "chrome/test/base/testing_profile_manager.h" #include "components/account_id/account_id.h" #include "components/enterprise/browser/reporting/browser_report_generator.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "content/public/browser/plugin_service.h" #include "content/public/common/webplugininfo.h" #include "content/public/test/browser_task_environment.h"
diff --git a/chrome/browser/enterprise/reporting/extension_info_unittest.cc b/chrome/browser/enterprise/reporting/extension_info_unittest.cc index 0e134d2..19c3526 100644 --- a/chrome/browser/enterprise/reporting/extension_info_unittest.cc +++ b/chrome/browser/enterprise/reporting/extension_info_unittest.cc
@@ -4,10 +4,10 @@ #include "chrome/browser/enterprise/reporting/extension_info.h" -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service_test_base.h" #include "chrome/test/base/testing_profile.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "extensions/common/extension_builder.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/value_builder.h"
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h index fb5bb88..d6bc8c43 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h +++ b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h
@@ -9,7 +9,7 @@ #include <string> #include "base/macros.h" -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "components/policy/core/browser/policy_conversions_client.h" #include "components/policy/proto/device_management_backend.pb.h"
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc index ae01177..1b087b8a 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc +++ b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "base/json/json_reader.h" #include "base/strings/string16.h"
diff --git a/chrome/browser/enterprise/reporting/report_request_queue_generator.h b/chrome/browser/enterprise/reporting/report_request_queue_generator.h index 37ea5e01..936afb75 100644 --- a/chrome/browser/enterprise/reporting/report_request_queue_generator.h +++ b/chrome/browser/enterprise/reporting/report_request_queue_generator.h
@@ -11,7 +11,7 @@ #include "base/callback_forward.h" #include "base/macros.h" #include "build/build_config.h" -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include "components/enterprise/browser/reporting/report_request_definition.h" #include "components/policy/proto/device_management_backend.pb.h"
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index 25038cf..ad958c5 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -241,7 +241,7 @@ web_app_info->open_as_window = false; if (!image_result.image.IsEmpty()) { - web_app_info->icon_bitmaps[image_result.image.Width()] = + web_app_info->icon_bitmaps_any[image_result.image.Width()] = image_result.image.AsBitmap(); }
diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index 3c49991..62ced6e 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc
@@ -296,7 +296,7 @@ } auto icons = std::make_unique<base::DictionaryValue>(); for (const std::pair<const SquareSizePx, SkBitmap>& icon : - web_app.icon_bitmaps) { + web_app.icon_bitmaps_any) { std::string size = base::StringPrintf("%i", icon.first); std::string icon_path = base::StringPrintf("%s/%s.png", kIconsDirName, size.c_str()); @@ -383,7 +383,7 @@ return nullptr; } for (const std::pair<const SquareSizePx, SkBitmap>& icon : - web_app.icon_bitmaps) { + web_app.icon_bitmaps_any) { DCHECK_NE(icon.second.colorType(), kUnknown_SkColorType); base::FilePath icon_file =
diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index f850f23d..8b5ca6c 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc
@@ -293,7 +293,7 @@ web_app.app_url.Resolve(base::StringPrintf("%i.png", sizes[i])); icon_info.square_size_px = sizes[i]; web_app.icon_infos.push_back(std::move(icon_info)); - web_app.icon_bitmaps[sizes[i]] = GetIconBitmap(sizes[i]); + web_app.icon_bitmaps_any[sizes[i]] = GetIconBitmap(sizes[i]); } scoped_refptr<Extension> extension = ConvertWebAppToExtension( @@ -334,10 +334,10 @@ EXPECT_EQ(web_app.icon_infos[i].square_size_px, linked_icons.icons[i].size); } - EXPECT_EQ(web_app.icon_bitmaps.size(), + EXPECT_EQ(web_app.icon_bitmaps_any.size(), IconsInfo::GetIcons(extension.get()).map().size()); for (const std::pair<const SquareSizePx, SkBitmap>& icon : - web_app.icon_bitmaps) { + web_app.icon_bitmaps_any) { int size = icon.first; EXPECT_EQ(base::StringPrintf("icons/%i.png", size), IconsInfo::GetIcons(extension.get())
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index 133eb32..eee9f618 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -146,7 +146,7 @@ web_app_info.description = base::UTF8ToUTF16(description); web_app_info.app_url = GURL(app_url); web_app_info.scope = GURL(app_url); - web_app_info.icon_bitmaps[size] = CreateSquareBitmap(size); + web_app_info.icon_bitmaps_any[size] = CreateSquareBitmap(size); if (create_with_shortcuts) { WebApplicationShortcutsMenuItemInfo shortcut_item; WebApplicationShortcutsMenuItemInfo::Icon icon;
diff --git a/chrome/browser/extensions/extension_management_unittest.cc b/chrome/browser/extensions/extension_management_unittest.cc index 4c153f5..40eb1164 100644 --- a/chrome/browser/extensions/extension_management_unittest.cc +++ b/chrome/browser/extensions/extension_management_unittest.cc
@@ -310,7 +310,7 @@ // Wrappers for legacy admin policy functions, for testing purpose only. bool BlocklistedByDefault(const base::ListValue* blocklist); bool UserMayLoad(const base::ListValue* blocklist, - const base::ListValue* whitelist, + const base::ListValue* allowlist, const base::DictionaryValue* forcelist, const base::ListValue* allowed_types, const Extension* extension, @@ -336,7 +336,7 @@ bool ExtensionAdminPolicyTest::UserMayLoad( const base::ListValue* blocklist, - const base::ListValue* whitelist, + const base::ListValue* allowlist, const base::DictionaryValue* forcelist, const base::ListValue* allowed_types, const Extension* extension, @@ -344,8 +344,8 @@ SetUpPolicyProvider(); if (blocklist) SetPref(true, pref_names::kInstallDenyList, blocklist->CreateDeepCopy()); - if (whitelist) - SetPref(true, pref_names::kInstallAllowList, whitelist->CreateDeepCopy()); + if (allowlist) + SetPref(true, pref_names::kInstallAllowList, allowlist->CreateDeepCopy()); if (forcelist) SetPref(true, pref_names::kInstallForceList, forcelist->CreateDeepCopy()); if (allowed_types) @@ -424,9 +424,9 @@ ExtensionManagement::INSTALLATION_ALLOWED); } -// Verify that preference controlled by legacy ExtensionInstallWhitelist policy +// Verify that preference controlled by legacy ExtensionInstallAllowlist policy // is handled well. -TEST_F(ExtensionManagementServiceTest, LegacyInstallWhitelist) { +TEST_F(ExtensionManagementServiceTest, LegacyAllowlist) { base::ListValue denied_list_pref; denied_list_pref.AppendString("*"); base::ListValue allowed_list_pref; @@ -441,7 +441,7 @@ EXPECT_EQ(GetInstallationModeById(kNonExistingExtension), ExtensionManagement::INSTALLATION_BLOCKED); - // Verify that install whitelist preference set by user is ignored. + // Verify that install allowlist preference set by user is ignored. RemovePref(true, pref_names::kInstallAllowList); SetPref(false, pref_names::kInstallAllowList, allowed_list_pref.CreateDeepCopy()); @@ -549,7 +549,7 @@ EXPECT_TRUE(base::Contains(allowed_types, Manifest::TYPE_THEME)); EXPECT_TRUE(base::Contains(allowed_types, Manifest::TYPE_USER_SCRIPT)); - // Verifies blocked permission list settings. + // Verifies blocked permission allowlist settings. APIPermissionSet api_permission_set; api_permission_set.clear(); api_permission_set.insert(APIPermission::kFileSystem); @@ -756,8 +756,8 @@ } // Tests functionality of new preference as to deprecate legacy -// ExtensionInstallWhitelist policy. -TEST_F(ExtensionManagementServiceTest, NewInstallWhitelist) { +// ExtensionInstallAllowlist policy. +TEST_F(ExtensionManagementServiceTest, NewAllowlist) { // Set the new dictionary preference. { PrefUpdater updater(pref_service_); @@ -957,21 +957,21 @@ EXPECT_TRUE(error.empty()); } -// Tests UserMayLoad for an extension on the whitelist. -TEST_F(ExtensionAdminPolicyTest, UserMayLoadWhitelisted) { +// Tests UserMayLoad for an extension on the allowlist. +TEST_F(ExtensionAdminPolicyTest, UserMayLoadAllowlisted) { CreateExtension(Manifest::INTERNAL); - base::ListValue whitelist; - whitelist.AppendString(extension_->id()); - EXPECT_TRUE(UserMayLoad(nullptr, &whitelist, nullptr, nullptr, + base::ListValue allowlist; + allowlist.AppendString(extension_->id()); + EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, extension_.get(), nullptr)); base::ListValue blocklist; blocklist.AppendString(extension_->id()); - EXPECT_TRUE(UserMayLoad(nullptr, &whitelist, nullptr, nullptr, + EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, extension_.get(), nullptr)); base::string16 error; - EXPECT_TRUE(UserMayLoad(nullptr, &whitelist, nullptr, nullptr, + EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, extension_.get(), &error)); EXPECT_TRUE(error.empty()); } @@ -999,13 +999,13 @@ EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, extension_.get(), nullptr)); - // With a whitelist. There's no such thing as a whitelist wildcard. - base::ListValue whitelist; - whitelist.AppendString("behllobkkfkfnphdnhnkndlbkcpglgmj"); - EXPECT_FALSE(UserMayLoad(&blocklist, &whitelist, nullptr, nullptr, + // With a allowlist. There's no such thing as a allowlist wildcard. + base::ListValue allowlist; + allowlist.AppendString("behllobkkfkfnphdnhnkndlbkcpglgmj"); + EXPECT_FALSE(UserMayLoad(&blocklist, &allowlist, nullptr, nullptr, extension_.get(), nullptr)); - whitelist.AppendString("*"); - EXPECT_FALSE(UserMayLoad(&blocklist, &whitelist, nullptr, nullptr, + allowlist.AppendString("*"); + EXPECT_FALSE(UserMayLoad(&blocklist, &allowlist, nullptr, nullptr, extension_.get(), nullptr)); }
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 4bfc8db5..936773ef 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -487,6 +487,11 @@ "expiry_milestone": 76 }, { + "name": "cdm-factory-daemon", + "owners": [ "jkardatzke", "xhwang", "chromeos-gfx-video@google.com" ], + "expiry_milestone": 91 + }, + { "name": "change-tab-switcher-position", "owners": [ "ewannpv", "gambard" ], "expiry_milestone": 87
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 974e1f1..d14cfca 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3414,6 +3414,10 @@ "OS)"; #endif // defined(OS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) +const char kCdmFactoryDaemonName[] = "CDM Factory Daemon"; +const char kCdmFactoryDaemonDescription[] = + "Use the CDM daemon instead of the library CDM"; + const char kContextualNudgesName[] = "Contextual nudges for user gesture education"; const char kContextualNudgesDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 1c37bcf..2f482668 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1971,6 +1971,9 @@ extern const char kChromeOSDirectVideoDecoderDescription[]; #endif // defined(OS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) +extern const char kCdmFactoryDaemonName[]; +extern const char kCdmFactoryDaemonDescription[]; + extern const char kContextualNudgesName[]; extern const char kContextualNudgesDescription[];
diff --git a/chrome/browser/image_editor/internal/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinatorImpl.java b/chrome/browser/image_editor/internal/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinatorImpl.java index e7c5b03..4b2b328 100644 --- a/chrome/browser/image_editor/internal/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinatorImpl.java +++ b/chrome/browser/image_editor/internal/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinatorImpl.java
@@ -7,6 +7,7 @@ import android.app.Activity; import android.graphics.Bitmap; +import org.chromium.chrome.browser.share.share_sheet.ChromeOptionShareCallback; import org.chromium.chrome.browser.tab.Tab; /** @@ -15,5 +16,6 @@ */ public class ImageEditorDialogCoordinatorImpl implements ImageEditorDialogCoordinator { @Override - public void launchEditor(Activity activity, Bitmap image, Tab mTab) {} + public void launchEditor(Activity activity, Bitmap image, Tab tab, + ChromeOptionShareCallback chromeOptionShareCallback) {} }
diff --git a/chrome/browser/image_editor/public/BUILD.gn b/chrome/browser/image_editor/public/BUILD.gn index f9e26b2..917b098 100644 --- a/chrome/browser/image_editor/public/BUILD.gn +++ b/chrome/browser/image_editor/public/BUILD.gn
@@ -8,6 +8,7 @@ sources = [ "android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinator.java" ] deps = [ + "//chrome/browser/share:java", "//chrome/browser/tab:java", "//third_party/android_deps:android_support_v7_appcompat_java", ]
diff --git a/chrome/browser/image_editor/public/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinator.java b/chrome/browser/image_editor/public/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinator.java index 80a7d3d..75d030c 100644 --- a/chrome/browser/image_editor/public/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinator.java +++ b/chrome/browser/image_editor/public/android/java/src/org/chromium/chrome/browser/image_editor/ImageEditorDialogCoordinator.java
@@ -7,11 +7,13 @@ import android.app.Activity; import android.graphics.Bitmap; +import org.chromium.chrome.browser.share.share_sheet.ChromeOptionShareCallback; import org.chromium.chrome.browser.tab.Tab; /** * Interface to interact with the image editor dialog. */ public interface ImageEditorDialogCoordinator { - public void launchEditor(Activity activity, Bitmap image, Tab mTab); + public void launchEditor(Activity activity, Bitmap image, Tab mTab, + ChromeOptionShareCallback chromeOptionShareCallback); }
diff --git a/chrome/browser/media/platform_verification_impl.cc b/chrome/browser/media/platform_verification_impl.cc index 969f3d1..4f7b72197 100644 --- a/chrome/browser/media/platform_verification_impl.cc +++ b/chrome/browser/media/platform_verification_impl.cc
@@ -19,6 +19,11 @@ #include "content/public/browser/render_process_host.h" #endif +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/settings/cros_settings.h" +#include "chromeos/settings/cros_settings_names.h" +#endif // defined(OS_CHROMEOS) + using media::mojom::PlatformVerification; namespace { @@ -154,3 +159,18 @@ std::move(callback).Run(kCurrentStorageIdVersion, storage_id); } #endif // BUILDFLAG(ENABLE_CDM_STORAGE_ID) + +#if defined(OS_CHROMEOS) +void PlatformVerificationImpl::IsVerifiedAccessEnabled( + IsVerifiedAccessEnabledCallback callback) { + bool enabled_for_device = false; + if (!chromeos::CrosSettings::Get()->GetBoolean( + chromeos::kAttestationForContentProtectionEnabled, + &enabled_for_device)) { + LOG(ERROR) << "Failed to get device setting."; + std::move(callback).Run(false); + return; + } + std::move(callback).Run(enabled_for_device); +} +#endif // defined(OS_CHROMEOS)
diff --git a/chrome/browser/media/platform_verification_impl.h b/chrome/browser/media/platform_verification_impl.h index 8526318..a13311d 100644 --- a/chrome/browser/media/platform_verification_impl.h +++ b/chrome/browser/media/platform_verification_impl.h
@@ -35,6 +35,9 @@ const std::string& challenge, ChallengePlatformCallback callback) final; void GetStorageId(uint32_t version, GetStorageIdCallback callback) final; +#if defined(OS_CHROMEOS) + void IsVerifiedAccessEnabled(IsVerifiedAccessEnabledCallback callback) final; +#endif // defined(OS_CHROMEOS) private: // |this| can only be destructed as a FrameServiceBase.
diff --git a/chrome/browser/nearby_sharing/nearby_notification_manager.cc b/chrome/browser/nearby_sharing/nearby_notification_manager.cc index a4bd0d3..d417161f5 100644 --- a/chrome/browser/nearby_sharing/nearby_notification_manager.cc +++ b/chrome/browser/nearby_sharing/nearby_notification_manager.cc
@@ -90,6 +90,16 @@ return l10n_util::GetPluralStringFUTF16(resource_id, text_count + file_count); } +base::string16 GetNotificationTitle(const ShareTarget& share_target) { + int resource_id = share_target.is_incoming() + ? IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE + : IDS_NEARBY_NOTIFICATION_SEND_PROGRESS_TITLE; + base::string16 attachments = GetAttachmentsString(share_target); + base::string16 device_name = base::ASCIIToUTF16(share_target.device_name()); + + return l10n_util::GetStringFUTF16(resource_id, attachments, device_name); +} + } // namespace NearbyNotificationManager::NearbyNotificationManager(Profile* profile) @@ -107,10 +117,7 @@ message_center::Notification notification( message_center::NOTIFICATION_TYPE_PROGRESS, kNearbyNotificationId, - l10n_util::GetStringFUTF16( - IDS_NEARBY_NOTIFICATION_SEND_PROGRESS_TITLE, - GetAttachmentsString(share_target), - base::ASCIIToUTF16(share_target.device_name())), + GetNotificationTitle(share_target), /*message=*/base::string16(), /*icon=*/gfx::Image(), l10n_util::GetStringUTF16(IDS_NEARBY_NOTIFICATION_SOURCE),
diff --git a/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc b/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc index e965d49..db9d9b9 100644 --- a/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc +++ b/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc
@@ -33,6 +33,11 @@ return *this; } + ShareTargetBuilder& set_is_incoming(bool is_incoming) { + is_incoming_ = is_incoming; + return *this; + } + ShareTargetBuilder& add_attachment(TextAttachment attachment) { text_attachments_.push_back(std::move(attachment)); return *this; @@ -46,14 +51,14 @@ ShareTarget build() const { return ShareTarget(device_name_, /*image_url=*/GURL(), ShareTarget::Type::kPhone, - text_attachments_, file_attachments_, - /*is_incoming=*/false, + text_attachments_, file_attachments_, is_incoming_, /*full_name=*/base::nullopt, /*is_known=*/false); } private: std::string device_name_; + bool is_incoming_ = false; std::vector<TextAttachment> text_attachments_; std::vector<FileAttachment> file_attachments_; }; @@ -114,13 +119,13 @@ NearbyNotificationManager manager_{&profile_}; }; -struct ProgressNotificationTestParam { +struct ProgressNotificationTestParamInternal { std::vector<TextAttachment::Type> text_attachments; std::vector<FileAttachment::Type> file_attachments; int expected_resource_id; }; -ProgressNotificationTestParam kProgressNotificationTestParams[] = { +ProgressNotificationTestParamInternal kProgressNotificationTestParams[] = { // No attachments. {{}, {}, IDS_NEARBY_UNKNOWN_ATTACHMENTS}, @@ -158,6 +163,9 @@ IDS_NEARBY_FILE_ATTACHMENTS_UNKNOWN}, }; +using ProgressNotificationTestParam = + std::tuple<ProgressNotificationTestParamInternal, bool>; + class NearbyNotificationManagerProgressNotificationTest : public NearbyNotificationManagerTest, public testing::WithParamInterface<ProgressNotificationTestParam> {}; @@ -230,10 +238,13 @@ } TEST_P(NearbyNotificationManagerProgressNotificationTest, Test) { - const ProgressNotificationTestParam& param = GetParam(); + const ProgressNotificationTestParamInternal& param = std::get<0>(GetParam()); + bool is_incoming = std::get<1>(GetParam()); + std::string device_name = "device"; ShareTargetBuilder share_target_builder; share_target_builder.set_device_name(device_name); + share_target_builder.set_is_incoming(is_incoming); for (TextAttachment::Type type : param.text_attachments) share_target_builder.add_attachment(CreateTextAttachment(type)); @@ -245,9 +256,12 @@ TransferMetadata transfer_metadata = TransferMetadataBuilder().build(); manager()->ShowProgress(share_target, transfer_metadata); + int expected_resource_id = + is_incoming ? IDS_NEARBY_NOTIFICATION_RECEIVE_PROGRESS_TITLE + : IDS_NEARBY_NOTIFICATION_SEND_PROGRESS_TITLE; size_t total = param.text_attachments.size() + param.file_attachments.size(); base::string16 expected = l10n_util::GetStringFUTF16( - IDS_NEARBY_NOTIFICATION_SEND_PROGRESS_TITLE, + expected_resource_id, l10n_util::GetPluralStringFUTF16(param.expected_resource_id, total), base::ASCIIToUTF16(device_name)); @@ -259,6 +273,8 @@ EXPECT_EQ(expected, notification.title()); } -INSTANTIATE_TEST_SUITE_P(NearbyNotificationManagerProgressNotificationTest, - NearbyNotificationManagerProgressNotificationTest, - testing::ValuesIn(kProgressNotificationTestParams)); +INSTANTIATE_TEST_SUITE_P( + NearbyNotificationManagerProgressNotificationTest, + NearbyNotificationManagerProgressNotificationTest, + testing::Combine(testing::ValuesIn(kProgressNotificationTestParams), + testing::Bool()));
diff --git a/chrome/browser/password_check/android/internal/BUILD.gn b/chrome/browser/password_check/android/internal/BUILD.gn index 9e5c192..3a3c66af 100644 --- a/chrome/browser/password_check/android/internal/BUILD.gn +++ b/chrome/browser/password_check/android/internal/BUILD.gn
@@ -45,6 +45,7 @@ android_library("internal_java") { deps = [ ":java_resources", + "//base:jni_java", "//chrome/android:chrome_app_java_resources", "//chrome/android:chrome_java", "//chrome/browser/password_check/android:public_ui_java", @@ -59,6 +60,7 @@ _public_target, ] sources = [ + "java/src/org/chromium/chrome/browser/password_check/PasswordCheckBridge.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckCoordinator.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckImpl.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckMediator.java", @@ -66,6 +68,23 @@ "java/src/org/chromium/chrome/browser/password_check/PasswordCheckViewBinder.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckViewHolder.java", ] + annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] +} + +generate_jni("jni_headers") { + visibility = [ ":*" ] + sources = [ "java/src/org/chromium/chrome/browser/password_check/PasswordCheckBridge.java" ] +} + +source_set("internal") { + deps = [ + ":jni_headers", + "//base:base", + ] + sources = [ + "password_check_bridge.cc", + "password_check_bridge.h", + ] } android_resources("java_resources") {
diff --git a/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckBridge.java b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckBridge.java new file mode 100644 index 0000000..fdad344 --- /dev/null +++ b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckBridge.java
@@ -0,0 +1,104 @@ +// Copyright 2020 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. + +package org.chromium.chrome.browser.password_check; + +import org.chromium.base.annotations.NativeMethods; + +/** + * Class handling the communication with the C++ part of the password check feature. It forwards + * messages to and from its C++ counterpart. + */ +class PasswordCheckBridge { + private final long mNativePasswordCheckBridge; + private final PasswordCheckObserver mPasswordCheckObserver; + + /** + * Observer listening to all messages relevant to the password check. + */ + interface PasswordCheckObserver { + /** + * Called when a new compromised credential is found by the password check + * @param originUrl Origin of the compromised credential. + * @param username Username for the compromised credential. + * @param password Password of the compromised credential. + */ + void onCompromisedCredentialFound(String originUrl, String username, String password); + + /** + * Called when the compromised credentials found in a previous check are read from disk. + * @param count The number of compromised credentials that were found in a previous check. + */ + void onCompromisedCredentialsFetched(int count); + } + + PasswordCheckBridge(PasswordCheckObserver passwordCheckObserver) { + // Initialized its native counterpart. This will also start fetching the compromised + // credentials stored in the database by the last check. + mNativePasswordCheckBridge = PasswordCheckBridgeJni.get().create(); + mPasswordCheckObserver = passwordCheckObserver; + } + + // TODO(crbug.com/1102025): Add call from native. + void onCompromisedCredentialFound(String originUrl, String username, String password) { + mPasswordCheckObserver.onCompromisedCredentialFound(originUrl, username, password); + } + + // TODO(crbug.com/1102025): Add call from native. + void onCompromisedCredentialsFetched(int count) { + mPasswordCheckObserver.onCompromisedCredentialsFetched(count); + } + + // TODO(crbug.com/1102025): Add call from native. + private static void insertCredential(CompromisedCredential[] credentials, int index, + String originUrl, String username, String password, boolean phished) { + credentials[index] = new CompromisedCredential(originUrl, username, password, phished); + } + + /** + * Starts the password check. + */ + void startCheck() { + PasswordCheckBridgeJni.get().startCheck(mNativePasswordCheckBridge); + } + + /** + * Stops the password check. + */ + void stopCheck() { + PasswordCheckBridgeJni.get().stopCheck(mNativePasswordCheckBridge); + } + + /** + * This can return 0 if the compromised credentials haven't been fetched from the database yet. + * @return The number of compromised credentials found in the last run password check. + */ + int getCompromisedCredentialsCount() { + return PasswordCheckBridgeJni.get().getCompromisedCredentialsCount( + mNativePasswordCheckBridge); + } + + /** + * Returns the list of compromised credentials that are stored in the database. + * @param credentials array to be populated with the compromised credentials. + */ + void getCompromisedCredentials(CompromisedCredential[] credentials) { + PasswordCheckBridgeJni.get().getCompromisedCredentials( + mNativePasswordCheckBridge, credentials); + } + + /** + * C++ method signatures. + */ + @NativeMethods + interface Natives { + long create(); + void startCheck(long nativePasswordCheckBridge); + void stopCheck(long nativePasswordCheckBridge); + int getCompromisedCredentialsCount(long nativePasswordCheckBridge); + void getCompromisedCredentials( + long nativePasswordCheckBridge, CompromisedCredential[] credentials); + void destroy(long nativePasswordCheckBridge); + } +}
diff --git a/chrome/browser/password_check/android/internal/password_check_bridge.cc b/chrome/browser/password_check/android/internal/password_check_bridge.cc new file mode 100644 index 0000000..64e1ecd --- /dev/null +++ b/chrome/browser/password_check/android/internal/password_check_bridge.cc
@@ -0,0 +1,39 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/password_check/android/internal/password_check_bridge.h" + +#include <jni.h> + +#include "chrome/browser/password_check/android/internal/jni_headers/PasswordCheckBridge_jni.h" + +static jlong JNI_PasswordCheckBridge_Create(JNIEnv* env) { + return reinterpret_cast<intptr_t>(new PasswordCheckBridge()); +} + +PasswordCheckBridge::PasswordCheckBridge() = default; +PasswordCheckBridge::~PasswordCheckBridge() = default; + +void PasswordCheckBridge::StartCheck(JNIEnv* env) { + // TODO(crbug.com/1102025): implement this. +} + +void PasswordCheckBridge::StopCheck(JNIEnv* env) { + // TODO(crbug.com/1102025): implement this. +} + +jint PasswordCheckBridge::GetCompromisedCredentialsCount(JNIEnv* env) { + // TODO(crbug.com/1102025): implement this. + return 0; +} + +void PasswordCheckBridge::GetCompromisedCredentials( + JNIEnv* env, + const base::android::JavaParamRef<jobjectArray>& credentials) { + // TODO(crbug.com/1102025): implement this. +} + +void PasswordCheckBridge::Destroy(JNIEnv* env) { + delete this; +}
diff --git a/chrome/browser/password_check/android/internal/password_check_bridge.h b/chrome/browser/password_check/android/internal/password_check_bridge.h new file mode 100644 index 0000000..f55f1c5 --- /dev/null +++ b/chrome/browser/password_check/android/internal/password_check_bridge.h
@@ -0,0 +1,40 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PASSWORD_CHECK_ANDROID_INTERNAL_PASSWORD_CHECK_BRIDGE_H_ +#define CHROME_BROWSER_PASSWORD_CHECK_ANDROID_INTERNAL_PASSWORD_CHECK_BRIDGE_H_ + +#include <jni.h> +#include "base/android/scoped_java_ref.h" + +// C++ counterpart of |PasswordCheckBridge.java|. Used to mediate the +// communication between the UI and the password check logic. +class PasswordCheckBridge { + public: + PasswordCheckBridge(); + PasswordCheckBridge(const PasswordCheckBridge&) = delete; + PasswordCheckBridge& operator=(const PasswordCheckBridge&) = delete; + + // Called by Java to start the password check. + void StartCheck(JNIEnv* env); + + // Called by Java to stop the password check. + void StopCheck(JNIEnv* env); + + // Called by Java to get the number of compromised credentials. + jint GetCompromisedCredentialsCount(JNIEnv* env); + + // Called by Java to get the list of compromised credentials. + void GetCompromisedCredentials( + JNIEnv* env, + const base::android::JavaParamRef<jobjectArray>& credentials); + + // Called by Java when the bridge is no longer needed. Destructs itself. + void Destroy(JNIEnv* env); + + private: + ~PasswordCheckBridge(); +}; + +#endif // CHROME_BROWSER_PASSWORD_CHECK_ANDROID_INTERNAL_PASSWORD_CHECK_BRIDGE_H_
diff --git a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/CompromisedCredential.java b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/CompromisedCredential.java index 06b2df1..a9b61d4 100644 --- a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/CompromisedCredential.java +++ b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/CompromisedCredential.java
@@ -10,23 +10,33 @@ */ public class CompromisedCredential { private final String mUsername; + private final String mPassword; private final String mOriginUrl; + private final boolean mPhished; /** * @param username Username shown to the user. * @param originUrl Origin URL shown to the user in case this credential is a PSL match. */ - public CompromisedCredential(String username, String originUrl) { + public CompromisedCredential( + String originUrl, String username, String password, boolean phished) { assert originUrl != null : "Credential origin is null! Pass an empty one instead."; - mUsername = username; mOriginUrl = originUrl; - } - - public String getUsername() { - return mUsername; + mUsername = username; + mPassword = password; + mPhished = phished; } public String getOriginUrl() { return mOriginUrl; } + public String getUsername() { + return mUsername; + } + public String getPassword() { + return mPassword; + } + public boolean isPhished() { + return mPhished; + } }
diff --git a/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckViewTest.java b/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckViewTest.java index 6077aec..72c2e06 100644 --- a/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckViewTest.java +++ b/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckViewTest.java
@@ -41,7 +41,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PasswordCheckViewTest { private static final CompromisedCredential ANA = - new CompromisedCredential("Ana", "https://some-url.com"); + new CompromisedCredential("https://some-url.com", "Ana", "password", false); private PropertyModel mModel = PasswordCheckProperties.createDefaultModel(); private PasswordCheckFragmentView mPasswordCheckView;
diff --git a/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java b/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java index 69b8ea2..6641a24 100644 --- a/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java +++ b/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java
@@ -32,7 +32,7 @@ @RunWith(BaseRobolectricTestRunner.class) public class PasswordCheckControllerTest { private static final CompromisedCredential ANA = - new CompromisedCredential("Ana", "https://m.a.xyz/"); + new CompromisedCredential("https://m.a.xyz/", "Ana", "password", false); private final PasswordCheckMediator mMediator = new PasswordCheckMediator(); private final PropertyModel mModel = PasswordCheckProperties.createDefaultModel();
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index f7ae30c..b4f2927b 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -1795,9 +1795,13 @@ #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) #if BUILDFLAG(ENABLE_EXTENSIONS) - handlers->AddHandler(std::make_unique<extensions::ExtensionListPolicyHandler>( - key::kExtensionInstallWhitelist, - extensions::pref_names::kInstallAllowList, false)); + handlers->AddHandler(std::make_unique<policy::SimpleDeprecatingPolicyHandler>( + std::make_unique<extensions::ExtensionListPolicyHandler>( + key::kExtensionInstallWhitelist, + extensions::pref_names::kInstallAllowList, false), + std::make_unique<extensions::ExtensionListPolicyHandler>( + key::kExtensionInstallAllowlist, + extensions::pref_names::kInstallAllowList, false))); handlers->AddHandler(std::make_unique<extensions::ExtensionListPolicyHandler>( key::kExtensionInstallBlacklist, extensions::pref_names::kInstallDenyList, true));
diff --git a/chrome/browser/policy/extension_policy_browsertest.cc b/chrome/browser/policy/extension_policy_browsertest.cc index 63b4a289..3aa1aa9 100644 --- a/chrome/browser/policy/extension_policy_browsertest.cc +++ b/chrome/browser/policy/extension_policy_browsertest.cc
@@ -821,8 +821,8 @@ EXPECT_EQ(kSharedModuleId, imports[0].extension_id); } -IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest, ExtensionInstallWhitelist) { - // Verifies that the whitelist can open exceptions to the blacklist. +IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest, ExtensionInstallAllowlist) { + // Verifies that the allowlist can open exceptions to the blacklist. extensions::ExtensionRegistry* registry = extension_registry(); ASSERT_FALSE(registry->GetExtensionById( kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); @@ -830,21 +830,21 @@ kSimpleWithIconCrxId, extensions::ExtensionRegistry::EVERYTHING)); base::ListValue blacklist; blacklist.AppendString("*"); - base::ListValue whitelist; - whitelist.AppendString(kGoodCrxId); + base::ListValue allowlist; + allowlist.AppendString(kGoodCrxId); PolicyMap policies; policies.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); - policies.Set(key::kExtensionInstallWhitelist, POLICY_LEVEL_MANDATORY, + policies.Set(key::kExtensionInstallAllowlist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, - whitelist.CreateDeepCopy(), nullptr); + allowlist.CreateDeepCopy(), nullptr); UpdateProviderPolicy(policies); // "simple_with_icon.crx" is blacklisted. EXPECT_FALSE(InstallExtension(kSimpleWithIconCrxName)); EXPECT_FALSE(registry->GetExtensionById( kSimpleWithIconCrxId, extensions::ExtensionRegistry::EVERYTHING)); - // "good.crx" has a whitelist exception. + // "good.crx" has a allowlist exception. const extensions::Extension* good = InstallExtension(kGoodCrxName); ASSERT_TRUE(good); EXPECT_EQ(kGoodCrxId, good->id()); @@ -1699,7 +1699,7 @@ EXPECT_FALSE(registry->GetExtensionById( kGoodCrxId, extensions::ExtensionRegistry::EVERYTHING)); - // "hosted_app.crx" is of a whitelisted type. + // "hosted_app.crx" is of a allowlisted type. const extensions::Extension* hosted_app = InstallExtension(kHostedAppCrxName); ASSERT_TRUE(hosted_app); EXPECT_EQ(kHostedAppCrxId, hosted_app->id()); @@ -1712,7 +1712,7 @@ // Checks that a click on an extension CRX download triggers the extension // installation prompt without further user interaction when the source is -// whitelisted by policy. +// allowlisted by policy. // Flaky on windows; http://crbug.com/295729 . #if defined(OS_WIN) #define MAYBE_ExtensionInstallSources DISABLED_ExtensionInstallSources
diff --git a/chrome/browser/resources/chromeos/login/update_required_card.css b/chrome/browser/resources/chromeos/login/update_required_card.css index 442dc46..2127427a 100644 --- a/chrome/browser/resources/chromeos/login/update_required_card.css +++ b/chrome/browser/resources/chromeos/login/update_required_card.css
@@ -11,7 +11,7 @@ margin-top: 20px; } -.update-error { +.bold { font-weight: bold; }
diff --git a/chrome/browser/resources/chromeos/login/update_required_card.html b/chrome/browser/resources/chromeos/login/update_required_card.html index 35d747d..0043668 100644 --- a/chrome/browser/resources/chromeos/login/update_required_card.html +++ b/chrome/browser/resources/chromeos/login/update_required_card.html
@@ -124,7 +124,8 @@ <div slot="footer" class="flex layout vertical"> <div id="adminMessageContainer" hidden="[[isEmpty_(eolAdminMessage_)]]"> - <div>[[i18nDynamic(locale, 'eolAdminMessageTitle')]]</div> + <div class="bold">[[i18nDynamic(locale, 'eolAdminMessageTitle')]] + </div> <div id="adminMessage">[[eolAdminMessage_]]</div> </div> <div class="flex layout vertical center-justified center">
diff --git a/chrome/browser/resources/nearby_internals/log_object.html b/chrome/browser/resources/nearby_internals/log_object.html index 39b2490..48485db 100644 --- a/chrome/browser/resources/nearby_internals/log_object.html +++ b/chrome/browser/resources/nearby_internals/log_object.html
@@ -1,18 +1,10 @@ <style> - :host { - --large-font-size: 120%; - } - .warning-log { background-color: rgb(255, 252, 239); - color: rgb(49, 34, 0); - font-size: var(--large-font-size); } .error-log { background-color: rgb(255, 241, 241); - color: rgb(239, 0, 0); - font-size: var(--large-font-size); } #item-metadata {
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/ambient_mode_page/BUILD.gn index 71795b2..10e93ed 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/BUILD.gn
@@ -10,6 +10,8 @@ ":ambient_mode_page", ":ambient_mode_photos_page", ":constants", + ":topic_source_item", + ":topic_source_list", ] } @@ -49,6 +51,17 @@ js_library("constants") { } +js_library("topic_source_item") { + deps = [ + "//ui/webui/resources/js:cr", + "//ui/webui/resources/js:i18n_behavior", + ] +} + +js_library("topic_source_list") { + deps = [ "//ui/webui/resources/js:cr" ] +} + # TODO: Uncomment as the Polymer3 migration makes progress. #js_type_check("closure_compile_module") { # is_polymer3 = true @@ -56,6 +69,8 @@ # ":ambient_mode_browser_proxy.m", # ":ambient_mode_page.m", # ":ambient_mode_photos_page.m", +# ":topic_source_item.m", +# ":topic_source_list.m", # ] #} @@ -83,6 +98,22 @@ extra_deps = [ ":ambient_mode_photos_page_module" ] } +js_library("topic_source_item.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.m.js" ] + deps = [ + # TODO: Fill those in. + ] + extra_deps = [ ":topic_source_item_module" ] +} + +js_library("topic_source_list.m") { + sources = [ "$root_gen_dir/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.m.js" ] + deps = [ + # TODO: Fill those in. + ] + extra_deps = [ ":topic_source_list_module" ] +} + import("//tools/polymer/polymer.gni") group("polymer3_elements") { @@ -90,6 +121,8 @@ ":ambient_mode_page_module", ":ambient_mode_photos_page_module", ":modulize", + ":topic_source_item_module", + ":topic_source_list_module", ] } @@ -105,6 +138,18 @@ html_type = "dom-module" } +polymer_modulizer("topic_source_item") { + js_file = "topic_source_item.js" + html_file = "topic_source_item.html" + html_type = "dom-module" +} + +polymer_modulizer("topic_source_list") { + js_file = "topic_source_list.js" + html_file = "topic_source_list.html" + html_type = "dom-module" +} + import("//ui/webui/resources/tools/js_modulizer.gni") js_modulizer("modulize") {
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_browser_proxy.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_browser_proxy.js index 23a944b..24baeb6 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_browser_proxy.js +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_browser_proxy.js
@@ -27,16 +27,15 @@ * response, the C++ sends the 'photos-containers-changed' WebUIListener * event. * @param {!AmbientModeTopicSource} topicSource the topic source for which - * the containers requested - * for. + * the containers requested for. */ requestPhotosContainers(topicSource) {} /** * Updates the selected personal albums or art categories to server. - * @param {!Array<string>} containers the selected albums or categeries. + * @param {!AmbientModeSettings} settings the selected albums or categeries. */ - setSelectedPhotosContainers(containers) {} + setSelectedPhotosContainers(settings) {} } /** @implements {settings.AmbientModeBrowserProxy} */ @@ -57,8 +56,8 @@ } /** @override */ - setSelectedPhotosContainers(containers) { - chrome.send('setSelectedPhotosContainers', containers); + setSelectedPhotosContainers(settings) { + chrome.send('setSelectedPhotosContainers', [settings]); } }
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.html b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.html index e11f702d..ded78ae 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.html +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.html
@@ -3,9 +3,11 @@ <link rel="import" href="ambient_mode_browser_proxy.html"> <link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html"> <link rel="import" href="constants.html"> +<link rel="import" href="topic_source_list.html"> <link rel="import" href="../os_route.html"> <link rel="import" href="../../router.html"> <link rel="import" href="../../controls/settings_radio_group.html"> @@ -14,14 +16,17 @@ <dom-module id="settings-ambient-mode-page"> <template> - <style include="cr-shared-style settings-shared"> + <style include="cr-shared-style settings-shared iron-flex"> #ambientModeEnable { border-bottom: var(--cr-separator-line); } - #topicSourceDescription { - display: block; - padding-inline-end: var(--cr-section-padding); + /* Set padding on children instead of the container itself to ensure that + * separator lines can fill the entire width of the page. */ + #topicSourceListDiv > * { + /* Padded to the right to allow space for a ripple */ + padding-inline-end: calc(var(--cr-section-padding) - + var(--cr-icon-ripple-padding)); padding-inline-start: var(--cr-section-padding); } </style> @@ -33,29 +38,11 @@ </settings-toggle-button> <template is="dom-if" if="[[prefs.settings.ambient_mode.enabled.value]]"> - <label id="topicSourceDescription" class="cr-padded-text"> - $i18n{ambientModeTopicSourceTitle} - </label> - - <!-- TODO(b/159746638): Implement a new UI to pick topic source and open - subpage. --> - <div class="list-frame"> - <!-- Disable the radio buttons before the selection is fetched from - server. --> - <cr-radio-group id="topicSourceRadioGroup" - aria-labelledby="topicSourceDescription" - selected="[[selectedTopicSource_]]" - on-click="onTopicSourceClicked_" + <div id="topicSourceListDiv" class="layout vertical flex"> + <topic-source-list topic-sources="[[topicSources_]]" + selected-item="[[selectedTopicSource_]]" disabled="[[!isValidTopicSource_(selectedTopicSource_)]]"> - <cr-radio-button name="[[AmbientModeTopicSource.GOOGLE_PHOTOS]]" - class="list-item underbar" - label="$i18n{ambientModeTopicSourceGooglePhotos}"> - </cr-radio-button> - <cr-radio-button name="[[AmbientModeTopicSource.ART_GALLERY]]" - class="list-item underbar" - label="$i18n{ambientModeTopicSourceArtGallery}"> - </cr-radio-button> - </cr-radio-group> + </topic-source-list> </div> </template> </template>
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js index c9f3127c..13eae7e 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_page.js
@@ -24,17 +24,25 @@ value: AmbientModeTopicSource, }, + // TODO(b/160632748): Dynamically generate topic source of Google Photos. + /** @private {!Array<!AmbientModeTopicSource>} */ + topicSources_: { + type: Array, + value: [ + AmbientModeTopicSource.GOOGLE_PHOTOS, AmbientModeTopicSource.ART_GALLERY + ], + }, + /** @private {!AmbientModeTopicSource} */ selectedTopicSource_: { type: AmbientModeTopicSource, value: AmbientModeTopicSource.UNKNOWN, }, + }, - /** @private {!AmbientModeTopicSource} */ - previousTopicSource_: { - type: AmbientModeTopicSource, - value: AmbientModeTopicSource.UNKNOWN, - }, + listeners: { + 'selected-topic-source-changed': 'onSelectedTopicSourceChanged_', + 'show-albums': 'onShowAlbums_', }, /** @private {?settings.AmbientModeBrowserProxy} */ @@ -49,7 +57,6 @@ ready() { this.addWebUIListener('topic-source-changed', (topicSource) => { this.selectedTopicSource_ = topicSource; - this.previousTopicSource_ = topicSource; }); this.browserProxy_.onAmbientModePageReady(); @@ -64,26 +71,6 @@ return this.i18n(toggleValue ? 'ambientModeOn' : 'ambientModeOff'); }, - /** @private */ - onTopicSourceClicked_() { - const selectedTopicSource = this.$$('#topicSourceRadioGroup').selected; - if (selectedTopicSource === '0') { - this.selectedTopicSource_ = AmbientModeTopicSource.GOOGLE_PHOTOS; - } else if (selectedTopicSource === '1') { - this.selectedTopicSource_ = AmbientModeTopicSource.ART_GALLERY; - } - - if (this.selectedTopicSource_ !== this.previousTopicSource_) { - this.previousTopicSource_ = this.selectedTopicSource_; - this.browserProxy_.setSelectedTopicSource(this.selectedTopicSource_); - } - - const params = new URLSearchParams(); - params.append('topicSource', JSON.stringify(this.selectedTopicSource_)); - settings.Router.getInstance().navigateTo( - settings.routes.AMBIENT_MODE_PHOTOS, params); - }, - /** * @param {number} topicSource * @return {boolean} @@ -92,4 +79,25 @@ isValidTopicSource_(topicSource) { return topicSource !== AmbientModeTopicSource.UNKNOWN; }, + + /** + * @param {!CustomEvent<{item: !AmbientModeTopicSource}>} event + * @private + */ + onSelectedTopicSourceChanged_(event) { + this.browserProxy_.setSelectedTopicSource( + /** @type {!AmbientModeTopicSource} */ (event.detail)); + }, + + /** + * Open ambientMode/photos subpage. + * @param {!CustomEvent<{item: !AmbientModeTopicSource}>} event + * @private + */ + onShowAlbums_(event) { + const params = new URLSearchParams(); + params.append('topicSource', JSON.stringify(event.detail)); + settings.Router.getInstance().navigateTo( + settings.routes.AMBIENT_MODE_PHOTOS, params); + } });
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_photos_page.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_photos_page.js index d019114..77e42551 100644 --- a/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_photos_page.js +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/ambient_mode_photos_page.js
@@ -86,7 +86,7 @@ * @private */ getDescription_(topicSource) { - // TODO(b/159766700): Finialize the strings and i18n. + // TODO(b/159766700, items 2&3): Finalize the strings and i18n. if (topicSource === AmbientModeTopicSource.GOOGLE_PHOTOS) { return 'A slideshow of selected memories will be created'; } else { @@ -103,7 +103,8 @@ containers.push(checkbox.label); } }); - this.browserProxy_.setSelectedPhotosContainers(containers); + this.browserProxy_.setSelectedPhotosContainers( + {topicSource: this.topicSource_, topicContainers: containers}); } });
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.html b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.html new file mode 100644 index 0000000..2dd89e4 --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.html
@@ -0,0 +1,45 @@ +<link rel="import" href="chrome://resources/html/polymer.html"> + +<link rel="import" href="chrome://resources/cr_elements/cr_radio_button/cr_radio_button_style_css.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/html/i18n_behavior.html"> +<link rel="import" href="../../settings_shared_css.html"> + +<dom-module id="topic-source-item"> + <template> + <style include="settings-shared cr-shared-style iron-flex + cr-radio-button-style"> + :host { + display: inline-flex; + } + + #rowContainer { + padding-inline-end: var(--cr-icon-ripple-padding); + padding-inline-start: var(--cr-section-padding); + } + </style> + + <div id="rowContainer" class="layout horizontal center flex" + on-click="onItemClick_"> + <!-- This item behaviors similar to a radio button and reuses disc and + label style in cr-radio-button-style. --> + <div class="disc-wrapper" aria-hidden="true"> + <div class="disc-border"></div> + <div class="disc"></div> + </div> + + <div id="labelWrapper" aria-hidden="true"> + <span>[[getItemName_(item)]]</span> + </div> + + <cr-icon-button class="subpage-arrow" id="subpage-button" + on-click="onSubpageArrowClick_" tabindex$="[[tabindex]]" + aria-label$="[[buttonLabel]]"> + </cr-icon-button> + </div> + </template> + <script src="topic_source_item.js"></script> +</dom-module>
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.js new file mode 100644 index 0000000..3614679 --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_item.js
@@ -0,0 +1,141 @@ +// Copyright 2020 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. + +/** + * @fileoverview Polymer element for displaying options to select a + * AmbientModeTopicSource in a list. + */ + +Polymer({ + is: 'topic-source-item', + + behaviors: [I18nBehavior], + + properties: { + /** + * Whether this item is selected. This property is related to + * cr_radio_button_style and used to style the disc appearance. + */ + checked: { + type: Boolean, + value: false, + reflectToAttribute: true, + }, + + /** @type {!AmbientModeTopicSource} */ + item: Object, + + buttonLabel: { + type: String, + computed: 'getButtonLabel_(item)', + }, + + /** Aria label for the row. */ + ariaLabel: { + type: String, + computed: 'computeAriaLabel_(item, checked)', + reflectToAttribute: true, + }, + }, + + /** @override */ + attached() { + this.listen(this, 'keydown', 'onKeydown_'); + }, + + /** @override */ + detached() { + this.unlisten(this, 'keydown', 'onKeydown_'); + }, + + /** + * @return {string} + * @private + */ + getItemName_() { + if (this.item === AmbientModeTopicSource.GOOGLE_PHOTOS) { + return this.i18n('ambientModeTopicSourceGooglePhotos'); + } else if (this.item === AmbientModeTopicSource.ART_GALLERY) { + return this.i18n('ambientModeTopicSourceArtGallery'); + } else { + return ''; + } + }, + + /** + * The aria label for the subpage button. + * @return {string} + * @private + */ + getButtonLabel_() { + // TODO(b/159766700, item 5): Finalize the strings and i18n. + return 'Select ' + this.getItemName_() + ' albums'; + }, + + /** + * @return {string} Aria label string for ChromeVox to verbalize. + * @private + */ + computeAriaLabel_() { + // TODO(b/159766700, item 6): Finalize the strings and i18n. + if (this.checked) { + return 'Topic source ' + this.getItemName_() + ' selected, ' + + this.getButtonLabel_(); + } + return 'Select topic source ' + this.getItemName_(); + }, + + /** + * @param {!KeyboardEvent} event + * @private + */ + onKeydown_(event) { + // The only key event handled by this element is pressing Enter. + // (1) Pressing the subpage arrow leads to the subpage. + // (2) Pressing anywhere on an already-selected item leads to the subpage. + if (event.key !== 'Enter') { + return; + } + + // If the item is not checked, it will be handled by + // onSelectedItemChanged_() in topic_source_list.js. + if (!this.checked && + this.$$('#subpage-button') !== this.shadowRoot.activeElement) { + return; + } + + this.fireShowAlbums_(); + event.preventDefault(); + event.stopPropagation(); + }, + + /** + * @param {!MouseEvent} event + * @private + */ + onItemClick_(event) { + // Clicking anywhere on an already-selected item leads to the subpage. + if (this.checked) { + this.fireShowAlbums_(); + event.stopPropagation(); + } + }, + + /** + * @param {!MouseEvent} event + * @private + */ + onSubpageArrowClick_(event) { + this.fireShowAlbums_(); + event.stopPropagation(); + }, + + /** + * Fires a 'show-albums' event with |this.item| as the details. + * @private + */ + fireShowAlbums_() { + this.fire('show-albums', this.item); + }, +});
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.html b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.html new file mode 100644 index 0000000..5fa5f72d --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.html
@@ -0,0 +1,46 @@ +<link rel="import" href="chrome://resources/html/polymer.html"> + +<link rel="import" href="topic_source_item.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html"> +<link rel="import" href="../../settings_shared_css.html"> + +<dom-module id="topic-source-list"> + <template> + <style include="settings-shared cr-shared-style iron-flex"> + topic-source-item { + align-items: center; + height: 48px; + } + + iron-list > *:not(:first-of-type) { + border-top: var(--cr-separator-line); + } + + iron-list > :focus { + background-color: var(--cr-focused-item-color); + } + </style> + <div class="first"> + <h2> + $i18n{ambientModeTopicSourceTitle} + </h2> + </div> + + <iron-list id="topicSourceList" selection-enabled + items="[[topicSources]]" + selected-item="{{selectedItem}}" + on-selected-item-changed="onSelectedItemChanged_"> + <template> + <topic-source-item item="[[item]]" + checked="[[isItemSelected_(item, selectedItem)]]" + tabindex$="[[tabIndex]]" + disabled$="[[disabled]]"> + </topic-source-item> + </template> + </iron-list> + </template> + <script src="topic_source_list.js"></script> +</dom-module>
diff --git a/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.js b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.js new file mode 100644 index 0000000..bf73e42b --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/ambient_mode_page/topic_source_list.js
@@ -0,0 +1,63 @@ +// Copyright 2020 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. + +/** + * @fileoverview Polymer element for displaying a list of + * AmbientModeTopicSource. + */ + +/** + * Polymer class definition for 'topic-source-list'. + */ +Polymer({ + is: 'topic-source-list', + + properties: { + /** + * Contains topic sources. + * @private {!Array<!AmbientModeTopicSource>} + */ + topicSources: { + type: Array, + value: [], + }, + + /** + * Reflects the iron-list selectedItem property. + * @type {AmbientModeTopicSource} + */ + selectedItem: Object, + + /** + * The last iron-list selectedItem. + * @type {AmbientModeTopicSource} + */ + lastSelectedItem_: Object, + }, + + /** @private */ + onSelectedItemChanged_() { + // <iron-list> causes |this.$.topicSourceList.selectedItem| to be null if + // tapped a second time. + if (this.$.topicSourceList.selectedItem === null) { + // In the case that the user deselects an item, reselect the item manually + // by altering the list. + this.selectedItem_ = this.lastSelectedItem_; + return; + } + + if (this.lastSelectedItem_ !== this.$.topicSourceList.selectedItem) { + this.lastSelectedItem_ = this.$.topicSourceList.selectedItem; + this.fire('selected-topic-source-changed', this.lastSelectedItem_); + } + }, + + /** + * @param {!AmbientModeTopicSource} item + * @private + */ + isItemSelected_(item) { + return this.selectedItem === item; + }, +});
diff --git a/chrome/browser/resources/settings/os_settings_resources.grd b/chrome/browser/resources/settings/os_settings_resources.grd index 91f752d..031836c2 100644 --- a/chrome/browser/resources/settings/os_settings_resources.grd +++ b/chrome/browser/resources/settings/os_settings_resources.grd
@@ -93,6 +93,18 @@ <structure name="IDR_OS_SETTINGS_AMBIENT_CONSTANTS_HTML" file="chromeos/ambient_mode_page/constants.html" compress="false" type="chrome_html" /> + <structure name="IDR_OS_SETTINGS_AMBIENT_TOPIC_SOURCE_ITEM_JS" + file="chromeos/ambient_mode_page/topic_source_item.js" + compress="false" type="chrome_html" /> + <structure name="IDR_OS_SETTINGS_AMBIENT_TOPIC_SOURCE_ITEM_HTML" + file="chromeos/ambient_mode_page/topic_source_item.html" + compress="false" type="chrome_html" /> + <structure name="IDR_OS_SETTINGS_AMBIENT_TOPIC_SOURCE_LIST_JS" + file="chromeos/ambient_mode_page/topic_source_list.js" + compress="false" type="chrome_html" /> + <structure name="IDR_OS_SETTINGS_AMBIENT_TOPIC_SOURCE_LIST_HTML" + file="chromeos/ambient_mode_page/topic_source_list.html" + compress="false" type="chrome_html" /> <structure name="IDR_OS_SETTINGS_APPS_PAGE_JS" file="chromeos/os_apps_page/os_apps_page.js" compress="false" type="chrome_html" />
diff --git a/chrome/browser/resources/settings/site_settings/site_entry.html b/chrome/browser/resources/settings/site_settings/site_entry.html index 8a76f681..b64fcb2 100644 --- a/chrome/browser/resources/settings/site_settings/site_entry.html +++ b/chrome/browser/resources/settings/site_settings/site_entry.html
@@ -81,8 +81,8 @@ <iron-collapse id="collapseChild" no-animation> <div class="list-frame"> <template is="dom-repeat" items="[[siteGroup.origins]]"> - <div class="hr"> - <div class="start row-aligned list-item" + <div class="list-item hr"> + <div class="start row-aligned list-item origin-link" on-click="onOriginTap_" actionable> <site-favicon url="[[item.origin]]"></site-favicon> <div class="site-representation middle text-elide">
diff --git a/chrome/browser/resources/tab_strip/tab_group.html b/chrome/browser/resources/tab_strip/tab_group.html index f52e072..fe21e147 100644 --- a/chrome/browser/resources/tab_strip/tab_group.html +++ b/chrome/browser/resources/tab_strip/tab_group.html
@@ -164,7 +164,7 @@ :host([dragging]) #dragImage { /* Position the actual drag image out of view so it is not visible. */ position: absolute; - top: 100vh; + top: calc(100vh + var(--drag-image-padding)); } </style>
diff --git a/chrome/browser/resources/tab_strip/tab_swiper.js b/chrome/browser/resources/tab_strip/tab_swiper.js index 7a351d4..3f51808 100644 --- a/chrome/browser/resources/tab_strip/tab_swiper.js +++ b/chrome/browser/resources/tab_strip/tab_swiper.js
@@ -34,7 +34,7 @@ * register the set of pointer events as an intended swipe. * @const {number} */ -const SWIPE_VELOCITY_THRESHOLD = 0.1; +const SWIPE_VELOCITY_THRESHOLD = 0.2; export class TabSwiper { /** @param {!HTMLElement} element */
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc index f95e0996..8b9bd4c 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc +++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_dialog_delegate.cc
@@ -141,28 +141,6 @@ return true; } -enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule::Action -GetHighestPrecedenceAction( - const enterprise_connectors::ContentAnalysisResponse& response) { - auto action = enterprise_connectors::ContentAnalysisResponse::Result:: - TriggeredRule::ACTION_UNSPECIFIED; - - for (const auto& result : response.results()) { - if (!result.has_status() || - result.status() != - enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS) { - continue; - } - - for (const auto& rule : result.triggered_rules()) { - if (rule.action() > action) - action = rule.action(); - } - } - - return action; -} - bool ContentAnalysisActionAllowsDataUse( enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: Action action) { @@ -540,7 +518,7 @@ access_point_, content_size, result, response); text_request_complete_ = true; - auto action = GetHighestPrecedenceAction(response); + auto action = enterprise_connectors::GetHighestPrecedenceAction(response); bool text_complies = ResultShouldAllowDataUse(result, data_.settings) && ContentAnalysisActionAllowsDataUse(action); std::fill(result_.text_results.begin(), result_.text_results.end(),
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc index 094cc767..7056b0a 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
@@ -54,8 +54,8 @@ continue; } for (const auto& rule : result.triggered_rules()) { - if (rule.action() > malware_action) - malware_action = rule.action(); + malware_action = enterprise_connectors::GetHighestPrecedenceAction( + malware_action, rule.action()); } } if (result.tag() == "dlp") { @@ -65,41 +65,45 @@ continue; } for (const auto& rule : result.triggered_rules()) { - if (rule.action() > dlp_action) - dlp_action = rule.action(); + dlp_action = enterprise_connectors::GetHighestPrecedenceAction( + dlp_action, rule.action()); } } } - switch (malware_action) { - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - BLOCK: - *download_result = DownloadCheckResult::DANGEROUS; - return; - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - WARN: - *download_result = DownloadCheckResult::POTENTIALLY_UNWANTED; - return; - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - REPORT_ONLY: - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - ACTION_UNSPECIFIED: - break; - } - switch (dlp_action) { - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - BLOCK: - *download_result = DownloadCheckResult::SENSITIVE_CONTENT_BLOCK; - return; - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - WARN: - *download_result = DownloadCheckResult::SENSITIVE_CONTENT_WARNING; - return; - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - REPORT_ONLY: - case enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule:: - ACTION_UNSPECIFIED: - break; + if (malware_action == enterprise_connectors::GetHighestPrecedenceAction( + malware_action, dlp_action)) { + switch (malware_action) { + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::BLOCK: + *download_result = DownloadCheckResult::DANGEROUS; + return; + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::WARN: + *download_result = DownloadCheckResult::POTENTIALLY_UNWANTED; + return; + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::REPORT_ONLY: + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::ACTION_UNSPECIFIED: + break; + } + } else { + switch (dlp_action) { + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::BLOCK: + *download_result = DownloadCheckResult::SENSITIVE_CONTENT_BLOCK; + return; + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::WARN: + *download_result = DownloadCheckResult::SENSITIVE_CONTENT_WARNING; + return; + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::REPORT_ONLY: + case enterprise_connectors::ContentAnalysisResponse::Result:: + TriggeredRule::ACTION_UNSPECIFIED: + break; + } } if (dlp_scan_failure || malware_scan_failure) { @@ -112,18 +116,11 @@ void ResponseToDownloadCheckResult(const DeepScanningClientResponse& response, DownloadCheckResult* download_result) { - if (response.has_malware_scan_verdict()) { - if (response.malware_scan_verdict().verdict() == - MalwareDeepScanningVerdict::MALWARE) { - *download_result = DownloadCheckResult::DANGEROUS; - return; - } - - if (response.malware_scan_verdict().verdict() == - MalwareDeepScanningVerdict::UWS) { - *download_result = DownloadCheckResult::POTENTIALLY_UNWANTED; - return; - } + if (response.has_malware_scan_verdict() && + response.malware_scan_verdict().verdict() == + MalwareDeepScanningVerdict::MALWARE) { + *download_result = DownloadCheckResult::DANGEROUS; + return; } if (response.has_dlp_scan_verdict() && @@ -138,7 +135,17 @@ *download_result = DownloadCheckResult::SENSITIVE_CONTENT_BLOCK; return; } + } + if (response.has_malware_scan_verdict() && + response.malware_scan_verdict().verdict() == + MalwareDeepScanningVerdict::UWS) { + *download_result = DownloadCheckResult::POTENTIALLY_UNWANTED; + return; + } + + if (response.has_dlp_scan_verdict() && + response.dlp_scan_verdict().status() == DlpDeepScanningVerdict::SUCCESS) { bool should_dlp_warn = std::any_of( response.dlp_scan_verdict().triggered_rules().begin(), response.dlp_scan_verdict().triggered_rules().end(),
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc index 4d8a46d..fe52ab2 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc
@@ -692,7 +692,7 @@ response.mutable_dlp_scan_verdict()->set_status( DlpDeepScanningVerdict::SUCCESS); response.mutable_dlp_scan_verdict()->add_triggered_rules()->set_action( - DlpDeepScanningVerdict::TriggeredRule::BLOCK); + DlpDeepScanningVerdict::TriggeredRule::WARN); download_protection_service_.GetFakeBinaryUploadService()->SetResponse( BinaryUploadService::Result::SUCCESS, response); dlp_verdict = SensitiveDataVerdictToResult(response.dlp_scan_verdict()); @@ -714,8 +714,7 @@ enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS); auto* dlp_rule = dlp_result->add_triggered_rules(); dlp_rule->set_action(enterprise_connectors::ContentAnalysisResponse:: - Result::TriggeredRule::BLOCK); - dlp_rule->set_rule_name("dlp_rule"); + Result::TriggeredRule::WARN); dlp_rule->set_rule_name("dlp_rule"); dlp_rule->set_rule_id("0");
diff --git a/chrome/browser/share/BUILD.gn b/chrome/browser/share/BUILD.gn index afa4537..fdc0f51 100644 --- a/chrome/browser/share/BUILD.gn +++ b/chrome/browser/share/BUILD.gn
@@ -2,6 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") +import("//chrome/browser/buildflags.gni") + source_set("share") { sources = [ "bitmap_download_request.cc", @@ -18,3 +22,12 @@ "//skia", ] } + +android_library("java") { + sources = [ + "android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java", + "android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeOptionShareCallback.java", + ] + + deps = [ "//components/browser_ui/share/android:java" ] +}
diff --git a/chrome/browser/share/DEPS b/chrome/browser/share/DEPS index fbb6bd92..0e47ab2 100644 --- a/chrome/browser/share/DEPS +++ b/chrome/browser/share/DEPS
@@ -10,13 +10,6 @@ "+chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java", "+chrome/android/java/src/org/chromium/chrome/browser/media/MediaViewerUtils.java", "+chrome/android/java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationBuilder.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationConstants.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptor.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/PendingIntentProvider.java", - "+chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java", "+chrome/android/java/src/org/chromium/chrome/browser/screenshot/EditorScreenshotTask.java", "+chrome/android/java/src/org/chromium/chrome/browser/share", "+chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java similarity index 100% rename from chrome/android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java rename to chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotCoordinator.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotCoordinator.java index 2f254f5f..80032e8d 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotCoordinator.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotCoordinator.java
@@ -74,7 +74,7 @@ private void launchEditor() { ImageEditorDialogCoordinator editor = ImageEditorModuleProvider.getImageEditorProvider() .getImageEditorDialogCoordinator(); - editor.launchEditor(mActivity, mScreenshot, mTab); + editor.launchEditor(mActivity, mScreenshot, mTab, mChromeOptionShareCallback); mScreenshot = null; }
diff --git a/chrome/browser/share/android/java_sources.gni b/chrome/browser/share/android/java_sources.gni index 2e1856d..efdd8d1 100644 --- a/chrome/browser/share/android/java_sources.gni +++ b/chrome/browser/share/android/java_sources.gni
@@ -34,7 +34,6 @@ "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotShareSheetView.java", "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotShareSheetViewBinder.java", "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/screenshot/ScreenshotShareSheetViewProperties.java", - "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeOptionShareCallback.java", "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java", "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetBottomSheetContent.java", "//chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetCoordinator.java",
diff --git a/chrome/browser/spellchecker/OWNERS b/chrome/browser/spellchecker/OWNERS index 1ca3018..4343155e 100644 --- a/chrome/browser/spellchecker/OWNERS +++ b/chrome/browser/spellchecker/OWNERS
@@ -1,4 +1,3 @@ -groby@chromium.org rouslan@chromium.org per-file spellcheck_language_policy_handler*=macourteau@chromium.org
diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc index 69a1dd2..fbac180 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc
@@ -18,7 +18,6 @@ #include "base/synchronization/waitable_event.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" #include "components/language/core/browser/pref_names.h" @@ -328,6 +327,50 @@ return supported_accept_language; } +#if defined(OS_WIN) +// static +void SpellcheckService::EnableFirstUserLanguageForSpellcheck( + PrefService* prefs) { + // Ensure that spellcheck is enabled for the first language in the + // accept languages list. + base::Value user_dictionaries = + prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries)->Clone(); + std::vector<std::string> user_languages = + base::SplitString(prefs->GetString(language::prefs::kAcceptLanguages), + ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + + // Some first run scenarios will add an accept language to preferences that + // is not found in the hard-coded list in kAcceptLanguageList. Only + // languages in kAcceptLanguageList can be spellchecked. An example is an + // installation on a device where Finnish is the Windows display + // language--the initial accept language preferences are observed to be + // "fi-FI,fi,en-US,en". Only "fi" is contained in kAcceptLanguageList. + std::string first_user_language; + std::vector<std::string> accept_languages; + l10n_util::GetAcceptLanguages(&accept_languages); + for (const auto& user_language : user_languages) { + if (base::Contains(accept_languages, user_language)) { + first_user_language = user_language; + break; + } + } + + bool first_user_language_spellchecked = false; + for (const auto& dictionary_value : user_dictionaries.GetList()) { + first_user_language_spellchecked = + base::Contains(dictionary_value.GetString(), first_user_language); + if (first_user_language_spellchecked) + break; + } + + if (!first_user_language_spellchecked) { + user_dictionaries.Insert(user_dictionaries.GetList().begin(), + base::Value(first_user_language)); + prefs->Set(spellcheck::prefs::kSpellCheckDictionaries, user_dictionaries); + } +} +#endif // defined(OS_WIN) + void SpellcheckService::StartRecordingMetrics(bool spellcheck_enabled) { metrics_ = std::make_unique<SpellCheckHostMetrics>(); metrics_->RecordEnabledStats(spellcheck_enabled); @@ -580,7 +623,10 @@ // enabling it for spellcheck on the language settings page. Remove // preferences for this language so that there is no attempt to load a // non-existent Hunspell dictionary, and so that Hunspell spellchecking isn't - // broken because of the failed load. + // broken because of the failed load. This also handles the case where the + // primary preferred language is enabled for spellchecking during first run, + // but it's now determined that there is neither Windows platform nor Hunspell + // dictionary support for that language. PrefService* prefs = user_prefs::UserPrefs::Get(context_); DCHECK(prefs); // When following object goes out of scope, preference change observers will @@ -593,48 +639,6 @@ .empty()); }); - if (first_run::IsChromeFirstRun()) { - // Ensure that spellcheck is enabled for the first dialect of the - // accepted languages if there is a Windows dictionary installed for - // that dialect. - base::Value user_dictionaries = - prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries)->Clone(); - std::vector<std::string> user_languages = - base::SplitString(prefs->GetString(language::prefs::kAcceptLanguages), - ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - - // Some first run scenarios will add an accept language to preferences that - // is not found in the hard-coded list in kAcceptLanguageList. Only - // languages in kAcceptLanguageList can be spellchecked. An example is an - // installation on a device where Finnnish is the Windows display - // language--the initial accept language preferences are observed to be - // "fi-FI,fi,en-US,en". Only "fi" is contained in kAcceptLanguageList. - std::string first_user_language; - std::vector<std::string> accept_languages; - l10n_util::GetAcceptLanguages(&accept_languages); - for (const auto& user_language : user_languages) { - if (base::Contains(accept_languages, user_language)) { - first_user_language = user_language; - break; - } - } - - bool first_user_language_spellchecked = false; - for (const auto& dictionary_value : user_dictionaries.GetList()) { - first_user_language_spellchecked = - base::Contains(dictionary_value.GetString(), first_user_language); - if (first_user_language_spellchecked) - break; - } - - if (!first_user_language_spellchecked && - UsesWindowsDictionary(first_user_language)) { - user_dictionaries.Insert(user_dictionaries.GetList().begin(), - base::Value(first_user_language)); - prefs->Set(spellcheck::prefs::kSpellCheckDictionaries, user_dictionaries); - } - } - // No need to call LoadDictionaries() as when the ListPrefUpdate // object goes out of scope, the preference change handler will do this. }
diff --git a/chrome/browser/spellchecker/spellcheck_service.h b/chrome/browser/spellchecker/spellcheck_service.h index 4c3d45d..bc7a644 100644 --- a/chrome/browser/spellchecker/spellcheck_service.h +++ b/chrome/browser/spellchecker/spellcheck_service.h
@@ -107,6 +107,14 @@ static std::string GetSupportedAcceptLanguageCode( const std::string& supported_language_full_tag); +#if defined(OS_WIN) + // Since Windows platform dictionary support is determined asynchronously, + // this method is used to assure that the first preferred language initially + // has spellchecking enabled after first run. Spellchecking for the primary + // language will be disabled later if there is no dictionary support. + static void EnableFirstUserLanguageForSpellcheck(PrefService* prefs); +#endif // defined(OS_WIN) + // Instantiates SpellCheckHostMetrics object and makes it ready for recording // metrics. This should be called only if the metrics recording is active. void StartRecordingMetrics(bool spellcheck_enabled);
diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 663ff43..b73c6716 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
@@ -23,11 +23,13 @@ #include "base/threading/thread_restrictions.h" #include "base/values.h" #include "build/build_config.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/browser_sync/browser_sync_switches.h" #include "components/language/core/browser/pref_names.h" @@ -667,8 +669,8 @@ // The list of Windows spellcheck languages should have been populated by at // least one language. This assures that the spellcheck context menu will // include Windows spellcheck languages that lack Hunspell support. - ASSERT_TRUE(service->dictionaries_loaded()); - ASSERT_FALSE(service->windows_spellcheck_dictionary_map_.empty()); + EXPECT_TRUE(service->dictionaries_loaded()); + EXPECT_FALSE(service->windows_spellcheck_dictionary_map_.empty()); } class SpellcheckServiceWindowsHybridBrowserTestDelayInit @@ -682,6 +684,14 @@ /*enabled_features=*/{spellcheck::kWinUseBrowserSpellChecker, spellcheck::kWinDelaySpellcheckServiceInit}, /*disabled_features=*/{}); + + // Add command line switch that forces first run state, to test whether + // primary preferred language has its spellcheck dictionary enabled by + // default for non-Hunspell languages. + first_run::ResetCachedSentinelDataForTesting(); + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kForceFirstRun); + InProcessBrowserTest::SetUp(); } @@ -710,6 +720,47 @@ base::OnceClosure quit_on_callback_; }; +// Used for faking the presence of Windows spellcheck dictionaries. +const std::vector<std::string> kWindowsSpellcheckLanguages = { + "fi-FI" // Finnish has no Hunspell support. + "fr-FR", // French has both Windows and Hunspell support. +}; + +// Used for testing whether primary preferred language is enabled by default for +// spellchecking. +const char kAcceptLanguages[] = "fi-FI,fi,ar-AR,fr-FR,hr,ceb"; +const std::vector<std::string> kSpellcheckDictionariesBefore = { + // Note that Finnish is initially unset, but has Windows spellcheck + // dictionary present. + "ar", // Arabic has no Hunspell support, and its Windows spellcheck + // dictionary is not present. + "fr-FR", // French has both Windows and Hunspell support, and its Windows + // spellcheck dictionary is present. + "hr", // Croatian has Hunspell support. + "ceb" // Cebuano doesn't have any dictionary support and should be removed + // from preferences. +}; + +const std::vector<std::string> kSpellcheckDictionariesAfter = { + "fi", // Finnish should have been enabled for spellchecking since it's the + // primary language. + "fr-FR", // French should still be there. + "hr" // So should Croatian. +}; + +// As a prelude to the next test, sets the initial accept languages and +// spellcheck language preferences for the test profile. +IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTestDelayInit, + PRE_WindowsHybridSpellcheckDelayInit) { + GetPrefs()->SetString(language::prefs::kAcceptLanguages, kAcceptLanguages); + base::Value spellcheck_dictionaries_list(base::Value::Type::LIST); + for (const auto& dictionary : kSpellcheckDictionariesBefore) { + spellcheck_dictionaries_list.Append(std::move(dictionary)); + } + GetPrefs()->Set(spellcheck::prefs::kSpellCheckDictionaries, + spellcheck_dictionaries_list); +} + IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTestDelayInit, WindowsHybridSpellcheckDelayInit) { if (!spellcheck::WindowsVersionSupportsSpellchecker()) @@ -724,7 +775,7 @@ SpellcheckService* service = static_cast<SpellcheckService*>( SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( GetContext(), /* create */ false)); - ASSERT_EQ(nullptr, service); + EXPECT_EQ(nullptr, service); // Now create the SpellcheckService but don't call InitializeDictionaries(). service = static_cast<SpellcheckService*>( @@ -735,8 +786,11 @@ // The list of Windows spellcheck languages should not have been populated // yet since InitializeDictionaries() has not been called. - ASSERT_FALSE(service->dictionaries_loaded()); - ASSERT_TRUE(service->windows_spellcheck_dictionary_map_.empty()); + EXPECT_FALSE(service->dictionaries_loaded()); + EXPECT_TRUE(service->windows_spellcheck_dictionary_map_.empty()); + + // Fake the presence of Windows spellcheck dictionaries. + service->AddSpellcheckLanguagesForTesting(kWindowsSpellcheckLanguages); service->InitializeDictionaries( base::BindOnce(&SpellcheckServiceWindowsHybridBrowserTestDelayInit:: @@ -744,12 +798,25 @@ base::Unretained(this))); RunUntilCallbackReceived(); - ASSERT_TRUE(service->dictionaries_loaded()); + EXPECT_TRUE(service->dictionaries_loaded()); // The list of Windows spellcheck languages should now have been populated. std::map<std::string, std::string> windows_spellcheck_dictionary_map_first_call = service->windows_spellcheck_dictionary_map_; - ASSERT_FALSE(windows_spellcheck_dictionary_map_first_call.empty()); + EXPECT_EQ(kWindowsSpellcheckLanguages.size(), + windows_spellcheck_dictionary_map_first_call.size()); + + // Check that the primary accept language has spellchecking enabled and + // that languages with no spellcheck support have spellchecking disabled. + EXPECT_EQ(kAcceptLanguages, + GetPrefs()->GetString(language::prefs::kAcceptLanguages)); + const base::Value* dictionaries_list = + GetPrefs()->Get(spellcheck::prefs::kSpellCheckDictionaries); + std::vector<std::string> actual_dictionaries; + for (const auto& dictionary : dictionaries_list->GetList()) { + actual_dictionaries.push_back(dictionary.GetString()); + } + EXPECT_EQ(kSpellcheckDictionariesAfter, actual_dictionaries); // It should be safe to call InitializeDictionaries again (it should // immediately run the callback). @@ -759,8 +826,8 @@ base::Unretained(this))); RunUntilCallbackReceived(); - ASSERT_TRUE(service->dictionaries_loaded()); - ASSERT_EQ(windows_spellcheck_dictionary_map_first_call, + EXPECT_TRUE(service->dictionaries_loaded()); + EXPECT_EQ(windows_spellcheck_dictionary_map_first_call, service->windows_spellcheck_dictionary_map_); } #endif // defined(OS_WIN)
diff --git a/chrome/browser/spellchecker/spellcheck_service_unittest.cc b/chrome/browser/spellchecker/spellcheck_service_unittest.cc index c4ecd5f..89cd4ad6 100644 --- a/chrome/browser/spellchecker/spellcheck_service_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_unittest.cc
@@ -14,7 +14,6 @@ #include "base/supports_user_data.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" -#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -125,7 +124,7 @@ TestCases, SpellcheckServiceUnitTest, testing::Values( - TestCase("en,aa", {"aa"}, {""}, {""}), + TestCase("en,aa", {"aa"}, {}, {}), TestCase("en,en-JP,fr,aa", {"fr"}, {"fr"}, {"fr"}), TestCase("en,en-JP,fr,zz,en-US", {"fr"}, {"fr", "en-US"}, {"fr"}), TestCase("en,en-US,en-GB", {"en-GB"}, {"en-US", "en-GB"}, {"en-GB"}), @@ -172,13 +171,6 @@ void SetUp() override { InitFeatures(); - // Add command line switch that forces first run state, since code path - // through SpellcheckService::InitWindowsDictionaryLanguages depends on - // whether this is first run. - first_run::ResetCachedSentinelDataForTesting(); - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kForceFirstRun); - // Use SetTestingFactoryAndUse to force creation and initialization. SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( &profile_, base::BindRepeating(&BuildSpellcheckService)); @@ -231,6 +223,11 @@ prefs()->Set(spellcheck::prefs::kSpellCheckDictionaries, spellcheck_dictionaries_list); + // Simulate first-run scenario (method is normally called during browser + // start-up). If the primary accept language has no dictionary support, it is + // expected that spellchecking will be disabled for that language. + SpellcheckService::EnableFirstUserLanguageForSpellcheck(prefs()); + InitializeSpellcheckService(windows_spellcheck_languages_for_testing_); std::vector<SpellcheckService::Dictionary> dictionaries; @@ -315,16 +312,18 @@ static const TestCase kHybridGetDictionariesParams[] = { // Galician (gl) has only Windows support, no Hunspell dictionary. Croatian // (hr) has only Hunspell support, no local Windows dictionary. First - // language is supported by windows and should be spellchecked - TestCase("gl", {""}, {"gl"}, {"gl"}), - TestCase("gl", {"gl"}, {"gl"}, {"gl"}), - TestCase("gl,hr", {""}, {"gl", "hr"}, {"gl"}), + // language is supported by windows and should be spellchecked. + TestCase("gl", {}, {"gl"}, {"gl"}), TestCase("gl", {"gl"}, {"gl"}, {"gl"}), + TestCase("gl,hr", {}, {"gl", "hr"}, {"gl"}), TestCase("gl,hr", {"gl"}, {"gl", "hr"}, {"gl"}), TestCase("gl,hr", {"hr"}, {"gl", "hr"}, {"gl", "hr"}), TestCase("gl,hr", {"gl", "hr"}, {"gl", "hr"}, {"gl", "hr"}), - // First language is not supported by windows so nothing is changed - TestCase("hr", {""}, {"hr"}, {""}), TestCase("hr", {"hr"}, {"hr"}, {"hr"}), + TestCase("hr", {}, {"hr"}, {"hr"}), TestCase("hr", {"hr"}, {"hr"}, {"hr"}), TestCase("hr,gl", {"hr"}, {"hr", "gl"}, {"hr"}), + // Cebuano (ceb) is a language with neither Windows or Hunspell support, + // should be unset if was enabled during simulated "first run" scenario. + TestCase("ceb", {}, {}, {}), + TestCase("ceb,gl,hr", {"gl", "hr"}, {"gl", "hr"}, {"gl", "hr"}), // Finnish has only "fi" in hard-coded list of accept languages. TestCase("fi-FI,fi,en-US,en", {"en-US"}, {"fi", "en-US"}, {"fi", "en-US"}), // First language is supported by Windows but private use dictionaries @@ -332,7 +331,7 @@ TestCase("ja,gl", {"gl"}, {"gl"}, {"gl"}), // (Basque) No Hunspell support, has Windows support but // language pack not present. - TestCase("eu", {"eu"}, {""}, {""}), + TestCase("eu", {"eu"}, {}, {}), TestCase("es-419,es-MX", {"es-419", "es-MX"}, {"es-419", "es-MX"}, @@ -342,9 +341,9 @@ {"fr-FR", "es-MX", "gl", "pt-BR", "hr", "it"}, {"fr-FR", "gl", "pt-BR", "it"}), // Hausa with Hawaiian language pack (ha/haw string in string). - TestCase("ha", {"ha"}, {""}, {""}), + TestCase("ha", {"ha"}, {}, {}), // Sesotho with Asturian language pack (st/ast string in string). - TestCase("st", {"st"}, {""}, {""}), + TestCase("st", {"st"}, {}, {}), // User chose generic Serbian in languages preferences (which uses // Cyrillic script). TestCase("sr,sr-Latn-RS", {"sr", "sr-Latn-RS"}, {"sr"}, {"sr"})};
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 485dfff..55664ea 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1626,8 +1626,6 @@ "app_list/chrome_app_list_item.h", "app_list/chrome_app_list_model_updater.cc", "app_list/chrome_app_list_model_updater.h", - "app_list/extension_app_context_menu.cc", - "app_list/extension_app_context_menu.h", "app_list/extension_app_utils.cc", "app_list/extension_app_utils.h", "app_list/internal_app/internal_app_metadata.cc",
diff --git a/chrome/browser/ui/README b/chrome/browser/ui/README.md similarity index 69% rename from chrome/browser/ui/README rename to chrome/browser/ui/README.md index b4736806..2137f44 100644 --- a/chrome/browser/ui/README +++ b/chrome/browser/ui/README.md
@@ -8,15 +8,15 @@ bee you eye". Important subdirectories: - views - the Views implementation of the UI, used on Windows, Mac, Linux, and +* views - the Views implementation of the UI, used on Windows, Mac, Linux, and ChromeOS. This includes things like the browser window itself, tabs, dialogs, etc. - cocoa - the remaining Cocoa UI, used only on Mac. This directory used to +* cocoa - the remaining Cocoa UI, used only on Mac. This directory used to contain a separate full implementation of the UI, parallel to the Views implementation. - android - part of the Android implementation of the UI. See also +* android - part of the Android implementation of the UI. See also //chrome/browser/android. - webui - the WebUI parts of the browser UI. This includes things like the +* webui - the WebUI parts of the browser UI. This includes things like the chrome://settings page and other WebUI pages. A common pattern is for code in //chrome/browser/ui to define a @@ -27,11 +27,11 @@ This pattern often looks like this: -//chrome/browser/ui/browser_dialogs.h: - void ShowMyDialog(...); +[//chrome/browser/ui/browser_dialogs.h](browser_dialogs.h): + void ShowMyDialog(...); -//chrome/browser/ui/views/my_dialog_views.cc: - void ShowMyDialog(...) { ... } +//chrome/browser/ui/views/my_dialog_views.cc: + void ShowMyDialog(...) { ... } -//chrome/browser/ui/android/my_dialog_android.cc: - void ShowMyDialog(...) { ... } +//chrome/browser/ui/android/my_dialog_android.cc: + void ShowMyDialog(...) { ... }
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index 98813fd..9da0228 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -2323,18 +2323,6 @@ Turn on sync </message> - <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING" desc="Alert dialog text warning the user (who is currently in incognito mode) that the site they are currently using is going to share data with an external application." formatter_data="android_java"> - This site is about to share information with an app outside of incognito mode. - </message> - <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING_TITLE" desc="Title for dialog asking if the user wants to leave incognito mode. [CHAR-LIMIT=32]" formatter_data="android_java"> - Leave incognito mode? - </message> - <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_STAY" desc="Label for the dialog button to stay in incognito mode. [CHAR-LIMIT=20]" formatter_data="android_java"> - Stay - </message> - <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_LEAVE" desc="Label for the dialog button to leave incognito mode. [CHAR-LIMIT=20]" formatter_data="android_java"> - Leave - </message> <message name="IDS_EXTERNAL_APP_RESTRICTED_ACCESS_ERROR" desc="A message shown to the user if Chrome receives a file view request to something Chrome does not have access to view." formatter_data="android_java"> Chrome does not have access to the requested resource. </message>
diff --git a/chrome/browser/ui/app_list/app_context_menu_unittest.cc b/chrome/browser/ui/app_list/app_context_menu_unittest.cc index fb6e7433..860a300 100644 --- a/chrome/browser/ui/app_list/app_context_menu_unittest.cc +++ b/chrome/browser/ui/app_list/app_context_menu_unittest.cc
@@ -10,7 +10,9 @@ #include "ash/public/cpp/app_menu_constants.h" #include "base/bind.h" +#include "base/json/json_file_value_serializer.h" #include "base/macros.h" +#include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -20,25 +22,28 @@ #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_test.h" #include "chrome/browser/chromeos/arc/icon_decode_request.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/menu_manager_factory.h" #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_test_util.h" #include "chrome/browser/ui/app_list/app_service/app_service_app_item.h" +#include "chrome/browser/ui/app_list/app_service/app_service_context_menu.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_test.h" #include "chrome/browser/ui/app_list/chrome_app_list_item.h" -#include "chrome/browser/ui/app_list/extension_app_context_menu.h" #include "chrome/browser/ui/app_list/internal_app/internal_app_metadata.h" #include "chrome/browser/ui/app_list/test/fake_app_list_model_updater.h" #include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/common/chrome_features.h" +#include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" #include "components/arc/test/fake_app_instance.h" #include "components/keyed_service/core/keyed_service.h" #include "components/services/app_service/public/cpp/app_update.h" +#include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/ui_base_features.h" #include "ui/display/test/test_screen.h" @@ -223,7 +228,7 @@ Profile* profile() { return profile_.get(); } - void AddToStates(const app_list::ExtensionAppContextMenu& menu, + void AddToStates(const AppServiceContextMenu& menu, MenuState state, std::vector<MenuState>* states) { // If the command is not enabled do not add it to states. @@ -233,15 +238,45 @@ states->push_back(state); } + scoped_refptr<extensions::Extension> MakeApp(const std::string& app_id, + bool platform_app) { + base::FilePath path; + base::PathService::Get(chrome::DIR_TEST_DATA, &path); + path = path.AppendASCII("extensions").AppendASCII("manifest_tests"); + base::FilePath manifest_path = + (platform_app) ? path.AppendASCII("init_valid_platform_app.json") + : path.AppendASCII("hosted_app_absolute_options.json"); + + JSONFileValueDeserializer deserializer(manifest_path); + std::unique_ptr<base::Value> manifest = + deserializer.Deserialize(nullptr, nullptr); + + base::Value value = base::Value(std::move(*manifest)); + DCHECK(value.is_dict()); + const base::DictionaryValue* dictionary_manifest = nullptr; + value.GetAsDictionary(&dictionary_manifest); + std::string error; + return extensions::Extension::Create( + path.DirName(), extensions::Manifest::INTERNAL, *dictionary_manifest, + extensions::Extension::NO_FLAGS, app_id, &error); + } + void TestExtensionApp(const std::string& app_id, bool platform_app, AppListControllerDelegate::Pinnable pinnable, extensions::LaunchType launch_type) { + scoped_refptr<extensions::Extension> store = MakeApp(app_id, platform_app); + service_->AddExtension(store.get()); + extensions::ExtensionRegistry::Get(profile())->AddEnabled(store); + app_service_test_.SetUp(profile()); + app_service_test_.FlushMojoCalls(); + controller_ = std::make_unique<FakeAppListControllerDelegate>(); controller_->SetAppPinnable(app_id, pinnable); controller_->SetExtensionLaunchType(profile(), app_id, launch_type); - app_list::ExtensionAppContextMenu menu(menu_delegate(), profile(), app_id, - controller(), platform_app); + + AppServiceContextMenu menu(menu_delegate(), profile(), app_id, + controller()); std::unique_ptr<ui::MenuModel> menu_model = GetMenuModel(&menu); ASSERT_NE(nullptr, menu_model); @@ -257,18 +292,36 @@ &states); } if (!platform_app) - AddToStates(menu, MenuState(ash::OPTIONS, false, false), &states); + AddToStates(menu, MenuState(ash::OPTIONS), &states); AddToStates(menu, MenuState(ash::UNINSTALL), &states); AddToStates(menu, MenuState(ash::SHOW_APP_INFO), &states); ValidateMenuState(menu_model.get(), states); } + scoped_refptr<extensions::Extension> MakeChromeApp() { + std::string err; + base::DictionaryValue value; + value.SetString("name", "Chrome App"); + value.SetString("version", "0.0"); + value.SetString("app.launch.web_url", "http://google.com"); + scoped_refptr<extensions::Extension> app = extensions::Extension::Create( + base::FilePath(), extensions::Manifest::INTERNAL, value, + extensions::Extension::WAS_INSTALLED_BY_DEFAULT, + extension_misc::kChromeAppId, &err); + EXPECT_EQ(err, ""); + return app; + } + void TestChromeApp() { + scoped_refptr<extensions::Extension> store = MakeChromeApp(); + service_->AddExtension(store.get()); + app_service_test_.SetUp(profile()); + app_service_test_.FlushMojoCalls(); + controller_ = std::make_unique<FakeAppListControllerDelegate>(); - app_list::ExtensionAppContextMenu menu( - menu_delegate(), profile(), extension_misc::kChromeAppId, controller(), - false /* is_platform_app */); + AppServiceContextMenu menu(menu_delegate(), profile(), + extension_misc::kChromeAppId, controller()); std::unique_ptr<ui::MenuModel> menu_model = GetMenuModel(&menu); ASSERT_NE(nullptr, menu_model); @@ -288,13 +341,12 @@ std::unique_ptr<FakeAppListControllerDelegate> controller_; std::unique_ptr<FakeAppContextMenuDelegate> menu_delegate_; std::unique_ptr<FakeAppListModelUpdater> model_updater_; + apps::AppServiceTest app_service_test_; DISALLOW_COPY_AND_ASSIGN(AppContextMenuTest); }; TEST_P(AppContextMenuTest, ExtensionApp) { - app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( - false); for (extensions::LaunchType launch_type = extensions::LAUNCH_TYPE_FIRST; launch_type < extensions::NUM_LAUNCH_TYPES; launch_type = static_cast<extensions::LaunchType>(launch_type + 1)) { @@ -316,17 +368,12 @@ } TEST_P(AppContextMenuTest, ChromeApp) { - app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( - true); TestChromeApp(); } TEST_P(AppContextMenuTest, NonExistingExtensionApp) { - app_list::ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( - false); - app_list::ExtensionAppContextMenu menu( - menu_delegate(), profile(), "some_non_existing_extension_app", - controller(), false /* is_platform_app */); + AppServiceContextMenu menu(menu_delegate(), profile(), + "some_non_existing_extension_app", controller()); std::unique_ptr<ui::MenuModel> menu_model = GetMenuModel(&menu); EXPECT_EQ(nullptr, menu_model); }
diff --git a/chrome/browser/ui/app_list/app_service/app_service_app_item.cc b/chrome/browser/ui/app_list/app_service/app_service_app_item.cc index 8e77a1a..49a7604 100644 --- a/chrome/browser/ui/app_list/app_service/app_service_app_item.cc +++ b/chrome/browser/ui/app_list/app_service/app_service_app_item.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_service/app_service_context_menu.h" -#include "chrome/browser/ui/app_list/extension_app_context_menu.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/common/chrome_features.h"
diff --git a/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc b/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc index be7e8f3f..3027236 100644 --- a/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc +++ b/chrome/browser/ui/app_list/app_service/app_service_context_menu.cc
@@ -84,6 +84,12 @@ apps::AppServiceProxy* proxy = apps::AppServiceProxyFactory::GetForProfile(profile()); DCHECK(proxy); + if (proxy->AppRegistryCache().GetAppType(app_id()) == + apps::mojom::AppType::kUnknown) { + std::move(callback).Run(nullptr); + return; + } + proxy->GetMenuModel( app_id(), apps::mojom::MenuType::kAppList, controller()->GetAppListDisplayId(),
diff --git a/chrome/browser/ui/app_list/extension_app_context_menu.cc b/chrome/browser/ui/app_list/extension_app_context_menu.cc deleted file mode 100644 index 88c6488..0000000 --- a/chrome/browser/ui/app_list/extension_app_context_menu.cc +++ /dev/null
@@ -1,235 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/app_list/extension_app_context_menu.h" - -#include "ash/public/cpp/app_menu_constants.h" -#include "base/bind.h" -#include "chrome/browser/extensions/context_menu_matcher.h" -#include "chrome/browser/extensions/menu_manager.h" -#include "chrome/browser/prefs/incognito_mode_prefs.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_context_menu_delegate.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/browser/ui/app_list/extension_app_utils.h" -#include "chrome/browser/web_applications/system_web_app_manager.h" -#include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/grit/chromium_strings.h" -#include "chrome/grit/generated_resources.h" -#include "content/public/browser/context_menu_params.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/display/scoped_display_for_new_windows.h" -#include "ui/gfx/paint_vector_icon.h" -#include "ui/views/controls/menu/menu_config.h" -#include "ui/views/vector_icons.h" - -namespace app_list { - -namespace { - -bool disable_installed_extension_check_for_testing = false; - -bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { - return item->contexts().Contains(extensions::MenuItem::LAUNCHER); -} - -} // namespace - -ExtensionAppContextMenu::ExtensionAppContextMenu( - AppContextMenuDelegate* delegate, - Profile* profile, - const std::string& app_id, - AppListControllerDelegate* controller, - bool is_platform_app) - : AppContextMenu(delegate, profile, app_id, controller), - is_platform_app_(is_platform_app) {} - -ExtensionAppContextMenu::~ExtensionAppContextMenu() {} - -// static -void ExtensionAppContextMenu::DisableInstalledExtensionCheckForTesting( - bool disable) { - disable_installed_extension_check_for_testing = disable; -} - -int ExtensionAppContextMenu::GetLaunchStringId() const { - bool launch_in_window = IsCommandIdChecked(ash::USE_LAUNCH_TYPE_WINDOW); - return launch_in_window ? IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW - : IDS_APP_LIST_CONTEXT_MENU_NEW_TAB; -} - -void ExtensionAppContextMenu::GetMenuModel(GetMenuModelCallback callback) { - if (!disable_installed_extension_check_for_testing && - !controller()->IsExtensionInstalled(profile(), app_id())) { - std::move(callback).Run(nullptr); - return; - } - - AppContextMenu::GetMenuModel(std::move(callback)); -} - -void ExtensionAppContextMenu::BuildMenu(ui::SimpleMenuModel* menu_model) { - if (app_id() == extension_misc::kChromeAppId) { - AddContextMenuOption(menu_model, ash::APP_CONTEXT_MENU_NEW_WINDOW, - IDS_APP_LIST_NEW_WINDOW); - if (!profile()->IsOffTheRecord()) { - AddContextMenuOption(menu_model, - ash::APP_CONTEXT_MENU_NEW_INCOGNITO_WINDOW, - IDS_APP_LIST_NEW_INCOGNITO_WINDOW); - } - AddContextMenuOption(menu_model, ash::SHOW_APP_INFO, - IDS_APP_CONTEXT_MENU_SHOW_INFO); - } else { - extension_menu_items_ = std::make_unique<extensions::ContextMenuMatcher>( - profile(), this, menu_model, - base::Bind(MenuItemHasLauncherContext)); - - bool is_system_web_app = web_app::WebAppProvider::Get(profile()) - ->system_web_app_manager() - .IsSystemWebApp(app_id()); - - // First, add the primary actions. - if (!is_platform_app_ && !is_system_web_app) - CreateOpenNewSubmenu(menu_model); - - // Create default items. - AppContextMenu::BuildMenu(menu_model); - - // Assign unique IDs to commands added by the app itself. - int index = ash::USE_LAUNCH_TYPE_COMMAND_END; - extension_menu_items_->AppendExtensionItems( - extensions::MenuItem::ExtensionKey(app_id()), - base::string16(), - &index, - false); // is_action_menu - - const int appended_count = index - ash::USE_LAUNCH_TYPE_COMMAND_END; - AddMenuItemIconsForSystemApps(app_id(), menu_model, - menu_model->GetItemCount() - appended_count, - appended_count); - - if (!is_platform_app_) - AddContextMenuOption(menu_model, ash::OPTIONS, IDS_NEW_TAB_APP_OPTIONS); - - AddContextMenuOption(menu_model, ash::UNINSTALL, - is_platform_app_ ? IDS_APP_LIST_UNINSTALL_ITEM - : IDS_APP_LIST_EXTENSIONS_UNINSTALL); - - if (!is_system_web_app) { - AddContextMenuOption(menu_model, ash::SHOW_APP_INFO, - IDS_APP_CONTEXT_MENU_SHOW_INFO); - } - } -} - -base::string16 ExtensionAppContextMenu::GetLabelForCommandId( - int command_id) const { - if (command_id == ash::LAUNCH_NEW) - return l10n_util::GetStringUTF16(GetLaunchStringId()); - - return AppContextMenu::GetLabelForCommandId(command_id); -} - -ui::ImageModel ExtensionAppContextMenu::GetIconForCommandId( - int command_id) const { - if (command_id == ash::LAUNCH_NEW) { - return ui::ImageModel::FromVectorIcon( - GetMenuItemVectorIcon(ash::LAUNCH_NEW, GetLaunchStringId())); - } - - return AppContextMenu::GetIconForCommandId(command_id); -} - -bool ExtensionAppContextMenu::IsItemForCommandIdDynamic(int command_id) const { - return command_id == ash::LAUNCH_NEW || - AppContextMenu::IsItemForCommandIdDynamic(command_id); -} - -bool ExtensionAppContextMenu::IsCommandIdChecked(int command_id) const { - if (command_id >= ash::USE_LAUNCH_TYPE_COMMAND_START && - command_id < ash::USE_LAUNCH_TYPE_COMMAND_END) { - return static_cast<int>( - controller()->GetExtensionLaunchType(profile(), app_id())) + - ash::USE_LAUNCH_TYPE_COMMAND_START == - command_id; - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - return extension_menu_items_->IsCommandIdChecked(command_id); - } - return AppContextMenu::IsCommandIdChecked(command_id); -} - -bool ExtensionAppContextMenu::IsCommandIdEnabled(int command_id) const { - if (command_id == ash::OPTIONS) { - return controller()->HasOptionsPage(profile(), app_id()); - } else if (command_id == ash::UNINSTALL) { - return controller()->UninstallAllowed(profile(), app_id()); - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - return extension_menu_items_->IsCommandIdEnabled(command_id); - } else if (command_id == ash::APP_CONTEXT_MENU_NEW_WINDOW) { - // "Normal" windows are not allowed when incognito is enforced. - return IncognitoModePrefs::GetAvailability(profile()->GetPrefs()) != - IncognitoModePrefs::FORCED; - } else if (command_id == ash::APP_CONTEXT_MENU_NEW_INCOGNITO_WINDOW) { - // Incognito windows are not allowed when incognito is disabled. - return IncognitoModePrefs::GetAvailability(profile()->GetPrefs()) != - IncognitoModePrefs::DISABLED; - } - return AppContextMenu::IsCommandIdEnabled(command_id); -} - -void ExtensionAppContextMenu::ExecuteCommand(int command_id, int event_flags) { - // Place new windows on the same display as the context menu. - display::ScopedDisplayForNewWindows scoped_display( - controller()->GetAppListDisplayId()); - if (command_id == ash::LAUNCH_NEW) { - delegate()->ExecuteLaunchCommand(event_flags); - } else if (command_id == ash::SHOW_APP_INFO) { - controller()->DoShowAppInfoFlow(profile(), app_id()); - } else if (command_id >= ash::USE_LAUNCH_TYPE_COMMAND_START && - command_id < ash::USE_LAUNCH_TYPE_COMMAND_END) { - // Hosted apps can only toggle between LAUNCH_TYPE_WINDOW and - // LAUNCH_TYPE_REGULAR. - extensions::LaunchType launch_type = - (controller()->GetExtensionLaunchType(profile(), app_id()) == - extensions::LAUNCH_TYPE_WINDOW) - ? extensions::LAUNCH_TYPE_REGULAR - : extensions::LAUNCH_TYPE_WINDOW; - controller()->SetExtensionLaunchType(profile(), app_id(), launch_type); - } else if (command_id == ash::OPTIONS) { - controller()->ShowOptionsPage(profile(), app_id()); - } else if (command_id == ash::UNINSTALL) { - controller()->UninstallApp(profile(), app_id()); - } else if (extensions::ContextMenuMatcher::IsExtensionsCustomCommandId( - command_id)) { - extension_menu_items_->ExecuteCommand(command_id, nullptr, nullptr, - content::ContextMenuParams()); - } else if (command_id == ash::APP_CONTEXT_MENU_NEW_WINDOW) { - controller()->CreateNewWindow(/*incognito=*/false); - } else if (command_id == ash::APP_CONTEXT_MENU_NEW_INCOGNITO_WINDOW) { - controller()->CreateNewWindow(/*incognito=*/true); - } else { - AppContextMenu::ExecuteCommand(command_id, event_flags); - } -} - -void ExtensionAppContextMenu::CreateOpenNewSubmenu( - ui::SimpleMenuModel* menu_model) { - // Touchable extension context menus use an actionable submenu for LAUNCH_NEW. - const int kGroupId = 1; - open_new_submenu_model_ = std::make_unique<ui::SimpleMenuModel>(this); - open_new_submenu_model_->AddRadioItemWithStringId( - ash::USE_LAUNCH_TYPE_REGULAR, IDS_APP_LIST_CONTEXT_MENU_NEW_TAB, - kGroupId); - open_new_submenu_model_->AddRadioItemWithStringId( - ash::USE_LAUNCH_TYPE_WINDOW, IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW, - kGroupId); - menu_model->AddActionableSubmenuWithStringIdAndIcon( - ash::LAUNCH_NEW, GetLaunchStringId(), open_new_submenu_model_.get(), - ui::ImageModel::FromVectorIcon( - GetMenuItemVectorIcon(ash::LAUNCH_NEW, GetLaunchStringId()))); -} - -} // namespace app_list
diff --git a/chrome/browser/ui/app_list/extension_app_context_menu.h b/chrome/browser/ui/app_list/extension_app_context_menu.h deleted file mode 100644 index 7907b199..0000000 --- a/chrome/browser/ui/app_list/extension_app_context_menu.h +++ /dev/null
@@ -1,69 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ -#define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ - -#include <memory> -#include <string> - -#include "base/macros.h" -#include "chrome/browser/ui/app_list/app_context_menu.h" -#include "ui/base/models/image_model.h" - -class AppListControllerDelegate; -class Profile; - -namespace extensions { -class ContextMenuMatcher; -} - -namespace app_list { - -class AppContextMenuDelegate; - -class ExtensionAppContextMenu : public AppContextMenu { - public: - ExtensionAppContextMenu(AppContextMenuDelegate* delegate, - Profile* profile, - const std::string& app_id, - AppListControllerDelegate* controller, - bool is_platform_app); - ~ExtensionAppContextMenu() override; - - static void DisableInstalledExtensionCheckForTesting(bool disable); - - // Returns the string id based on launch type. - int GetLaunchStringId() const; - - // AppContextMenu overrides: - void GetMenuModel(GetMenuModelCallback callback) override; - void BuildMenu(ui::SimpleMenuModel* menu_model) override; - - // ui::SimpleMenuModel::Delegate overrides: - base::string16 GetLabelForCommandId(int command_id) const override; - ui::ImageModel GetIconForCommandId(int command_id) const override; - bool IsItemForCommandIdDynamic(int command_id) const override; - bool IsCommandIdChecked(int command_id) const override; - bool IsCommandIdEnabled(int command_id) const override; - void ExecuteCommand(int command_id, int event_flags) override; - - private: - // Creates the actionable submenu for LAUNCH_NEW. - void CreateOpenNewSubmenu(ui::SimpleMenuModel* menu_model); - - bool is_platform_app_; - - // The MenuModel used to control LAUNCH_NEW's icon, label, and - // execution when touchable app context menus are enabled. - std::unique_ptr<ui::SimpleMenuModel> open_new_submenu_model_; - - std::unique_ptr<extensions::ContextMenuMatcher> extension_menu_items_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionAppContextMenu); -}; - -} // namespace app_list - -#endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_
diff --git a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.cc b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.cc index 305761f..79a1c3f 100644 --- a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.cc +++ b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.cc
@@ -41,11 +41,17 @@ OnBubbleClosing(); } -base::string16 PostSaveCompromisedBubbleController::GetBody() const { +base::string16 PostSaveCompromisedBubbleController::GetBody() { switch (type_) { - case BubbleType::kPasswordUpdatedSafeState: - return l10n_util::GetStringUTF16( - IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE); + case BubbleType::kPasswordUpdatedSafeState: { + base::string16 settings = + l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAFE_STATE_SETTINGS); + size_t offset = 0; + base::string16 body = l10n_util::GetStringFUTF16( + IDS_PASSWORD_MANAGER_SAFE_STATE_BODY_MESSAGE, settings, &offset); + link_range_ = gfx::Range(offset, offset + settings.size()); + return body; + } case BubbleType::kPasswordUpdatedWithMoreToFix: return l10n_util::GetPluralStringFUTF16( IDS_PASSWORD_MANAGER_MORE_TO_FIX_BODY_MESSAGE, @@ -57,6 +63,10 @@ } } +gfx::Range PostSaveCompromisedBubbleController::GetSettingLinkRange() const { + return link_range_; +} + base::string16 PostSaveCompromisedBubbleController::GetButtonText() const { switch (type_) { case BubbleType::kPasswordUpdatedSafeState: @@ -102,6 +112,12 @@ delegate_->NavigateToPasswordCheckup(referrer); } +void PostSaveCompromisedBubbleController::OnSettingsClicked() { + if (delegate_) + delegate_->NavigateToPasswordManagerSettingsPage( + password_manager::ManagePasswordsReferrer::kSafeStateBubble); +} + base::string16 PostSaveCompromisedBubbleController::GetTitle() const { switch (type_) { case BubbleType::kPasswordUpdatedSafeState:
diff --git a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.h b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.h index 6991635..fd1c1c93 100644 --- a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.h +++ b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_POST_SAVE_COMPROMISED_BUBBLE_CONTROLLER_H_ #include "chrome/browser/ui/passwords/bubble_controllers/password_bubble_controller_base.h" +#include "ui/gfx/range/range.h" class PasswordsModelDelegate; @@ -30,13 +31,17 @@ ~PostSaveCompromisedBubbleController() override; BubbleType type() const { return type_; } - base::string16 GetBody() const; + base::string16 GetBody(); + gfx::Range GetSettingLinkRange() const; base::string16 GetButtonText() const; int GetImageID(bool dark) const; // The user chose to check passwords. void OnAccepted(); + // The user chose to view passwords. + void OnSettingsClicked(); + private: // PasswordBubbleControllerBase: base::string16 GetTitle() const override; @@ -44,6 +49,8 @@ BubbleType type_; bool checked_clicked_ = false; + // Link to the settings range in the body text. + gfx::Range link_range_; }; #endif // CHROME_BROWSER_UI_PASSWORDS_BUBBLE_CONTROLLERS_POST_SAVE_COMPROMISED_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller_unittest.cc b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller_unittest.cc index 7b655208..c958a7304 100644 --- a/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller_unittest.cc +++ b/chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller_unittest.cc
@@ -71,12 +71,22 @@ kPasswordUpdatedSafeState, controller()->type()); EXPECT_NE(base::string16(), controller()->GetBody()); + EXPECT_NE(gfx::Range(), controller()->GetSettingLinkRange()); EXPECT_EQ(base::string16(), controller()->GetButtonText()); EXPECT_EQ(IDR_SAVED_PASSWORDS_SAFE_STATE_DARK, controller()->GetImageID(true)); EXPECT_EQ(IDR_SAVED_PASSWORDS_SAFE_STATE, controller()->GetImageID(false)); } +TEST_F(PostSaveCompromisedBubbleControllerTest, SafeState_Click) { + CreateController(password_manager::ui::PASSWORD_UPDATED_SAFE_STATE); + + EXPECT_CALL(*delegate(), + NavigateToPasswordManagerSettingsPage( + password_manager::ManagePasswordsReferrer::kSafeStateBubble)); + controller()->OnSettingsClicked(); +} + TEST_F(PostSaveCompromisedBubbleControllerTest, MoreToFix_Destroy) { base::HistogramTester histogram_tester; CreateController(password_manager::ui::PASSWORD_UPDATED_MORE_TO_FIX); @@ -100,6 +110,7 @@ kPasswordUpdatedWithMoreToFix, controller()->type()); EXPECT_NE(base::string16(), controller()->GetBody()); + EXPECT_EQ(gfx::Range(), controller()->GetSettingLinkRange()); EXPECT_NE(base::string16(), controller()->GetButtonText()); EXPECT_EQ(IDR_SAVED_PASSWORDS_NEUTRAL_STATE_DARK, controller()->GetImageID(true)); @@ -140,6 +151,7 @@ EXPECT_EQ(PostSaveCompromisedBubbleController::BubbleType::kUnsafeState, controller()->type()); EXPECT_NE(base::string16(), controller()->GetBody()); + EXPECT_EQ(gfx::Range(), controller()->GetSettingLinkRange()); EXPECT_NE(base::string16(), controller()->GetButtonText()); EXPECT_EQ(IDR_SAVED_PASSWORDS_WARNING_STATE_DARK, controller()->GetImageID(true));
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc index 2744f46a..b7bcaa4 100644 --- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc +++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
@@ -208,6 +208,8 @@ return "password_generation_confirmation"; case ManagePasswordsReferrer::kProfileChooser: return "profile_chooser"; + case ManagePasswordsReferrer::kSafeStateBubble: + return "safe_state"; case ManagePasswordsReferrer::kPasswordsAccessorySheet: case ManagePasswordsReferrer::kTouchToFill: NOTREACHED();
diff --git a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc index 5705ecf3..dedec5fd 100644 --- a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc +++ b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
@@ -57,18 +57,18 @@ namespace { -template<typename T> -void GetValueAndQuit(T* result, const base::Closure& quit, T actual) { +template <typename T> +void GetValueAndQuit(T* result, base::OnceClosure quit, T actual) { *result = actual; - quit.Run(); + std::move(quit).Run(); } template <typename T> T GetCallbackResult( - const base::Callback<void(base::OnceCallback<void(T)>)>& callback) { + base::OnceCallback<void(base::OnceCallback<void(T)>)> callback) { T result = false; base::RunLoop loop; - callback.Run( + std::move(callback).Run( base::BindOnce(&GetValueAndQuit<T>, &result, loop.QuitClosure())); loop.Run(); return result; @@ -188,11 +188,8 @@ TEST_F(ProfileSigninConfirmationHelperTest, DISABLED_DoNotPromptForNewProfile) { // Profile is new and there's no profile data. profile_->SetIsNewProfile(true); - EXPECT_FALSE( - GetCallbackResult( - base::Bind( - &ui::CheckShouldPromptForNewProfile, - profile_.get()))); + EXPECT_FALSE(GetCallbackResult( + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); } TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Bookmarks) { @@ -203,11 +200,8 @@ model_->AddURL(model_->bookmark_bar_node(), 0, base::string16(base::ASCIIToUTF16("foo")), GURL("http://foo.com")); - EXPECT_TRUE( - GetCallbackResult( - base::Bind( - &ui::CheckShouldPromptForNewProfile, - profile_.get()))); + EXPECT_TRUE(GetCallbackResult( + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); } #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -226,7 +220,7 @@ ->AddGrantedPermissions(webstore->id(), extensions::PermissionSet()); extensions->AddExtension(webstore.get()); EXPECT_FALSE(GetCallbackResult( - base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); scoped_refptr<extensions::Extension> extension = CreateExtension("foo", std::string(), extensions::Manifest::INTERNAL); @@ -234,7 +228,7 @@ ->AddGrantedPermissions(extension->id(), extensions::PermissionSet()); extensions->AddExtension(extension.get()); EXPECT_TRUE(GetCallbackResult( - base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); } #endif @@ -255,11 +249,8 @@ history::RedirectList(), ui::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED, false, false); } - EXPECT_TRUE( - GetCallbackResult( - base::Bind( - &ui::CheckShouldPromptForNewProfile, - profile_.get()))); + EXPECT_TRUE(GetCallbackResult( + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); } // http://crbug.com/393149 @@ -274,19 +265,13 @@ history->AddPage(GURL("http://example.com"), base::Time::Now(), NULL, 1, GURL(), history::RedirectList(), ui::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, false, false); - EXPECT_TRUE( - GetCallbackResult( - base::Bind( - &ui::CheckShouldPromptForNewProfile, - profile_.get()))); + EXPECT_TRUE(GetCallbackResult( + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); } TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { // Browser has been shut down since profile was created. profile_->SetIsNewProfile(false); - EXPECT_TRUE( - GetCallbackResult( - base::Bind( - &ui::CheckShouldPromptForNewProfile, - profile_.get()))); + EXPECT_TRUE(GetCallbackResult( + base::BindOnce(&ui::CheckShouldPromptForNewProfile, profile_.get()))); }
diff --git a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc index 45c86348..a42c0c7 100644 --- a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc +++ b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc
@@ -1341,12 +1341,12 @@ cardholder_name_textfield->InsertOrReplaceText(base::ASCIIToUTF16("")); views::LabelButton* save_button = static_cast<views::LabelButton*>( FindViewInBubbleById(DialogViewId::OK_BUTTON)); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_DISABLED); // Setting a cardholder name should enable the [Save] button. cardholder_name_textfield->InsertOrReplaceText( base::ASCIIToUTF16("John Smith")); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_NORMAL); } @@ -1811,21 +1811,21 @@ // because there are no preselected values in the dropdown lists. views::LabelButton* save_button = static_cast<views::LabelButton*>( FindViewInBubbleById(DialogViewId::OK_BUTTON)); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_DISABLED); // Selecting only month or year will disable [Save] button. year_input()->SetSelectedRow(2); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_DISABLED); year_input()->SetSelectedRow(0); month_input()->SetSelectedRow(2); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_DISABLED); // Selecting both month and year will enable [Save] button. month_input()->SetSelectedRow(2); year_input()->SetSelectedRow(2); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_NORMAL); } @@ -1850,7 +1850,7 @@ // Selecting expired date will disable [Save] button. month_input()->SetSelectedRow(1); year_input()->SetSelectedRow(1); - EXPECT_EQ(save_button->state(), + EXPECT_EQ(save_button->GetState(), views::LabelButton::ButtonState::STATE_DISABLED); }
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index 4380f34..eaf8946 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -557,7 +557,7 @@ // Button should be depressed. views::LabelButton* button = GetBookmarkButton(0); - ASSERT_TRUE(button->state() == views::Button::STATE_PRESSED); + ASSERT_TRUE(button->GetState() == views::Button::STATE_PRESSED); // Click on the 2nd menu item (A URL). ASSERT_TRUE(menu->GetSubmenu()); @@ -577,7 +577,7 @@ // Make sure button is no longer pushed. views::LabelButton* button = GetBookmarkButton(0); - ASSERT_TRUE(button->state() == views::Button::STATE_NORMAL); + ASSERT_TRUE(button->GetState() == views::Button::STATE_NORMAL); views::MenuItemView* menu = bb_view_->GetMenu(); ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing()); @@ -632,7 +632,7 @@ // Make sure button is no longer pushed. views::LabelButton* button = GetBookmarkButton(0); - ASSERT_TRUE(button->state() == views::Button::STATE_NORMAL); + ASSERT_TRUE(button->GetState() == views::Button::STATE_NORMAL); Done(); } @@ -876,7 +876,7 @@ // The button should be highlighted now. EXPECT_EQ(views::Button::STATE_PRESSED, - bb_view_->other_bookmarks_button()->state()); + bb_view_->other_bookmarks_button()->GetState()); // Cause the target view to trigger a mouse up when dragged over. const views::View* target_view = drop_submenu->GetMenuItemAt(0); @@ -894,7 +894,7 @@ void OnWidgetDragComplete(views::Widget* widget) override { // The button should be in normal state now. EXPECT_EQ(views::Button::STATE_NORMAL, - bb_view_->other_bookmarks_button()->state()); + bb_view_->other_bookmarks_button()->GetState()); BookmarkBarViewDragTestBase::OnWidgetDragComplete(widget); } @@ -1537,7 +1537,7 @@ // Button should be depressed. views::LabelButton* button = GetBookmarkButton(0); - ASSERT_TRUE(button->state() == views::Button::STATE_PRESSED); + ASSERT_TRUE(button->GetState() == views::Button::STATE_PRESSED); // Close the window. window()->Close(); @@ -1663,7 +1663,7 @@ ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); // The button should be pressed. EXPECT_EQ(views::Button::STATE_PRESSED, - bb_view_->other_bookmarks_button()->state()); + bb_view_->other_bookmarks_button()->GetState()); // Move the mouse to the first folder on the bookmark bar. views::LabelButton* button = GetBookmarkButton(0); @@ -1682,10 +1682,10 @@ // The menu for the first folder should be in the pressed state (since the // menu is showing for it)... - EXPECT_EQ(views::Button::STATE_PRESSED, GetBookmarkButton(0)->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, GetBookmarkButton(0)->GetState()); // ... And the "other bookmarks" button should no longer be pressed. EXPECT_EQ(views::Button::STATE_NORMAL, - bb_view_->other_bookmarks_button()->state()); + bb_view_->other_bookmarks_button()->GetState()); menu->GetMenuController()->Cancel(views::MenuController::ExitType::kAll);
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc b/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc index 03e27d6..f50d405 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc
@@ -533,9 +533,10 @@ ASSERT_TRUE(VerifyUi()); ASSERT_EQ(1u, GetExtensionsMenuItemViews().size()); - EXPECT_EQ( - views::Button::STATE_DISABLED, - GetExtensionsMenuItemViews().front()->pin_button_for_testing()->state()); + EXPECT_EQ(views::Button::STATE_DISABLED, GetExtensionsMenuItemViews() + .front() + ->pin_button_for_testing() + ->GetState()); DismissUi(); }
diff --git a/chrome/browser/ui/views/frame/windows_10_caption_button.cc b/chrome/browser/ui/views/frame/windows_10_caption_button.cc index aaa8cf91..731e922 100644 --- a/chrome/browser/ui/views/frame/windows_10_caption_button.cc +++ b/chrome/browser/ui/views/frame/windows_10_caption_button.cc
@@ -119,7 +119,7 @@ } SkAlpha alpha; - if (state() == STATE_PRESSED) + if (GetState() == STATE_PRESSED) alpha = pressed_alpha; else alpha = gfx::Tween::IntValueBetween(hover_animation().GetCurrentValue(), @@ -180,8 +180,8 @@ void Windows10CaptionButton::PaintSymbol(gfx::Canvas* canvas) { SkColor symbol_color = GetBaseColor(); - if (!frame_view_->ShouldPaintAsActive() && state() != STATE_HOVERED && - state() != STATE_PRESSED) { + if (!frame_view_->ShouldPaintAsActive() && GetState() != STATE_HOVERED && + GetState() != STATE_PRESSED) { symbol_color = SkColorSetA( symbol_color, GlassBrowserFrameView::kInactiveTitlebarFeatureAlpha); } else if (button_type_ == VIEW_ID_CLOSE_BUTTON && @@ -189,7 +189,7 @@ symbol_color = gfx::Tween::ColorValueBetween( hover_animation().GetCurrentValue(), symbol_color, SK_ColorWHITE); } else if (button_type_ == VIEW_ID_CLOSE_BUTTON && - (state() == STATE_HOVERED || state() == STATE_PRESSED)) { + (GetState() == STATE_HOVERED || GetState() == STATE_PRESSED)) { symbol_color = SK_ColorWHITE; }
diff --git a/chrome/browser/ui/views/hover_button.cc b/chrome/browser/ui/views/hover_button.cc index 99a7502..e07767d 100644 --- a/chrome/browser/ui/views/hover_button.cc +++ b/chrome/browser/ui/views/hover_button.cc
@@ -258,9 +258,9 @@ // |HoverButtons| are designed for use in a list, so ensure only one button // can have a hover background at any time by requesting focus on hover. - if (state() == STATE_HOVERED && old_state != STATE_PRESSED) { + if (GetState() == STATE_HOVERED && old_state != STATE_PRESSED) { RequestFocus(); - } else if (state() == STATE_NORMAL && HasFocus()) { + } else if (GetState() == STATE_NORMAL && HasFocus()) { GetFocusManager()->SetFocusedView(nullptr); } }
diff --git a/chrome/browser/ui/views/hover_button_controller.cc b/chrome/browser/ui/views/hover_button_controller.cc index 3b971b2..a860679c 100644 --- a/chrome/browser/ui/views/hover_button_controller.cc +++ b/chrome/browser/ui/views/hover_button_controller.cc
@@ -51,7 +51,7 @@ void HoverButtonController::OnMouseReleased(const ui::MouseEvent& event) { DCHECK(notify_action() == views::ButtonController::NotifyAction::kOnRelease); - if (button()->state() != views::Button::STATE_DISABLED && + if (button()->GetState() != views::Button::STATE_DISABLED && delegate()->IsTriggerableEvent(event) && button()->HitTestPoint(event.location()) && !delegate()->InDrag()) { if (listener_)
diff --git a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc index cdbb61cc..4ab8dc4f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_tab_switch_button.cc
@@ -71,7 +71,7 @@ void OmniboxTabSwitchButton::StateChanged(ButtonState old_state) { MdTextButton::StateChanged(old_state); - if (state() == STATE_NORMAL && old_state == STATE_PRESSED) { + if (GetState() == STATE_NORMAL && old_state == STATE_PRESSED) { SetMouseHandler(parent()); if (popup_contents_view_->model()->selected_line_state() == OmniboxPopupModel::FOCUSED_BUTTON_TAB_SWITCH)
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc index c0ef631..3867194 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
@@ -456,7 +456,7 @@ label->GetText()); views::Button* button = static_cast<views::Button*>(children[2]); - EXPECT_EQ(button->state(), views::Button::STATE_DISABLED); + EXPECT_EQ(button->GetState(), views::Button::STATE_DISABLED); views::Label* desc_label = static_cast<views::Label*>(children[3]); EXPECT_EQ(base::ASCIIToUTF16("USB device allowed by your administrator"), @@ -518,7 +518,7 @@ EXPECT_EQ(base::ASCIIToUTF16("Gizmo"), label->GetText()); views::Button* button = static_cast<views::Button*>(children[2]); - EXPECT_NE(button->state(), views::Button::STATE_DISABLED); + EXPECT_NE(button->GetState(), views::Button::STATE_DISABLED); views::Label* desc_label = static_cast<views::Label*>(children[3]); EXPECT_EQ(base::ASCIIToUTF16("USB device"), desc_label->GetText()); @@ -545,7 +545,7 @@ label->GetText()); views::Button* button = static_cast<views::Button*>(children[2]); - EXPECT_EQ(button->state(), views::Button::STATE_DISABLED); + EXPECT_EQ(button->GetState(), views::Button::STATE_DISABLED); views::Label* desc_label = static_cast<views::Label*>(children[3]); EXPECT_EQ(base::ASCIIToUTF16("USB device allowed by your administrator"),
diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.cc b/chrome/browser/ui/views/passwords/credentials_item_view.cc index 299863c8..95ffddb 100644 --- a/chrome/browser/ui/views/passwords/credentials_item_view.cc +++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc
@@ -166,7 +166,7 @@ } void CredentialsItemView::OnPaintBackground(gfx::Canvas* canvas) { - if (state() == STATE_PRESSED || state() == STATE_HOVERED) { + if (GetState() == STATE_PRESSED || GetState() == STATE_HOVERED) { canvas->DrawColor(GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor)); }
diff --git a/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view_unittest.cc b/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view_unittest.cc index c289300..94577a2 100644 --- a/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/passwords/move_to_account_store_bubble_view.h" #include "base/test/scoped_feature_list.h" +#include "build/build_config.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_test_base.h" @@ -59,7 +60,13 @@ PasswordBubbleViewTestBase::TearDown(); } -TEST_F(MoveToAccountStoreBubbleViewTest, HasTwoButtons) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_HasTwoButtons DISABLED_HasTwoButtons +#else +#define MAYBE_HasTwoButtons HasTwoButtons +#endif +TEST_F(MoveToAccountStoreBubbleViewTest, MAYBE_HasTwoButtons) { CreateViewAndShow(); ASSERT_TRUE(view_->GetOkButton()); ASSERT_TRUE(view_->GetCancelButton()); @@ -69,7 +76,13 @@ view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL)); } -TEST_F(MoveToAccountStoreBubbleViewTest, HasDescription) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_HasDescription DISABLED_HasDescription +#else +#define MAYBE_HasDescription HasDescription +#endif +TEST_F(MoveToAccountStoreBubbleViewTest, MAYBE_HasDescription) { CreateViewAndShow(); ASSERT_EQ(view_->children().size(), 2u);
diff --git a/chrome/browser/ui/views/passwords/password_save_unsynced_credentials_locally_view_unittest.cc b/chrome/browser/ui/views/passwords/password_save_unsynced_credentials_locally_view_unittest.cc index cb15cd08..82d5e06 100644 --- a/chrome/browser/ui/views/passwords/password_save_unsynced_credentials_locally_view_unittest.cc +++ b/chrome/browser/ui/views/passwords/password_save_unsynced_credentials_locally_view_unittest.cc
@@ -7,6 +7,7 @@ #include <vector> #include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" #include "chrome/browser/ui/passwords/passwords_model_delegate_mock.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_test_base.h" #include "components/autofill/core/common/password_form.h" @@ -55,7 +56,14 @@ PasswordBubbleViewTestBase::TearDown(); } -TEST_F(PasswordSaveUnsyncedCredentialsLocallyViewTest, HasTitleAndTwoButtons) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_HasTitleAndTwoButtons DISABLED_HasTitleAndTwoButtons +#else +#define MAYBE_HasTitleAndTwoButtons HasTitleAndTwoButtons +#endif +TEST_F(PasswordSaveUnsyncedCredentialsLocallyViewTest, + MAYBE_HasTitleAndTwoButtons) { CreateViewAndShow(); EXPECT_TRUE(view_->ShouldShowWindowTitle()); EXPECT_TRUE(view_->GetOkButton());
diff --git a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view_unittest.cc b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view_unittest.cc index 8bb0146..494f3e71 100644 --- a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view_unittest.cc +++ b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view_unittest.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "base/test/scoped_feature_list.h" +#include "build/build_config.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_test_base.h" @@ -98,21 +99,42 @@ signin::MakePrimaryAccountAvailable(identity_manager, "test@email.com"); } -TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, HasTitleAndTwoButtons) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_HasTitleAndTwoButtons DISABLED_HasTitleAndTwoButtons +#else +#define MAYBE_HasTitleAndTwoButtons HasTitleAndTwoButtons +#endif +TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, + MAYBE_HasTitleAndTwoButtons) { CreateViewAndShow(); EXPECT_TRUE(view()->ShouldShowWindowTitle()); EXPECT_TRUE(view()->GetOkButton()); EXPECT_TRUE(view()->GetCancelButton()); } -TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, ShouldNotShowAccountPicker) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_ShouldNotShowAccountPicker DISABLED_ShouldNotShowAccountPicker +#else +#define MAYBE_ShouldNotShowAccountPicker ShouldNotShowAccountPicker +#endif +TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, + MAYBE_ShouldNotShowAccountPicker) { ON_CALL(*feature_manager_mock(), ShouldShowAccountStorageBubbleUi) .WillByDefault(Return(false)); CreateViewAndShow(); EXPECT_FALSE(account_picker()); } -TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, ShouldShowAccountPicker) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_ShouldShowAccountPicker DISABLED_ShouldShowAccountPicker +#else +#define MAYBE_ShouldShowAccountPicker ShouldShowAccountPicker +#endif +TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, + MAYBE_ShouldShowAccountPicker) { ON_CALL(*feature_manager_mock(), ShouldShowAccountStorageBubbleUi) .WillByDefault(Return(true)); SimulateSignIn(); @@ -121,8 +143,16 @@ EXPECT_EQ(0, account_picker()->GetSelectedIndex()); } +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_ShouldSelectAccountStoreByDefault \ + DISABLED_ShouldSelectAccountStoreByDefault +#else +#define MAYBE_ShouldSelectAccountStoreByDefault \ + ShouldSelectAccountStoreByDefault +#endif TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, - ShouldSelectAccountStoreByDefault) { + MAYBE_ShouldSelectAccountStoreByDefault) { ON_CALL(*feature_manager_mock(), ShouldShowAccountStorageBubbleUi) .WillByDefault(Return(true)); ON_CALL(*feature_manager_mock(), GetDefaultPasswordStore) @@ -140,8 +170,16 @@ account_picker()->GetTextForRow(account_picker()->GetSelectedIndex())); } +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_ShouldSelectProfileStoreByDefault \ + DISABLED_ShouldSelectProfileStoreByDefault +#else +#define MAYBE_ShouldSelectProfileStoreByDefault \ + ShouldSelectProfileStoreByDefault +#endif TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, - ShouldSelectProfileStoreByDefault) { + MAYBE_ShouldSelectProfileStoreByDefault) { ON_CALL(*feature_manager_mock(), ShouldShowAccountStorageBubbleUi) .WillByDefault(Return(true)); ON_CALL(*feature_manager_mock(), GetDefaultPasswordStore) @@ -156,9 +194,17 @@ account_picker()->GetTextForRow(account_picker()->GetSelectedIndex())); } +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_OnThemesChangedShouldNotCrashForFederatedCredentials \ + DISABLED_OnThemesChangedShouldNotCrashForFederatedCredentials +#else +#define MAYBE_OnThemesChangedShouldNotCrashForFederatedCredentials \ + OnThemesChangedShouldNotCrashForFederatedCredentials +#endif // This is a regression test for crbug.com/1093290 TEST_F(PasswordSaveUpdateWithAccountStoreViewTest, - OnThemesChangedShouldNotCrashForFederatedCredentials) { + MAYBE_OnThemesChangedShouldNotCrashForFederatedCredentials) { GURL kURL("https://example.com"); url::Origin kOrigin = url::Origin::Create(kURL); ON_CALL(*model_delegate_mock(), GetOrigin).WillByDefault(Return(kOrigin));
diff --git a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.cc b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.cc index 8248761f..3adb5efd 100644 --- a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.cc +++ b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.cc
@@ -12,7 +12,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/color_utils.h" #include "ui/views/bubble/bubble_frame_view.h" -#include "ui/views/controls/label.h" +#include "ui/views/controls/styled_label.h" #include "ui/views/layout/fill_layout.h" PostSaveCompromisedBubbleView::PostSaveCompromisedBubbleView( @@ -32,11 +32,15 @@ SetButtonLabel(ui::DIALOG_BUTTON_OK, std::move(button)); } - auto label = std::make_unique<views::Label>(controller_.GetBody(), - CONTEXT_BODY_TEXT_LARGE, - views::style::STYLE_SECONDARY); - label->SetHorizontalAlignment(gfx::ALIGN_LEFT); - label->SetMultiLine(true); + auto label = + std::make_unique<views::StyledLabel>(controller_.GetBody(), this); + label->SetTextContext(CONTEXT_BODY_TEXT_LARGE); + label->SetDefaultTextStyle(views::style::STYLE_SECONDARY); + gfx::Range range = controller_.GetSettingLinkRange(); + if (!range.is_empty()) { + label->AddStyleRange(range, + views::StyledLabel::RangeStyleInfo::CreateForLink()); + } AddChildView(std::move(label)); SetAcceptCallback( @@ -76,3 +80,10 @@ *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(image_id)); GetBubbleFrameView()->SetHeaderView(std::move(image_view)); } + +void PostSaveCompromisedBubbleView::StyledLabelLinkClicked( + views::StyledLabel* label, + const gfx::Range& range, + int event_flags) { + controller_.OnSettingsClicked(); +}
diff --git a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.h b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.h index 67fc084..7250b5c 100644 --- a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.h +++ b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.h
@@ -7,10 +7,12 @@ #include "chrome/browser/ui/passwords/bubble_controllers/post_save_compromised_bubble_controller.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_base.h" +#include "ui/views/controls/styled_label_listener.h" // Bubble notifying the user about remaining compromised credentials in the // store. -class PostSaveCompromisedBubbleView : public PasswordBubbleViewBase { +class PostSaveCompromisedBubbleView : public PasswordBubbleViewBase, + public views::StyledLabelListener { public: explicit PostSaveCompromisedBubbleView(content::WebContents* web_contents, views::View* anchor_view); @@ -24,6 +26,11 @@ bool ShouldShowCloseButton() const override; void OnThemeChanged() override; + // views::StyledLabelListener: + void StyledLabelLinkClicked(views::StyledLabel* label, + const gfx::Range& range, + int event_flags) override; + PostSaveCompromisedBubbleController controller_; };
diff --git a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view_unittest.cc b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view_unittest.cc index a51433b..2650d784 100644 --- a/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/passwords/post_save_compromised_bubble_view_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/passwords/post_save_compromised_bubble_view.h" +#include "build/build_config.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_test_base.h" namespace { @@ -44,7 +45,13 @@ EXPECT_FALSE(view_->GetCancelButton()); } -TEST_F(PostSaveCompromisedBubbleViewTest, MoreToFixState) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_MoreToFixState DISABLED_MoreToFixState +#else +#define MAYBE_MoreToFixState MoreToFixState +#endif +TEST_F(PostSaveCompromisedBubbleViewTest, MAYBE_MoreToFixState) { CreateViewAndShow(password_manager::ui::PASSWORD_UPDATED_MORE_TO_FIX); EXPECT_TRUE(view_->GetOkButton()); EXPECT_FALSE(view_->GetCancelButton()); @@ -53,7 +60,13 @@ view_->AcceptDialog(); } -TEST_F(PostSaveCompromisedBubbleViewTest, UnsafeState) { +// Flaky on Windows due to http://crbug.com/968222 +#if defined(OS_WIN) +#define MAYBE_UnsafeState DISABLED_UnsafeState +#else +#define MAYBE_UnsafeState UnsafeState +#endif +TEST_F(PostSaveCompromisedBubbleViewTest, MAYBE_UnsafeState) { CreateViewAndShow(password_manager::ui::PASSWORD_UPDATED_UNSAFE_STATE); EXPECT_TRUE(view_->GetOkButton()); EXPECT_FALSE(view_->GetCancelButton());
diff --git a/chrome/browser/ui/views/payments/payment_request_row_view.cc b/chrome/browser/ui/views/payments/payment_request_row_view.cc index a22eeb0..9b9ab70 100644 --- a/chrome/browser/ui/views/payments/payment_request_row_view.cc +++ b/chrome/browser/ui/views/payments/payment_request_row_view.cc
@@ -76,8 +76,8 @@ if (!clickable()) return; - SetIsHighlighted(state() == views::Button::STATE_HOVERED || - state() == views::Button::STATE_PRESSED); + SetIsHighlighted(GetState() == views::Button::STATE_HOVERED || + GetState() == views::Button::STATE_PRESSED); } void PaymentRequestRowView::OnFocus() {
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc index 1fb6e96..c57f0c9 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -165,10 +165,14 @@ SelectFileDialogExtension::RoutingID GetRoutingID( content::WebContents* web_contents, - int android_task_id) { - if (android_task_id != SelectFileDialogExtension::kAndroidTaskIdNone) { - return base::StringPrintf("android.%d", android_task_id); - } else if (web_contents) { + const SelectFileDialogExtension::Owner& owner) { + if (owner.android_task_id.has_value()) + return base::StringPrintf("android.%d", *owner.android_task_id); + + if (owner.lacros_window_id.has_value()) + return base::StringPrintf("lacros.%d", *owner.lacros_window_id); + + if (web_contents) { return base::StringPrintf( "web.%d", web_contents->GetMainFrame()->GetFrameTreeNodeId()); } @@ -180,6 +184,9 @@ ///////////////////////////////////////////////////////////////////////////// +SelectFileDialogExtension::Owner::Owner() = default; +SelectFileDialogExtension::Owner::~Owner() = default; + // static SelectFileDialogExtension* SelectFileDialogExtension::Create( Listener* listener, @@ -298,9 +305,8 @@ const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - gfx::NativeWindow owner_window, void* params, - int owner_android_task_id, + const Owner& owner, bool show_android_picker_apps) { if (owner_window_) { LOG(ERROR) << "File dialog already in use!"; @@ -314,8 +320,8 @@ content::WebContents* web_contents = nullptr; // Obtain BaseWindow and WebContents if the owner window is browser. - if (owner_android_task_id == kAndroidTaskIdNone) - FindRuntimeContext(owner_window, &base_window, &web_contents); + if (!owner.android_task_id.has_value() && !owner.lacros_window_id.has_value()) + FindRuntimeContext(owner.window, &base_window, &web_contents); if (web_contents) profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -329,7 +335,7 @@ // Check if we have another dialog opened for the contents. It's unlikely, but // possible. In such situation, discard this request. - RoutingID routing_id = GetRoutingID(web_contents, owner_android_task_id); + RoutingID routing_id = GetRoutingID(web_contents, owner); if (PendingExists(routing_id)) return; @@ -391,7 +397,7 @@ ExtensionDialog::InitParams dialog_params( {kFileManagerWidth, kFileManagerHeight}); - dialog_params.is_modal = (owner_window != nullptr); + dialog_params.is_modal = (owner.window != nullptr); dialog_params.min_size = {kFileManagerMinimumWidth, kFileManagerMinimumHeight}; dialog_params.title = file_manager::util::GetSelectFileDialogTitle(type); @@ -402,7 +408,7 @@ ExtensionDialog* dialog = ExtensionDialog::Show( file_manager_url, - base_window ? base_window->GetNativeWindow() : owner_window, profile_, + base_window ? base_window->GetNativeWindow() : owner.window, profile_, web_contents, this /* ExtensionDialog::Observer */, dialog_params); if (!dialog) { LOG(ERROR) << "Unable to create extension dialog"; @@ -418,7 +424,7 @@ extension_dialog_ = dialog; params_ = params; routing_id_ = routing_id; - owner_window_ = owner_window; + owner_window_ = owner.window; } void SelectFileDialogExtension::SelectFileImpl( @@ -431,9 +437,11 @@ gfx::NativeWindow owner_window, void* params) { // |default_extension| is ignored. - SelectFileWithFileManagerParams( - type, title, default_path, file_types, file_type_index, owner_window, - params, kAndroidTaskIdNone, /*show_android_picker_apps=*/false); + Owner owner; + owner.window = owner_window; + SelectFileWithFileManagerParams(type, title, default_path, file_types, + file_type_index, params, owner, + /*show_android_picker_apps=*/false); } bool SelectFileDialogExtension::HasMultipleFileTypeChoicesImpl() {
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.h b/chrome/browser/ui/views/select_file_dialog_extension.h index 91ed2629..8b84aad 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.h +++ b/chrome/browser/ui/views/select_file_dialog_extension.h
@@ -11,6 +11,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/optional.h" #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow #include "ui/shell_dialogs/select_file_dialog.h" @@ -42,8 +43,6 @@ // every WebContents or every Android task ID. typedef std::string RoutingID; - static const int kAndroidTaskIdNone = -1; - static SelectFileDialogExtension* Create( ui::SelectFileDialog::Listener* listener, std::unique_ptr<ui::SelectFilePolicy> policy); @@ -70,20 +69,27 @@ content::RenderViewHost* GetRenderViewHost(); // Call SelectFile with params specific to Chrome OS file manager. - // |owner_android_task_id| is the Android task ID of the owner window if the - // owner is Android, or kAndroidTaskIdNone if the owner is browser. + // |owner| specifies the window and app type that opened the dialog. // |show_android_picker_apps| determines whether to show Android picker apps // in the select file dialog. - void SelectFileWithFileManagerParams( - Type type, - const base::string16& title, - const base::FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - aura::Window* owning_window, - void* params, - int owner_android_task_id, - bool show_android_picker_apps); + struct Owner { + Owner(); + ~Owner(); + // The native window that opened the dialog. + aura::Window* window = nullptr; + // Android task ID if the owner window is an Android app. + base::Optional<int> android_task_id; + // Lacros window ID if the owner window is a Lacros browser. + base::Optional<int> lacros_window_id; + }; + void SelectFileWithFileManagerParams(Type type, + const base::string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + void* params, + const Owner& owner, + bool show_android_picker_apps); protected: // SelectFileDialog implementation.
diff --git a/chrome/browser/ui/views/toolbar/app_menu.cc b/chrome/browser/ui/views/toolbar/app_menu.cc index e7dcf3ae..b6c6f6b 100644 --- a/chrome/browser/ui/views/toolbar/app_menu.cc +++ b/chrome/browser/ui/views/toolbar/app_menu.cc
@@ -182,7 +182,7 @@ // Fill in background for state. views::Button::ButtonState state = - button ? button->state() : views::Button::STATE_NORMAL; + button ? button->GetState() : views::Button::STATE_NORMAL; DrawBackground(canvas, view, view->GetMirroredRect(bounds), state); }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_action_view.cc b/chrome/browser/ui/views/toolbar/toolbar_action_view.cc index c2bb548..4b19f021 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_action_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_action_view.cc
@@ -162,7 +162,7 @@ if (!view_controller_->IsEnabled(web_contents) && !view_controller_->DisabledClickOpensMenu()) { SetState(views::Button::STATE_DISABLED); - } else if (state() == views::Button::STATE_DISABLED) { + } else if (GetState() == views::Button::STATE_DISABLED) { SetState(views::Button::STATE_NORMAL); }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc b/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc index e9d7ea1e..72590ee 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc
@@ -230,7 +230,7 @@ ax::mojom::StringAttribute::kName)); // The button should start in normal state, with no actions executed. - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); EXPECT_EQ(0, view_controller->execute_action_count()); // Click the button. This should execute it. @@ -242,26 +242,26 @@ // Since this was not a user action, the button should not be pressed. generator.MoveMouseTo(gfx::Point(300, 300)); view_controller->ShowPopup(false); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); view_controller->HidePopup(); // Show the popup through a user action - the button should be pressed. view_controller->ShowPopup(true); - EXPECT_EQ(views::Button::STATE_PRESSED, view->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, view->GetState()); view_controller->HidePopup(); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); // Ensure that the button's enabled state reflects that of the controller. view_controller->SetEnabled(false); - EXPECT_EQ(views::Button::STATE_DISABLED, view->state()); + EXPECT_EQ(views::Button::STATE_DISABLED, view->GetState()); view_controller->SetEnabled(true); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); // Ensure that clicking on an otherwise-disabled action optionally opens the // context menu. view_controller->SetDisabledClickOpensMenu(true); view_controller->SetEnabled(false); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); int old_execute_action_count = view_controller->execute_action_count(); { OpenMenuListener menu_listener(view); @@ -279,9 +279,9 @@ // popups. view->SetVisible(false); view_controller->ShowPopup(true); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); - EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); + EXPECT_EQ(views::Button::STATE_PRESSED, overflow_button->GetState()); view_controller->HidePopup(); - EXPECT_EQ(views::Button::STATE_NORMAL, view->state()); - EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, view->GetState()); + EXPECT_EQ(views::Button::STATE_NORMAL, overflow_button->GetState()); }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc index cef55227..cc262c53 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_button.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -349,7 +349,7 @@ // Starting a drag results in a MouseExited, we need to ignore it. // A right click release triggers an exit event. We want to // remain in a PUSHED state until the drop down menu closes. - if (state() != STATE_DISABLED && !InDrag() && state() != STATE_PRESSED) + if (GetState() != STATE_DISABLED && !InDrag() && GetState() != STATE_PRESSED) SetState(STATE_NORMAL); } @@ -509,7 +509,7 @@ menu_showing_ = false; // Set the state back to normal after the drop down menu is closed. - if (state() != STATE_DISABLED) { + if (GetState() != STATE_DISABLED) { GetInkDrop()->SetHovered(IsMouseHovered()); SetState(STATE_NORMAL); }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc b/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc index 858760b..fb9b608 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc
@@ -154,7 +154,7 @@ EXPECT_FALSE(test_api.menu_showing()); EXPECT_FALSE(test_api.menu_runner()); - EXPECT_EQ(views::Button::STATE_NORMAL, button_->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, button_->GetState()); // Show the menu. Note that it is asynchronous. button_->ShowContextMenuForView(nullptr, gfx::Point(), ui::MENU_SOURCE_MOUSE); @@ -164,14 +164,14 @@ EXPECT_TRUE(test_api.menu_runner()->IsRunning()); // Button should appear pressed when the menu is showing. - EXPECT_EQ(views::Button::STATE_PRESSED, button_->state()); + EXPECT_EQ(views::Button::STATE_PRESSED, button_->GetState()); test_api.menu_runner()->Cancel(); // Ensure the ToolbarButton's |menu_runner_| member is reset to null. EXPECT_FALSE(test_api.menu_showing()); EXPECT_FALSE(test_api.menu_runner()); - EXPECT_EQ(views::Button::STATE_NORMAL, button_->state()); + EXPECT_EQ(views::Button::STATE_NORMAL, button_->GetState()); } // Test deleting a ToolbarButton while its menu is showing.
diff --git a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc index 15d3e11e..f293f92b 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.cc
@@ -153,8 +153,8 @@ views::Button* button = views::Button::AsButton(child); if (!button) continue; - if (button->state() == views::Button::ButtonState::STATE_PRESSED || - button->state() == views::Button::ButtonState::STATE_HOVERED) { + if (button->GetState() == views::Button::ButtonState::STATE_PRESSED || + button->GetState() == views::Button::ButtonState::STATE_HOVERED) { return true; } // The container should also be highlighted if a dialog is anchored to.
diff --git a/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.cc b/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.cc index 717fbbb..7f52365 100644 --- a/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.cc +++ b/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.cc
@@ -48,7 +48,7 @@ const WebApplicationInfo& web_app_info) { constexpr int kIconSize = 48; gfx::ImageSkia image(std::make_unique<WebAppInfoImageSource>( - kIconSize, web_app_info.icon_bitmaps), + kIconSize, web_app_info.icon_bitmaps_any), gfx::Size(kIconSize, kIconSize)); auto icon_image_view = std::make_unique<views::ImageView>();
diff --git a/chrome/browser/ui/views/web_apps/web_app_confirmation_view.cc b/chrome/browser/ui/views/web_apps/web_app_confirmation_view.cc index 0ce96f1..4ed7a59 100644 --- a/chrome/browser/ui/views/web_apps/web_app_confirmation_view.cc +++ b/chrome/browser/ui/views/web_apps/web_app_confirmation_view.cc
@@ -79,7 +79,7 @@ gfx::Size image_size(web_app::kWebAppIconSmall, web_app::kWebAppIconSmall); gfx::ImageSkia image( std::make_unique<WebAppInfoImageSource>(web_app::kWebAppIconSmall, - web_app_info_->icon_bitmaps), + web_app_info_->icon_bitmaps_any), image_size); icon_image_view->SetImageSize(image_size); icon_image_view->SetImage(image);
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index e763759..eda8c6d0 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -1130,7 +1130,7 @@ web_app->app_url = install_info->app_url; if (!image_result.image.IsEmpty()) { - web_app->icon_bitmaps[image_result.image.Width()] = + web_app->icon_bitmaps_any[image_result.image.Width()] = image_result.image.AsBitmap(); }
diff --git a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc index fd4f14a6..2b44821d 100644 --- a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc
@@ -4,6 +4,9 @@ #include "chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h" +#include <string> +#include <utility> + #include "ash/public/cpp/ambient/ambient_backend_controller.h" #include "ash/public/cpp/ambient/common/ambient_settings.h" #include "base/bind.h" @@ -20,16 +23,20 @@ constexpr int kBannerWidth = 512; constexpr int kBannderHeight = 512; -ash::AmbientModeTopicSource ExtractTopicSource(const base::ListValue* args) { - CHECK_EQ(args->GetSize(), 1U); +ash::AmbientModeTopicSource ExtractTopicSource(const base::Value& value) { ash::AmbientModeTopicSource topic_source = - static_cast<ash::AmbientModeTopicSource>(args->GetList()[0].GetInt()); + static_cast<ash::AmbientModeTopicSource>(value.GetInt()); // Check the |topic_source| has valid value. CHECK_GE(topic_source, ash::AmbientModeTopicSource::kMinValue); CHECK_LE(topic_source, ash::AmbientModeTopicSource::kMaxValue); return topic_source; } +ash::AmbientModeTopicSource ExtractTopicSource(const base::ListValue* args) { + CHECK_EQ(args->GetSize(), 1U); + return ExtractTopicSource(args->GetList()[0]); +} + } // namespace AmbientModeHandler::AmbientModeHandler() = default; @@ -85,12 +92,10 @@ return; ash::AmbientModeTopicSource topic_source = ExtractTopicSource(args); - DCHECK_EQ(topic_source, settings_->topic_source); - - if (topic_source == ash::AmbientModeTopicSource::kGooglePhotos) { + if (topic_source == ash::AmbientModeTopicSource::kGooglePhotos) FetchPersonalAlbums(); - } - SendPhotosContainers(); + + SendPhotosContainers(topic_source); } void AmbientModeHandler::HandleSetSelectedTopicSource( @@ -102,12 +107,23 @@ void AmbientModeHandler::HandleSetSelectedPhotosContainers( const base::ListValue* args) { - switch (settings_->topic_source) { + const base::DictionaryValue* dictionary = nullptr; + CHECK(!args->GetList().empty()); + args->GetList()[0].GetAsDictionary(&dictionary); + CHECK(dictionary); + + const base::Value* topic_source_value = dictionary->FindKey("topicSource"); + CHECK(topic_source_value); + ash::AmbientModeTopicSource topic_source = + ExtractTopicSource(*topic_source_value); + const base::Value* containers = dictionary->FindKey("topicContainers"); + CHECK(containers); + switch (topic_source) { case ash::AmbientModeTopicSource::kGooglePhotos: // For Google Photos, we will populate the |selected_album_ids| with IDs // of selected albums. settings_->selected_album_ids.clear(); - for (const auto& value : args->GetList()) { + for (const auto& value : containers->GetList()) { std::string name = value.GetString(); auto it = std::find_if( personal_albums_.albums.begin(), personal_albums_.albums.end(), @@ -122,9 +138,9 @@ for (auto& art_setting : settings_->art_settings) { std::string title = art_setting.title; auto it = std::find_if( - args->GetList().begin(), args->GetList().end(), + containers->GetList().begin(), containers->GetList().end(), [title](const auto& value) { return value.GetString() == title; }); - const bool checked = it != args->GetList().end(); + const bool checked = it != containers->GetList().end(); art_setting.enabled = checked; } break; @@ -156,12 +172,13 @@ base::Value(static_cast<int>(settings_->topic_source))); } -void AmbientModeHandler::SendPhotosContainers() { +void AmbientModeHandler::SendPhotosContainers( + ash::AmbientModeTopicSource topic_source) { DCHECK(settings_); base::Value dictionary(base::Value::Type::DICTIONARY); base::Value containers(base::Value::Type::LIST); - switch (settings_->topic_source) { + switch (topic_source) { case ash::AmbientModeTopicSource::kGooglePhotos: for (const auto& album : personal_albums_.albums) { base::Value value(base::Value::Type::DICTIONARY); @@ -182,8 +199,7 @@ break; } - dictionary.SetKey("topicSource", - base::Value(static_cast<int>(settings_->topic_source))); + dictionary.SetKey("topicSource", base::Value(static_cast<int>(topic_source))); dictionary.SetKey("topicContainers", std::move(containers)); FireWebUIListener("photos-containers-changed", std::move(dictionary)); } @@ -204,7 +220,7 @@ } void AmbientModeHandler::FetchPersonalAlbums() { - // TODO: Add a helper function to get all the albums. + // TODO(b/161044021): Add a helper function to get all the albums. ash::AmbientBackendController::Get()->FetchPersonalAlbums( kBannerWidth, kBannderHeight, /*num_albums=*/100, /*resume_token=*/"", base::BindOnce(&AmbientModeHandler::OnPersonalAlbumsFetched, @@ -223,9 +239,9 @@ // FetchPersonalAlbums() is to prefetch albums, which takes several seconds, // This improves the experience when we click into the ambientMode/photos page // to show the albums list faster. - if (settings_ && - settings_->topic_source == ash::AmbientModeTopicSource::kGooglePhotos) { - SendPhotosContainers(); + if (settings_) { + SendPhotosContainers( + /*topic_source=*/ash::AmbientModeTopicSource::kGooglePhotos); } }
diff --git a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h index ac0c6441..2c500ee 100644 --- a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h
@@ -61,9 +61,9 @@ // settings is retrieved. void SendTopicSource(); - // Send the "photos-containers-changed" WebUIListener event when the personal - // albums are retrieved. - void SendPhotosContainers(); + // Send the "photos-containers-changed" WebUIListener event with albums info + // in the |topic_source|. + void SendPhotosContainers(ash::AmbientModeTopicSource topic_source); // Update the local |settings_| to server. void UpdateSettings();
diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc index c9539ab..44a0466 100644 --- a/chrome/browser/ui/webui/theme_source.cc +++ b/chrome/browser/ui/webui/theme_source.cc
@@ -58,15 +58,6 @@ rep.GetBitmap(), false /* discard transparency */, &data->data()); } -void ProcessResourceOnUiThread(int resource_id, - float scale, - scoped_refptr<base::RefCountedBytes> data) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - ProcessImageOnUiThread( - *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id), - scale, data); -} - } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -211,22 +202,18 @@ content::URLDataSource::GotDataCallback callback, int resource_id, float scale) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes()); if (BrowserThemePack::IsPersistentImageID(resource_id)) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); const ui::ThemeProvider& tp = ThemeService::GetThemeProviderForProfile( profile_->GetOriginalProfile()); ProcessImageOnUiThread(*tp.GetImageSkiaNamed(resource_id), scale, data); - std::move(callback).Run(data.get()); } else { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - // Fetching image data in ResourceBundle should happen on the UI thread. See - // crbug.com/449277 - content::GetUIThreadTaskRunner({})->PostTaskAndReply( - FROM_HERE, - base::BindOnce(&ProcessResourceOnUiThread, resource_id, scale, data), - base::BindOnce(std::move(callback), data)); + ProcessImageOnUiThread( + *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id), + scale, data); } + std::move(callback).Run(data.get()); } std::string ThemeSource::GetAccessControlAllowOriginForOrigin(
diff --git a/chrome/browser/web_applications/components/web_app_install_utils.cc b/chrome/browser/web_applications/components/web_app_install_utils.cc index 499ea447..3c962ba 100644 --- a/chrome/browser/web_applications/components/web_app_install_utils.cc +++ b/chrome/browser/web_applications/components/web_app_install_utils.cc
@@ -270,7 +270,7 @@ FilterSquareIconsFromMap(*icons_map, &square_icons); } } - FilterSquareIconsFromBitmaps(web_app_info->icon_bitmaps, &square_icons); + FilterSquareIconsFromBitmaps(web_app_info->icon_bitmaps_any, &square_icons); base::char16 icon_letter = web_app_info->title.empty() @@ -285,8 +285,8 @@ for (auto& item : size_to_icons) { // Retain any bitmaps provided as input to the installation. - if (web_app_info->icon_bitmaps.count(item.first) == 0) - web_app_info->icon_bitmaps[item.first] = std::move(item.second); + if (web_app_info->icon_bitmaps_any.count(item.first) == 0) + web_app_info->icon_bitmaps_any[item.first] = std::move(item.second); } }
diff --git a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc index d70d6225..7b5b6710 100644 --- a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc
@@ -458,7 +458,7 @@ icons_map.emplace(IconUrl1(), bmp1); FilterAndResizeIconsGenerateMissing(&web_app_info, &icons_map); - EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps.size()); + EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps_any.size()); } // Tests that when FilterAndResizeIconsGenerateMissing is called with no @@ -472,7 +472,7 @@ icons_map.emplace(IconUrl1(), bmp1); FilterAndResizeIconsGenerateMissing(&web_app_info, &icons_map); - EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps.size()); + EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps_any.size()); } // Tests that when FilterAndResizeIconsGenerateMissing is called with both @@ -511,8 +511,8 @@ FilterAndResizeIconsGenerateMissing(&web_app_info, &icons_map); - EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps.size()); - for (const auto& icon_bitmap : web_app_info.icon_bitmaps) { + EXPECT_EQ(SizesToGenerate().size(), web_app_info.icon_bitmaps_any.size()); + for (const auto& icon_bitmap : web_app_info.icon_bitmaps_any) { EXPECT_EQ(SK_ColorWHITE, icon_bitmap.second.getColor(0, 0)); } }
diff --git a/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc b/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc index 8c4107ec2..a0b85fa 100644 --- a/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc +++ b/chrome/browser/web_applications/extensions/install_manager_bookmark_app_unittest.cc
@@ -82,8 +82,8 @@ } void SetAppIcon(WebApplicationInfo* web_app, int size, SkColor color) { - web_app->icon_bitmaps.clear(); - web_app->icon_bitmaps[size] = CreateSquareBitmapWithColor(size, color); + web_app->icon_bitmaps_any.clear(); + web_app->icon_bitmaps_any[size] = CreateSquareBitmapWithColor(size, color); } // Use only real BookmarkAppInstallFinalizer::FinalizeInstall and mock any other
diff --git a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc index 488343b..f195cb0d 100644 --- a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc
@@ -655,7 +655,7 @@ EXPECT_EQ(WebAppUrl(), web_app_info.app_url); EXPECT_TRUE(web_app_info.open_as_window); EXPECT_TRUE(web_app_info.icon_infos.empty()); - EXPECT_TRUE(web_app_info.icon_bitmaps.empty()); + EXPECT_TRUE(web_app_info.icon_bitmaps_any.empty()); run_loop.Quit(); })); @@ -691,7 +691,7 @@ EXPECT_EQ(WebAppUrl(), web_app_info.app_url); EXPECT_TRUE(web_app_info.open_as_window); EXPECT_TRUE(web_app_info.icon_infos.empty()); - EXPECT_TRUE(web_app_info.icon_bitmaps.empty()); + EXPECT_TRUE(web_app_info.icon_bitmaps_any.empty()); run_loop.Quit(); }));
diff --git a/chrome/browser/web_applications/manifest_update_task.cc b/chrome/browser/web_applications/manifest_update_task.cc index ea903fe..76dcc40 100644 --- a/chrome/browser/web_applications/manifest_update_task.cc +++ b/chrome/browser/web_applications/manifest_update_task.cc
@@ -250,7 +250,7 @@ const std::map<SquareSizePx, SkBitmap>& disk_icon_bitmaps) const { DCHECK(web_application_info_.has_value()); const std::map<SquareSizePx, SkBitmap>& downloaded_icon_bitmaps = - web_application_info_->icon_bitmaps; + web_application_info_->icon_bitmaps_any; if (HaveIconContentsChanged(disk_icon_bitmaps, downloaded_icon_bitmaps)) return true;
diff --git a/chrome/browser/web_applications/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_app_manager_browsertest.cc index 433a29d..853910b 100644 --- a/chrome/browser/web_applications/system_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/system_web_app_manager_browsertest.cc
@@ -555,13 +555,13 @@ "});")); // Check launch directory is correct. - bool is_directory; - EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + std::string kind; + EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, "domAutomationController.send(window.firstLaunchParams." - "files[0].isDirectory)", - &is_directory)); - EXPECT_TRUE(is_directory); + "files[0].kind)", + &kind)); + EXPECT_EQ("directory", kind); std::string file_name; EXPECT_TRUE(content::ExecuteScriptAndExtractString( @@ -571,11 +571,12 @@ EXPECT_EQ(temp_directory.GetPath().BaseName().AsUTF8Unsafe(), file_name); // Check launch files are correct. - bool is_file; - EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, - "domAutomationController.send(window.firstLaunchParams.files[1].isFile)", - &is_file)); + "domAutomationController.send(window.firstLaunchParams.files[1].kind)", + &kind)); + EXPECT_EQ("file", kind); + EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, "domAutomationController.send(window.firstLaunchParams.files[1].name)", @@ -613,12 +614,12 @@ "});")); // Second launch_dir and launch_files are passed to the opened application. - EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, "domAutomationController.send(window.secondLaunchParams.files[0]." - "isDirectory)", - &is_directory)); - EXPECT_TRUE(is_directory); + "kind)", + &kind)); + EXPECT_EQ("directory", kind); EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, @@ -626,12 +627,12 @@ &file_name)); EXPECT_EQ(temp_directory2.GetPath().BaseName().AsUTF8Unsafe(), file_name); - EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents, "domAutomationController.send(window.secondLaunchParams.files[1]." - "isFile)", - &is_file)); - EXPECT_TRUE(is_file); + "kind)", + &kind)); + EXPECT_EQ("file", kind); EXPECT_TRUE(content::ExecuteScriptAndExtractString( web_contents,
diff --git a/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc b/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc index 317e45b..880b4e7 100644 --- a/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc +++ b/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc
@@ -74,7 +74,8 @@ SkBitmap bitmap; bitmap.allocN32Pixels(icon_size::k32, icon_size::k32, true); bitmap.eraseColor(SK_ColorBLUE); - web_application_info->icon_bitmaps[icon_size::k32] = std::move(bitmap); + web_application_info->icon_bitmaps_any[icon_size::k32] = + std::move(bitmap); } InstallManager& install_manager =
diff --git a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc index 102aa5a..b5fef773 100644 --- a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
@@ -63,11 +63,11 @@ for (size_t i = 0; i < sizes_px.size(); ++i) { std::string icon_name = base::StringPrintf("app-%d.ico", sizes_px[i]); - AddGeneratedIcon(&web_app_info->icon_bitmaps, sizes_px[i], colors[i]); + AddGeneratedIcon(&web_app_info->icon_bitmaps_any, sizes_px[i], colors[i]); } base::RunLoop run_loop; - icon_manager_->WriteData(app_id, std::move(web_app_info->icon_bitmaps), + icon_manager_->WriteData(app_id, std::move(web_app_info->icon_bitmaps_any), base::BindLambdaForTesting([&](bool success) { EXPECT_TRUE(success); run_loop.Quit();
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.cc b/chrome/browser/web_applications/web_app_install_finalizer.cc index 3351422..2ba2f653 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.cc +++ b/chrome/browser/web_applications/web_app_install_finalizer.cc
@@ -441,7 +441,8 @@ web_app->SetSyncFallbackData(std::move(sync_fallback_data)); web_app->SetIconInfos(web_app_info.icon_infos); - web_app->SetDownloadedIconSizes(GetSquareSizePxs(web_app_info.icon_bitmaps)); + web_app->SetDownloadedIconSizes( + GetSquareSizePxs(web_app_info.icon_bitmaps_any)); web_app->SetIsGeneratedIcon(web_app_info.is_generated_icon); web_app->SetShortcutInfos(web_app_info.shortcut_infos); @@ -454,7 +455,7 @@ AppId app_id = web_app->app_id(); icon_manager_->WriteData( - std::move(app_id), web_app_info.icon_bitmaps, + std::move(app_id), web_app_info.icon_bitmaps_any, base::BindOnce(&WebAppInstallFinalizer::OnIconsDataWritten, weak_ptr_factory_.GetWeakPtr(), std::move(commit_callback), std::move(web_app),
diff --git a/chrome/browser/web_applications/web_app_install_task_unittest.cc b/chrome/browser/web_applications/web_app_install_task_unittest.cc index 87dc3f2..268407a9 100644 --- a/chrome/browser/web_applications/web_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_task_unittest.cc
@@ -589,7 +589,7 @@ test_install_finalizer().web_app_info(); // Make sure that icons have been generated for all sub sizes. - EXPECT_TRUE(ContainsOneIconOfEachSize(web_app_info->icon_bitmaps)); + EXPECT_TRUE(ContainsOneIconOfEachSize(web_app_info->icon_bitmaps_any)); // Generated icons are not considered part of the manifest icons. EXPECT_TRUE(web_app_info->icon_infos.empty()); @@ -614,7 +614,7 @@ test_install_finalizer().web_app_info(); // Make sure that icons have been generated for all sizes. - EXPECT_TRUE(ContainsOneIconOfEachSize(web_app_info->icon_bitmaps)); + EXPECT_TRUE(ContainsOneIconOfEachSize(web_app_info->icon_bitmaps_any)); // Generated icons are not considered part of the manifest icons. EXPECT_TRUE(web_app_info->icon_infos.empty()); @@ -639,7 +639,7 @@ const int original_icon_size_px = icon_size::k512; // Generate one icon as if it was fetched from renderer. - AddGeneratedIcon(&data_retriever_->web_app_info().icon_bitmaps, + AddGeneratedIcon(&data_retriever_->web_app_info().icon_bitmaps_any, original_icon_size_px, color); const AppId app_id = InstallWebAppFromManifestWithFallback(); @@ -863,7 +863,7 @@ web_app_info->open_as_window = false; // Add square yellow icon. - AddGeneratedIcon(&web_app_info->icon_bitmaps, icon_size::k256, + AddGeneratedIcon(&web_app_info->icon_bitmaps_any, icon_size::k256, SK_ColorYELLOW); base::RunLoop run_loop; @@ -877,12 +877,12 @@ test_install_finalizer().web_app_info(); // Make sure that icons have been generated for all sub sizes. - EXPECT_TRUE( - ContainsOneIconOfEachSize(final_web_app_info->icon_bitmaps)); + EXPECT_TRUE(ContainsOneIconOfEachSize( + final_web_app_info->icon_bitmaps_any)); // Make sure they're all derived from the yellow icon. for (const std::pair<const SquareSizePx, SkBitmap>& icon : - final_web_app_info->icon_bitmaps) { + final_web_app_info->icon_bitmaps_any) { EXPECT_FALSE(icon.second.drawsNothing()); EXPECT_EQ(SK_ColorYELLOW, icon.second.getColor(0, 0)); } @@ -914,10 +914,10 @@ std::unique_ptr<WebApplicationInfo> final_web_app_info = test_install_finalizer().web_app_info(); // Make sure that icons have been generated for all sub sizes. - EXPECT_TRUE( - ContainsOneIconOfEachSize(final_web_app_info->icon_bitmaps)); + EXPECT_TRUE(ContainsOneIconOfEachSize( + final_web_app_info->icon_bitmaps_any)); for (const std::pair<const SquareSizePx, SkBitmap>& icon : - final_web_app_info->icon_bitmaps) { + final_web_app_info->icon_bitmaps_any) { EXPECT_FALSE(icon.second.drawsNothing()); } @@ -1138,7 +1138,7 @@ EXPECT_TRUE(result); EXPECT_EQ(result->app_url, start_url); EXPECT_TRUE(result->icon_infos.empty()); - EXPECT_FALSE(result->icon_bitmaps.empty()); + EXPECT_FALSE(result->icon_bitmaps_any.empty()); } { // Verify the callback is always called.
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index b0aa6e6..7b37b1f5 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-master-1594640123-ecf0c679b64f8e063828d3c68ecfae268f1bc244.profdata +chrome-mac-master-1594662802-fdeeec39ffe5ca406713d5654e95a154ee25e0d8.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index ff232c7..84f82cc 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1594629784-da8b390fd981475e55c5716b256e0384d0033bc0.profdata +chrome-win32-master-1594648594-97cb9ce3cb39a74bf15fa7f9f08c38efdf753597.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 5a309e3f..a0fea18 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1594619844-5466e7844d9f3c0d4a095c9938c9765c2c3181c8.profdata +chrome-win64-master-1594640123-fdf8a72e5b13627e142e52b62a8ba89cbc874f73.profdata
diff --git a/chrome/chrome_cleaner/components/system_report_component.cc b/chrome/chrome_cleaner/components/system_report_component.cc index 09b430b..8b5c8c21 100644 --- a/chrome/chrome_cleaner/components/system_report_component.cc +++ b/chrome/chrome_cleaner/components/system_report_component.cc
@@ -132,12 +132,16 @@ L"disablewindowsupdateaccess"}}; const RegistryKey extension_policy_keys[] = { - {HKEY_LOCAL_MACHINE, kChromePoliciesWhitelistKeyPath}, - {HKEY_CURRENT_USER, kChromePoliciesWhitelistKeyPath}, + {HKEY_LOCAL_MACHINE, kChromePoliciesAllowlistKeyPath}, + {HKEY_LOCAL_MACHINE, kChromePoliciesWhitelistKeyPathDeprecated}, + {HKEY_CURRENT_USER, kChromePoliciesAllowlistKeyPath}, + {HKEY_CURRENT_USER, kChromePoliciesWhitelistKeyPathDeprecated}, {HKEY_LOCAL_MACHINE, kChromePoliciesForcelistKeyPath}, {HKEY_CURRENT_USER, kChromePoliciesForcelistKeyPath}, - {HKEY_LOCAL_MACHINE, kChromiumPoliciesWhitelistKeyPath}, - {HKEY_CURRENT_USER, kChromiumPoliciesWhitelistKeyPath}, + {HKEY_LOCAL_MACHINE, kChromiumPoliciesAllowlistKeyPath}, + {HKEY_LOCAL_MACHINE, kChromiumPoliciesWhitelistKeyPathDeprecated}, + {HKEY_CURRENT_USER, kChromiumPoliciesAllowlistKeyPath}, + {HKEY_CURRENT_USER, kChromiumPoliciesWhitelistKeyPathDeprecated}, {HKEY_LOCAL_MACHINE, kChromiumPoliciesForcelistKeyPath}, {HKEY_CURRENT_USER, kChromiumPoliciesForcelistKeyPath}};
diff --git a/chrome/chrome_cleaner/components/system_report_component_unittest.cc b/chrome/chrome_cleaner/components/system_report_component_unittest.cc index 7fe0fd99..7237c2c 100644 --- a/chrome/chrome_cleaner/components/system_report_component_unittest.cc +++ b/chrome/chrome_cleaner/components/system_report_component_unittest.cc
@@ -77,7 +77,7 @@ }; const ReportTestData kExtensionPolicyEmpty{ - HKEY_LOCAL_MACHINE, kChromePoliciesWhitelistKeyPath, L"test1", L""}; + HKEY_LOCAL_MACHINE, kChromePoliciesAllowlistKeyPath, L"test1", L""}; constexpr base::char16 kTestingExtensionId1[] = L"ababababcdcdcdcdefefefefghghghgh"; @@ -91,22 +91,30 @@ L"update2/crx"; const ReportTestData extension_policies[] = { - {HKEY_LOCAL_MACHINE, kChromePoliciesWhitelistKeyPath, L"test1", + {HKEY_LOCAL_MACHINE, kChromePoliciesWhitelistKeyPathDeprecated, L"test1", kTestingExtensionId1}, - {HKEY_CURRENT_USER, kChromePoliciesWhitelistKeyPath, L"test2", + {HKEY_CURRENT_USER, kChromePoliciesWhitelistKeyPathDeprecated, L"test2", kTestingExtensionId1}, {HKEY_LOCAL_MACHINE, kChromePoliciesForcelistKeyPath, L"test3", kTestingExtensionId2WithUpdateUrl}, {HKEY_CURRENT_USER, kChromePoliciesForcelistKeyPath, L"test4", kTestingExtensionId2WithUpdateUrl}, - {HKEY_LOCAL_MACHINE, kChromiumPoliciesWhitelistKeyPath, L"test5", + {HKEY_LOCAL_MACHINE, kChromiumPoliciesWhitelistKeyPathDeprecated, L"test5", kTestingExtensionId1}, - {HKEY_CURRENT_USER, kChromiumPoliciesWhitelistKeyPath, L"test6", + {HKEY_CURRENT_USER, kChromiumPoliciesWhitelistKeyPathDeprecated, L"test6", kTestingExtensionId1}, {HKEY_LOCAL_MACHINE, kChromiumPoliciesForcelistKeyPath, L"test7", kTestingExtensionId2WithUpdateUrl}, {HKEY_CURRENT_USER, kChromiumPoliciesForcelistKeyPath, L"test8", kTestingExtensionId2WithUpdateUrl}, + {HKEY_LOCAL_MACHINE, kChromePoliciesAllowlistKeyPath, L"test9", + kTestingExtensionId1}, + {HKEY_CURRENT_USER, kChromePoliciesAllowlistKeyPath, L"test10", + kTestingExtensionId1}, + {HKEY_LOCAL_MACHINE, kChromiumPoliciesAllowlistKeyPath, L"test11", + kTestingExtensionId1}, + {HKEY_CURRENT_USER, kChromiumPoliciesAllowlistKeyPath, L"test12", + kTestingExtensionId1}, }; const ReportTestData extension_forcelist_policies[] = {
diff --git a/chrome/chrome_cleaner/os/registry_util.cc b/chrome/chrome_cleaner/os/registry_util.cc index a1011bf..28436fc 100644 --- a/chrome/chrome_cleaner/os/registry_util.cc +++ b/chrome/chrome_cleaner/os/registry_util.cc
@@ -129,13 +129,17 @@ const wchar_t kChromePoliciesForcelistKeyPath[] = L"software\\policies\\google\\chrome\\ExtensionInstallForcelist"; -const wchar_t kChromePoliciesWhitelistKeyPath[] = +const wchar_t kChromePoliciesWhitelistKeyPathDeprecated[] = L"software\\policies\\google\\chrome\\ExtensionInstallWhitelist"; +const wchar_t kChromePoliciesAllowlistKeyPath[] = + L"software\\policies\\google\\chrome\\ExtensionInstallAllowlist"; const wchar_t kChromiumPoliciesForcelistKeyPath[] = L"software\\policies\\chromium\\ExtensionInstallForcelist"; -const wchar_t kChromiumPoliciesWhitelistKeyPath[] = +const wchar_t kChromiumPoliciesWhitelistKeyPathDeprecated[] = L"software\\policies\\chromium\\ExtensionInstallWhitelist"; +const wchar_t kChromiumPoliciesAllowlistKeyPath[] = + L"software\\policies\\chromium\\ExtensionInstallAllowlist"; base::string16 RegistryValueTypeToString(DWORD value_type) { switch (value_type) {
diff --git a/chrome/chrome_cleaner/os/registry_util.h b/chrome/chrome_cleaner/os/registry_util.h index 0c949c1..4f099f6c 100644 --- a/chrome/chrome_cleaner/os/registry_util.h +++ b/chrome/chrome_cleaner/os/registry_util.h
@@ -56,13 +56,19 @@ // The key for Chrome policies. extern const wchar_t kChromePoliciesKeyPath[]; -// The keys for the Chrome policy forcelist and whitelist. +// The keys for the Chrome policy forcelist, whitelist and allowlist. +// Whitelist has been deprecated in favor of allowlist, but is still reported +// by the cleaner for compatibility with older versions of Chrome. extern const wchar_t kChromePoliciesForcelistKeyPath[]; -extern const wchar_t kChromePoliciesWhitelistKeyPath[]; +extern const wchar_t kChromePoliciesWhitelistKeyPathDeprecated[]; +extern const wchar_t kChromePoliciesAllowlistKeyPath[]; -// The keys for the Chromium policy forcelist and whitelist. +// The keys for the Chromium policy forcelist, whitelist and allowlist. +// Whitelist has been deprecated in favor of allowlist, but is still reported +// by the cleaner for compatibility with older versions of Chromium. extern const wchar_t kChromiumPoliciesForcelistKeyPath[]; -extern const wchar_t kChromiumPoliciesWhitelistKeyPath[]; +extern const wchar_t kChromiumPoliciesWhitelistKeyPathDeprecated[]; +extern const wchar_t kChromiumPoliciesAllowlistKeyPath[]; // Returns a string representation of the registry value type. base::string16 RegistryValueTypeToString(DWORD value_type);
diff --git a/chrome/common/web_application_info.h b/chrome/common/web_application_info.h index 4f9111c9..898ad621 100644 --- a/chrome/common/web_application_info.h +++ b/chrome/common/web_application_info.h
@@ -100,8 +100,9 @@ // List of icon URLs with associated square size. std::vector<WebApplicationIconInfo> icon_infos; - // Icon bitmaps keyed by their square size. - std::map<SquareSizePx, SkBitmap> icon_bitmaps; + // Icon bitmaps suitable for any context, keyed by their square size. + // See https://www.w3.org/TR/appmanifest/#dfn-any-purpose + std::map<SquareSizePx, SkBitmap> icon_bitmaps_any; // Represents whether the icons for the web app are generated by Chrome due to // no suitable icons being available.
diff --git a/chrome/common/web_application_info_provider_param_traits.h b/chrome/common/web_application_info_provider_param_traits.h index dad5456..9492fc1 100644 --- a/chrome/common/web_application_info_provider_param_traits.h +++ b/chrome/common/web_application_info_provider_param_traits.h
@@ -21,6 +21,6 @@ IPC_STRUCT_TRAITS_MEMBER(description) IPC_STRUCT_TRAITS_MEMBER(app_url) IPC_STRUCT_TRAITS_MEMBER(icon_infos) - IPC_STRUCT_TRAITS_MEMBER(icon_bitmaps) + IPC_STRUCT_TRAITS_MEMBER(icon_bitmaps_any) IPC_STRUCT_TRAITS_MEMBER(mobile_capable) IPC_STRUCT_TRAITS_END()
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc index 373520f..c94ab0e 100644 --- a/chrome/installer/mini_installer/mini_installer.cc +++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -719,7 +719,8 @@ if (!path->append(name)) continue; // Continue in spite of too long names. - if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && + !(find_data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { RecursivelyDeleteDirectory(path); } else { ::DeleteFile(path->get());
diff --git a/chrome/test/base/browser_tests_main_chromeos.cc b/chrome/test/base/browser_tests_main_chromeos.cc index 8c44fb2f..a0c5d8d 100644 --- a/chrome/test/base/browser_tests_main_chromeos.cc +++ b/chrome/test/base/browser_tests_main_chromeos.cc
@@ -30,10 +30,8 @@ public: int RunTestSuite(int argc, char** argv) override { BrowserTestSuiteChromeOS test_suite(argc, argv); - // Browser tests are expected not to tear-down various globals and may - // complete with the thread priority being above NORMAL. + // Browser tests are expected not to tear-down various globals. test_suite.DisableCheckForLeakedGlobals(); - test_suite.DisableCheckForThreadPriorityAtTestEnd(); return test_suite.Run(); } };
diff --git a/chrome/test/data/chromeos/enterprise/policies b/chrome/test/data/chromeos/enterprise/policies index 35bb3d1..06a729e 100644 --- a/chrome/test/data/chromeos/enterprise/policies +++ b/chrome/test/data/chromeos/enterprise/policies
@@ -50,7 +50,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'inmnggcpelemfookhlhkdfbechcdadfp;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn', @@ -112,7 +112,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'kcnhkahnjcbndmmehfkdnkjomaanaooo;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn', @@ -174,7 +174,7 @@ u'slashdot.org/popular'], u'DefaultSearchProviderInstantURL': u'http://search.my.company/suggest?q={searchTerms}', - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kjebfhglflhjjjiceimfkgicifkhjlnm', u'aknpkdffaafgjchaibgeefbgmgeghloj', u'hpfomeedmekonipambfkmjfacahlngjd'], @@ -228,7 +228,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'inmnggcpelemfookhlhkdfbechcdadfp;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn', @@ -301,7 +301,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'inmnggcpelemfookhlhkdfbechcdadfp;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn', @@ -363,7 +363,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'kcnhkahnjcbndmmehfkdnkjomaanaooo;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn', @@ -425,7 +425,7 @@ u'slashdot.org/popular'], u'DefaultSearchProviderInstantURL': u'http://search.my.company/suggest?q={searchTerms}', - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kjebfhglflhjjjiceimfkgicifkhjlnm', u'aknpkdffaafgjchaibgeefbgmgeghloj', u'hpfomeedmekonipambfkmjfacahlngjd'], @@ -479,7 +479,7 @@ 'https://clients2.google.com/service/update2/crx'), (u'inmnggcpelemfookhlhkdfbechcdadfp;' 'https://clients2.google.com/service/update2/crx')], - u'ExtensionInstallWhitelist': [ + u'ExtensionInstallAllowlist': [ u'kcnhkahnjcbndmmehfkdnkjomaanaooo', u'boidnimkebefpfgbeekbjoponilnomle', u'aggljnipbdiebhbmadknfbjlhehbohbn',
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 4ce14241..c96267e 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -1412,6 +1412,16 @@ ] }, + "ExtensionInstallAllowlist": { + "os": ["win", "linux", "mac", "chromeos"], + "policy_pref_mapping_test": [ + { + "policies": { "ExtensionInstallAllowlist": ["lcncmkcnkcdbbanbjakcencbaoegdjlp"]}, + "prefs": { "extensions.install.allowlist": {} } + } + ] + }, + "ExtensionInstallForcelist": { "os": ["win", "linux", "mac", "chromeos"], "policy_pref_mapping_test": [
diff --git a/chrome/test/data/webui/settings/chromeos/ambient_mode_page_test.js b/chrome/test/data/webui/settings/chromeos/ambient_mode_page_test.js index 1288e263..d7918c6 100644 --- a/chrome/test/data/webui/settings/chromeos/ambient_mode_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/ambient_mode_page_test.js
@@ -46,6 +46,7 @@ page = document.createElement('settings-ambient-mode-page'); page.prefs = prefElement.prefs; document.body.appendChild(page); + Polymer.dom.flush(); }); }); @@ -78,11 +79,10 @@ assertEquals(enabled, enabled_toggled_twice); }); - test('hasTopicSourceButtons', function() { - const topicSourceRadioGroup = page.$$('#topicSourceRadioGroup'); - - const radioButtons = - topicSourceRadioGroup.querySelectorAll('cr-radio-button'); - assertEquals(2, radioButtons.length); + test('hasTopicSourceItems', function() { + const topicSourceListElement = page.$$('topic-source-list'); + const ironList = topicSourceListElement.$$('iron-list'); + const topicSourceItems = ironList.querySelectorAll('topic-source-item'); + assertEquals(2, topicSourceItems.length); }); });
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js index 5cc375d..5ca3840 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js
@@ -1198,9 +1198,7 @@ } }; - -// TODO(https://crbug.com/1094896): Re-enable once we fix the cause for flakes. -TEST_F('OSSettingsPersonalizationPageTest', 'DISABLED_AllJsTests', () => { +TEST_F('OSSettingsPersonalizationPageTest', 'AllJsTests', () => { mocha.run(); });
diff --git a/chrome/test/data/webui/settings/site_entry_tests.js b/chrome/test/data/webui/settings/site_entry_tests.js index eb5fac8..0fc4259 100644 --- a/chrome/test/data/webui/settings/site_entry_tests.js +++ b/chrome/test/data/webui/settings/site_entry_tests.js
@@ -95,7 +95,7 @@ flush(); const collapseChild = testElement.$.originList.get(); flush(); - assertEquals(3, collapseChild.querySelectorAll('.list-item').length); + assertEquals(3, collapseChild.querySelectorAll('.origin-link').length); }); test('expands and closes to show more origins', function() { @@ -137,7 +137,7 @@ flush(); const collapseChild = testElement.$.originList.get(); flush(); - const originList = collapseChild.querySelectorAll('.list-item'); + const originList = collapseChild.querySelectorAll('.origin-link'); assertEquals(3, originList.length); // Test clicking on one of these origins takes the user to Site Details, @@ -381,7 +381,7 @@ flush(); const collapseChild = testElement.$.originList.get(); flush(); - const origins = collapseChild.querySelectorAll('.list-item'); + const origins = collapseChild.querySelectorAll('.origin-link'); assertEquals(3, origins.length); assertEquals( 'www.example.com', @@ -411,7 +411,7 @@ flush(); const collapseChild = testElement.$.originList.get(); flush(); - const origins = collapseChild.querySelectorAll('.list-item'); + const origins = collapseChild.querySelectorAll('.origin-link'); assertEquals(3, origins.length); assertEquals( 'www.example.com', @@ -441,7 +441,7 @@ flush(); const collapseChild = testElement.$.originList.get(); flush(); - const origins = collapseChild.querySelectorAll('.list-item'); + const origins = collapseChild.querySelectorAll('.origin-link'); assertEquals(3, origins.length); assertEquals( 'example.com',
diff --git a/chrome/test/enterprise/e2e/infra/template.host.textpb b/chrome/test/enterprise/e2e/infra/template.host.textpb index c8a16b5..d61756c 100644 --- a/chrome/test/enterprise/e2e/infra/template.host.textpb +++ b/chrome/test/enterprise/e2e/infra/template.host.textpb
@@ -90,6 +90,29 @@ } machine_type { + # Name must match the host_machine_type field in the windows_machine asset + # entries. + name: "win2019" + + instance_properties { + machineType: "projects/${host.project.name}/zones/${host.project.zone}/machineTypes/n1-standard-2" + + scheduling { + automaticRestart: true + } + + disks { + autoDelete: true + boot: true + + initializeParams { + sourceImage: "${host.image.windows-2019.url}" + } + } + } +} + +machine_type { name: 'win7' nested_vm { image: 'gs://<storage_bucket>/images/win7_sp1_ent_unlicensed.img'
diff --git a/chrome/test/enterprise/e2e/policy/allow_deleting_browser_history/allow_deleting_browser_history.py b/chrome/test/enterprise/e2e/policy/allow_deleting_browser_history/allow_deleting_browser_history.py index 2a22c622..35792a06 100644 --- a/chrome/test/enterprise/e2e/policy/allow_deleting_browser_history/allow_deleting_browser_history.py +++ b/chrome/test/enterprise/e2e/policy/allow_deleting_browser_history/allow_deleting_browser_history.py
@@ -17,30 +17,30 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') def allowDeletingBrowserHistoryEnabled(self, instance_name): """Returns true if AllowDeletingBrowserHistory is enabled.""" directory = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', + 'client2019', os.path.join(directory, 'allow_deleting_browser_history_webdriver_test.py')) return 'ENABLED' in output @test def test_allow_deleting_browser_history_enabled(self): - self.SetPolicy('win2012-dc', r'AllowDeletingBrowserHistory', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'AllowDeletingBrowserHistory', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - policy_enabled = self.allowDeletingBrowserHistoryEnabled('client2012') + policy_enabled = self.allowDeletingBrowserHistoryEnabled('client2019') self.assertTrue(policy_enabled) @test def test_allow_deleting_browser_history_disabled(self): - self.SetPolicy('win2012-dc', r'AllowDeletingBrowserHistory', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'AllowDeletingBrowserHistory', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - policy_enabled = self.allowDeletingBrowserHistoryEnabled('client2012') + policy_enabled = self.allowDeletingBrowserHistoryEnabled('client2019') self.assertFalse(policy_enabled)
diff --git a/chrome/test/enterprise/e2e/policy/apps_shortcut/apps_shortcut.py b/chrome/test/enterprise/e2e/policy/apps_shortcut/apps_shortcut.py index 1970103..cf370cf 100644 --- a/chrome/test/enterprise/e2e/policy/apps_shortcut/apps_shortcut.py +++ b/chrome/test/enterprise/e2e/policy/apps_shortcut/apps_shortcut.py
@@ -17,11 +17,11 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') # Enable the bookmark bar so we can see the Apps Shortcut that lives there. - self.SetPolicy('win2012-dc', 'BookmarkBarEnabled', 1, 'DWORD') + self.SetPolicy('win2019-dc', 'BookmarkBarEnabled', 1, 'DWORD') def isAppsShortcutVisible(self, instance): local = os.path.dirname(os.path.abspath(__file__)) @@ -31,16 +31,16 @@ @test def test_AppShortcutEnabled(self): - self.SetPolicy('win2012-dc', AppsShortcutEnabledTest.Policy, 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', AppsShortcutEnabledTest.Policy, 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - visible = self.isAppsShortcutVisible('client2012') + visible = self.isAppsShortcutVisible('client2019') self.assertTrue(visible) @test def test_AppShortcutDisabled(self): - self.SetPolicy('win2012-dc', AppsShortcutEnabledTest.Policy, 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', AppsShortcutEnabledTest.Policy, 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - visible = self.isAppsShortcutVisible('client2012') + visible = self.isAppsShortcutVisible('client2019') self.assertFalse(visible)
diff --git a/chrome/test/enterprise/e2e/policy/bookmarkbar_enabled/bookmarkbar_enabled.py b/chrome/test/enterprise/e2e/policy/bookmarkbar_enabled/bookmarkbar_enabled.py index b33de5d2..bc66e85 100644 --- a/chrome/test/enterprise/e2e/policy/bookmarkbar_enabled/bookmarkbar_enabled.py +++ b/chrome/test/enterprise/e2e/policy/bookmarkbar_enabled/bookmarkbar_enabled.py
@@ -24,8 +24,8 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') def _getUIStructure(self, instance_name): local_dir = os.path.dirname(os.path.abspath(__file__)) @@ -36,19 +36,19 @@ @test def test_bookmark_bar_enabled(self): # Enable bookmark bar - self.SetPolicy('win2012-dc', r'BookmarkBarEnabled', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'BookmarkBarEnabled', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Enabled bookmark bar') - output = self._getUIStructure('client2012') + output = self._getUIStructure('client2019') self.assertIn('Bookmarkbar is found', output) @test def test_bookmark_bar_disabled(self): # Disable bookmark bar - self.SetPolicy('win2012-dc', r'BookmarkBarEnabled', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'BookmarkBarEnabled', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Disabled bookmark bar') - output = self._getUIStructure('client2012') + output = self._getUIStructure('client2019') self.assertIn('Bookmarkbar is missing', output)
diff --git a/chrome/test/enterprise/e2e/policy/cloud_management_enrollment_token/cloud_management_enrollment_token.py b/chrome/test/enterprise/e2e/policy/cloud_management_enrollment_token/cloud_management_enrollment_token.py index 8d0fd38..7cb265f 100644 --- a/chrome/test/enterprise/e2e/policy/cloud_management_enrollment_token/cloud_management_enrollment_token.py +++ b/chrome/test/enterprise/e2e/policy/cloud_management_enrollment_token/cloud_management_enrollment_token.py
@@ -23,8 +23,8 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') @test def test_browser_enrolled_prod(self): @@ -32,17 +32,17 @@ if token == None: path = "gs://%s/secrets/enrollToken" % self.gsbucket cmd = r'gsutil cat ' + path - token = self.RunCommand('win2012-dc', cmd).rstrip() - self.SetPolicy('win2012-dc', r'CloudManagementEnrollmentToken', token, + token = self.RunCommand('win2019-dc', cmd).rstrip() + self.SetPolicy('win2019-dc', r'CloudManagementEnrollmentToken', token, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') local_dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', os.path.join(local_dir, 'cloud_enrollment_webdriver.py')) + 'client2019', os.path.join(local_dir, 'cloud_enrollment_webdriver.py')) # Verify CBCM status legend self.assertIn('Machine policies', output) - self.assertIn('CLIENT2012', output) + self.assertIn('CLIENT2019', output) self.assertIn(token, output) self.assertIn('Policy cache OK', output)
diff --git a/chrome/test/enterprise/e2e/policy/default_search_provider/default_search_provider.py b/chrome/test/enterprise/e2e/policy/default_search_provider/default_search_provider.py index e216935..d1a3c750 100644 --- a/chrome/test/enterprise/e2e/policy/default_search_provider/default_search_provider.py +++ b/chrome/test/enterprise/e2e/policy/default_search_provider/default_search_provider.py
@@ -21,8 +21,8 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') def _get_search_url(self, instance_name): local_dir = os.path.dirname(os.path.abspath(__file__)) @@ -33,31 +33,31 @@ @test def test_default_search_provider_bing(self): - self.SetPolicy('win2012-dc', 'DefaultSearchProviderEnabled', 1, 'DWORD') - self.SetPolicy('win2012-dc', 'DefaultSearchProviderName', 'Bing', 'String') - self.SetPolicy('win2012-dc', 'DefaultSearchProviderSearchURL', + self.SetPolicy('win2019-dc', 'DefaultSearchProviderEnabled', 1, 'DWORD') + self.SetPolicy('win2019-dc', 'DefaultSearchProviderName', 'Bing', 'String') + self.SetPolicy('win2019-dc', 'DefaultSearchProviderSearchURL', '"https://www.bing.com/search?q={searchTerms}"', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') - output = self._get_search_url('client2012') + output = self._get_search_url('client2019') self.assertIn('www.bing.com', output) @test def test_default_search_provider_yahoo(self): - self.SetPolicy('win2012-dc', 'DefaultSearchProviderEnabled', 1, 'DWORD') - self.SetPolicy('win2012-dc', 'DefaultSearchProviderName', 'Yahoo', 'String') - self.SetPolicy('win2012-dc', 'DefaultSearchProviderSearchURL', + self.SetPolicy('win2019-dc', 'DefaultSearchProviderEnabled', 1, 'DWORD') + self.SetPolicy('win2019-dc', 'DefaultSearchProviderName', 'Yahoo', 'String') + self.SetPolicy('win2019-dc', 'DefaultSearchProviderSearchURL', '"https://search.yahoo.com/search?p={searchTerms}"', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') - output = self._get_search_url('client2012') + output = self._get_search_url('client2019') self.assertIn('search.yahoo.com', output) @test def test_default_search_provider_disabled(self): - self.SetPolicy('win2012-dc', 'DefaultSearchProviderEnabled', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'DefaultSearchProviderEnabled', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - output = self._get_search_url('client2012') + output = self._get_search_url('client2019') self.assertIn('http://anything', output)
diff --git a/chrome/test/enterprise/e2e/policy/extension_blacklist/extension_blacklist.py b/chrome/test/enterprise/e2e/policy/extension_blacklist/extension_blacklist.py index 2a35a08..83744b1 100644 --- a/chrome/test/enterprise/e2e/policy/extension_blacklist/extension_blacklist.py +++ b/chrome/test/enterprise/e2e/policy/extension_blacklist/extension_blacklist.py
@@ -15,9 +15,9 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') + self.InstallWebDriver('client2019') def installExtension(self, url): args = ['--url', url] @@ -25,15 +25,15 @@ dir = os.path.dirname(os.path.abspath(__file__)) logging.info('Opening page: %s' % url) output = self.RunUITest( - 'client2012', os.path.join(dir, '../install_extension.py'), args=args) + 'client2019', os.path.join(dir, '../install_extension.py'), args=args) return output @test def test_ExtensionBlacklist_all(self): extension = '*' - self.SetPolicy('win2012-dc', r'ExtensionInstallBlacklist\1', extension, + self.SetPolicy('win2019-dc', r'ExtensionInstallBlacklist\1', extension, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Disabled extension install for ' + extension) test_url = 'https://chrome.google.com/webstore/detail/google-hangouts/nckgahadagoaajjgafhacjanaoiihapd' @@ -43,9 +43,9 @@ @test def test_ExtensionBlacklist_hangout(self): extension = 'nckgahadagoaajjgafhacjanaoiihapd' - self.SetPolicy('win2012-dc', r'ExtensionInstallBlacklist\1', extension, + self.SetPolicy('win2019-dc', r'ExtensionInstallBlacklist\1', extension, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Disabled extension install for ' + extension) test_url = 'https://chrome.google.com/webstore/detail/google-hangouts/nckgahadagoaajjgafhacjanaoiihapd'
diff --git a/chrome/test/enterprise/e2e/policy/extension_forcelist/extension_forcelist.py b/chrome/test/enterprise/e2e/policy/extension_forcelist/extension_forcelist.py index 546d176f..24daebc 100644 --- a/chrome/test/enterprise/e2e/policy/extension_forcelist/extension_forcelist.py +++ b/chrome/test/enterprise/e2e/policy/extension_forcelist/extension_forcelist.py
@@ -18,13 +18,13 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') def isExtensionInstalled(self, incognito=False): dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', + 'client2019', os.path.join(dir, 'is_extension_installed.py'), args=["--extension_id", ExtensionInstallForcelistTest.ExtensionId]) @@ -36,8 +36,8 @@ @test def test_NoForcelistNoExtensionInstalled(self): - self.SetPolicy('win2012-dc', r'ExtensionInstallForcelist\1', '""', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'ExtensionInstallForcelist\1', '""', 'String') + self.RunCommand('client2019', 'gpupdate /force') installed = self.isExtensionInstalled() self.assertFalse(installed) @@ -46,9 +46,9 @@ def test_ForcelistExtensionInstalled(self): url = 'https://clients2.google.com/service/update2/crx' extension = '"%s;%s"' % (ExtensionInstallForcelistTest.ExtensionId, url) - self.SetPolicy('win2012-dc', r'ExtensionInstallForcelist\1', extension, + self.SetPolicy('win2019-dc', r'ExtensionInstallForcelist\1', extension, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') installed = self.isExtensionInstalled() self.assertTrue(installed)
diff --git a/chrome/test/enterprise/e2e/policy/extension_whitelist/extension_whitelist.py b/chrome/test/enterprise/e2e/policy/extension_whitelist/extension_whitelist.py index d86693eb..2fb6ddbd 100644 --- a/chrome/test/enterprise/e2e/policy/extension_whitelist/extension_whitelist.py +++ b/chrome/test/enterprise/e2e/policy/extension_whitelist/extension_whitelist.py
@@ -15,9 +15,9 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') + self.InstallWebDriver('client2019') def installExtension(self, url): args = ['--url', url] @@ -25,16 +25,16 @@ dir = os.path.dirname(os.path.abspath(__file__)) logging.info('Opening page: %s' % url) output = self.RunUITest( - 'client2012', os.path.join(dir, '../install_extension.py'), args=args) + 'client2019', os.path.join(dir, '../install_extension.py'), args=args) return output @test def test_ExtensionWhitelist_hangout(self): extension = 'nckgahadagoaajjgafhacjanaoiihapd' - self.SetPolicy('win2012-dc', r'ExtensionInstallBlacklist\1', '*', 'String') - self.SetPolicy('win2012-dc', r'ExtensionInstallWhitelist\1', extension, + self.SetPolicy('win2019-dc', r'ExtensionInstallBlacklist\1', '*', 'String') + self.SetPolicy('win2019-dc', r'ExtensionInstallWhitelist\1', extension, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Whitelist extension install for ' + extension + ' while disabling others')
diff --git a/chrome/test/enterprise/e2e/policy/force_google_safe_search/force_google_safe_search.py b/chrome/test/enterprise/e2e/policy/force_google_safe_search/force_google_safe_search.py index 7955660..a0a2962 100644 --- a/chrome/test/enterprise/e2e/policy/force_google_safe_search/force_google_safe_search.py +++ b/chrome/test/enterprise/e2e/policy/force_google_safe_search/force_google_safe_search.py
@@ -16,18 +16,18 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') @test def test_ForceGoogleSafeSearchEnabled(self): # enable policy ForceGoogleSafeSearch - self.SetPolicy('win2012-dc', 'ForceGoogleSafeSearch', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ForceGoogleSafeSearch', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') logging.info('ForceGoogleSafeSearch ENABLED') d = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', + 'client2019', os.path.join(d, 'force_google_safe_search_webdriver_test.py')) logging.info('url used: %s', output) @@ -38,12 +38,12 @@ @test def test_ForceGoogleSafeSearchDisabled(self): # disable policy ForceGoogleSafeSearch - self.SetPolicy('win2012-dc', 'ForceGoogleSafeSearch', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ForceGoogleSafeSearch', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') d = os.path.dirname(os.path.abspath(__file__)) logging.info('ForceGoogleSafeSearch DISABLED') output = self.RunWebDriverTest( - 'client2012', + 'client2019', os.path.join(d, 'force_google_safe_search_webdriver_test.py')) logging.info('url used: %s', output)
diff --git a/chrome/test/enterprise/e2e/policy/fullscreen_allowed/fullscreen_allowed.py b/chrome/test/enterprise/e2e/policy/fullscreen_allowed/fullscreen_allowed.py index ce66eef7..31316ec 100644 --- a/chrome/test/enterprise/e2e/policy/fullscreen_allowed/fullscreen_allowed.py +++ b/chrome/test/enterprise/e2e/policy/fullscreen_allowed/fullscreen_allowed.py
@@ -17,11 +17,11 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') # Enable the bookmark bar so we can see the Apps Shortcut that lives there. - self.SetPolicy('win2012-dc', 'BookmarkBarEnabled', 1, 'DWORD') + self.SetPolicy('win2019-dc', 'BookmarkBarEnabled', 1, 'DWORD') def isFullscreenAllowed(self, instance): local = os.path.dirname(os.path.abspath(__file__)) @@ -31,16 +31,16 @@ @test def test_FullscreenAllowed(self): - self.SetPolicy('win2012-dc', FullscreenAllowedTest.Policy, 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', FullscreenAllowedTest.Policy, 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - allowed = self.isFullscreenAllowed('client2012') + allowed = self.isFullscreenAllowed('client2019') self.assertTrue(allowed) @test def test_FullscreenNotAllowed(self): - self.SetPolicy('win2012-dc', FullscreenAllowedTest.Policy, 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', FullscreenAllowedTest.Policy, 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - allowed = self.isFullscreenAllowed('client2012') + allowed = self.isFullscreenAllowed('client2019') self.assertFalse(allowed)
diff --git a/chrome/test/enterprise/e2e/policy/homepage/homepage.py b/chrome/test/enterprise/e2e/policy/homepage/homepage.py index f3219461..6f79f418 100644 --- a/chrome/test/enterprise/e2e/policy/homepage/homepage.py +++ b/chrome/test/enterprise/e2e/policy/homepage/homepage.py
@@ -23,8 +23,8 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') def _getHomepageLocation(self, instance_name): dir = os.path.dirname(os.path.abspath(__file__)) @@ -45,26 +45,26 @@ # - HomepageIsNewTabPage is false # - HomepageLocation is set # In this case, when a home page is opened, the HomepageLocation is used - self.SetPolicy('win2012-dc', 'HomepageIsNewTabPage', 0, 'DWORD') - self.SetPolicy('win2012-dc', 'HomepageLocation', + self.SetPolicy('win2019-dc', 'HomepageIsNewTabPage', 0, 'DWORD') + self.SetPolicy('win2019-dc', 'HomepageLocation', '"http://www.example.com/"', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') # verify the home page is the value of HomepageLocation - homepage = self._getHomepageLocation('client2012') + homepage = self._getHomepageLocation('client2019') self.assertEqual(homepage, 'http://www.example.com/') @test def test_HomepageIsNewTab(self): # Test the case when HomepageIsNewTabPage is true # In this case, when a home page is opened, the new tab page will be used. - self.SetPolicy('win2012-dc', 'HomepageIsNewTabPage', 1, 'DWORD') - self.SetPolicy('win2012-dc', 'HomepageLocation', + self.SetPolicy('win2019-dc', 'HomepageIsNewTabPage', 1, 'DWORD') + self.SetPolicy('win2019-dc', 'HomepageLocation', '"http://www.example.com/"', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') # verify that the home page is the new tab page. - homepage = self._getHomepageLocation('client2012') + homepage = self._getHomepageLocation('client2019') # The URL of the new tab can be one of the following: # - https://www.google.com/_/chrome/newtab?ie=UTF-8 @@ -79,15 +79,15 @@ @test def test_ShowHomeButton(self): # Test the case when ShowHomeButton is true - self.SetPolicy('win2012-dc', 'ShowHomeButton', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ShowHomeButton', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - isHomeButtonShown = self._isHomeButtonShown('client2012') + isHomeButtonShown = self._isHomeButtonShown('client2019') self.assertTrue(isHomeButtonShown) # Test the case when ShowHomeButton is false - self.SetPolicy('win2012-dc', 'ShowHomeButton', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ShowHomeButton', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') - isHomeButtonShown = self._isHomeButtonShown('client2012') + isHomeButtonShown = self._isHomeButtonShown('client2019') self.assertFalse(isHomeButtonShown)
diff --git a/chrome/test/enterprise/e2e/policy/password_manager_enabled/password_manager_enabled.py b/chrome/test/enterprise/e2e/policy/password_manager_enabled/password_manager_enabled.py index a747fcf6..ca1b63f7 100644 --- a/chrome/test/enterprise/e2e/policy/password_manager_enabled/password_manager_enabled.py +++ b/chrome/test/enterprise/e2e/policy/password_manager_enabled/password_manager_enabled.py
@@ -15,28 +15,28 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') def isPasswordManagerEnabled(self): dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', + 'client2019', os.path.join(dir, 'password_manager_enabled_webdriver_test.py')) return "TRUE" in output @test def test_PasswordManagerDisabled(self): - self.SetPolicy('win2012-dc', 'PasswordManagerEnabled', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'PasswordManagerEnabled', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') enabled = self.isPasswordManagerEnabled() self.assertFalse(enabled) @test def test_PasswordManagerEnabled(self): - self.SetPolicy('win2012-dc', 'PasswordManagerEnabled', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'PasswordManagerEnabled', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') enabled = self.isPasswordManagerEnabled() self.assertTrue(enabled)
diff --git a/chrome/test/enterprise/e2e/policy/policy_test.asset.textpb b/chrome/test/enterprise/e2e/policy/policy_test.asset.textpb index 978fc119..c3a62c4 100644 --- a/chrome/test/enterprise/e2e/policy/policy_test.asset.textpb +++ b/chrome/test/enterprise/e2e/policy/policy_test.asset.textpb
@@ -10,20 +10,20 @@ netbios_name: 'example' domain_controller { - windows_machine: 'win2012-dc' + windows_machine: 'win2019-dc' } } # the domain controller. windows_machine { - name: 'win2012-dc' - machine_type: 'win2012r2' + name: 'win2019-dc' + machine_type: 'win2019' network_interface { network: 'primary' } } windows_machine { - name: 'client2012' - machine_type: 'win2012r2' + name: 'client2019' + machine_type: 'win2019' network_interface { network: 'primary' } container { ad_domain: 'test1.com' } } \ No newline at end of file
diff --git a/chrome/test/enterprise/e2e/policy/popups_allowed/popups_allowed.py b/chrome/test/enterprise/e2e/policy/popups_allowed/popups_allowed.py index cbc1e2a..6b4405f0 100644 --- a/chrome/test/enterprise/e2e/policy/popups_allowed/popups_allowed.py +++ b/chrome/test/enterprise/e2e/policy/popups_allowed/popups_allowed.py
@@ -21,22 +21,22 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') @test def test_popup_allow_for_url(self): # Enable "Allow popups on these sites" with testing URL # TODO(jxiang, crbug/1020231) test_site = 'www.dummysoftware.com' - self.SetPolicy('win2012-dc', r'PopupsAllowedForUrls\1', test_site, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'PopupsAllowedForUrls\1', test_site, 'String') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Enabled Allow pop-ups on' + test_site) # Run webdriver test local_dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', os.path.join(local_dir, + 'client2019', os.path.join(local_dir, 'popup_allowed_webdriver_test.py')) # Check if new pop up window comes up self.assertTrue(int(output) > 1) @@ -45,14 +45,14 @@ def test_allow_for_other_url(self): # Set the allow popup site using google.com, so popuptest.com is disabled test_site = 'www.google.com' - self.SetPolicy('win2012-dc', r'PopupsAllowedForUrls\1', test_site, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'PopupsAllowedForUrls\1', test_site, 'String') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Enabled Allow pop-ups on' + test_site) # Run webdriver test local_dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunWebDriverTest( - 'client2012', os.path.join(local_dir, + 'client2019', os.path.join(local_dir, 'popup_allowed_webdriver_test.py')) # Check if the new pop-up windows are blocked self.assertEquals(int(output), 1)
diff --git a/chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup.py b/chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup.py index 0fa9ba32..41b22288e7 100644 --- a/chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup.py +++ b/chrome/test/enterprise/e2e/policy/restore_on_startup/restore_on_startup.py
@@ -22,20 +22,20 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') @test def test_RestoreTheLastSession(self): logging.info('RestoreOnStartup is set to RestoreTheLastSession') - self.SetPolicy('win2012-dc', 'RestoreOnStartup', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'RestoreOnStartup', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') # delete the user data directory to make sure we start from a clean slate. user_data_dir = r'c:\temp\user1' self.RunCommand( - 'client2012', + 'client2019', 'cmd /C if exist %s rmdir /s /q %s' % (user_data_dir, user_data_dir)) dir = os.path.dirname(os.path.abspath(__file__)) user_data_dir_arg = '--user_data_dir=%s' % user_data_dir @@ -44,7 +44,7 @@ # create a session: start Chrome and open several URLs. output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=open_urls', user_data_dir_arg, @@ -54,7 +54,7 @@ # start Chrome. The last session should be restored. output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=start_chrome', user_data_dir_arg, @@ -66,8 +66,8 @@ def test_OpenNewTabPage(self): logging.info('RestoreOnStartup is set to Open New Tab Page') - self.SetPolicy('win2012-dc', 'RestoreOnStartup', 5, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'RestoreOnStartup', 5, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') dir = os.path.dirname(os.path.abspath(__file__)) user_data_dir_arg = r'--user_data_dir=c:\temp\user2' urls = ['https://www.cnn.com/', 'https://www.youtube.com/'] @@ -75,7 +75,7 @@ # create a session: start Chrome and open several URLs. output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=open_urls', user_data_dir_arg, @@ -85,7 +85,7 @@ # start Chrome. There should be just one New Tab page. output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=start_chrome', user_data_dir_arg, @@ -104,13 +104,13 @@ def test_OpenListOfUrls(self): logging.info('RestoreOnStartup is set to Open a list of URLs') - self.SetPolicy('win2012-dc', 'RestoreOnStartup', 4, 'DWORD') + self.SetPolicy('win2019-dc', 'RestoreOnStartup', 4, 'DWORD') urls_to_open = ['https://www.wikipedia.org/'] for i in range(len(urls_to_open)): - self.SetPolicy('win2012-dc', r'RestoreOnStartupURLs\%s' % (i + 1), + self.SetPolicy('win2019-dc', r'RestoreOnStartupURLs\%s' % (i + 1), '"%s"' % urls_to_open[i], 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') dir = os.path.dirname(os.path.abspath(__file__)) user_data_dir_arg = r'--user_data_dir=c:\temp\user3' urls = ['https://www.cnn.com/', 'https://www.youtube.com/'] @@ -118,7 +118,7 @@ # start Chrome and open several URLs. output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=open_urls', user_data_dir_arg, @@ -128,7 +128,7 @@ # start Chrome. Urls specified by RestoreOnStartupURLs should be opened output = self.RunWebDriverTest( - 'client2012', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), + 'client2019', os.path.join(dir, 'restore_on_startup_webdriver_test.py'), [ '--action=start_chrome', user_data_dir_arg,
diff --git a/chrome/test/enterprise/e2e/policy/safe_browsing/safe_browsing.py b/chrome/test/enterprise/e2e/policy/safe_browsing/safe_browsing.py index ea4a36c..9df25458 100644 --- a/chrome/test/enterprise/e2e/policy/safe_browsing/safe_browsing.py +++ b/chrome/test/enterprise/e2e/policy/safe_browsing/safe_browsing.py
@@ -15,20 +15,20 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') def isSafeBrowsingEnabled(self): dir = os.path.dirname(os.path.abspath(__file__)) return self.RunUITest( - 'client2012', + 'client2019', os.path.join(dir, 'safe_browsing_ui_test.py'), timeout=600) @test def test_SafeBrowsingDisabledNoWarning(self): - self.SetPolicy('win2012-dc', r'SafeBrowsingEnabled', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'SafeBrowsingEnabled', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') output = self.isSafeBrowsingEnabled() self.assertIn("RESULTS.unsafe_page: False", output) @@ -36,8 +36,8 @@ @test def test_SafeBrowsingEnabledShowsWarning(self): - self.SetPolicy('win2012-dc', r'SafeBrowsingEnabled', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'SafeBrowsingEnabled', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') output = self.isSafeBrowsingEnabled() self.assertIn("RESULTS.unsafe_page: True", output)
diff --git a/chrome/test/enterprise/e2e/policy/translate_enabled/translate_enabled.py b/chrome/test/enterprise/e2e/policy/translate_enabled/translate_enabled.py index 2826cd1..2d6f57d 100644 --- a/chrome/test/enterprise/e2e/policy/translate_enabled/translate_enabled.py +++ b/chrome/test/enterprise/e2e/policy/translate_enabled/translate_enabled.py
@@ -15,29 +15,29 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.EnableUITest('client2012') + self.InstallChrome('client2019') + self.EnableUITest('client2019') def isChromeTranslateEnabled(self, incognito=False): dir = os.path.dirname(os.path.abspath(__file__)) output = self.RunUITest( - 'client2012', + 'client2019', os.path.join(dir, 'translate_enabled_webdriver_test.py'), args=['--incognito'] if incognito else []) return "TRUE" in output @test def test_TranslatedDisabled(self, incognito=False): - self.SetPolicy('win2012-dc', 'TranslateEnabled', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'TranslateEnabled', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') enabled = self.isChromeTranslateEnabled() self.assertFalse(enabled) @test def test_TranslatedEnabled(self, incognito=False): - self.SetPolicy('win2012-dc', 'TranslateEnabled', 1, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'TranslateEnabled', 1, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') enabled = self.isChromeTranslateEnabled() self.assertTrue(enabled)
diff --git a/chrome/test/enterprise/e2e/policy/url_blacklist/url_blacklist.py b/chrome/test/enterprise/e2e/policy/url_blacklist/url_blacklist.py index 2ac8c23..c9af4e8 100644 --- a/chrome/test/enterprise/e2e/policy/url_blacklist/url_blacklist.py +++ b/chrome/test/enterprise/e2e/policy/url_blacklist/url_blacklist.py
@@ -16,8 +16,8 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') def openPage(self, url, incognito=False): args = ['--url', url, '--text_only'] @@ -26,14 +26,14 @@ dir = os.path.dirname(os.path.abspath(__file__)) logging.info('Opening page: %s' % url) - output = self.RunWebDriverTest('client2012', + output = self.RunWebDriverTest('client2019', os.path.join(dir, '../open_page.py'), args) return output @test def test_BlacklistAllCantVisit(self, incognito=False): - self.SetPolicy('win2012-dc', r'URLBlacklist\1', '*', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'URLBlacklist\1', '*', 'String') + self.RunCommand('client2019', 'gpupdate /force') # Verify that we can't visit any site. output = self.openPage('https://youtube.com/yt/about/', incognito=incognito) @@ -44,9 +44,9 @@ @test def test_BlacklistYouTubeCantVisit(self, incognito=False): - self.SetPolicy('win2012-dc', r'URLBlacklist\1', 'https://youtube.com', + self.SetPolicy('win2019-dc', r'URLBlacklist\1', 'https://youtube.com', 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.RunCommand('client2019', 'gpupdate /force') # Verify that we can't visit YouTube, but can still visit other sites. output = self.openPage('https://youtube.com/yt/about/', incognito=incognito)
diff --git a/chrome/test/enterprise/e2e/policy/url_whitelist/url_whitelist.py b/chrome/test/enterprise/e2e/policy/url_whitelist/url_whitelist.py index 9185837..81a096c 100644 --- a/chrome/test/enterprise/e2e/policy/url_whitelist/url_whitelist.py +++ b/chrome/test/enterprise/e2e/policy/url_whitelist/url_whitelist.py
@@ -19,8 +19,8 @@ @before_all def setup(self): - client = 'client2012' - dc = 'win2012-dc' + client = 'client2019' + dc = 'win2019-dc' self.InstallChrome(client) self.InstallWebDriver(client) @@ -36,7 +36,7 @@ dir = os.path.dirname(os.path.abspath(__file__)) logging.info('Opening page: %s' % url) - output = self.RunWebDriverTest('client2012', + output = self.RunWebDriverTest('client2019', os.path.join(dir, '../open_page.py'), args) return output
diff --git a/chrome/test/enterprise/e2e/policy/user_data_dir/user_data_dir.py b/chrome/test/enterprise/e2e/policy/user_data_dir/user_data_dir.py index ccbce5e..0802187 100644 --- a/chrome/test/enterprise/e2e/policy/user_data_dir/user_data_dir.py +++ b/chrome/test/enterprise/e2e/policy/user_data_dir/user_data_dir.py
@@ -19,20 +19,20 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') @test def test_user_data_dir(self): user_data_dir = r'C:\Temp\Browser\Google\Chrome\UserData' - self.SetPolicy('win2012-dc', r'UserDataDir', user_data_dir, 'String') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', r'UserDataDir', user_data_dir, 'String') + self.RunCommand('client2019', 'gpupdate /force') logging.info('Updated User data dir to: ' + user_data_dir) local_dir = os.path.dirname(os.path.abspath(__file__)) args = ['--user_data_dir', user_data_dir] output = self.RunWebDriverTest( - 'client2012', os.path.join(local_dir, 'user_data_dir_webdriver.py'), + 'client2019', os.path.join(local_dir, 'user_data_dir_webdriver.py'), args) # Verify user data dir not existing before chrome launch
diff --git a/chrome/test/enterprise/e2e/policy/youtube_restrict/youtube_restrict.py b/chrome/test/enterprise/e2e/policy/youtube_restrict/youtube_restrict.py index 2583840..0d54433f 100644 --- a/chrome/test/enterprise/e2e/policy/youtube_restrict/youtube_restrict.py +++ b/chrome/test/enterprise/e2e/policy/youtube_restrict/youtube_restrict.py
@@ -18,30 +18,30 @@ @before_all def setup(self): - self.InstallChrome('client2012') - self.InstallWebDriver('client2012') + self.InstallChrome('client2019') + self.InstallWebDriver('client2019') def openRestrictedVideo(self): url = "https://www.youtube.com/watch?v=JtvhQ6klunk" dir = os.path.dirname(os.path.abspath(__file__)) logging.info('Opening page: %s' % url) - output = self.RunWebDriverTest('client2012', + output = self.RunWebDriverTest('client2019', os.path.join(dir, '../open_page.py'), ['--url', url, '--wait=5', '--text_only']) return output @test def test_UnrestrictedYouTubeCanWatchVideo(self): - self.SetPolicy('win2012-dc', 'ForceYouTubeRestrict', 0, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ForceYouTubeRestrict', 0, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') output = self.openRestrictedVideo() self.assertNotIn(YouTubeRestrictTest.RestrictedText, output) @test def test_StrictRestrictedYouTubeCantWatchVideo(self): - self.SetPolicy('win2012-dc', 'ForceYouTubeRestrict', 2, 'DWORD') - self.RunCommand('client2012', 'gpupdate /force') + self.SetPolicy('win2019-dc', 'ForceYouTubeRestrict', 2, 'DWORD') + self.RunCommand('client2019', 'gpupdate /force') output = self.openRestrictedVideo() self.assertIn(YouTubeRestrictTest.RestrictedText, output)
diff --git a/chromeos/components/cdm_factory_daemon/cdm_factory_daemon_proxy.h b/chromeos/components/cdm_factory_daemon/cdm_factory_daemon_proxy.h index b1552e4..f16e61b 100644 --- a/chromeos/components/cdm_factory_daemon/cdm_factory_daemon_proxy.h +++ b/chromeos/components/cdm_factory_daemon/cdm_factory_daemon_proxy.h
@@ -28,8 +28,6 @@ class COMPONENT_EXPORT(CDM_FACTORY_DAEMON) CdmFactoryDaemonProxy : public cdm::mojom::CdmFactoryDaemon { public: - typedef base::OnceCallback<void(bool connected)> ValidateDaemonConnectionCB; - CdmFactoryDaemonProxy(); CdmFactoryDaemonProxy(const CdmFactoryDaemonProxy&) = delete;
diff --git a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc index cb0da8e..cabe97a 100644 --- a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc +++ b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc
@@ -16,6 +16,7 @@ #include "chromeos/components/cdm_factory_daemon/mojom/content_decryption_module.mojom.h" #include "media/base/content_decryption_module.h" #include "mojo/public/cpp/bindings/associated_remote.h" +#include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "mojo/public/cpp/bindings/pending_associated_remote.h" namespace chromeos { @@ -66,6 +67,37 @@ const media::SessionExpirationUpdateCB& session_expiration_update_cb, media::CdmCreatedCB cdm_created_cb) { DVLOG(1) << __func__ << " key system=" << key_system; + // Check that the user has Verified Access enabled in their Chrome settings + // and if they do not then block this connection since OEMCrypto utilizes + // remote attestation as part of verification. + if (!platform_verification_) { + frame_interfaces_->BindEmbedderReceiver(mojo::GenericPendingReceiver( + platform_verification_.BindNewPipeAndPassReceiver())); + } + platform_verification_->IsVerifiedAccessEnabled(base::BindOnce( + &ChromeOsCdmFactory::OnVerifiedAccessEnabled, weak_factory_.GetWeakPtr(), + key_system, cdm_config, session_message_cb, session_closed_cb, + session_keys_change_cb, session_expiration_update_cb, + std::move(cdm_created_cb))); +} + +void ChromeOsCdmFactory::OnVerifiedAccessEnabled( + const std::string& key_system, + const media::CdmConfig& cdm_config, + const media::SessionMessageCB& session_message_cb, + const media::SessionClosedCB& session_closed_cb, + const media::SessionKeysChangeCB& session_keys_change_cb, + const media::SessionExpirationUpdateCB& session_expiration_update_cb, + media::CdmCreatedCB cdm_created_cb, + bool enabled) { + if (!enabled) { + DVLOG(1) + << "Not using Chrome OS CDM factory due to Verified Access disabled"; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(cdm_created_cb), nullptr, + "Verified Access is disabled.")); + return; + } // This tests if it is bound already. if (!GetCdmFactoryDaemonRemote()) { DCHECK(GetBrowserProxy());
diff --git a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h index c4ed9f4..c5a4925 100644 --- a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h +++ b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h
@@ -11,6 +11,7 @@ #include "media/base/cdm_config.h" #include "media/base/cdm_factory.h" #include "media/mojo/mojom/frame_interface_factory.mojom.h" +#include "media/mojo/mojom/platform_verification.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" @@ -48,6 +49,15 @@ media::CdmCreatedCB cdm_created_cb) override; private: + void OnVerifiedAccessEnabled( + const std::string& key_system, + const media::CdmConfig& cdm_config, + const media::SessionMessageCB& session_message_cb, + const media::SessionClosedCB& session_closed_cb, + const media::SessionKeysChangeCB& session_keys_change_cb, + const media::SessionExpirationUpdateCB& session_expiration_update_cb, + media::CdmCreatedCB cdm_created_cb, + bool enabled); void OnCreateFactory( const media::CdmConfig& cdm_config, const media::SessionMessageCB& session_message_cb, @@ -67,6 +77,7 @@ media::mojom::FrameInterfaceFactory* frame_interfaces_; mojo::Remote<cdm::mojom::CdmFactory> remote_factory_; + mojo::Remote<media::mojom::PlatformVerification> platform_verification_; // WeakPtrFactory to use for callbacks. base::WeakPtrFactory<ChromeOsCdmFactory> weak_factory_{this};
diff --git a/chromeos/components/media_app_ui/resources/js/launch.js b/chromeos/components/media_app_ui/resources/js/launch.js index b03efe8..b4db220 100644 --- a/chromeos/components/media_app_ui/resources/js/launch.js +++ b/chromeos/components/media_app_ui/resources/js/launch.js
@@ -146,7 +146,7 @@ const originalFile = await handle.getFile(); const renamedFileHandle = - await directory.getFile(renameMsg.newFilename, {create: true}); + await directory.getFileHandle(renameMsg.newFilename, {create: true}); // Copy file data over to the new file. const writer = await renamedFileHandle.createWritable(); // TODO(b/153021155): Use originalFile.stream(). @@ -438,7 +438,8 @@ return null; } try { - return (await currentDirectoryHandle.getFile(filename, {create: false})); + return ( + await currentDirectoryHandle.getFileHandle(filename, {create: false})); } catch (/** @type {?Object} */ e) { if (!suppressError) { console.error(e); @@ -455,7 +456,7 @@ * @return {!Promise<{file: !File, handle: !FileSystemFileHandle}>} */ async function getFileFromHandle(fileSystemHandle) { - if (!fileSystemHandle || !fileSystemHandle.isFile) { + if (!fileSystemHandle || fileSystemHandle.kind !== 'file') { // Invent our own exception for this corner case. It might happen if a file // is deleted and replaced with a directory with the same name. throw new DOMException('Not a file.', 'NotAFile'); @@ -529,7 +530,7 @@ return ProcessOtherFilesResult.ABORT; } - if (!handle.isFile) { + if (handle.kind !== 'file') { continue; } let entry = null; @@ -670,7 +671,7 @@ async function launchWithMultipleSelection(directory, handles) { currentFiles.length = 0; for (const handle of handles) { - if (handle && handle.isFile) { + if (handle && handle.kind === 'file') { const fileHandle = /** @type {!FileSystemFileHandle} */ (handle); currentFiles.push({ token: generateToken(fileHandle), @@ -718,7 +719,7 @@ return Promise.resolve(); } - if (!assertCast(params.files[0]).isDirectory) { + if (assertCast(params.files[0]).kind !== 'directory') { console.error('Invalid launch: files[0] is not a directory: ', params); return Promise.resolve(); }
diff --git a/chromeos/components/media_app_ui/resources/js/web_app_file_handling.externs.js b/chromeos/components/media_app_ui/resources/js/web_app_file_handling.externs.js index 12ac91d..3a31ae0 100644 --- a/chromeos/components/media_app_ui/resources/js/web_app_file_handling.externs.js +++ b/chromeos/components/media_app_ui/resources/js/web_app_file_handling.externs.js
@@ -71,11 +71,8 @@ /** @interface */ class FileSystemHandle { constructor() { - /** @type {boolean} */ - this.isFile; - - /** @type {boolean} */ - this.isDirectory; + /** @type {string} */ + this.kind; /** @type {string} */ this.name; @@ -141,14 +138,14 @@ * @param {FileSystemGetFileOptions=} options * @return {!Promise<!FileSystemFileHandle>} */ - getFile(name, options) {} + getFileHandle(name, options) {} /** * @param {string} name * @param {FileSystemGetDirectoryOptions=} options * @return {Promise<!FileSystemDirectoryHandle>} */ - getDirectory(name, options) {} + getDirectoryHandle(name, options) {} /** @return {!AsyncIterable<!FileSystemHandle>} */ getEntries() {} @@ -159,12 +156,6 @@ * @return {Promise<undefined>} */ removeEntry(name, options) {} - - /** - * @param {GetSystemDirectoryOptions} options - * @return {Promise<!FileSystemDirectoryHandle>} - */ - static getSystemDirectory(options) {} } /** @interface */
diff --git a/chromeos/components/media_app_ui/test/driver.js b/chromeos/components/media_app_ui/test/driver.js index 52f8ee6..26cefd0 100644 --- a/chromeos/components/media_app_ui/test/driver.js +++ b/chromeos/components/media_app_ui/test/driver.js
@@ -108,8 +108,7 @@ * @param {string=} name */ constructor(name = 'fake_file.png') { - this.isFile = true; - this.isDirectory = false; + this.kind = 'file'; this.name = name; } /** @override */ @@ -178,8 +177,7 @@ */ constructor(name = 'fake-dir') { super(name); - this.isFile = false; - this.isDirectory = true; + this.kind = 'directory'; /** * Internal state mocking file handles in a directory handle. * @type {!Array<!FakeFileSystemFileHandle>} @@ -206,7 +204,7 @@ return this.files.map(f => f.getFileSync()); } /** @override */ - async getFile(name, options) { + async getFileHandle(name, options) { const fileHandle = this.files.find(f => f.name === name); if (!fileHandle && options && options.create === true) { // Simulate creating a new file, assume it is an image. This is needed for @@ -221,7 +219,7 @@ 'NotFoundError', `File ${name} not found`))); } /** @override */ - getDirectory(name, options) {} + getDirectoryHandle(name, options) {} /** * @override * @return {!AsyncIterable<!FileSystemHandle>} @@ -371,7 +369,7 @@ * @param {!File} file */ async function loadFilesWithoutSendingToGuest(directory, file) { - const handle = await directory.getFile(file.name); + const handle = await directory.getFileHandle(file.name); globalLaunchNumber++; setCurrentDirectory(directory, {file, handle}); await processOtherFilesInDirectory(directory, file, globalLaunchNumber);
diff --git a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js index 987996e..416bbc1 100644 --- a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js +++ b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js
@@ -423,8 +423,7 @@ let result = await waitForImageAndGetWidth('1.png'); assertEquals(await getFileErrors(), ','); - handles[1].isFile = false; - handles[1].isDirectory = true; + handles[1].kind = 'directory'; handles[1].getFileSync = () => { throw new Error( '(in test) FileThatBecomesDirectory: getFileSync should not be called');
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index ba395e3..30ecb35 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -79,6 +79,11 @@ const base::Feature kCameraSystemWebApp{"CameraSystemWebApp", base::FEATURE_DISABLED_BY_DEFAULT}; +// If enabled, will use the CDM in the Chrome OS daemon rather than loading the +// CDM using the library CDM interface. +const base::Feature kCdmFactoryDaemon{"CdmFactoryDaemon", + base::FEATURE_DISABLED_BY_DEFAULT}; + // If enabled, options page for each input method will be opened in ChromeOS // settings. Otherwise it will be opened in a new web page in Chrome browser. const base::Feature kImeOptionsInSettings{"ImeOptionsInSettings",
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index b6f3326..485c7ae 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -44,6 +44,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kCameraSystemWebApp; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const base::Feature kCdmFactoryDaemon; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kCrostiniPortForwarding; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kCrostiniDiskResizing; @@ -91,8 +93,6 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kClipboardHistory; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) -extern const base::Feature kClipboardHistory; -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kEnableImeSandbox; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kEnableSupervisionTransitionScreens;
diff --git a/chromeos/profiles/orderfile.newest.txt b/chromeos/profiles/orderfile.newest.txt index a19e09f..9f3ad8e 100644 --- a/chromeos/profiles/orderfile.newest.txt +++ b/chromeos/profiles/orderfile.newest.txt
@@ -1 +1 @@ -chromeos-chrome-orderfile-field-85-4181.3-1594028802-benchmark-85.0.4183.18-r1.orderfile.xz +chromeos-chrome-orderfile-field-85-4181.3-1594028802-benchmark-85.0.4183.22-r1.orderfile.xz
diff --git a/components/autofill_assistant/browser/field_formatter.cc b/components/autofill_assistant/browser/field_formatter.cc index a1986f01..020e23c 100644 --- a/components/autofill_assistant/browser/field_formatter.cc +++ b/components/autofill_assistant/browser/field_formatter.cc
@@ -10,6 +10,7 @@ #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/autofill_type.h" #include "components/autofill/core/browser/field_types.h" +#include "components/autofill/core/browser/geo/state_names.h" #include "components/autofill_assistant/browser/generic_ui.pb.h" #include "third_party/re2/src/re2/re2.h" #include "third_party/re2/src/re2/stringpiece.h" @@ -86,7 +87,21 @@ CreateAutofillMappings<autofill::AutofillProfile>( const autofill::AutofillProfile& profile, const std::string& locale) { - return CreateFormGroupMappings(profile, locale); + auto mappings = CreateFormGroupMappings(profile, locale); + + auto state = profile.GetInfo( + autofill::AutofillType(autofill::ADDRESS_HOME_STATE), locale); + if (!state.empty()) { + // TODO(b/159309560): Capitalize first letter of the state name. + auto state_name = + base::UTF16ToUTF8(autofill::state_names::GetNameForAbbreviation(state)); + if (!state_name.empty()) { + mappings[base::NumberToString(static_cast<int>( + AutofillFormatProto::ADDRESS_HOME_STATE_NAME))] = state_name; + } + } + + return mappings; } template <>
diff --git a/components/autofill_assistant/browser/field_formatter_unittest.cc b/components/autofill_assistant/browser/field_formatter_unittest.cc index 760a5fb..ad75b5a 100644 --- a/components/autofill_assistant/browser/field_formatter_unittest.cc +++ b/components/autofill_assistant/browser/field_formatter_unittest.cc
@@ -46,18 +46,37 @@ autofill::test::SetProfileInfo( &profile, "John", "", "Doe", "editor@gmail.com", "", "203 Barfield Lane", "", "Mountain View", "CA", "94043", "US", "+12345678901"); - // NAME_FIRST - EXPECT_EQ(*FormatString("${3}", CreateAutofillMappings(profile, "en-US")), - "John"); - // UNKNOWN_TYPE - EXPECT_EQ(FormatString("${1}", CreateAutofillMappings(profile, "en-US")), - base::nullopt); + // NAME_FIRST NAME_LAST + EXPECT_EQ( + *FormatString("${3} ${5}", CreateAutofillMappings(profile, "en-US")), + "John Doe"); // PHONE_HOME_COUNTRY_CODE, PHONE_HOME_CITY_CODE, PHONE_HOME_NUMBER EXPECT_EQ(*FormatString("(+${12}) (${11}) ${10}", CreateAutofillMappings(profile, "en-US")), "(+1) (234) 5678901"); + + // ADDRESS_HOME_STATE, ADDRESS_HOME_STATE_NAME + EXPECT_EQ( + *FormatString("${34} - ${-6}", CreateAutofillMappings(profile, "en-US")), + "CA - california"); + + // Unknown state. + autofill::AutofillProfile unknown_state_profile(base::GenerateGUID(), + kFakeUrl); + autofill::test::SetProfileInfo(&unknown_state_profile, "John", "", "Doe", "", + "", "", "", "", "XY", "", "US", ""); + EXPECT_EQ(FormatString("${34}", CreateAutofillMappings(unknown_state_profile, + "en-US")), + "XY"); + EXPECT_EQ(FormatString("${-6}", CreateAutofillMappings(unknown_state_profile, + "en-US")), + base::nullopt); + + // UNKNOWN_TYPE + EXPECT_EQ(FormatString("${1}", CreateAutofillMappings(profile, "en-US")), + base::nullopt); } TEST(FieldFormatterTest, CreditCard) {
diff --git a/components/autofill_assistant/browser/generic_ui.proto b/components/autofill_assistant/browser/generic_ui.proto index 85cbffb..e4031ba9 100644 --- a/components/autofill_assistant/browser/generic_ui.proto +++ b/components/autofill_assistant/browser/generic_ui.proto
@@ -196,6 +196,8 @@ CREDIT_CARD_RAW_NUMBER = -3; CREDIT_CARD_NUMBER_LAST_FOUR_DIGITS = -4; CREDIT_CARD_NETWORK_FOR_DISPLAY = -5; + // Currently only US states are supported. The state name is in lower case. + ADDRESS_HOME_STATE_NAME = -6; } // The format string to use. May contain one or multiple "${key}" // placeholders, where the key is an integer corresponding to
diff --git a/components/browser_ui/media/android/java/src/org/chromium/components/browser_ui/media/MediaNotificationController.java b/components/browser_ui/media/android/java/src/org/chromium/components/browser_ui/media/MediaNotificationController.java index be930b7..276c7ea 100644 --- a/components/browser_ui/media/android/java/src/org/chromium/components/browser_ui/media/MediaNotificationController.java +++ b/components/browser_ui/media/android/java/src/org/chromium/components/browser_ui/media/MediaNotificationController.java
@@ -27,11 +27,11 @@ import org.chromium.base.CollectionUtil; import org.chromium.base.ContextUtils; import org.chromium.base.Log; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.ForegroundServiceUtils; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.media_session.mojom.MediaSessionAction; import org.chromium.services.media_session.MediaMetadata; @@ -85,7 +85,7 @@ private SparseArray<MediaButtonInfo> mActionToButtonInfo; @VisibleForTesting - public ChromeNotificationBuilder mNotificationBuilder; + public NotificationWrapperBuilder mNotificationBuilder; @VisibleForTesting public Bitmap mDefaultNotificationLargeIcon; @@ -243,7 +243,7 @@ * @return true if {@link Service#startForeground()} was called. */ public static boolean finishStartingForegroundServiceOnO( - Service service, ChromeNotification notification) { + Service service, NotificationWrapper notification) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return false; ForegroundServiceUtils.getInstance().startForeground(service, notification.getMetadata().id, notification.getNotification(), 0 /* foregroundServiceType */); @@ -294,13 +294,13 @@ String getNotificationGroupName(); /** Returns a builder suitable as a starting point for creating the notification. */ - ChromeNotificationBuilder createChromeNotificationBuilder(); + NotificationWrapperBuilder createNotificationWrapperBuilder(); /** Called when the Android MediaSession has been updated. */ void onMediaSessionUpdated(MediaSessionCompat session); /** Called when a notification has been shown and should be logged in UMA. */ - void logNotificationShown(ChromeNotification notification); + void logNotificationShown(NotificationWrapper notification); } public MediaNotificationController(Delegate delegate) { @@ -547,7 +547,7 @@ if (mMediaNotificationInfo == null) { if (serviceStarting) { finishStartingForegroundServiceOnO(mService, - mDelegate.createChromeNotificationBuilder().buildChromeNotification()); + mDelegate.createNotificationWrapperBuilder().buildNotificationWrapper()); ForegroundServiceUtils.getInstance().stopForeground( mService, Service.STOP_FOREGROUND_REMOVE); } @@ -556,7 +556,7 @@ updateMediaSession(); updateNotificationBuilder(); - ChromeNotification notification = mNotificationBuilder.buildChromeNotification(); + NotificationWrapper notification = mNotificationBuilder.buildNotificationWrapper(); // On O, finish starting the foreground service nevertheless, or Android will // crash Chrome. @@ -586,7 +586,7 @@ public void updateNotificationBuilder() { assert (mMediaNotificationInfo != null); - mNotificationBuilder = mDelegate.createChromeNotificationBuilder(); + mNotificationBuilder = mDelegate.createNotificationWrapperBuilder(); setMediaStyleLayoutForNotificationBuilder(mNotificationBuilder); // TODO(zqzhang): It's weird that setShowWhen() doesn't work on K. Calling setWhen() to @@ -697,7 +697,7 @@ mMediaSession.setActive(true); } - private void setMediaStyleLayoutForNotificationBuilder(ChromeNotificationBuilder builder) { + private void setMediaStyleLayoutForNotificationBuilder(NotificationWrapperBuilder builder) { setMediaStyleNotificationText(builder); if (!mMediaNotificationInfo.supportsPlayPause()) { // Non-playback (Cast) notification will not use MediaStyle, so not @@ -721,7 +721,7 @@ addNotificationButtons(builder); } - private void addNotificationButtons(ChromeNotificationBuilder builder) { + private void addNotificationButtons(NotificationWrapperBuilder builder) { Set<Integer> actions = new HashSet<>(); // TODO(zqzhang): handle other actions when play/pause is not supported? See @@ -759,7 +759,7 @@ } } - private void setMediaStyleNotificationText(ChromeNotificationBuilder builder) { + private void setMediaStyleNotificationText(NotificationWrapperBuilder builder) { if (mMediaNotificationInfo.isPrivate) { // Notifications in incognito shouldn't show what is playing to avoid leaking // information.
diff --git a/components/browser_ui/notifications/android/BUILD.gn b/components/browser_ui/notifications/android/BUILD.gn index 220f0f9..2946699 100644 --- a/components/browser_ui/notifications/android/BUILD.gn +++ b/components/browser_ui/notifications/android/BUILD.gn
@@ -6,14 +6,14 @@ android_library("java") { sources = [ - "java/src/org/chromium/components/browser_ui/notifications/ChromeNotification.java", - "java/src/org/chromium/components/browser_ui/notifications/ChromeNotificationBuilder.java", "java/src/org/chromium/components/browser_ui/notifications/ForegroundServiceUtils.java", - "java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java", - "java/src/org/chromium/components/browser_ui/notifications/NotificationCompatBuilder.java", "java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxy.java", "java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl.java", "java/src/org/chromium/components/browser_ui/notifications/NotificationMetadata.java", + "java/src/org/chromium/components/browser_ui/notifications/NotificationWrapper.java", + "java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperBuilder.java", + "java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java", + "java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java", "java/src/org/chromium/components/browser_ui/notifications/PendingIntentProvider.java", "java/src/org/chromium/components/browser_ui/notifications/channels/ChannelDefinitions.java", "java/src/org/chromium/components/browser_ui/notifications/channels/ChannelsInitializer.java",
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotificationBuilder.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotificationBuilder.java deleted file mode 100644 index 096baa92..0000000 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotificationBuilder.java +++ /dev/null
@@ -1,120 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.components.browser_ui.notifications; - -import android.app.Notification; -import android.app.PendingIntent; -import android.graphics.Bitmap; -import android.graphics.drawable.Icon; -import android.net.Uri; -import android.os.Bundle; -import android.support.v4.media.session.MediaSessionCompat; -import android.widget.RemoteViews; - -/** - * Abstraction over Notification.Builder and NotificationCompat.Builder interfaces. - */ -public interface ChromeNotificationBuilder { - ChromeNotificationBuilder setAutoCancel(boolean autoCancel); - - @Deprecated - ChromeNotificationBuilder setContentIntent(PendingIntent contentIntent); - - ChromeNotificationBuilder setContentIntent(PendingIntentProvider contentIntent); - - ChromeNotificationBuilder setContentTitle(CharSequence title); - - ChromeNotificationBuilder setContentText(CharSequence text); - - ChromeNotificationBuilder setSmallIcon(int icon); - - ChromeNotificationBuilder setSmallIcon(Icon icon); - - ChromeNotificationBuilder setColor(int argb); - - ChromeNotificationBuilder setTicker(CharSequence text); - - ChromeNotificationBuilder setLocalOnly(boolean localOnly); - - ChromeNotificationBuilder setGroup(String group); - - ChromeNotificationBuilder setGroupSummary(boolean isGroupSummary); - - ChromeNotificationBuilder addExtras(Bundle extras); - - ChromeNotificationBuilder setOngoing(boolean ongoing); - - ChromeNotificationBuilder setVisibility(int visibility); - - ChromeNotificationBuilder setShowWhen(boolean showWhen); - - @Deprecated - ChromeNotificationBuilder addAction(int icon, CharSequence title, PendingIntent intent); - - /** - * @param actionType is for UMA. In Chrome, this is {@link NotificationUmaTracker.ActionType}. - */ - ChromeNotificationBuilder addAction( - int icon, CharSequence title, PendingIntentProvider intent, int actionType); - - @Deprecated - ChromeNotificationBuilder addAction(Notification.Action action); - - /** - * @param actionType is for UMA. In Chrome, this is {@link NotificationUmaTracker.ActionType}. - */ - ChromeNotificationBuilder addAction(Notification.Action action, int flags, int actionType); - - @Deprecated - ChromeNotificationBuilder setDeleteIntent(PendingIntent intent); - - ChromeNotificationBuilder setDeleteIntent(PendingIntentProvider intent); - - /** - * Sets the priority of single notification on Android versions prior to Oreo. - * (From Oreo onwards, priority is instead determined by channel importance.) - */ - ChromeNotificationBuilder setPriorityBeforeO(int pri); - - ChromeNotificationBuilder setProgress(int max, int percentage, boolean indeterminate); - - ChromeNotificationBuilder setSubText(CharSequence text); - - ChromeNotificationBuilder setContentInfo(String info); - - ChromeNotificationBuilder setWhen(long time); - - ChromeNotificationBuilder setLargeIcon(Bitmap icon); - - ChromeNotificationBuilder setVibrate(long[] vibratePattern); - - ChromeNotificationBuilder setSound(Uri sound); - - ChromeNotificationBuilder setDefaults(int defaults); - - ChromeNotificationBuilder setOnlyAlertOnce(boolean onlyAlertOnce); - - ChromeNotificationBuilder setPublicVersion(Notification publicNotification); - - ChromeNotificationBuilder setContent(RemoteViews views); - - ChromeNotificationBuilder setStyle(Notification.BigPictureStyle style); - - ChromeNotificationBuilder setStyle(Notification.BigTextStyle bigTextStyle); - - ChromeNotificationBuilder setMediaStyle(MediaSessionCompat session, int[] actions, - PendingIntent intent, boolean showCancelButton); - - ChromeNotificationBuilder setCategory(String category); - - ChromeNotification buildWithBigContentView(RemoteViews bigView); - - ChromeNotification buildWithBigTextStyle(String bigText); - - @Deprecated - Notification build(); - - ChromeNotification buildChromeNotification(); -}
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/MockNotificationManagerProxy.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/MockNotificationManagerProxy.java index 79326445..4cd0dced 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/MockNotificationManagerProxy.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/MockNotificationManagerProxy.java
@@ -115,7 +115,7 @@ } @Override - public void notify(ChromeNotification notification) { + public void notify(NotificationWrapper notification) { notify(notification.getMetadata().tag, notification.getMetadata().id, notification.getNotification()); }
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxy.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxy.java index 881a227..f588b70 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxy.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxy.java
@@ -45,7 +45,7 @@ @Deprecated void notify(String tag, int id, Notification notification); - void notify(ChromeNotification notification); + void notify(NotificationWrapper notification); @TargetApi(Build.VERSION_CODES.O) NotificationChannel getNotificationChannel(String channelId);
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl.java index dc8eddf..48d798c 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationManagerProxyImpl.java
@@ -109,7 +109,7 @@ } @Override - public void notify(ChromeNotification notification) { + public void notify(NotificationWrapper notification) { if (notification == null || notification.getNotification() == null) { Log.e(TAG, "Failed to create notification."); return;
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotification.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapper.java similarity index 87% rename from components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotification.java rename to components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapper.java index a3d956d..791a1566 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/ChromeNotification.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapper.java
@@ -11,12 +11,12 @@ /** * A wrapper class of {@link Notification}, which also contains the notification id and tag, etc. */ -public class ChromeNotification { +public class NotificationWrapper { @Nullable private final Notification mNotification; private final NotificationMetadata mNotificationMetadata; - public ChromeNotification(@Nullable Notification notification, NotificationMetadata metadata) { + public NotificationWrapper(@Nullable Notification notification, NotificationMetadata metadata) { assert metadata != null; mNotification = notification; mNotificationMetadata = metadata;
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperBuilder.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperBuilder.java new file mode 100644 index 0000000..6726260 --- /dev/null +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperBuilder.java
@@ -0,0 +1,120 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.browser_ui.notifications; + +import android.app.Notification; +import android.app.PendingIntent; +import android.graphics.Bitmap; +import android.graphics.drawable.Icon; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.media.session.MediaSessionCompat; +import android.widget.RemoteViews; + +/** + * Abstraction over Notification.Builder and NotificationCompat.Builder interfaces. + */ +public interface NotificationWrapperBuilder { + NotificationWrapperBuilder setAutoCancel(boolean autoCancel); + + @Deprecated + NotificationWrapperBuilder setContentIntent(PendingIntent contentIntent); + + NotificationWrapperBuilder setContentIntent(PendingIntentProvider contentIntent); + + NotificationWrapperBuilder setContentTitle(CharSequence title); + + NotificationWrapperBuilder setContentText(CharSequence text); + + NotificationWrapperBuilder setSmallIcon(int icon); + + NotificationWrapperBuilder setSmallIcon(Icon icon); + + NotificationWrapperBuilder setColor(int argb); + + NotificationWrapperBuilder setTicker(CharSequence text); + + NotificationWrapperBuilder setLocalOnly(boolean localOnly); + + NotificationWrapperBuilder setGroup(String group); + + NotificationWrapperBuilder setGroupSummary(boolean isGroupSummary); + + NotificationWrapperBuilder addExtras(Bundle extras); + + NotificationWrapperBuilder setOngoing(boolean ongoing); + + NotificationWrapperBuilder setVisibility(int visibility); + + NotificationWrapperBuilder setShowWhen(boolean showWhen); + + @Deprecated + NotificationWrapperBuilder addAction(int icon, CharSequence title, PendingIntent intent); + + /** + * @param actionType is for UMA. In Chrome, this is {@link NotificationUmaTracker.ActionType}. + */ + NotificationWrapperBuilder addAction( + int icon, CharSequence title, PendingIntentProvider intent, int actionType); + + @Deprecated + NotificationWrapperBuilder addAction(Notification.Action action); + + /** + * @param actionType is for UMA. In Chrome, this is {@link NotificationUmaTracker.ActionType}. + */ + NotificationWrapperBuilder addAction(Notification.Action action, int flags, int actionType); + + @Deprecated + NotificationWrapperBuilder setDeleteIntent(PendingIntent intent); + + NotificationWrapperBuilder setDeleteIntent(PendingIntentProvider intent); + + /** + * Sets the priority of single notification on Android versions prior to Oreo. + * (From Oreo onwards, priority is instead determined by channel importance.) + */ + NotificationWrapperBuilder setPriorityBeforeO(int pri); + + NotificationWrapperBuilder setProgress(int max, int percentage, boolean indeterminate); + + NotificationWrapperBuilder setSubText(CharSequence text); + + NotificationWrapperBuilder setContentInfo(String info); + + NotificationWrapperBuilder setWhen(long time); + + NotificationWrapperBuilder setLargeIcon(Bitmap icon); + + NotificationWrapperBuilder setVibrate(long[] vibratePattern); + + NotificationWrapperBuilder setSound(Uri sound); + + NotificationWrapperBuilder setDefaults(int defaults); + + NotificationWrapperBuilder setOnlyAlertOnce(boolean onlyAlertOnce); + + NotificationWrapperBuilder setPublicVersion(Notification publicNotification); + + NotificationWrapperBuilder setContent(RemoteViews views); + + NotificationWrapperBuilder setStyle(Notification.BigPictureStyle style); + + NotificationWrapperBuilder setStyle(Notification.BigTextStyle bigTextStyle); + + NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, + PendingIntent intent, boolean showCancelButton); + + NotificationWrapperBuilder setCategory(String category); + + NotificationWrapper buildWithBigContentView(RemoteViews bigView); + + NotificationWrapper buildWithBigTextStyle(String bigText); + + @Deprecated + Notification build(); + + NotificationWrapper buildNotificationWrapper(); +}
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationCompatBuilder.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java similarity index 63% rename from components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationCompatBuilder.java rename to components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java index ac08419..5d8a549 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationCompatBuilder.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java
@@ -23,12 +23,12 @@ /** * Wraps a {@link NotificationCompat.Builder} object. */ -public class NotificationCompatBuilder implements ChromeNotificationBuilder { +public class NotificationWrapperCompatBuilder implements NotificationWrapperBuilder { private static final String TAG = "NotifCompatBuilder"; private final NotificationCompat.Builder mBuilder; private final NotificationMetadata mMetadata; - public NotificationCompatBuilder(Context context, String channelId, + public NotificationWrapperCompatBuilder(Context context, String channelId, ChannelsInitializer channelsInitializer, NotificationMetadata metadata) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { channelsInitializer.safeInitialize(channelId); @@ -38,223 +38,224 @@ } @Override - public ChromeNotificationBuilder setAutoCancel(boolean autoCancel) { + public NotificationWrapperBuilder setAutoCancel(boolean autoCancel) { mBuilder.setAutoCancel(autoCancel); return this; } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntent contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntent contentIntent) { mBuilder.setContentIntent(contentIntent); return this; } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntentProvider contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntentProvider contentIntent) { mBuilder.setContentIntent(contentIntent.getPendingIntent()); return this; } @Override - public ChromeNotificationBuilder setContentTitle(CharSequence title) { + public NotificationWrapperBuilder setContentTitle(CharSequence title) { mBuilder.setContentTitle(title); return this; } @Override - public ChromeNotificationBuilder setContentText(CharSequence text) { + public NotificationWrapperBuilder setContentText(CharSequence text) { mBuilder.setContentText(text); return this; } @Override - public ChromeNotificationBuilder setSmallIcon(int icon) { + public NotificationWrapperBuilder setSmallIcon(int icon) { mBuilder.setSmallIcon(icon); return this; } @Override - public ChromeNotificationBuilder setSmallIcon(Icon icon) { + public NotificationWrapperBuilder setSmallIcon(Icon icon) { assert false; // unused return this; } @Override - public ChromeNotificationBuilder setColor(int argb) { + public NotificationWrapperBuilder setColor(int argb) { mBuilder.setColor(argb); return this; } @Override - public ChromeNotificationBuilder setTicker(CharSequence text) { + public NotificationWrapperBuilder setTicker(CharSequence text) { mBuilder.setTicker(text); return this; } @Override - public ChromeNotificationBuilder setLocalOnly(boolean localOnly) { + public NotificationWrapperBuilder setLocalOnly(boolean localOnly) { mBuilder.setLocalOnly(localOnly); return this; } @Override - public ChromeNotificationBuilder setGroup(String group) { + public NotificationWrapperBuilder setGroup(String group) { mBuilder.setGroup(group); return this; } @Override - public ChromeNotificationBuilder setGroupSummary(boolean isGroupSummary) { + public NotificationWrapperBuilder setGroupSummary(boolean isGroupSummary) { mBuilder.setGroupSummary(isGroupSummary); return this; } @Override - public ChromeNotificationBuilder addExtras(Bundle extras) { + public NotificationWrapperBuilder addExtras(Bundle extras) { mBuilder.addExtras(extras); return this; } @Override - public ChromeNotificationBuilder setOngoing(boolean ongoing) { + public NotificationWrapperBuilder setOngoing(boolean ongoing) { mBuilder.setOngoing(ongoing); return this; } @Override - public ChromeNotificationBuilder setVisibility(int visibility) { + public NotificationWrapperBuilder setVisibility(int visibility) { mBuilder.setVisibility(visibility); return this; } @Override - public ChromeNotificationBuilder setShowWhen(boolean showWhen) { + public NotificationWrapperBuilder setShowWhen(boolean showWhen) { mBuilder.setShowWhen(showWhen); return this; } @Override - public ChromeNotificationBuilder addAction(int icon, CharSequence title, PendingIntent intent) { + public NotificationWrapperBuilder addAction( + int icon, CharSequence title, PendingIntent intent) { mBuilder.addAction(icon, title, intent); return this; } @Override - public ChromeNotificationBuilder addAction(int icon, CharSequence title, + public NotificationWrapperBuilder addAction(int icon, CharSequence title, PendingIntentProvider pendingIntentProvider, int actionType) { addAction(icon, title, pendingIntentProvider.getPendingIntent()); return this; } @Override - public ChromeNotificationBuilder addAction(Notification.Action action) { + public NotificationWrapperBuilder addAction(Notification.Action action) { return this; } @Override - public ChromeNotificationBuilder addAction( + public NotificationWrapperBuilder addAction( Notification.Action action, int flags, int actionType) { return this; } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntent intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntent intent) { mBuilder.setDeleteIntent(intent); return this; } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntentProvider intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntentProvider intent) { mBuilder.setDeleteIntent(intent.getPendingIntent()); return this; } @Override - public ChromeNotificationBuilder setPriorityBeforeO(int pri) { + public NotificationWrapperBuilder setPriorityBeforeO(int pri) { mBuilder.setPriority(pri); return this; } @Override - public ChromeNotificationBuilder setProgress(int max, int percentage, boolean indeterminate) { + public NotificationWrapperBuilder setProgress(int max, int percentage, boolean indeterminate) { mBuilder.setProgress(max, percentage, indeterminate); return this; } @Override - public ChromeNotificationBuilder setSubText(CharSequence text) { + public NotificationWrapperBuilder setSubText(CharSequence text) { mBuilder.setSubText(text); return this; } @Override - public ChromeNotificationBuilder setContentInfo(String info) { + public NotificationWrapperBuilder setContentInfo(String info) { mBuilder.setContentInfo(info); return this; } @Override - public ChromeNotificationBuilder setWhen(long time) { + public NotificationWrapperBuilder setWhen(long time) { mBuilder.setWhen(time); return this; } @Override - public ChromeNotificationBuilder setLargeIcon(Bitmap icon) { + public NotificationWrapperBuilder setLargeIcon(Bitmap icon) { mBuilder.setLargeIcon(icon); return this; } @Override - public ChromeNotificationBuilder setVibrate(long[] vibratePattern) { + public NotificationWrapperBuilder setVibrate(long[] vibratePattern) { mBuilder.setVibrate(vibratePattern); return this; } @Override - public ChromeNotificationBuilder setSound(Uri sound) { + public NotificationWrapperBuilder setSound(Uri sound) { mBuilder.setSound(sound); return this; } @Override - public ChromeNotificationBuilder setDefaults(int defaults) { + public NotificationWrapperBuilder setDefaults(int defaults) { mBuilder.setDefaults(defaults); return this; } @Override - public ChromeNotificationBuilder setOnlyAlertOnce(boolean onlyAlertOnce) { + public NotificationWrapperBuilder setOnlyAlertOnce(boolean onlyAlertOnce) { mBuilder.setOnlyAlertOnce(onlyAlertOnce); return this; } @Override - public ChromeNotificationBuilder setPublicVersion(Notification publicNotification) { + public NotificationWrapperBuilder setPublicVersion(Notification publicNotification) { mBuilder.setPublicVersion(publicNotification); return this; } @Override - public ChromeNotificationBuilder setContent(RemoteViews views) { + public NotificationWrapperBuilder setContent(RemoteViews views) { mBuilder.setCustomContentView(views); return this; } @Override - public ChromeNotificationBuilder setStyle(Notification.BigPictureStyle style) { + public NotificationWrapperBuilder setStyle(Notification.BigPictureStyle style) { assert false; // unused return this; } @Override - public ChromeNotificationBuilder setStyle(Notification.BigTextStyle bigTextStyle) { + public NotificationWrapperBuilder setStyle(Notification.BigTextStyle bigTextStyle) { assert false; // unused return this; } @Override - public ChromeNotificationBuilder setMediaStyle(MediaSessionCompat session, int[] actions, + public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, PendingIntent intent, boolean showCancelButton) { androidx.media.app.NotificationCompat.MediaStyle style = new androidx.media.app.NotificationCompat.MediaStyle(); @@ -267,25 +268,25 @@ } @Override - public ChromeNotificationBuilder setCategory(String category) { + public NotificationWrapperBuilder setCategory(String category) { mBuilder.setCategory(category); return this; } @Override - public ChromeNotification buildWithBigContentView(RemoteViews view) { + public NotificationWrapper buildWithBigContentView(RemoteViews view) { assert mMetadata != null; - return new ChromeNotification(mBuilder.setCustomBigContentView(view).build(), mMetadata); + return new NotificationWrapper(mBuilder.setCustomBigContentView(view).build(), mMetadata); } @Override - public ChromeNotification buildWithBigTextStyle(String bigText) { + public NotificationWrapper buildWithBigTextStyle(String bigText) { NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(mBuilder); bigTextStyle.bigText(bigText); assert mMetadata != null; - return new ChromeNotification(bigTextStyle.build(), mMetadata); + return new NotificationWrapper(bigTextStyle.build(), mMetadata); } @Override @@ -301,9 +302,9 @@ } @Override - public ChromeNotification buildChromeNotification() { + public NotificationWrapper buildNotificationWrapper() { assert mMetadata != null; - return new ChromeNotification(build(), mMetadata); + return new NotificationWrapper(build(), mMetadata); } protected NotificationCompat.Builder getBuilder() {
diff --git a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java similarity index 66% rename from components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java rename to components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java index 89250262..0c02412 100644 --- a/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java +++ b/components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java
@@ -21,12 +21,12 @@ /** * Wraps a {@link Notification.Builder} object. */ -public class NotificationBuilder implements ChromeNotificationBuilder { +public class NotificationWrapperStandardBuilder implements NotificationWrapperBuilder { private final Notification.Builder mBuilder; private final Context mContext; private final NotificationMetadata mMetadata; - public NotificationBuilder(Context context, String channelId, + public NotificationWrapperStandardBuilder(Context context, String channelId, ChannelsInitializer channelsInitializer, NotificationMetadata metadata) { mContext = context; mBuilder = new Notification.Builder(mContext); @@ -38,43 +38,43 @@ } @Override - public ChromeNotificationBuilder setAutoCancel(boolean autoCancel) { + public NotificationWrapperBuilder setAutoCancel(boolean autoCancel) { mBuilder.setAutoCancel(autoCancel); return this; } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntent contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntent contentIntent) { mBuilder.setContentIntent(contentIntent); return this; } @Override - public ChromeNotificationBuilder setContentIntent(PendingIntentProvider contentIntent) { + public NotificationWrapperBuilder setContentIntent(PendingIntentProvider contentIntent) { mBuilder.setContentIntent(contentIntent.getPendingIntent()); return this; } @Override - public ChromeNotificationBuilder setContentTitle(CharSequence title) { + public NotificationWrapperBuilder setContentTitle(CharSequence title) { mBuilder.setContentTitle(title); return this; } @Override - public ChromeNotificationBuilder setContentText(CharSequence text) { + public NotificationWrapperBuilder setContentText(CharSequence text) { mBuilder.setContentText(text); return this; } @Override - public ChromeNotificationBuilder setSmallIcon(int icon) { + public NotificationWrapperBuilder setSmallIcon(int icon) { mBuilder.setSmallIcon(icon); return this; } @Override - public ChromeNotificationBuilder setSmallIcon(Icon icon) { + public NotificationWrapperBuilder setSmallIcon(Icon icon) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mBuilder.setSmallIcon(icon); } @@ -82,62 +82,63 @@ } @Override - public ChromeNotificationBuilder setColor(int argb) { + public NotificationWrapperBuilder setColor(int argb) { mBuilder.setColor(argb); return this; } @Override - public ChromeNotificationBuilder setTicker(CharSequence text) { + public NotificationWrapperBuilder setTicker(CharSequence text) { mBuilder.setTicker(text); return this; } @Override - public ChromeNotificationBuilder setLocalOnly(boolean localOnly) { + public NotificationWrapperBuilder setLocalOnly(boolean localOnly) { mBuilder.setLocalOnly(localOnly); return this; } @Override - public ChromeNotificationBuilder setGroup(String group) { + public NotificationWrapperBuilder setGroup(String group) { mBuilder.setGroup(group); return this; } @Override - public ChromeNotificationBuilder setGroupSummary(boolean isGroupSummary) { + public NotificationWrapperBuilder setGroupSummary(boolean isGroupSummary) { mBuilder.setGroupSummary(isGroupSummary); return this; } @Override - public ChromeNotificationBuilder addExtras(Bundle extras) { + public NotificationWrapperBuilder addExtras(Bundle extras) { mBuilder.addExtras(extras); return this; } @Override - public ChromeNotificationBuilder setOngoing(boolean ongoing) { + public NotificationWrapperBuilder setOngoing(boolean ongoing) { mBuilder.setOngoing(ongoing); return this; } @Override - public ChromeNotificationBuilder setVisibility(int visibility) { + public NotificationWrapperBuilder setVisibility(int visibility) { mBuilder.setVisibility(visibility); return this; } @Override - public ChromeNotificationBuilder setShowWhen(boolean showWhen) { + public NotificationWrapperBuilder setShowWhen(boolean showWhen) { mBuilder.setShowWhen(showWhen); return this; } @Override @SuppressWarnings("deprecation") - public ChromeNotificationBuilder addAction(int icon, CharSequence title, PendingIntent intent) { + public NotificationWrapperBuilder addAction( + int icon, CharSequence title, PendingIntent intent) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mBuilder.addAction( new Notification.Action @@ -150,20 +151,20 @@ } @Override - public ChromeNotificationBuilder addAction(int icon, CharSequence title, + public NotificationWrapperBuilder addAction(int icon, CharSequence title, PendingIntentProvider pendingIntentProvider, int actionType) { addAction(icon, title, pendingIntentProvider.getPendingIntent()); return this; } @Override - public ChromeNotificationBuilder addAction(Notification.Action action) { + public NotificationWrapperBuilder addAction(Notification.Action action) { mBuilder.addAction(action); return this; } @Override - public ChromeNotificationBuilder addAction( + public NotificationWrapperBuilder addAction( Notification.Action action, int flags, int actionType) { action.actionIntent = new PendingIntentProvider(action.actionIntent, flags).getPendingIntent(); @@ -172,20 +173,20 @@ } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntent intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntent intent) { mBuilder.setDeleteIntent(intent); return this; } @Override - public ChromeNotificationBuilder setDeleteIntent(PendingIntentProvider intent) { + public NotificationWrapperBuilder setDeleteIntent(PendingIntentProvider intent) { mBuilder.setDeleteIntent(intent.getPendingIntent()); return this; } @Override @SuppressWarnings("deprecation") - public ChromeNotificationBuilder setPriorityBeforeO(int pri) { + public NotificationWrapperBuilder setPriorityBeforeO(int pri) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { mBuilder.setPriority(pri); } @@ -193,20 +194,20 @@ } @Override - public ChromeNotificationBuilder setProgress(int max, int percentage, boolean indeterminate) { + public NotificationWrapperBuilder setProgress(int max, int percentage, boolean indeterminate) { mBuilder.setProgress(max, percentage, indeterminate); return this; } @Override - public ChromeNotificationBuilder setSubText(CharSequence text) { + public NotificationWrapperBuilder setSubText(CharSequence text) { mBuilder.setSubText(text); return this; } @Override @SuppressWarnings("deprecation") - public ChromeNotificationBuilder setContentInfo(String info) { + public NotificationWrapperBuilder setContentInfo(String info) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { mBuilder.setContentInfo(info); } else { @@ -216,50 +217,50 @@ } @Override - public ChromeNotificationBuilder setWhen(long time) { + public NotificationWrapperBuilder setWhen(long time) { mBuilder.setWhen(time); return this; } @Override - public ChromeNotificationBuilder setLargeIcon(Bitmap icon) { + public NotificationWrapperBuilder setLargeIcon(Bitmap icon) { mBuilder.setLargeIcon(icon); return this; } @Override - public ChromeNotificationBuilder setVibrate(long[] vibratePattern) { + public NotificationWrapperBuilder setVibrate(long[] vibratePattern) { mBuilder.setVibrate(vibratePattern); return this; } @Override - public ChromeNotificationBuilder setSound(Uri sound) { + public NotificationWrapperBuilder setSound(Uri sound) { mBuilder.setSound(sound); return this; } @Override - public ChromeNotificationBuilder setDefaults(int defaults) { + public NotificationWrapperBuilder setDefaults(int defaults) { mBuilder.setDefaults(defaults); return this; } @Override - public ChromeNotificationBuilder setOnlyAlertOnce(boolean onlyAlertOnce) { + public NotificationWrapperBuilder setOnlyAlertOnce(boolean onlyAlertOnce) { mBuilder.setOnlyAlertOnce(onlyAlertOnce); return this; } @Override - public ChromeNotificationBuilder setPublicVersion(Notification publicNotification) { + public NotificationWrapperBuilder setPublicVersion(Notification publicNotification) { mBuilder.setPublicVersion(publicNotification); return this; } @Override @SuppressWarnings("deprecation") - public ChromeNotificationBuilder setContent(RemoteViews views) { + public NotificationWrapperBuilder setContent(RemoteViews views) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { mBuilder.setCustomContentView(views); } else { @@ -269,19 +270,19 @@ } @Override - public ChromeNotificationBuilder setStyle(Notification.BigPictureStyle style) { + public NotificationWrapperBuilder setStyle(Notification.BigPictureStyle style) { mBuilder.setStyle(style); return this; } @Override - public ChromeNotificationBuilder setStyle(Notification.BigTextStyle style) { + public NotificationWrapperBuilder setStyle(Notification.BigTextStyle style) { mBuilder.setStyle(style); return this; } @Override - public ChromeNotificationBuilder setMediaStyle(MediaSessionCompat session, int[] actions, + public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, PendingIntent intent, boolean showCancelButton) { Notification.MediaStyle style = new Notification.MediaStyle(); style.setMediaSession(((MediaSession) session.getMediaSession()).getSessionToken()); @@ -291,33 +292,33 @@ } @Override - public ChromeNotificationBuilder setCategory(String category) { + public NotificationWrapperBuilder setCategory(String category) { mBuilder.setCategory(category); return this; } @Override @SuppressWarnings("deprecation") - public ChromeNotification buildWithBigContentView(RemoteViews view) { + public NotificationWrapper buildWithBigContentView(RemoteViews view) { assert mMetadata != null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - return new ChromeNotification( + return new NotificationWrapper( mBuilder.setCustomBigContentView(view).build(), mMetadata); } else { Notification notification = mBuilder.build(); notification.bigContentView = view; - return new ChromeNotification(notification, mMetadata); + return new NotificationWrapper(notification, mMetadata); } } @Override - public ChromeNotification buildWithBigTextStyle(String bigText) { + public NotificationWrapper buildWithBigTextStyle(String bigText) { Notification.BigTextStyle bigTextStyle = new Notification.BigTextStyle(); bigTextStyle.setBuilder(mBuilder); bigTextStyle.bigText(bigText); assert mMetadata != null; - return new ChromeNotification(bigTextStyle.build(), mMetadata); + return new NotificationWrapper(bigTextStyle.build(), mMetadata); } @Override @@ -326,9 +327,9 @@ } @Override - public ChromeNotification buildChromeNotification() { + public NotificationWrapper buildNotificationWrapper() { assert mMetadata != null; - return new ChromeNotification(build(), mMetadata); + return new NotificationWrapper(build(), mMetadata); } protected Notification.Builder getBuilder() {
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd index 969529b..67de3a2 100644 --- a/components/browser_ui/strings/android/browser_ui_strings.grd +++ b/components/browser_ui/strings/android/browser_ui_strings.grd
@@ -587,7 +587,20 @@ <message name="IDS_BOTTOM_BAR_SCREEN_POSITION" desc="Accessibility label to inform users about the InfoBar location"> Options available near bottom of the screen </message> - </messages> + <!-- Warning on sharing info with external apps in incognito mode --> + <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING" desc="Alert dialog text warning the user (who is currently in incognito mode) that the site they are currently using is going to share data with an external application." formatter_data="android_java"> + This site is about to share information with an app outside of incognito mode. + </message> + <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING_TITLE" desc="Title for dialog asking if the user wants to leave incognito mode. [CHAR-LIMIT=32]" formatter_data="android_java"> + Leave incognito mode? + </message> + <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_STAY" desc="Label for the dialog button to stay in incognito mode. [CHAR-LIMIT=20]" formatter_data="android_java"> + Stay + </message> + <message name="IDS_EXTERNAL_APP_LEAVE_INCOGNITO_LEAVE" desc="Label for the dialog button to leave incognito mode. [CHAR-LIMIT=20]" formatter_data="android_java"> + Leave + </message> + </messages> </release> </grit>
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_LEAVE.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_LEAVE.png.sha1 new file mode 100644 index 0000000..303d243 --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_LEAVE.png.sha1
@@ -0,0 +1 @@ +b8efdca4a145257a2f18123938a46ce7c03cd7b8 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_STAY.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_STAY.png.sha1 new file mode 100644 index 0000000..303d243 --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_STAY.png.sha1
@@ -0,0 +1 @@ +b8efdca4a145257a2f18123938a46ce7c03cd7b8 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING.png.sha1 new file mode 100644 index 0000000..303d243 --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING.png.sha1
@@ -0,0 +1 @@ +b8efdca4a145257a2f18123938a46ce7c03cd7b8 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING_TITLE.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING_TITLE.png.sha1 new file mode 100644 index 0000000..303d243 --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_EXTERNAL_APP_LEAVE_INCOGNITO_WARNING_TITLE.png.sha1
@@ -0,0 +1 @@ +b8efdca4a145257a2f18123938a46ce7c03cd7b8 \ No newline at end of file
diff --git a/components/download/internal/common/download_utils.cc b/components/download/internal/common/download_utils.cc index 5a68a5a..ecd6e62 100644 --- a/components/download/internal/common/download_utils.cc +++ b/components/download/internal/common/download_utils.cc
@@ -428,6 +428,7 @@ in_progress_info.metered = item.AllowMetered(); in_progress_info.bytes_wasted = item.GetBytesWasted(); in_progress_info.auto_resume_count = item.GetAutoResumeCount(); + in_progress_info.download_schedule = item.GetDownloadSchedule(); download_info.in_progress_info = in_progress_info;
diff --git a/components/enterprise/BUILD.gn b/components/enterprise/BUILD.gn index 37f6488b..faad9edb 100644 --- a/components/enterprise/BUILD.gn +++ b/components/enterprise/BUILD.gn
@@ -12,6 +12,8 @@ "browser/reporting/browser_report_generator.h", "browser/reporting/policy_info.cc", "browser/reporting/policy_info.h", + "browser/reporting/profile_report_generator.cc", + "browser/reporting/profile_report_generator.h", "browser/reporting/report_request_definition.h", "browser/reporting/report_uploader.cc", "browser/reporting/report_uploader.h",
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator.cc b/components/enterprise/browser/reporting/profile_report_generator.cc similarity index 93% rename from chrome/browser/enterprise/reporting/profile_report_generator.cc rename to components/enterprise/browser/reporting/profile_report_generator.cc index 76e59be..be3fc13 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator.cc +++ b/components/enterprise/browser/reporting/profile_report_generator.cc
@@ -2,13 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/enterprise/reporting/profile_report_generator.h" +#include "components/enterprise/browser/reporting/profile_report_generator.h" #include <utility> #include "base/files/file_path.h" -#include "base/strings/utf_string_conversions.h" -#include "base/util/values/values_util.h" #include "components/enterprise/browser/reporting/policy_info.h" #include "components/policy/core/browser/policy_conversions.h"
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator.h b/components/enterprise/browser/reporting/profile_report_generator.h similarity index 92% rename from chrome/browser/enterprise/reporting/profile_report_generator.h rename to components/enterprise/browser/reporting/profile_report_generator.h index aac6968..d473783c 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator.h +++ b/components/enterprise/browser/reporting/profile_report_generator.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_ENTERPRISE_REPORTING_PROFILE_REPORT_GENERATOR_H_ -#define CHROME_BROWSER_ENTERPRISE_REPORTING_PROFILE_REPORT_GENERATOR_H_ +#ifndef COMPONENTS_ENTERPRISE_BROWSER_REPORTING_PROFILE_REPORT_GENERATOR_H_ +#define COMPONENTS_ENTERPRISE_BROWSER_REPORTING_PROFILE_REPORT_GENERATOR_H_ #include <memory> #include <string> @@ -94,4 +94,4 @@ } // namespace enterprise_reporting -#endif // CHROME_BROWSER_ENTERPRISE_REPORTING_PROFILE_REPORT_GENERATOR_H_ +#endif // COMPONENTS_ENTERPRISE_BROWSER_REPORTING_PROFILE_REPORT_GENERATOR_H_
diff --git a/components/external_intents/android/BUILD.gn b/components/external_intents/android/BUILD.gn index f0688b0..14acad8 100644 --- a/components/external_intents/android/BUILD.gn +++ b/components/external_intents/android/BUILD.gn
@@ -27,6 +27,7 @@ "//content/public/android:content_java", "//services/network/public/mojom:mojom_java", "//third_party/android_deps:androidx_annotation_annotation_java", + "//third_party/android_deps:androidx_appcompat_appcompat_java", "//ui/android:ui_java", "//url:gurl_java", "//url:origin_java", @@ -36,7 +37,10 @@ android_resources("java_resources") { sources = [] custom_package = "org.chromium.components.external_intents" - deps = [ "//components/browser_ui/strings/android:browser_ui_strings_grd" ] + deps = [ + "//components/browser_ui/strings/android:browser_ui_strings_grd", + "//components/browser_ui/styles/android:java_resources", + ] } generate_jni("jni_headers") {
diff --git a/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java index 97f2e0b..5e24dfd9 100644 --- a/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java +++ b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationDelegate.java
@@ -95,22 +95,6 @@ int maybeHandleStartActivityIfNeeded(Intent intent, boolean proxy); /** - * Display a dialog warning the user that they may be leaving this app by starting this - * intent. Give the user the opportunity to cancel the action. And if it is canceled, a - * navigation will happen in this app. Catches BadTokenExceptions caused by showing the dialog - * on certain devices. (crbug.com/782602) - * @param intent The intent for external application that will be sent. - * @param referrerUrl The referrer for the current navigation. - * @param fallbackUrl The URL to load if the user doesn't proceed with external intent. - * @param needsToCloseTab Whether the current tab has to be closed after the intent is sent. - * @param proxy Whether we need to proxy the intent through AuthenticatedProxyActivity (this is - * used by Instant Apps intents. - * @return True if the function returned error free, false if it threw an exception. - */ - boolean startIncognitoIntent(Intent intent, String referrerUrl, String fallbackUrl, - boolean needsToCloseTab, boolean proxy); - - /** * Handle the incognito intent by loading it as a URL in the embedder, using the fallbackUrl if * the intent URL cannot be handled by the embedder. * @param intent The intent to be handled by the embedder. @@ -186,6 +170,15 @@ boolean hasValidTab(); /** + * @return Whether it's possible to close the current tab on launching on an incognito intent. + * TODO(blundell): Investigate whether it would be feasible to change the //chrome + * implementation of this method to be identical to that of its implementation of + * ExternalNavigationDelegate#hasValidTab() and then eliminate this method in favor of + * ExternalNavigationHandler calling hasValidTab() if so. + */ + boolean canCloseTabOnIncognitoIntentLaunch(); + + /** * @return whether this delegate supports creation of new tabs. If this method returns false, * all URLs loaded by ExternalNavigationHandler will be loaded in the current tab and * loadUrlInNewTab() will never be invoked.
diff --git a/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java index ac3f8699..da96ce6 100644 --- a/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java +++ b/components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java
@@ -9,6 +9,9 @@ import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; +import android.content.DialogInterface; +import android.content.DialogInterface.OnCancelListener; +import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; @@ -22,6 +25,7 @@ import android.provider.Telephony; import android.text.TextUtils; import android.util.Pair; +import android.view.WindowManager.BadTokenException; import android.webkit.MimeTypeMap; import android.webkit.WebView; @@ -49,6 +53,7 @@ import org.chromium.content_public.common.ContentUrlConstants; import org.chromium.content_public.common.Referrer; import org.chromium.network.mojom.ReferrerPolicy; +import org.chromium.ui.UiUtils; import org.chromium.ui.base.PageTransition; import org.chromium.ui.base.PermissionCallback; import org.chromium.url.URI; @@ -948,8 +953,7 @@ boolean shouldProxyForInstantApps) { // This intent may leave this app. Warn the user that incognito does not carry over // to external apps. - if (mDelegate.startIncognitoIntent(targetIntent, params.getReferrerUrl(), - browserFallbackUrl, + if (startIncognitoIntent(targetIntent, params.getReferrerUrl(), browserFallbackUrl, params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(), shouldProxyForInstantApps)) { if (DEBUG) Log.i(TAG, "Incognito navigation out"); @@ -960,6 +964,81 @@ } /** + * Display a dialog warning the user that they may be leaving this app by starting this + * intent. Give the user the opportunity to cancel the action. And if it is canceled, a + * navigation will happen in this app. Catches BadTokenExceptions caused by showing the dialog + * on certain devices. (crbug.com/782602) + * @param intent The intent for external application that will be sent. + * @param referrerUrl The referrer for the current navigation. + * @param fallbackUrl The URL to load if the user doesn't proceed with external intent. + * @param needsToCloseTab Whether the current tab has to be closed after the intent is sent. + * @param proxy Whether we need to proxy the intent through AuthenticatedProxyActivity (this is + * used by Instant Apps intents. + * @return True if the function returned error free, false if it threw an exception. + */ + private boolean startIncognitoIntent(final Intent intent, final String referrerUrl, + final String fallbackUrl, final boolean needsToCloseTab, final boolean proxy) { + try { + return startIncognitoIntentInternal( + intent, referrerUrl, fallbackUrl, needsToCloseTab, proxy); + } catch (BadTokenException e) { + return false; + } + } + + /** + * Internal implementation of startIncognitoIntent(), with all the same parameters. + */ + @VisibleForTesting + protected boolean startIncognitoIntentInternal(final Intent intent, final String referrerUrl, + final String fallbackUrl, final boolean needsToCloseTab, final boolean proxy) { + if (!mDelegate.hasValidTab()) return false; + Context context = mDelegate.getContext(); + if (ContextUtils.activityFromContext(context) == null) return false; + + new UiUtils.CompatibleAlertDialogBuilder(context, R.style.Theme_Chromium_AlertDialog) + .setTitle(R.string.external_app_leave_incognito_warning_title) + .setMessage(R.string.external_app_leave_incognito_warning) + .setPositiveButton(R.string.external_app_leave_incognito_leave, + new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + try { + startActivity(intent, proxy, mDelegate); + if (mDelegate.canCloseTabOnIncognitoIntentLaunch() + && needsToCloseTab) { + mDelegate.closeTab(); + } + } catch (ActivityNotFoundException e) { + // The activity that we thought was going to handle the intent + // no longer exists, so catch the exception and assume Chrome + // can handle it. + loadUrlFromIntent(referrerUrl, fallbackUrl, + intent.getDataString(), mDelegate, needsToCloseTab, + true); + } + } + }) + .setNegativeButton(R.string.external_app_leave_incognito_stay, + new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + loadUrlFromIntent(referrerUrl, fallbackUrl, intent.getDataString(), + mDelegate, needsToCloseTab, true); + } + }) + .setOnCancelListener(new OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + loadUrlFromIntent(referrerUrl, fallbackUrl, intent.getDataString(), + mDelegate, needsToCloseTab, true); + } + }) + .show(); + return true; + } + + /** * If some third-party app launched this app with an intent, and the URL got redirected, and the * user explicitly chose this app over other intent handlers, stay in the app unless there was a * new intent handler after redirection or the app cannot handle it internally any more. @@ -1240,7 +1319,7 @@ } if (params.isIncognito()) { - if (!mDelegate.startIncognitoIntent(intent, params.getReferrerUrl(), null, + if (!startIncognitoIntent(intent, params.getReferrerUrl(), null, params.shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent(), false)) { if (DEBUG) Log.i(TAG, "Failed to show incognito alert dialog.");
diff --git a/components/external_intents/android/javatests/src/org/chromium/components/external_intents/ExternalNavigationHandlerTest.java b/components/external_intents/android/javatests/src/org/chromium/components/external_intents/ExternalNavigationHandlerTest.java index a96e9e6e..84f1bad 100644 --- a/components/external_intents/android/javatests/src/org/chromium/components/external_intents/ExternalNavigationHandlerTest.java +++ b/components/external_intents/android/javatests/src/org/chromium/components/external_intents/ExternalNavigationHandlerTest.java
@@ -1084,7 +1084,7 @@ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION, START_INCOGNITO | START_OTHER_ACTIVITY); - Intent invokedIntent = mDelegate.startActivityIntent; + Intent invokedIntent = mUrlHandler.mStartActivityInIncognitoIntent; Assert.assertTrue(invokedIntent.getData().toString().startsWith("market://")); Assert.assertEquals(null, mUrlHandler.mNewUrlAfterClobbering); Assert.assertEquals(null, mUrlHandler.mReferrerUrlForClobbering); @@ -1602,7 +1602,7 @@ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION, START_INCOGNITO | START_OTHER_ACTIVITY); - Assert.assertTrue(mDelegate.startIncognitoIntentCalled); + Assert.assertTrue(mUrlHandler.mStartIncognitoIntentCalled); } @Test @@ -1613,7 +1613,7 @@ .withIsIncognito(true) .expecting(OverrideUrlLoadingResult.NO_OVERRIDE, IGNORE); - Assert.assertFalse(mDelegate.startIncognitoIntentCalled); + Assert.assertFalse(mUrlHandler.mStartIncognitoIntentCalled); } @Test @@ -1628,7 +1628,7 @@ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, START_OTHER_ACTIVITY); Assert.assertTrue(mDelegate.maybeSetRequestMetadataCalled); - Assert.assertFalse(mDelegate.startIncognitoIntentCalled); + Assert.assertFalse(mUrlHandler.mStartIncognitoIntentCalled); } @Test @@ -1644,7 +1644,7 @@ .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION, START_INCOGNITO | START_OTHER_ACTIVITY); Assert.assertTrue(mDelegate.maybeSetRequestMetadataCalled); - Assert.assertTrue(mDelegate.startIncognitoIntentCalled); + Assert.assertTrue(mUrlHandler.mStartIncognitoIntentCalled); } @Test @@ -1981,6 +1981,8 @@ public String mNewUrlAfterClobbering; public String mReferrerUrlForClobbering; public boolean mStartFileIntentCalled; + public Intent mStartActivityInIncognitoIntent; + public boolean mStartIncognitoIntentCalled; public ExternalNavigationHandlerForTesting(ExternalNavigationDelegate delegate) { super(delegate); @@ -1992,6 +1994,14 @@ } @Override + protected boolean startIncognitoIntentInternal(Intent intent, String referrerUrl, + String fallbackUrl, boolean needsToCloseTab, boolean proxy) { + mStartActivityInIncognitoIntent = intent; + mStartIncognitoIntentCalled = true; + return true; + } + + @Override protected String getDefaultSmsPackageNameFromSystem() { return defaultSmsPackageName; } @@ -2100,14 +2110,6 @@ } @Override - public boolean startIncognitoIntent(Intent intent, String referrerUrl, String fallbackUrl, - boolean needsToCloseTab, boolean proxy) { - startActivityIntent = intent; - startIncognitoIntentCalled = true; - return true; - } - - @Override public @OverrideUrlLoadingResult int handleIncognitoIntentTargetingSelf( Intent intent, String referrerUrl, String fallbackUrl) { handleIncognitoIntentTargetingSelfCalled = true; @@ -2194,6 +2196,11 @@ } @Override + public boolean canCloseTabOnIncognitoIntentLaunch() { + return false; + } + + @Override public boolean isIntentForTrustedCallingApp(Intent intent) { return mIsCallingAppTrusted; } @@ -2414,26 +2421,32 @@ int result = mUrlHandler.shouldOverrideUrlLoading(params); boolean startActivityCalled = false; boolean startWebApkCalled = false; - if (mDelegate.startActivityIntent != null) { + + // Incognito intent launching gets caught by the test URL handler, whereas non-incgonito + // intent launching gets caught by the test delegate. + Intent startActivityIntent = expectStartIncognito + ? mUrlHandler.mStartActivityInIncognitoIntent + : mDelegate.startActivityIntent; + + if (startActivityIntent != null) { startActivityCalled = true; - String packageName = mDelegate.startActivityIntent.getPackage(); + String packageName = startActivityIntent.getPackage(); if (packageName != null) { startWebApkCalled = packageName.startsWith(WEBAPK_PACKAGE_PREFIX); } } Assert.assertEquals(expectedOverrideResult, result); - Assert.assertEquals(expectStartIncognito, mDelegate.startIncognitoIntentCalled); + Assert.assertEquals(expectStartIncognito, mUrlHandler.mStartIncognitoIntentCalled); Assert.assertEquals(expectStartActivity, startActivityCalled); Assert.assertEquals(expectStartWebApk, startWebApkCalled); Assert.assertEquals(expectStartFile, mUrlHandler.mStartFileIntentCalled); Assert.assertEquals(expectProxyForIA, mDelegate.mCalledWithProxy); if (startActivityCalled && expectSaneIntent) { - checkIntentSanity(mDelegate.startActivityIntent, "Intent"); - if (mDelegate.startActivityIntent.getSelector() != null) { - checkIntentSanity( - mDelegate.startActivityIntent.getSelector(), "Intent's selector"); + checkIntentSanity(startActivityIntent, "Intent"); + if (startActivityIntent.getSelector() != null) { + checkIntentSanity(startActivityIntent.getSelector(), "Intent's selector"); } } }
diff --git a/components/mirroring/service/BUILD.gn b/components/mirroring/service/BUILD.gn index 1cec42d..f81ff53 100644 --- a/components/mirroring/service/BUILD.gn +++ b/components/mirroring/service/BUILD.gn
@@ -40,6 +40,8 @@ deps = [ "//components/mirroring/mojom:service", + "//components/openscreen_platform", + "//components/openscreen_platform:openscreen_platform_network_service", "//components/version_info", "//crypto", "//gpu/config", @@ -60,10 +62,13 @@ "//services/network/public/cpp", "//services/network/public/mojom", "//services/viz/public/cpp/gpu", + "//third_party/jsoncpp", + "//third_party/openscreen/src/cast/streaming:common", "//ui/base", "//ui/gfx", ] + include_dirs = [ "//third_party/openscreen/src" ] defines = [ "IS_MIRRORING_SERVICE_IMPL" ] } @@ -92,6 +97,8 @@ "//base", "//base/test:test_support", "//components/mirroring/mojom:service", + "//components/openscreen_platform", + "//components/openscreen_platform:openscreen_platform_network_service", "//media", "//media/capture/mojom:video_capture", "//media/cast:common", @@ -107,5 +114,8 @@ "//services/viz/public/cpp/gpu", "//testing/gmock", "//testing/gtest", + "//third_party/openscreen/src/cast/streaming:common", ] + + include_dirs = [ "//third_party/openscreen/src" ] }
diff --git a/components/mirroring/service/DEPS b/components/mirroring/service/DEPS index 07a4900..f7c98091 100644 --- a/components/mirroring/service/DEPS +++ b/components/mirroring/service/DEPS
@@ -6,9 +6,11 @@ "+crypto", "+gpu/config", "+gpu/ipc/client", + "+third_party/jsoncpp/source/include/json", "+net", "+services/network/public", "+services/network/test", "+services/viz/public", + "+third_party/openscreen/src/cast/streaming", "+ui/base", ]
diff --git a/components/mirroring/service/media_remoter.cc b/components/mirroring/service/media_remoter.cc index ee28058..7216624 100644 --- a/components/mirroring/service/media_remoter.cc +++ b/components/mirroring/service/media_remoter.cc
@@ -47,9 +47,9 @@ } void MediaRemoter::OnMessageFromSink(const ReceiverResponse& response) { - DCHECK_EQ(ResponseType::RPC, response.type); + DCHECK_EQ(ResponseType::RPC, response.type()); remoting_source_->OnMessageFromSink( - std::vector<uint8_t>(response.rpc.begin(), response.rpc.end())); + std::vector<uint8_t>(response.rpc().begin(), response.rpc().end())); } void MediaRemoter::StartRpcMessaging(
diff --git a/components/mirroring/service/media_remoter.h b/components/mirroring/service/media_remoter.h index 583456ef..950fd1cd 100644 --- a/components/mirroring/service/media_remoter.h +++ b/components/mirroring/service/media_remoter.h
@@ -23,7 +23,7 @@ namespace mirroring { class MessageDispatcher; -struct ReceiverResponse; +class ReceiverResponse; class RemotingSender; // MediaRemoter remotes media content directly to a Cast Receiver. When
diff --git a/components/mirroring/service/message_dispatcher.cc b/components/mirroring/service/message_dispatcher.cc index 190e5423..849a9d65 100644 --- a/components/mirroring/service/message_dispatcher.cc +++ b/components/mirroring/service/message_dispatcher.cc
@@ -36,7 +36,7 @@ // Send |response| if the sequence number matches, or if the request times // out, in which case the |response| is UNKNOWN type. void SendResponse(const ReceiverResponse& response) { - if (!timer_.IsRunning() || response.sequence_number == sequence_number_) + if (!timer_.IsRunning() || response.sequence_number() == sequence_number_) std::move(response_callback_).Run(response); // Ignore the response with mismatched sequence number. } @@ -78,27 +78,27 @@ if (message->json_format_data.empty()) return; // Ignore null message. - ReceiverResponse response; - if (!response.Parse(message->json_format_data)) { + auto response = ReceiverResponse::Parse(message->json_format_data); + if (!response) { error_callback_.Run("Response parsing error. message=" + message->json_format_data); return; } #if DCHECK_IS_ON() - if (response.type == ResponseType::RPC) + if (response->type() == ResponseType::RPC) DCHECK_EQ(mojom::kRemotingNamespace, message->message_namespace); else DCHECK_EQ(mojom::kWebRtcNamespace, message->message_namespace); #endif // DCHECK_IS_ON() - const auto callback_iter = callback_map_.find(response.type); + const auto callback_iter = callback_map_.find(response->type()); if (callback_iter == callback_map_.end()) { error_callback_.Run("No callback subscribed. message=" + message->json_format_data); return; } - callback_iter->second.Run(response); + callback_iter->second.Run(*response); } void MessageDispatcher::Subscribe(ResponseType type,
diff --git a/components/mirroring/service/message_dispatcher_unittest.cc b/components/mirroring/service/message_dispatcher_unittest.cc index e43d458..1f01b8ba8 100644 --- a/components/mirroring/service/message_dispatcher_unittest.cc +++ b/components/mirroring/service/message_dispatcher_unittest.cc
@@ -9,6 +9,8 @@ #include "base/callback.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" #include "base/test/mock_callback.h" #include "base/test/task_environment.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -16,7 +18,6 @@ #include "mojo/public/cpp/bindings/remote.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" - using ::testing::InvokeWithoutArgs; using ::testing::_; using mirroring::mojom::CastMessage; @@ -26,35 +27,22 @@ namespace { +constexpr char kValidAnswerResponse[] = R"( + { "type": "ANSWER", + "seqNum": 12345, + "result": "ok", + "answer":{ + "udpPort": 50691, + "sendIndexes": [1, 2], + "ssrcs": [3, 4] + } + })"; + bool IsEqual(const CastMessage& message1, const CastMessage& message2) { return message1.message_namespace == message2.message_namespace && message1.json_format_data == message2.json_format_data; } -void CloneResponse(const ReceiverResponse& response, - ReceiverResponse* cloned_response) { - cloned_response->type = response.type; - cloned_response->session_id = response.session_id; - cloned_response->sequence_number = response.sequence_number; - cloned_response->result = response.result; - if (response.answer) - cloned_response->answer = std::make_unique<Answer>(*response.answer); - if (response.status) - cloned_response->status = - std::make_unique<ReceiverStatus>(*response.status); - if (response.capabilities) { - cloned_response->capabilities = - std::make_unique<ReceiverCapability>(*response.capabilities); - } - cloned_response->rpc = response.rpc; - if (response.error) { - cloned_response->error = std::make_unique<ReceiverError>(); - cloned_response->error->code = response.error->code; - cloned_response->error->description = response.error->description; - cloned_response->error->details = response.error->details; - } -} - } // namespace class MessageDispatcherTest : public mojom::CastMessageChannel, @@ -84,15 +72,11 @@ } void OnAnswerResponse(const ReceiverResponse& response) { - if (!last_answer_response_) - last_answer_response_ = std::make_unique<ReceiverResponse>(); - CloneResponse(response, last_answer_response_.get()); + last_answer_response_ = response.CloneForTesting(); } void OnStatusResponse(const ReceiverResponse& response) { - if (!last_status_response_) - last_status_response_ = std::make_unique<ReceiverResponse>(); - CloneResponse(response, last_status_response_.get()); + last_status_response_ = response.CloneForTesting(); } protected: @@ -139,20 +123,16 @@ TEST_F(MessageDispatcherTest, DispatchMessageToSubscriber) { // Simulate a receiver ANSWER response and expect that just the ANSWER // subscriber processes the message. - const std::string answer_response = - "{\"type\":\"ANSWER\",\"seqNum\":12345,\"result\":\"ok\"," - "\"answer\":{\"udpPort\":50691}}"; const CastMessage answer_message = - CastMessage{mojom::kWebRtcNamespace, answer_response}; + CastMessage{mojom::kWebRtcNamespace, kValidAnswerResponse}; SendInboundMessage(answer_message); task_environment_.RunUntilIdle(); ASSERT_TRUE(last_answer_response_); EXPECT_FALSE(last_status_response_); - EXPECT_EQ(12345, last_answer_response_->sequence_number); - EXPECT_EQ(ResponseType::ANSWER, last_answer_response_->type); - EXPECT_EQ("ok", last_answer_response_->result); - EXPECT_EQ(50691, last_answer_response_->answer->udp_port); - EXPECT_FALSE(last_answer_response_->status); + EXPECT_EQ(12345, last_answer_response_->sequence_number()); + EXPECT_EQ(ResponseType::ANSWER, last_answer_response_->type()); + ASSERT_TRUE(last_answer_response_->valid()); + EXPECT_EQ(50691, last_answer_response_->answer().udp_port); last_answer_response_.reset(); EXPECT_TRUE(last_error_message_.empty()); @@ -167,10 +147,10 @@ task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); ASSERT_TRUE(last_status_response_); - EXPECT_EQ(12345, last_status_response_->sequence_number); - EXPECT_EQ(ResponseType::STATUS_RESPONSE, last_status_response_->type); - EXPECT_EQ("ok", last_status_response_->result); - EXPECT_EQ(42, last_status_response_->status->wifi_snr); + EXPECT_EQ(12345, last_status_response_->sequence_number()); + EXPECT_EQ(ResponseType::STATUS_RESPONSE, last_status_response_->type()); + ASSERT_TRUE(last_status_response_->valid()); + EXPECT_EQ(42, last_status_response_->status().wifi_snr); last_status_response_.reset(); EXPECT_TRUE(last_error_message_.empty()); @@ -220,11 +200,8 @@ } TEST_F(MessageDispatcherTest, IgnoreMessageWithWrongNamespace) { - const std::string answer_response = - "{\"type\":\"ANSWER\",\"seqNum\":12345,\"result\":\"ok\"," - "\"answer\":{\"udpPort\":50691}}"; const CastMessage answer_message = - CastMessage{"Wrong_namespace", answer_response}; + CastMessage{"Wrong_namespace", kValidAnswerResponse}; SendInboundMessage(answer_message); task_environment_.RunUntilIdle(); EXPECT_FALSE(last_answer_response_); @@ -250,31 +227,37 @@ // Received the request to send the outbound message. EXPECT_TRUE(IsEqual(offer_message, last_outbound_message_)); - std::string answer_response = - "{\"type\":\"ANSWER\",\"seqNum\":12345,\"result\":\"ok\"," - "\"answer\":{\"udpPort\":50691}}"; - CastMessage answer_message = - CastMessage{mojom::kWebRtcNamespace, answer_response}; - SendInboundMessage(answer_message); + const CastMessage wrong_answer_message{mojom::kWebRtcNamespace, + kValidAnswerResponse}; + SendInboundMessage(wrong_answer_message); task_environment_.RunUntilIdle(); // The answer message with mismatched sequence number is ignored. EXPECT_FALSE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_TRUE(last_error_message_.empty()); - answer_response = - "{\"type\":\"ANSWER\",\"seqNum\":45623,\"result\":\"ok\"," - "\"answer\":{\"udpPort\":50691}}"; - answer_message = CastMessage{mojom::kWebRtcNamespace, answer_response}; + constexpr char kAnswerWithCorrectSeqNum[] = R"( + { "type": "ANSWER", + "seqNum": 45623, + "result": "ok", + "answer":{ + "udpPort": 50691, + "sendIndexes": [1, 2], + "ssrcs": [3, 4] + } + })"; + + const CastMessage answer_message{mojom::kWebRtcNamespace, + kAnswerWithCorrectSeqNum}; SendInboundMessage(answer_message); task_environment_.RunUntilIdle(); ASSERT_TRUE(last_answer_response_); EXPECT_FALSE(last_status_response_); EXPECT_TRUE(last_error_message_.empty()); - EXPECT_EQ(45623, last_answer_response_->sequence_number); - EXPECT_EQ(ResponseType::ANSWER, last_answer_response_->type); - EXPECT_EQ("ok", last_answer_response_->result); - EXPECT_EQ(50691, last_answer_response_->answer->udp_port); + EXPECT_EQ(45623, last_answer_response_->sequence_number()); + EXPECT_EQ(ResponseType::ANSWER, last_answer_response_->type()); + ASSERT_TRUE(last_answer_response_->valid()); + EXPECT_EQ(50691, last_answer_response_->answer().udp_port); last_answer_response_.reset(); // Expect that the callback for ANSWER message was already unsubscribed.
diff --git a/components/mirroring/service/mirror_settings.cc b/components/mirroring/service/mirror_settings.cc index ca9874d1..4e0b361 100644 --- a/components/mirroring/service/mirror_settings.cc +++ b/components/mirroring/service/mirror_settings.cc
@@ -131,6 +131,10 @@ max_height_ = std::max(max_height, min_height_); } +void MirrorSettings::SetSenderSideLetterboxingEnabled(bool enabled) { + enable_sender_side_letterboxing_ = enabled; +} + media::VideoCaptureParams MirrorSettings::GetVideoCaptureParams() { media::VideoCaptureParams params; params.requested_format =
diff --git a/components/mirroring/service/mirror_settings.h b/components/mirroring/service/mirror_settings.h index de56459..4ac440f 100644 --- a/components/mirroring/service/mirror_settings.h +++ b/components/mirroring/service/mirror_settings.h
@@ -37,6 +37,7 @@ // Call to override the default resolution settings. void SetResolutionConstraints(int max_width, int max_height); + void SetSenderSideLetterboxingEnabled(bool enabled); // Get video capture constraints with the current settings. media::VideoCaptureParams GetVideoCaptureParams(); @@ -52,10 +53,6 @@ const int min_height_; int max_width_; int max_height_; - - // TODO(crbug.com/1002603, issuetracker.google.com/issues/158032164): provide - // this field from the aspect ratio constraint in libcast's OFFER/ANSWER - // exchange. bool enable_sender_side_letterboxing_ = true; DISALLOW_COPY_AND_ASSIGN(MirrorSettings);
diff --git a/components/mirroring/service/receiver_response.cc b/components/mirroring/service/receiver_response.cc index 6e15a03..aec89a2 100644 --- a/components/mirroring/service/receiver_response.cc +++ b/components/mirroring/service/receiver_response.cc
@@ -5,18 +5,19 @@ #include "components/mirroring/service/receiver_response.h" #include "base/base64.h" -#include "base/json/json_reader.h" -#include "base/json/json_writer.h" +#include "base/bind.h" +#include "base/callback.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "components/mirroring/service/value_util.h" +#include "third_party/jsoncpp/source/include/json/reader.h" +#include "third_party/jsoncpp/source/include/json/writer.h" namespace mirroring { - namespace { // Get the response type from the type string value in the JSON message. -ResponseType GetResponseType(const std::string& type) { +ResponseType ResponseTypeFromString(const std::string& type) { if (type == "ANSWER") return ResponseType::ANSWER; if (type == "STATUS_RESPONSE") @@ -25,176 +26,314 @@ return ResponseType::CAPABILITIES_RESPONSE; if (type == "RPC") return ResponseType::RPC; + return ResponseType::UNKNOWN; } +// JSON helper methods. Note that these are *heavily* based on the +// util/json_helpers.h methods from Open Screen. When the mirroring service +// moves to depend on libcast, the duplicate code should pretty much all go +// away. +bool GetInt(const Json::Value& value, int* out) { + // We are generally very forgiving of missing fields, so don't return an + // error if it is just missing. + if (!value) { + *out = -1; + return true; + } + // If it's present, though, it must be valid. + if (!value.isInt()) { + return false; + } + const int i = value.asInt(); + if (i < 0) { + return false; + } + *out = i; + return true; +} + +bool GetDouble(const Json::Value& value, double* out) { + if (!value) { + *out = 0.0; + return true; + } + if (!value.isDouble()) { + return false; + } + const double i = value.asDouble(); + if (i < 0) { + return false; + } + *out = i; + return true; +} + +bool GetString(const Json::Value& value, std::string* out) { + if (!value) { + *out = {}; + return true; + } + if (!value.isString()) { + return false; + } + *out = value.asString(); + return true; +} + +template <typename T> +using Parser = base::RepeatingCallback<bool(const Json::Value&, T*)>; + +// Returns whether or not an error occurred. For the purpose of this function, +// if the value is empty or not an array, that is not an error, and it thus +// returns true after setting the |out| vector to empty. +template <typename T> +bool GetArray(const Json::Value& value, Parser<T> parser, std::vector<T>* out) { + out->clear(); + if (!value.isArray() || value.empty()) { + return true; + } + + out->reserve(value.size()); + for (auto i : value) { + T v; + if (!parser.Run(i, &v)) { + out->clear(); + return false; + } + out->push_back(std::move(v)); + } + + return true; +} + +bool GetIntArray(const Json::Value& value, std::vector<int>* out) { + return GetArray<int>(value, base::BindRepeating(&GetInt), out); +} + +bool GetStringArray(const Json::Value& value, std::vector<std::string>* out) { + return GetArray<std::string>(value, base::BindRepeating(&GetString), out); +} + +ResponseType GetResponseType(const Json::Value& root_node) { + std::string type; + if (!GetString(root_node["type"], &type)) { + return ResponseType::UNKNOWN; + } + + return ResponseTypeFromString(base::ToUpperASCII(type)); +} + +std::string GetDetails(const Json::Value& value) { + if (!value) { + return {}; + } + + Json::StreamWriterBuilder builder; + return Json::writeString(builder, value); +} + +std::unique_ptr<ReceiverError> ParseError(const Json::Value& value) { + auto error = std::make_unique<ReceiverError>(); + + if (!GetInt(value["code"], &(error->code)) || + !GetString(value["description"], &(error->description))) { + return {}; + } + + // We are generally pretty forgiving about details: throwing an error + // because the Receiver didn't properly fill out the detail of an error + // message doesn't really make sense. + error->details = GetDetails(value["details"]); + return error; +} + +std::unique_ptr<ReceiverCapability> ParseCapability(const Json::Value& value) { + auto capability = std::make_unique<ReceiverCapability>(); + if (!value || + !GetStringArray(value["mediaCaps"], &(capability->media_caps))) { + return {}; + } + return capability; +} + +std::unique_ptr<ReceiverStatus> ParseStatus(const Json::Value& value) { + auto status = std::make_unique<ReceiverStatus>(); + if (!GetDouble(value["wifiSnr"], &(status->wifi_snr)) || + !GetIntArray(value["wifiSpeed"], &(status->wifi_speed))) { + return {}; + } + return status; +} + } // namespace -Answer::Answer() - : udp_port(-1), supports_get_status(false), cast_mode("mirroring") {} - -Answer::~Answer() {} - -Answer::Answer(const Answer& answer) = default; - -bool Answer::Parse(const base::Value& raw_value) { - return (raw_value.is_dict() && GetInt(raw_value, "udpPort", &udp_port) && - GetIntArray(raw_value, "ssrcs", &ssrcs) && - GetIntArray(raw_value, "sendIndexes", &send_indexes) && - GetString(raw_value, "IV", &iv) && - GetBool(raw_value, "receiverGetStatus", &supports_get_status) && - GetString(raw_value, "castMode", &cast_mode)); -} - -// ---------------------------------------------------------------------------- - -ReceiverStatus::ReceiverStatus() : wifi_snr(0) {} - -ReceiverStatus::~ReceiverStatus() {} - -ReceiverStatus::ReceiverStatus(const ReceiverStatus& status) = default; - -bool ReceiverStatus::Parse(const base::Value& raw_value) { - return (raw_value.is_dict() && GetDouble(raw_value, "wifiSnr", &wifi_snr) && - GetIntArray(raw_value, "wifiSpeed", &wifi_speed)); -} - -// ---------------------------------------------------------------------------- - -ReceiverKeySystem::ReceiverKeySystem() {} - -ReceiverKeySystem::~ReceiverKeySystem() {} - -ReceiverKeySystem::ReceiverKeySystem( - const ReceiverKeySystem& receiver_key_system) = default; - -bool ReceiverKeySystem::Parse(const base::Value& raw_value) { - return (raw_value.is_dict() && GetString(raw_value, "keySystemName", &name) && - GetStringArray(raw_value, "initDataTypes", &init_data_types) && - GetStringArray(raw_value, "codecs", &codecs) && - GetStringArray(raw_value, "secureCodecs", &secure_codecs) && - GetStringArray(raw_value, "audioRobustness", &audio_robustness) && - GetStringArray(raw_value, "videoRobustness", &video_robustness) && - GetString(raw_value, "persistentLicenseSessionSupport", - &persistent_license_session_support) && - GetString(raw_value, "persistentReleaseMessageSessionSupport", - &persistent_release_message_session_support) && - GetString(raw_value, "persistentStateSupport", - &persistent_state_support) && - GetString(raw_value, "distinctiveIdentifierSupport", - &distinctive_identifier_support)); -} - -// ---------------------------------------------------------------------------- - -ReceiverCapability::ReceiverCapability() {} - -ReceiverCapability::~ReceiverCapability() {} - -ReceiverCapability::ReceiverCapability(const ReceiverCapability& capabilities) = +ReceiverStatus::ReceiverStatus() = default; +ReceiverStatus::~ReceiverStatus() = default; +ReceiverStatus::ReceiverStatus(ReceiverStatus&& receiver_response) = default; +ReceiverStatus::ReceiverStatus(const ReceiverStatus& receiver_response) = default; +ReceiverStatus& ReceiverStatus::operator=(ReceiverStatus&& receiver_response) = + default; +ReceiverStatus& ReceiverStatus::operator=( + const ReceiverStatus& receiver_response) = default; -bool ReceiverCapability::Parse(const base::Value& raw_value) { - if (!raw_value.is_dict() || - !GetStringArray(raw_value, "mediaCaps", &media_caps)) - return false; - auto* found = raw_value.FindKey("keySystems"); - if (!found) - return true; - for (const auto& key_system_value : found->GetList()) { - ReceiverKeySystem key_system; - if (!key_system.Parse(key_system_value)) - return false; - key_systems.emplace_back(key_system); - } - return true; -} +ReceiverCapability::ReceiverCapability() = default; +ReceiverCapability::~ReceiverCapability() = default; +ReceiverCapability::ReceiverCapability(ReceiverCapability&& receiver_response) = + default; +ReceiverCapability::ReceiverCapability( + const ReceiverCapability& receiver_response) = default; +ReceiverCapability& ReceiverCapability::operator=( + ReceiverCapability&& receiver_response) = default; +ReceiverCapability& ReceiverCapability::operator=( + const ReceiverCapability& receiver_response) = default; -// ---------------------------------------------------------------------------- +ReceiverError::ReceiverError() = default; +ReceiverError::~ReceiverError() = default; +ReceiverError::ReceiverError(ReceiverError&& receiver_response) = default; +ReceiverError::ReceiverError(const ReceiverError& receiver_response) = default; +ReceiverError& ReceiverError::operator=(ReceiverError&& receiver_response) = + default; +ReceiverError& ReceiverError::operator=( + const ReceiverError& receiver_response) = default; -ReceiverError::ReceiverError() : code(-1) {} - -ReceiverError::~ReceiverError() {} - -bool ReceiverError::Parse(const base::Value& raw_value) { - if (!raw_value.is_dict() || !GetInt(raw_value, "code", &code) || - !GetString(raw_value, "description", &description)) - return false; - auto* found = raw_value.FindKey("details"); - return found && base::JSONWriter::Write(*found, &details); -} - -// ---------------------------------------------------------------------------- - -ReceiverResponse::ReceiverResponse() - : type(ResponseType::UNKNOWN), session_id(-1), sequence_number(-1) {} - -ReceiverResponse::~ReceiverResponse() {} - +ReceiverResponse::ReceiverResponse() = default; +ReceiverResponse::~ReceiverResponse() = default; ReceiverResponse::ReceiverResponse(ReceiverResponse&& receiver_response) = default; - ReceiverResponse& ReceiverResponse::operator=( ReceiverResponse&& receiver_response) = default; -bool ReceiverResponse::Parse(const std::string& message_data) { - std::unique_ptr<base::Value> raw_value = - base::JSONReader::ReadDeprecated(message_data); - if (!raw_value || !raw_value->is_dict() || - !GetInt(*raw_value, "sessionId", &session_id) || - !GetInt(*raw_value, "seqNum", &sequence_number) || - !GetString(*raw_value, "result", &result)) - return false; +// static +std::unique_ptr<ReceiverResponse> ReceiverResponse::Parse( + const std::string& message_data) { + Json::CharReaderBuilder builder; + Json::CharReaderBuilder::strictMode(&builder.settings_); + std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); - if (result == "error") { - auto* found = raw_value->FindKey("error"); - if (found) { - error = std::make_unique<ReceiverError>(); - if (!error->Parse(*found)) - return false; + Json::Value root_node; + std::string error_msg; + const bool succeeded = reader->parse( + message_data.data(), message_data.data() + message_data.length(), + &root_node, &error_msg); + if (!succeeded) { + DVLOG(1) << "Failed to parse reciever message: " << error_msg; + return nullptr; + } + + auto response = std::make_unique<ReceiverResponse>(); + std::string result; + if (!root_node || !GetInt(root_node["sessionId"], &(response->session_id_)) || + !GetInt(root_node["seqNum"], &(response->sequence_number_)) || + !GetString(root_node["result"], &result)) { + return nullptr; + } + + response->type_ = GetResponseType(root_node); + response->valid_ = (result == "ok"); + if (!response->valid_) { + response->error_ = ParseError(root_node["error"]); + return response; + } + + switch (response->type_) { + case ResponseType::ANSWER: + response->answer_ = std::make_unique<openscreen::cast::Answer>(); + if (!openscreen::cast::Answer::ParseAndValidate( + root_node["answer"], response->answer_.get())) { + response->valid_ = false; + } + break; + + case ResponseType::STATUS_RESPONSE: + response->status_ = ParseStatus(root_node["status"]); + if (!response->status_) { + response->valid_ = false; + } + break; + + case ResponseType::CAPABILITIES_RESPONSE: + response->capabilities_ = ParseCapability(root_node["capabilities"]); + if (!response->capabilities_) { + response->valid_ = false; + } + break; + + case ResponseType::RPC: { + std::string raw_rpc; + if (!GetString(root_node["rpc"], &raw_rpc) || + !base::Base64Decode(raw_rpc, &(response->rpc_))) { + response->valid_ = false; + } + } break; + + case ResponseType::UNKNOWN: + default: + response->valid_ = false; + break; + } + + return response; +} + +std::unique_ptr<ReceiverResponse> ReceiverResponse::CloneForTesting() const { + auto clone = std::make_unique<ReceiverResponse>(); + clone->type_ = type_; + clone->session_id_ = session_id_; + clone->sequence_number_ = sequence_number_; + clone->valid_ = valid_; + if (!valid_) { + if (error_) { + clone->error_ = std::make_unique<ReceiverError>(*error_); } + return clone; } - std::string message_type; - if (!GetString(*raw_value, "type", &message_type)) - return false; - // Convert |message_type| to uppercase. - message_type = base::ToUpperASCII(message_type); - type = GetResponseType(message_type); - if (type == ResponseType::UNKNOWN) { - DVLOG(2) << "Unknown response message type= " << message_type; - return false; + // We assume that if the message wasn't classified as an error, + // it has a body. + switch (type_) { + case ResponseType::ANSWER: + clone->answer_ = std::make_unique<openscreen::cast::Answer>(*answer_); + break; + case ResponseType::STATUS_RESPONSE: + clone->status_ = std::make_unique<ReceiverStatus>(*status_); + break; + case ResponseType::CAPABILITIES_RESPONSE: + clone->capabilities_ = + std::make_unique<ReceiverCapability>(*capabilities_); + break; + case ResponseType::RPC: + clone->rpc_ = rpc_; + break; + case ResponseType::UNKNOWN: + break; } + return clone; +} - auto* found = raw_value->FindKey("answer"); - if (found && !found->is_none()) { - answer = std::make_unique<Answer>(); - if (!answer->Parse(*found)) - return false; - } +// static +ReceiverResponse ReceiverResponse::CreateAnswerResponseForTesting( + int32_t sequence_number, + std::unique_ptr<openscreen::cast::Answer> answer) { + ReceiverResponse response; + response.type_ = ResponseType::ANSWER; + response.sequence_number_ = sequence_number; + response.answer_ = std::move(answer); + response.valid_ = true; + return response; +} - found = raw_value->FindKey("status"); - if (found && !found->is_none()) { - status = std::make_unique<ReceiverStatus>(); - if (!status->Parse(*found)) - return false; - } - - found = raw_value->FindKey("capabilities"); - if (found && !found->is_none()) { - capabilities = std::make_unique<ReceiverCapability>(); - if (!capabilities->Parse(*found)) - return false; - } - - found = raw_value->FindKey("rpc"); - if (found && !found->is_none()) { - // Decode the base64-encoded string. - if (!found->is_string() || !base::Base64Decode(found->GetString(), &rpc)) - return false; - } - - return true; +// static +ReceiverResponse ReceiverResponse::CreateCapabilitiesResponseForTesting( + int32_t sequence_number, + std::unique_ptr<ReceiverCapability> capabilities) { + ReceiverResponse response; + response.type_ = ResponseType::CAPABILITIES_RESPONSE; + response.sequence_number_ = sequence_number; + response.capabilities_ = std::move(capabilities); + response.valid_ = true; + return response; } } // namespace mirroring
diff --git a/components/mirroring/service/receiver_response.h b/components/mirroring/service/receiver_response.h index 152cfd7..a03d6fd 100644 --- a/components/mirroring/service/receiver_response.h +++ b/components/mirroring/service/receiver_response.h
@@ -9,13 +9,15 @@ #include <string> #include <vector> +#include "base/check.h" #include "base/component_export.h" -#include "base/values.h" +#include "third_party/jsoncpp/source/include/json/value.h" +#include "third_party/openscreen/src/cast/streaming/answer_messages.h" namespace mirroring { // Receiver response message type. -enum ResponseType { +enum class ResponseType { UNKNOWN, ANSWER, // Response to OFFER message. STATUS_RESPONSE, // Response to GET_STATUS message. @@ -23,111 +25,147 @@ RPC, // Rpc binary messages. The payload is base64 encoded. }; -struct COMPONENT_EXPORT(MIRRORING_SERVICE) Answer { - Answer(); - ~Answer(); - Answer(const Answer& answer); - bool Parse(const base::Value& raw_value); - - // The UDP port used for all streams in this session. - int32_t udp_port; - // The indexes chosen from the OFFER message. - std::vector<int32_t> send_indexes; - // The RTP SSRC used to send the RTCP feedback of the stream, indicated by - // the |send_indexes| above. - std::vector<int32_t> ssrcs; - // A 128bit hex number containing the initialization vector for the crypto. - std::string iv; - // Indicates whether receiver supports the GET_STATUS command. - bool supports_get_status; - // "mirroring" for screen mirroring, or "remoting" for media remoting. - std::string cast_mode; -}; - struct COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverStatus { ReceiverStatus(); ~ReceiverStatus(); - ReceiverStatus(const ReceiverStatus& status); - bool Parse(const base::Value& raw_value); + ReceiverStatus(ReceiverStatus&& receiver_response); + ReceiverStatus(const ReceiverStatus& receiver_response); + ReceiverStatus& operator=(ReceiverStatus&& receiver_response); + ReceiverStatus& operator=(const ReceiverStatus& receiver_response); // Current WiFi signal to noise ratio in decibels. - double wifi_snr; + double wifi_snr = 0.0; + // Min, max, average, and current bandwidth in bps in order of the WiFi link. // Example: [1200, 1300, 1250, 1230]. std::vector<int32_t> wifi_speed; }; -struct COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverKeySystem { - ReceiverKeySystem(); - ~ReceiverKeySystem(); - ReceiverKeySystem(const ReceiverKeySystem& receiver_key_system); - bool Parse(const base::Value& raw_value); - - // Reverse URI (e.g. com.widevine.alpha). - std::string name; - // EME init data types (e.g. cenc). - std::vector<std::string> init_data_types; - // Codecs supported by key system. This will include AVC and VP8 on all - // Chromecasts. - std::vector<std::string> codecs; - // Codecs that are also hardware-secure. - std::vector<std::string> secure_codecs; - // Support levels for audio encryption robustness. - std::vector<std::string> audio_robustness; - // Support levels for video encryption robustness. - std::vector<std::string> video_robustness; - - std::string persistent_license_session_support; - std::string persistent_release_message_session_support; - std::string persistent_state_support; - std::string distinctive_identifier_support; -}; - struct COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverCapability { ReceiverCapability(); ~ReceiverCapability(); - ReceiverCapability(const ReceiverCapability& capabilities); - bool Parse(const base::Value& raw_value); + ReceiverCapability(ReceiverCapability&& receiver_response); + ReceiverCapability(const ReceiverCapability& receiver_response); + ReceiverCapability& operator=(ReceiverCapability&& receiver_response); + ReceiverCapability& operator=(const ReceiverCapability& receiver_response); // Set of capabilities (e.g., ac3, 4k, hevc, vp9, dolby_vision, etc.). std::vector<std::string> media_caps; - std::vector<ReceiverKeySystem> key_systems; }; struct COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverError { ReceiverError(); ~ReceiverError(); - bool Parse(const base::Value& raw_value); + ReceiverError(ReceiverError&& receiver_response); + ReceiverError(const ReceiverError& receiver_response); + ReceiverError& operator=(ReceiverError&& receiver_response); + ReceiverError& operator=(const ReceiverError& receiver_response); - int32_t code; + int32_t code = -1; std::string description; std::string details; // In JSON format. }; -struct COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverResponse { +// TODO(b/160978984): Migrate parsing and ReceiverResponse object to libcast. +class COMPONENT_EXPORT(MIRRORING_SERVICE) ReceiverResponse { + public: ReceiverResponse(); ~ReceiverResponse(); - ReceiverResponse(ReceiverResponse&& receiver_response); - ReceiverResponse& operator=(ReceiverResponse&& receiver_response); - bool Parse(const std::string& message_data); - ResponseType type; + // ReceiverResponse is shallow move only due to having unique_ptrs. We expose + // a clone method for testing that performs a deep copy. + ReceiverResponse(ReceiverResponse&& receiver_response); + ReceiverResponse(const ReceiverResponse& receiver_response) = delete; + ReceiverResponse& operator=(ReceiverResponse&& receiver_response); + ReceiverResponse& operator=(const ReceiverResponse& receiver_response) = + delete; + + static std::unique_ptr<ReceiverResponse> Parse( + const std::string& message_data); + static ReceiverResponse CreateErrorResponse(); + + // Test only methods + std::unique_ptr<ReceiverResponse> CloneForTesting() const; + static ReceiverResponse CreateAnswerResponseForTesting( + int32_t sequence_number, + std::unique_ptr<openscreen::cast::Answer> answer); + static ReceiverResponse CreateCapabilitiesResponseForTesting( + int32_t sequence_number, + std::unique_ptr<ReceiverCapability> capabilities); + + // Simple getter for the ResponseType. Note that if the message is an error + // message, this will be UNKNOWN since it's technically not applicable. + ResponseType type() const { return type_; } + // All messages have same |session_id| for each mirroring session. This value // is provided by the media router provider. - int32_t session_id; + int32_t session_id() const { return session_id_; } + // This should be same as the value in the corresponding query/OFFER messages // for non-rpc messages. - int32_t sequence_number; + int sequence_number() const { return sequence_number_; } - std::string result; // "ok" or "error". + // We don't expose "result" directly, to avoid string comparisons to "ok" + // and "error." This method returns true if and only if the result is "ok" + // and the object its specified payload. + bool valid() const { return valid_; } - // Only one of the following has value, according to |type|. - std::unique_ptr<Answer> answer; - std::string rpc; - std::unique_ptr<ReceiverStatus> status; - std::unique_ptr<ReceiverCapability> capabilities; - // Can only be non-null when result is "error". - std::unique_ptr<ReceiverError> error; + // Each response type has its own payload, including errors. If the receiver + // response exists, the payload is guaranteed to be present based on the + // DCHECK rules below. + const openscreen::cast::Answer& answer() const { + DCHECK(valid_ && type_ == ResponseType::ANSWER); + return *answer_; + } + + const std::string& rpc() const { + DCHECK(valid_ && type_ == ResponseType::RPC); + return rpc_; + } + + const ReceiverStatus& status() const { + DCHECK(valid_ && type_ == ResponseType::STATUS_RESPONSE); + return *status_; + } + + const ReceiverCapability& capabilities() const { + DCHECK(valid_ && type_ == ResponseType::CAPABILITIES_RESPONSE); + return *capabilities_; + } + + // Errors are different than the other payloads, and may be null depending + // on the type of error. + const ReceiverError* error() const { + DCHECK(!valid_); + return error_.get(); + } + + private: + ResponseType type_ = ResponseType::UNKNOWN; + int32_t session_id_ = -1; + int32_t sequence_number_ = -1; + bool valid_ = false; + + // Only one of these fields will be populated, based on the ResponseType + // value. Currently, we enforce this by DCHECKing on their accessors, instead + // of subclasses or a sum type/union/variant. ResponseType associated with + // each type is documented below. + + // ResponseType::ANSWER + std::unique_ptr<openscreen::cast::Answer> answer_; + + // ResponseType::RPC + // Contains the decoded (i.e. raw binary) RPC data. + std::string rpc_; + + // ResponseType::STATUS_RESPONSE + std::unique_ptr<ReceiverStatus> status_; + + // ResponseType::CAPABILITIES_RESPONSE + std::unique_ptr<ReceiverCapability> capabilities_; + + // Error may be populated for any ResponseType, as long as valid_ = false. + std::unique_ptr<ReceiverError> error_; }; } // namespace mirroring
diff --git a/components/mirroring/service/receiver_response_unittest.cc b/components/mirroring/service/receiver_response_unittest.cc index 1151046..3f17fde 100644 --- a/components/mirroring/service/receiver_response_unittest.cc +++ b/components/mirroring/service/receiver_response_unittest.cc
@@ -29,84 +29,81 @@ }; TEST_F(ReceiverResponseTest, ParseValidJson) { - const std::string response_string = "{\"type\":\"ANSWER\",\"result\":\"ok\"}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(-1, response.session_id); - EXPECT_EQ(-1, response.sequence_number); - EXPECT_EQ(ResponseType::ANSWER, response.type); - EXPECT_EQ("ok", response.result); - EXPECT_FALSE(response.answer); - EXPECT_FALSE(response.status); - EXPECT_FALSE(response.capabilities); - EXPECT_FALSE(response.error); - EXPECT_TRUE(response.rpc.empty()); + const std::string response_string = R"({"type": "ANSWER", "result": "ok"})"; + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(-1, response->session_id()); + EXPECT_EQ(-1, response->sequence_number()); + EXPECT_EQ(ResponseType::ANSWER, response->type()); + // Should be an error: there is no message body so this ANSWER is + // completely useless. + EXPECT_FALSE(response->valid()); } TEST_F(ReceiverResponseTest, ParseInvalidValueType) { const std::string response_string = - "{\"sessionId\":123, \"seqNum\":\"one-two-three\"}"; - ReceiverResponse response; - EXPECT_FALSE(response.Parse(response_string)); + R"({ + "sessionId": 123, "seqNum": "one - two - three" + })"; + EXPECT_EQ(nullptr, ReceiverResponse::Parse(response_string)); } TEST_F(ReceiverResponseTest, ParseNonJsonString) { const std::string response_string = "This is not JSON."; - ReceiverResponse response; - EXPECT_FALSE(response.Parse(response_string)); + EXPECT_EQ(nullptr, ReceiverResponse::Parse(response_string)); } TEST_F(ReceiverResponseTest, ParseRealWorldAnswerMessage) { const std::string response_string = - "{\"answer\":{\"receiverRtcpEventLog\":[0,1],\"rtpExtensions\":" - "[[\"adaptive_playout_delay\"],[\"adaptive_playout_delay\"]]," - "\"sendIndexes\":[0,1],\"ssrcs\":[40863,759293],\"udpPort\":50691," - "\"castMode\":\"mirroring\"},\"result\":\"ok\",\"seqNum\":989031000," - "\"type\":\"ANSWER\"}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(-1, response.session_id); - EXPECT_EQ(989031000, response.sequence_number); - EXPECT_EQ(ResponseType::ANSWER, response.type); - EXPECT_EQ("ok", response.result); - ASSERT_TRUE(response.answer); - EXPECT_EQ(50691, response.answer->udp_port); - EXPECT_EQ(std::vector<int32_t>({0, 1}), response.answer->send_indexes); - EXPECT_EQ(std::vector<int32_t>({40863, 759293}), response.answer->ssrcs); - EXPECT_TRUE(response.answer->iv.empty()); - EXPECT_EQ(false, response.answer->supports_get_status); - EXPECT_EQ("mirroring", response.answer->cast_mode); - EXPECT_FALSE(response.status); - EXPECT_FALSE(response.capabilities); - EXPECT_FALSE(response.error); + R"({"answer":{ + "receiverRtcpEventLog":[0, 1], + "rtpExtensions": [ + ["adaptive_playout_delay"], + ["adaptive_playout_delay"] + ], + "sendIndexes": [0, 1], + "ssrcs": [40863, 759293], + "udpPort": 50691, + "castMode": "mirroring" + }, + "result": "ok", + "seqNum": 989031000, + "type": "ANSWER" + })"; + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(-1, response->session_id()); + EXPECT_EQ(989031000, response->sequence_number()); + EXPECT_EQ(ResponseType::ANSWER, response->type()); + ASSERT_TRUE(response->valid()); + EXPECT_EQ(50691, response->answer().udp_port); + EXPECT_EQ(std::vector<int32_t>({0, 1}), response->answer().send_indexes); + EXPECT_EQ(std::vector<uint32_t>({40863u, 759293u}), response->answer().ssrcs); + EXPECT_EQ(false, response->answer().supports_wifi_status_reporting); } TEST_F(ReceiverResponseTest, ParseErrorMessage) { const std::string response_string = - "{\"sessionId\": 123," - "\"seqNum\": 999," - "\"type\": \"ANSWER\"," - "\"result\": \"error\"," - "\"error\": {" - "\"code\": 42," - "\"description\": \"it is broke\"," - "\"details\": {\"foo\": -1, \"bar\": 88}" - "}" - "}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(123, response.session_id); - EXPECT_EQ(999, response.sequence_number); - EXPECT_EQ(ResponseType::ANSWER, response.type); - EXPECT_EQ("error", response.result); - EXPECT_FALSE(response.answer); - EXPECT_FALSE(response.status); - EXPECT_FALSE(response.capabilities); - ASSERT_TRUE(response.error); - EXPECT_EQ(42, response.error->code); - EXPECT_EQ("it is broke", response.error->description); + R"({"sessionId": 123, + "seqNum": 999, + "type": "ANSWER", + "result": "error", + "error": { + "code": 42, + "description": "it is broken", + "details": {"foo": -1, "bar": 88} + } + })"; + auto response = ReceiverResponse::Parse(response_string); + EXPECT_EQ(123, response->session_id()); + EXPECT_EQ(999, response->sequence_number()); + EXPECT_EQ(ResponseType::ANSWER, response->type()); + ASSERT_FALSE(response->valid()); + ASSERT_TRUE(response->error()); + EXPECT_EQ(42, response->error()->code); + EXPECT_EQ("it is broken", response->error()->description); std::unique_ptr<base::Value> parsed_details = - base::JSONReader::ReadDeprecated(response.error->details); + base::JSONReader::ReadDeprecated(response->error()->details); ASSERT_TRUE(parsed_details && parsed_details->is_dict()); EXPECT_EQ(2u, parsed_details->DictSize()); int fool_value = 0; @@ -119,145 +116,114 @@ TEST_F(ReceiverResponseTest, ParseStatusMessage) { const std::string response_string = - "{\"seqNum\": 777," - "\"type\": \"STATUS_RESPONSE\"," - "\"result\": \"ok\"," - "\"status\": {" - "\"wifiSnr\": 36.7," - "\"wifiSpeed\": [1234, 5678, 3000, 3001]," - "\"wifiFcsError\": [12, 13, 12, 12]}" // This will be ignored. - "}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(777, response.sequence_number); - EXPECT_EQ(ResponseType::STATUS_RESPONSE, response.type); - EXPECT_EQ("ok", response.result); - EXPECT_FALSE(response.error); - EXPECT_FALSE(response.answer); - ASSERT_TRUE(response.status); - EXPECT_EQ(36.7, response.status->wifi_snr); + R"({"seqNum": 777, + "type": "STATUS_RESPONSE", + "result": "ok", + "sessionId": 12345323, + "status": { + "wifiSnr": 36.7, + "wifiSpeed": [1234, 5678, 3000, 3001], + "wifiFcsError": [12, 13, 12, 12] + } + })"; + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(777, response->sequence_number()); + EXPECT_EQ(ResponseType::STATUS_RESPONSE, response->type()); + ASSERT_TRUE(response->valid()); + EXPECT_EQ(36.7, response->status().wifi_snr); const std::vector<int32_t> expect_speed({1234, 5678, 3000, 3001}); - EXPECT_EQ(expect_speed, response.status->wifi_speed); - EXPECT_FALSE(response.capabilities); + EXPECT_EQ(expect_speed, response->status().wifi_speed); } TEST_F(ReceiverResponseTest, ParseCapabilityMessage) { const std::string response_string = - "{\"sessionId\": 999888777," - "\"seqNum\": 5551212," - "\"type\": \"CAPABILITIES_RESPONSE\"," - "\"result\": \"ok\"," - "\"capabilities\": {" - "\"mediaCaps\": [\"audio\", \"video\", \"vp9\"]," - "\"keySystems\": [" - "{" - "\"keySystemName\": \"com.w3c.clearkey\"" - "}," - "{" - "\"keySystemName\": \"com.widevine.alpha\"," - "\"initDataTypes\": [\"a\", \"b\", \"c\", \"1\", \"2\", \"3\"]," - "\"codecs\": [\"vp8\", \"h264\"]," - "\"secureCodecs\": [\"h264\", \"vp8\"]," - "\"audioRobustness\": [\"nope\"]," - "\"videoRobustness\": [\"yep\"]," - "\"persistentLicenseSessionSupport\": \"SUPPORTED\"," - "\"persistentReleaseMessageSessionSupport\": \"SUPPORTED_WITH_ID\"," - "\"persistentStateSupport\": \"REQUESTABLE\"," - "\"distinctiveIdentifierSupport\": \"ALWAYS_ENABLED\"" - "}" - "]}}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(999888777, response.session_id); - EXPECT_EQ(5551212, response.sequence_number); - EXPECT_EQ(ResponseType::CAPABILITIES_RESPONSE, response.type); - EXPECT_EQ("ok", response.result); - EXPECT_FALSE(response.error); - EXPECT_FALSE(response.answer); - EXPECT_FALSE(response.status); - ASSERT_TRUE(response.capabilities); + R"({"sessionId": 999888777, + "seqNum": 5551212, + "type": "CAPABILITIES_RESPONSE", + "result": "ok", + "capabilities": { + "mediaCaps": ["audio", "video", "vp9"], + "keySystems": [ + { + "keySystemName": "com.w3c.clearkey" + }, + { + "keySystemName": "com.widevine.alpha", + "initDataTypes": ["a", "b", "c", "1", "2", "3"], + "codecs": ["vp8", "h264"], + "secureCodecs": ["h264", "vp8"], + "audioRobustness": ["nope"], + "videoRobustness": ["yep"], + "persistentLicenseSessionSupport": "SUPPORTED", + "persistentReleaseMessageSessionSupport": "SUPPORTED_WITH_ID", + "persistentStateSupport": "REQUESTABLE", + "distinctiveIdentifierSupport": "ALWAYS_ENABLED" + } + ] + }})"; + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(999888777, response->session_id()); + EXPECT_EQ(5551212, response->sequence_number()); + EXPECT_EQ(ResponseType::CAPABILITIES_RESPONSE, response->type()); + // Key systems are now ignored, but should not be considered an error. + ASSERT_TRUE(response->valid()); EXPECT_EQ(std::vector<std::string>({"audio", "video", "vp9"}), - response.capabilities->media_caps); - const ReceiverKeySystem& first_key_system = - response.capabilities->key_systems[0]; - EXPECT_EQ("com.w3c.clearkey", first_key_system.name); - EXPECT_TRUE(first_key_system.init_data_types.empty()); - EXPECT_TRUE(first_key_system.codecs.empty()); - EXPECT_TRUE(first_key_system.secure_codecs.empty()); - EXPECT_TRUE(first_key_system.audio_robustness.empty()); - EXPECT_TRUE(first_key_system.video_robustness.empty()); - EXPECT_TRUE(first_key_system.persistent_license_session_support.empty()); - EXPECT_TRUE( - first_key_system.persistent_release_message_session_support.empty()); - EXPECT_TRUE(first_key_system.persistent_state_support.empty()); - EXPECT_TRUE(first_key_system.distinctive_identifier_support.empty()); - const ReceiverKeySystem& second_key_system = - response.capabilities->key_systems[1]; - EXPECT_EQ("com.widevine.alpha", second_key_system.name); - EXPECT_EQ(std::vector<std::string>({"a", "b", "c", "1", "2", "3"}), - second_key_system.init_data_types); - EXPECT_EQ(std::vector<std::string>({"vp8", "h264"}), - second_key_system.codecs); - EXPECT_EQ(std::vector<std::string>({"h264", "vp8"}), - second_key_system.secure_codecs); - EXPECT_EQ(std::vector<std::string>({"nope"}), - second_key_system.audio_robustness); - EXPECT_EQ(std::vector<std::string>({"yep"}), - second_key_system.video_robustness); - EXPECT_EQ("SUPPORTED", second_key_system.persistent_license_session_support); - EXPECT_EQ("SUPPORTED_WITH_ID", - second_key_system.persistent_release_message_session_support); - EXPECT_EQ("REQUESTABLE", second_key_system.persistent_state_support); - EXPECT_EQ("ALWAYS_ENABLED", second_key_system.distinctive_identifier_support); + response->capabilities().media_caps); } TEST_F(ReceiverResponseTest, ParseRpcMessage) { const std::string message = "Hello from the Cast Receiver!"; std::string rpc_base64; base::Base64Encode(message, &rpc_base64); - std::string response_string = - "{\"sessionId\": 735189," - "\"seqNum\": 6789," - "\"type\": \"RPC\"," - "\"result\": \"ok\"," - "\"rpc\": \"" + - rpc_base64 + "\"}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(735189, response.session_id); - EXPECT_EQ(6789, response.sequence_number); - EXPECT_EQ("ok", response.result); - EXPECT_EQ(ResponseType::RPC, response.type); - EXPECT_EQ(message, response.rpc); - EXPECT_FALSE(response.error); - EXPECT_FALSE(response.answer); - EXPECT_FALSE(response.status); - EXPECT_FALSE(response.capabilities); + const std::string response_string = + R"({"sessionId": 735189, + "seqNum": 6789, + "type": "RPC", + "result": "ok", + "rpc": ")" + + rpc_base64 + R"("})"; + + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(735189, response->session_id()); + EXPECT_EQ(6789, response->sequence_number()); + ASSERT_TRUE(response->valid()); + EXPECT_EQ(ResponseType::RPC, response->type()); + EXPECT_EQ(message, response->rpc()); } TEST_F(ReceiverResponseTest, ParseResponseWithNullField) { const std::string response_string = - "{\"sessionId\":null,\"seqNum\":808907000,\"type\":\"ANSWER\"," - "\"result\":\"ok\",\"rpc\":null,\"error\":null," - "\"answer\":{\"udpPort\":51706,\"sendIndexes\":[0,1]," - "\"ssrcs\":[152818,556029],\"IV\":null,\"receiverGetStatus\":true," - "\"castMode\":\"mirroring\"},\"status\":null,\"capabilities\":null}"; - ReceiverResponse response; - ASSERT_TRUE(response.Parse(response_string)); - EXPECT_EQ(808907000, response.sequence_number); - EXPECT_EQ("ok", response.result); - EXPECT_FALSE(response.error); - EXPECT_FALSE(response.status); - EXPECT_FALSE(response.capabilities); - EXPECT_TRUE(response.rpc.empty()); - EXPECT_EQ(ResponseType::ANSWER, response.type); - ASSERT_TRUE(response.answer); - EXPECT_EQ(51706, response.answer->udp_port); - EXPECT_EQ(std::vector<int32_t>({0, 1}), response.answer->send_indexes); - EXPECT_EQ(std::vector<int32_t>({152818, 556029}), response.answer->ssrcs); - EXPECT_TRUE(response.answer->iv.empty()); - EXPECT_EQ(true, response.answer->supports_get_status); - EXPECT_EQ("mirroring", response.answer->cast_mode); + R"({"sessionId": null, + "seqNum": 808907000, + "type": "ANSWER", + "result": "ok", + "rpc": null, + "error": null, + "answer": { + "udpPort": 51706, + "sendIndexes": [0,1], + "ssrcs": [152818,556029], + "IV": null, + "receiverGetStatus": true, + "castMode": "mirroring" + }, + "status": null, + "capabilities": null + } + )"; + auto response = ReceiverResponse::Parse(response_string); + ASSERT_TRUE(response); + EXPECT_EQ(808907000, response->sequence_number()); + ASSERT_TRUE(response->valid()); + EXPECT_EQ(ResponseType::ANSWER, response->type()); + EXPECT_EQ(51706, response->answer().udp_port); + EXPECT_EQ(std::vector<int32_t>({0, 1}), response->answer().send_indexes); + EXPECT_EQ(std::vector<uint32_t>({152818u, 556029u}), + response->answer().ssrcs); + EXPECT_EQ(true, response->answer().supports_wifi_status_reporting); } } // namespace mirroring
diff --git a/components/mirroring/service/session.cc b/components/mirroring/service/session.cc index c081cc5..3757bb71 100644 --- a/components/mirroring/service/session.cc +++ b/components/mirroring/service/session.cc
@@ -45,6 +45,9 @@ #include "mojo/public/cpp/system/platform_handle.h" #include "net/base/ip_endpoint.h" #include "services/viz/public/cpp/gpu/gpu.h" +#include "third_party/openscreen/src/cast/streaming/answer_messages.h" +#include "third_party/openscreen/src/cast/streaming/capture_recommendations.h" +#include "third_party/openscreen/src/cast/streaming/offer_messages.h" using media::cast::CastTransportStatus; using media::cast::Codec; @@ -577,32 +580,73 @@ std::move(packet_events)); } +void Session::SetConstraints(const openscreen::cast::Answer& answer, + FrameSenderConfig* audio_config, + FrameSenderConfig* video_config) { + const auto recommendations = + openscreen::cast::capture_recommendations::GetRecommendations(answer); + const auto& audio = recommendations.audio; + const auto& video = recommendations.video; + + if (video_config) { + // We use pixels instead of comparing width and height to allow for + // differences in aspect ratio. + const int current_pixels = + mirror_settings_.max_width() * mirror_settings_.max_height(); + const int recommended_pixels = video.maximum.width * video.maximum.height; + // Prioritize the stricter of the sender's and receiver's constraints. + if (recommended_pixels < current_pixels) { + // The resolution constraints here are used to generate the + // media::VideoCaptureParams below. + mirror_settings_.SetResolutionConstraints(video.maximum.width, + video.maximum.height); + } + video_config->min_bitrate = + std::max(video_config->min_bitrate, video.bit_rate_limits.minimum); + video_config->start_bitrate = video_config->min_bitrate; + video_config->max_bitrate = + std::min(video_config->max_bitrate, video.bit_rate_limits.maximum); + video_config->max_playout_delay = + std::min(video_config->max_playout_delay, + base::TimeDelta::FromMilliseconds(video.max_delay.count())); + video_config->max_frame_rate = + std::min(video_config->max_frame_rate, video.maximum.frame_rate); + + // We only do sender-side letterboxing if the receiver doesn't support it. + mirror_settings_.SetSenderSideLetterboxingEnabled(!video.supports_scaling); + } + + if (audio_config) { + audio_config->min_bitrate = + std::max(audio_config->min_bitrate, audio.bit_rate_limits.minimum); + audio_config->start_bitrate = audio_config->min_bitrate; + audio_config->max_bitrate = + std::min(audio_config->max_bitrate, audio.bit_rate_limits.maximum); + audio_config->max_playout_delay = + std::min(audio_config->max_playout_delay, + base::TimeDelta::FromMilliseconds(audio.max_delay.count())); + // Currently, Chrome only supports stereo, so audio.max_channels is ignored. + } +} + void Session::OnAnswer(const std::vector<FrameSenderConfig>& audio_configs, const std::vector<FrameSenderConfig>& video_configs, const ReceiverResponse& response) { if (state_ == STOPPED) return; - if (!response.answer || response.type == ResponseType::UNKNOWN) { + if (response.type() == ResponseType::UNKNOWN) { ReportError(SessionError::ANSWER_TIME_OUT); return; } - DCHECK_EQ(ResponseType::ANSWER, response.type); - - if (response.result != "ok") { + DCHECK_EQ(ResponseType::ANSWER, response.type()); + if (!response.valid()) { ReportError(SessionError::ANSWER_NOT_OK); return; } - const Answer& answer = *response.answer; - const std::string cast_mode = - (state_ == MIRRORING ? "mirroring" : "remoting"); - if (answer.cast_mode != cast_mode) { - ReportError(SessionError::ANSWER_MISMATCHED_CAST_MODE); - return; - } - + const openscreen::cast::Answer& answer = response.answer(); if (answer.send_indexes.size() != answer.ssrcs.size()) { ReportError(SessionError::ANSWER_MISMATCHED_SSRC_LENGTH); return; @@ -648,6 +692,10 @@ return; } + // Set constraints from ANSWER message. + SetConstraints(answer, has_audio ? &audio_config : nullptr, + has_video ? &video_config : nullptr); + // Start streaming. const bool initially_starting_session = !audio_encode_thread_ && !video_encode_thread_; @@ -744,7 +792,7 @@ } std::unique_ptr<WifiStatusMonitor> wifi_status_monitor; - if (answer.supports_get_status) { + if (answer.supports_wifi_status_reporting) { wifi_status_monitor = std::make_unique<WifiStatusMonitor>(&message_dispatcher_); // Nest Hub devices do not support remoting despite having a relatively new @@ -782,6 +830,8 @@ video_stream_->SetTargetPlayoutDelay(playout_delay); } +// TODO(issuetracker.google.com/159352836): Refactor to use libcast's +// OFFER message format. void Session::CreateAndSendOffer() { DCHECK(state_ != STOPPED); @@ -923,20 +973,16 @@ } void Session::OnCapabilitiesResponse(const ReceiverResponse& response) { - if (!response.capabilities || response.type == ResponseType::UNKNOWN) { - VLOG(1) << "Receiver doens't support GET_CAPABILITIES. Remoting disabled."; - return; - } - if (response.result != "ok") { + if (!response.valid()) { VLOG(1) << "Bad CAPABILITIES_RESPONSE. Remoting disabled."; - if (response.error) { - VLOG(1) << "error code=" << response.error->code - << " description=" << response.error->description - << " details=" << response.error->details; + if (response.error()) { + VLOG(1) << " error code=" << response.error()->code + << " description=" << response.error()->description + << " details=" << response.error()->details; } return; } - const std::vector<std::string>& caps = response.capabilities->media_caps; + const std::vector<std::string>& caps = response.capabilities().media_caps; std::string build_version; std::string friendly_name;
diff --git a/components/mirroring/service/session.h b/components/mirroring/service/session.h index 3b33b4b..6231e73 100644 --- a/components/mirroring/service/session.h +++ b/components/mirroring/service/session.h
@@ -45,7 +45,7 @@ namespace mirroring { -struct ReceiverResponse; +class ReceiverResponse; class VideoCaptureClient; class ReceiverSetupQuerier; @@ -86,6 +86,11 @@ std::unique_ptr<std::vector<media::cast::FrameEvent>> frame_events, std::unique_ptr<std::vector<media::cast::PacketEvent>> packet_events); + // Helper method for setting constraints from the ANSWER response. + void SetConstraints(const openscreen::cast::Answer& answer, + media::cast::FrameSenderConfig* audio_config, + media::cast::FrameSenderConfig* video_config); + // Callback for ANSWER response. If the ANSWER is invalid, |observer_| will // get notified with error, and session is stopped. Otherwise, capturing and // streaming are started with the selected configs.
diff --git a/components/mirroring/service/session_unittest.cc b/components/mirroring/service/session_unittest.cc index 941dd3a5..ca53d56 100644 --- a/components/mirroring/service/session_unittest.cc +++ b/components/mirroring/service/session_unittest.cc
@@ -27,6 +27,7 @@ #include "services/viz/public/cpp/gpu/gpu.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/openscreen/src/cast/streaming/ssrc.h" using ::testing::InvokeWithoutArgs; using ::testing::_; @@ -47,6 +48,30 @@ constexpr int kDefaultPlayoutDelay = 400; // ms +const openscreen::cast::Answer kAnswerWithConstraints{ + 1234, + // Send indexes and SSRCs are set later. + {}, + {}, + openscreen::cast::Constraints{ + openscreen::cast::AudioConstraints{44100, 2, 32000, 960000, + std::chrono::milliseconds(4000)}, + openscreen::cast::VideoConstraints{ + 40000.0, openscreen::cast::Dimensions{320, 480, {30, 1}}, + openscreen::cast::Dimensions{1920, 1080, {60, 1}}, 300000, + 144000000, std::chrono::milliseconds(4000)}}, + openscreen::cast::DisplayDescription{ + openscreen::cast::Dimensions{1280, 720, {60, 1}}, + openscreen::cast::AspectRatio{16, 9}, + openscreen::cast::AspectRatioConstraint::kFixed, + }, + // We don't currently use the RTCP event log, or DSCP, or extensions. + {}, + {}, + true, // receiver_get_status + {}, +}; + class MockRemotingSource final : public media::mojom::RemotingSource { public: MockRemotingSource() {} @@ -181,22 +206,23 @@ } } - auto answer = std::make_unique<Answer>(); + std::unique_ptr<openscreen::cast::Answer> answer; + if (answer_) { + answer.swap(answer_); + } else { + answer = std::make_unique<openscreen::cast::Answer>(); + answer->supports_wifi_status_reporting = true; + } + answer->udp_port = receiver_endpoint_.port(); - answer->cast_mode = cast_mode_; - answer->supports_get_status = true; const int number_of_configs = audio_configs.size() + video_configs.size(); for (int i = 0; i < number_of_configs; ++i) { answer->send_indexes.push_back(i); answer->ssrcs.push_back(31 + i); // Arbitrary receiver SSRCs. } - ReceiverResponse response; - response.result = "ok"; - response.type = ResponseType::ANSWER; - response.sequence_number = offer_sequence_number_; - response.answer = std::move(answer); - + auto response = ReceiverResponse::CreateAnswerResponseForTesting( + offer_sequence_number_, std::move(answer)); session_->OnAnswer(audio_configs, video_configs, response); task_environment_.RunUntilIdle(); } @@ -292,6 +318,7 @@ .Times(1); EXPECT_CALL(remoting_source_, OnSinkGone()).Times(AtLeast(1)); } + session_->OnAnswer(std::vector<FrameSenderConfig>(), std::vector<FrameSenderConfig>(), ReceiverResponse()); task_environment_.RunUntilIdle(); @@ -303,13 +330,11 @@ void SendRemotingCapabilities() { EXPECT_CALL(*this, OnConnectToRemotingSource()).Times(1); EXPECT_CALL(remoting_source_, OnSinkAvailable(_)).Times(1); - ReceiverResponse response; - response.result = "ok"; - response.type = ResponseType::CAPABILITIES_RESPONSE; - response.sequence_number = capability_sequence_number_; - response.capabilities = std::make_unique<ReceiverCapability>(); - response.capabilities->media_caps = + auto capabilities = std::make_unique<ReceiverCapability>(); + capabilities->media_caps = std::vector<std::string>({"video", "audio", "vp8", "opus"}); + auto response = ReceiverResponse::CreateCapabilitiesResponseForTesting( + capability_sequence_number_, std::move(capabilities)); session_->OnCapabilitiesResponse(response); task_environment_.RunUntilIdle(); Mock::VerifyAndClear(this); @@ -356,6 +381,10 @@ target_playout_delay_ms_ = target_playout_delay_ms; } + void SetAnswer(std::unique_ptr<openscreen::cast::Answer> answer) { + answer_ = std::move(answer); + } + private: base::test::TaskEnvironment task_environment_; const net::IPEndPoint receiver_endpoint_; @@ -374,7 +403,7 @@ std::unique_ptr<Session> session_; std::unique_ptr<FakeVideoCaptureHost> video_host_; std::unique_ptr<MockNetworkContext> network_context_; - + std::unique_ptr<openscreen::cast::Answer> answer_; DISALLOW_COPY_AND_ASSIGN(SessionTest); }; @@ -399,6 +428,13 @@ StopSession(); } +TEST_F(SessionTest, AnswerWithConstraints) { + SetAnswer(std::make_unique<openscreen::cast::Answer>(kAnswerWithConstraints)); + CreateSession(SessionType::AUDIO_AND_VIDEO); + StartSession(); + StopSession(); +} + TEST_F(SessionTest, AnswerTimeout) { CreateSession(SessionType::AUDIO_AND_VIDEO); SignalAnswerTimeout();
diff --git a/components/mirroring/service/wifi_status_monitor.cc b/components/mirroring/service/wifi_status_monitor.cc index dbce9b0..549efa4f 100644 --- a/components/mirroring/service/wifi_status_monitor.cc +++ b/components/mirroring/service/wifi_status_monitor.cc
@@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/check.h" #include "base/json/json_writer.h" +#include "base/values.h" #include "components/mirroring/service/message_dispatcher.h" namespace mirroring { @@ -63,14 +64,16 @@ } void WifiStatusMonitor::RecordStatus(const ReceiverResponse& response) { - if (!response.status || response.status->wifi_speed.size() != 4) + if (!response.valid() || response.status().wifi_speed.size() != 4) return; + if (recent_status_.size() == kMaxRecords) recent_status_.pop_front(); + WifiStatus received_status; - received_status.snr = response.status->wifi_snr; + received_status.snr = response.status().wifi_snr; // Only records the current speed. - received_status.speed = response.status->wifi_speed[3]; + received_status.speed = response.status().wifi_speed[3]; received_status.timestamp = base::Time::Now(); recent_status_.emplace_back(received_status); }
diff --git a/components/mirroring/service/wifi_status_monitor.h b/components/mirroring/service/wifi_status_monitor.h index ef68793a..ba25a3f 100644 --- a/components/mirroring/service/wifi_status_monitor.h +++ b/components/mirroring/service/wifi_status_monitor.h
@@ -16,7 +16,7 @@ namespace mirroring { class MessageDispatcher; -struct ReceiverResponse; +class ReceiverResponse; struct WifiStatus { double snr;
diff --git a/components/ntp_tiles/most_visited_sites.h b/components/ntp_tiles/most_visited_sites.h index 5bdf52c..d72ac1c3 100644 --- a/components/ntp_tiles/most_visited_sites.h +++ b/components/ntp_tiles/most_visited_sites.h
@@ -106,7 +106,6 @@ virtual ~HomepageClient() = default; virtual bool IsHomepageTileEnabled() const = 0; virtual GURL GetHomepageUrl() const = 0; - // TODO(https://crbug.com/862753): Extract this to another interface. virtual void QueryHomepageTitle(TitleCallback title_callback) = 0; };
diff --git a/components/omnibox/browser/autocomplete_result.cc b/components/omnibox/browser/autocomplete_result.cc index 28d14e64..12700c2a4 100644 --- a/components/omnibox/browser/autocomplete_result.cc +++ b/components/omnibox/browser/autocomplete_result.cc
@@ -112,6 +112,14 @@ return field_trial_value; } +// static +size_t AutocompleteResult::GetDynamicMaxMatches() { + return base::GetFieldTrialParamByFeatureAsInt( + omnibox::kDynamicMaxAutocomplete, + OmniboxFieldTrial::kDynamicMaxAutocompleteIncreasedLimitParam, + AutocompleteResult::GetMaxMatches()); +} + AutocompleteResult::AutocompleteResult() { // Reserve enough space for the maximum number of matches we'll show in either // on-focus or prefix-suggest mode. @@ -639,13 +647,11 @@ const ACMatches& matches, const CompareWithDemoteByType<AutocompleteMatch>& comparing_object) { size_t base_limit = GetMaxMatches(); + size_t increased_limit = GetDynamicMaxMatches(); size_t url_cutoff = base::GetFieldTrialParamByFeatureAsInt( omnibox::kDynamicMaxAutocomplete, OmniboxFieldTrial::kDynamicMaxAutocompleteUrlCutoffParam, 0); - size_t increased_limit = base::GetFieldTrialParamByFeatureAsInt( - omnibox::kDynamicMaxAutocomplete, - OmniboxFieldTrial::kDynamicMaxAutocompleteIncreasedLimitParam, - base_limit); + DCHECK(increased_limit > base_limit); size_t num_matches = 0; size_t num_url_matches = 0;
diff --git a/components/omnibox/browser/autocomplete_result.h b/components/omnibox/browser/autocomplete_result.h index 339fbf7..15c48161 100644 --- a/components/omnibox/browser/autocomplete_result.h +++ b/components/omnibox/browser/autocomplete_result.h
@@ -33,8 +33,12 @@ // Max number of matches we'll show from the various providers. This limit may // be different for zero suggest (i.e. when |input_from_omnibox_focus| is - // true) and non zero suggest. + // true) and non zero suggest. Does not take into account the boost + // conditionally provided by the omnibox::kDynamicMaxAutocomplete feature. static size_t GetMaxMatches(bool input_from_omnibox_focus = false); + // Defaults to GetMaxMatches if omnibox::kDynamicMaxAutocomplete is disabled; + // otherwise returns the boosted dynamic limit. + static size_t GetDynamicMaxMatches(); AutocompleteResult(); ~AutocompleteResult();
diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc index 0b73e389..27f28ab8 100644 --- a/components/omnibox/browser/search_provider.cc +++ b/components/omnibox/browser/search_provider.cc
@@ -1090,12 +1090,13 @@ // always include in that set a legal default match if possible. If Instant // Extended is enabled and we have server-provided (and thus hopefully more // accurate) scores for some suggestions, we allow more of those, until we - // reach AutocompleteResult::GetMaxMatches() total matches (that is, enough to - // fill the whole popup). + // reach AutocompleteResult::GetDynamicMaxMatches() total matches (that is, + // enough to fill the whole popup). // // We will always return any verbatim matches, no matter how we obtained their - // scores, unless we have already accepted AutocompleteResult::GetMaxMatches() - // higher-scoring matches under the conditions above. + // scores, unless we have already accepted + // AutocompleteResult::GetDynamicMaxMatches() higher-scoring matches under + // the conditions above. std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); // Guarantee that if there's a legal default match anywhere in the result @@ -1117,7 +1118,7 @@ size_t num_suggestions = 0; for (ACMatches::const_iterator i(matches.begin()); (i != matches.end()) && - (matches_.size() < AutocompleteResult::GetMaxMatches()); + (matches_.size() < AutocompleteResult::GetDynamicMaxMatches()); ++i) { // SEARCH_OTHER_ENGINE is only used in the SearchProvider for the keyword // verbatim result, so this condition basically means "if this match is a @@ -1612,7 +1613,7 @@ // are processed in descending order of relevance so the first suggestions are // the ones to be shown; prefetching images for the rest would be wasteful. std::vector<GURL> prefetch_image_urls; - int prefetch_limit = AutocompleteResult::GetMaxMatches(); + int prefetch_limit = AutocompleteResult::GetDynamicMaxMatches(); for (const auto& suggestion : results->suggest_results) { if (prefetch_limit <= 0) break;
diff --git a/components/os_crypt/kwallet_dbus_unittest.cc b/components/os_crypt/kwallet_dbus_unittest.cc index 33edf7f..a1702ea0 100644 --- a/components/os_crypt/kwallet_dbus_unittest.cc +++ b/components/os_crypt/kwallet_dbus_unittest.cc
@@ -92,7 +92,7 @@ mock_session_bus_.get(), dbus_service_name_, dbus::ObjectPath(dbus_path_)); - // The kwallet proxy is aquired once, when preparing |kwallet_dbus_| + // The kwallet proxy is acquired once, when preparing |kwallet_dbus_| EXPECT_CALL( *mock_session_bus_.get(), GetObjectProxy(dbus_service_name_, dbus::ObjectPath(dbus_path_)))
diff --git a/components/page_info/android/OWNERS b/components/page_info/android/OWNERS index 262cb412..59f03d8 100644 --- a/components/page_info/android/OWNERS +++ b/components/page_info/android/OWNERS
@@ -1,5 +1,6 @@ +file://components/page_info/OWNERS + # Additional owners from EMEA. -# Feel free to add components/page_info/OWNERS as well. dullweber@chromium.org eokoyomon@chromium.org
diff --git a/components/paint_preview/player/android/BUILD.gn b/components/paint_preview/player/android/BUILD.gn index 945baecb..6ff295f 100644 --- a/components/paint_preview/player/android/BUILD.gn +++ b/components/paint_preview/player/android/BUILD.gn
@@ -55,6 +55,7 @@ "java/src/org/chromium/components/paintpreview/player/PlayerManager.java", "java/src/org/chromium/components/paintpreview/player/PlayerSwipeRefreshHandler.java", "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainter.java", + "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapState.java", "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameCoordinator.java", "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameGestureDetector.java", "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediator.java",
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainter.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainter.java index bb51c9ff..769c2c76 100644 --- a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainter.java +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainter.java
@@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; +import android.util.Size; import javax.annotation.Nonnull; @@ -15,8 +16,7 @@ * on a {@link Canvas}. */ class PlayerFrameBitmapPainter { - private int mTileWidth; - private int mTileHeight; + private Size mTileSize; private Bitmap[][] mBitmapMatrix; private Rect mViewPort = new Rect(); private Rect mDrawBitmapSrc = new Rect(); @@ -27,9 +27,8 @@ mInvalidateCallback = invalidateCallback; } - void updateTileDimensions(int[] tileDimensions) { - mTileWidth = tileDimensions[0]; - mTileHeight = tileDimensions[1]; + void updateTileDimensions(Size tileDimensions) { + mTileSize = tileDimensions; } void updateViewPort(int left, int top, int right, int bottom) { @@ -50,12 +49,12 @@ if (mViewPort.isEmpty()) return; - if (mTileWidth <= 0 || mTileHeight <= 0) return; + if (mTileSize.getWidth() <= 0 || mTileSize.getHeight() <= 0) return; - final int rowStart = mViewPort.top / mTileHeight; - final int rowEnd = (int) Math.ceil((double) mViewPort.bottom / mTileHeight); - final int colStart = mViewPort.left / mTileWidth; - final int colEnd = (int) Math.ceil((double) mViewPort.right / mTileWidth); + final int rowStart = mViewPort.top / mTileSize.getHeight(); + final int rowEnd = (int) Math.ceil((double) mViewPort.bottom / mTileSize.getHeight()); + final int colStart = mViewPort.left / mTileSize.getWidth(); + final int colEnd = (int) Math.ceil((double) mViewPort.right / mTileSize.getWidth()); if (rowEnd > mBitmapMatrix.length || colEnd > mBitmapMatrix[rowEnd - 1].length) { return; } @@ -68,17 +67,17 @@ } // Calculate the portion of this tileBitmap that is visible in mViewPort. - int bitmapLeft = Math.max(mViewPort.left - (col * mTileWidth), 0); - int bitmapTop = Math.max(mViewPort.top - (row * mTileHeight), 0); - int bitmapRight = - Math.min(mTileWidth, bitmapLeft + mViewPort.right - (col * mTileWidth)); - int bitmapBottom = - Math.min(mTileHeight, bitmapTop + mViewPort.bottom - (row * mTileHeight)); + int bitmapLeft = Math.max(mViewPort.left - (col * mTileSize.getWidth()), 0); + int bitmapTop = Math.max(mViewPort.top - (row * mTileSize.getHeight()), 0); + int bitmapRight = Math.min(mTileSize.getWidth(), + bitmapLeft + mViewPort.right - (col * mTileSize.getWidth())); + int bitmapBottom = Math.min(mTileSize.getHeight(), + bitmapTop + mViewPort.bottom - (row * mTileSize.getHeight())); mDrawBitmapSrc.set(bitmapLeft, bitmapTop, bitmapRight, bitmapBottom); // Calculate the portion of the canvas that tileBitmap is gonna be drawn on. - int canvasLeft = Math.max((col * mTileWidth) - mViewPort.left, 0); - int canvasTop = Math.max((row * mTileHeight) - mViewPort.top, 0); + int canvasLeft = Math.max((col * mTileSize.getWidth()) - mViewPort.left, 0); + int canvasTop = Math.max((row * mTileSize.getHeight()) - mViewPort.top, 0); int canvasRight = canvasLeft + mDrawBitmapSrc.width(); int canvasBottom = canvasTop + mDrawBitmapSrc.height(); mDrawBitmapDst.set(canvasLeft, canvasTop, canvasRight, canvasBottom);
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapState.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapState.java new file mode 100644 index 0000000..12bf3d642 --- /dev/null +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapState.java
@@ -0,0 +1,229 @@ +// Copyright 2020 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. + +package org.chromium.components.paintpreview.player.frame; + +import android.graphics.Bitmap; +import android.graphics.Rect; +import android.util.Size; + +import androidx.annotation.VisibleForTesting; + +import org.chromium.base.Callback; +import org.chromium.base.UnguessableToken; +import org.chromium.components.paintpreview.player.PlayerCompositorDelegate; + +/** + * Manages the bitmaps shown in the PlayerFrameView at a given scale factor. + */ +public class PlayerFrameBitmapState { + private final UnguessableToken mGuid; + /** Dimension of tiles. */ + private final Size mTileSize; + /** The scale factor of bitmaps. */ + private float mScaleFactor; + /** Bitmaps that make up the contents. */ + private Bitmap[][] mBitmapMatrix; + /** Whether a request for a bitmap tile is pending. */ + private boolean[][] mPendingBitmapRequests; + /** + * Whether we currently need a bitmap tile. This is used for deleting bitmaps that we don't + * need and freeing up memory. + */ + @VisibleForTesting + boolean[][] mRequiredBitmaps; + /** Delegate for accessing native to request bitmaps. */ + private final PlayerCompositorDelegate mCompositorDelegate; + private final PlayerFrameMediatorDelegate mMediatorDelegate; + + PlayerFrameBitmapState(UnguessableToken guid, int tileWidth, int tileHeight, float scaleFactor, + Size contentSize, PlayerCompositorDelegate compositorDelegate, + PlayerFrameMediatorDelegate mediatorDelegate) { + mGuid = guid; + mTileSize = new Size(tileWidth, tileHeight); + mScaleFactor = scaleFactor; + mCompositorDelegate = compositorDelegate; + mMediatorDelegate = mediatorDelegate; + + // Each tile is as big as the initial view port. Here we determine the number of + // columns and rows for the current scale factor. + int rows = (int) Math.ceil((contentSize.getHeight() * scaleFactor) / tileHeight); + int cols = (int) Math.ceil((contentSize.getWidth() * scaleFactor) / tileWidth); + + mBitmapMatrix = new Bitmap[rows][cols]; + mPendingBitmapRequests = new boolean[rows][cols]; + mRequiredBitmaps = new boolean[rows][cols]; + } + + Bitmap[][] getMatrix() { + return mBitmapMatrix; + } + + Size getTileDimensions() { + return mTileSize; + } + + /** + * Clears state so in-flight requests abort upon return. + */ + void clear() { + mBitmapMatrix = null; + mRequiredBitmaps = null; + mPendingBitmapRequests = null; + } + + /** + * Clears all the required bitmaps before they are re-set in {@link #requestBitmapForRect()} + */ + void clearRequiredBitmaps() { + if (mRequiredBitmaps == null) return; + + for (int row = 0; row < mRequiredBitmaps.length; row++) { + for (int col = 0; col < mRequiredBitmaps[row].length; col++) { + mRequiredBitmaps[row][col] = false; + } + } + } + + /** + * Requests bitmaps for tiles that overlap with the provided rect. Also requests bitmaps for + * adjacent tiles. + * @param viewportRect The rect of the viewport for which bitmaps are needed. + */ + void requestBitmapForRect(Rect viewportRect) { + if (mRequiredBitmaps == null) return; + + final int rowStart = + Math.max(0, (int) Math.floor((double) viewportRect.top / mTileSize.getHeight())); + final int rowEnd = Math.min(mRequiredBitmaps.length, + (int) Math.ceil((double) viewportRect.bottom / mTileSize.getHeight())); + + final int colStart = + Math.max(0, (int) Math.floor((double) viewportRect.left / mTileSize.getWidth())); + final int colEnd = Math.min(mRequiredBitmaps[0].length, + (int) Math.ceil((double) viewportRect.right / mTileSize.getWidth())); + + for (int col = colStart; col < colEnd; col++) { + for (int row = rowStart; row < rowEnd; row++) { + requestBitmapForTile(row, col); + } + } + + // Request bitmaps for adjacent tiles that are not currently in the view port. The reason + // that we do this in a separate loop is to make sure bitmaps for tiles inside the view port + // are fetched first. + for (int col = colStart; col < colEnd; col++) { + for (int row = rowStart; row < rowEnd; row++) { + requestBitmapForAdjacentTiles(row, col); + } + } + } + + private void requestBitmapForAdjacentTiles(int row, int col) { + if (mBitmapMatrix == null) return; + + if (row > 0) { + requestBitmapForTile(row - 1, col); + } + if (row < mBitmapMatrix.length - 1) { + requestBitmapForTile(row + 1, col); + } + if (col > 0) { + requestBitmapForTile(row, col - 1); + } + if (col < mBitmapMatrix[row].length - 1) { + requestBitmapForTile(row, col + 1); + } + } + + private void requestBitmapForTile(int row, int col) { + if (mRequiredBitmaps == null) return; + + mRequiredBitmaps[row][col] = true; + if (mBitmapMatrix == null || mPendingBitmapRequests == null + || mBitmapMatrix[row][col] != null || mPendingBitmapRequests[row][col]) { + return; + } + + final int y = row * mTileSize.getHeight(); + final int x = col * mTileSize.getWidth(); + + BitmapRequestHandler bitmapRequestHandler = + new BitmapRequestHandler(row, col, mScaleFactor); + mPendingBitmapRequests[row][col] = true; + mCompositorDelegate.requestBitmap(mGuid, + new Rect(x, y, x + mTileSize.getWidth(), y + mTileSize.getHeight()), mScaleFactor, + bitmapRequestHandler, bitmapRequestHandler::onError); + } + + /** + * Remove previously fetched bitmaps that are no longer required according to + * {@link #mRequiredBitmaps}. + */ + private void deleteUnrequiredBitmaps() { + if (mBitmapMatrix == null) return; + + for (int row = 0; row < mBitmapMatrix.length; row++) { + for (int col = 0; col < mBitmapMatrix[row].length; col++) { + Bitmap bitmap = mBitmapMatrix[row][col]; + if (!mRequiredBitmaps[row][col] && bitmap != null) { + bitmap.recycle(); + mBitmapMatrix[row][col] = null; + } + } + } + } + + /** + * Used as the callback for bitmap requests from the Paint Preview compositor. + */ + private class BitmapRequestHandler implements Callback<Bitmap> { + int mRequestRow; + int mRequestCol; + float mRequestScaleFactor; + + private BitmapRequestHandler(int requestRow, int requestCol, float requestScaleFactor) { + mRequestRow = requestRow; + mRequestCol = requestCol; + mRequestScaleFactor = requestScaleFactor; + } + + /** + * Called when bitmap is successfully composited. + * @param result + */ + @Override + public void onResult(Bitmap result) { + if (result == null) { + onError(); + return; + } + if (mBitmapMatrix == null || !mPendingBitmapRequests[mRequestRow][mRequestCol] + || !mRequiredBitmaps[mRequestRow][mRequestCol]) { + result.recycle(); + deleteUnrequiredBitmaps(); + return; + } + + mPendingBitmapRequests[mRequestRow][mRequestCol] = false; + mBitmapMatrix[mRequestRow][mRequestCol] = result; + mMediatorDelegate.updateBitmapMatrix(mBitmapMatrix); + deleteUnrequiredBitmaps(); + } + + /** + * Called when there was an error compositing the bitmap. + */ + public void onError() { + if (mPendingBitmapRequests == null) return; + + // TODO(crbug.com/1021590): Handle errors. + assert mBitmapMatrix != null; + assert mBitmapMatrix[mRequestRow][mRequestCol] == null; + assert mPendingBitmapRequests[mRequestRow][mRequestCol]; + + mPendingBitmapRequests[mRequestRow][mRequestCol] = false; + } + } +}
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediator.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediator.java index 8a3a44f..fa0c7c89 100644 --- a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediator.java +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediator.java
@@ -13,7 +13,6 @@ import androidx.annotation.VisibleForTesting; -import org.chromium.base.Callback; import org.chromium.base.UnguessableToken; import org.chromium.components.paintpreview.player.OverscrollHandler; import org.chromium.components.paintpreview.player.PlayerCompositorDelegate; @@ -64,18 +63,6 @@ private final PlayerCompositorDelegate mCompositorDelegate; /** The viewport of this frame. */ private final PlayerFrameViewport mViewport; - /** Dimension of tiles. */ - private int[] mTileDimensions; - /** Bitmaps that make up the content of this frame. */ - private Bitmap[][] mBitmapMatrix; - /** Whether a request for a bitmap tile is pending. */ - private boolean[][] mPendingBitmapRequests; - /** - * Whether we currently need a bitmap tile. This is used for deleting bitmaps that we don't - * need and freeing up memory. - */ - @VisibleForTesting - boolean[][] mRequiredBitmaps; /** Handles scaling of bitmaps. */ private final Matrix mBitmapScaleMatrix = new Matrix(); @@ -85,6 +72,9 @@ /** Handles scaling. */ private final PlayerFrameScaleController mScaleController; + @VisibleForTesting + PlayerFrameBitmapState mBitmapState; + PlayerFrameMediator(PropertyModel model, PlayerCompositorDelegate compositorDelegate, PlayerFrameViewport viewport, OverScroller scroller, @Nullable Runnable userInteractionCallback, UnguessableToken frameGuid, @@ -215,65 +205,33 @@ @Override public void updateVisuals(boolean scaleUpdated) { final float scaleFactor = mViewport.getScale(); - if (scaleUpdated || mBitmapMatrix == null) { - // Each tile is as big as the initial view port. Here we determine the number of - // columns and rows for the current scale factor. - int rows = (int) Math.ceil( - (mContentSize.getHeight() * scaleFactor) / mViewport.getHeight()); - int cols = - (int) Math.ceil((mContentSize.getWidth() * scaleFactor) / mViewport.getWidth()); - mTileDimensions = new int[] {mViewport.getWidth(), mViewport.getHeight()}; - mBitmapMatrix = new Bitmap[rows][cols]; - mPendingBitmapRequests = new boolean[rows][cols]; - mRequiredBitmaps = new boolean[rows][cols]; + if (scaleUpdated || mBitmapState == null) { + if (mBitmapState != null) { + mBitmapState.clear(); + } + mBitmapState = + new PlayerFrameBitmapState(mGuid, mViewport.getWidth(), mViewport.getHeight(), + mViewport.getScale(), mContentSize, mCompositorDelegate, this); } Rect viewportRect = mViewport.asRect(); updateSubframes(viewportRect, mViewport.getScale()); // Let the view know |mViewport| changed. PropertyModelChangeProcessor is smart about // this and will only update the view if |mViewport|'s rect is actually changed. - mModel.set(PlayerFrameProperties.TILE_DIMENSIONS, mTileDimensions); + mModel.set(PlayerFrameProperties.TILE_DIMENSIONS, mBitmapState.getTileDimensions()); mModel.set(PlayerFrameProperties.VIEWPORT, mViewport.asRect()); // Clear the required bitmaps matrix. It will be updated in #requestBitmapForTile. - for (int row = 0; row < mRequiredBitmaps.length; row++) { - for (int col = 0; col < mRequiredBitmaps[row].length; col++) { - mRequiredBitmaps[row][col] = false; - } - } + mBitmapState.clearRequiredBitmaps(); // Request bitmaps for tiles inside the view port that don't already have a bitmap. - final int tileWidth = mTileDimensions[0]; - final int tileHeight = mTileDimensions[1]; - final int colStart = Math.max(0, (int) Math.floor((double) viewportRect.left / tileWidth)); - final int colEnd = Math.min(mRequiredBitmaps[0].length, - (int) Math.ceil((double) viewportRect.right / tileWidth)); - final int rowStart = Math.max(0, (int) Math.floor((double) viewportRect.top / tileHeight)); - final int rowEnd = Math.min(mRequiredBitmaps.length, - (int) Math.ceil((double) viewportRect.bottom / tileHeight)); - for (int col = colStart; col < colEnd; col++) { - for (int row = rowStart; row < rowEnd; row++) { - int tileLeft = col * tileWidth; - int tileTop = row * tileHeight; - requestBitmapForTile( - tileLeft, tileTop, tileWidth, tileHeight, row, col, scaleFactor); - } - } - - // Request bitmaps for adjacent tiles that are not currently in the view port. The reason - // that we do this in a separate loop is to make sure bitmaps for tiles inside the view port - // are fetched first. - for (int col = colStart; col < colEnd; col++) { - for (int row = rowStart; row < rowEnd; row++) { - requestBitmapForAdjacentTiles(tileWidth, tileHeight, row, col, scaleFactor); - } - } + mBitmapState.requestBitmapForRect(mViewport.asRect()); // If the scale factor is changed, the view should get the correct bitmap matrix. // TODO(crbug/1090804): "Double buffer" this such that there is no period where there is a // blank screen between scale finishing and new bitmaps being fetched. if (scaleUpdated) { - mModel.set(PlayerFrameProperties.BITMAP_MATRIX, mBitmapMatrix); + mModel.set(PlayerFrameProperties.BITMAP_MATRIX, mBitmapState.getMatrix()); } } @@ -294,6 +252,11 @@ } @Override + public void updateBitmapMatrix(Bitmap[][] bitmapMatrix) { + mModel.set(PlayerFrameProperties.BITMAP_MATRIX, bitmapMatrix); + } + + @Override public void updateSubframes(Rect viewport, float scaleFactor) { for (int i = 0; i < mSubFrameRects.size(); i++) { Rect subFrameScaledRect = mSubFrameScaledRects.get(i); @@ -363,111 +326,4 @@ (int) (((float) inRect.bottom) * scaleFactor)); } - private void requestBitmapForAdjacentTiles( - int tileWidth, int tileHeight, int row, int col, float scaleFactor) { - if (mBitmapMatrix == null) return; - - if (row > 0) { - requestBitmapForTile(col * tileWidth, (row - 1) * tileHeight, tileWidth, tileHeight, - row - 1, col, scaleFactor); - } - if (row < mBitmapMatrix.length - 1) { - requestBitmapForTile(col * tileWidth, (row + 1) * tileHeight, tileWidth, tileHeight, - row + 1, col, scaleFactor); - } - if (col > 0) { - requestBitmapForTile((col - 1) * tileWidth, row * tileHeight, tileWidth, tileHeight, - row, col - 1, scaleFactor); - } - if (col < mBitmapMatrix[row].length - 1) { - requestBitmapForTile((col + 1) * tileWidth, row * tileHeight, tileWidth, tileHeight, - row, col + 1, scaleFactor); - } - } - - private void requestBitmapForTile( - int x, int y, int width, int height, int row, int col, float scaleFactor) { - if (mRequiredBitmaps == null) return; - - mRequiredBitmaps[row][col] = true; - if (mBitmapMatrix == null || mPendingBitmapRequests == null - || mBitmapMatrix[row][col] != null || mPendingBitmapRequests[row][col]) { - return; - } - - BitmapRequestHandler bitmapRequestHandler = new BitmapRequestHandler(row, col, scaleFactor); - mPendingBitmapRequests[row][col] = true; - mCompositorDelegate.requestBitmap(mGuid, new Rect(x, y, x + width, y + height), scaleFactor, - bitmapRequestHandler, bitmapRequestHandler); - } - - /** - * Remove previously fetched bitmaps that are no longer required according to - * {@link #mRequiredBitmaps}. - */ - private void deleteUnrequiredBitmaps() { - for (int row = 0; row < mBitmapMatrix.length; row++) { - for (int col = 0; col < mBitmapMatrix[row].length; col++) { - Bitmap bitmap = mBitmapMatrix[row][col]; - if (!mRequiredBitmaps[row][col] && bitmap != null) { - bitmap.recycle(); - mBitmapMatrix[row][col] = null; - } - } - } - } - - /** - * Used as the callback for bitmap requests from the Paint Preview compositor. - */ - private class BitmapRequestHandler implements Callback<Bitmap>, Runnable { - int mRequestRow; - int mRequestCol; - float mRequestScaleFactor; - - private BitmapRequestHandler(int requestRow, int requestCol, float requestScaleFactor) { - mRequestRow = requestRow; - mRequestCol = requestCol; - mRequestScaleFactor = requestScaleFactor; - } - - /** - * Called when bitmap is successfully composited. - * @param result - */ - @Override - public void onResult(Bitmap result) { - if (result == null) { - run(); - return; - } - if (mViewport.getScale() != mRequestScaleFactor - || !mPendingBitmapRequests[mRequestRow][mRequestCol] - || !mRequiredBitmaps[mRequestRow][mRequestCol]) { - result.recycle(); - deleteUnrequiredBitmaps(); - return; - } - - mPendingBitmapRequests[mRequestRow][mRequestCol] = false; - mBitmapMatrix[mRequestRow][mRequestCol] = result; - mModel.set(PlayerFrameProperties.BITMAP_MATRIX, mBitmapMatrix); - deleteUnrequiredBitmaps(); - } - - /** - * Called when there was an error compositing the bitmap. - */ - @Override - public void run() { - if (mViewport.getScale() != mRequestScaleFactor) return; - - // TODO(crbug.com/1021590): Handle errors. - assert mBitmapMatrix != null; - assert mBitmapMatrix[mRequestRow][mRequestCol] == null; - assert mPendingBitmapRequests[mRequestRow][mRequestCol]; - - mPendingBitmapRequests[mRequestRow][mRequestCol] = false; - } - } }
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorDelegate.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorDelegate.java index c2840d4..e0773b5a 100644 --- a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorDelegate.java +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorDelegate.java
@@ -4,6 +4,7 @@ package org.chromium.components.paintpreview.player.frame; +import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.Rect; @@ -46,4 +47,9 @@ * redraw when scaling is finished if its layout size didn't change. */ void forceRedrawVisibleSubframes(); + + /** + * Updates the bitmap matrix in the model. + */ + void updateBitmapMatrix(Bitmap[][] bitmapMatrix); }
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameProperties.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameProperties.java index 0c3299c..f391765 100644 --- a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameProperties.java +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameProperties.java
@@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.Rect; +import android.util.Size; import android.view.View; import org.chromium.ui.modelutil.PropertyKey; @@ -22,7 +23,7 @@ static final PropertyModel.WritableObjectPropertyKey<Bitmap[][]> BITMAP_MATRIX = new PropertyModel.WritableObjectPropertyKey<>(true); /** The dimensions of each bitmap tile in the current bitmap matrix. */ - static final PropertyModel.WritableObjectPropertyKey<int[]> TILE_DIMENSIONS = + static final PropertyModel.WritableObjectPropertyKey<Size> TILE_DIMENSIONS = new PropertyModel.WritableObjectPropertyKey<>(); /** * Contains the current user-visible content window. The view should use this to draw the
diff --git a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameView.java b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameView.java index 048ce5ca..d3c18d9 100644 --- a/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameView.java +++ b/components/paint_preview/player/android/java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameView.java
@@ -9,6 +9,7 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Rect; +import android.util.Size; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; @@ -80,7 +81,7 @@ mBitmapPainter.updateBitmapMatrix(bitmapMatrix); } - void updateTileDimensions(int[] tileDimensions) { + void updateTileDimensions(Size tileDimensions) { mBitmapPainter.updateTileDimensions(tileDimensions); }
diff --git a/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainterTest.java b/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainterTest.java index 485b7fa..5577ee1 100644 --- a/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainterTest.java +++ b/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameBitmapPainterTest.java
@@ -8,6 +8,7 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; +import android.util.Size; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -99,7 +100,7 @@ PlayerFrameBitmapPainter painter = new PlayerFrameBitmapPainter(Mockito.mock(Runnable.class)); painter.updateBitmapMatrix(generateMockBitmapMatrix(2, 3)); - painter.updateTileDimensions(new int[] {10, -5}); + painter.updateTileDimensions(new Size(10, -5)); painter.updateViewPort(0, 5, 10, -10); MockCanvas canvas = new MockCanvas(); @@ -107,7 +108,7 @@ canvas.assertNumberOfBitmapDraws(0); // Update the view port so it is covered by 2 bitmap tiles. - painter.updateTileDimensions(new int[] {10, 10}); + painter.updateTileDimensions(new Size(10, 10)); painter.updateViewPort(0, 5, 10, 15); painter.onDraw(canvas); canvas.assertNumberOfBitmapDraws(2); @@ -123,7 +124,7 @@ painter.updateBitmapMatrix(new Bitmap[0][0]); // This view port is covered by 2 bitmap tiles, so there should be 2 draw operations on // the canvas. - painter.updateTileDimensions(new int[] {10, 10}); + painter.updateTileDimensions(new Size(10, 10)); painter.updateViewPort(0, 5, 10, 15); MockCanvas canvas = new MockCanvas(); @@ -156,7 +157,7 @@ bitmaps[1][1] = bitmap11; painter.updateBitmapMatrix(bitmaps); - painter.updateTileDimensions(new int[] {10, 15}); + painter.updateTileDimensions(new Size(10, 15)); painter.updateViewPort(5, 10, 15, 25); // Make sure the invalidator was called after updating the bitmap matrix and the view port.
diff --git a/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorTest.java b/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorTest.java index 25ccabde..1564d8c20 100644 --- a/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorTest.java +++ b/components/paint_preview/player/android/junit/src/org/chromium/components/paintpreview/player/frame/PlayerFrameMediatorTest.java
@@ -400,7 +400,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); mMediator.scrollBy(10, 15); // The current viewport covers portions of the 4 top left bitmap tiles. @@ -421,7 +422,8 @@ expectedRequiredBitmaps[1][2] = true; expectedRequiredBitmaps[2][0] = true; expectedRequiredBitmaps[2][1] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); mMediator.scrollBy(200, 400); // The current view port contains portions of the middle 4 tiles. @@ -454,7 +456,8 @@ expectedRequiredBitmaps[3][4] = true; expectedRequiredBitmaps[4][2] = true; expectedRequiredBitmaps[4][3] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); mMediator.scrollBy(200, 400); // The current view port contains portions of the 4 bottom right tiles. @@ -488,7 +491,8 @@ expectedRequiredBitmaps[5][3] = true; expectedRequiredBitmaps[5][4] = true; expectedRequiredBitmaps[5][5] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); } /** @@ -811,7 +815,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Now a scale factor of 2 will be applied. This will happen at a focal point of 0, 0. // The same bitmaps will be required but the grid will be double the size. @@ -822,7 +827,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Reduce the scale factor by 0.5 returning to a scale of 1. Assert.assertTrue(mMediator.scaleBy(0.5f, 0, 0)); @@ -832,7 +838,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Increase the scale factor to 6 which is above the maximum limit returning to a scale // of 5. Note that the grid is smaller than 30x30 as the viewport is not a multiple of the @@ -844,7 +851,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Reduce the scale factor back to 1. Assert.assertTrue(mMediator.scaleBy(0.2f, 0, 0)); @@ -854,7 +862,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // We now reduce the scale factor to less than mInitialScaleFactor; however, the maximum // scale out is limited to mInitialScaleFactor. @@ -866,7 +875,8 @@ expectedRequiredBitmaps = new boolean[2][1]; expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); } /** @@ -910,7 +920,8 @@ assertViewportStateIs(1f, 0f, 0f, mViewport); Assert.assertTrue(mModel.get(PlayerFrameProperties.SCALE_MATRIX).isIdentity()); // Ensure the correct bitmaps are required and requested. - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); Assert.assertEquals(expectedRequestedBitmaps, mCompositorDelegate.mRequestedBitmap); // STEP 2: Scroll slightly. @@ -933,7 +944,8 @@ expectedRequiredBitmaps[1][2] = true; expectedRequiredBitmaps[2][0] = true; expectedRequiredBitmaps[2][1] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); expectedRequestedBitmaps.add( new RequestedBitmap(mFrameGuid, getRectForTile(100, 200, 1, 1), 1f)); @@ -985,7 +997,8 @@ expectedRequiredBitmaps[1][2] = true; expectedRequiredBitmaps[2][0] = true; expectedRequiredBitmaps[2][1] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); expectedRequestedBitmaps.add( new RequestedBitmap(mFrameGuid, getRectForTile(100, 200, 0, 0), 2f)); @@ -1035,7 +1048,8 @@ expectedRequiredBitmaps[1][2] = true; expectedRequiredBitmaps[2][0] = true; expectedRequiredBitmaps[2][1] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); expectedRequestedBitmaps.add( new RequestedBitmap(mFrameGuid, getRectForTile(100, 200, 0, 0), 1f)); @@ -1098,7 +1112,8 @@ expectedRequiredBitmaps[2][3] = true; expectedRequiredBitmaps[3][1] = true; expectedRequiredBitmaps[3][2] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); expectedRequestedBitmaps.add( new RequestedBitmap(mFrameGuid, getRectForTile(100, 200, 1, 1), 2f)); @@ -1249,7 +1264,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Now a scale factor of 2 will be applied. This will happen at a focal point of 0, 0. // The same bitmaps will be required but the grid will be double the size. @@ -1267,7 +1283,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); // Reduce the scale factor by 0.5 returning to a scale of 1 but try to do so with a focal // point that causes translation outside the bounds. The focal point should be ignored. @@ -1284,7 +1301,8 @@ expectedRequiredBitmaps[0][0] = true; expectedRequiredBitmaps[0][1] = true; expectedRequiredBitmaps[1][0] = true; - Assert.assertTrue(Arrays.deepEquals(expectedRequiredBitmaps, mMediator.mRequiredBitmaps)); + Assert.assertTrue(Arrays.deepEquals( + expectedRequiredBitmaps, mMediator.mBitmapState.mRequiredBitmaps)); } /**
diff --git a/components/password_manager/core/browser/manage_passwords_referrer.h b/components/password_manager/core/browser/manage_passwords_referrer.h index d202ce9..80a2d352d 100644 --- a/components/password_manager/core/browser/manage_passwords_referrer.h +++ b/components/password_manager/core/browser/manage_passwords_referrer.h
@@ -42,7 +42,10 @@ // Corresponds to the touch to fill bottom sheet that replaces the dropdown. // Only used on Android. kTouchToFill = 7, - kMaxValue = kTouchToFill, + // The bubble notifying the user that the last compromised password was + // updated. + kSafeStateBubble = 8, + kMaxValue = kSafeStateBubble, }; } // namespace password_manager
diff --git a/components/performance_manager/test_support/performance_manager_test_harness.h b/components/performance_manager/test_support/performance_manager_test_harness.h index b40637b4..fa4128c 100644 --- a/components/performance_manager/test_support/performance_manager_test_harness.h +++ b/components/performance_manager/test_support/performance_manager_test_harness.h
@@ -16,7 +16,7 @@ // via content::RenderViewHostTestHarness::task_environment(). // // Meant to be used from components_unittests, but not from unit_tests or -// browser tests. +// browser tests. unit_tests should use PerformanceManagerTestHarnessHelper. // // To set the active WebContents for the test use: //
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index f0de848..97d959c 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -747,7 +747,7 @@ PolicyMap::Entry(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, base::Value(cd), nullptr)); - // Case 3 - policy::key::kExtensionInstallWhitelist + // Case 3 - policy::key::kExtensionInstallAllowlist // This policy is part of the atomic group "Extensions" and has a lower // source than policy::key::kExtensionInstallBlacklist from the same group, // its value should be ignored. @@ -768,7 +768,7 @@ policy_not_merged.Set(kTestPolicyName1, platform_user_mandatory.DeepCopy()); policy_not_merged.Set(policy::key::kExtensionInstallBlacklist, cloud_machine_mandatory.DeepCopy()); - policy_not_merged.Set(policy::key::kExtensionInstallWhitelist, + policy_not_merged.Set(policy::key::kExtensionInstallAllowlist, ad_machine_mandatory.DeepCopy()); policy_not_merged.Set(policy::key::kExtensionInstallForcelist, cloud_machine_recommended.DeepCopy()); @@ -783,7 +783,7 @@ platform_user_mandatory.DeepCopy()); expected_group_merged.Set(policy::key::kExtensionInstallBlacklist, cloud_machine_mandatory.DeepCopy()); - expected_group_merged.Set(policy::key::kExtensionInstallWhitelist, + expected_group_merged.Set(policy::key::kExtensionInstallAllowlist, ad_machine_mandatory_ignored.DeepCopy()); expected_group_merged.Set(policy::key::kExtensionInstallForcelist, cloud_machine_recommended.DeepCopy());
diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc index e895be48..776735b6 100644 --- a/components/policy/core/common/policy_service_impl.cc +++ b/components/policy/core/common/policy_service_impl.cc
@@ -297,6 +297,7 @@ policy_lists_to_merge.insert(key::kExtensionInstallForcelist); policy_lists_to_merge.insert(key::kExtensionInstallBlacklist); policy_lists_to_merge.insert(key::kExtensionInstallWhitelist); + policy_lists_to_merge.insert(key::kExtensionInstallAllowlist); } PolicyListMerger policy_list_merger(std::move(policy_lists_to_merge));
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc index daa9deac..6f9e5f9a 100644 --- a/components/policy/core/common/policy_service_impl_unittest.cc +++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -1062,7 +1062,7 @@ POLICY_SOURCE_CLOUD, std::move(list3), nullptr); policy_map2.Set(key::kExtensionInstallForcelist, entry_list_2.DeepCopy()); policy_map2.Set(key::kExtensionInstallBlacklist, entry_list_2.DeepCopy()); - policy_map2.Set(key::kExtensionInstallWhitelist, entry_list_3.DeepCopy()); + policy_map2.Set(key::kExtensionInstallAllowlist, entry_list_3.DeepCopy()); PolicyMap expected_chrome; expected_chrome.Set(key::kPolicyListMultipleSourceMergeList, @@ -1078,7 +1078,7 @@ merged.AddWarning(IDS_POLICY_CONFLICT_DIFF_VALUE); expected_chrome.Set(key::kExtensionInstallForcelist, merged.DeepCopy()); expected_chrome.Set(key::kExtensionInstallBlacklist, std::move(merged)); - expected_chrome.Set(key::kExtensionInstallWhitelist, std::move(entry_list_3)); + expected_chrome.Set(key::kExtensionInstallAllowlist, std::move(entry_list_3)); expected_chrome.Set(key::kPolicyAtomicGroupsEnabled, atomic_policy_enabled.DeepCopy()); @@ -1130,7 +1130,7 @@ POLICY_SOURCE_CLOUD, std::move(list3), nullptr); policy_map2.Set(key::kExtensionInstallForcelist, entry_list_2.DeepCopy()); policy_map2.Set(key::kExtensionInstallBlacklist, entry_list_2.DeepCopy()); - policy_map2.Set(key::kExtensionInstallWhitelist, entry_list_3.DeepCopy()); + policy_map2.Set(key::kExtensionInstallAllowlist, entry_list_3.DeepCopy()); PolicyMap expected_chrome; expected_chrome.Set(key::kPolicyListMultipleSourceMergeList, @@ -1147,7 +1147,7 @@ entry_list_3.SetIgnoredByPolicyAtomicGroup(); expected_chrome.Set(key::kExtensionInstallForcelist, merged.DeepCopy()); expected_chrome.Set(key::kExtensionInstallBlacklist, std::move(merged)); - expected_chrome.Set(key::kExtensionInstallWhitelist, std::move(entry_list_3)); + expected_chrome.Set(key::kExtensionInstallAllowlist, std::move(entry_list_3)); expected_chrome.Set(key::kPolicyAtomicGroupsEnabled, atomic_policy_enabled.DeepCopy());
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 919a242..ec0e74d 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -445,6 +445,7 @@ 'caption': '''Extensions''', 'desc': '''Configures extension-related policies. The user is not allowed to install blacklisted extensions unless they are whitelisted. You can also force <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> to automatically install extensions by specifying them in <ph name="EXTENSION_INSTALL_FORCELIST_POLICY_NAME">ExtensionInstallForcelist</ph>. Force-installed extensions are installed regardless whether they are present in the blacklist.''', 'policies': [ + 'ExtensionInstallAllowlist', 'ExtensionInstallBlacklist', 'ExtensionInstallWhitelist', 'ExtensionInstallForcelist', @@ -4286,6 +4287,30 @@ 'label': '''Extension IDs the user should be prevented from installing (or * for all)''', }, { + 'name': 'ExtensionInstallAllowlist', + 'owners': ['file://components/policy/resources/OWNERS'], + 'type': 'list', + 'schema': { + 'type': 'array', + 'items': { 'type': 'string' }, + }, + 'supported_on': ['chrome.*:86-', 'chrome_os:86-'], + 'features': { + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': ['extension_id1', 'extension_id2'], + 'id': 738, + 'caption': '''Configure extension installation allow list''', + 'tags': [], + 'desc': '''Allows you to specify which extensions are not subject to the blocklist. + + A blocklist value of * means all extensions are blocklisted and users can only install extensions listed in the allow list. + + By default, all extensions are allowed, but if all extensions have been blocklisted by policy, the allow list can be used to override that policy.''', + 'label': '''Extension IDs to exempt from the blocklist''', + }, + { 'name': 'ExtensionInstallWhitelist', 'owners': ['file://components/policy/resources/OWNERS'], 'type': 'list', @@ -4300,13 +4325,16 @@ }, 'example_value': ['extension_id1', 'extension_id2'], 'id': 33, + 'deprecated': True, 'caption': '''Configure extension installation whitelist''', 'tags': [], 'desc': '''Allows you to specify which extensions are not subject to the blacklist. A blacklist value of * means all extensions are blacklisted and users can only install extensions listed in the whitelist. - By default, all extensions are whitelisted, but if all extensions have been blacklisted by policy, the whitelist can be used to override that policy.''', + By default, all extensions are whitelisted, but if all extensions have been blacklisted by policy, the whitelist can be used to override that policy. + + This policy is deprecated in favor of <ph name="EXTENSION_INSTALL_ALLOWLIST_POLICY_NAME">ExtensionInstallAllowlist</ph>. If both <ph name="EXTENSION_INSTALL_WHITELIST_POLICY_NAME">ExtensionInstallWhitelist</ph> and <ph name="EXTENSION_INSTALL_ALLOWLIST_POLICY_NAME">ExtensionInstallAllowlist</ph> are set, <ph name="EXTENSION_INSTALL_ALLOWLIST_POLICY_NAME">ExtensionInstallAllowlist</ph> will be used and <ph name="EXTENSION_INSTALL_WHITELIST_POLICY_NAME">ExtensionInstallWhitelist</ph> ignored.''', 'label': '''Extension IDs to exempt from the blacklist''', }, { @@ -4607,7 +4635,7 @@ 'id': 544, 'caption': '''Merge extension install list policies from multiple sources''', 'tags': [], - 'desc': '''Enables merging of the extension install list policies <ph name="EXTENSION_INSTALL_BLACKLIST_POLICY_NAME">ExtensionInstallBlacklist</ph>, <ph name="EXTENSION_INSTALL_WHITELIST_POLICY_NAME">ExtensionInstallWhitelist</ph> and <ph name="EXTENSION_INSTALL_FORCELIST_POLICY_NAME">ExtensionInstallForcelist</ph>. + 'desc': '''Enables merging of the extension install list policies <ph name="EXTENSION_INSTALL_BLACKLIST_POLICY_NAME">ExtensionInstallBlacklist</ph>, <ph name="EXTENSION_INSTALL_ALLOWLIST_POLICY_NAME">ExtensionInstallAllowlist</ph> and <ph name="EXTENSION_INSTALL_FORCELIST_POLICY_NAME">ExtensionInstallForcelist</ph>. If you enable this setting, the values from machine platform policy, machine cloud policy and user platform policy are merged into a single list and used as a whole instead of only using the values from the single source with highest priority. @@ -7372,7 +7400,7 @@ 'dynamic_refresh': True, 'per_profile': True, }, - 'example_value': ['ExtensionInstallWhitelist', 'ExtensionInstallBlacklist'], + 'example_value': ['ExtensionInstallAllowlist', 'ExtensionInstallBlacklist'], 'id': 554, 'caption': '''Allow merging list policies from different sources''', 'tags': [], @@ -7466,7 +7494,7 @@ 'dynamic_refresh': True, 'per_profile': True, }, - 'example_value': ['ExtensionInstallWhitelist', 'ExtensionInstallBlacklist'], + 'example_value': ['ExtensionInstallAllowlist', 'ExtensionInstallBlacklist'], 'id': 711, 'caption': '''Enables experimental policies''', 'tags': [], @@ -22480,6 +22508,7 @@ 'name': 'Extensions', 'caption': '''Extensions''', 'policies': [ + 'ExtensionInstallAllowlist', 'ExtensionInstallBlacklist', 'ExtensionInstallWhitelist', 'ExtensionInstallForcelist', @@ -22880,6 +22909,6 @@ ], 'placeholders': [], 'deleted_policy_ids': [412, 476, 546, 562, 569, 578], - 'highest_id_currently_used': 737, + 'highest_id_currently_used': 738, 'highest_atomic_group_id_currently_used': 38 }
diff --git a/components/sessions/core/command_storage_backend.cc b/components/sessions/core/command_storage_backend.cc index 3fe6dff..e3f3ca64e 100644 --- a/components/sessions/core/command_storage_backend.cc +++ b/components/sessions/core/command_storage_backend.cc
@@ -358,6 +358,12 @@ DoInit(); } +void CommandStorageBackend::SetPath(const base::FilePath& path) { + // Do not change the path if the file is open + DCHECK(!file_); + path_ = path; +} + std::vector<std::unique_ptr<sessions::SessionCommand>> CommandStorageBackend::ReadCommandsFromFile( const base::FilePath& path,
diff --git a/components/sessions/core/command_storage_backend.h b/components/sessions/core/command_storage_backend.h index 922dc9f..3afb6bc0 100644 --- a/components/sessions/core/command_storage_backend.h +++ b/components/sessions/core/command_storage_backend.h
@@ -88,6 +88,10 @@ const base::FilePath& path() const { return path_; } + // Change the file path used to save the session. Must be called after closing + // the file first (CloseFile()) + void SetPath(const base::FilePath& path); + // Reads the commands from the specified file. If |crypto_key| is non-empty, // it is used to decrypt the file. std::vector<std::unique_ptr<sessions::SessionCommand>> ReadCommandsFromFile( @@ -133,7 +137,7 @@ bool IsEncrypted() const { return !crypto_key_.empty(); } // Path commands are saved to. - const base::FilePath path_; + base::FilePath path_; // This may be null, created as necessary. std::unique_ptr<base::File> file_;
diff --git a/components/sessions/core/session_constants.cc b/components/sessions/core/session_constants.cc index 52eb6816..d2a08a5 100644 --- a/components/sessions/core/session_constants.cc +++ b/components/sessions/core/session_constants.cc
@@ -6,14 +6,23 @@ namespace sessions { -const base::FilePath::StringPieceType kCurrentTabSessionFileName = +const base::FilePath::StringPieceType kSessionsDirectory = + FILE_PATH_LITERAL("Sessions"); + +const base::FilePath::StringPieceType kTabSessionFileNamePrefix = + FILE_PATH_LITERAL("Tabs"); + +const base::FilePath::StringPieceType kSessionFileNamePrefix = + FILE_PATH_LITERAL("Session"); + +const base::FilePath::StringPieceType kLegacyCurrentTabSessionFileName = FILE_PATH_LITERAL("Current Tabs"); -const base::FilePath::StringPieceType kLastTabSessionFileName = +const base::FilePath::StringPieceType kLegacyLastTabSessionFileName = FILE_PATH_LITERAL("Last Tabs"); -const base::FilePath::StringPieceType kCurrentSessionFileName = +const base::FilePath::StringPieceType kLegacyCurrentSessionFileName = FILE_PATH_LITERAL("Current Session"); -const base::FilePath::StringPieceType kLastSessionFileName = +const base::FilePath::StringPieceType kLegacyLastSessionFileName = FILE_PATH_LITERAL("Last Session"); const int gMaxPersistNavigationCount = 6;
diff --git a/components/sessions/core/session_constants.h b/components/sessions/core/session_constants.h index 5932a12..2dcc968 100644 --- a/components/sessions/core/session_constants.h +++ b/components/sessions/core/session_constants.h
@@ -10,17 +10,33 @@ namespace sessions { -// File names (current and previous) for a type of TAB. -extern const base::FilePath::StringPieceType SESSIONS_EXPORT - kCurrentTabSessionFileName; -extern const base::FilePath::StringPieceType SESSIONS_EXPORT - kLastTabSessionFileName; +// Directory under the profile directory to store session data. +// Added in Chrome 85. +extern const base::FilePath::StringPieceType SESSIONS_EXPORT kSessionsDirectory; -// File names (current and previous) for a type of SESSION. +// File name prefix for a type of TAB. +// Added in Chrome 85. extern const base::FilePath::StringPieceType SESSIONS_EXPORT - kCurrentSessionFileName; + kTabSessionFileNamePrefix; + +// File name prefix for a type of SESSION. +// Added in Chrome 85. extern const base::FilePath::StringPieceType SESSIONS_EXPORT - kLastSessionFileName; + kSessionFileNamePrefix; + +// Legacy file names (current and previous) for a type of TAB. +// Used before Chrome 85. +extern const base::FilePath::StringPieceType SESSIONS_EXPORT + kLegacyCurrentTabSessionFileName; +extern const base::FilePath::StringPieceType SESSIONS_EXPORT + kLegacyLastTabSessionFileName; + +// Legacy file names (current and previous) for a type of SESSION. +// Used before Chrome 85. +extern const base::FilePath::StringPieceType SESSIONS_EXPORT + kLegacyCurrentSessionFileName; +extern const base::FilePath::StringPieceType SESSIONS_EXPORT + kLegacyLastSessionFileName; // The maximum number of navigation entries in each direction to persist. extern const int SESSIONS_EXPORT gMaxPersistNavigationCount;
diff --git a/components/sessions/core/snapshotting_command_storage_backend.cc b/components/sessions/core/snapshotting_command_storage_backend.cc index 6a2701c..e5bb93d 100644 --- a/components/sessions/core/snapshotting_command_storage_backend.cc +++ b/components/sessions/core/snapshotting_command_storage_backend.cc
@@ -5,33 +5,50 @@ #include "components/sessions/core/snapshotting_command_storage_backend.h" #include "base/bind.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "build/build_config.h" #include "components/sessions/core/session_constants.h" namespace sessions { namespace { -base::FilePath GetCurrentFilePath( - SnapshottingCommandStorageManager::SessionType type, - const base::FilePath& base_path) { - base::FilePath path = base_path; - if (type == SnapshottingCommandStorageManager::TAB_RESTORE) - path = path.Append(kCurrentTabSessionFileName); - else - path = path.Append(kCurrentSessionFileName); - return path; +base::FilePath::StringType TimestampToString(const base::Time time) { +#if defined(OS_POSIX) || defined(OS_FUCHSIA) + return base::NumberToString(time.ToDeltaSinceWindowsEpoch().InMicroseconds()); +#elif defined(OS_WIN) + return base::NumberToString16( + time.ToDeltaSinceWindowsEpoch().InMicroseconds()); +#endif } -base::FilePath GetLastFilePath( - SnapshottingCommandStorageManager::SessionType type, - const base::FilePath& base_path) { - base::FilePath path = base_path; +base::FilePath::StringType GetSessionFilename( + const SnapshottingCommandStorageManager::SessionType type, + const base::FilePath::StringType& timestamp_str) { if (type == SnapshottingCommandStorageManager::TAB_RESTORE) - path = path.Append(kLastTabSessionFileName); - else - path = path.Append(kLastSessionFileName); - return path; + return base::JoinString({kTabSessionFileNamePrefix, timestamp_str}, + FILE_PATH_LITERAL("_")); + + return base::JoinString({kSessionFileNamePrefix, timestamp_str}, + FILE_PATH_LITERAL("_")); +} + +base::FilePath GetLegacySessionPath( + SnapshottingCommandStorageManager::SessionType type, + const base::FilePath& base_path, + bool current) { + base::FilePath session_path = base_path; + + if (type == SnapshottingCommandStorageManager::TAB_RESTORE) { + return session_path.Append(current ? kLegacyCurrentTabSessionFileName + : kLegacyLastTabSessionFileName); + } + return session_path.Append(current ? kLegacyCurrentSessionFileName + : kLegacyLastSessionFileName); } } // namespace @@ -40,42 +57,177 @@ scoped_refptr<base::SequencedTaskRunner> owning_task_runner, SnapshottingCommandStorageManager::SessionType type, const base::FilePath& path_to_dir) - : CommandStorageBackend(std::move(owning_task_runner), - GetCurrentFilePath(type, path_to_dir)), - last_file_path_(GetLastFilePath(type, path_to_dir)) { + : CommandStorageBackend( + std::move(owning_task_runner), + FilePathFromTime(type, path_to_dir, base::Time::Now())), + base_dir_(path_to_dir), + type_(type) { // NOTE: this is invoked on the main thread, don't do file access here. + + // We need to retrieve the timestamp after initializing the superclass. + if (!TimestampFromPath(path(), timestamp_)) + NOTREACHED(); +} + +// static +bool SnapshottingCommandStorageBackend::TimestampFromPath( + const base::FilePath& path, + base::Time& timestamp_result) { + auto parts = + base::SplitString(path.BaseName().value(), FILE_PATH_LITERAL("_"), + base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + if (parts.size() != 2u) + return false; + + int64_t result = 0u; + if (!base::StringToInt64(parts[1], &result)) + return false; + + timestamp_result = base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(result)); + return true; +} + +// static +base::FilePath SnapshottingCommandStorageBackend::FilePathFromTime( + const SnapshottingCommandStorageManager::SessionType type, + const base::FilePath& base_path, + base::Time time) { + return base_path.Append(kSessionsDirectory) + .Append(GetSessionFilename(type, TimestampToString(time))); } std::vector<std::unique_ptr<SessionCommand>> SnapshottingCommandStorageBackend::ReadLastSessionCommands() { InitIfNecessary(); - return ReadCommandsFromFile(last_file_path_, std::vector<uint8_t>()); + if (last_session_info_) + return ReadCommandsFromFile(last_session_info_->path, + std::vector<uint8_t>()); + else + return {}; } void SnapshottingCommandStorageBackend::DeleteLastSession() { InitIfNecessary(); - base::DeleteFile(last_file_path_); + if (last_session_info_) { + base::DeleteFile(last_session_info_->path); + last_session_info_.reset(); + } } void SnapshottingCommandStorageBackend::MoveCurrentSessionToLastSession() { InitIfNecessary(); CloseFile(); + DeleteLastSession(); - if (base::PathExists(last_file_path_)) - base::DeleteFile(last_file_path_); + // Move current session to last. if (base::PathExists(path())) - last_session_valid_ = base::Move(path(), last_file_path_); + last_session_info_ = SessionInfo{path(), timestamp_}; + else + last_session_info_.reset(); - if (base::PathExists(path())) - base::DeleteFile(path()); + // Create new file, ensuring the timestamp is after the previous. + // Due to clock changes, there might be an existing session with a later + // time. This is especially true on Windows, which uses the local time as + // the system clock. + base::Time new_timestamp = base::Time::Now(); + if (!last_session_info_ || last_session_info_->timestamp < new_timestamp) { + timestamp_ = new_timestamp; + } else { + timestamp_ = + last_session_info_->timestamp + base::TimeDelta::FromMicroseconds(1); + } + SetPath(FilePathFromTime(type_, base_dir_, timestamp_)); // Create and open the file for the current session. + DCHECK(!base::PathExists(path())); TruncateFile(); } void SnapshottingCommandStorageBackend::DoInit() { - MoveCurrentSessionToLastSession(); + // Find the last session. + DetermineLastSessionFile(); + if (last_session_info_) { + // Check that the last session's timestamp is before the current file's. + // This might not be true if the system clock has changed. + if (last_session_info_->timestamp > timestamp_) { + timestamp_ = + last_session_info_->timestamp + base::TimeDelta::FromMicroseconds(1); + SetPath(FilePathFromTime(type_, base_dir_, timestamp_)); + } + } + + // Best effort delete all sessions except the current & last. + DeleteLastSessionFiles(); + + // Create and open the file for the current session. + DCHECK(!base::PathExists(path())); + TruncateFile(); +} + +void SnapshottingCommandStorageBackend::DetermineLastSessionFile() { + last_session_info_.reset(); + + // Determine the session with the most recent timestamp that + // does not match the current session path. + for (const SnapshottingCommandStorageBackend::SessionInfo& session : + GetSessionFiles()) { + if (session.path != path()) { + if (!last_session_info_ || + session.timestamp > last_session_info_->timestamp) + last_session_info_ = session; + } + } + + // If no last session was found, use the legacy session if present. + // The legacy session is considered to have a timestamp of 0, before any + // new session. + if (!last_session_info_) { + base::FilePath legacy_session = + GetLegacySessionPath(type_, base_dir_, true); + if (base::PathExists(legacy_session)) + last_session_info_ = SessionInfo{legacy_session, base::Time()}; + } +} + +void SnapshottingCommandStorageBackend::DeleteLastSessionFiles() { + // Delete session files whose paths do not match the current + // or last session path. + for (const SnapshottingCommandStorageBackend::SessionInfo& session : + GetSessionFiles()) { + if (session.path != path() && + (!last_session_info_ || session.path != last_session_info_->path)) { + base::DeleteFile(session.path, false); + } + } + + // Delete legacy session files, unless they are being used. + base::FilePath current_session_path = + GetLegacySessionPath(type_, base_dir_, true); + if (last_session_info_ && current_session_path != last_session_info_->path && + base::PathExists(current_session_path)) + base::DeleteFile(current_session_path, false); + + base::FilePath last_session_path = + GetLegacySessionPath(type_, base_dir_, false); + if (base::PathExists(last_session_path)) + base::DeleteFile(last_session_path, false); +} + +std::vector<SnapshottingCommandStorageBackend::SessionInfo> +SnapshottingCommandStorageBackend::GetSessionFiles() { + std::vector<SnapshottingCommandStorageBackend::SessionInfo> sessions; + base::FileEnumerator file_enum( + base_dir_.Append(kSessionsDirectory), false, base::FileEnumerator::FILES, + GetSessionFilename(type_, FILE_PATH_LITERAL("*"))); + for (base::FilePath name = file_enum.Next(); !name.empty(); + name = file_enum.Next()) { + base::Time file_time; + if (TimestampFromPath(name, file_time)) + sessions.push_back(SessionInfo{name, file_time}); + } + return sessions; } SnapshottingCommandStorageBackend::~SnapshottingCommandStorageBackend() =
diff --git a/components/sessions/core/snapshotting_command_storage_backend.h b/components/sessions/core/snapshotting_command_storage_backend.h index 43cf5ce..13f9db69 100644 --- a/components/sessions/core/snapshotting_command_storage_backend.h +++ b/components/sessions/core/snapshotting_command_storage_backend.h
@@ -42,6 +42,15 @@ SnapshottingCommandStorageBackend& operator=( const SnapshottingCommandStorageBackend&) = delete; + // Parses out the timestamp from a path pointing to a session file. + static bool TimestampFromPath(const base::FilePath& path, base::Time& result); + + // Generates the path to a session file with the given timestamp. + static base::FilePath FilePathFromTime( + const SnapshottingCommandStorageManager::SessionType type, + const base::FilePath& base_path, + base::Time time); + // Returns the commands from the last session file. std::vector<std::unique_ptr<SessionCommand>> ReadLastSessionCommands(); @@ -61,13 +70,45 @@ SnapshottingCommandStorageBackend>; friend class base::DeleteHelper<SnapshottingCommandStorageBackend>; + FRIEND_TEST_ALL_PREFIXES(SnapshottingCommandStorageBackendTest, + ReadLegacySession); + FRIEND_TEST_ALL_PREFIXES(SnapshottingCommandStorageBackendTest, + DeterminePreviousSessionEmpty); + FRIEND_TEST_ALL_PREFIXES(SnapshottingCommandStorageBackendTest, + DeterminePreviousSessionSingle); + FRIEND_TEST_ALL_PREFIXES(SnapshottingCommandStorageBackendTest, + DeterminePreviousSessionMultiple); + FRIEND_TEST_ALL_PREFIXES(SnapshottingCommandStorageBackendTest, + DeterminePreviousSessionInvalid); + ~SnapshottingCommandStorageBackend() override; - // Directory files are relative to. - const base::FilePath last_file_path_; + // Represents data for a session. + struct SessionInfo { + base::FilePath path; + base::Time timestamp; + }; - // Whether the previous target file is valid. - bool last_session_valid_ = false; + // Gets data for the last session file. + void DetermineLastSessionFile(); + + // Attempt to delete all sessions besides the current and last. This is a + // best effort operation. + void DeleteLastSessionFiles(); + + // Gets all sessions files. + std::vector<SessionInfo> GetSessionFiles(); + + // Timestamp when this session was started. + base::Time timestamp_; + + // Directory files are relative to. + const base::FilePath base_dir_; + + // Data for the last session. If unset, fallback to legacy session data. + base::Optional<SessionInfo> last_session_info_; + + const SnapshottingCommandStorageManager::SessionType type_; }; } // namespace sessions
diff --git a/components/sessions/core/snapshotting_session_backend_unittest.cc b/components/sessions/core/snapshotting_session_backend_unittest.cc index 14bea8b..87c3226 100644 --- a/components/sessions/core/snapshotting_session_backend_unittest.cc +++ b/components/sessions/core/snapshotting_session_backend_unittest.cc
@@ -15,6 +15,7 @@ #include "base/strings/string_util.h" #include "base/test/bind_test_util.h" #include "base/test/task_environment.h" +#include "components/sessions/core/session_constants.h" #include "testing/gtest/include/gtest/gtest.h" using base::MakeRefCounted; @@ -212,4 +213,167 @@ commands.clear(); } +// Test parsing the timestamp of a session from the path. +TEST_F(SnapshottingCommandStorageBackendTest, TimestampFromPath) { + const auto base_dir = base::FilePath(kSessionsDirectory); + + // Test parsing the timestamp from a valid session. + const auto test_path_1 = base_dir.Append(FILE_PATH_LITERAL("Tabs_0")); + base::Time result_time_1; + EXPECT_TRUE(SnapshottingCommandStorageBackend::TimestampFromPath( + test_path_1, result_time_1)); + EXPECT_EQ(base::Time(), result_time_1); + + const auto test_path_2 = + base_dir.Append(FILE_PATH_LITERAL("Session_13234316721694577")); + base::Time result_time_2; + EXPECT_TRUE(SnapshottingCommandStorageBackend::TimestampFromPath( + test_path_2, result_time_2)); + EXPECT_EQ(base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(13234316721694577)), + result_time_2); + + // Test attempting to parse invalid file names. + const auto invalid_path_1 = + base_dir.Append(FILE_PATH_LITERAL("Session_nonsense")); + base::Time invalid_result_1; + EXPECT_FALSE(SnapshottingCommandStorageBackend::TimestampFromPath( + invalid_path_1, invalid_result_1)); + + const auto invalid_path_2 = base_dir.Append(FILE_PATH_LITERAL("Arbitrary")); + base::Time invalid_result_2; + EXPECT_FALSE(SnapshottingCommandStorageBackend::TimestampFromPath( + invalid_path_2, invalid_result_2)); +} + +// Test serializing a timestamp to string. +TEST_F(SnapshottingCommandStorageBackendTest, FilePathFromTime) { + const auto base_dir = base::FilePath(kSessionsDirectory); + const auto test_time_1 = base::Time(); + const auto result_path_1 = + SnapshottingCommandStorageBackend::FilePathFromTime( + SnapshottingCommandStorageManager::SessionType::SESSION_RESTORE, + base::FilePath(), test_time_1); + EXPECT_EQ(base_dir.Append(FILE_PATH_LITERAL("Session_0")), result_path_1); + + const auto test_time_2 = base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(13234316721694577)); + const auto result_path_2 = + SnapshottingCommandStorageBackend::FilePathFromTime( + SnapshottingCommandStorageManager::SessionType::TAB_RESTORE, + base::FilePath(), test_time_2); + EXPECT_EQ(base_dir.Append(FILE_PATH_LITERAL("Tabs_13234316721694577")), + result_path_2); +} + +// Test migrating a session from the old format. +TEST_F(SnapshottingCommandStorageBackendTest, ReadLegacySession) { + // Create backend with some data. + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + + // Set to legacy path for testing. + const auto legacy_path = path_.Append(kLegacyCurrentSessionFileName); + backend->SetPath(legacy_path); + + const struct TestData first_data = {1, "a"}; + SessionCommands commands; + commands.push_back(CreateCommandFromData(first_data)); + backend->AppendCommands(std::move(commands), true); + EXPECT_TRUE(base::PathExists(legacy_path)); + + // Reset backend and ensure we loaded from the legacy session. + backend = nullptr; + backend = CreateBackend(); + commands = backend->ReadLastSessionCommands(); + ASSERT_EQ(1U, commands.size()); + AssertCommandEqualsData(first_data, commands[0].get()); + commands.clear(); + + // Add data to new session. + struct TestData second_data = {2, "b"}; + commands.push_back(CreateCommandFromData(second_data)); + backend->AppendCommands(std::move(commands), true); + EXPECT_TRUE(base::PathExists(legacy_path)); + + // Reset backend and ensure we loaded from the newer session, not the legacy + // one. + backend = nullptr; + backend = CreateBackend(); + commands = backend->ReadLastSessionCommands(); + ASSERT_EQ(1U, commands.size()); + AssertCommandEqualsData(second_data, commands[0].get()); + EXPECT_FALSE(base::PathExists(legacy_path)); +} + +// Test that the previous session is empty if no session files exist. +TEST_F(SnapshottingCommandStorageBackendTest, DeterminePreviousSessionEmpty) { + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + backend->DetermineLastSessionFile(); + ASSERT_FALSE(backend->last_session_info_); +} + +// Test that the previous session is selected correctly when a file is present. +TEST_F(SnapshottingCommandStorageBackendTest, DeterminePreviousSessionSingle) { + const auto prev_path = + path_.Append(base::FilePath(kSessionsDirectory) + .Append(FILE_PATH_LITERAL("Session_13235178308836991"))); + ASSERT_TRUE(base::CreateDirectory(prev_path.DirName())); + ASSERT_EQ(0, base::WriteFile(prev_path, "", 0)); + + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + backend->DetermineLastSessionFile(); + ASSERT_TRUE(backend->last_session_info_); + ASSERT_EQ(prev_path, backend->last_session_info_->path); +} + +// Test that the previous session is selected correctly when multiple session +// files are present. +TEST_F(SnapshottingCommandStorageBackendTest, + DeterminePreviousSessionMultiple) { + const auto sessions_dir = path_.Append(base::FilePath(kSessionsDirectory)); + const auto prev_path = + sessions_dir.Append(FILE_PATH_LITERAL("Session_13235178308836991")); + const auto old_path_1 = + sessions_dir.Append(FILE_PATH_LITERAL("Session_13235178308548874")); + const auto old_path_2 = sessions_dir.Append(FILE_PATH_LITERAL("Session_0")); + ASSERT_TRUE(base::CreateDirectory(prev_path.DirName())); + ASSERT_EQ(0, base::WriteFile(prev_path, "", 0)); + ASSERT_EQ(0, base::WriteFile(old_path_1, "", 0)); + ASSERT_EQ(0, base::WriteFile(old_path_2, "", 0)); + + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + backend->DetermineLastSessionFile(); + ASSERT_TRUE(backend->last_session_info_); + ASSERT_EQ(prev_path, backend->last_session_info_->path); +} + +// Test that the a file with an invalid name won't be used. +TEST_F(SnapshottingCommandStorageBackendTest, DeterminePreviousSessionInvalid) { + const auto prev_path = + path_.Append(base::FilePath(kSessionsDirectory) + .Append(FILE_PATH_LITERAL("Session_invalid"))); + ASSERT_TRUE(base::CreateDirectory(prev_path.DirName())); + ASSERT_EQ(0, base::WriteFile(prev_path, "", 0)); + + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + backend->DetermineLastSessionFile(); + ASSERT_FALSE(backend->last_session_info_); +} + +// Tests that MoveCurrentSessionToLastSession deletes the last session file. +TEST_F(SnapshottingCommandStorageBackendTest, + MoveCurrentSessionToLastDeletesLastSession) { + const auto sessions_dir = path_.Append(base::FilePath(kSessionsDirectory)); + const auto last_session = + sessions_dir.Append(FILE_PATH_LITERAL("Session_13235178308548874")); + ASSERT_TRUE(base::CreateDirectory(last_session.DirName())); + ASSERT_EQ(0, base::WriteFile(last_session, "", 0)); + + scoped_refptr<SnapshottingCommandStorageBackend> backend = CreateBackend(); + char buffer[1]; + ASSERT_EQ(0, base::ReadFile(last_session, buffer, 0)); + backend->MoveCurrentSessionToLastSession(); + ASSERT_EQ(-1, base::ReadFile(last_session, buffer, 0)); +} + } // namespace sessions
diff --git a/components/update_client/background_downloader_win.cc b/components/update_client/background_downloader_win.cc index 8743cc8..c180215 100644 --- a/components/update_client/background_downloader_win.cc +++ b/components/update_client/background_downloader_win.cc
@@ -20,7 +20,6 @@ #include "base/files/file_util.h" #include "base/location.h" #include "base/logging.h" -#include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/sequenced_task_runner.h" #include "base/strings/string_piece.h" @@ -396,7 +395,7 @@ } // namespace BackgroundDownloader::BackgroundDownloader( - std::unique_ptr<CrxDownloader> successor) + scoped_refptr<CrxDownloader> successor) : CrxDownloader(std::move(successor)), com_task_runner_(base::ThreadPool::CreateCOMSTATaskRunner( kTaskTraitsBackgroundDownloader)), @@ -417,15 +416,14 @@ void BackgroundDownloader::OnTimer() { DCHECK(thread_checker_.CalledOnValidThread()); com_task_runner_->PostTask( - FROM_HERE, base::BindOnce(&BackgroundDownloader::OnDownloading, - base::Unretained(this))); + FROM_HERE, base::BindOnce(&BackgroundDownloader::OnDownloading, this)); } void BackgroundDownloader::DoStartDownload(const GURL& url) { DCHECK(thread_checker_.CalledOnValidThread()); com_task_runner_->PostTask( - FROM_HERE, base::BindOnce(&BackgroundDownloader::BeginDownload, - base::Unretained(this), url)); + FROM_HERE, + base::BindOnce(&BackgroundDownloader::BeginDownload, this, url)); } // Called one time when this class is asked to do a download. @@ -444,9 +442,8 @@ VLOG(1) << "Starting BITS download for: " << url.spec(); ResetInterfacePointers(); - main_task_runner()->PostTask(FROM_HERE, - base::BindOnce(&BackgroundDownloader::StartTimer, - base::Unretained(this))); + main_task_runner()->PostTask( + FROM_HERE, base::BindOnce(&BackgroundDownloader::StartTimer, this)); } // Creates or opens an existing BITS job to download the |url|, and handles @@ -535,9 +532,8 @@ return; ResetInterfacePointers(); - main_task_runner()->PostTask(FROM_HERE, - base::BindOnce(&BackgroundDownloader::StartTimer, - base::Unretained(this))); + main_task_runner()->PostTask( + FROM_HERE, base::BindOnce(&BackgroundDownloader::StartTimer, this)); } // Completes the BITS download, picks up the file path of the response, and @@ -582,9 +578,8 @@ if (!result.error) result.response = response_; main_task_runner()->PostTask( - FROM_HERE, base::BindOnce(&BackgroundDownloader::OnDownloadComplete, - base::Unretained(this), is_handled, result, - download_metrics)); + FROM_HERE, base::BindOnce(&BackgroundDownloader::OnDownloadComplete, this, + is_handled, result, download_metrics)); // Once the task is posted to the the main thread, this object may be deleted // by its owner. It is not safe to access members of this object on this task @@ -666,9 +661,8 @@ GetJobByteCount(job_, &downloaded_bytes, &total_bytes); main_task_runner()->PostTask( - FROM_HERE, - base::BindOnce(&BackgroundDownloader::OnDownloadProgress, - base::Unretained(this), downloaded_bytes, total_bytes)); + FROM_HERE, base::BindOnce(&BackgroundDownloader::OnDownloadProgress, this, + downloaded_bytes, total_bytes)); return false; }
diff --git a/components/update_client/background_downloader_win.h b/components/update_client/background_downloader_win.h index 28b969386..4e0b396 100644 --- a/components/update_client/background_downloader_win.h +++ b/components/update_client/background_downloader_win.h
@@ -11,7 +11,6 @@ #include <memory> -#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "base/threading/thread_checker.h" @@ -39,11 +38,11 @@ // the BITS service. class BackgroundDownloader : public CrxDownloader { public: - explicit BackgroundDownloader(std::unique_ptr<CrxDownloader> successor); - ~BackgroundDownloader() override; + explicit BackgroundDownloader(scoped_refptr<CrxDownloader> successor); private: // Overrides for CrxDownloader. + ~BackgroundDownloader() override; void DoStartDownload(const GURL& url) override; // Called asynchronously on the |com_task_runner_| at different stages during @@ -148,8 +147,6 @@ // Contains the path of the downloaded file if the download was successful. base::FilePath response_; - - DISALLOW_COPY_AND_ASSIGN(BackgroundDownloader); }; } // namespace update_client
diff --git a/components/update_client/component.cc b/components/update_client/component.cc index 294b9da..07268c7 100644 --- a/components/update_client/component.cc +++ b/components/update_client/component.cc
@@ -759,7 +759,7 @@ for (const auto& download_metrics : crx_downloader_->download_metrics()) component.AppendEvent(component.MakeEventDownloadMetrics(download_metrics)); - crx_downloader_.reset(); + crx_downloader_ = nullptr; if (download_result.error) { DCHECK(download_result.response.empty()); @@ -832,7 +832,7 @@ for (const auto& download_metrics : crx_downloader_->download_metrics()) component.AppendEvent(component.MakeEventDownloadMetrics(download_metrics)); - crx_downloader_.reset(); + crx_downloader_ = nullptr; if (download_result.error) { DCHECK(download_result.response.empty());
diff --git a/components/update_client/component.h b/components/update_client/component.h index 9323a36..cc263f4 100644 --- a/components/update_client/component.h +++ b/components/update_client/component.h
@@ -14,7 +14,6 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "base/gtest_prod_util.h" -#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/optional.h" #include "base/sequence_checker.h" @@ -45,6 +44,8 @@ using CallbackHandleComplete = base::OnceCallback<void()>; Component(const UpdateContext& update_context, const std::string& id); + Component(const Component&) = delete; + Component& operator=(const Component&) = delete; ~Component(); // Handles the current state of the component and makes it transition @@ -183,18 +184,20 @@ class StateNew : public State { public: explicit StateNew(Component* component); + StateNew(const StateNew&) = delete; + StateNew& operator=(const StateNew&) = delete; ~StateNew() override; private: // State overrides. void DoHandle() override; - - DISALLOW_COPY_AND_ASSIGN(StateNew); }; class StateChecking : public State { public: explicit StateChecking(Component* component); + StateChecking(const StateChecking&) = delete; + StateChecking& operator=(const StateChecking&) = delete; ~StateChecking() override; private: @@ -202,50 +205,50 @@ void DoHandle() override; void UpdateCheckComplete(); - - DISALLOW_COPY_AND_ASSIGN(StateChecking); }; class StateUpdateError : public State { public: explicit StateUpdateError(Component* component); + StateUpdateError(const StateUpdateError&) = delete; + StateUpdateError& operator=(const StateUpdateError&) = delete; ~StateUpdateError() override; private: // State overrides. void DoHandle() override; - - DISALLOW_COPY_AND_ASSIGN(StateUpdateError); }; class StateCanUpdate : public State { public: explicit StateCanUpdate(Component* component); + StateCanUpdate(const StateCanUpdate&) = delete; + StateCanUpdate& operator=(const StateCanUpdate&) = delete; ~StateCanUpdate() override; private: // State overrides. void DoHandle() override; bool CanTryDiffUpdate() const; - - DISALLOW_COPY_AND_ASSIGN(StateCanUpdate); }; class StateUpToDate : public State { public: explicit StateUpToDate(Component* component); + StateUpToDate(const StateUpToDate&) = delete; + StateUpToDate& operator=(const StateUpToDate&) = delete; ~StateUpToDate() override; private: // State overrides. void DoHandle() override; - - DISALLOW_COPY_AND_ASSIGN(StateUpToDate); }; class StateDownloadingDiff : public State { public: explicit StateDownloadingDiff(Component* component); + StateDownloadingDiff(const StateDownloadingDiff&) = delete; + StateDownloadingDiff& operator=(const StateDownloadingDiff&) = delete; ~StateDownloadingDiff() override; private: @@ -260,14 +263,14 @@ void DownloadComplete(const CrxDownloader::Result& download_result); // Downloads updates for one CRX id only. - std::unique_ptr<CrxDownloader> crx_downloader_; - - DISALLOW_COPY_AND_ASSIGN(StateDownloadingDiff); + scoped_refptr<CrxDownloader> crx_downloader_; }; class StateDownloading : public State { public: explicit StateDownloading(Component* component); + StateDownloading(const StateDownloading&) = delete; + StateDownloading& operator=(const StateDownloading&) = delete; ~StateDownloading() override; private: @@ -282,14 +285,14 @@ void DownloadComplete(const CrxDownloader::Result& download_result); // Downloads updates for one CRX id only. - std::unique_ptr<CrxDownloader> crx_downloader_; - - DISALLOW_COPY_AND_ASSIGN(StateDownloading); + scoped_refptr<CrxDownloader> crx_downloader_; }; class StateUpdatingDiff : public State { public: explicit StateUpdatingDiff(Component* component); + StateUpdatingDiff(const StateUpdatingDiff&) = delete; + StateUpdatingDiff& operator=(const StateUpdatingDiff&) = delete; ~StateUpdatingDiff() override; private: @@ -300,13 +303,13 @@ void InstallComplete(ErrorCategory error_category, int error_code, int extra_code1); - - DISALLOW_COPY_AND_ASSIGN(StateUpdatingDiff); }; class StateUpdating : public State { public: explicit StateUpdating(Component* component); + StateUpdating(const StateUpdating&) = delete; + StateUpdating& operator=(const StateUpdating&) = delete; ~StateUpdating() override; private: @@ -317,37 +320,37 @@ void InstallComplete(ErrorCategory error_category, int error_code, int extra_code1); - - DISALLOW_COPY_AND_ASSIGN(StateUpdating); }; class StateUpdated : public State { public: explicit StateUpdated(Component* component); + StateUpdated(const StateUpdated&) = delete; + StateUpdated& operator=(const StateUpdated&) = delete; ~StateUpdated() override; private: // State overrides. void DoHandle() override; - - DISALLOW_COPY_AND_ASSIGN(StateUpdated); }; class StateUninstalled : public State { public: explicit StateUninstalled(Component* component); + StateUninstalled(const StateUninstalled&) = delete; + StateUninstalled& operator=(const StateUninstalled&) = delete; ~StateUninstalled() override; private: // State overrides. void DoHandle() override; - - DISALLOW_COPY_AND_ASSIGN(StateUninstalled); }; class StateRun : public State { public: explicit StateRun(Component* component); + StateRun(const StateRun&) = delete; + StateRun& operator=(const StateRun&) = delete; ~StateRun() override; private: @@ -359,8 +362,6 @@ // Runs the action referred by the |action_run_| member of the Component // class. std::unique_ptr<ActionRunner> action_runner_; - - DISALLOW_COPY_AND_ASSIGN(StateRun); }; // Returns true is the update payload for this component can be downloaded @@ -479,8 +480,6 @@ // True if this component has reached a final state because all its states // have been handled. bool is_handled_ = false; - - DISALLOW_COPY_AND_ASSIGN(Component); }; using IdToComponentPtrMap = std::map<std::string, std::unique_ptr<Component>>;
diff --git a/components/update_client/crx_downloader.cc b/components/update_client/crx_downloader.cc index bb1fe04..5d634b5 100644 --- a/components/update_client/crx_downloader.cc +++ b/components/update_client/crx_downloader.cc
@@ -33,15 +33,16 @@ // On Windows, the first downloader in the chain is a background downloader, // which uses the BITS service. -std::unique_ptr<CrxDownloader> CrxDownloader::Create( +scoped_refptr<CrxDownloader> CrxDownloader::Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - std::unique_ptr<CrxDownloader> url_fetcher_downloader = - std::make_unique<UrlFetcherDownloader>(nullptr, network_fetcher_factory); + scoped_refptr<CrxDownloader> url_fetcher_downloader = + base::MakeRefCounted<UrlFetcherDownloader>(nullptr, + network_fetcher_factory); #if defined(OS_WIN) if (is_background_download) { - return std::make_unique<BackgroundDownloader>( + return base::MakeRefCounted<BackgroundDownloader>( std::move(url_fetcher_downloader)); } #endif @@ -49,7 +50,7 @@ return url_fetcher_downloader; } -CrxDownloader::CrxDownloader(std::unique_ptr<CrxDownloader> successor) +CrxDownloader::CrxDownloader(scoped_refptr<CrxDownloader> successor) : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), successor_(std::move(successor)) {} @@ -86,7 +87,7 @@ void CrxDownloader::StartDownload(const std::vector<GURL>& urls, const std::string& expected_hash, DownloadCallback download_callback) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto error = CrxDownloaderError::NONE; if (urls.empty()) { @@ -115,23 +116,22 @@ bool is_handled, const Result& result, const DownloadMetrics& download_metrics) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!result.error) base::ThreadPool::PostTask( FROM_HERE, kTaskTraits, - base::BindOnce(&CrxDownloader::VerifyResponse, base::Unretained(this), - is_handled, result, download_metrics)); + base::BindOnce(&CrxDownloader::VerifyResponse, this, is_handled, result, + download_metrics)); else main_task_runner()->PostTask( - FROM_HERE, base::BindOnce(&CrxDownloader::HandleDownloadError, - base::Unretained(this), is_handled, result, - download_metrics)); + FROM_HERE, base::BindOnce(&CrxDownloader::HandleDownloadError, this, + is_handled, result, download_metrics)); } void CrxDownloader::OnDownloadProgress(int64_t downloaded_bytes, int64_t total_bytes) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (progress_callback_.is_null()) return; @@ -164,16 +164,15 @@ result.response.clear(); main_task_runner()->PostTask( - FROM_HERE, base::BindOnce(&CrxDownloader::HandleDownloadError, - base::Unretained(this), is_handled, result, - download_metrics)); + FROM_HERE, base::BindOnce(&CrxDownloader::HandleDownloadError, this, + is_handled, result, download_metrics)); } void CrxDownloader::HandleDownloadError( bool is_handled, const Result& result, const DownloadMetrics& download_metrics) { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_NE(0, result.error); DCHECK(result.response.empty()); DCHECK_NE(0, download_metrics.error);
diff --git a/components/update_client/crx_downloader.h b/components/update_client/crx_downloader.h index 983c222..b0c8a81 100644 --- a/components/update_client/crx_downloader.h +++ b/components/update_client/crx_downloader.h
@@ -13,10 +13,9 @@ #include "base/callback.h" #include "base/files/file_path.h" -#include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" -#include "base/threading/thread_checker.h" #include "url/gurl.h" namespace update_client { @@ -33,7 +32,7 @@ // the order they are provided in the StartDownload function argument. After // that, the download request is routed to the next downloader in the chain. // The members of this class expect to be called from the main thread only. -class CrxDownloader { +class CrxDownloader : public base::RefCountedThreadSafe<CrxDownloader> { public: struct DownloadMetrics { enum Downloader { kNone = 0, kUrlFetcher, kBits }; @@ -78,18 +77,20 @@ int64_t total_bytes)>; using Factory = - std::unique_ptr<CrxDownloader> (*)(bool, - scoped_refptr<NetworkFetcherFactory>); + scoped_refptr<CrxDownloader> (*)(bool, + scoped_refptr<NetworkFetcherFactory>); + + CrxDownloader(const CrxDownloader&) = delete; + CrxDownloader& operator=(const CrxDownloader&) = delete; // Factory method to create an instance of this class and build the // chain of responsibility. |is_background_download| specifies that a // background downloader be used, if the platform supports it. // |task_runner| should be a task runner able to run blocking // code such as file IO operations. - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory); - virtual ~CrxDownloader(); void set_progress_callback(const ProgressCallback& progress_callback); @@ -108,7 +109,8 @@ const std::vector<DownloadMetrics> download_metrics() const; protected: - explicit CrxDownloader(std::unique_ptr<CrxDownloader> successor); + explicit CrxDownloader(scoped_refptr<CrxDownloader> successor); + virtual ~CrxDownloader(); // Handles the fallback in the case of multiple urls and routing of the // download to the following successor in the chain. Derived classes must call @@ -133,6 +135,8 @@ } private: + friend class base::RefCountedThreadSafe<CrxDownloader>; + virtual void DoStartDownload(const GURL& url) = 0; void VerifyResponse(bool is_handled, @@ -143,7 +147,7 @@ const Result& result, const DownloadMetrics& download_metrics); - base::ThreadChecker thread_checker_; + SEQUENCE_CHECKER(sequence_checker_); // Used to post callbacks to the main thread. scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; @@ -152,15 +156,13 @@ // The SHA256 hash of the download payload in hexadecimal format. std::string expected_hash_; - std::unique_ptr<CrxDownloader> successor_; + scoped_refptr<CrxDownloader> successor_; DownloadCallback download_callback_; ProgressCallback progress_callback_; std::vector<GURL>::iterator current_url_; std::vector<DownloadMetrics> download_metrics_; - - DISALLOW_COPY_AND_ASSIGN(CrxDownloader); }; } // namespace update_client
diff --git a/components/update_client/crx_downloader_unittest.cc b/components/update_client/crx_downloader_unittest.cc index 52eac3e0a..b6478d4 100644 --- a/components/update_client/crx_downloader_unittest.cc +++ b/components/update_client/crx_downloader_unittest.cc
@@ -4,7 +4,6 @@ #include "components/update_client/crx_downloader.h" -#include <memory> #include <utility> #include "base/bind.h" @@ -69,7 +68,7 @@ int net_error); protected: - std::unique_ptr<CrxDownloader> crx_downloader_; + scoped_refptr<CrxDownloader> crx_downloader_; network::TestURLLoaderFactory test_url_loader_factory_; @@ -120,7 +119,7 @@ } void CrxDownloaderTest::TearDown() { - crx_downloader_.reset(); + crx_downloader_ = nullptr; } void CrxDownloaderTest::Quit() { @@ -175,6 +174,7 @@ RunThreadsUntilIdle(); } +// TODO(crbug.com/1104691): rewrite the tests to not use RunUntilIdle(). void CrxDownloaderTest::RunThreadsUntilIdle() { task_environment_.RunUntilIdle(); base::RunLoop().RunUntilIdle();
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc index c8fdcf6..8f4cbac 100644 --- a/components/update_client/update_client_unittest.cc +++ b/components/update_client/update_client_unittest.cc
@@ -11,7 +11,6 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/location.h" -#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/optional.h" #include "base/path_service.h" @@ -136,6 +135,8 @@ }; explicit MockPingManagerImpl(scoped_refptr<Configurator> config); + MockPingManagerImpl(const MockPingManagerImpl&) = delete; + MockPingManagerImpl& operator=(const MockPingManagerImpl&) = delete; void SendPing(const Component& component, Callback callback) override; @@ -149,7 +150,6 @@ private: std::vector<PingData> ping_data_; std::vector<base::Value> events_; - DISALLOW_COPY_AND_ASSIGN(MockPingManagerImpl); }; MockPingManagerImpl::MockPingManagerImpl(scoped_refptr<Configurator> config) @@ -188,6 +188,8 @@ class UpdateClientTest : public testing::Test { public: UpdateClientTest(); + UpdateClientTest(const UpdateClientTest&) = delete; + UpdateClientTest& operator=(const UpdateClientTest&) = delete; ~UpdateClientTest() override; protected: @@ -213,8 +215,6 @@ base::MakeRefCounted<TestConfigurator>(pref_.get()); std::unique_ptr<update_client::PersistedData> metadata_ = std::make_unique<PersistedData>(pref_.get(), nullptr); - - DISALLOW_COPY_AND_ASSIGN(UpdateClientTest); }; constexpr int UpdateClientTest::kNumWorkerThreads_; @@ -307,15 +307,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -487,15 +489,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; download_metrics.url = url; @@ -730,15 +734,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; download_metrics.url = url; @@ -963,15 +969,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -1125,15 +1133,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { NOTREACHED(); } }; @@ -1326,15 +1336,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -1648,15 +1660,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -2007,15 +2021,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; download_metrics.url = url; @@ -2276,15 +2292,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -2544,15 +2562,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -2727,15 +2747,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -2909,15 +2931,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { NOTREACHED(); } }; @@ -3054,15 +3078,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -3164,15 +3190,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -3226,14 +3254,15 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { return nullptr; } - private: MockCrxDownloader() : CrxDownloader(nullptr) {} + + private: ~MockCrxDownloader() override = default; void DoStartDownload(const GURL& url) override {} @@ -3358,15 +3387,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -3601,15 +3632,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -3797,15 +3830,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -3967,15 +4002,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -4150,15 +4187,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { DownloadMetrics download_metrics; FilePath path; @@ -4324,15 +4363,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } }; @@ -4501,15 +4542,17 @@ class MockCrxDownloader : public CrxDownloader { public: - static std::unique_ptr<CrxDownloader> Create( + static scoped_refptr<CrxDownloader> Create( bool is_background_download, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) { - return std::make_unique<MockCrxDownloader>(); + return base::MakeRefCounted<MockCrxDownloader>(); } MockCrxDownloader() : CrxDownloader(nullptr) {} private: + ~MockCrxDownloader() override = default; + void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } };
diff --git a/components/update_client/url_fetcher_downloader.cc b/components/update_client/url_fetcher_downloader.cc index fe05941..906738a 100644 --- a/components/update_client/url_fetcher_downloader.cc +++ b/components/update_client/url_fetcher_downloader.cc
@@ -21,23 +21,21 @@ namespace update_client { UrlFetcherDownloader::UrlFetcherDownloader( - std::unique_ptr<CrxDownloader> successor, + scoped_refptr<CrxDownloader> successor, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory) : CrxDownloader(std::move(successor)), network_fetcher_factory_(network_fetcher_factory) {} UrlFetcherDownloader::~UrlFetcherDownloader() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void UrlFetcherDownloader::DoStartDownload(const GURL& url) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); base::ThreadPool::PostTaskAndReply( FROM_HERE, kTaskTraits, - base::BindOnce(&UrlFetcherDownloader::CreateDownloadDir, - base::Unretained(this)), - base::BindOnce(&UrlFetcherDownloader::StartURLFetch, - base::Unretained(this), url)); + base::BindOnce(&UrlFetcherDownloader::CreateDownloadDir, this), + base::BindOnce(&UrlFetcherDownloader::StartURLFetch, this, url)); } void UrlFetcherDownloader::CreateDownloadDir() { @@ -46,7 +44,7 @@ } void UrlFetcherDownloader::StartURLFetch(const GURL& url) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (download_dir_.empty()) { Result result; @@ -62,8 +60,7 @@ main_task_runner()->PostTask( FROM_HERE, base::BindOnce(&UrlFetcherDownloader::OnDownloadComplete, - base::Unretained(this), false, result, - download_metrics)); + this, false, result, download_metrics)); return; } @@ -71,19 +68,16 @@ network_fetcher_ = network_fetcher_factory_->Create(); network_fetcher_->DownloadToFile( url, file_path_, - base::BindOnce(&UrlFetcherDownloader::OnResponseStarted, - base::Unretained(this)), - base::BindRepeating(&UrlFetcherDownloader::OnDownloadProgress, - base::Unretained(this)), - base::BindOnce(&UrlFetcherDownloader::OnNetworkFetcherComplete, - base::Unretained(this))); + base::BindOnce(&UrlFetcherDownloader::OnResponseStarted, this), + base::BindRepeating(&UrlFetcherDownloader::OnDownloadProgress, this), + base::BindOnce(&UrlFetcherDownloader::OnNetworkFetcherComplete, this)); download_start_time_ = base::TimeTicks::Now(); } void UrlFetcherDownloader::OnNetworkFetcherComplete(int net_error, int64_t content_size) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); const base::TimeTicks download_end_time(base::TimeTicks::Now()); const base::TimeDelta download_time = @@ -131,15 +125,15 @@ } main_task_runner()->PostTask( - FROM_HERE, base::BindOnce(&UrlFetcherDownloader::OnDownloadComplete, - base::Unretained(this), is_handled, result, - download_metrics)); + FROM_HERE, base::BindOnce(&UrlFetcherDownloader::OnDownloadComplete, this, + is_handled, result, download_metrics)); + network_fetcher_ = nullptr; } // This callback is used to indicate that a download has been started. void UrlFetcherDownloader::OnResponseStarted(int response_code, int64_t content_length) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); VLOG(1) << "url fetcher response started for: " << url().spec(); @@ -148,7 +142,7 @@ } void UrlFetcherDownloader::OnDownloadProgress(int64_t current) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); CrxDownloader::OnDownloadProgress(current, total_bytes_); }
diff --git a/components/update_client/url_fetcher_downloader.h b/components/update_client/url_fetcher_downloader.h index eedee7f7..111aa4a6 100644 --- a/components/update_client/url_fetcher_downloader.h +++ b/components/update_client/url_fetcher_downloader.h
@@ -10,9 +10,8 @@ #include <memory> #include "base/files/file_path.h" -#include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "base/time/time.h" #include "components/update_client/crx_downloader.h" @@ -25,12 +24,14 @@ class UrlFetcherDownloader : public CrxDownloader { public: UrlFetcherDownloader( - std::unique_ptr<CrxDownloader> successor, + scoped_refptr<CrxDownloader> successor, scoped_refptr<NetworkFetcherFactory> network_fetcher_factory); - ~UrlFetcherDownloader() override; + UrlFetcherDownloader(const UrlFetcherDownloader&) = delete; + UrlFetcherDownloader& operator=(const UrlFetcherDownloader&) = delete; private: // Overrides for CrxDownloader. + ~UrlFetcherDownloader() override; void DoStartDownload(const GURL& url) override; void CreateDownloadDir(); @@ -39,7 +40,7 @@ void OnResponseStarted(int response_code, int64_t content_length); void OnDownloadProgress(int64_t content_length); - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); scoped_refptr<NetworkFetcherFactory> network_fetcher_factory_; std::unique_ptr<NetworkFetcher> network_fetcher_; @@ -54,8 +55,6 @@ int response_code_ = -1; int64_t total_bytes_ = -1; - - DISALLOW_COPY_AND_ASSIGN(UrlFetcherDownloader); }; } // namespace update_client
diff --git a/components/viz/OWNERS b/components/viz/OWNERS index e39a0ed..af9a9b1 100644 --- a/components/viz/OWNERS +++ b/components/viz/OWNERS
@@ -7,7 +7,6 @@ # display / resources / quads / passes danakj@chromium.org -ericrk@chromium.org vmpstr@chromium.org weiliangc@chromium.org @@ -28,12 +27,10 @@ # frame sinks / surfaces kylechar@chromium.org -samans@chromium.org jonross@chromium.org # gpu danakj@chromium.org -ericrk@chromium.org sadrul@chromium.org kylechar@chromium.org
diff --git a/components/viz/common/frame_sinks/begin_frame_args.h b/components/viz/common/frame_sinks/begin_frame_args.h index 3fa20066..613d760c 100644 --- a/components/viz/common/frame_sinks/begin_frame_args.h +++ b/components/viz/common/frame_sinks/begin_frame_args.h
@@ -6,7 +6,9 @@ #define COMPONENTS_VIZ_COMMON_FRAME_SINKS_BEGIN_FRAME_ARGS_H_ #include <stdint.h> + #include <memory> +#include <string> #include "base/location.h" #include "base/memory/ref_counted.h"
diff --git a/components/viz/common/frame_sinks/begin_frame_source.cc b/components/viz/common/frame_sinks/begin_frame_source.cc index b3ca047..e3bd48a 100644 --- a/components/viz/common/frame_sinks/begin_frame_source.cc +++ b/components/viz/common/frame_sinks/begin_frame_source.cc
@@ -6,6 +6,10 @@ #include <stddef.h> +#include <algorithm> +#include <memory> +#include <utility> + #include "base/atomic_sequence_num.h" #include "base/auto_reset.h" #include "base/check_op.h"
diff --git a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl_unittest.cc b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl_unittest.cc index 21ef53a9..5685eddc 100644 --- a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl_unittest.cc +++ b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl_unittest.cc
@@ -4,6 +4,7 @@ #include "components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.h" +#include <string> #include <utility> #include <vector>
diff --git a/components/webrtc/android/java/src/org/chromium/components/webrtc/MediaCaptureNotificationUtil.java b/components/webrtc/android/java/src/org/chromium/components/webrtc/MediaCaptureNotificationUtil.java index 8cfc9b4..826c28a08 100644 --- a/components/webrtc/android/java/src/org/chromium/components/webrtc/MediaCaptureNotificationUtil.java +++ b/components/webrtc/android/java/src/org/chromium/components/webrtc/MediaCaptureNotificationUtil.java
@@ -13,8 +13,8 @@ import androidx.core.app.NotificationCompat; import org.chromium.base.ContextUtils; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.url_formatter.SchemeDisplay; import org.chromium.components.url_formatter.UrlFormatter; @@ -41,7 +41,7 @@ * @param contentIntent the intent to be sent when the notification is clicked. * @param stopIntent if non-null, a stop button that triggers this intent will be added. */ - public static ChromeNotification createNotification(ChromeNotificationBuilder builder, + public static NotificationWrapper createNotification(NotificationWrapperBuilder builder, @MediaType int mediaType, @Nullable String url, @Nullable String appName, @Nullable PendingIntentProvider contentIntent, @Nullable PendingIntent stopIntent) { Context appContext = ContextUtils.getApplicationContext();
diff --git a/content/browser/devtools/protocol/system_info_handler.cc b/content/browser/devtools/protocol/system_info_handler.cc index 58256d8..a49b881 100644 --- a/content/browser/devtools/protocol/system_info_handler.cc +++ b/content/browser/devtools/protocol/system_info_handler.cc
@@ -302,7 +302,7 @@ base::CommandLine* command = base::CommandLine::ForCurrentProcess(); // Only wait for DX12/Vulkan info if requested at Chrome start up. if (!command->HasSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection) && + switches::kDisableGpuProcessForDX12InfoCollection) && command->HasSwitch(switches::kNoDelayForDX12VulkanInfoCollection) && !GpuDataManagerImpl::GetInstance()->IsDx12VulkanVersionAvailable()) return;
diff --git a/content/browser/frame_host/OWNERS b/content/browser/frame_host/OWNERS index db989f80..ac5a766 100644 --- a/content/browser/frame_host/OWNERS +++ b/content/browser/frame_host/OWNERS
@@ -5,8 +5,6 @@ arthursonzogni@chromium.org # For surface ID propagation and synchronization -per-file render_widget_host_view_guest*=fsamuel@chromium.org -per-file render_widget_host_view_guest*=samans@chromium.org per-file render_widget_host_view_guest*=jonross@chromium.org # For compositing and input related changes.
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 169f172..c4c5c35 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -717,7 +717,7 @@ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection)) { + switches::kDisableGpuProcessForDX12InfoCollection)) { manager->UpdateDx12RequestStatus(false); return; } @@ -778,14 +778,6 @@ if (manager->VulkanRequested()) return; - base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection)) { - manager->UpdateVulkanRequestStatus(false); - return; - } - // No info collection for software GL implementation (id == 0xffff) or // abnormal situation (id == 0). There are a few crash reports on // exit_or_terminate_process() during process teardown. The GPU ID
diff --git a/content/browser/media/media_interface_proxy.cc b/content/browser/media/media_interface_proxy.cc index a2fe709..222a421 100644 --- a/content/browser/media/media_interface_proxy.cc +++ b/content/browser/media/media_interface_proxy.cc
@@ -22,6 +22,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/service_process_host.h" #include "content/public/common/content_client.h" +#include "media/base/cdm_context.h" #include "media/mojo/buildflags.h" #include "media/mojo/mojom/frame_interface_factory.mojom.h" #include "media/mojo/mojom/media_service.mojom.h" @@ -49,6 +50,9 @@ #if defined(OS_MACOSX) #include "sandbox/mac/seatbelt_extension.h" #endif // defined(OS_MACOSX) +#if defined(OS_CHROMEOS) +#include "chromeos/constants/chromeos_features.h" +#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) #if defined(OS_ANDROID) @@ -220,6 +224,11 @@ #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(OS_MACOSX) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(OS_CHROMEOS) +constexpr char kChromeOsCdmFileSystemId[] = + "application_chromeos-cdm-factory-daemon"; +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(OS_CHROMEOS) + // The amount of time to allow the secondary Media Service instance to idle // before tearing it down. Only used if the Content embedder defines how to // launch a secondary Media Service instance. @@ -309,9 +318,17 @@ DVLOG(1) << __func__; DCHECK(render_frame_host_); +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) && defined(OS_CHROMEOS) + // The file system ID passed in here is only used by the CDM obtained through + // the |media_interface_factory_ptr_|. + auto frame_factory_getter = base::BindRepeating( + &MediaInterfaceProxy::GetFrameServices, base::Unretained(this), + base::Token(), kChromeOsCdmFileSystemId); +#else auto frame_factory_getter = base::BindRepeating(&MediaInterfaceProxy::GetFrameServices, base::Unretained(this), base::Token(), std::string()); +#endif media_interface_factory_ptr_ = std::make_unique<MediaInterfaceFactoryHolder>( base::BindRepeating(&GetMediaService), frame_factory_getter); secondary_interface_factory_ = std::make_unique<MediaInterfaceFactoryHolder>( @@ -417,6 +434,22 @@ CreateCdmCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); #if BUILDFLAG(ENABLE_LIBRARY_CDMS) +#if defined(OS_CHROMEOS) + // TODO(jkardatzke): Conditionalize this on |cdm_config.use_hw_secure_codecs| + if (base::FeatureList::IsEnabled(chromeos::features::kCdmFactoryDaemon)) { + auto* factory = media_interface_factory_ptr_->Get(); + if (factory) { + // We need to intercept the callback in this case so we can fallback to + // the library CDM in case of failure. + factory->CreateCdm( + key_system, cdm_config, + base::BindOnce(&MediaInterfaceProxy::OnChromeOsCdmCreated, + weak_factory_.GetWeakPtr(), key_system, cdm_config, + std::move(callback))); + return; + } + } +#endif // defined(OS_CHROMEOS) auto* factory = GetCdmFactory(key_system); #elif BUILDFLAG(ENABLE_CAST_RENDERER) // CDM service lives together with renderer service if cast renderer is @@ -429,8 +462,14 @@ auto* factory = media_interface_factory_ptr_->Get(); #endif - if (factory) - factory->CreateCdm(key_system, cdm_config, std::move(callback)); + if (!factory) { + std::move(callback).Run(mojo::NullRemote(), + media::CdmContext::kInvalidCdmId, + mojo::NullRemote(), "Unable to find a CDM factory"); + return; + } + + factory->CreateCdm(key_system, cdm_config, std::move(callback)); } mojo::PendingRemote<media::mojom::FrameInterfaceFactory> @@ -525,6 +564,35 @@ cdm_factory_map_.erase(cdm_guid); } +#if defined(OS_CHROMEOS) +void MediaInterfaceProxy::OnChromeOsCdmCreated( + const std::string& key_system, + const media::CdmConfig& cdm_config, + CreateCdmCallback callback, + mojo::PendingRemote<media::mojom::ContentDecryptionModule> receiver, + int32_t cdm_id, + mojo::PendingRemote<media::mojom::Decryptor> decryptor, + const std::string& error_message) { + if (receiver) { + // Success case, just pass it back through the callback. + std::move(callback).Run(std::move(receiver), cdm_id, std::move(decryptor), + error_message); + return; + } + + // We failed creating a CDM with the Chrome OS daemon, fallback to the library + // CDM interface. + VLOG(1) << "Failed creating Chrome OS CDM, will use library CDM"; + auto* factory = GetCdmFactory(key_system); + if (!factory) { + std::move(callback).Run(mojo::NullRemote(), + media::CdmContext::kInvalidCdmId, + mojo::NullRemote(), "Unable to find a CDM factory"); + return; + } + factory->CreateCdm(key_system, cdm_config, std::move(callback)); +} +#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } // namespace content
diff --git a/content/browser/media/media_interface_proxy.h b/content/browser/media/media_interface_proxy.h index 67e27219..4398d53 100644 --- a/content/browser/media/media_interface_proxy.h +++ b/content/browser/media/media_interface_proxy.h
@@ -10,6 +10,7 @@ #include <vector> #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" #include "base/token.h" #include "base/unguessable_token.h" @@ -18,6 +19,7 @@ #include "media/media_buildflags.h" #include "media/mojo/buildflags.h" #include "media/mojo/mojom/content_decryption_module.mojom.h" +#include "media/mojo/mojom/decryptor.mojom.h" #include "media/mojo/mojom/interface_factory.mojom.h" #include "media/mojo/services/media_service.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -104,6 +106,20 @@ // Callback for connection error from the CdmFactoryPtr in the // |cdm_factory_map_| associated with |cdm_guid|. void OnCdmServiceConnectionError(const base::Token& cdm_guid); + +#if defined(OS_CHROMEOS) + // Callback for for Chrome OS CDM creation to facilitate falling back to the + // library CDM if the daemon is unavailable or other settings prevent usage of + // it. + void OnChromeOsCdmCreated( + const std::string& key_system, + const media::CdmConfig& cdm_config, + CreateCdmCallback callback, + mojo::PendingRemote<media::mojom::ContentDecryptionModule> receiver, + int32_t cdm_id, + mojo::PendingRemote<media::mojom::Decryptor> decryptor, + const std::string& error_message); +#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) // Safe to hold a raw pointer since |this| is owned by RenderFrameHostImpl. @@ -137,6 +153,8 @@ // Receivers for incoming interface requests from the the RenderFrameImpl. mojo::ReceiverSet<media::mojom::InterfaceFactory> receivers_; + base::WeakPtrFactory<MediaInterfaceProxy> weak_factory_{this}; + DISALLOW_COPY_AND_ASSIGN(MediaInterfaceProxy); };
diff --git a/content/browser/renderer_host/OWNERS b/content/browser/renderer_host/OWNERS index 36f34e3..7e5ad01 100644 --- a/content/browser/renderer_host/OWNERS +++ b/content/browser/renderer_host/OWNERS
@@ -9,7 +9,6 @@ ccameron@chromium.org # for *android* -per-file *android*=ericrk@chromium.org per-file *android*=khushalsagar@chromium.org # For touch/gesture specific changes @@ -17,13 +16,9 @@ sadrul@chromium.org # For surface ID propagation and synchronization -fsamuel@chromium.org -samans@chromium.org jonross@chromium.org # DelegatedFrame* -per-file *delegated_frame*=fsamuel@chromium.org -per-file *delegated_frame*=samans@chromium.org per-file *delegated_frame*=jonross@chromium.org # WebSQL
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 83b8576..3378de15 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1092,11 +1092,6 @@ return; if (delegate_) delegate_->Detach(this); - - CancelActiveAndPendingDialogs(); - // Since |dialog_manager_| was provided by |delegate_|, reset it. - dialog_manager_ = nullptr; - delegate_ = delegate; if (delegate_) { delegate_->Attach(this); @@ -1174,8 +1169,9 @@ } void WebContentsImpl::CancelActiveAndPendingDialogs() { - if (dialog_manager_) + if (dialog_manager_) { dialog_manager_->CancelDialogs(this, /*reset_state=*/false); + } if (browser_plugin_embedder_) browser_plugin_embedder_->CancelGuestDialogs(); }
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index f5dc80e1..1adea5b 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -518,8 +518,8 @@ // Respect the MacOS system setting for subpixel text anti-aliasing. // https://crbug.com/1079418. -const base::Feature kRespectMacLCDTextSetting{ - "RespectMacLCDTextSetting", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kRespectMacLCDTextSetting{"RespectMacLCDTextSetting", + base::FEATURE_ENABLED_BY_DEFAULT}; // Run video capture service in the Browser process as opposed to a dedicated // utility process
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index f64ec8f..ae723a9 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc
@@ -362,11 +362,9 @@ disabled_features); } - // Always disable the unsandbox GPU process for DX12 and Vulkan Info - // collection to avoid interference. This GPU process is launched 120 - // seconds after chrome starts. - command_line->AppendSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection); + // Always disable the unsandbox GPU process for DX12 Info collection to avoid + // interference. This GPU process is launched 120 seconds after chrome starts. + command_line->AppendSwitch(switches::kDisableGpuProcessForDX12InfoCollection); // The current global field trial list contains any trials that were activated // prior to main browser startup. That global field trial list is about to be
diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index 6a8be563..08b0876 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc
@@ -266,11 +266,9 @@ void AppendCommandLineSwitches() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - // Always disable the unsandbox GPU process for DX12 and Vulkan Info - // collection to avoid interference. This GPU process is launched 120 - // seconds after chrome starts. - command_line->AppendSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection); + // Always disable the unsandbox GPU process for DX12 Info collection to avoid + // interference. This GPU process is launched 120 seconds after chrome starts. + command_line->AppendSwitch(switches::kDisableGpuProcessForDX12InfoCollection); } } // namespace
diff --git a/content/renderer/OWNERS b/content/renderer/OWNERS index a97b9653..904c6c6 100644 --- a/content/renderer/OWNERS +++ b/content/renderer/OWNERS
@@ -8,18 +8,6 @@ per-file BUILD.gn=* # For surface ID propagation and synchronization -per-file render_frame_proxy*=fsamuel@chromium.org -per-file render_view_impl*=fsamuel@chromium.org -per-file render_widget*=fsamuel@chromium.org -per-file child_frame_compositor*=fsamuel@chromium.org -per-file child_frame_compositing_helper*=fsamuel@chromium.org -per-file render_frame_metadata*=fsamuel@chromium.org -per-file render_frame_proxy*=samans@chromium.org -per-file render_view_impl*=samans@chromium.org -per-file render_widget*=samans@chromium.org -per-file child_frame_compositor*=samans@chromium.org -per-file child_frame_compositing_helper*=samans@chromium.org -per-file render_frame_metadata*=samans@chromium.org per-file render_frame_proxy*=jonross@chromium.org per-file render_view_impl*=jonross@chromium.org per-file render_widget*=jonross@chromium.org @@ -37,4 +25,3 @@ # For security review. per-file browser_exposed_renderer_interfaces.cc=set noparent per-file browser_exposed_renderer_interfaces.cc=file://ipc/SECURITY_OWNERS -
diff --git a/content/renderer/compositor/OWNERS b/content/renderer/compositor/OWNERS index e5db14ab..1b8decb 100644 --- a/content/renderer/compositor/OWNERS +++ b/content/renderer/compositor/OWNERS
@@ -1,11 +1,8 @@ enne@chromium.org -ericrk@chromium.org kbr@chromium.org vmpstr@chromium.org # For surface synchronization -fsamuel@chromium.org -samans@chromium.org jonross@chromium.org # COMPONENT: Internals>Compositing
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 18b21cb..2af21278c 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -2619,7 +2619,7 @@ return PP_FALSE; blink::WebScreenInfo info = render_frame_->GetLocalRootRenderWidget()->GetScreenInfo(); - *size = PP_MakeSize(info.rect.width, info.rect.height); + *size = PP_MakeSize(info.rect.width(), info.rect.height()); } return PP_TRUE; } @@ -3203,7 +3203,7 @@ blink::WebScreenInfo info = render_frame_->GetLocalRootRenderWidget()->GetScreenInfo(); - screen_size_for_fullscreen_ = gfx::Size(info.rect.width, info.rect.height); + screen_size_for_fullscreen_ = info.rect.size(); std::string width = base::NumberToString(screen_size_for_fullscreen_.width()); std::string height = base::NumberToString(screen_size_for_fullscreen_.height());
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index dd9a3d1..2b6bff2 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -1378,8 +1378,8 @@ web_screen_info.depth = info.depth; web_screen_info.depth_per_component = info.depth_per_component; web_screen_info.is_monochrome = info.is_monochrome; - web_screen_info.rect = blink::WebRect(info.rect); - web_screen_info.available_rect = blink::WebRect(info.available_rect); + web_screen_info.rect = info.rect; + web_screen_info.available_rect = info.available_rect; switch (info.orientation_type) { case SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY: web_screen_info.orientation_type =
diff --git a/content/shell/browser/web_test/web_test_browser_main_runner.cc b/content/shell/browser/web_test/web_test_browser_main_runner.cc index 270a8cb0..413f7d6 100644 --- a/content/shell/browser/web_test/web_test_browser_main_runner.cc +++ b/content/shell/browser/web_test/web_test_browser_main_runner.cc
@@ -132,11 +132,9 @@ command_line.AppendSwitch( switches::kDisableBackgroundingOccludedWindowsForTesting); - // Always disable the unsandbox GPU process for DX12 and Vulkan Info - // collection to avoid interference. This GPU process is launched 120 - // seconds after chrome starts. - command_line.AppendSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection); + // Always disable the unsandbox GPU process for DX12 Info collection to avoid + // interference. This GPU process is launched 120 seconds after chrome starts. + command_line.AppendSwitch(switches::kDisableGpuProcessForDX12InfoCollection); #if BUILDFLAG(ENABLE_PLUGINS) bool ppapi_ok = ppapi::RegisterBlinkTestPlugin(&command_line); @@ -217,11 +215,9 @@ // Enable the deprecated WebAuthn Mojo Testing API. command_line.AppendSwitch(switches::kEnableWebAuthDeprecatedMojoTestingApi); - // Always disable the unsandbox GPU process for DX12 and Vulkan Info - // collection to avoid interference. This GPU process is launched 120 - // seconds after chrome starts. - command_line.AppendSwitch( - switches::kDisableGpuProcessForDX12VulkanInfoCollection); + // Always disable the unsandbox GPU process for DX12 Info collection to avoid + // interference. This GPU process is launched 120 seconds after chrome starts. + command_line.AppendSwitch(switches::kDisableGpuProcessForDX12InfoCollection); #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) content::WebTestBrowserPlatformInitialize();
diff --git a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt index cee4866..8a7dc91 100644 --- a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt
@@ -37,3 +37,6 @@ # GpuProcess_canvas2d is flaky on fuchsia. crbug.com/1102542 [ fuchsia ] GpuProcess_canvas2d [ Failure ] + +# Flaky on Fuchsia +crbug.com/1087298 [ fuchsia ] GpuProcess_webgl_disabled_extension [ Skip ]
diff --git a/docs/clang_sheriffing.md b/docs/clang_sheriffing.md index 242e8d1..124a3dee 100644 --- a/docs/clang_sheriffing.md +++ b/docs/clang_sheriffing.md
@@ -26,6 +26,11 @@ [TOC] +## Disk out of space + +If there are any issues with disk running out of space, file a go/bug-a-trooper +bug, for example https://crbug.com/1105134. + ## Is it the compiler? Chromium does not always build and pass tests in all configurations that
diff --git a/gpu/OWNERS b/gpu/OWNERS index 138fdcc..5eb00e6 100644 --- a/gpu/OWNERS +++ b/gpu/OWNERS
@@ -1,5 +1,4 @@ backer@chromium.org -ericrk@chromium.org kbr@chromium.org khushalsagar@chromium.org vmiura@chromium.org
diff --git a/gpu/command_buffer/service/shared_context_state.cc b/gpu/command_buffer/service/shared_context_state.cc index 900a182c..16171bc 100644 --- a/gpu/command_buffer/service/shared_context_state.cc +++ b/gpu/command_buffer/service/shared_context_state.cc
@@ -144,6 +144,21 @@ DCHECK(gr_context_); } + // Ensure that the context type is consistent with the provided factories. + switch (gr_context_type_) { + case GrContextType::kGL: + break; + case GrContextType::kVulkan: + DCHECK(vk_context_provider_); + break; + case GrContextType::kMetal: + DCHECK(metal_context_provider_); + break; + case GrContextType::kDawn: + DCHECK(dawn_context_provider_); + break; + } + if (base::ThreadTaskRunnerHandle::IsSet()) { base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( this, "SharedContextState", base::ThreadTaskRunnerHandle::Get());
diff --git a/gpu/command_buffer/service/shared_context_state.h b/gpu/command_buffer/service/shared_context_state.h index 6a7fcf0f..ec476f3 100644 --- a/gpu/command_buffer/service/shared_context_state.h +++ b/gpu/command_buffer/service/shared_context_state.h
@@ -85,13 +85,13 @@ return gr_context_type_ == GrContextType::kGL; } bool GrContextIsVulkan() const { - return vk_context_provider_ && gr_context_type_ == GrContextType::kVulkan; + return gr_context_type_ == GrContextType::kVulkan; } bool GrContextIsMetal() const { - return metal_context_provider_ && gr_context_type_ == GrContextType::kMetal; + return gr_context_type_ == GrContextType::kMetal; } bool GrContextIsDawn() const { - return dawn_context_provider_ && gr_context_type_ == GrContextType::kDawn; + return gr_context_type_ == GrContextType::kDawn; } bool InitializeGL(const GpuPreferences& gpu_preferences, @@ -126,6 +126,7 @@ } gl::ProgressReporter* progress_reporter() const { return progress_reporter_; } GrContext* gr_context() { return gr_context_; } + GrContextType gr_context_type() const { return gr_context_type_; } // Handles Skia-reported shader compilation errors. void compileError(const char* shader, const char* errors) override; gles2::FeatureInfo* feature_info() { return feature_info_.get(); }
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc b/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc index 312e30d..9adc4f0 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc +++ b/gpu/command_buffer/service/shared_image_backing_factory_gl_texture.cc
@@ -304,7 +304,7 @@ SharedImageRepresentationGLTextureImpl::SharedImageRepresentationGLTextureImpl( SharedImageManager* manager, SharedImageBacking* backing, - Client* client, + SharedImageRepresentationGLTextureClient* client, MemoryTypeTracker* tracker, gles2::Texture* texture) : SharedImageRepresentationGLTexture(manager, backing, tracker), @@ -316,11 +316,16 @@ } bool SharedImageRepresentationGLTextureImpl::BeginAccess(GLenum mode) { - if (client_) - return client_->OnGLTextureBeginAccess(mode); + if (client_ && mode != GL_SHARED_IMAGE_ACCESS_MODE_OVERLAY_CHROMIUM) + return client_->SharedImageRepresentationGLTextureBeginAccess(); return true; } +void SharedImageRepresentationGLTextureImpl::EndAccess() { + if (client_) + return client_->SharedImageRepresentationGLTextureEndAccess(); +} + /////////////////////////////////////////////////////////////////////////////// // SharedImageRepresentationGLTexturePassthroughImpl @@ -328,7 +333,7 @@ SharedImageRepresentationGLTexturePassthroughImpl( SharedImageManager* manager, SharedImageBacking* backing, - Client* client, + SharedImageRepresentationGLTextureClient* client, MemoryTypeTracker* tracker, scoped_refptr<gles2::TexturePassthrough> texture_passthrough) : SharedImageRepresentationGLTexturePassthrough(manager, backing, tracker), @@ -345,11 +350,16 @@ bool SharedImageRepresentationGLTexturePassthroughImpl::BeginAccess( GLenum mode) { - if (client_) - return client_->OnGLTexturePassthroughBeginAccess(mode); + if (client_ && mode != GL_SHARED_IMAGE_ACCESS_MODE_OVERLAY_CHROMIUM) + return client_->SharedImageRepresentationGLTextureBeginAccess(); return true; } +void SharedImageRepresentationGLTexturePassthroughImpl::EndAccess() { + if (client_) + return client_->SharedImageRepresentationGLTextureEndAccess(); +} + /////////////////////////////////////////////////////////////////////////////// // SharedImageBackingGLCommon @@ -396,7 +406,7 @@ SharedImageRepresentationSkiaImpl::SharedImageRepresentationSkiaImpl( SharedImageManager* manager, SharedImageBacking* backing, - Client* client, + SharedImageRepresentationGLTextureClient* client, scoped_refptr<SharedContextState> context_state, sk_sp<SkPromiseImageTexture> promise_texture, MemoryTypeTracker* tracker) @@ -424,14 +434,18 @@ std::vector<GrBackendSemaphore>* begin_semaphores, std::vector<GrBackendSemaphore>* end_semaphores) { CheckContext(); - if (client_ && !client_->OnSkiaBeginWriteAccess()) - return nullptr; + if (client_) { + DCHECK(context_state_->GrContextIsGL()); + if (!client_->SharedImageRepresentationGLTextureBeginAccess()) + return nullptr; + } + if (write_surface_) return nullptr; - if (!promise_texture_) { + if (!promise_texture_) return nullptr; - } + SkColorType sk_color_type = viz::ResourceFormatToClosestSkColorType( /*gpu_compositing=*/true, format()); auto surface = SkSurface::MakeFromBackendTexture( @@ -449,19 +463,26 @@ CheckContext(); // TODO(ericrk): Keep the surface around for re-use. write_surface_ = nullptr; + + if (client_) + client_->SharedImageRepresentationGLTextureEndAccess(); } sk_sp<SkPromiseImageTexture> SharedImageRepresentationSkiaImpl::BeginReadAccess( std::vector<GrBackendSemaphore>* begin_semaphores, std::vector<GrBackendSemaphore>* end_semaphores) { CheckContext(); - if (client_ && !client_->OnSkiaBeginReadAccess()) - return nullptr; + if (client_) { + DCHECK(context_state_->GrContextIsGL()); + if (!client_->SharedImageRepresentationGLTextureBeginAccess()) + return nullptr; + } return promise_texture_; } void SharedImageRepresentationSkiaImpl::EndReadAccess() { - // TODO(ericrk): Handle begin/end correctness checks. + if (client_) + client_->SharedImageRepresentationGLTextureEndAccess(); } bool SharedImageRepresentationSkiaImpl::SupportsMultipleConcurrentReadAccess() { @@ -814,6 +835,7 @@ SharedImageManager* manager, MemoryTypeTracker* tracker, scoped_refptr<SharedContextState> context_state) { + SharedImageRepresentationGLTextureClient* gl_client = nullptr; if (!cached_promise_texture_) { if (context_state->GrContextIsMetal()) { #if defined(OS_MACOSX) @@ -823,6 +845,7 @@ DCHECK(cached_promise_texture_); #endif } else { + gl_client = this; GrBackendTexture backend_texture; GetGrBackendTexture(context_state->feature_info(), GetGLTarget(), size(), GetGLServiceId(), format(), &backend_texture); @@ -830,8 +853,8 @@ } } return std::make_unique<SharedImageRepresentationSkiaImpl>( - manager, this, this, std::move(context_state), cached_promise_texture_, - tracker); + manager, this, gl_client, std::move(context_state), + cached_promise_texture_, tracker); } std::unique_ptr<SharedImageRepresentationGLTexture> @@ -897,24 +920,20 @@ image_bind_or_copy_needed_ = true; } -bool SharedImageBackingGLImage::OnGLTextureBeginAccess(GLenum mode) { - if (mode == GL_SHARED_IMAGE_ACCESS_MODE_OVERLAY_CHROMIUM) - return true; +bool SharedImageBackingGLImage:: + SharedImageRepresentationGLTextureBeginAccess() { return BindOrCopyImageIfNeeded(); } -bool SharedImageBackingGLImage::OnGLTexturePassthroughBeginAccess(GLenum mode) { - if (mode == GL_SHARED_IMAGE_ACCESS_MODE_OVERLAY_CHROMIUM) - return true; - return BindOrCopyImageIfNeeded(); -} - -bool SharedImageBackingGLImage::OnSkiaBeginReadAccess() { - return BindOrCopyImageIfNeeded(); -} - -bool SharedImageBackingGLImage::OnSkiaBeginWriteAccess() { - return BindOrCopyImageIfNeeded(); +void SharedImageBackingGLImage::SharedImageRepresentationGLTextureEndAccess() { +#if defined(OS_MACOSX) + // If this image could potentially be shared with Metal via WebGPU, then flush + // the GL context to ensure Metal will see it. + if (usage() & SHARED_IMAGE_USAGE_WEBGPU) { + gl::GLApi* api = gl::g_current_gl_context; + api->glFlushFn(); + } +#endif } bool SharedImageBackingGLImage::BindOrCopyImageIfNeeded() { @@ -1333,7 +1352,12 @@ return nullptr; } +#if defined(OS_MACOSX) + const bool use_buffer = + usage & (SHARED_IMAGE_USAGE_SCANOUT | SHARED_IMAGE_USAGE_WEBGPU); +#else const bool use_buffer = usage & SHARED_IMAGE_USAGE_SCANOUT; +#endif if (use_buffer && !format_info.allow_scanout) { LOG(ERROR) << "CreateSharedImage: SCANOUT shared images unavailable"; return nullptr;
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_internal.h b/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_internal.h index bd1b947..ee8e556 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_internal.h +++ b/gpu/command_buffer/service/shared_image_backing_factory_gl_texture_internal.h
@@ -11,27 +11,33 @@ namespace gpu { +// Interface through which a representation that has a GL texture calls into its +// GLImage backing. +class SharedImageRepresentationGLTextureClient { + public: + virtual bool SharedImageRepresentationGLTextureBeginAccess() = 0; + virtual void SharedImageRepresentationGLTextureEndAccess() = 0; +}; + // Representation of a SharedImageBackingGLTexture or SharedImageBackingGLImage // as a GL Texture. class SharedImageRepresentationGLTextureImpl : public SharedImageRepresentationGLTexture { public: - class Client { - public: - virtual bool OnGLTextureBeginAccess(GLenum mode) = 0; - }; - SharedImageRepresentationGLTextureImpl(SharedImageManager* manager, - SharedImageBacking* backing, - Client* client, - MemoryTypeTracker* tracker, - gles2::Texture* texture); + SharedImageRepresentationGLTextureImpl( + SharedImageManager* manager, + SharedImageBacking* backing, + SharedImageRepresentationGLTextureClient* client, + MemoryTypeTracker* tracker, + gles2::Texture* texture); private: // SharedImageRepresentationGLTexture: gles2::Texture* GetTexture() override; bool BeginAccess(GLenum mode) override; + void EndAccess() override; - Client* const client_ = nullptr; + SharedImageRepresentationGLTextureClient* const client_ = nullptr; gles2::Texture* texture_; }; @@ -47,7 +53,7 @@ SharedImageRepresentationGLTexturePassthroughImpl( SharedImageManager* manager, SharedImageBacking* backing, - Client* client, + SharedImageRepresentationGLTextureClient* client, MemoryTypeTracker* tracker, scoped_refptr<gles2::TexturePassthrough> texture_passthrough); ~SharedImageRepresentationGLTexturePassthroughImpl() override; @@ -57,8 +63,9 @@ const scoped_refptr<gles2::TexturePassthrough>& GetTexturePassthrough() override; bool BeginAccess(GLenum mode) override; + void EndAccess() override; - Client* const client_ = nullptr; + SharedImageRepresentationGLTextureClient* const client_ = nullptr; scoped_refptr<gles2::TexturePassthrough> texture_passthrough_; }; @@ -103,7 +110,7 @@ SharedImageRepresentationSkiaImpl( SharedImageManager* manager, SharedImageBacking* backing, - Client* client, + SharedImageRepresentationGLTextureClient* client, scoped_refptr<SharedContextState> context_state, sk_sp<SkPromiseImageTexture> promise_texture, MemoryTypeTracker* tracker); @@ -128,7 +135,7 @@ void CheckContext(); - Client* const client_ = nullptr; + SharedImageRepresentationGLTextureClient* const client_ = nullptr; scoped_refptr<SharedContextState> context_state_; sk_sp<SkPromiseImageTexture> promise_texture_; @@ -201,9 +208,7 @@ // mailbox implementation. class SharedImageBackingGLImage : public SharedImageBacking, - public SharedImageRepresentationGLTextureImpl::Client, - public SharedImageRepresentationGLTexturePassthroughImpl::Client, - public SharedImageRepresentationSkiaImpl::Client { + public SharedImageRepresentationGLTextureClient { public: SharedImageBackingGLImage( scoped_refptr<gl::GLImage> image, @@ -257,15 +262,9 @@ MemoryTypeTracker* tracker) override; void Update(std::unique_ptr<gfx::GpuFence> in_fence) override; - // SharedImageRepresentationGLTextureImpl::Client: - bool OnGLTextureBeginAccess(GLenum mode) override; - - // SharedImageRepresentationGLTexturePassthroughImpl::Client: - bool OnGLTexturePassthroughBeginAccess(GLenum mode) override; - - // SharedImageRepresentationGLTextureImpl::Client: - bool OnSkiaBeginReadAccess() override; - bool OnSkiaBeginWriteAccess() override; + // SharedImageRepresentationGLTextureClient: + bool SharedImageRepresentationGLTextureBeginAccess() override; + void SharedImageRepresentationGLTextureEndAccess() override; bool IsPassthrough() const { return is_passthrough_; }
diff --git a/gpu/command_buffer/service/shared_image_factory.cc b/gpu/command_buffer/service/shared_image_factory.cc index d4e01be..cf6eb7f3 100644 --- a/gpu/command_buffer/service/shared_image_factory.cc +++ b/gpu/command_buffer/service/shared_image_factory.cc
@@ -89,8 +89,8 @@ shared_image_manager_(shared_image_manager), shared_context_state_(context_state), memory_tracker_(std::make_unique<MemoryTypeTracker>(memory_tracker)), - using_vulkan_(context_state && context_state->GrContextIsVulkan()), - using_skia_dawn_(context_state && context_state->GrContextIsDawn()) { + gr_context_type_(context_state ? context_state->gr_context_type() + : GrContextType::kGL) { bool use_gl = gl::GetGLImplementation() != gl::kGLImplementationNone; if (use_gl) { gl_backing_factory_ = std::make_unique<SharedImageBackingFactoryGLTexture>( @@ -98,25 +98,26 @@ shared_image_manager->batch_access_manager()); } - // For X11 + // TODO(ccameron): This block of code should be changed to a switch on + // |gr_context_type|. #if defined(USE_X11) && BUILDFLAG(ENABLE_VULKAN) if (!features::IsUsingOzonePlatform()) { - if (using_vulkan_) { + if (gr_context_type_ == GrContextType::kVulkan) { interop_backing_factory_ = std::make_unique<ExternalVkImageFactory>(context_state); } - } else if (using_vulkan_) { - LOG(ERROR) << "ERROR: using_vulkan_ = true and interop_backing_factory_ is " - "not set"; + } else if (gr_context_type_ == GrContextType::kVulkan) { + LOG(ERROR) << "ERROR: gr_context_type_ is GrContextType::kVulkan and " + "interop_backing_factory_ is not set"; } #elif (defined(OS_FUCHSIA) || defined(OS_WIN)) && BUILDFLAG(ENABLE_VULKAN) - if (using_vulkan_) { + if (gr_context_type_ == GrContextType::kVulkan) { interop_backing_factory_ = std::make_unique<ExternalVkImageFactory>(context_state); } #elif defined(OS_ANDROID) && BUILDFLAG(ENABLE_VULKAN) // For Android - if (using_vulkan_) { + if (gr_context_type_ == GrContextType::kVulkan) { external_vk_image_factory_ = std::make_unique<ExternalVkImageFactory>(context_state); const auto& enabled_extensions = context_state->vk_context_provider() @@ -134,21 +135,22 @@ } #elif defined(OS_MACOSX) // OSX - DCHECK(!using_vulkan_); + DCHECK(gr_context_type_ == GrContextType::kGL || + gr_context_type_ == GrContextType::kMetal); interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryIOSurface>( workarounds, gpu_feature_info, use_gl); #elif defined(OS_CHROMEOS) - if (context_state && context_state->vk_context_provider()) { + if (gr_context_type_ == GrContextType::kVulkan) { interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryOzone>(context_state); } #else // Others - if (using_vulkan_) - LOG(ERROR) << "ERROR: using_vulkan_ = true and interop_backing_factory_ is " - "not set"; - + if (gr_context_type_ == GrContextType::kVulkan) { + LOG(ERROR) << "ERROR: gr_context_type_ is GrContextType::kVulkan and " + "interop_backing_factory_ is not set"; + } #endif if (enable_wrapped_sk_image && context_state) { wrapped_sk_image_factory_ = @@ -159,7 +161,7 @@ // For Windows bool use_passthrough = gpu_preferences.use_passthrough_cmd_decoder && gles2::PassthroughCommandDecoderSupported(); - if (use_passthrough && !using_vulkan_) { + if (use_passthrough && gr_context_type_ == GrContextType::kGL) { // Only supported for passthrough command decoder. interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryD3D>(); } @@ -215,7 +217,7 @@ SharedImageBackingFactory* factory = nullptr; if (backing_factory_for_testing_) { factory = backing_factory_for_testing_; - } else if (!using_vulkan_ && !using_skia_dawn_) { + } else if (gr_context_type_ == GrContextType::kGL) { allow_legacy_mailbox = true; factory = gl_backing_factory_.get(); } else { @@ -397,7 +399,7 @@ SHARED_IMAGE_USAGE_OOP_RASTERIZATION | SHARED_IMAGE_USAGE_DISPLAY; - if (using_vulkan_ || using_skia_dawn_) { + if (gr_context_type_ != GrContextType::kGL) { // For SkiaRenderer/Vulkan+Dawn use WrappedSkImage if the usage is only // raster and/or display. return (usage & kWrappedSkImageUsage) && !(usage & ~kWrappedSkImageUsage); @@ -417,7 +419,8 @@ return backing_factory_for_testing_; bool using_dawn = usage & SHARED_IMAGE_USAGE_WEBGPU; - bool vulkan_usage = using_vulkan_ && (usage & SHARED_IMAGE_USAGE_DISPLAY); + bool vulkan_usage = gr_context_type_ == GrContextType::kVulkan && + (usage & SHARED_IMAGE_USAGE_DISPLAY); bool gl_usage = usage & SHARED_IMAGE_USAGE_GLES2; bool share_between_threads = IsSharedBetweenThreads(usage); bool share_between_gl_vulkan = gl_usage && vulkan_usage; @@ -460,8 +463,9 @@ using_interop_factory |= interop_factory_supports_gmb; } - *allow_legacy_mailbox = - !using_interop_factory && !using_vulkan_ && !share_between_threads; + *allow_legacy_mailbox = !using_interop_factory && + gr_context_type_ == GrContextType::kGL && + !share_between_threads; if (using_interop_factory) { // TODO(crbug.com/969114): Not all shared image factory implementations
diff --git a/gpu/command_buffer/service/shared_image_factory.h b/gpu/command_buffer/service/shared_image_factory.h index 9753cf9..0aad865 100644 --- a/gpu/command_buffer/service/shared_image_factory.h +++ b/gpu/command_buffer/service/shared_image_factory.h
@@ -14,6 +14,7 @@ #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/service/shared_image_manager.h" #include "gpu/command_buffer/service/texture_manager.h" +#include "gpu/config/gpu_preferences.h" #include "gpu/gpu_gles2_export.h" #include "gpu/ipc/common/surface_handle.h" #include "ui/gfx/buffer_types.h" @@ -134,8 +135,11 @@ SharedImageManager* shared_image_manager_; SharedContextState* shared_context_state_; std::unique_ptr<MemoryTypeTracker> memory_tracker_; - const bool using_vulkan_; - const bool using_skia_dawn_; + + // This is |shared_context_state_|'s context type. Some tests leave + // |shared_context_state_| as nullptr, in which case this is set to a default + /// of kGL. + const GrContextType gr_context_type_; // The set of SharedImages which have been created (and are being kept alive) // by this factory.
diff --git a/gpu/command_buffer/service/wrapped_sk_image.cc b/gpu/command_buffer/service/wrapped_sk_image.cc index 7cd628f..7762881 100644 --- a/gpu/command_buffer/service/wrapped_sk_image.cc +++ b/gpu/command_buffer/service/wrapped_sk_image.cc
@@ -10,6 +10,7 @@ #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event.h" +#include "build/build_config.h" #include "components/viz/common/resources/resource_format_utils.h" #include "gpu/command_buffer/common/shared_image_trace_utils.h" #include "gpu/command_buffer/service/feature_info.h" @@ -248,6 +249,14 @@ tracing_id_ = tex_info.fID; break; } +#if defined(OS_MACOSX) + case GrBackendApi::kMetal: { + GrMtlTextureInfo image_info; + if (backend_texture_.getMtlTextureInfo(&image_info)) + tracing_id_ = reinterpret_cast<uint64_t>(image_info.fTexture.get()); + break; + } +#endif case GrBackendApi::kVulkan: { GrVkImageInfo image_info; if (backend_texture_.getVkImageInfo(&image_info))
diff --git a/gpu/config/gpu_switches.cc b/gpu/config/gpu_switches.cc index 916d1e3..9df5641 100644 --- a/gpu/config/gpu_switches.cc +++ b/gpu/config/gpu_switches.cc
@@ -34,9 +34,9 @@ // devices. const char kShaderDiskCacheSizeKB[] = "shader-disk-cache-size-kb"; -// Disables the non-sandboxed GPU process for DX12 and Vulkan info collection -const char kDisableGpuProcessForDX12VulkanInfoCollection[] = - "disable-gpu-process-for-dx12-vulkan-info-collection"; +// Disables the non-sandboxed GPU process for DX12 info collection +const char kDisableGpuProcessForDX12InfoCollection[] = + "disable-gpu-process-for-dx12-info-collection"; const char kEnableUnsafeWebGPU[] = "enable-unsafe-webgpu";
diff --git a/gpu/config/gpu_switches.h b/gpu/config/gpu_switches.h index 0921b6a..55dc444 100644 --- a/gpu/config/gpu_switches.h +++ b/gpu/config/gpu_switches.h
@@ -16,7 +16,7 @@ GPU_EXPORT extern const char kGpuPreferences[]; GPU_EXPORT extern const char kIgnoreGpuBlacklist[]; GPU_EXPORT extern const char kShaderDiskCacheSizeKB[]; -GPU_EXPORT extern const char kDisableGpuProcessForDX12VulkanInfoCollection[]; +GPU_EXPORT extern const char kDisableGpuProcessForDX12InfoCollection[]; GPU_EXPORT extern const char kEnableUnsafeWebGPU[]; GPU_EXPORT extern const char kEnableDawnBackendValidation[]; GPU_EXPORT extern const char kUseHighGPUThreadPriorityForPerfTests[];
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc index 6fae5ad..74c6cec5c 100644 --- a/headless/lib/headless_content_main_delegate.cc +++ b/headless/lib/headless_content_main_delegate.cc
@@ -233,7 +233,7 @@ #if defined(OS_WIN) command_line->AppendSwitch( - ::switches::kDisableGpuProcessForDX12VulkanInfoCollection); + ::switches::kDisableGpuProcessForDX12InfoCollection); #endif content::Profiling::ProcessStarted();
diff --git a/ios/chrome/browser/ui/tab_grid/grid/grid_view_controller_unittest.mm b/ios/chrome/browser/ui/tab_grid/grid/grid_view_controller_unittest.mm index 7e19ca1..6c6187d9 100644 --- a/ios/chrome/browser/ui/tab_grid/grid/grid_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/tab_grid/grid/grid_view_controller_unittest.mm
@@ -189,6 +189,13 @@ // Tests that |-replaceItemID:withItem:| does not crash when updating an item // that is scrolled offscreen. TEST_F(GridViewControllerTest, ReplaceScrolledOffScreenCell) { + // TODO(crbug.com/1104872): On iOS 14 iPhone X, visibleCellsCount is always + // equal to the total number of cells, so the while loop below never + // terminates. + if (@available(iOS 14, *)) { + return; + } + // This test requires that the collection view be placed on the screen. SetRootViewController(view_controller_); EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
diff --git a/media/base/stream_parser_buffer.h b/media/base/stream_parser_buffer.h index d26d783..3800e17 100644 --- a/media/base/stream_parser_buffer.h +++ b/media/base/stream_parser_buffer.h
@@ -44,25 +44,25 @@ return ts_ - rhs.ts_; } - DecodeTimestamp& operator+=(const base::TimeDelta& rhs) { + DecodeTimestamp& operator+=(base::TimeDelta rhs) { ts_ += rhs; return *this; } - DecodeTimestamp& operator-=(const base::TimeDelta& rhs) { + DecodeTimestamp& operator-=(base::TimeDelta rhs) { ts_ -= rhs; return *this; } - DecodeTimestamp operator+(const base::TimeDelta& rhs) const { + DecodeTimestamp operator+(base::TimeDelta rhs) const { return DecodeTimestamp(ts_ + rhs); } - DecodeTimestamp operator-(const base::TimeDelta& rhs) const { + DecodeTimestamp operator-(base::TimeDelta rhs) const { return DecodeTimestamp(ts_ - rhs); } - int64_t operator/(const base::TimeDelta& rhs) const { return ts_ / rhs; } + int64_t operator/(base::TimeDelta rhs) const { return ts_ / rhs; } static DecodeTimestamp FromSecondsD(double seconds) { return DecodeTimestamp(base::TimeDelta::FromSecondsD(seconds));
diff --git a/media/filters/aom_video_decoder.cc b/media/filters/aom_video_decoder.cc index 1ce06159..a9ae5615 100644 --- a/media/filters/aom_video_decoder.cc +++ b/media/filters/aom_video_decoder.cc
@@ -276,7 +276,7 @@ } // TODO(dalecurtis): Is this true even for low resolutions? - frame->metadata()->SetBoolean(VideoFrameMetadata::POWER_EFFICIENT, false); + frame->metadata()->power_efficient = false; // Ensure the frame memory is returned to the MemoryPool upon discard. frame->AddDestructionObserver(
diff --git a/media/gpu/vaapi/vaapi_unittest.cc b/media/gpu/vaapi/vaapi_unittest.cc index abb662d..814d077 100644 --- a/media/gpu/vaapi/vaapi_unittest.cc +++ b/media/gpu/vaapi/vaapi_unittest.cc
@@ -30,14 +30,14 @@ base::Optional<VAProfile> ConvertToVAProfile(VideoCodecProfile profile) { // A map between VideoCodecProfile and VAProfile. const std::map<VideoCodecProfile, VAProfile> kProfileMap = { + // VAProfileH264Baseline is marked deprecated in <va/va.h> from libva 2.0. + // consider making VAProfileH264ConstrainedBaseline the default one. {H264PROFILE_BASELINE, VAProfileH264Baseline}, {H264PROFILE_MAIN, VAProfileH264Main}, {H264PROFILE_HIGH, VAProfileH264High}, {VP8PROFILE_ANY, VAProfileVP8Version0_3}, {VP9PROFILE_PROFILE0, VAProfileVP9Profile0}, - {VP9PROFILE_PROFILE1, VAProfileVP9Profile1}, {VP9PROFILE_PROFILE2, VAProfileVP9Profile2}, - {VP9PROFILE_PROFILE3, VAProfileVP9Profile3}, }; auto it = kProfileMap.find(profile); return it != kProfileMap.end() ? base::make_optional<VAProfile>(it->second) @@ -55,9 +55,7 @@ {"VAProfileJPEGBaseline", VAProfileJPEGBaseline}, {"VAProfileVP8Version0_3", VAProfileVP8Version0_3}, {"VAProfileVP9Profile0", VAProfileVP9Profile0}, - {"VAProfileVP9Profile1", VAProfileVP9Profile1}, {"VAProfileVP9Profile2", VAProfileVP9Profile2}, - {"VAProfileVP9Profile3", VAProfileVP9Profile3}, }; auto it = kStringToVAProfile.find(va_profile); @@ -87,6 +85,12 @@ public: VaapiTest() = default; ~VaapiTest() override = default; + + void SetUp() override { + // PreSandboxInitialization() loads and opens the driver, queries its + // capabilities and fills in the VASupportedProfiles. + VaapiWrapper::PreSandboxInitialization(); + } }; std::map<VAProfile, std::vector<VAEntrypoint>> ParseVainfo( @@ -120,17 +124,7 @@ return info; } -TEST_F(VaapiTest, VaapiSandboxInitialization) { - // VASupportedProfiles::Get() is called in PreSandboxInitialization(). - // It queries VA-API driver their capabilities. - VaapiWrapper::PreSandboxInitialization(); -} - -TEST_F(VaapiTest, VaapiProfiles) { - // VASupportedProfiles::Get() is called in PreSandboxInitialization(). - // It queries VA-API driver their capabilities. - VaapiWrapper::PreSandboxInitialization(); - +std::map<VAProfile, std::vector<VAEntrypoint>> RetrieveVAInfoOutput() { int fds[2]; PCHECK(pipe(fds) == 0); base::File read_pipe(fds[0]); @@ -148,50 +142,86 @@ EXPECT_LT(n, 4096); std::string output(buf, n); DVLOG(4) << output; - auto va_info = ParseVainfo(output); + return ParseVainfo(output); +} + +TEST_F(VaapiTest, VaapiSandboxInitialization) { + // Here we just test that the PreSandboxInitialization() in SetUp() worked + // fine. Said initialization is buried in internal singletons, but we can + // verify that at least the implementation type has been filled in. + EXPECT_NE(VaapiWrapper::GetImplementationType(), VAImplementation::kInvalid); +} + +// Verifies that every VAProfile from VaapiWrapper::GetSupportedDecodeProfiles() +// is indeed supported by the command line vainfo utility and by +// VaapiWrapper::IsDecodeSupported(). +TEST_F(VaapiTest, GetSupportedDecodeProfiles) { + const auto va_info = RetrieveVAInfoOutput(); for (const auto& profile : VaapiWrapper::GetSupportedDecodeProfiles()) { - auto va_profile = ConvertToVAProfile(profile.profile); + const auto va_profile = ConvertToVAProfile(profile.profile); ASSERT_TRUE(va_profile.has_value()); bool is_profile_supported = - base::Contains(va_info[*va_profile], VAEntrypointVLD); + base::Contains(va_info, *va_profile) && + base::Contains(va_info.at(*va_profile), VAEntrypointVLD); + bool is_decode_supported = VaapiWrapper::IsDecodeSupported(*va_profile); + // H264PROFILE_BASELINE may be supported by VAProfileH264Baseline + // (deprecated) or by VAProfileH264ConstrainedBaseline. This is the same + // logic as in vaapi_wrapper.cc. if (profile.profile == H264PROFILE_BASELINE) { - // ConstrainedBaseline is the fallback profile for H264PROFILE_BASELINE. - // This is the same logic as in vaapi_wrapper.cc. is_profile_supported |= base::Contains( - va_info[VAProfileH264ConstrainedBaseline], VAEntrypointVLD); + va_info.at(VAProfileH264ConstrainedBaseline), VAEntrypointVLD); + is_decode_supported |= + VaapiWrapper::IsDecodeSupported(VAProfileH264ConstrainedBaseline); } EXPECT_TRUE(is_profile_supported) << " profile: " << GetProfileName(profile.profile); + EXPECT_TRUE(is_decode_supported) + << " profile: " << GetProfileName(profile.profile); } +} + +// Verifies that every VAProfile from VaapiWrapper::GetSupportedEncodeProfiles() +// is indeed supported by the command line vainfo utility. +TEST_F(VaapiTest, GetSupportedEncodeProfiles) { + const auto va_info = RetrieveVAInfoOutput(); for (const auto& profile : VaapiWrapper::GetSupportedEncodeProfiles()) { - auto va_profile = ConvertToVAProfile(profile.profile); + const auto va_profile = ConvertToVAProfile(profile.profile); ASSERT_TRUE(va_profile.has_value()); + bool is_profile_supported = - base::Contains(va_info[*va_profile], VAEntrypointEncSlice) || - base::Contains(va_info[*va_profile], VAEntrypointEncSliceLP); + base::Contains(va_info, *va_profile) && + (base::Contains(va_info.at(*va_profile), VAEntrypointEncSlice) || + base::Contains(va_info.at(*va_profile), VAEntrypointEncSliceLP)); + // H264PROFILE_BASELINE may be supported by VAProfileH264Baseline + // (deprecated) or by VAProfileH264ConstrainedBaseline. This is the same + // logic as in vaapi_wrapper.cc. if (profile.profile == H264PROFILE_BASELINE) { - // ConstrainedBaseline is the fallback profile for H264PROFILE_BASELINE. - // This is the same logic as in vaapi_wrapper.cc. is_profile_supported |= - base::Contains(va_info[VAProfileH264ConstrainedBaseline], + base::Contains(va_info.at(VAProfileH264ConstrainedBaseline), VAEntrypointEncSlice) || - base::Contains(va_info[VAProfileH264ConstrainedBaseline], + base::Contains(va_info.at(VAProfileH264ConstrainedBaseline), VAEntrypointEncSliceLP); } EXPECT_TRUE(is_profile_supported) << " profile: " << GetProfileName(profile.profile); } +} + +// Verifies that if JPEG decoding and encoding are supported by VaapiWrapper, +// they are also supported by by the command line vainfo utility. +TEST_F(VaapiTest, VaapiProfilesJPEG) { + const auto va_info = RetrieveVAInfoOutput(); EXPECT_EQ(VaapiWrapper::IsDecodeSupported(VAProfileJPEGBaseline), - base::Contains(va_info[VAProfileJPEGBaseline], VAEntrypointVLD)); - EXPECT_EQ( - VaapiWrapper::IsJpegEncodeSupported(), - base::Contains(va_info[VAProfileJPEGBaseline], VAEntrypointEncPicture)); + base::Contains(va_info.at(VAProfileJPEGBaseline), VAEntrypointVLD)); + EXPECT_EQ(VaapiWrapper::IsJpegEncodeSupported(), + base::Contains(va_info.at(VAProfileJPEGBaseline), + VAEntrypointEncPicture)); } // Verifies that the default VAEntrypoint as per VaapiWrapper is indeed among @@ -220,8 +250,6 @@ int main(int argc, char** argv) { base::TestSuite test_suite(argc, argv); - media::VaapiWrapper::PreSandboxInitialization(); - return base::LaunchUnitTests( argc, argv, base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite)));
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc index b137ee3..113c6cc9 100644 --- a/media/gpu/vaapi/vaapi_wrapper.cc +++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -250,6 +250,8 @@ // Map of the supported VaProfiles indexed by media's VideoCodecProfile. std::map<VideoCodecProfile, VAProfile> kMediaToVAProfileMap = { + // VAProfileH264Baseline is marked deprecated in <va/va.h> from libva 2.0. + // consider making VAProfileH264ConstrainedBaseline the default one. {H264PROFILE_BASELINE, VAProfileH264Baseline}, {H264PROFILE_MAIN, VAProfileH264Main}, // TODO(posciak): See if we can/want to support other variants of
diff --git a/media/mojo/mojom/platform_verification.mojom b/media/mojo/mojom/platform_verification.mojom index 550ade0..c96c33bb 100644 --- a/media/mojo/mojom/platform_verification.mojom +++ b/media/mojo/mojom/platform_verification.mojom
@@ -31,4 +31,8 @@ // available version if 0 is specified). This returns the requested // |storage_id|, which may be empty if it is not supported by the platform. GetStorageId(uint32 version) => (uint32 version, array<uint8> storage_id); + + // Returns true if Verified Access is enabled in settings, false otherwise. + [EnableIf=is_chromeos] + IsVerifiedAccessEnabled() => (bool enabled); };
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index f91fa57a..0782f9f 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn
@@ -140,6 +140,10 @@ deps += [ "//sandbox" ] } } + if (is_chromeos) { + deps += + [ "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_gpu" ] + } } source_set("unit_tests") {
diff --git a/media/mojo/services/DEPS b/media/mojo/services/DEPS index f3ef946..6a093c6 100644 --- a/media/mojo/services/DEPS +++ b/media/mojo/services/DEPS
@@ -1,4 +1,7 @@ specific_include_rules = { + "gpu_mojo_media_client\.cc": [ + "+chromeos/components/cdm_factory_daemon", + ], "media_manifest\.cc": [ "+chromecast/common/mojom", ],
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc index dd1935be..8fc45da 100644 --- a/media/mojo/services/gpu_mojo_media_client.cc +++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -58,6 +58,10 @@ using media::android_mojo_util::CreateMediaDrmStorage; #endif // defined(OS_ANDROID) +#if defined(OS_CHROMEOS) +#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h" +#endif // defined(OS_CHROMEOS) + namespace media { namespace { @@ -335,14 +339,16 @@ } std::unique_ptr<CdmFactory> GpuMojoMediaClient::CreateCdmFactory( - mojom::FrameInterfaceFactory* interface_provider) { + mojom::FrameInterfaceFactory* frame_interfaces) { #if defined(OS_ANDROID) return std::make_unique<AndroidCdmFactory>( - base::BindRepeating(&CreateProvisionFetcher, interface_provider), - base::BindRepeating(&CreateMediaDrmStorage, interface_provider)); + base::BindRepeating(&CreateProvisionFetcher, frame_interfaces), + base::BindRepeating(&CreateMediaDrmStorage, frame_interfaces)); +#elif defined(OS_CHROMEOS) + return std::make_unique<chromeos::ChromeOsCdmFactory>(frame_interfaces); #else return nullptr; -#endif // defined(OS_ANDROID) +#endif } } // namespace media
diff --git a/net/network_error_logging/OWNERS b/net/network_error_logging/OWNERS index 46f7dc9..4e378e9 100644 --- a/net/network_error_logging/OWNERS +++ b/net/network_error_logging/OWNERS
@@ -1,3 +1,7 @@ chlily@chromium.org +# This is the component for the Network Error Logging API. +# For chrome://net-export and NetLogs, see Internals>Network>Logging. +# For network errors in general, see Internals>Network. + # COMPONENT: Internals>Network>ReportingAndNEL
diff --git a/net/quic/mock_crypto_client_stream.cc b/net/quic/mock_crypto_client_stream.cc index 3eb98fde..c2ef794 100644 --- a/net/quic/mock_crypto_client_stream.cc +++ b/net/quic/mock_crypto_client_stream.cc
@@ -14,6 +14,7 @@ #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h" #include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h" +#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/boringssl/src/include/openssl/ssl.h" @@ -49,19 +50,6 @@ using quiche::QuicheStringPiece; using std::string; -namespace { - -// TODO(crbug.com/1085541): Consider moving this method into QuicTestUtils. -quic::QuicConnectionId TestConnectionId(uint64_t connection_number) { - const uint64_t connection_id64_net = - quiche::QuicheEndian::HostToNet64(connection_number); - return quic::QuicConnectionId( - reinterpret_cast<const char*>(&connection_id64_net), - sizeof(connection_id64_net)); -} - -} // namespace - namespace net { MockCryptoClientStream::MockCryptoClientStream( @@ -327,7 +315,7 @@ if (quic::VersionHasIetfInvariantHeader( session()->connection()->transport_version())) { - auto connection_id = TestConnectionId(0x1337); + auto connection_id = quic::test::TestConnectionId(); config.SetStatelessResetTokenToSend( quic::QuicUtils::GenerateStatelessResetToken(connection_id)); }
diff --git a/net/quic/quic_test_packet_maker.cc b/net/quic/quic_test_packet_maker.cc index 8d16a6c..496d1948 100644 --- a/net/quic/quic_test_packet_maker.cc +++ b/net/quic/quic_test_packet_maker.cc
@@ -103,14 +103,6 @@ return new_frames; } -// TODO(crbug.com/1085541): Consider moving this method into QuicTestUtils. -quic::QuicConnectionId TestConnectionId(uint64_t connection_number) { - const uint64_t connection_id64_net = - quiche::QuicheEndian::HostToNet64(connection_number); - return quic::QuicConnectionId( - reinterpret_cast<const char*>(&connection_id64_net), - sizeof(connection_id64_net)); -} } // namespace @@ -939,7 +931,7 @@ std::unique_ptr<quic::QuicEncryptedPacket> QuicTestPacketMaker::MakeStatelessResetPacket() { - auto connection_id = TestConnectionId(0x1337); + auto connection_id = quic::test::TestConnectionId(); return quic::QuicFramer::BuildIetfStatelessResetPacket( connection_id, quic::QuicUtils::GenerateStatelessResetToken(connection_id));
diff --git a/services/network/quic_transport.cc b/services/network/quic_transport.cc index 0ef85a5..8a06b3e 100644 --- a/services/network/quic_transport.cc +++ b/services/network/quic_transport.cc
@@ -148,7 +148,10 @@ MayDisposeLater(); } - ~Stream() { transport_->transport_->session()->CloseStream(id_); } + ~Stream() { + transport_->transport_->session()->ResetStream( + id_, quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED); + } private: using ArmingPolicy = mojo::SimpleWatcher::ArmingPolicy; @@ -506,13 +509,15 @@ sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024}; if (mojo::CreateDataPipe(&options, &writable_for_outgoing, &readable_for_outgoing) != MOJO_RESULT_OK) { - transport_->session()->CloseStream(stream->id()); + transport_->session()->ResetStream( + stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED); // TODO(yhirano): Error the entire connection. return; } if (mojo::CreateDataPipe(&options, &writable_for_incoming, &readable_for_incoming) != MOJO_RESULT_OK) { - transport_->session()->CloseStream(stream->id()); + transport_->session()->ResetStream( + stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED); // TODO(yhirano): Error the entire connection. return; } @@ -547,7 +552,8 @@ sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024}; if (mojo::CreateDataPipe(&options, &writable_for_incoming, &readable_for_incoming) != MOJO_RESULT_OK) { - transport_->session()->CloseStream(stream->id()); + transport_->session()->ResetStream( + stream->id(), quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED); // TODO(yhirano): Error the entire connection. return; }
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index d16f165..c469dd3 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -225,6 +225,14 @@ const base::Feature kIntensiveWakeUpThrottling{ "IntensiveWakeUpThrottling", base::FEATURE_DISABLED_BY_DEFAULT}; +// When enabled, no throttling is applied to a page when it uses WebRTC. +// +// This allows a page to use a timer to do video processing on frames. An +// event-driven mechanism should be provided to do video processing. When it is +// available, this feature should be removed. https://crbug.com/1101806 +const base::Feature kOptOutWebRTCFromAllThrottling{ + "OptOutWebRTCFromAllThrottling", base::FEATURE_DISABLED_BY_DEFAULT}; + // Name of the parameter that controls the grace period during which there is no // intensive wake up throttling after a page is hidden. Defined here to allow // access from about_flags.cc. The FeatureParam is defined in
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index d2b0667d..913f172 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -60,6 +60,8 @@ BLINK_COMMON_EXPORT extern const char kIntensiveWakeUpThrottling_GracePeriodSeconds_Name[]; +BLINK_COMMON_EXPORT extern const base::Feature kOptOutWebRTCFromAllThrottling; + #if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) BLINK_COMMON_EXPORT extern const base::Feature kWebRtcH264WithOpenH264FFmpeg; #endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
diff --git a/third_party/blink/public/platform/web_screen_info.h b/third_party/blink/public/platform/web_screen_info.h index 10ec99da..3ff8ac7 100644 --- a/third_party/blink/public/platform/web_screen_info.h +++ b/third_party/blink/public/platform/web_screen_info.h
@@ -32,8 +32,8 @@ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_SCREEN_INFO_H_ #include "third_party/blink/public/common/screen_orientation/web_screen_orientation_type.h" -#include "third_party/blink/public/platform/web_rect.h" #include "ui/gfx/color_space.h" +#include "ui/gfx/geometry/rect.h" namespace blink { @@ -60,7 +60,7 @@ // expressed in virtual-screen coordinates. Note that if the monitor // is not the primary display monitor, some of the rectangle's // coordinates may be negative values." - WebRect rect; + gfx::Rect rect; // This is set from the rcWork member of MONITORINFOEX, to whit: // "A RECT structure that specifies the work area rectangle of the @@ -70,7 +70,7 @@ // rcMonitor contains system windows such as the task bar and side // bars. Note that if the monitor is not the primary display monitor, // some of the rectangle's coordinates may be negative values". - WebRect available_rect; + gfx::Rect available_rect; // This is the orientation 'type' or 'name', as in landscape-primary or // portrait-secondary for examples.
diff --git a/third_party/blink/renderer/core/animation/README.md b/third_party/blink/renderer/core/animation/README.md index ebecfdb..60cd133 100644 --- a/third_party/blink/renderer/core/animation/README.md +++ b/third_party/blink/renderer/core/animation/README.md
@@ -33,7 +33,7 @@ https://cs.chromium.org/search/?q=class:blink::Animation$)) with the majority of the code being common to all three animation types. -### CSS animations +### CSS animation CSS animations are created via CSS rules, whereby an animation-name property (or animation shorthand property) refers to one or more keyframes rules. @@ -193,6 +193,114 @@ [MDN Element.animate]( https://developer.mozilla.org/en-US/docs/Web/API/Element/animate) page. +## Web animation model + +At a fundamental level, the web animation model converts a time value to one or +more property values. This is true whether we are using a DocumentTimeline +driven by an AnimationClock, or a ScrollTimeline that converts a scroll position +to an abstract representation of time. The same rules also apply for +CSSAnimations and CSSTransitions, which derive from the base Animation class. + +The web animation model can be further broken down into two sub-models: + +1. A 'timing model' which converts time to an iteration index and progress +(proportional value between 0 and 1). + +2. An 'animation model' which converts the progress to property values. + + + +The division of responsibilities can best be illustrated through an example. +Consider the following: + +```css +@keyframes fade { + from { opacity: 1; animation-timing-function: ease-in; } + 50% { opacity: 0.5; animation-timing-function: ease-out; } + to { opacity: 0; } +} +.pulse { + animation-name: fade; + animation-iteration-count: 3; + animation-duration: 0.5s; + animation-delay: 200ms; + animation-direction: alternate-reverse; + animation-fill: both; +} +``` +```javascript +element.classList.add('pulse'); +``` + +Prior to the 200ms mark, the animation is in the 'before' phase. since the +elapsed time is less than the start delay (200ms). Conversely, after the 1.7s +mark (start delay + itertions * duration), the animation is in the 'after' +phase. Between these time boundaries, we are in the 'active' phase, and the +timing model is applied to calculate the iteration index and progress. + +At the 1s mark of the animation, we are 0.8s into playing the animation (active +time) due to the start delay. Each iteration takes 0.5s, putting us 0.3s into +the second iteration, which is in the forward direction since alternating and +initially playing backwards (alternate-reverse). The last step of the timing +model is to convert the iteration time to an iteration progress. This is simply +the ratio of the iteration time to the iteration duration (0.3s / 0.5s = 0.6). + +Conversely, at the 0.5s mark, we are 0.3s into an iteration playing in the +reverse direction. As the iteration progress measures progress in the forward +direction, the iteration progress becomes 1 - directional progress, which is +1 - 0.3s / 0.5s = 0.4. + +The animation model converts the iteration index and progress into property +values. As the iteration-composite property is not supported at this time, only +the iteration progress is a factor in our calculations. The iteration progress +is fed into the keyframes model to compute property values. + +Each keyframe has an offset, and for each property, we determine the keyframe +pair that bounds the iteration progress. Returning to our example with an +iteration progress of 0.6 at the 1s mark, we are iterating between the '50%' +and 'to' keyframes. The relative progress between these frames is +(0.6 - 0.5) / (1.0 - 0.5) = 0.2. This value is the input to our +animation-timing-function. The timing function for this keyframe pair +is 'ease-out', which is equivalent to cubic-bezier(0, 0, 0.58, 1)). Plugging an +input value of 0.2 into our cubic-bezier function, we get an output of roughly +0.31, which is the local progress value used for interpolation between the two +keyframes. For any scalar-valued property, the interpolation function is: + +v = progress * v_1 + (1 - progress) * v_0 + +For our example, + +opacity = 0.31 * 0 + (1 - 0.31) * 0.5 = 0.35 + +The interpolation procedure is less straightforward for non-scalar values +(especially for transform lists). Nonetheless, this example provides a good +overview of the web animation model. + +Points of interest in the Blink code base: +* [timing_calculations.h]( +https://cs.chromium.org/search?q=file:core/animation/timing_calculations.h): +contains static helper functions for various timing calculations used in the +animation model such as determining the phase of the animation, iteration +progress and transformed progress. +* [AnimationEffect::UpdateInheritedTime]( +https://cs.chromium.org/search?q=function:blink::AnimationEffect::UpdateInheritedTime): +applies the web animation model and dispatches animation/transition events. +* [InterpolationEffect::GetActiveInterpolations]( +https://cs.chromium.org/search?q=function:blink::InterpolationEffect::GetActiveInterpolations): +creates a list of active interpolations by determining keyframe-pairs that bound +the iteration progress and determining the 'local' progress between keyframes. +If a timing function is specified for the interpolation, it is applied when +computing the 'local' progress. +* [KeyframeEffect::ApplyEffects]( +https://cs.chromium.org/search?q=function:blink::KeyframeEffect::ApplyEffects): +Samples the keyframe effect, adding it to the effect stack if necessary and +signaling that an animation style recalc is needed if the sampled value changed. +* [Animation::Update]( +https://cs.chromium.org/search?q=function:blink::Animation::Update): +Called in response to ticking the animation timeline or to revalidate outdated +animations. In addition to applying the web animation model via +UpdateInheritedTime, this method determines if the animation is finished. + ## Integration with Chromium
diff --git a/third_party/blink/renderer/core/css/media_values.cc b/third_party/blink/renderer/core/css/media_values.cc index 4764298..f73cf86 100644 --- a/third_party/blink/renderer/core/css/media_values.cc +++ b/third_party/blink/renderer/core/css/media_values.cc
@@ -63,7 +63,7 @@ DCHECK(frame && frame->View() && frame->GetSettings() && frame->GetPage()); blink::WebScreenInfo screen_info = frame->GetPage()->GetChromeClient().GetScreenInfo(*frame); - int device_width = screen_info.rect.width; + int device_width = screen_info.rect.width(); if (frame->GetSettings()->GetReportScreenSizeInPhysicalPixelsQuirk()) { device_width = static_cast<int>( lroundf(device_width * screen_info.device_scale_factor)); @@ -75,7 +75,7 @@ DCHECK(frame && frame->View() && frame->GetSettings() && frame->GetPage()); blink::WebScreenInfo screen_info = frame->GetPage()->GetChromeClient().GetScreenInfo(*frame); - int device_height = screen_info.rect.height; + int device_height = screen_info.rect.height(); if (frame->GetSettings()->GetReportScreenSizeInPhysicalPixelsQuirk()) { device_height = static_cast<int>( lroundf(device_height * screen_info.device_scale_factor));
diff --git a/third_party/blink/renderer/core/display_lock/README.md b/third_party/blink/renderer/core/display_lock/README.md new file mode 100644 index 0000000..51cd73d --- /dev/null +++ b/third_party/blink/renderer/core/display_lock/README.md
@@ -0,0 +1,56 @@ +## Display Locking (a.k.a. content-visibility). + +This directory is an implementation of a CSS feature +[content-visibility](https://drafts.csswg.org/css-contain/#content-visibility). + +### Naming Conventions + +Other than the places that rely on the name content-visibility as developer +exposed features, the code uses display-locking naming: + +* Locked: this means that the context and the element itself is locked for + display, and will not paint or hit-test its contents. The lock is acquired by + content-visibility properties hidden and auto (when not on-screen). +* Unlocked: this means that the context and the element itself behave as if + there was no display lock acquired, painting and laying out as usual. + +### Brief structure overview + +When a content-visibility property is specified with a value that may require +locking, a DisplayLockContext is created on the element's rare data. The state +of the context is updated by the style adjuster in response to style changes. +Additionally, the element's containment is also adjusted in style adjuster in +response to the actual state of the DisplayLockContext. + +In lifecycle phases, such as style, layout, and paint, code checks +LayoutObject::LayoutBlockedByDisplayLock and similar functions in order to +determine whether processing of work should happen. The function takes a +DisplayLockLifecycleTarget enum, with either kSelf or kChildren values in order +to identify whether the element itself should layout. + +Note that due to the evolution of the feature, kChildren is the typical value to +use. + +Note that the LayoutObject checks delegate the decision to the +DisplayLockContext and can be thought of as helper functions. + +The DisplayLockContext thus acts as an authoritative source of information when +it comes to deciding whether contents lifecycle should be processed in response +to content-visibility values. It is also responsible for blocking dirty-bit +propagation and restoring the dirty-bit state upon unlocking. + +In addition to DisplayLockContext and LayoutObject helper functions, a +DisplayLockUtilities class is provided with a set of static functions that +perform common functionality, such as checking whether an element is within a +locked subtree without itself being locked. + +### Ongoing work + +This feature is new, and some work is continuing in the area. + +In particular, we are working on adding a beforematch event as well as a +hidden-matchable value for content-visibility property which allows +searchability in hidden content. + +In addition, we are working on developing an updateRendering javascript method +which allows asynchronous updates to locked / hidden display lock subtree.
diff --git a/third_party/blink/renderer/core/dom/document_init.cc b/third_party/blink/renderer/core/dom/document_init.cc index 3d528f5..8f240cb 100644 --- a/third_party/blink/renderer/core/dom/document_init.cc +++ b/third_party/blink/renderer/core/dom/document_init.cc
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/core/dom/dom_implementation.h" #include "third_party/blink/renderer/core/dom/sink_document.h" #include "third_party/blink/renderer/core/dom/xml_document.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/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/settings.h" @@ -57,7 +56,6 @@ #include "third_party/blink/renderer/platform/network/mime/content_type.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/blink/renderer/platform/network/network_utils.h" -#include "third_party/blink/renderer/platform/web_test_support.h" namespace blink { @@ -72,11 +70,6 @@ return &owner_element->GetDocument(); } -bool IsPagePopupRunningInWebTest(LocalFrame* frame) { - return frame && frame->GetPage()->GetChromeClient().IsPopup() && - WebTestSupport::IsRunningWebTest(); -} - // static DocumentInit DocumentInit::Create() { return DocumentInit(); @@ -124,29 +117,16 @@ return nullptr; } -network::mojom::blink::WebSandboxFlags DocumentInit::GetSandboxFlags() const { - network::mojom::blink::WebSandboxFlags flags = sandbox_flags_; - if (content_security_policy_) - flags |= content_security_policy_->GetSandboxMask(); - if (DocumentLoader* loader = TreeRootDocumentLoader()) - flags |= loader->GetFrame()->Loader().EffectiveSandboxFlags(); - return flags; -} - -DocumentInit& DocumentInit::WithDocumentLoader(DocumentLoader* loader, - ContentSecurityPolicy* policy) { +DocumentInit& DocumentInit::WithDocumentLoader(DocumentLoader* loader) { DCHECK(!document_loader_); DCHECK(!execution_context_); DCHECK(!imports_controller_); #if DCHECK_IS_ON() DCHECK(!for_test_); #endif - DCHECK(!content_security_policy_); DCHECK(loader); - DCHECK(policy); document_loader_ = loader; parent_document_ = ParentDocument(document_loader_); - content_security_policy_ = policy; return *this; } @@ -269,125 +249,17 @@ return owner_document_ ? owner_document_->CookieURL() : url_; } -void DocumentInit::CalculateAndCacheDocumentOrigin() { - DCHECK(!cached_document_origin_); - cached_document_origin_ = GetDocumentOrigin(); -} - -scoped_refptr<SecurityOrigin> DocumentInit::GetDocumentOrigin() const { - if (cached_document_origin_) - return cached_document_origin_; - - scoped_refptr<SecurityOrigin> document_origin; - if (origin_to_commit_) { - // Origin to commit is specified by the browser process, it must be taken - // and used directly. It is currently supplied only for session history - // navigations, where the origin was already calcuated previously and - // stored on the session history entry. - document_origin = origin_to_commit_; - } else if (IsPagePopupRunningInWebTest(GetFrame())) { - // If we are a page popup in LayoutTests ensure we use the popup - // owner's security origin so the tests can possibly access the - // document via internals API. - auto* owner_context = GetFrame()->PagePopupOwner()->GetExecutionContext(); - document_origin = owner_context->GetSecurityOrigin()->IsolatedCopy(); - } else if (owner_document_ && owner_document_->domWindow()) { - document_origin = owner_document_->domWindow()->GetMutableSecurityOrigin(); - } else { - // Otherwise, create an origin that propagates precursor information - // as needed. For non-opaque origins, this creates a standard tuple - // origin, but for opaque origins, it creates an origin with the - // initiator origin as the precursor. - document_origin = SecurityOrigin::CreateWithReferenceOrigin( - url_, initiator_origin_.get()); - } - - if (IsSandboxed(network::mojom::blink::WebSandboxFlags::kOrigin)) { - auto sandbox_origin = document_origin->DeriveNewOpaqueOrigin(); - - // If we're supposed to inherit our security origin from our - // owner, but we're also sandboxed, the only things we inherit are - // the origin's potential trustworthiness and the ability to - // load local resources. The latter lets about:blank iframes in - // file:// URL documents load images and other resources from - // the file system. - // - // Note: Sandboxed about:srcdoc iframe without "allow-same-origin" aren't - // allowed to load user's file, even if its parent can. - if (owner_document_) { - if (document_origin->IsPotentiallyTrustworthy()) - sandbox_origin->SetOpaqueOriginIsPotentiallyTrustworthy(true); - if (document_origin->CanLoadLocalResources() && !IsSrcdocDocument()) - sandbox_origin->GrantLoadLocalResources(); - } - document_origin = sandbox_origin; - } - - if (TreeRootDocumentLoader() && - TreeRootDocumentLoader()->GetFrame()->GetSettings()) { - Settings* settings = TreeRootDocumentLoader()->GetFrame()->GetSettings(); - if (!settings->GetWebSecurityEnabled()) { - // Web security is turned off. We should let this document access - // every other document. This is used primary by testing harnesses for - // web sites. - document_origin->GrantUniversalAccess(); - } else if (document_origin->IsLocal()) { - if (settings->GetAllowUniversalAccessFromFileURLs()) { - // Some clients want local URLs to have universal access, but that - // setting is dangerous for other clients. - document_origin->GrantUniversalAccess(); - } else if (!settings->GetAllowFileAccessFromFileURLs()) { - // Some clients do not want local URLs to have access to other local - // URLs. - document_origin->BlockLocalAccessFromLocalOrigin(); - } - } - } - - if (grant_load_local_resources_) - document_origin->GrantLoadLocalResources(); - - if (document_origin->IsOpaque() && ShouldSetURL()) { - KURL url = url_.IsEmpty() ? BlankURL() : url_; - if (SecurityOrigin::Create(url)->IsPotentiallyTrustworthy()) - document_origin->SetOpaqueOriginIsPotentiallyTrustworthy(true); - } - return document_origin; -} - DocumentInit& DocumentInit::WithOwnerDocument(Document* owner_document) { DCHECK(!owner_document_); - DCHECK(!initiator_origin_ || !owner_document || - owner_document->domWindow()->GetSecurityOrigin() == initiator_origin_); owner_document_ = owner_document; return *this; } -DocumentInit& DocumentInit::WithInitiatorOrigin( - scoped_refptr<const SecurityOrigin> initiator_origin) { - DCHECK(!initiator_origin_); - DCHECK(!initiator_origin || !owner_document_ || - owner_document_->domWindow()->GetSecurityOrigin() == initiator_origin); - initiator_origin_ = std::move(initiator_origin); - return *this; -} - -DocumentInit& DocumentInit::WithOriginToCommit( - scoped_refptr<SecurityOrigin> origin_to_commit) { - origin_to_commit_ = std::move(origin_to_commit); - return *this; -} - DocumentInit& DocumentInit::WithSrcdocDocument(bool is_srcdoc_document) { is_srcdoc_document_ = is_srcdoc_document; return *this; } -DocumentInit& DocumentInit::WithGrantLoadLocalResources( - bool grant_load_local_resources) { - grant_load_local_resources_ = grant_load_local_resources; - return *this; -} DocumentInit& DocumentInit::WithRegistrationContext( V0CustomElementRegistrationContext* registration_context) { @@ -428,29 +300,15 @@ return *this; } -ContentSecurityPolicy* DocumentInit::GetContentSecurityPolicy() const { - return content_security_policy_; -} - DocumentInit& DocumentInit::WithWebBundleClaimedUrl( const KURL& web_bundle_claimed_url) { web_bundle_claimed_url_ = web_bundle_claimed_url; return *this; } -bool DocumentInit::ShouldReuseDOMWindow() const { - DCHECK(GetFrame()); - // Secure transitions can only happen when navigating from the initial empty - // document. - if (!GetFrame()->Loader().StateMachine()->IsDisplayingInitialEmptyDocument()) - return false; - return GetFrame()->DomWindow()->GetSecurityOrigin()->CanAccess( - GetDocumentOrigin().get()); -} - bool DocumentInit::IsSandboxed( network::mojom::blink::WebSandboxFlags mask) const { - return (GetSandboxFlags() & mask) != + return (sandbox_flags_ & mask) != network::mojom::blink::WebSandboxFlags::kNone; }
diff --git a/third_party/blink/renderer/core/dom/document_init.h b/third_party/blink/renderer/core/dom/document_init.h index b76aa1f..4ce78e9f 100644 --- a/third_party/blink/renderer/core/dom/document_init.h +++ b/third_party/blink/renderer/core/dom/document_init.h
@@ -40,7 +40,6 @@ namespace blink { -class ContentSecurityPolicy; class Document; class DocumentLoader; class ExecutionContext; @@ -104,9 +103,8 @@ bool HasSecurityContext() const { return TreeRootDocumentLoader(); } bool IsSrcdocDocument() const; bool ShouldSetURL() const; - network::mojom::blink::WebSandboxFlags GetSandboxFlags() const; - DocumentInit& WithDocumentLoader(DocumentLoader*, ContentSecurityPolicy*); + DocumentInit& WithDocumentLoader(DocumentLoader*); LocalFrame* GetFrame() const; UseCounter* GetUseCounter() const; @@ -135,26 +133,10 @@ const KURL& GetCookieUrl() const; - // Pre-calculates the origin. This is needed for DocumentLoader, which wants - // to inspect the origin multiple times and should receive the same object - // back each time. - void CalculateAndCacheDocumentOrigin(); - scoped_refptr<SecurityOrigin> GetDocumentOrigin() const; - // Specifies the Document to inherit security configurations from. DocumentInit& WithOwnerDocument(Document*); - // Specifies the SecurityOrigin in which the URL was requested. This is - // relevant for determining properties of the resulting document's origin - // when loading data: and about: schemes. - DocumentInit& WithInitiatorOrigin( - scoped_refptr<const SecurityOrigin> initiator_origin); - - DocumentInit& WithOriginToCommit( - scoped_refptr<SecurityOrigin> origin_to_commit); - DocumentInit& WithSrcdocDocument(bool is_srcdoc_document); - DocumentInit& WithGrantLoadLocalResources(bool grant_load_local_resources); DocumentInit& WithRegistrationContext(V0CustomElementRegistrationContext*); V0CustomElementRegistrationContext* RegistrationContext(Document*) const; @@ -162,13 +144,9 @@ DocumentInit& WithSandboxFlags(network::mojom::blink::WebSandboxFlags flags); - ContentSecurityPolicy* GetContentSecurityPolicy() const; - DocumentInit& WithWebBundleClaimedUrl(const KURL& web_bundle_claimed_url); const KURL& GetWebBundleClaimedUrl() const { return web_bundle_claimed_url_; } - bool ShouldReuseDOMWindow() const; - private: DocumentInit() = default; @@ -194,36 +172,10 @@ KURL url_; Document* owner_document_ = nullptr; - // Used to cache the final origin for the Document to be created. - scoped_refptr<SecurityOrigin> cached_document_origin_; - - // Initiator origin is used for calculating the document origin when the - // navigation is started in a different process. In such cases, the document - // which initiates the navigation sends its origin to the browser process and - // it is provided by the browser process here. It is used for cases such as - // data: URLs, which inherit their origin from the initiator of the - // navigation. - // Note: about:blank should also behave this way, however currently it - // inherits its origin from the parent frame or opener, regardless of whether - // it is the initiator or not. - scoped_refptr<const SecurityOrigin> initiator_origin_; - - // The |origin_to_commit_| is to be used directly without calculating the - // document origin at initialization time. It is specified by the browser - // process for session history navigations. This allows us to preserve - // the origin across session history and ensure the exact same origin - // is present on such navigations to URLs that inherit their origins (e.g. - // about:blank and data: URLs). - scoped_refptr<SecurityOrigin> origin_to_commit_; - // Whether we should treat the new document as "srcdoc" document. This // affects security checks, since srcdoc's content comes directly from // the parent document, not from loading a URL. bool is_srcdoc_document_ = false; - - // Whether the document should be able to access local file:// resources. - bool grant_load_local_resources_ = false; - V0CustomElementRegistrationContext* registration_context_ = nullptr; bool create_new_registration_context_ = false; @@ -231,9 +183,6 @@ network::mojom::blink::WebSandboxFlags sandbox_flags_ = network::mojom::blink::WebSandboxFlags::kNone; - // Loader's CSP - ContentSecurityPolicy* content_security_policy_ = nullptr; - // The claimed URL inside Web Bundle file from which the document is loaded. // This URL is used for window.location and document.URL and relative path // computation in the document.
diff --git a/third_party/blink/renderer/core/events/navigator_events.idl b/third_party/blink/renderer/core/events/navigator_events.idl index da8d0e7a..78c753fd 100644 --- a/third_party/blink/renderer/core/events/navigator_events.idl +++ b/third_party/blink/renderer/core/events/navigator_events.idl
@@ -33,5 +33,5 @@ [ ImplementedAs=NavigatorEvents ] partial interface Navigator { - [HighEntropy, MeasureAs=NavigatorMaxTouchPoints] readonly attribute long maxTouchPoints; + [HighEntropy=Direct, MeasureAs=NavigatorMaxTouchPoints] readonly attribute long maxTouchPoints; };
diff --git a/third_party/blink/renderer/core/execution_context/security_context.cc b/third_party/blink/renderer/core/execution_context/security_context.cc index 9a2ba91..a6c696e5 100644 --- a/third_party/blink/renderer/core/execution_context/security_context.cc +++ b/third_party/blink/renderer/core/execution_context/security_context.cc
@@ -75,12 +75,10 @@ } security_origin_ = init.GetSecurityOrigin(); secure_context_mode_ = init.GetSecureContextMode(); - ApplySandboxFlags(init.GetSandboxFlags()); feature_policy_ = init.CreateFeaturePolicy(); report_only_feature_policy_ = init.CreateReportOnlyFeaturePolicy(); document_policy_ = init.CreateDocumentPolicy(); report_only_document_policy_ = init.CreateReportOnlyDocumentPolicy(); - SetContentSecurityPolicy(init.GetCSP()); origin_trial_context_ = init.GetOriginTrialContext(); }
diff --git a/third_party/blink/renderer/core/execution_context/security_context_init.cc b/third_party/blink/renderer/core/execution_context/security_context_init.cc index 445f90b..910c56e 100644 --- a/third_party/blink/renderer/core/execution_context/security_context_init.cc +++ b/third_party/blink/renderer/core/execution_context/security_context_init.cc
@@ -7,7 +7,6 @@ #include "base/metrics/histogram_macros.h" #include "services/network/public/cpp/web_sandbox_flags.h" #include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" -#include "third_party/blink/renderer/core/dom/document_init.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/execution_context/agent.h" #include "third_party/blink/renderer/core/feature_policy/document_policy_parser.h" @@ -87,17 +86,9 @@ // A helper class that allows the security context be initialized in the // process of constructing the document. -SecurityContextInit::SecurityContextInit(const DocumentInit& initializer) - : execution_context_(initializer.GetExecutionContext()), - csp_(initializer.GetContentSecurityPolicy()), - sandbox_flags_(initializer.GetSandboxFlags()), - security_origin_(initializer.GetDocumentOrigin()) { - // Derive possibly a new security origin that contains the agent cluster id. - if (execution_context_) { - security_origin_ = security_origin_->GetOriginForAgentCluster( - execution_context_->GetAgent()->cluster_id()); - } -} +SecurityContextInit::SecurityContextInit(ExecutionContext* context, + scoped_refptr<SecurityOrigin> origin) + : execution_context_(context), security_origin_(std::move(origin)) {} void SecurityContextInit::CountFeaturePolicyUsage( mojom::blink::WebFeature feature) { @@ -158,7 +149,6 @@ void SecurityContextInit::CalculateFeaturePolicy( LocalFrame* frame, - bool is_view_source, const ResourceResponse& response, const base::Optional<WebOriginPolicy>& origin_policy, const FramePolicy& frame_policy) { @@ -166,7 +156,7 @@ initialized_feature_policy_state_ = true; // If we are a HTMLViewSourceDocument we use container, header or // inherited policies. https://crbug.com/898688. - if (is_view_source) + if (frame && frame->InViewSourceMode()) return; // For a main frame, get inherited feature policy from the opener if any. @@ -225,13 +215,16 @@ } } - if (sandbox_flags_ != network::mojom::blink::WebSandboxFlags::kNone && + // DocumentLoader applied the sandbox flags before calling this function, so + // they are accessible here. + auto sandbox_flags = execution_context_->GetSandboxFlags(); + if (sandbox_flags != network::mojom::blink::WebSandboxFlags::kNone && RuntimeEnabledFeatures::FeaturePolicyForSandboxEnabled()) { // The sandbox flags might have come from CSP header or the browser; in // such cases the sandbox is not part of the container policy. They are // added to the header policy (which specifically makes sense in the case // of CSP sandbox). - ApplySandboxFlagsToParsedFeaturePolicy(sandbox_flags_, + ApplySandboxFlagsToParsedFeaturePolicy(sandbox_flags, feature_policy_header_); } @@ -242,7 +235,7 @@ // feature policy is initialized. if (RuntimeEnabledFeatures::BlockingFocusWithoutUserActivationEnabled() && frame && frame->Tree().Parent() && - (sandbox_flags_ & network::mojom::blink::WebSandboxFlags::kNavigation) != + (sandbox_flags & network::mojom::blink::WebSandboxFlags::kNavigation) != network::mojom::blink::WebSandboxFlags::kNone) { // Enforcing the policy for sandbox frames (for context see // https://crbug.com/954349). @@ -348,7 +341,8 @@ secure_context_mode_ = SecureContextMode::kInsecureContext; } bool is_secure = secure_context_mode_ == SecureContextMode::kSecureContext; - if (GetSandboxFlags() != network::mojom::blink::WebSandboxFlags::kNone) { + if (execution_context_->GetSandboxFlags() != + network::mojom::blink::WebSandboxFlags::kNone) { UseCounter::Count( execution_context_, is_secure ? WebFeature::kSecureContextCheckForSandboxedOriginPassed
diff --git a/third_party/blink/renderer/core/execution_context/security_context_init.h b/third_party/blink/renderer/core/execution_context/security_context_init.h index c700b10..bb248f33 100644 --- a/third_party/blink/renderer/core/execution_context/security_context_init.h +++ b/third_party/blink/renderer/core/execution_context/security_context_init.h
@@ -5,7 +5,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EXECUTION_CONTEXT_SECURITY_CONTEXT_INIT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EXECUTION_CONTEXT_SECURITY_CONTEXT_INIT_H_ -#include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/frame/frame_policy.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" @@ -20,9 +19,7 @@ #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { -class ContentSecurityPolicy; class Document; -class DocumentInit; class Frame; class LocalFrame; class OriginTrialContext; @@ -33,14 +30,16 @@ STACK_ALLOCATED(); public: + // The first constructor is for workers and tests. The second is for windows. + // TODO(japhet): Merge these. SecurityContextInit(scoped_refptr<SecurityOrigin>, OriginTrialContext*); - explicit SecurityContextInit(const DocumentInit&); + explicit SecurityContextInit(ExecutionContext*, + scoped_refptr<SecurityOrigin>); void CalculateSecureContextMode(LocalFrame* frame); void InitializeOriginTrials(const String& origin_trials_header); void CalculateFeaturePolicy( LocalFrame* frame, - bool is_view_source, const ResourceResponse& response, const base::Optional<WebOriginPolicy>& origin_policy, const FramePolicy& frame_policy); @@ -52,12 +51,6 @@ return security_origin_; } - network::mojom::blink::WebSandboxFlags GetSandboxFlags() const { - return sandbox_flags_; - } - - ContentSecurityPolicy* GetCSP() const { return csp_; } - // Returns nullptr if SecurityContext is used for non-Document contexts(i.e., // workers and tests). std::unique_ptr<FeaturePolicy> CreateFeaturePolicy() const; @@ -88,9 +81,6 @@ private: ExecutionContext* execution_context_ = nullptr; - ContentSecurityPolicy* csp_ = nullptr; - network::mojom::blink::WebSandboxFlags sandbox_flags_ = - network::mojom::blink::WebSandboxFlags::kNone; scoped_refptr<SecurityOrigin> security_origin_; DocumentPolicy::ParsedDocumentPolicy document_policy_; DocumentPolicy::ParsedDocumentPolicy report_only_document_policy_;
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index 10d5ad1..c826c81 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -7829,8 +7829,7 @@ frame_test_helpers::WebViewHelper web_view_helper; int viewport_width = 640; int viewport_height = 480; - client.screen_info_.rect.width = viewport_width; - client.screen_info_.rect.height = viewport_height; + client.screen_info_.rect = gfx::Rect(viewport_width, viewport_height); WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( base_url_ + "fullscreen_div.html", nullptr, nullptr, &client, ConfigureAndroid); @@ -7855,8 +7854,7 @@ EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalHeight().ToInt()); // Verify it's updated after a device rotation. - client.screen_info_.rect.width = viewport_height; - client.screen_info_.rect.height = viewport_width; + client.screen_info_.rect = gfx::Rect(viewport_height, viewport_width); web_view_helper.Resize(WebSize(viewport_height, viewport_width)); UpdateAllLifecyclePhases(web_view_impl); EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); @@ -7984,8 +7982,7 @@ ConfigureAndroid); int viewport_width = 640; int viewport_height = 480; - client.screen_info_.rect.width = viewport_width; - client.screen_info_.rect.height = viewport_height; + client.screen_info_.rect = gfx::Rect(viewport_width, viewport_height); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); UpdateAllLifecyclePhases(web_view_impl); @@ -8007,8 +8004,7 @@ EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalHeight().ToInt()); // Verify it's updated after a device rotation. - client.screen_info_.rect.width = viewport_height; - client.screen_info_.rect.height = viewport_width; + client.screen_info_.rect = gfx::Rect(viewport_height, viewport_width); web_view_helper.Resize(WebSize(viewport_height, viewport_width)); UpdateAllLifecyclePhases(web_view_impl); EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); @@ -8068,8 +8064,7 @@ ConfigureAndroid); int viewport_width = 384; int viewport_height = 640; - client.screen_info_.rect.width = viewport_width; - client.screen_info_.rect.height = viewport_height; + client.screen_info_.rect = gfx::Rect(viewport_width, viewport_height); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); UpdateAllLifecyclePhases(web_view_impl); @@ -8112,8 +8107,7 @@ ConfigureAndroid); int viewport_width = 384; int viewport_height = 640; - client.screen_info_.rect.width = viewport_width; - client.screen_info_.rect.height = viewport_height; + client.screen_info_.rect = gfx::Rect(viewport_width, viewport_height); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); UpdateAllLifecyclePhases(web_view_impl); @@ -8134,8 +8128,7 @@ viewport_width = 640; viewport_height = 384; - client.screen_info_.rect.width = viewport_width; - client.screen_info_.rect.height = viewport_height; + client.screen_info_.rect = gfx::Rect(viewport_width, viewport_height); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); UpdateAllLifecyclePhases(web_view_impl); EXPECT_EQ(640, layout_view->LogicalWidth().Floor()); @@ -8168,10 +8161,9 @@ WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( base_url_ + "fullscreen_restore_scale_factor.html", nullptr, nullptr, &client, &ConfigureAndroid); - client.screen_info_.rect.width = - screen_size_minus_status_bars_minus_url_bar.width; - client.screen_info_.rect.height = - screen_size_minus_status_bars_minus_url_bar.height; + client.screen_info_.rect = + gfx::Rect(screen_size_minus_status_bars_minus_url_bar.width, + screen_size_minus_status_bars_minus_url_bar.height); web_view_helper.Resize(screen_size_minus_status_bars_minus_url_bar); auto* layout_view = web_view_helper.GetWebView() ->MainFrameImpl() @@ -8193,11 +8185,10 @@ web_view_impl->MainFrameWidget()->DidEnterFullscreen(); UpdateAllLifecyclePhases(web_view_impl); - client.screen_info_.rect.width = screen_size_minus_status_bars.width; - client.screen_info_.rect.height = screen_size_minus_status_bars.height; + client.screen_info_.rect = gfx::Rect(screen_size_minus_status_bars.width, + screen_size_minus_status_bars.height); web_view_helper.Resize(screen_size_minus_status_bars); - client.screen_info_.rect.width = screen_size.width; - client.screen_info_.rect.height = screen_size.height; + client.screen_info_.rect = gfx::Rect(screen_size.width, screen_size.height); web_view_helper.Resize(screen_size); EXPECT_EQ(screen_size.width, layout_view->LogicalWidth().Floor()); EXPECT_EQ(screen_size.height, layout_view->LogicalHeight().Floor()); @@ -8207,13 +8198,12 @@ web_view_impl->MainFrameWidget()->DidExitFullscreen(); UpdateAllLifecyclePhases(web_view_impl); - client.screen_info_.rect.width = screen_size_minus_status_bars.width; - client.screen_info_.rect.height = screen_size_minus_status_bars.height; + client.screen_info_.rect = gfx::Rect(screen_size_minus_status_bars.width, + screen_size_minus_status_bars.height); web_view_helper.Resize(screen_size_minus_status_bars); - client.screen_info_.rect.width = - screen_size_minus_status_bars_minus_url_bar.width; - client.screen_info_.rect.height = - screen_size_minus_status_bars_minus_url_bar.height; + client.screen_info_.rect = + gfx::Rect(screen_size_minus_status_bars_minus_url_bar.width, + screen_size_minus_status_bars_minus_url_bar.height); web_view_helper.Resize(screen_size_minus_status_bars_minus_url_bar); EXPECT_EQ(screen_size_minus_status_bars_minus_url_bar.width, layout_view->LogicalWidth().Floor()); @@ -9787,37 +9777,37 @@ Element* element = frame->GetDocument()->getElementById("test"); ASSERT_TRUE(element); - client.screen_info_.rect = WebRect(0, 0, 700, 500); + client.screen_info_.rect = gfx::Rect(700, 500); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(700, 500)); EXPECT_EQ(300, element->OffsetWidth()); EXPECT_EQ(300, element->OffsetHeight()); - client.screen_info_.rect = WebRect(0, 0, 710, 500); + client.screen_info_.rect = gfx::Rect(710, 500); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(710, 500)); EXPECT_EQ(400, element->OffsetWidth()); EXPECT_EQ(300, element->OffsetHeight()); - client.screen_info_.rect = WebRect(0, 0, 690, 500); + client.screen_info_.rect = gfx::Rect(690, 500); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(690, 500)); EXPECT_EQ(200, element->OffsetWidth()); EXPECT_EQ(300, element->OffsetHeight()); - client.screen_info_.rect = WebRect(0, 0, 700, 510); + client.screen_info_.rect = gfx::Rect(700, 510); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(700, 510)); EXPECT_EQ(300, element->OffsetWidth()); EXPECT_EQ(400, element->OffsetHeight()); - client.screen_info_.rect = WebRect(0, 0, 700, 490); + client.screen_info_.rect = gfx::Rect(700, 490); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(700, 490)); EXPECT_EQ(300, element->OffsetWidth()); EXPECT_EQ(200, element->OffsetHeight()); - client.screen_info_.rect = WebRect(0, 0, 690, 510); + client.screen_info_.rect = gfx::Rect(690, 510); client.screen_info_.available_rect = client.screen_info_.rect; web_view_helper.Resize(WebSize(690, 510)); EXPECT_EQ(200, element->OffsetWidth()); @@ -9834,7 +9824,7 @@ } void TestResize(const WebSize size, const String& expected_size) { - client_.screen_info_.rect = WebRect(0, 0, size.width, size.height); + client_.screen_info_.rect = gfx::Rect(size.width, size.height); client_.screen_info_.available_rect = client_.screen_info_.rect; web_view_helper_.Resize(size); EXPECT_EQ(expected_size, DumpSize("test"));
diff --git a/third_party/blink/renderer/core/frame/dactyloscoper.cc b/third_party/blink/renderer/core/frame/dactyloscoper.cc index e1776353..1fc5af7 100644 --- a/third_party/blink/renderer/core/frame/dactyloscoper.cc +++ b/third_party/blink/renderer/core/frame/dactyloscoper.cc
@@ -33,7 +33,7 @@ // static void Dactyloscoper::RecordDirectSurface(ExecutionContext* context, WebFeature feature, - unsigned value) { + IdentifiableToken value) { auto* window = DynamicTo<LocalDOMWindow>(context); if (!window) return;
diff --git a/third_party/blink/renderer/core/frame/dactyloscoper.h b/third_party/blink/renderer/core/frame/dactyloscoper.h index bb4d3e4a..4c25ae7 100644 --- a/third_party/blink/renderer/core/frame/dactyloscoper.h +++ b/third_party/blink/renderer/core/frame/dactyloscoper.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DACTYLOSCOPER_H_ +#include "third_party/blink/public/common/privacy_budget/identifiable_token.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -25,7 +26,9 @@ static void Record(ExecutionContext*, WebFeature); - static void RecordDirectSurface(ExecutionContext*, WebFeature, unsigned); + static void RecordDirectSurface(ExecutionContext*, + WebFeature, + IdentifiableToken); static void RecordDirectSurface(ExecutionContext*, WebFeature, String); private:
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 55dfea6a..6d91a9a4 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -1818,8 +1818,7 @@ DomWindow()->InstallNewDocument( DocumentInit::Create() - .WithDocumentLoader(loader_.GetDocumentLoader(), - MakeGarbageCollected<ContentSecurityPolicy>()) + .WithDocumentLoader(loader_.GetDocumentLoader()) .WithTypeFrom(mime_type)); loader_.StateMachine()->AdvanceTo( FrameLoaderStateMachine::kCommittedFirstRealLoad);
diff --git a/third_party/blink/renderer/core/frame/navigator.idl b/third_party/blink/renderer/core/frame/navigator.idl index 9a1f030..c66bc24 100644 --- a/third_party/blink/renderer/core/frame/navigator.idl +++ b/third_party/blink/renderer/core/frame/navigator.idl
@@ -25,13 +25,13 @@ // objects implementing this interface also implement the interfaces given below // TODO(foolip): vendorSub should be on NavigatorID. - [HighEntropy, MeasureAs=NavigatorVendorSub] readonly attribute DOMString vendorSub; + [HighEntropy=Direct, MeasureAs=NavigatorVendorSub] readonly attribute DOMString vendorSub; // TODO(foolip): productSub and vendor are not yet in the spec: // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27954 - [HighEntropy, MeasureAs=NavigatorProductSub] readonly attribute DOMString productSub; + [HighEntropy=Direct, MeasureAs=NavigatorProductSub] readonly attribute DOMString productSub; // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27786 - [HighEntropy, MeasureAs=NavigatorVendor] readonly attribute DOMString vendor; + [HighEntropy=Direct, MeasureAs=NavigatorVendor] readonly attribute DOMString vendor; }; Navigator includes NavigatorConcurrentHardware;
diff --git a/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl b/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl index 3bb78d4b..5cc78bb 100644 --- a/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl +++ b/third_party/blink/renderer/core/frame/navigator_concurrent_hardware.idl
@@ -5,5 +5,5 @@ // https://html.spec.whatwg.org/C/#navigator.hardwareconcurrency interface mixin NavigatorConcurrentHardware { - [HighEntropy, MeasureAs=NavigatorHardwareConcurrency] readonly attribute unsigned long long hardwareConcurrency; + [HighEntropy=Direct, MeasureAs=NavigatorHardwareConcurrency] readonly attribute unsigned long long hardwareConcurrency; };
diff --git a/third_party/blink/renderer/core/frame/navigator_cookies.idl b/third_party/blink/renderer/core/frame/navigator_cookies.idl index a231a86..65a983d 100644 --- a/third_party/blink/renderer/core/frame/navigator_cookies.idl +++ b/third_party/blink/renderer/core/frame/navigator_cookies.idl
@@ -5,6 +5,6 @@ // https://html.spec.whatwg.org/C/#cookies interface mixin NavigatorCookies { - [HighEntropy,MeasureAs=NavigatorCookieEnabled] + [HighEntropy=Direct,MeasureAs=NavigatorCookieEnabled] readonly attribute boolean cookieEnabled; };
diff --git a/third_party/blink/renderer/core/frame/navigator_language.idl b/third_party/blink/renderer/core/frame/navigator_language.idl index a5a08667c..c766f62 100644 --- a/third_party/blink/renderer/core/frame/navigator_language.idl +++ b/third_party/blink/renderer/core/frame/navigator_language.idl
@@ -5,6 +5,6 @@ // https://html.spec.whatwg.org/C/#language-preferences interface mixin NavigatorLanguage { - [HighEntropy, MeasureAs=NavigatorLanguage] readonly attribute DOMString language; + [HighEntropy=Direct, MeasureAs=NavigatorLanguage] readonly attribute DOMString language; [CachedAttribute=IsLanguagesDirty, HighEntropy, MeasureAs=NavigatorLanguages] readonly attribute FrozenArray<DOMString> languages; };
diff --git a/third_party/blink/renderer/core/frame/screen.cc b/third_party/blink/renderer/core/frame/screen.cc index dda1f9a..4508bd28 100644 --- a/third_party/blink/renderer/core/frame/screen.cc +++ b/third_party/blink/renderer/core/frame/screen.cc
@@ -63,9 +63,9 @@ if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); return static_cast<int>( - lroundf(screen_info.rect.height * screen_info.device_scale_factor)); + lroundf(screen_info.rect.height() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).rect.height; + return GetScreenInfo(*frame).rect.height(); } int Screen::width() const { @@ -80,9 +80,9 @@ if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); return static_cast<int>( - lroundf(screen_info.rect.width * screen_info.device_scale_factor)); + lroundf(screen_info.rect.width() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).rect.width; + return GetScreenInfo(*frame).rect.width(); } unsigned Screen::colorDepth() const { @@ -111,10 +111,10 @@ Page* page = frame->GetPage(); if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); - return static_cast<int>(lroundf(screen_info.available_rect.x * + return static_cast<int>(lroundf(screen_info.available_rect.x() * screen_info.device_scale_factor)); } - return static_cast<int>(GetScreenInfo(*frame).available_rect.x); + return static_cast<int>(GetScreenInfo(*frame).available_rect.x()); } int Screen::availTop() const { @@ -128,10 +128,10 @@ Page* page = frame->GetPage(); if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); - return static_cast<int>(lroundf(screen_info.available_rect.y * + return static_cast<int>(lroundf(screen_info.available_rect.y() * screen_info.device_scale_factor)); } - return static_cast<int>(GetScreenInfo(*frame).available_rect.y); + return static_cast<int>(GetScreenInfo(*frame).available_rect.y()); } int Screen::availHeight() const { @@ -145,10 +145,10 @@ Page* page = frame->GetPage(); if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); - return static_cast<int>(lroundf(screen_info.available_rect.height * + return static_cast<int>(lroundf(screen_info.available_rect.height() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).available_rect.height; + return GetScreenInfo(*frame).available_rect.height(); } int Screen::availWidth() const { @@ -162,10 +162,10 @@ Page* page = frame->GetPage(); if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); - return static_cast<int>(lroundf(screen_info.available_rect.width * + return static_cast<int>(lroundf(screen_info.available_rect.width() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).available_rect.width; + return GetScreenInfo(*frame).available_rect.width(); } void Screen::Trace(Visitor* visitor) const { @@ -196,9 +196,9 @@ if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); return static_cast<int>( - lroundf(screen_info.rect.x * screen_info.device_scale_factor)); + lroundf(screen_info.rect.x() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).rect.x; + return GetScreenInfo(*frame).rect.x(); } int Screen::top() const { @@ -213,9 +213,9 @@ if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk()) { WebScreenInfo screen_info = GetScreenInfo(*frame); return static_cast<int>( - lroundf(screen_info.rect.y * screen_info.device_scale_factor)); + lroundf(screen_info.rect.y() * screen_info.device_scale_factor)); } - return GetScreenInfo(*frame).rect.y; + return GetScreenInfo(*frame).rect.y(); } bool Screen::internal() const {
diff --git a/third_party/blink/renderer/core/html/html_frame_element_test.cc b/third_party/blink/renderer/core/html/html_frame_element_test.cc index 0f639b1..7d375da 100644 --- a/third_party/blink/renderer/core/html/html_frame_element_test.cc +++ b/third_party/blink/renderer/core/html/html_frame_element_test.cc
@@ -19,12 +19,8 @@ // fullscreen feature should be unconditionally disabled. TEST_F(HTMLFrameElementTest, DefaultContainerPolicy) { const KURL document_url("http://example.com"); - DocumentInit init = - DocumentInit::Create() - .ForTest() - .WithInitiatorOrigin(SecurityOrigin::Create(document_url)) - .WithURL(document_url); - auto* document = MakeGarbageCollected<Document>(init); + auto* document = MakeGarbageCollected<Document>( + DocumentInit::Create().ForTest().WithURL(document_url)); auto* frame_element = MakeGarbageCollected<HTMLFrameElement>(*document);
diff --git a/third_party/blink/renderer/core/html/html_image_element.h b/third_party/blink/renderer/core/html/html_image_element.h index 630301e..d5b32db 100644 --- a/third_party/blink/renderer/core/html/html_image_element.h +++ b/third_party/blink/renderer/core/html/html_image_element.h
@@ -43,9 +43,10 @@ namespace blink { +class ExceptionState; class HTMLFormElement; class ImageCandidate; -class ExceptionState; +class LayoutSize; class ShadowRoot; class CORE_EXPORT HTMLImageElement final
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index 8eb204f..238744e 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -526,6 +526,8 @@ "ng/ng_relative_utils.h", "ng/ng_simplified_layout_algorithm.cc", "ng/ng_simplified_layout_algorithm.h", + "ng/ng_simplified_oof_layout_algorithm.cc", + "ng/ng_simplified_oof_layout_algorithm.h", "ng/ng_space_utils.cc", "ng/ng_space_utils.h", "ng/ng_text_decoration_offset.cc",
diff --git a/third_party/blink/renderer/core/layout/geometry/physical_size.h b/third_party/blink/renderer/core/layout/geometry/physical_size.h index 427e026..45119540 100644 --- a/third_party/blink/renderer/core/layout/geometry/physical_size.h +++ b/third_party/blink/renderer/core/layout/geometry/physical_size.h
@@ -99,6 +99,10 @@ return {LayoutUnit::FromFloatRound(size.Width()), LayoutUnit::FromFloatRound(size.Height())}; } + static PhysicalSize FromFloatSizeFloor(const FloatSize& size) { + return {LayoutUnit::FromFloatFloor(size.Width()), + LayoutUnit::FromFloatFloor(size.Height())}; + } constexpr explicit operator FloatSize() const { return {width, height}; } explicit PhysicalSize(const IntSize& size)
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index c37634d..cd98599 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -93,6 +93,7 @@ #include "third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/shadow_list.h" #include "third_party/blink/renderer/platform/geometry/double_rect.h" #include "third_party/blink/renderer/platform/geometry/float_quad.h" @@ -243,7 +244,7 @@ has_override_containing_block_content_logical_width_(false), has_override_containing_block_content_logical_height_(false), has_override_percentage_resolution_block_size_(false), - has_previous_content_box_rect_and_layout_overflow_rect_(false), + has_previous_content_box_and_overflow_rects_(false), percent_height_container_(nullptr), snap_container_(nullptr), snap_areas_(nullptr) {} @@ -1830,7 +1831,8 @@ if (!skip_children && StyleRef().HasBorderRadius()) { PhysicalRect bounds_rect(accumulated_offset, Size()); skip_children = !hit_test_location.Intersects( - StyleRef().GetRoundedInnerBorderFor(bounds_rect.ToLayoutRect())); + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder(StyleRef(), + bounds_rect)); } } @@ -1895,7 +1897,8 @@ PhysicalRect border_rect = PhysicalBorderBoxRect(); border_rect.Move(border_box_location); return !hit_test_location.Intersects( - StyleRef().GetRoundedBorderFor(border_rect.ToLayoutRect())); + RoundedBorderGeometry::PixelSnappedRoundedBorder(StyleRef(), + border_rect)); } void LayoutBox::Paint(const PaintInfo& paint_info) const { @@ -2908,6 +2911,11 @@ return &To<NGPhysicalBoxFragment>(layout_results_[index]->PhysicalFragment()); } +const NGPhysicalBoxFragment& +LayoutBox::NGPhysicalFragmentList::Iterator::operator*() const { + return To<NGPhysicalBoxFragment>((*iterator_)->PhysicalFragment()); +} + const FragmentData* LayoutBox::FragmentDataFromPhysicalFragment( const NGPhysicalBoxFragment& physical_fragment) const { const FragmentData* fragment_data = &FirstFragment(); @@ -6696,14 +6704,15 @@ return HasOverflowClip() || ShouldApplyPaintContainment() || HasControlClip(); } -void LayoutBox::MutableForPainting:: - SavePreviousContentBoxRectAndLayoutOverflowRect() { +void LayoutBox::MutableForPainting::SavePreviousContentBoxAndOverflowRects() { auto& rare_data = GetLayoutBox().EnsureRareData(); - rare_data.has_previous_content_box_rect_and_layout_overflow_rect_ = true; + rare_data.has_previous_content_box_and_overflow_rects_ = true; rare_data.previous_physical_content_box_rect_ = GetLayoutBox().PhysicalContentBoxRect(); rare_data.previous_physical_layout_overflow_rect_ = GetLayoutBox().PhysicalLayoutOverflowRect(); + rare_data.previous_physical_self_visual_overflow_rect_ = + GetLayoutBox().PhysicalSelfVisualOverflowRect(); } RasterEffectOutset LayoutBox::VisualRectOutsetForRasterEffects() const {
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index 93c9f6b6..149e191 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -81,7 +81,7 @@ bool has_override_containing_block_content_logical_width_ : 1; bool has_override_containing_block_content_logical_height_ : 1; bool has_override_percentage_resolution_block_size_ : 1; - bool has_previous_content_box_rect_and_layout_overflow_rect_ : 1; + bool has_previous_content_box_and_overflow_rects_ : 1; LayoutUnit override_containing_block_content_logical_width_; LayoutUnit override_containing_block_content_logical_height_; @@ -107,9 +107,10 @@ // Used by BoxPaintInvalidator. Stores the previous content box size and // layout overflow rect after the last paint invalidation. They are valid if - // has_previous_content_box_rect_and_layout_overflow_rect_ is true. + // has_previous_content_box_rect_and_overflow_rects_ is true. PhysicalRect previous_physical_content_box_rect_; PhysicalRect previous_physical_layout_overflow_rect_; + PhysicalRect previous_physical_self_visual_overflow_rect_; // Used by CSSLayoutDefinition::Instance::Layout. Represents the script // object for this box that web developers can query style, and perform @@ -1004,6 +1005,48 @@ base::Optional<NGFragmentGeometry>* initial_fragment_geometry, NGLayoutCacheStatus* out_cache_status); + using NGLayoutResultList = Vector<scoped_refptr<const NGLayoutResult>, 1>; + class NGPhysicalFragmentList { + STACK_ALLOCATED(); + + public: + explicit NGPhysicalFragmentList(const NGLayoutResultList& layout_results) + : layout_results_(layout_results) {} + + wtf_size_t Size() const { return layout_results_.size(); } + bool IsEmpty() const { return layout_results_.IsEmpty(); } + + class Iterator : public std::iterator<std::forward_iterator_tag, + NGPhysicalBoxFragment> { + public: + explicit Iterator(const NGLayoutResultList::const_iterator& iterator) + : iterator_(iterator) {} + + const NGPhysicalBoxFragment& operator*() const; + + void operator++() { ++iterator_; } + + bool operator==(const Iterator& other) const { + return iterator_ == other.iterator_; + } + bool operator!=(const Iterator& other) const { + return !operator==(other); + } + + private: + NGLayoutResultList::const_iterator iterator_; + }; + + Iterator begin() const { return Iterator(layout_results_.begin()); } + Iterator end() const { return Iterator(layout_results_.end()); } + + private: + const NGLayoutResultList& layout_results_; + }; + + NGPhysicalFragmentList PhysicalFragments() const { + return NGPhysicalFragmentList(layout_results_); + } const NGPhysicalBoxFragment* GetPhysicalFragment(wtf_size_t i) const; const FragmentData* FragmentDataFromPhysicalFragment( const NGPhysicalBoxFragment&) const; @@ -1566,12 +1609,11 @@ void SavePreviousSize() { GetLayoutBox().previous_size_ = GetLayoutBox().Size(); } - void SavePreviousContentBoxRectAndLayoutOverflowRect(); - void ClearPreviousContentBoxRectAndLayoutOverflowRect() { + void SavePreviousContentBoxAndOverflowRects(); + void ClearPreviousContentBoxAndOverflowRects() { if (!GetLayoutBox().rare_data_) return; - GetLayoutBox() - .rare_data_->has_previous_content_box_rect_and_layout_overflow_rect_ = + GetLayoutBox().rare_data_->has_previous_content_box_and_overflow_rects_ = false; } @@ -1591,18 +1633,22 @@ LayoutSize PreviousSize() const { return previous_size_; } PhysicalRect PreviousPhysicalContentBoxRect() const { return rare_data_ && - rare_data_ - ->has_previous_content_box_rect_and_layout_overflow_rect_ + rare_data_->has_previous_content_box_and_overflow_rects_ ? rare_data_->previous_physical_content_box_rect_ : PhysicalRect(PhysicalOffset(), PreviousSize()); } PhysicalRect PreviousPhysicalLayoutOverflowRect() const { return rare_data_ && - rare_data_ - ->has_previous_content_box_rect_and_layout_overflow_rect_ + rare_data_->has_previous_content_box_and_overflow_rects_ ? rare_data_->previous_physical_layout_overflow_rect_ : PhysicalRect(PhysicalOffset(), PreviousSize()); } + PhysicalRect PreviousPhysicalSelfVisualOverflowRect() const { + return rare_data_ && + rare_data_->has_previous_content_box_and_overflow_rects_ + ? rare_data_->previous_physical_self_visual_overflow_rect_ + : PhysicalRect(PhysicalOffset(), PreviousSize()); + } // Calculates the intrinsic logical widths for this layout box. // https://drafts.csswg.org/css-sizing-3/#intrinsic @@ -1940,7 +1986,7 @@ Persistent<LayoutBoxRareData> rare_data_; scoped_refptr<const NGLayoutResult> measure_result_; - Vector<scoped_refptr<const NGLayoutResult>, 1> layout_results_; + NGLayoutResultList layout_results_; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBox, IsBox());
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.cc b/third_party/blink/renderer/core/layout/layout_image_resource.cc index 57bc7eb4..3b2d71d 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource.cc
@@ -118,7 +118,7 @@ FloatSize LayoutImageResource::ImageSizeWithDefaultSize( float multiplier, - const LayoutSize&) const { + const FloatSize&) const { return ImageSize(multiplier); }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.h b/third_party/blink/renderer/core/layout/layout_image_resource.h index 286f991..b21ee832 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource.h
@@ -67,7 +67,7 @@ virtual FloatSize ImageSize(float multiplier) const; // Default size is effective when this is LayoutImageResourceStyleImage. virtual FloatSize ImageSizeWithDefaultSize(float multiplier, - const LayoutSize&) const; + const FloatSize&) const; virtual WrappedImagePtr ImagePtr() const { return cached_image_.Get(); } virtual void Trace(Visitor* visitor) const { visitor->Trace(cached_image_); }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc index db5476d..927725f803 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc
@@ -71,17 +71,17 @@ FloatSize LayoutImageResourceStyleImage::ImageSize(float multiplier) const { // TODO(davve): Find out the correct default object size in this context. - LayoutSize default_size = + FloatSize default_size = layout_object_->IsListMarkerImage() - ? ToLayoutListMarkerImage(layout_object_)->DefaultSize() - : LayoutSize(LayoutReplaced::kDefaultWidth, - LayoutReplaced::kDefaultHeight); + ? FloatSize(ToLayoutListMarkerImage(layout_object_)->DefaultSize()) + : FloatSize(LayoutReplaced::kDefaultWidth, + LayoutReplaced::kDefaultHeight); return ImageSizeWithDefaultSize(multiplier, default_size); } FloatSize LayoutImageResourceStyleImage::ImageSizeWithDefaultSize( float multiplier, - const LayoutSize& default_size) const { + const FloatSize& default_size) const { return style_image_->ImageSize( layout_object_->GetDocument(), multiplier, default_size, LayoutObject::ShouldRespectImageOrientation(layout_object_));
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h index b1b08dd1..93c5e6f 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h
@@ -52,7 +52,7 @@ } FloatSize ImageSize(float multiplier) const override; FloatSize ImageSizeWithDefaultSize(float multiplier, - const LayoutSize&) const override; + const FloatSize&) const override; WrappedImagePtr ImagePtr() const override { return style_image_->Data(); } void Trace(Visitor*) const override;
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker.cc b/third_party/blink/renderer/core/layout/layout_list_marker.cc index 7a000f0f..715ade7 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker.cc +++ b/third_party/blink/renderer/core/layout/layout_list_marker.cc
@@ -67,11 +67,10 @@ // markers really won't become particularly useful until we support the CSS3 // marker pseudoclass to allow control over the width and height of the // marker box. - LayoutUnit bullet_width = - font_data->GetFontMetrics().Ascent() / LayoutUnit(2); + float bullet_width = font_data->GetFontMetrics().Ascent() / 2.0f; return RoundedLayoutSize( image_->ImageSize(GetDocument(), StyleRef().EffectiveZoom(), - LayoutSize(bullet_width, bullet_width), + FloatSize(bullet_width, bullet_width), LayoutObject::ShouldRespectImageOrientation(this))); }
diff --git a/third_party/blink/renderer/core/layout/layout_list_marker_image.cc b/third_party/blink/renderer/core/layout/layout_list_marker_image.cc index ae1b5fb8..e17dbc4 100644 --- a/third_party/blink/renderer/core/layout/layout_list_marker_image.cc +++ b/third_party/blink/renderer/core/layout/layout_list_marker_image.cc
@@ -40,7 +40,7 @@ void LayoutListMarkerImage::ComputeIntrinsicSizingInfoByDefaultSize( IntrinsicSizingInfo& intrinsic_sizing_info) const { FloatSize concrete_size = ImageResource()->ImageSizeWithDefaultSize( - Style()->EffectiveZoom(), DefaultSize()); + Style()->EffectiveZoom(), FloatSize(DefaultSize())); concrete_size.Scale(ImageDevicePixelRatio()); LayoutSize image_size(RoundedLayoutSize(concrete_size));
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index fcb110a..6e774ae0 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -2549,10 +2549,7 @@ // First assume the outline will be affected. It may be updated when we know // it's not affected. - bool has_outline = style_->HasOutline(); - SetOutlineMayBeAffectedByDescendants(has_outline); - if (!has_outline) - SetPreviousOutlineMayBeAffectedByDescendants(false); + SetOutlineMayBeAffectedByDescendants(style_->HasOutline()); if (affects_parent_block_) HandleDynamicFloatPositionChange(this); @@ -4135,6 +4132,21 @@ } #endif +void LayoutObject::EnsureIsReadyForPaintInvalidation() { + DCHECK(!NeedsLayout() || + LayoutBlockedByDisplayLock(DisplayLockLifecycleTarget::kChildren)); + + // Force full paint invalidation if the outline may be affected by descendants + // and this object is marked for checking paint invalidation for any reason. + if (bitfields_.OutlineMayBeAffectedByDescendants() || + bitfields_.PreviousOutlineMayBeAffectedByDescendants()) { + SetShouldDoFullPaintInvalidationWithoutGeometryChange( + PaintInvalidationReason::kOutline); + } + bitfields_.SetPreviousOutlineMayBeAffectedByDescendants( + bitfields_.OutlineMayBeAffectedByDescendants()); +} + void LayoutObject::ClearPaintFlags() { DCHECK_EQ(GetDocument().Lifecycle().GetState(), DocumentLifecycle::kInPrePaint);
diff --git a/third_party/blink/renderer/core/layout/layout_object.h b/third_party/blink/renderer/core/layout/layout_object.h index 7c8ae18..4f4541e 100644 --- a/third_party/blink/renderer/core/layout/layout_object.h +++ b/third_party/blink/renderer/core/layout/layout_object.h
@@ -2405,9 +2405,9 @@ layout_object_.SetBackgroundPaintLocation(location); } - void UpdatePreviousOutlineMayBeAffectedByDescendants() { - layout_object_.SetPreviousOutlineMayBeAffectedByDescendants( - layout_object_.OutlineMayBeAffectedByDescendants()); + void UpdatePreviousVisibilityVisible() { + layout_object_.bitfields_.SetPreviousVisibilityVisible( + layout_object_.StyleRef().Visibility() == EVisibility::kVisible); } void SetNeedsPaintPropertyUpdate() { @@ -2543,13 +2543,6 @@ bitfields_.SetBackgroundNeedsFullPaintInvalidation(true); } - bool OutlineMayBeAffectedByDescendants() const { - return bitfields_.OutlineMayBeAffectedByDescendants(); - } - bool PreviousOutlineMayBeAffectedByDescendants() const { - return bitfields_.PreviousOutlineMayBeAffectedByDescendants(); - } - IntRect SelectionVisualRect() const { return fragment_.SelectionVisualRect(); } @@ -2630,6 +2623,13 @@ bitfields_.SetIsLayoutNGObjectForListMarkerImage(b); } + bool PreviousVisibilityVisible() const { + return bitfields_.PreviousVisibilityVisible(); + } + + // See LocalVisualRect(). + virtual bool VisualRectRespectsVisibility() const { return true; } + protected: enum LayoutObjectType { kLayoutObjectBr, @@ -2778,10 +2778,7 @@ #endif // Called before paint invalidation. - virtual void EnsureIsReadyForPaintInvalidation() { - DCHECK(!NeedsLayout() || - LayoutBlockedByDisplayLock(DisplayLockLifecycleTarget::kChildren)); - } + virtual void EnsureIsReadyForPaintInvalidation(); virtual void ClearPaintFlags(); void SetIsBackgroundAttachmentFixedObject(bool); @@ -2792,12 +2789,7 @@ // LayoutFlowThread. void RemoveFromLayoutFlowThread(); - void SetPreviousOutlineMayBeAffectedByDescendants(bool b) { - bitfields_.SetPreviousOutlineMayBeAffectedByDescendants(b); - } - // See LocalVisualRect(). - virtual bool VisualRectRespectsVisibility() const { return true; } virtual PhysicalRect LocalVisualRectIgnoringVisibility() const; virtual bool CanBeSelectionLeafInternal() const { return false; } @@ -3020,6 +3012,7 @@ background_needs_full_paint_invalidation_(true), outline_may_be_affected_by_descendants_(false), previous_outline_may_be_affected_by_descendants_(false), + previous_visibility_visible_(false), is_truncated_(false), inside_blocking_touch_event_handler_(false), effective_allowed_touch_action_changed_(true), @@ -3271,6 +3264,9 @@ // invalidation. ADD_BOOLEAN_BITFIELD(previous_outline_may_be_affected_by_descendants_, PreviousOutlineMayBeAffectedByDescendants); + // CSS visibility : visible status of the last paint invalidation. + ADD_BOOLEAN_BITFIELD(previous_visibility_visible_, + PreviousVisibilityVisible); ADD_BOOLEAN_BITFIELD(is_truncated_, IsTruncated);
diff --git a/third_party/blink/renderer/core/layout/line/inline_flow_box.cc b/third_party/blink/renderer/core/layout/line/inline_flow_box.cc index a364f7f..8b15cdf6 100644 --- a/third_party/blink/renderer/core/layout/line/inline_flow_box.cc +++ b/third_party/blink/renderer/core/layout/line/inline_flow_box.cc
@@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/layout/line/root_inline_box.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/inline_flow_box_painter.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/shadow_list.h" #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" @@ -1429,11 +1430,11 @@ if (GetLineLayoutItem().StyleRef().HasBorderRadius()) { // TODO(layout-dev): LogicalFrameRect() seems incorrect. - LayoutRect border_rect = LogicalFrameRect(); - border_rect.MoveBy(accumulated_offset.ToLayoutPoint()); - FloatRoundedRect border = - GetLineLayoutItem().StyleRef().GetRoundedBorderFor( - border_rect, IncludeLogicalLeftEdge(), IncludeLogicalRightEdge()); + PhysicalRect border_rect = PhysicalRectToBeNoop(LogicalFrameRect()); + border_rect.Move(accumulated_offset); + FloatRoundedRect border = RoundedBorderGeometry::PixelSnappedRoundedBorder( + GetLineLayoutItem().StyleRef(), border_rect, IncludeLogicalLeftEdge(), + IncludeLogicalRightEdge()); if (!hit_test_location.Intersects(border)) return false; }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc index 8c6d4d1..52e95f3 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.cc
@@ -440,17 +440,21 @@ if (Type() == NGFragmentItem::kText) { StringBuilder name; name.Append("NGPhysicalTextFragment '"); - const NGPhysicalBoxFragment* containing_fragment = - layout_object_->ContainingBlockFlowFragment(); - if (containing_fragment) { - name.Append(Text(*containing_fragment->Items())); - } else { - // TODO(crbug.com/1061423): ContainingBlockFlowFragment() relies on - // CurrentFragment(), which doesn't work inside block fragmentation. Check - // that we're (most likely) inside block fragmentation. Otherwise, this - // shouldn't happen. - DCHECK(layout_object_->IsInsideFlowThread()); + const NGFragmentItems* fragment_items = nullptr; + if (const LayoutBlockFlow* block_flow = + layout_object_->FragmentItemsContainer()) { + for (unsigned i = 0; i < block_flow->PhysicalFragmentCount(); ++i) { + const NGPhysicalBoxFragment* containing_fragment = + block_flow->GetPhysicalFragment(i); + fragment_items = containing_fragment->Items(); + if (fragment_items) + break; + } } + if (fragment_items) + name.Append(Text(*fragment_items)); + else + name.Append("(container not found)"); name.Append('\''); return name.ToString(); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 972f6bb..8ec105fc 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -205,10 +205,6 @@ LayoutMultiColumnSet* column_set = ToLayoutMultiColumnSetOrNull(flow_thread->FirstMultiColumnBox()); for (const auto& child : fragment.Children()) { - // TODO(almaher): Remove check for out of flow. - if (child->IsOutOfFlowPositioned()) - continue; - if (child->GetLayoutObject() && child->GetLayoutObject()->IsColumnSpanAll()) { // Column spanners are not part of the fragmentation context. We'll use @@ -1119,9 +1115,7 @@ for (const auto& child : physical_fragment.Children()) { const LayoutObject* child_object = child->GetLayoutObject(); if (child_object && child_object != box_) { - // TODO(almaher): Remove check for out of flow. - DCHECK(child_object->IsColumnSpanAll() || - child_object->IsOutOfFlowPositioned()); + DCHECK(child_object->IsColumnSpanAll()); CopyChildFragmentPosition(To<NGPhysicalBoxFragment>(*child), child.offset, physical_fragment); continue;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h index 9aa33c64..6ea9056 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h
@@ -181,6 +181,10 @@ DCHECK(space_); return child_available_size_; } + const NGBlockNode& Node() { + DCHECK(node_); + return To<NGBlockNode>(node_); + } // Add a break token for a child that doesn't yet have any fragments, because // its first fragment is to be produced in the next fragmentainer. This will
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc index 3545edd..fb12ee5 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc
@@ -569,7 +569,8 @@ do { // Lay out one column. Each column will become a fragment. NGConstraintSpace child_space = CreateConstraintSpaceForColumns( - column_size, is_first_fragmentainer, balance_columns); + ConstraintSpace(), Style().GetWritingMode(), column_size, + is_first_fragmentainer, balance_columns); NGFragmentGeometry fragment_geometry = CalculateInitialFragmentGeometry(child_space, Node()); @@ -999,38 +1000,6 @@ return algorithm_with_break.Layout(); } -NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForColumns( - const LogicalSize& column_size, - bool is_first_fragmentainer, - bool balance_columns) const { - NGConstraintSpaceBuilder space_builder( - ConstraintSpace(), Style().GetWritingMode(), /* is_new_fc */ true); - space_builder.SetAvailableSize(column_size); - space_builder.SetPercentageResolutionSize(column_size); - - // To ensure progression, we need something larger than 0 here. The spec - // actually says that fragmentainers have to accept at least 1px of content. - // See https://www.w3.org/TR/css-break-3/#breaking-rules - LayoutUnit column_block_size = - std::max(column_size.block_size, LayoutUnit(1)); - - space_builder.SetFragmentationType(kFragmentColumn); - space_builder.SetFragmentainerBlockSize(column_block_size); - space_builder.SetIsAnonymous(true); - space_builder.SetIsInColumnBfc(); - if (balance_columns) - space_builder.SetIsInsideBalancedColumns(); - if (!is_first_fragmentainer) { - // Margins at fragmentainer boundaries should be eaten and truncated to - // zero. Note that this doesn't apply to margins at forced breaks, but we'll - // deal with those when we get to them. Set up a margin strut that eats all - // leading adjacent margins. - space_builder.SetDiscardingMarginStrut(); - } - - return space_builder.ToConstraintSpace(); -} - NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForBalancing( const LogicalSize& column_size) const { NGConstraintSpaceBuilder space_builder(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h index 3c4e6e0..096dd9c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.h
@@ -72,10 +72,6 @@ // such as break-before:avoid or break-after:avoid. scoped_refptr<const NGLayoutResult> RelayoutAndBreakEarlier(); - NGConstraintSpace CreateConstraintSpaceForColumns( - const LogicalSize& column_size, - bool is_first_fragmentainer, - bool balance_columns) const; NGConstraintSpace CreateConstraintSpaceForBalancing( const LogicalSize& column_size) const; NGConstraintSpace CreateConstraintSpaceForSpanner(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm_test.cc index cb92eea2..aaa0460 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm_test.cc
@@ -2047,9 +2047,7 @@ EXPECT_EQ(expectation, dump); } -// TODO(1079031): Re-enable once layout for fragmented positioned elements is -// complete. -TEST_F(NGColumnLayoutAlgorithmTest, DISABLED_WidowsAndAbspos) { +TEST_F(NGColumnLayoutAlgorithmTest, WidowsAndAbspos) { SetBodyInnerHTML(R"HTML( <style> #parent { @@ -2085,12 +2083,12 @@ offset:0,0 size:100x70 offset:0,0 size:0x20 offset:0,20 size:0x20 + offset:0,40 size:33x33 offset:110,0 size:100x70 offset:0,0 size:100x60 offset:0,0 size:0x20 offset:0,20 size:0x20 offset:0,40 size:0x20 - offset:0,40 size:33x33 )DUMP"; EXPECT_EQ(expectation, dump); } @@ -4320,9 +4318,7 @@ EXPECT_EQ(expectation, dump); } -// TODO(1079031): Re-enable once layout for fragmented positioned elements is -// complete. -TEST_F(NGColumnLayoutAlgorithmTest, DISABLED_AbsposFitsInOneColumn) { +TEST_F(NGColumnLayoutAlgorithmTest, AbsposFitsInOneColumn) { SetBodyInnerHTML(R"HTML( <div id="container"> <div style="columns:3; width:320px; height:100px; column-gap:10px; column-fill:auto;"> @@ -4339,7 +4335,7 @@ offset:0,0 size:320x100 offset:0,0 size:100x100 offset:0,0 size:222x100 - offset:0,0 size:111x50 + offset:0,0 size:111x50 offset:110,0 size:100x100 offset:0,0 size:222x100 offset:220,0 size:100x100
diff --git a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc index 88ecc97..c3837c0e 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc
@@ -33,6 +33,14 @@ AddChildInternal(&child, child_offset); } +void NGContainerFragmentBuilder::ReplaceChild( + wtf_size_t index, + const NGPhysicalContainerFragment& new_child, + const LogicalOffset offset) { + DCHECK_LT(index, children_.size()); + children_[index] = ChildWithOffset(offset, std::move(&new_child)); +} + // Propagate data in |child| to this fragment. The |child| will then be added as // a child fragment or a child fragment item. void NGContainerFragmentBuilder::PropagateChildData(
diff --git a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h index 1b007aa..097936d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h +++ b/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.h
@@ -86,6 +86,10 @@ AddChildInternal(child, offset); } + void ReplaceChild(wtf_size_t index, + const NGPhysicalContainerFragment& new_child, + const LogicalOffset offset); + const ChildrenVector& Children() const { return children_; } // Builder has non-trivial OOF-positioned methods.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fragment_child_iterator.cc b/third_party/blink/renderer/core/layout/ng/ng_fragment_child_iterator.cc index eae3491..3e9a1186 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fragment_child_iterator.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_fragment_child_iterator.cc
@@ -121,9 +121,7 @@ // rendered legend. We'll leave |current_block_break_token_| alone here, // as it will be used as in incoming break token when we get to the next // column. - // TODO(almaher): Remove check for out of flow. DCHECK(previous_fragment->IsRenderedLegend() || - previous_fragment->IsOutOfFlowPositioned() || previous_fragment->IsColumnSpanAll()); } } else {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc index f20e523..b8ab3e2d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc
@@ -670,4 +670,38 @@ return true; } +NGConstraintSpace CreateConstraintSpaceForColumns( + const NGConstraintSpace& parent_space, + WritingMode writing_mode, + const LogicalSize& column_size, + bool is_first_fragmentainer, + bool balance_columns) { + NGConstraintSpaceBuilder space_builder(parent_space, writing_mode, + /* is_new_fc */ true); + space_builder.SetAvailableSize(column_size); + space_builder.SetPercentageResolutionSize(column_size); + + // To ensure progression, we need something larger than 0 here. The spec + // actually says that fragmentainers have to accept at least 1px of content. + // See https://www.w3.org/TR/css-break-3/#breaking-rules + LayoutUnit column_block_size = + std::max(column_size.block_size, LayoutUnit(1)); + + space_builder.SetFragmentationType(kFragmentColumn); + space_builder.SetFragmentainerBlockSize(column_block_size); + space_builder.SetIsAnonymous(true); + space_builder.SetIsInColumnBfc(); + if (balance_columns) + space_builder.SetIsInsideBalancedColumns(); + if (!is_first_fragmentainer) { + // Margins at fragmentainer boundaries should be eaten and truncated to + // zero. Note that this doesn't apply to margins at forced breaks, but we'll + // deal with those when we get to them. Set up a margin strut that eats all + // leading adjacent margins. + space_builder.SetDiscardingMarginStrut(); + } + + return space_builder.ToConstraintSpace(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h index e42a0f5a..cd57e2c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h +++ b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h
@@ -259,6 +259,14 @@ NGBreakAppeal appeal_before, NGBoxFragmentBuilder*); +// Calculate the constraint space for columns of a multi-column layout. +NGConstraintSpace CreateConstraintSpaceForColumns( + const NGConstraintSpace& parent_space, + WritingMode writing_mode, + const LogicalSize& column_size, + bool is_first_fragmentainer, + bool balance_columns); + // Return the adjusted child margin to be applied at the end of a fragment. // Margins should collapse with the fragmentainer boundary. |bfc_block_offset| // is the BFC offset where the margin should be applied (i.e. after the
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc index 84c129d8..b57f3abb 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc
@@ -16,11 +16,13 @@ #include "third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h" #include "third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h" #include "third_party/blink/renderer/core/layout/ng/ng_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" #include "third_party/blink/renderer/core/layout/ng/ng_length_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -605,10 +607,9 @@ scoped_refptr<const NGLayoutResult> result = LayoutFragmentainerDescendant(descendant); - // TODO(almaher): Add children to the correct fragmentainer. - container_builder_->AddChild(result->PhysicalFragment(), - result->OutOfFlowPositionedOffset(), - descendant.inline_container); + // TODO(almaher): Add children to the correct fragmentainer. For now, it + // always get added to the first one. + AddOOFResultToFragmentainer(result, /* index */ 0); } // Sweep any descendants that might have been added. // This happens when an absolute container has a fixed child. @@ -964,4 +965,40 @@ return node.Layout(space); } +void NGOutOfFlowLayoutPart::AddOOFResultToFragmentainer( + scoped_refptr<const NGLayoutResult> result, + const wtf_size_t index) { + DCHECK_LT(index, container_builder_->Children().size()); + + const auto& fragmentainer = container_builder_->Children()[index]; + DCHECK(fragmentainer.fragment->IsFragmentainerBox()); + const NGBlockNode& node = container_builder_->Node(); + const auto& fragment = + To<NGPhysicalBoxFragment>(*fragmentainer.fragment.get()); + const WritingMode container_writing_mode = + container_builder_->Style().GetWritingMode(); + // TODO(bebeaudr): Need to handle different fragmentation types. It won't + // always be multi-column. + NGConstraintSpace space = CreateConstraintSpaceForColumns( + *container_builder_->ConstraintSpace(), container_writing_mode, + fragment.Size().ConvertToLogical(container_writing_mode), + /* is_first_fragmentainer */ index == 0, /* balance_columns */ false); + NGFragmentGeometry fragment_geometry = + CalculateInitialFragmentGeometry(space, node); + NGLayoutAlgorithmParams params(node, fragment_geometry, space, + /* break_token */ nullptr, + /* early_break */ nullptr); + + // |algorithm| corresponds to the "mutable copy" of our original + // fragmentainer. As long as this "copy" hasn't been laid out via + // NGSimplifiedOOFLayoutAlgorithm::Layout, we can append new items to it. + NGSimplifiedOOFLayoutAlgorithm algorithm(params, fragment); + + // TODO(bebeaudr): Is the offset returned by OutOfFlowPositionedOffset the one + // to use? + algorithm.AppendOutOfFlowResult(result, result->OutOfFlowPositionedOffset()); + container_builder_->ReplaceChild( + index, algorithm.Layout()->PhysicalFragment(), fragmentainer.offset); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h index 1275646..f624a5ba 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h
@@ -125,6 +125,8 @@ bool IsContainingBlockForCandidate(const NGLogicalOutOfFlowPositionedNode&); + void AddOOFResultToFragmentainer(scoped_refptr<const NGLayoutResult> result, + const wtf_size_t index); scoped_refptr<const NGLayoutResult> GenerateFragment( NGBlockNode node, const LogicalSize& container_content_size_in_child_writing_mode,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc index f1ec239..72b09b9 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part_test.cc
@@ -104,14 +104,12 @@ } // Tests that positioned nodes fragment correctly. -// TODO(almaher): Reenable once the layout algorithm for fragmented positioned -// items is in a more stable state. -TEST_F(NGOutOfFlowLayoutPartTest, DISABLED_PositionedFragmentation) { +TEST_F(NGOutOfFlowLayoutPartTest, PositionedFragmentation) { SetBodyInnerHTML( R"HTML( <style> #multicol { - column-count: 2; height: 40px; column-fill:auto; + column-count: 2; height: 40px; column-fill: auto; column-gap: 16px; } .rel { position: relative; @@ -123,11 +121,11 @@ <div id="container"> <div id="multicol"> <div style="width:100px; height:50px;"></div> - <div class="rel"> - <div class="abs" style="width:5px; top: 10px; height:5px;"> + <div class="rel" style="width:30px;"> + <div class="abs" style="width:5px; top:10px; height:5px;"> </div> - <div class="rel"> - <div class="abs" style="width:10px; top: 20px; height:10px;"> + <div class="rel" style="width:35px; padding-top:8px;"> + <div class="abs" style="width:10px; top:20px; height:10px;"> </div> </div> </div> @@ -136,19 +134,17 @@ )HTML"); String dump = DumpFragmentTree(GetElementById("container")); - // TODO(almaher): Positioned nodes are not currently placed in the correct - // fragment. String expectation = R"DUMP(.:: LayoutNG Physical Fragment Tree ::. offset:unplaced size:1000x40 offset:0,0 size:1000x40 - offset:0,0 size:499.5x40 + offset:0,0 size:492x40 offset:0,0 size:100x40 - offset:500.5,0 size:499.5x40 + offset:0,20 size:10x10 + offset:0,10 size:5x5 + offset:508,0 size:492x40 offset:0,0 size:100x10 - offset:0,10 size:499.5x0 - offset:0,0 size:499.5x0 - offset:0,20 size:10x10 - offset:0,10 size:5x5 + offset:0,10 size:30x8 + offset:0,0 size:35x8 )DUMP"; EXPECT_EQ(expectation, dump); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc index b4d1866..bc4b4e35 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/layout/layout_block.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_border_edges.h" #include "third_party/blink/renderer/core/layout/ng/geometry/ng_box_strut.h" +#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_line_box_fragment.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h" @@ -36,31 +37,6 @@ ASSERT_SIZE(NGPhysicalFragment, SameSizeAsNGPhysicalFragment); -bool AppendFragmentOffsetAndSize(const NGPhysicalFragment* fragment, - base::Optional<PhysicalOffset> fragment_offset, - StringBuilder* builder, - NGPhysicalFragment::DumpFlags flags, - bool has_content) { - if (flags & NGPhysicalFragment::DumpOffset) { - if (has_content) - builder->Append(" "); - builder->Append("offset:"); - if (fragment_offset) - builder->Append(fragment_offset->ToString()); - else - builder->Append("unplaced"); - has_content = true; - } - if (flags & NGPhysicalFragment::DumpSize) { - if (has_content) - builder->Append(" "); - builder->Append("size:"); - builder->Append(fragment->Size().ToString()); - has_content = true; - } - return has_content; -} - String StringForBoxType(const NGPhysicalFragment& fragment) { StringBuilder result; switch (fragment.BoxType()) { @@ -113,99 +89,175 @@ return result.ToString(); } -void AppendFragmentToString(const NGPhysicalFragment* fragment, - base::Optional<PhysicalOffset> fragment_offset, - StringBuilder* builder, - NGPhysicalFragment::DumpFlags flags, - unsigned indent = 2) { - if (flags & NGPhysicalFragment::DumpIndentation) { - for (unsigned i = 0; i < indent; i++) - builder->Append(" "); - } +class FragmentTreeDumper { + STACK_ALLOCATED(); - bool has_content = false; - if (const auto* box = DynamicTo<NGPhysicalBoxFragment>(fragment)) { - if (flags & NGPhysicalFragment::DumpType) { - builder->Append("Box"); - String box_type = StringForBoxType(*fragment); - has_content = true; - if (!box_type.IsEmpty()) { - builder->Append(" ("); - builder->Append(box_type); - builder->Append(")"); + public: + FragmentTreeDumper(StringBuilder* builder, + NGPhysicalFragment::DumpFlags flags) + : builder_(builder), flags_(flags) {} + + void Append(const NGPhysicalFragment* fragment, + base::Optional<PhysicalOffset> fragment_offset, + unsigned indent = 2) { + AppendIndentation(indent); + + bool has_content = false; + if (const auto* box = DynamicTo<NGPhysicalBoxFragment>(fragment)) { + if (flags_ & NGPhysicalFragment::DumpType) { + builder_->Append("Box"); + String box_type = StringForBoxType(*fragment); + has_content = true; + if (!box_type.IsEmpty()) { + builder_->Append(" ("); + builder_->Append(box_type); + builder_->Append(")"); + } + if (flags_ & NGPhysicalFragment::DumpSelfPainting && + box->HasSelfPaintingLayer()) { + if (box_type.IsEmpty()) + builder_->Append(" "); + builder_->Append("(self paint)"); + } } - if (flags & NGPhysicalFragment::DumpSelfPainting && - box->HasSelfPaintingLayer()) { - if (box_type.IsEmpty()) - builder->Append(" "); - builder->Append("(self paint)"); + has_content = AppendOffsetAndSize(fragment, fragment_offset, has_content); + + if (flags_ & NGPhysicalFragment::DumpNodeName && + fragment->GetLayoutObject()) { + if (has_content) + builder_->Append(" "); + builder_->Append(fragment->GetLayoutObject()->DebugName()); } - } - has_content = AppendFragmentOffsetAndSize(fragment, fragment_offset, - builder, flags, has_content); + builder_->Append("\n"); - if (flags & NGPhysicalFragment::DumpNodeName && - fragment->GetLayoutObject()) { - if (has_content) - builder->Append(" "); - builder->Append(fragment->GetLayoutObject()->DebugName()); - } - builder->Append("\n"); - - if (flags & NGPhysicalFragment::DumpSubtree) { - for (auto& child : box->Children()) { - AppendFragmentToString(child.get(), child.Offset(), builder, flags, - indent + 2); + bool has_fragment_items = false; + if (flags_ & NGPhysicalFragment::DumpItems) { + if (const NGFragmentItems* fragment_items = box->Items()) { + NGInlineCursor cursor(*fragment_items); + Append(&cursor, indent + 2); + has_fragment_items = true; + } } - } - return; - } - - if (const auto* line_box = DynamicTo<NGPhysicalLineBoxFragment>(fragment)) { - if (flags & NGPhysicalFragment::DumpType) { - builder->Append("LineBox"); - has_content = true; - } - has_content = AppendFragmentOffsetAndSize(fragment, fragment_offset, - builder, flags, has_content); - builder->Append("\n"); - - if (flags & NGPhysicalFragment::DumpSubtree) { - for (auto& child : line_box->Children()) { - AppendFragmentToString(child.get(), child.Offset(), builder, flags, - indent + 2); + if (flags_ & NGPhysicalFragment::DumpSubtree) { + for (auto& child : box->Children()) { + if (has_fragment_items && child->IsLineBox()) + continue; + Append(child.get(), child.Offset(), indent + 2); + } } return; } - } - if (const auto* text = DynamicTo<NGPhysicalTextFragment>(fragment)) { - if (flags & NGPhysicalFragment::DumpType) { - builder->Append("Text"); + if (const auto* line_box = DynamicTo<NGPhysicalLineBoxFragment>(fragment)) { + if (flags_ & NGPhysicalFragment::DumpType) { + builder_->Append("LineBox"); + has_content = true; + } + has_content = AppendOffsetAndSize(fragment, fragment_offset, has_content); + builder_->Append("\n"); + + if (flags_ & NGPhysicalFragment::DumpSubtree) { + for (auto& child : line_box->Children()) { + Append(child.get(), child.Offset(), indent + 2); + } + return; + } + } + + if (const auto* text = DynamicTo<NGPhysicalTextFragment>(fragment)) { + if (flags_ & NGPhysicalFragment::DumpType) { + builder_->Append("Text"); + has_content = true; + } + has_content = AppendOffsetAndSize(fragment, fragment_offset, has_content); + + if (flags_ & NGPhysicalFragment::DumpTextOffsets) { + if (has_content) + builder_->Append(' '); + builder_->AppendFormat("start: %u end: %u", text->StartOffset(), + text->EndOffset()); + has_content = true; + } + builder_->Append("\n"); + return; + } + + if (flags_ & NGPhysicalFragment::DumpType) { + builder_->Append("Unknown fragment type"); has_content = true; } - has_content = AppendFragmentOffsetAndSize(fragment, fragment_offset, - builder, flags, has_content); + has_content = AppendOffsetAndSize(fragment, fragment_offset, has_content); + builder_->Append("\n"); + } - if (flags & NGPhysicalFragment::DumpTextOffsets) { + private: + void Append(NGInlineCursor* cursor, unsigned indent) { + for (; *cursor; cursor->MoveToNextSkippingChildren()) { + const NGInlineCursorPosition& current = cursor->Current(); + if (const NGPhysicalBoxFragment* box = current.BoxFragment()) { + if (!box->IsInlineBox()) { + Append(box, current.OffsetInContainerBlock(), indent); + continue; + } + } + + AppendIndentation(indent); + + // TODO(kojii): Use the same format as layout tree dump for now. We can + // make this more similar to |AppendFragmentToString| above. + builder_->Append(current->ToString()); + + if (flags_ & NGPhysicalFragment::DumpOffset) { + builder_->Append(" offset:"); + builder_->Append(current.OffsetInContainerBlock().ToString()); + } + if (flags_ & NGPhysicalFragment::DumpSize) { + builder_->Append(" size:"); + builder_->Append(current.Size().ToString()); + } + + builder_->Append("\n"); + + if (flags_ & NGPhysicalFragment::DumpSubtree && current.HasChildren()) { + NGInlineCursor descendants = cursor->CursorForDescendants(); + Append(&descendants, indent + 2); + } + } + } + + bool AppendOffsetAndSize(const NGPhysicalFragment* fragment, + base::Optional<PhysicalOffset> fragment_offset, + bool has_content) { + if (flags_ & NGPhysicalFragment::DumpOffset) { if (has_content) - builder->Append(' '); - builder->AppendFormat("start: %u end: %u", text->StartOffset(), - text->EndOffset()); + builder_->Append(" "); + builder_->Append("offset:"); + if (fragment_offset) + builder_->Append(fragment_offset->ToString()); + else + builder_->Append("unplaced"); has_content = true; } - builder->Append("\n"); - return; + if (flags_ & NGPhysicalFragment::DumpSize) { + if (has_content) + builder_->Append(" "); + builder_->Append("size:"); + builder_->Append(fragment->Size().ToString()); + has_content = true; + } + return has_content; } - if (flags & NGPhysicalFragment::DumpType) { - builder->Append("Unknown fragment type"); - has_content = true; + void AppendIndentation(unsigned indent) { + if (flags_ & NGPhysicalFragment::DumpIndentation) { + for (unsigned i = 0; i < indent; i++) + builder_->Append(" "); + } } - has_content = AppendFragmentOffsetAndSize(fragment, fragment_offset, builder, - flags, has_content); - builder->Append("\n"); -} + + StringBuilder* builder_; + NGPhysicalFragment::DumpFlags flags_; +}; } // namespace @@ -566,7 +618,8 @@ StringBuilder string_builder; if (flags & DumpHeaderText) string_builder.Append(".:: LayoutNG Physical Fragment Tree ::.\n"); - AppendFragmentToString(this, fragment_offset, &string_builder, flags, indent); + FragmentTreeDumper(&string_builder, flags) + .Append(this, fragment_offset, indent); return string_builder.ToString(); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h index f8ef053..fc8de7bf 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h
@@ -389,6 +389,7 @@ DumpTextOffsets = 0x40, DumpSelfPainting = 0x80, DumpNodeName = 0x100, + DumpItems = 0x200, DumpAll = -1 }; typedef int DumpFlags;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.h index 54963f70..e80a855 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_simplified_layout_algorithm.h
@@ -45,7 +45,7 @@ scoped_refptr<const NGLayoutResult> Layout() override; MinMaxSizesResult ComputeMinMaxSizes(const MinMaxSizesInput&) const override { NOTREACHED(); - return {MinMaxSizes(), true}; + return {MinMaxSizes(), /* depends_on_percentage_block_size */ true}; } NOINLINE scoped_refptr<const NGLayoutResult> LayoutWithItemsBuilder();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.cc new file mode 100644 index 0000000..9b46a77 --- /dev/null +++ b/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.cc
@@ -0,0 +1,65 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.h" + +#include "third_party/blink/renderer/core/layout/geometry/writing_mode_converter.h" +#include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h" +#include "third_party/blink/renderer/core/layout/ng/ng_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" +#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" + +namespace blink { + +NGSimplifiedOOFLayoutAlgorithm::NGSimplifiedOOFLayoutAlgorithm( + const NGLayoutAlgorithmParams& params, + const NGPhysicalBoxFragment& fragment) + : NGLayoutAlgorithm(params), + writing_direction_(Style().GetWritingDirection()) { + DCHECK(fragment.IsFragmentainerBox()); + + container_builder_.SetBoxType(fragment.BoxType()); + LayoutUnit old_block_size = + NGFragment(writing_direction_.GetWritingMode(), fragment).BlockSize(); + container_builder_.SetFragmentBlockSize(old_block_size); + + // We need the previous physical container size to calculate the position of + // any child fragments. + previous_physical_container_size_ = fragment.Size(); + + // The OOF fragments need to be added after the already existing child + // fragments. Add them now so they are added before we append the OOF results. + for (const auto& child_link : fragment.Children()) { + AddChildFragment(child_link, + *To<NGPhysicalContainerFragment>(child_link.get())); + } +} + +scoped_refptr<const NGLayoutResult> NGSimplifiedOOFLayoutAlgorithm::Layout() { + return container_builder_.ToBoxFragment(); +} + +void NGSimplifiedOOFLayoutAlgorithm::AppendOutOfFlowResult( + scoped_refptr<const NGLayoutResult> result, + LogicalOffset offset) { + // Add the new result to the builder. + container_builder_.AddResult(*result, offset); +} + +void NGSimplifiedOOFLayoutAlgorithm::AddChildFragment( + const NGLink& old_fragment, + const NGPhysicalContainerFragment& new_fragment) { + DCHECK_EQ(old_fragment->Size(), new_fragment.Size()); + + // Determine the previous position in the logical coordinate system. + LogicalOffset child_offset = + WritingModeConverter(writing_direction_, + previous_physical_container_size_) + .ToLogical(old_fragment.Offset(), new_fragment.Size()); + + // Add the new fragment to the builder. + container_builder_.AddChild(new_fragment, child_offset); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.h new file mode 100644 index 0000000..e2ad5b27 --- /dev/null +++ b/third_party/blink/renderer/core/layout/ng/ng_simplified_oof_layout_algorithm.h
@@ -0,0 +1,50 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_SIMPLIFIED_OOF_LAYOUT_ALGORITHM_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_SIMPLIFIED_OOF_LAYOUT_ALGORITHM_H_ + +#include "third_party/blink/renderer/core/layout/ng/ng_layout_algorithm.h" + +#include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h" +#include "third_party/blink/renderer/core/layout/ng/ng_box_fragment_builder.h" + +namespace blink { + +struct NGLink; +class NGPhysicalContainerFragment; + +// This is more a copy-and-append algorithm than a layout algorithm. +// This algorithm will only run when we are trying to add OOF-positioned +// elements to an already laid out fragmentainer. It performs a copy of the +// previous |NGPhysicalFragment| and appends the OOF-positioned elements to the +// |container_builder_|. +class CORE_EXPORT NGSimplifiedOOFLayoutAlgorithm + : public NGLayoutAlgorithm<NGBlockNode, + NGBoxFragmentBuilder, + NGBlockBreakToken> { + public: + NGSimplifiedOOFLayoutAlgorithm(const NGLayoutAlgorithmParams&, + const NGPhysicalBoxFragment&); + + scoped_refptr<const NGLayoutResult> Layout() override; + MinMaxSizesResult ComputeMinMaxSizes(const MinMaxSizesInput&) const override { + NOTREACHED(); + return {MinMaxSizes(), /* depends_on_percentage_block_size */ true}; + } + + void AppendOutOfFlowResult(scoped_refptr<const NGLayoutResult> child, + LogicalOffset offset); + + private: + void AddChildFragment(const NGLink& old_fragment, + const NGPhysicalContainerFragment& new_fragment); + + const WritingDirectionMode writing_direction_; + PhysicalSize previous_physical_container_size_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_SIMPLIFIED_OOF_LAYOUT_ALGORITHM_H_
diff --git a/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc b/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc index 671fc26..6c94732 100644 --- a/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc +++ b/third_party/blink/renderer/core/layout/shapes/shape_outside_info.cc
@@ -39,6 +39,7 @@ #include "third_party/blink/renderer/core/layout/layout_block_flow.h" #include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_image.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/platform/geometry/length_functions.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" @@ -188,7 +189,7 @@ DCHECK(!style_image->IsPendingImage()); const LayoutSize& image_size = RoundedLayoutSize(style_image->ImageSize( layout_box_.GetDocument(), layout_box_.StyleRef().EffectiveZoom(), - reference_box_logical_size_, + FloatSize(reference_box_logical_size_), LayoutObject::ShouldRespectImageOrientation(&layout_box_))); const LayoutRect& margin_rect = @@ -249,8 +250,10 @@ shape_image_threshold, writing_mode, margin); break; case ShapeValue::kBox: { - const FloatRoundedRect& shape_rect = style.GetRoundedBorderFor( - LayoutRect(LayoutPoint(), reference_box_logical_size_)); + // TODO(layout-dev): It seems incorrect to pass logical size to + // RoundedBorderGeometry(). + const FloatRoundedRect& shape_rect = RoundedBorderGeometry::RoundedBorder( + style, PhysicalRect(PhysicalOffset(), reference_box_logical_size_)); shape_ = Shape::CreateLayoutBoxShape(shape_rect, writing_mode, margin); break; }
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index 5fbc225..03d3945 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -109,6 +109,7 @@ #include "third_party/blink/renderer/platform/network/network_utils.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" +#include "third_party/blink/renderer/platform/web_test_support.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" @@ -143,6 +144,11 @@ return result; } +bool IsPagePopupRunningInWebTest(LocalFrame* frame) { + return frame && frame->GetPage()->GetChromeClient().IsPopup() && + WebTestSupport::IsRunningWebTest(); +} + } // namespace DocumentLoader::DocumentLoader( @@ -1496,6 +1502,94 @@ } } +scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( + Document* owner_document, + network::mojom::blink::WebSandboxFlags sandbox_flags) { + scoped_refptr<SecurityOrigin> origin; + if (origin_to_commit_) { + // Origin to commit is specified by the browser process, it must be taken + // and used directly. It is currently supplied only for session history + // navigations, where the origin was already calcuated previously and + // stored on the session history entry. + origin = origin_to_commit_; + } else if (IsPagePopupRunningInWebTest(frame_)) { + // If we are a page popup in LayoutTests ensure we use the popup + // owner's security origin so the tests can possibly access the + // document via internals API. + auto* owner_context = frame_->PagePopupOwner()->GetExecutionContext(); + origin = owner_context->GetSecurityOrigin()->IsolatedCopy(); + } else if (owner_document && owner_document->domWindow()) { + origin = owner_document->domWindow()->GetMutableSecurityOrigin(); + } else { + // Otherwise, create an origin that propagates precursor information + // as needed. For non-opaque origins, this creates a standard tuple + // origin, but for opaque origins, it creates an origin with the + // initiator origin as the precursor. + origin = SecurityOrigin::CreateWithReferenceOrigin(url_, + requestor_origin_.get()); + } + + if ((sandbox_flags & network::mojom::blink::WebSandboxFlags::kOrigin) != + network::mojom::blink::WebSandboxFlags::kNone) { + auto sandbox_origin = origin->DeriveNewOpaqueOrigin(); + + // If we're supposed to inherit our security origin from our + // owner, but we're also sandboxed, the only things we inherit are + // the origin's potential trustworthiness and the ability to + // load local resources. The latter lets about:blank iframes in + // file:// URL documents load images and other resources from + // the file system. + // + // Note: Sandboxed about:srcdoc iframe without "allow-same-origin" aren't + // allowed to load user's file, even if its parent can. + if (owner_document) { + if (origin->IsPotentiallyTrustworthy()) + sandbox_origin->SetOpaqueOriginIsPotentiallyTrustworthy(true); + if (origin->CanLoadLocalResources() && !loading_srcdoc_) + sandbox_origin->GrantLoadLocalResources(); + } + origin = sandbox_origin; + } + + if (!frame_->GetSettings()->GetWebSecurityEnabled()) { + // Web security is turned off. We should let this document access + // every other document. This is used primary by testing harnesses for + // web sites. + origin->GrantUniversalAccess(); + } else if (origin->IsLocal()) { + if (frame_->GetSettings()->GetAllowUniversalAccessFromFileURLs()) { + // Some clients want local URLs to have universal access, but that + // setting is dangerous for other clients. + origin->GrantUniversalAccess(); + } else if (!frame_->GetSettings()->GetAllowFileAccessFromFileURLs()) { + // Some clients do not want local URLs to have access to other local + // URLs. + origin->BlockLocalAccessFromLocalOrigin(); + } + } + + if (grant_load_local_resources_) + origin->GrantLoadLocalResources(); + + if (origin->IsOpaque()) { + KURL url = url_.IsEmpty() ? BlankURL() : url_; + if (SecurityOrigin::Create(url)->IsPotentiallyTrustworthy()) + origin->SetOpaqueOriginIsPotentiallyTrustworthy(true); + } + return origin; +} + +GlobalObjectReusePolicy DocumentLoader::CalculateGlobalObjectReusePolicy( + SecurityOrigin* security_origin) { + // Secure transitions can only happen when navigating from the initial empty + // document. + if (!GetFrameLoader().StateMachine()->IsDisplayingInitialEmptyDocument()) + return GlobalObjectReusePolicy::kCreateNew; + if (!frame_->DomWindow()->GetSecurityOrigin()->CanAccess(security_origin)) + return GlobalObjectReusePolicy::kCreateNew; + return GlobalObjectReusePolicy::kUseExisting; +} + void DocumentLoader::CommitNavigation() { CHECK_GE(state_, kCommitted); DCHECK(frame_->GetPage()); @@ -1535,25 +1629,9 @@ // initialize sandbox flags in security context. crbug.com/1026627 GetFrameLoader().SetFrameOwnerSandboxFlags(frame_policy_.sandbox_flags); - DocumentInit init = - DocumentInit::Create() - .WithDocumentLoader(this, content_security_policy_.Get()) - .WithURL(Url()) - .WithTypeFrom(MimeType()) - .WithOwnerDocument(owner_document) - // Initiator origin will be unused if owner_document is non-null. - // WithInitiatorOrigin() does some DCHECKs that the initiator origin - // and owner document origin match, but it can mismatch in certain - // cases, e.g. a subframe is navigated to about:blank by a frame other - // than its parent. - .WithInitiatorOrigin(owner_document ? nullptr - : requestor_origin_.get()) - .WithOriginToCommit(origin_to_commit_) - .WithSrcdocDocument(loading_srcdoc_) - .WithGrantLoadLocalResources(grant_load_local_resources_) - .WithNewRegistrationContext() - .WithWebBundleClaimedUrl(web_bundle_claimed_url_); - + network::mojom::blink::WebSandboxFlags sandbox_flags = + GetFrameLoader().EffectiveSandboxFlags() | + content_security_policy_->GetSandboxMask(); if (archive_) { // The URL of a Document loaded from a MHTML archive is controlled by // the Content-Location header. This would allow UXSS, since @@ -1563,23 +1641,18 @@ // new windows. DCHECK(commit_reason_ == CommitReason::kRegular || commit_reason_ == CommitReason::kInitialization); - auto flags = (network::mojom::blink::WebSandboxFlags::kAll & - ~(network::mojom::blink::WebSandboxFlags::kPopups | - network::mojom::blink::WebSandboxFlags:: - kPropagatesToAuxiliaryBrowsingContexts)); - init = init.WithSandboxFlags(flags); + sandbox_flags |= (network::mojom::blink::WebSandboxFlags::kAll & + ~(network::mojom::blink::WebSandboxFlags::kPopups | + network::mojom::blink::WebSandboxFlags:: + kPropagatesToAuxiliaryBrowsingContexts)); } else if (commit_reason_ == CommitReason::kXSLT) { - init = init.WithSandboxFlags(frame_->DomWindow()->GetSandboxFlags()); + sandbox_flags |= frame_->DomWindow()->GetSandboxFlags(); } - // We've not set the requisite state on the DocumentInit. Calculate the origin - // and cache it, so repeated GetDocumentOrigin() invocations return the same - // object. - init.CalculateAndCacheDocumentOrigin(); + auto security_origin = CalculateOrigin(owner_document, sandbox_flags); GlobalObjectReusePolicy global_object_reuse_policy = - init.ShouldReuseDOMWindow() ? GlobalObjectReusePolicy::kUseExisting - : GlobalObjectReusePolicy::kCreateNew; + CalculateGlobalObjectReusePolicy(security_origin.get()); if (GetFrameLoader().StateMachine()->IsDisplayingInitialEmptyDocument()) { GetFrameLoader().StateMachine()->AdvanceTo( @@ -1604,7 +1677,7 @@ frame_->GetSettings()->GetAllowUniversalAccessFromFileURLs(); auto* agent = frame_->window_agent_factory().GetAgentForOrigin( has_potential_universal_access_privilege, - V8PerIsolateData::MainThreadIsolate(), init.GetDocumentOrigin().get()); + V8PerIsolateData::MainThreadIsolate(), security_origin.get()); if (frame_->GetDocument()) frame_->GetDocument()->RemoveAllEventListenersRecursively(); @@ -1620,14 +1693,22 @@ } } - SecurityContextInit security_init(init); + // Now that we have the final window and Agent, ensure the security origin has + // the appropriate agent cluster id. This may derive a new security origin. + security_origin = security_origin->GetOriginForAgentCluster( + frame_->DomWindow()->GetAgent()->cluster_id()); + + frame_->DomWindow()->GetSecurityContext().SetContentSecurityPolicy( + content_security_policy_.Get()); + frame_->DomWindow()->GetSecurityContext().ApplySandboxFlags(sandbox_flags); + + SecurityContextInit security_init(frame_->DomWindow(), security_origin); security_init.CalculateSecureContextMode(frame_.Get()); security_init.InitializeOriginTrials( response_.HttpHeaderField(http_names::kOriginTrial)); // TODO(iclelland): Add Feature-Policy-Report-Only to Origin Policy. - security_init.CalculateFeaturePolicy( - frame_.Get(), init.GetType() == DocumentInit::Type::kViewSource, - response_, origin_policy_, frame_policy_); + security_init.CalculateFeaturePolicy(frame_.Get(), response_, origin_policy_, + frame_policy_); // |document_policy_| is parsed in document loader because it is // compared with |frame_policy.required_document_policy| to decide // whether to block the document load or not. @@ -1656,6 +1737,15 @@ WillCommitNavigation(); + DocumentInit init = DocumentInit::Create() + .WithDocumentLoader(this) + .WithURL(Url()) + .WithTypeFrom(MimeType()) + .WithOwnerDocument(owner_document) + .WithSrcdocDocument(loading_srcdoc_) + .WithSandboxFlags(sandbox_flags) + .WithNewRegistrationContext() + .WithWebBundleClaimedUrl(web_bundle_claimed_url_); Document* document = frame_->DomWindow()->InstallNewDocument(init); // Clear the user activation state.
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index 1fd035d..0667393 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -342,6 +342,10 @@ mojom::MHTMLLoadResult::kSuccess; private: + scoped_refptr<SecurityOrigin> CalculateOrigin( + Document* owner_document, + network::mojom::blink::WebSandboxFlags); + GlobalObjectReusePolicy CalculateGlobalObjectReusePolicy(SecurityOrigin*); void DidInstallNewDocument(Document*); void WillCommitNavigation(); void DidCommitNavigation();
diff --git a/third_party/blink/renderer/core/page/chrome_client.cc b/third_party/blink/renderer/core/page/chrome_client.cc index b82b1d0e..a7f609c 100644 --- a/third_party/blink/renderer/core/page/chrome_client.cc +++ b/third_party/blink/renderer/core/page/chrome_client.cc
@@ -54,7 +54,7 @@ void ChromeClient::SetWindowRectWithAdjustment(const IntRect& pending_rect, LocalFrame& frame) { - IntRect screen = GetScreenInfo(frame).available_rect; + IntRect screen(GetScreenInfo(frame).available_rect); IntRect window = pending_rect; IntSize minimum_size = MinimumWindowSize();
diff --git a/third_party/blink/renderer/core/paint/BUILD.gn b/third_party/blink/renderer/core/paint/BUILD.gn index c0ddeeca..6b7ca92 100644 --- a/third_party/blink/renderer/core/paint/BUILD.gn +++ b/third_party/blink/renderer/core/paint/BUILD.gn
@@ -194,6 +194,8 @@ "replaced_painter.h", "root_inline_box_painter.cc", "root_inline_box_painter.h", + "rounded_border_geometry.cc", + "rounded_border_geometry.h", "rounded_inner_rect_clipper.cc", "rounded_inner_rect_clipper.h", "scoped_paint_state.cc",
diff --git a/third_party/blink/renderer/core/paint/background_image_geometry.cc b/third_party/blink/renderer/core/paint/background_image_geometry.cc index 6920506b..ccc8d73 100644 --- a/third_party/blink/renderer/core/paint/background_image_geometry.cc +++ b/third_party/blink/renderer/core/paint/background_image_geometry.cc
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/border_edge.h" #include "third_party/blink/renderer/platform/geometry/layout_rect.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" @@ -47,10 +48,10 @@ kBackgroundPaintInScrollingContents); } -LayoutPoint AccumulatedScrollOffsetForFixedBackground( +PhysicalOffset AccumulatedScrollOffsetForFixedBackground( const LayoutBoxModelObject& object, const LayoutBoxModelObject* container) { - LayoutPoint result; + PhysicalOffset result; if (&object == container) return result; @@ -59,7 +60,7 @@ block && !skip_info.AncestorSkipped(); block = block->ContainingBlock(&skip_info)) { if (block->HasOverflowClip()) - result += block->ScrolledContentOffset(); + result += PhysicalOffsetToBeNoop(block->ScrolledContentOffset()); if (block == container) break; } @@ -84,22 +85,22 @@ if (NeedsFullSizeDestination(fill_layer)) { SetPhaseX(-x_offset.ToFloat()); SetSpaceSize( - LayoutSize(unsnapped_dest_rect_.Width(), SpaceSize().Height())); + PhysicalSize(unsnapped_dest_rect_.Width(), SpaceSize().height)); return; } if (x_offset > 0) { // Move the dest rect if the offset is positive. The image "stays" where // it is over the dest rect, so this effectively modifies the phase. - unsnapped_dest_rect_.Move(x_offset, LayoutUnit()); + unsnapped_dest_rect_.Move(PhysicalOffset(x_offset, LayoutUnit())); snapped_dest_rect_.SetX(LayoutUnit(unsnapped_dest_rect_.X().Round())); // Make the dest as wide as a tile, which will reduce the dest // rect if the tile is too small to fill the paint_rect. If not, // the dest rect will be clipped when intersected with the paint // rect. - unsnapped_dest_rect_.SetWidth(tile_size_.Width()); - snapped_dest_rect_.SetWidth(tile_size_.Width()); + unsnapped_dest_rect_.SetWidth(tile_size_.width); + snapped_dest_rect_.SetWidth(tile_size_.width); SetPhaseX(0); } else { @@ -111,12 +112,12 @@ // tile that remains visible after offsetting the image. // TODO(schenney): This might grow the dest rect if the dest rect has // been adjusted for opaque borders. - unsnapped_dest_rect_.SetWidth(tile_size_.Width() + x_offset); - snapped_dest_rect_.SetWidth(tile_size_.Width() + snapped_x_offset); + unsnapped_dest_rect_.SetWidth(tile_size_.width + x_offset); + snapped_dest_rect_.SetWidth(tile_size_.width + snapped_x_offset); } // Force the horizontal space to zero, retaining vertical. - SetSpaceSize(LayoutSize(LayoutUnit(), SpaceSize().Height())); + SetSpaceSize(PhysicalSize(LayoutUnit(), SpaceSize().height)); } void BackgroundImageGeometry::SetNoRepeatY(const FillLayer& fill_layer, @@ -125,22 +126,22 @@ if (NeedsFullSizeDestination(fill_layer)) { SetPhaseY(-y_offset.ToFloat()); SetSpaceSize( - LayoutSize(SpaceSize().Width(), unsnapped_dest_rect_.Height())); + PhysicalSize(SpaceSize().width, unsnapped_dest_rect_.Height())); return; } if (y_offset > 0) { // Move the dest rect if the offset is positive. The image "stays" where // it is in the paint rect, so this effectively modifies the phase. - unsnapped_dest_rect_.Move(LayoutUnit(), y_offset); + unsnapped_dest_rect_.Move(PhysicalOffset(LayoutUnit(), y_offset)); snapped_dest_rect_.SetY(LayoutUnit(unsnapped_dest_rect_.Y().Round())); // Make the dest as wide as a tile, which will reduce the dest // rect if the tile is too small to fill the paint_rect. If not, // the dest rect will be clipped when intersected with the paint // rect. - unsnapped_dest_rect_.SetHeight(tile_size_.Height()); - snapped_dest_rect_.SetHeight(tile_size_.Height()); + unsnapped_dest_rect_.SetHeight(tile_size_.height); + snapped_dest_rect_.SetHeight(tile_size_.height); SetPhaseY(0); } else { @@ -152,12 +153,12 @@ // tile that remains visible after offsetting the image. // TODO(schenney): This might grow the dest rect if the dest rect has // been adjusted for opaque borders. - unsnapped_dest_rect_.SetHeight(tile_size_.Height() + y_offset); - snapped_dest_rect_.SetHeight(tile_size_.Height() + snapped_y_offset); + unsnapped_dest_rect_.SetHeight(tile_size_.height + y_offset); + snapped_dest_rect_.SetHeight(tile_size_.height + snapped_y_offset); } // Force the vertical space to zero, retaining horizontal. - SetSpaceSize(LayoutSize(SpaceSize().Width(), LayoutUnit())); + SetSpaceSize(PhysicalSize(SpaceSize().width, LayoutUnit())); } void BackgroundImageGeometry::SetRepeatX(const FillLayer& fill_layer, @@ -166,12 +167,12 @@ // All values are unsnapped to accurately set phase in the presence of // zoom and large values. That is, accurately render the // background-position value. - if (tile_size_.Width()) { + if (tile_size_.width) { // Recompute computed_position because here we need to resolve against // unsnapped widths to correctly set the phase. LayoutUnit computed_position = MinimumValueForLength(fill_layer.PositionX(), available_width) - - OffsetInBackground(fill_layer).X(); + OffsetInBackground(fill_layer).left; // Identify the number of tiles that fit within the computed // position in the direction we should be moving. @@ -179,22 +180,22 @@ if (fill_layer.BackgroundXOrigin() == BackgroundEdgeOrigin::kRight) { number_of_tiles_in_position = (available_width - computed_position + extra_offset).ToFloat() / - tile_size_.Width().ToFloat(); + tile_size_.width.ToFloat(); } else { number_of_tiles_in_position = (computed_position + extra_offset).ToFloat() / - tile_size_.Width().ToFloat(); + tile_size_.width.ToFloat(); } // Assuming a non-integral number of tiles, find out how much of the // partial tile is visible. That is the phase. float fractional_position_within_tile = 1.0f - (number_of_tiles_in_position - truncf(number_of_tiles_in_position)); - SetPhaseX(fractional_position_within_tile * tile_size_.Width()); + SetPhaseX(fractional_position_within_tile * tile_size_.width); } else { SetPhaseX(0); } - SetSpaceSize(LayoutSize(LayoutUnit(), SpaceSize().Height())); + SetSpaceSize(PhysicalSize(LayoutUnit(), SpaceSize().height)); } void BackgroundImageGeometry::SetRepeatY(const FillLayer& fill_layer, @@ -203,12 +204,12 @@ // All values are unsnapped to accurately set phase in the presence of // zoom and large values. That is, accurately render the // background-position value. - if (tile_size_.Height()) { + if (tile_size_.height) { // Recompute computed_position because here we need to resolve against // unsnapped widths to correctly set the phase. LayoutUnit computed_position = MinimumValueForLength(fill_layer.PositionY(), available_height) - - OffsetInBackground(fill_layer).Y(); + OffsetInBackground(fill_layer).top; // Identify the number of tiles that fit within the computed // position in the direction we should be moving. @@ -216,48 +217,48 @@ if (fill_layer.BackgroundYOrigin() == BackgroundEdgeOrigin::kBottom) { number_of_tiles_in_position = (available_height - computed_position + extra_offset).ToFloat() / - tile_size_.Height().ToFloat(); + tile_size_.height.ToFloat(); } else { number_of_tiles_in_position = (computed_position + extra_offset).ToFloat() / - tile_size_.Height().ToFloat(); + tile_size_.height.ToFloat(); } // Assuming a non-integral number of tiles, find out how much of the // partial tile is visible. That is the phase. float fractional_position_within_tile = 1.0f - (number_of_tiles_in_position - truncf(number_of_tiles_in_position)); - SetPhaseY(fractional_position_within_tile * tile_size_.Height()); + SetPhaseY(fractional_position_within_tile * tile_size_.height); } else { SetPhaseY(0); } - SetSpaceSize(LayoutSize(SpaceSize().Width(), LayoutUnit())); + SetSpaceSize(PhysicalSize(SpaceSize().width, LayoutUnit())); } void BackgroundImageGeometry::SetSpaceX(LayoutUnit space, LayoutUnit extra_offset) { - SetSpaceSize(LayoutSize(space, SpaceSize().Height())); + SetSpaceSize(PhysicalSize(space, SpaceSize().height)); // Modify the phase to start a full tile at the edge of the paint area - LayoutUnit actual_width = tile_size_.Width() + space; + LayoutUnit actual_width = tile_size_.width + space; SetPhaseX(actual_width ? actual_width - fmodf(extra_offset, actual_width) : 0); } void BackgroundImageGeometry::SetSpaceY(LayoutUnit space, LayoutUnit extra_offset) { - SetSpaceSize(LayoutSize(SpaceSize().Width(), space)); + SetSpaceSize(PhysicalSize(SpaceSize().width, space)); // Modify the phase to start a full tile at the edge of the paint area - LayoutUnit actual_height = tile_size_.Height() + space; + LayoutUnit actual_height = tile_size_.height + space; SetPhaseY(actual_height ? actual_height - fmodf(extra_offset, actual_height) : 0); } void BackgroundImageGeometry::UseFixedAttachment( - const LayoutPoint& attachment_point) { - LayoutPoint aligned_point = attachment_point; + const PhysicalOffset& attachment_point) { + PhysicalOffset aligned_point = attachment_point; phase_.Move( - std::max((aligned_point.X() - unsnapped_dest_rect_.X()).ToFloat(), 0.f), - std::max((aligned_point.Y() - unsnapped_dest_rect_.Y()).ToFloat(), 0.f)); + std::max((aligned_point.left - unsnapped_dest_rect_.X()).ToFloat(), 0.f), + std::max((aligned_point.top - unsnapped_dest_rect_.Y()).ToFloat(), 0.f)); } enum ColumnGroupDirection { kColumnGroupStart, kColumnGroupEnd }; @@ -281,54 +282,58 @@ } } -LayoutPoint BackgroundImageGeometry::GetPositioningOffsetForCell( +PhysicalOffset BackgroundImageGeometry::GetPositioningOffsetForCell( const LayoutTableCell& cell, const LayoutBox& positioning_box) { - LayoutSize border_spacing = LayoutSize(cell.Table()->HBorderSpacing(), - cell.Table()->VBorderSpacing()); - if (positioning_box.IsTableSection()) - return cell.Location() - border_spacing; + LayoutUnit h_border_spacing(cell.Table()->HBorderSpacing()); + LayoutUnit v_border_spacing(cell.Table()->VBorderSpacing()); + // TODO(layout-ng): It looks incorrect to use Location() in this function. + if (positioning_box.IsTableSection()) { + return PhysicalOffset(cell.Location().X() - h_border_spacing, + cell.Location().Y() - v_border_spacing); + } if (positioning_box.IsTableRow()) { - return LayoutPoint(cell.Location().X(), LayoutUnit()) - - LayoutSize(border_spacing.Width(), LayoutUnit()); + return PhysicalOffset(cell.Location().X() - h_border_spacing, LayoutUnit()); } PhysicalRect sections_rect(PhysicalOffset(), cell.Table()->Size()); cell.Table()->SubtractCaptionRect(sections_rect); LayoutUnit height_of_captions = cell.Table()->Size().Height() - sections_rect.Height(); - LayoutPoint offset_in_background = LayoutPoint( + PhysicalOffset offset_in_background = PhysicalOffset( LayoutUnit(), (cell.Section()->Location().Y() - cell.Table()->BorderBefore() - height_of_captions) + cell.Location().Y()); DCHECK(positioning_box.IsLayoutTableCol()); if (ToLayoutTableCol(positioning_box).IsTableColumn()) { - return offset_in_background - - LayoutSize(LayoutUnit(), border_spacing.Height()); + offset_in_background.top -= v_border_spacing; + return offset_in_background; } DCHECK(ToLayoutTableCol(positioning_box).IsTableColumnGroup()); - LayoutUnit offset = offset_in_background.X(); + LayoutUnit offset = offset_in_background.left; ExpandToTableColumnGroup(cell, ToLayoutTableCol(positioning_box), offset, kColumnGroupStart); - offset_in_background.Move(offset, LayoutUnit()); - return offset_in_background - - LayoutSize(LayoutUnit(), border_spacing.Height()); + offset_in_background.left += offset; + offset_in_background.top -= v_border_spacing; + return offset_in_background; } -LayoutSize BackgroundImageGeometry::GetBackgroundObjectDimensions( +PhysicalSize BackgroundImageGeometry::GetBackgroundObjectDimensions( const LayoutTableCell& cell, const LayoutBox& positioning_box) { - LayoutSize border_spacing = LayoutSize(cell.Table()->HBorderSpacing(), - cell.Table()->VBorderSpacing()); - if (positioning_box.IsTableSection()) - return positioning_box.Size() - border_spacing - border_spacing; + PhysicalSize border_spacing(LayoutUnit(cell.Table()->HBorderSpacing()), + LayoutUnit(cell.Table()->VBorderSpacing())); + if (positioning_box.IsTableSection()) { + return PhysicalSizeToBeNoop(positioning_box.Size()) - border_spacing - + border_spacing; + } if (positioning_box.IsTableRow()) { - return positioning_box.Size() - - LayoutSize(border_spacing.Width(), LayoutUnit()) - - LayoutSize(border_spacing.Width(), LayoutUnit()); + return PhysicalSizeToBeNoop(positioning_box.Size()) - + PhysicalSize(border_spacing.width, LayoutUnit()) - + PhysicalSize(border_spacing.width, LayoutUnit()); } DCHECK(positioning_box.IsLayoutTableCol()); @@ -336,9 +341,9 @@ cell.Table()->SubtractCaptionRect(sections_rect); LayoutUnit column_height = sections_rect.Height() - cell.Table()->BorderBefore() - - border_spacing.Height() - border_spacing.Height(); + border_spacing.height - border_spacing.height; if (ToLayoutTableCol(positioning_box).IsTableColumn()) - return LayoutSize(cell.Size().Width(), column_height); + return PhysicalSize(cell.Size().Width(), column_height); DCHECK(ToLayoutTableCol(positioning_box).IsTableColumnGroup()); LayoutUnit width = cell.Size().Width(); @@ -347,7 +352,7 @@ ExpandToTableColumnGroup(cell, ToLayoutTableCol(positioning_box), width, kColumnGroupEnd); - return LayoutSize(width, column_height); + return PhysicalSize(width, column_height); } bool BackgroundImageGeometry::ShouldUseFixedAttachment( @@ -359,20 +364,21 @@ namespace { -LayoutRect FixedAttachmentPositioningArea(const LayoutBoxModelObject& obj, - const LayoutBoxModelObject* container, - const GlobalPaintFlags flags) { +PhysicalRect FixedAttachmentPositioningArea( + const LayoutBoxModelObject& obj, + const LayoutBoxModelObject* container, + const GlobalPaintFlags flags) { // TODO(crbug.com/966142): We should consider ancestor with transform as the // fixed background container, instead of always the viewport. LocalFrameView* frame_view = obj.View()->GetFrameView(); if (!frame_view) - return LayoutRect(); + return PhysicalRect(); ScrollableArea* layout_viewport = frame_view->LayoutViewport(); DCHECK(layout_viewport); - LayoutRect rect = LayoutRect( - LayoutPoint(), LayoutSize(layout_viewport->VisibleContentRect().Size())); + PhysicalRect rect(PhysicalOffset(), + PhysicalSize(layout_viewport->VisibleContentRect().Size())); if (FixedBackgroundPaintsInLocalCoordinates(obj, flags)) return rect; @@ -380,16 +386,18 @@ // The LayoutView is the only object that can paint a fixed background into // its scrolling contents layer, so it gets a special adjustment here. if (auto* layout_view = DynamicTo<LayoutView>(obj)) { - if (obj.GetBackgroundPaintLocation() & kBackgroundPaintInScrollingContents) - rect.SetLocation(LayoutPoint(layout_view->ScrolledContentOffset())); + if (obj.GetBackgroundPaintLocation() & + kBackgroundPaintInScrollingContents) { + rect.offset = + PhysicalOffsetToBeNoop(layout_view->ScrolledContentOffset()); + } } - rect.MoveBy(AccumulatedScrollOffsetForFixedBackground(obj, container)); + rect.Move(AccumulatedScrollOffsetForFixedBackground(obj, container)); if (container) { - rect.MoveBy( - -container->LocalToAbsolutePoint(PhysicalOffset(), kIgnoreTransforms) - .ToLayoutPoint()); + rect.Move( + -container->LocalToAbsolutePoint(PhysicalOffset(), kIgnoreTransforms)); } // By now we have converted the viewport rect to the border box space of @@ -403,7 +411,7 @@ if (container) { DCHECK_GE(container->GetDocument().Lifecycle().GetState(), DocumentLifecycle::kPrePaintClean); - rect.MoveBy(container->FirstFragment().PaintOffset().ToLayoutPoint()); + rect.Move(container->FirstFragment().PaintOffset()); } return rect; @@ -413,12 +421,12 @@ BackgroundImageGeometry::BackgroundImageGeometry( const LayoutView& view, - const LayoutPoint& element_positioning_area_offset) + const PhysicalOffset& element_positioning_area_offset) : box_(view), positioning_box_(view.RootBox()), painting_view_(true) { // The background of the box generated by the root element covers the // entire canvas and will be painted by the view object, but the we should // still use the root element box for positioning. - positioning_size_override_ = view.RootBox().Size(); + positioning_size_override_ = PhysicalSizeToBeNoop(view.RootBox().Size()); // The background image should paint from the root element's coordinate space. element_positioning_area_offset_ = element_positioning_area_offset; } @@ -450,7 +458,7 @@ void BackgroundImageGeometry::ComputeDestRectAdjustments( const FillLayer& fill_layer, - const LayoutRect& unsnapped_positioning_area, + const PhysicalRect& unsnapped_positioning_area, bool disallow_border_derived_adjustment, LayoutRectOutsets& unsnapped_dest_adjust, LayoutRectOutsets& snapped_dest_adjust) const { @@ -479,16 +487,16 @@ // rounds down. We should FromFloatFloor or FromFloatCeil to // move toward the border. FloatRect inner_border_rect = - positioning_box_.StyleRef() - .GetRoundedInnerBorderFor(unsnapped_positioning_area) + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + positioning_box_.StyleRef(), unsnapped_positioning_area) .Rect(); snapped_dest_adjust.SetLeft(LayoutUnit(inner_border_rect.X()) - unsnapped_dest_rect_.X()); snapped_dest_adjust.SetTop(LayoutUnit(inner_border_rect.Y()) - unsnapped_dest_rect_.Y()); - snapped_dest_adjust.SetRight(unsnapped_dest_rect_.MaxX() - + snapped_dest_adjust.SetRight(unsnapped_dest_rect_.Right() - LayoutUnit(inner_border_rect.MaxX())); - snapped_dest_adjust.SetBottom(unsnapped_dest_rect_.MaxY() - + snapped_dest_adjust.SetBottom(unsnapped_dest_rect_.Bottom() - LayoutUnit(inner_border_rect.MaxY())); } return; @@ -516,8 +524,8 @@ BorderEdge edges[4]; positioning_box_.StyleRef().GetBorderEdgeInfo(edges); FloatRect inner_border_rect = - positioning_box_.StyleRef() - .GetRoundedInnerBorderFor(unsnapped_positioning_area) + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + positioning_box_.StyleRef(), unsnapped_positioning_area) .Rect(); LayoutRectOutsets box_outsets = positioning_box_.BorderBoxOutsets(); if (edges[static_cast<unsigned>(BoxSide::kTop)].ObscuresBackground()) { @@ -526,12 +534,12 @@ unsnapped_dest_adjust.SetTop(box_outsets.Top()); } if (edges[static_cast<unsigned>(BoxSide::kRight)].ObscuresBackground()) { - snapped_dest_adjust.SetRight(unsnapped_dest_rect_.MaxX() - + snapped_dest_adjust.SetRight(unsnapped_dest_rect_.Right() - LayoutUnit(inner_border_rect.MaxX())); unsnapped_dest_adjust.SetRight(box_outsets.Right()); } if (edges[static_cast<unsigned>(BoxSide::kBottom)].ObscuresBackground()) { - snapped_dest_adjust.SetBottom(unsnapped_dest_rect_.MaxY() - + snapped_dest_adjust.SetBottom(unsnapped_dest_rect_.Bottom() - LayoutUnit(inner_border_rect.MaxY())); unsnapped_dest_adjust.SetBottom(box_outsets.Bottom()); } @@ -549,7 +557,7 @@ void BackgroundImageGeometry::ComputePositioningAreaAdjustments( const FillLayer& fill_layer, - const LayoutRect& unsnapped_positioning_area, + const PhysicalRect& unsnapped_positioning_area, bool disallow_border_derived_adjustment, LayoutRectOutsets& unsnapped_box_outset, LayoutRectOutsets& snapped_box_outset) const { @@ -578,16 +586,16 @@ // border by more than a pixel when done (particularly under magnifying // zoom). FloatRect inner_border_rect = - positioning_box_.StyleRef() - .GetRoundedInnerBorderFor(unsnapped_positioning_area) + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + positioning_box_.StyleRef(), unsnapped_positioning_area) .Rect(); snapped_box_outset.SetLeft(LayoutUnit(inner_border_rect.X()) - unsnapped_positioning_area.X()); snapped_box_outset.SetTop(LayoutUnit(inner_border_rect.Y()) - unsnapped_positioning_area.Y()); - snapped_box_outset.SetRight(unsnapped_positioning_area.MaxX() - + snapped_box_outset.SetRight(unsnapped_positioning_area.Right() - LayoutUnit(inner_border_rect.MaxX())); - snapped_box_outset.SetBottom(unsnapped_positioning_area.MaxY() - + snapped_box_outset.SetBottom(unsnapped_positioning_area.Bottom() - LayoutUnit(inner_border_rect.MaxY())); } return; @@ -605,11 +613,11 @@ PaintPhase paint_phase, GlobalPaintFlags flags, const FillLayer& fill_layer, - const LayoutRect& paint_rect, - LayoutRect& unsnapped_positioning_area, - LayoutRect& snapped_positioning_area, - LayoutPoint& unsnapped_box_offset, - LayoutPoint& snapped_box_offset) { + const PhysicalRect& paint_rect, + PhysicalRect& unsnapped_positioning_area, + PhysicalRect& snapped_positioning_area, + PhysicalOffset& unsnapped_box_offset, + PhysicalOffset& snapped_box_offset) { if (ShouldUseFixedAttachment(fill_layer)) { // No snapping for fixed attachment. SetHasNonLocalGeometry(); @@ -621,7 +629,7 @@ unsnapped_dest_rect_ = paint_rect; if (painting_view_ || cell_using_container_background_) - unsnapped_positioning_area.SetSize(positioning_size_override_); + unsnapped_positioning_area.size = positioning_size_override_; else unsnapped_positioning_area = unsnapped_dest_rect_; @@ -670,12 +678,12 @@ // Apply the adjustments. snapped_dest_rect_ = unsnapped_dest_rect_; snapped_dest_rect_.Contract(snapped_dest_adjust); - snapped_dest_rect_ = LayoutRect(PixelSnappedIntRect(snapped_dest_rect_)); + snapped_dest_rect_ = PhysicalRect(PixelSnappedIntRect(snapped_dest_rect_)); unsnapped_dest_rect_.Contract(unsnapped_dest_adjust); snapped_positioning_area = unsnapped_positioning_area; snapped_positioning_area.Contract(snapped_box_outset); snapped_positioning_area = - LayoutRect(PixelSnappedIntRect(snapped_positioning_area)); + PhysicalRect(PixelSnappedIntRect(snapped_positioning_area)); unsnapped_positioning_area.Contract(unsnapped_box_outset); // Offset of the positioning area from the corner of the @@ -683,19 +691,19 @@ // TODO(schenney): Could we enable dest adjust for collapsed // borders if we computed this based on the actual offset between // the rects? - unsnapped_box_offset = - LayoutPoint(unsnapped_box_outset.Left() - unsnapped_dest_adjust.Left(), - unsnapped_box_outset.Top() - unsnapped_dest_adjust.Top()); + unsnapped_box_offset = PhysicalOffset( + unsnapped_box_outset.Left() - unsnapped_dest_adjust.Left(), + unsnapped_box_outset.Top() - unsnapped_dest_adjust.Top()); snapped_box_offset = - LayoutPoint(snapped_box_outset.Left() - snapped_dest_adjust.Left(), - snapped_box_outset.Top() - snapped_dest_adjust.Top()); + PhysicalOffset(snapped_box_outset.Left() - snapped_dest_adjust.Left(), + snapped_box_outset.Top() - snapped_dest_adjust.Top()); } } void BackgroundImageGeometry::CalculateFillTileSize( const FillLayer& fill_layer, - const LayoutSize& unsnapped_positioning_area_size, - const LayoutSize& snapped_positioning_area_size) { + const PhysicalSize& unsnapped_positioning_area_size, + const PhysicalSize& snapped_positioning_area_size) { StyleImage* image = fill_layer.GetImage(); EFillSizeType type = fill_layer.SizeType(); @@ -703,13 +711,14 @@ // generated content) and unsnapped for content that has intrinsic // dimensions. Once we choose here we stop tracking whether the tile size is // snapped or unsnapped. - LayoutSize positioning_area_size = !image->HasIntrinsicSize() - ? snapped_positioning_area_size - : unsnapped_positioning_area_size; - LayoutSize image_intrinsic_size(image->ImageSize( - positioning_box_.GetDocument(), - positioning_box_.StyleRef().EffectiveZoom(), positioning_area_size, - LayoutObject::ShouldRespectImageOrientation(&box_))); + PhysicalSize positioning_area_size = !image->HasIntrinsicSize() + ? snapped_positioning_area_size + : unsnapped_positioning_area_size; + PhysicalSize image_intrinsic_size = PhysicalSize::FromFloatSizeFloor( + image->ImageSize(positioning_box_.GetDocument(), + positioning_box_.StyleRef().EffectiveZoom(), + FloatSize(positioning_area_size), + LayoutObject::ShouldRespectImageOrientation(&box_))); switch (type) { case EFillSizeType::kSizeLength: { tile_size_ = positioning_area_size; @@ -718,17 +727,17 @@ const Length& layer_height = fill_layer.SizeLength().Height(); if (layer_width.IsFixed()) { - tile_size_.SetWidth(LayoutUnit(layer_width.Value())); + tile_size_.width = LayoutUnit(layer_width.Value()); } else if (layer_width.IsPercentOrCalc()) { - tile_size_.SetWidth( - ValueForLength(layer_width, positioning_area_size.Width())); + tile_size_.width = + ValueForLength(layer_width, positioning_area_size.width); } if (layer_height.IsFixed()) { - tile_size_.SetHeight(LayoutUnit(layer_height.Value())); + tile_size_.height = LayoutUnit(layer_height.Value()); } else if (layer_height.IsPercentOrCalc()) { - tile_size_.SetHeight( - ValueForLength(layer_height, positioning_area_size.Height())); + tile_size_.height = + ValueForLength(layer_height, positioning_area_size.height); } // If one of the values is auto we have to use the appropriate @@ -737,27 +746,27 @@ if (!image->HasIntrinsicSize()) { // Spec says that auto should be 100% in the absence of // an intrinsic ratio or size. - tile_size_.SetWidth(positioning_area_size.Width()); - } else if (image_intrinsic_size.Height()) { - float adjusted_width = image_intrinsic_size.Width().ToFloat() / - image_intrinsic_size.Height().ToFloat() * - tile_size_.Height().ToFloat(); - if (image_intrinsic_size.Width() >= 1 && adjusted_width < 1) + tile_size_.width = positioning_area_size.width; + } else if (image_intrinsic_size.height) { + float adjusted_width = image_intrinsic_size.width.ToFloat() / + image_intrinsic_size.height.ToFloat() * + tile_size_.height.ToFloat(); + if (image_intrinsic_size.width >= 1 && adjusted_width < 1) adjusted_width = 1; - tile_size_.SetWidth(LayoutUnit(adjusted_width)); + tile_size_.width = LayoutUnit(adjusted_width); } } else if (!layer_width.IsAuto() && layer_height.IsAuto()) { if (!image->HasIntrinsicSize()) { // Spec says that auto should be 100% in the absence of // an intrinsic ratio or size. - tile_size_.SetHeight(positioning_area_size.Height()); - } else if (image_intrinsic_size.Width()) { - float adjusted_height = image_intrinsic_size.Height().ToFloat() / - image_intrinsic_size.Width().ToFloat() * - tile_size_.Width().ToFloat(); - if (image_intrinsic_size.Height() >= 1 && adjusted_height < 1) + tile_size_.height = positioning_area_size.height; + } else if (image_intrinsic_size.width) { + float adjusted_height = image_intrinsic_size.height.ToFloat() / + image_intrinsic_size.width.ToFloat() * + tile_size_.width.ToFloat(); + if (image_intrinsic_size.height >= 1 && adjusted_height < 1) adjusted_height = 1; - tile_size_.SetHeight(LayoutUnit(adjusted_height)); + tile_size_.height = LayoutUnit(adjusted_height); } } else if (layer_width.IsAuto() && layer_height.IsAuto()) { // If both width and height are auto, use the image's intrinsic size. @@ -773,14 +782,14 @@ // so that we resize the image to completely fill the actual painted // area. float horizontal_scale_factor = - image_intrinsic_size.Width() - ? snapped_positioning_area_size.Width().ToFloat() / - image_intrinsic_size.Width() + image_intrinsic_size.width + ? snapped_positioning_area_size.width.ToFloat() / + image_intrinsic_size.width : 1.0f; float vertical_scale_factor = - image_intrinsic_size.Height() - ? snapped_positioning_area_size.Height().ToFloat() / - image_intrinsic_size.Height() + image_intrinsic_size.height + ? snapped_positioning_area_size.height.ToFloat() / + image_intrinsic_size.height : 1.0f; // Force the dimension that determines the size to exactly match the // positioning_area_size in that dimension, so that rounding of floating @@ -790,28 +799,28 @@ // Snap the dependent dimension to avoid bleeding/blending artifacts // at the edge of the image when we paint it. if (horizontal_scale_factor < vertical_scale_factor) { - tile_size_ = LayoutSize( - snapped_positioning_area_size.Width(), - LayoutUnit(std::max(1.0f, roundf(image_intrinsic_size.Height() * + tile_size_ = PhysicalSize( + snapped_positioning_area_size.width, + LayoutUnit(std::max(1.0f, roundf(image_intrinsic_size.height * horizontal_scale_factor)))); } else { - tile_size_ = LayoutSize( - LayoutUnit(std::max(1.0f, roundf(image_intrinsic_size.Width() * + tile_size_ = PhysicalSize( + LayoutUnit(std::max(1.0f, roundf(image_intrinsic_size.width * vertical_scale_factor))), - snapped_positioning_area_size.Height()); + snapped_positioning_area_size.height); } return; } if (horizontal_scale_factor > vertical_scale_factor) { - tile_size_ = - LayoutSize(snapped_positioning_area_size.Width(), - LayoutUnit(std::max(1.0f, image_intrinsic_size.Height() * - horizontal_scale_factor))); + tile_size_ = PhysicalSize( + snapped_positioning_area_size.width, + LayoutUnit(std::max( + 1.0f, image_intrinsic_size.height * horizontal_scale_factor))); } else { tile_size_ = - LayoutSize(LayoutUnit(std::max(1.0f, image_intrinsic_size.Width() * - vertical_scale_factor)), - snapped_positioning_area_size.Height()); + PhysicalSize(LayoutUnit(std::max(1.0f, image_intrinsic_size.width * + vertical_scale_factor)), + snapped_positioning_area_size.height); } return; } @@ -828,21 +837,20 @@ PaintPhase paint_phase, GlobalPaintFlags flags, const FillLayer& fill_layer, - const PhysicalRect& paint_rect_arg) { - LayoutRect paint_rect = paint_rect_arg.ToLayoutRect(); + const PhysicalRect& paint_rect) { // Unsnapped positioning area is used to derive quantities // that reference source image maps and define non-integer values, such // as phase and position. - LayoutRect unsnapped_positioning_area; + PhysicalRect unsnapped_positioning_area; // Snapped positioning area is used for sizing images based on the // background area (like cover and contain), and for setting the repeat // spacing. - LayoutRect snapped_positioning_area; + PhysicalRect snapped_positioning_area; // Additional offset from the corner of the positioning_box_ - LayoutPoint unsnapped_box_offset; - LayoutPoint snapped_box_offset; + PhysicalOffset unsnapped_box_offset; + PhysicalOffset snapped_box_offset; // This method also sets the destination rects. ComputePositioningArea(container, paint_phase, flags, fill_layer, paint_rect, @@ -850,8 +858,8 @@ unsnapped_box_offset, snapped_box_offset); // Sets the tile_size_. - CalculateFillTileSize(fill_layer, unsnapped_positioning_area.Size(), - snapped_positioning_area.Size()); + CalculateFillTileSize(fill_layer, unsnapped_positioning_area.size, + snapped_positioning_area.size); EFillRepeat background_repeat_x = fill_layer.RepeatX(); EFillRepeat background_repeat_y = fill_layer.RepeatY(); @@ -860,84 +868,80 @@ // Unsnapped values are used for most thing, but snapped are used // to computed sizes that must fill the area, such as round and space. LayoutUnit unsnapped_available_width = - unsnapped_positioning_area.Width() - tile_size_.Width(); + unsnapped_positioning_area.Width() - tile_size_.width; LayoutUnit unsnapped_available_height = - unsnapped_positioning_area.Height() - tile_size_.Height(); + unsnapped_positioning_area.Height() - tile_size_.height; LayoutUnit snapped_available_width = - snapped_positioning_area.Width() - tile_size_.Width(); + snapped_positioning_area.Width() - tile_size_.width; LayoutUnit snapped_available_height = - snapped_positioning_area.Height() - tile_size_.Height(); - LayoutSize snapped_positioning_area_size = snapped_positioning_area.Size(); + snapped_positioning_area.Height() - tile_size_.height; + PhysicalSize snapped_positioning_area_size = snapped_positioning_area.size; // Computed position is for placing things within the destination, so use // snapped values. LayoutUnit computed_x_position = MinimumValueForLength(fill_layer.PositionX(), snapped_available_width) - - OffsetInBackground(fill_layer).X(); + OffsetInBackground(fill_layer).left; LayoutUnit computed_y_position = MinimumValueForLength(fill_layer.PositionY(), snapped_available_height) - - OffsetInBackground(fill_layer).Y(); + OffsetInBackground(fill_layer).top; if (background_repeat_x == EFillRepeat::kRoundFill && - snapped_positioning_area_size.Width() > LayoutUnit() && - tile_size_.Width() > LayoutUnit()) { + snapped_positioning_area_size.width > LayoutUnit() && + tile_size_.width > LayoutUnit()) { int nr_tiles = std::max( - 1, - RoundToInt(snapped_positioning_area_size.Width() / tile_size_.Width())); - LayoutUnit rounded_width = snapped_positioning_area_size.Width() / nr_tiles; + 1, RoundToInt(snapped_positioning_area_size.width / tile_size_.width)); + LayoutUnit rounded_width = snapped_positioning_area_size.width / nr_tiles; // Maintain aspect ratio if background-size: auto is set if (fill_layer.SizeLength().Height().IsAuto() && background_repeat_y != EFillRepeat::kRoundFill) { - tile_size_.SetHeight(tile_size_.Height() * rounded_width / - tile_size_.Width()); + tile_size_.height = tile_size_.height * rounded_width / tile_size_.width; } - tile_size_.SetWidth(rounded_width); + tile_size_.width = rounded_width; // Force the first tile to line up with the edge of the positioning area. - SetPhaseX(tile_size_.Width() - ? tile_size_.Width() - - fmodf(computed_x_position + unsnapped_box_offset.X(), - tile_size_.Width()) + SetPhaseX(tile_size_.width + ? tile_size_.width - + fmodf(computed_x_position + unsnapped_box_offset.left, + tile_size_.width) : 0); - SetSpaceSize(LayoutSize()); + SetSpaceSize(PhysicalSize()); } if (background_repeat_y == EFillRepeat::kRoundFill && - snapped_positioning_area_size.Height() > LayoutUnit() && - tile_size_.Height() > LayoutUnit()) { - int nr_tiles = - std::max(1, RoundToInt(snapped_positioning_area_size.Height() / - tile_size_.Height())); - LayoutUnit rounded_height = - snapped_positioning_area_size.Height() / nr_tiles; + snapped_positioning_area_size.height > LayoutUnit() && + tile_size_.height > LayoutUnit()) { + int nr_tiles = std::max(1, RoundToInt(snapped_positioning_area_size.height / + tile_size_.height)); + LayoutUnit rounded_height = snapped_positioning_area_size.height / nr_tiles; // Maintain aspect ratio if background-size: auto is set if (fill_layer.SizeLength().Width().IsAuto() && background_repeat_x != EFillRepeat::kRoundFill) { - tile_size_.SetWidth(tile_size_.Width() * rounded_height / - tile_size_.Height()); + tile_size_.width = tile_size_.width * rounded_height / tile_size_.height; } - tile_size_.SetHeight(rounded_height); + tile_size_.height = rounded_height; // Force the first tile to line up with the edge of the positioning area. - SetPhaseY(tile_size_.Height() - ? tile_size_.Height() - - fmodf(computed_y_position + unsnapped_box_offset.Y(), - tile_size_.Height()) + SetPhaseY(tile_size_.height + ? tile_size_.height - + fmodf(computed_y_position + unsnapped_box_offset.top, + tile_size_.height) : 0); - SetSpaceSize(LayoutSize()); + SetSpaceSize(PhysicalSize()); } if (background_repeat_x == EFillRepeat::kRepeatFill) { // Repeat must set the phase accurately, so use unsnapped values. - SetRepeatX(fill_layer, unsnapped_available_width, unsnapped_box_offset.X()); + SetRepeatX(fill_layer, unsnapped_available_width, + unsnapped_box_offset.left); } else if (background_repeat_x == EFillRepeat::kSpaceFill && - tile_size_.Width() > LayoutUnit()) { + tile_size_.width > LayoutUnit()) { // SpaceFill uses snapped values to fill the painted area. LayoutUnit space = GetSpaceBetweenImageTiles( - snapped_positioning_area_size.Width(), tile_size_.Width()); + snapped_positioning_area_size.width, tile_size_.width); if (space >= LayoutUnit()) - SetSpaceX(space, snapped_box_offset.X()); + SetSpaceX(space, snapped_box_offset.left); else background_repeat_x = EFillRepeat::kNoRepeatFill; } @@ -952,23 +956,23 @@ fill_layer.BackgroundXOrigin() == BackgroundEdgeOrigin::kRight ? snapped_available_width - computed_x_position : computed_x_position; - SetNoRepeatX(fill_layer, unsnapped_box_offset.X() + x_offset, - snapped_box_offset.X() + snapped_x_offset); - if (OffsetInBackground(fill_layer).X() > tile_size_.Width()) - unsnapped_dest_rect_ = snapped_dest_rect_ = LayoutRect(); + SetNoRepeatX(fill_layer, unsnapped_box_offset.left + x_offset, + snapped_box_offset.left + snapped_x_offset); + if (OffsetInBackground(fill_layer).left > tile_size_.width) + unsnapped_dest_rect_ = snapped_dest_rect_ = PhysicalRect(); } if (background_repeat_y == EFillRepeat::kRepeatFill) { // Repeat must set the phase accurately, so use unsnapped values. SetRepeatY(fill_layer, unsnapped_available_height, - unsnapped_box_offset.Y()); + unsnapped_box_offset.top); } else if (background_repeat_y == EFillRepeat::kSpaceFill && - tile_size_.Height() > LayoutUnit()) { + tile_size_.height > LayoutUnit()) { // SpaceFill uses snapped values to fill the painted area. LayoutUnit space = GetSpaceBetweenImageTiles( - snapped_positioning_area_size.Height(), tile_size_.Height()); + snapped_positioning_area_size.height, tile_size_.height); if (space >= LayoutUnit()) - SetSpaceY(space, snapped_box_offset.Y()); + SetSpaceY(space, snapped_box_offset.top); else background_repeat_y = EFillRepeat::kNoRepeatFill; } @@ -983,14 +987,14 @@ fill_layer.BackgroundYOrigin() == BackgroundEdgeOrigin::kBottom ? snapped_available_height - computed_y_position : computed_y_position; - SetNoRepeatY(fill_layer, unsnapped_box_offset.Y() + y_offset, - snapped_box_offset.Y() + snapped_y_offset); - if (OffsetInBackground(fill_layer).Y() > tile_size_.Height()) - unsnapped_dest_rect_ = snapped_dest_rect_ = LayoutRect(); + SetNoRepeatY(fill_layer, unsnapped_box_offset.top + y_offset, + snapped_box_offset.top + snapped_y_offset); + if (OffsetInBackground(fill_layer).top > tile_size_.height) + unsnapped_dest_rect_ = snapped_dest_rect_ = PhysicalRect(); } if (ShouldUseFixedAttachment(fill_layer)) - UseFixedAttachment(paint_rect.Location()); + UseFixedAttachment(paint_rect.offset); // Clip the final output rect to the paint rect. unsnapped_dest_rect_.Intersect(paint_rect); @@ -998,7 +1002,7 @@ // Clip the snapped rect, and re-snap the dest rect as we may have // adjusted it with unsnapped values. snapped_dest_rect_.Intersect(paint_rect); - snapped_dest_rect_ = LayoutRect(PixelSnappedIntRect(snapped_dest_rect_)); + snapped_dest_rect_ = PhysicalRect(PixelSnappedIntRect(snapped_dest_rect_)); } const ImageResourceObserver& BackgroundImageGeometry::ImageClient() const { @@ -1020,10 +1024,10 @@ return box_.StyleRef().GetInterpolationQuality(); } -LayoutPoint BackgroundImageGeometry::OffsetInBackground( +PhysicalOffset BackgroundImageGeometry::OffsetInBackground( const FillLayer& fill_layer) const { if (ShouldUseFixedAttachment(fill_layer)) - return LayoutPoint(); + return PhysicalOffset(); return element_positioning_area_offset_; }
diff --git a/third_party/blink/renderer/core/paint/background_image_geometry.h b/third_party/blink/renderer/core/paint/background_image_geometry.h index 24b3974..a02b998 100644 --- a/third_party/blink/renderer/core/paint/background_image_geometry.h +++ b/third_party/blink/renderer/core/paint/background_image_geometry.h
@@ -7,9 +7,6 @@ #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/paint/paint_phase.h" -#include "third_party/blink/renderer/platform/geometry/layout_point.h" -#include "third_party/blink/renderer/platform/geometry/layout_rect.h" -#include "third_party/blink/renderer/platform/geometry/layout_size.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -19,7 +16,6 @@ class LayoutBox; class LayoutBoxModelObject; class LayoutObject; -class LayoutRect; class LayoutTableCell; class LayoutView; class Document; @@ -31,8 +27,9 @@ public: // Constructor for LayoutView where the coordinate space is different. - BackgroundImageGeometry(const LayoutView&, - const LayoutPoint& element_positioning_area_offset); + BackgroundImageGeometry( + const LayoutView&, + const PhysicalOffset& element_positioning_area_offset); // Constructor for table cells where background_object may be the row or // column the background image is attached to. @@ -58,19 +55,15 @@ // unsnapped rectangle is the size and location intended by the content // author, and is needed to correctly subset images when no background-size // size is given. - PhysicalRect UnsnappedDestRect() const { - return PhysicalRectToBeNoop(unsnapped_dest_rect_); - } - PhysicalRect SnappedDestRect() const { - return PhysicalRectToBeNoop(snapped_dest_rect_); - } + const PhysicalRect& UnsnappedDestRect() const { return unsnapped_dest_rect_; } + const PhysicalRect& SnappedDestRect() const { return snapped_dest_rect_; } // Tile size is the area into which to draw one copy of the image. It // need not be the same as the intrinsic size of the image; if not, // the image will be resized (via an image filter) when painted into // that tile region. This may happen because of CSS background-size and // background-repeat requirements. - const LayoutSize& TileSize() const { return tile_size_; } + const PhysicalSize& TileSize() const { return tile_size_; } // Phase() represents the point in the image that will appear at (0,0) in the // destination space. The point is defined in TileSize() coordinates, that is, @@ -79,7 +72,7 @@ // SpaceSize() represents extra width and height that may be added to // the image if used as a pattern with background-repeat: space. - const LayoutSize& SpaceSize() const { return repeat_spacing_; } + const PhysicalSize& SpaceSize() const { return repeat_spacing_; } // Has background-attachment: fixed. Implies that we can't always cheaply // compute the destination rects. @@ -99,7 +92,7 @@ private: static bool ShouldUseFixedAttachment(const FillLayer&); - void SetSpaceSize(const LayoutSize& repeat_spacing) { + void SetSpaceSize(const PhysicalSize& repeat_spacing) { repeat_spacing_ = repeat_spacing; } void SetPhaseX(float x) { phase_.SetX(x); } @@ -120,19 +113,19 @@ void SetSpaceX(LayoutUnit space, LayoutUnit extra_offset); void SetSpaceY(LayoutUnit space, LayoutUnit extra_offset); - void UseFixedAttachment(const LayoutPoint& attachment_point); + void UseFixedAttachment(const PhysicalOffset& attachment_point); void SetHasNonLocalGeometry() { has_non_local_geometry_ = true; } - LayoutPoint GetPositioningOffsetForCell(const LayoutTableCell&, - const LayoutBox&); - LayoutSize GetBackgroundObjectDimensions(const LayoutTableCell&, - const LayoutBox&); + PhysicalOffset GetPositioningOffsetForCell(const LayoutTableCell&, + const LayoutBox&); + PhysicalSize GetBackgroundObjectDimensions(const LayoutTableCell&, + const LayoutBox&); // Compute adjustments for the destination rects. Adjustments // both optimize painting when the background is obscured by a // border, and snap the dest rect to the border. They also // account for the background-clip property. void ComputeDestRectAdjustments(const FillLayer&, - const LayoutRect&, + const PhysicalRect&, bool, LayoutRectOutsets&, LayoutRectOutsets&) const; @@ -141,7 +134,7 @@ // positioning area to snap values and apply the // background-origin property. void ComputePositioningAreaAdjustments(const FillLayer&, - const LayoutRect&, + const PhysicalRect&, bool, LayoutRectOutsets&, LayoutRectOutsets&) const; @@ -150,17 +143,17 @@ PaintPhase, GlobalPaintFlags, const FillLayer&, - const LayoutRect&, - LayoutRect&, - LayoutRect&, - LayoutPoint&, - LayoutPoint&); + const PhysicalRect&, + PhysicalRect&, + PhysicalRect&, + PhysicalOffset&, + PhysicalOffset&); void CalculateFillTileSize(const FillLayer&, - const LayoutSize&, - const LayoutSize&); + const PhysicalSize&, + const PhysicalSize&); // The offset of the background image within the background positioning area. - LayoutPoint OffsetInBackground(const FillLayer&) const; + PhysicalOffset OffsetInBackground(const FillLayer&) const; // |box_| is the source for the Document. In most cases it also provides the // background properties (see |positioning_box_| for exceptions.) It's also @@ -175,17 +168,17 @@ // When painting table cells or the view, the positioning area // differs from the requested paint rect. - LayoutSize positioning_size_override_; + PhysicalSize positioning_size_override_; // The background image offset from within the background positioning area for // non-fixed background attachment. Used for table cells and the view. - LayoutPoint element_positioning_area_offset_; + PhysicalOffset element_positioning_area_offset_; - LayoutRect unsnapped_dest_rect_; - LayoutRect snapped_dest_rect_; + PhysicalRect unsnapped_dest_rect_; + PhysicalRect snapped_dest_rect_; FloatPoint phase_; - LayoutSize tile_size_; - LayoutSize repeat_spacing_; + PhysicalSize tile_size_; + PhysicalSize repeat_spacing_; bool has_non_local_geometry_ = false; bool painting_view_ = false; bool painting_table_cell_ = false;
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.cc b/third_party/blink/renderer/core/paint/box_border_painter.cc index eba80981..ccce719 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.cc +++ b/third_party/blink/renderer/core/paint/box_border_painter.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/border_edge.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" @@ -517,9 +518,10 @@ // outer stripe const LayoutRectOutsets outer_third_insets = DoubleStripeInsets(edges_, BorderEdge::kDoubleBorderStripeOuter); - FloatRoundedRect outer_third_rect = style_.GetRoundedInnerBorderFor( - border_rect.ToLayoutRect(), outer_third_insets, - include_logical_left_edge_, include_logical_right_edge_); + FloatRoundedRect outer_third_rect = + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, outer_third_insets, include_logical_left_edge_, + include_logical_right_edge_); if (force_rectangular) outer_third_rect.SetRadii(FloatRoundedRect::Radii()); DrawBleedAdjustedDRRect(context, bleed_avoidance_, outer_, outer_third_rect, @@ -528,9 +530,10 @@ // inner stripe const LayoutRectOutsets inner_third_insets = DoubleStripeInsets(edges_, BorderEdge::kDoubleBorderStripeInner); - FloatRoundedRect inner_third_rect = style_.GetRoundedInnerBorderFor( - border_rect.ToLayoutRect(), inner_third_insets, - include_logical_left_edge_, include_logical_right_edge_); + FloatRoundedRect inner_third_rect = + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, inner_third_insets, include_logical_left_edge_, + include_logical_right_edge_); if (force_rectangular) inner_third_rect.SetRadii(FloatRoundedRect::Radii()); context.FillDRRect(inner_third_rect, inner_, color); @@ -615,12 +618,12 @@ if (!visible_edge_set_) return; - outer_ = style_.GetRoundedBorderFor(border_rect.ToLayoutRect(), - include_logical_left_edge, - include_logical_right_edge); - inner_ = style_.GetRoundedInnerBorderFor(border_rect.ToLayoutRect(), - include_logical_left_edge, - include_logical_right_edge); + outer_ = RoundedBorderGeometry::PixelSnappedRoundedBorder( + style_, border_rect, include_logical_left_edge, + include_logical_right_edge); + inner_ = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, include_logical_left_edge, + include_logical_right_edge); // Make sure that the border width isn't larger than the border box, which // can pixel snap smaller. @@ -1083,9 +1086,10 @@ -edges_[static_cast<unsigned>(BoxSide::kBottom)].UsedWidth() * 0.5, -edges_[static_cast<unsigned>(BoxSide::kLeft)].UsedWidth() * 0.5); Path centerline_path; - centerline_path.AddRoundedRect(style_.GetRoundedInnerBorderFor( - border_rect.ToLayoutRect(), center_offsets, include_logical_left_edge_, - include_logical_right_edge_)); + centerline_path.AddRoundedRect( + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, center_offsets, include_logical_left_edge_, + include_logical_right_edge_)); graphics_context.SetStrokeColor(color); @@ -1140,9 +1144,10 @@ GraphicsContextStateSaver state_saver(graphics_context); const LayoutRectOutsets inner_insets = DoubleStripeInsets(edges_, BorderEdge::kDoubleBorderStripeInner); - FloatRoundedRect inner_clip = style_.GetRoundedInnerBorderFor( - border_rect.ToLayoutRect(), inner_insets, include_logical_left_edge_, - include_logical_right_edge_); + FloatRoundedRect inner_clip = + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, inner_insets, include_logical_left_edge_, + include_logical_right_edge_); graphics_context.ClipRoundedRect(inner_clip); DrawBoxSideFromPath(graphics_context, border_rect, border_path, @@ -1165,9 +1170,10 @@ outer_insets.SetLeft(outer_insets.Left() - 1); } - FloatRoundedRect outer_clip = style_.GetRoundedInnerBorderFor( - outer_rect.ToLayoutRect(), outer_insets, include_logical_left_edge_, - include_logical_right_edge_); + FloatRoundedRect outer_clip = + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, outer_rect, outer_insets, include_logical_left_edge_, + include_logical_right_edge_); graphics_context.ClipOutRoundedRect(outer_clip); DrawBoxSideFromPath(graphics_context, border_rect, border_path, border_thickness, stroke_thickness, side, color, @@ -1208,10 +1214,12 @@ int right_width = edges_[static_cast<unsigned>(BoxSide::kRight)].UsedWidth() / 2; - FloatRoundedRect clip_rect = style_.GetRoundedInnerBorderFor( - border_rect.ToLayoutRect(), - LayoutRectOutsets(-top_width, -right_width, -bottom_width, -left_width), - include_logical_left_edge_, include_logical_right_edge_); + FloatRoundedRect clip_rect = + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style_, border_rect, + LayoutRectOutsets(-top_width, -right_width, -bottom_width, + -left_width), + include_logical_left_edge_, include_logical_right_edge_); graphics_context.ClipRoundedRect(clip_rect); DrawBoxSideFromPath(graphics_context, border_rect, border_path,
diff --git a/third_party/blink/renderer/core/paint/box_paint_invalidator.cc b/third_party/blink/renderer/core/paint/box_paint_invalidator.cc index 53a09c5..7527fae 100644 --- a/third_party/blink/renderer/core/paint/box_paint_invalidator.cc +++ b/third_party/blink/renderer/core/paint/box_paint_invalidator.cc
@@ -131,23 +131,24 @@ return PaintInvalidationReason::kGeometry; if (box_.PreviousSize() == box_.Size() && - context_.old_visual_rect == context_.fragment_data->VisualRect()) + box_.PreviousPhysicalSelfVisualOverflowRect() == + box_.PhysicalSelfVisualOverflowRect()) return PaintInvalidationReason::kNone; - // If either border box changed or bounds changed, and old or new border box - // doesn't equal old or new bounds, incremental invalidation is not - // applicable. This captures the following cases: - // - pixel snapping, or not snapping e.g. for some visual overflowing effects, - // - scale, rotate, skew etc. transforms, - // - visual (ink) overflows. - if (PhysicalRect(context_.old_visual_rect) != - PhysicalRect(context_.old_paint_offset, box_.PreviousSize()) || - PhysicalRect(context_.fragment_data->VisualRect()) != - PhysicalRect(context_.fragment_data->PaintOffset(), box_.Size())) { + // Incremental invalidation is not applicable if there is visual overflow. + if (box_.PreviousPhysicalSelfVisualOverflowRect().size != + PhysicalSizeToBeNoop(box_.PreviousSize()) || + box_.PhysicalSelfVisualOverflowRect().size != + PhysicalSizeToBeNoop(box_.Size())) return PaintInvalidationReason::kGeometry; - } - DCHECK_NE(box_.PreviousSize(), box_.Size()); + // Incremental invalidation is not applicable if paint offset or size has + // fraction. + if (context_.old_paint_offset.HasFraction() || + context_.fragment_data->PaintOffset().HasFraction() || + PhysicalSizeToBeNoop(box_.PreviousSize()).HasFraction() || + PhysicalSizeToBeNoop(box_.Size()).HasFraction()) + return PaintInvalidationReason::kGeometry; // Incremental invalidation is not applicable if there is border in the // direction of border box size change because we don't know the border @@ -364,8 +365,7 @@ SavePreviousBoxGeometriesIfNeeded(); } -bool BoxPaintInvalidator:: - NeedsToSavePreviousContentBoxRectOrLayoutOverflowRect() { +bool BoxPaintInvalidator::NeedsToSavePreviousContentBoxRectOrOverflowRects() { // The LayoutView depends on the document element's layout overflow rect (see: // ComputeViewBackgroundInvalidation) and needs to invalidate before the // document element invalidates. There are few document elements so the @@ -379,10 +379,8 @@ if (box_.IsLayoutReplaced()) return true; - // Don't save old box geometries if the paint rect is empty because we'll - // fully invalidate once the paint rect becomes non-empty. - if (context_.fragment_data->VisualRect().IsEmpty()) - return false; + if (box_.HasSelfVisualOverflow()) + return true; const ComputedStyle& style = box_.StyleRef(); @@ -403,12 +401,10 @@ void BoxPaintInvalidator::SavePreviousBoxGeometriesIfNeeded() { box_.GetMutableForPainting().SavePreviousSize(); - if (NeedsToSavePreviousContentBoxRectOrLayoutOverflowRect()) { - box_.GetMutableForPainting() - .SavePreviousContentBoxRectAndLayoutOverflowRect(); + if (NeedsToSavePreviousContentBoxRectOrOverflowRects()) { + box_.GetMutableForPainting().SavePreviousContentBoxAndOverflowRects(); } else { - box_.GetMutableForPainting() - .ClearPreviousContentBoxRectAndLayoutOverflowRect(); + box_.GetMutableForPainting().ClearPreviousContentBoxAndOverflowRects(); } }
diff --git a/third_party/blink/renderer/core/paint/box_paint_invalidator.h b/third_party/blink/renderer/core/paint/box_paint_invalidator.h index f1db827..7a33160 100644 --- a/third_party/blink/renderer/core/paint/box_paint_invalidator.h +++ b/third_party/blink/renderer/core/paint/box_paint_invalidator.h
@@ -46,7 +46,7 @@ PaintInvalidationReason ComputePaintInvalidationReason(); - bool NeedsToSavePreviousContentBoxRectOrLayoutOverflowRect(); + bool NeedsToSavePreviousContentBoxRectOrOverflowRects(); void SavePreviousBoxGeometriesIfNeeded(); const LayoutBox& box_;
diff --git a/third_party/blink/renderer/core/paint/box_paint_invalidator_test.cc b/third_party/blink/renderer/core/paint/box_paint_invalidator_test.cc index c645690..6d3ceebf 100644 --- a/third_party/blink/renderer/core/paint/box_paint_invalidator_test.cc +++ b/third_party/blink/renderer/core/paint/box_paint_invalidator_test.cc
@@ -27,12 +27,10 @@ protected: PaintInvalidationReason ComputePaintInvalidationReason( - const LayoutBox& box, - const IntRect& old_visual_rect, + LayoutBox& box, const PhysicalOffset& old_paint_offset) { FragmentData fragment_data; PaintInvalidatorContext context; - context.old_visual_rect = old_visual_rect; context.old_paint_offset = old_paint_offset; fragment_data_.SetVisualRect(box.FirstFragment().VisualRect()); fragment_data_.SetPaintOffset(box.FirstFragment().PaintOffset()); @@ -40,16 +38,6 @@ return BoxPaintInvalidator(box, context).ComputePaintInvalidationReason(); } - // Accepts old_paint_offset as an IntPoint for convenience of passing it - // based on visual rect offset. - PaintInvalidationReason ComputePaintInvalidationReason( - const LayoutBox& box, - const IntRect& old_visual_rect, - const IntPoint& old_paint_offset) { - return ComputePaintInvalidationReason(box, old_visual_rect, - PhysicalOffset(old_paint_offset)); - } - // This applies when the target is set to meet conditions that we should do // full paint invalidation instead of incremental invalidation on geometry // change. @@ -59,13 +47,12 @@ UpdateAllLifecyclePhasesForTest(); auto& target = *GetDocument().getElementById("target"); auto& box = *ToLayoutBox(target.GetLayoutObject()); - auto visual_rect = box.FirstFragment().VisualRect(); auto paint_offset = box.FirstFragment().PaintOffset(); box.SetShouldCheckForPaintInvalidation(); // No geometry change. EXPECT_EQ(PaintInvalidationReason::kNone, - ComputePaintInvalidationReason(box, visual_rect, paint_offset)); + ComputePaintInvalidationReason(box, paint_offset)); target.setAttribute( html_names::kStyleAttr, @@ -77,12 +64,9 @@ GetDocument().View()->UpdateLifecycleToCompositingInputsClean( DocumentUpdateReason::kTest); } - // Simulate that PaintInvalidator updates visual rect. - box.GetMutableForPainting().SetVisualRect( - IntRect(visual_rect.Location(), RoundedIntSize(box.Size()))); EXPECT_EQ(PaintInvalidationReason::kGeometry, - ComputePaintInvalidationReason(box, visual_rect, paint_offset)); + ComputePaintInvalidationReason(box, paint_offset)); } void SetUpHTML() { @@ -129,32 +113,24 @@ UpdateAllLifecyclePhasesForTest(); box.SetShouldCheckForPaintInvalidation(); - auto visual_rect = box.FirstFragment().VisualRect(); + auto paint_offset = box.FirstFragment().PaintOffset(); // No geometry change. - EXPECT_EQ( - PaintInvalidationReason::kNone, - ComputePaintInvalidationReason(box, visual_rect, visual_rect.Location())); + EXPECT_EQ(PaintInvalidationReason::kNone, + ComputePaintInvalidationReason(box, paint_offset)); // Paint offset change. - auto old_visual_rect = visual_rect; - old_visual_rect.Move(IntSize(10, 20)); + auto old_paint_offset = paint_offset + PhysicalOffset(10, 20); EXPECT_EQ(PaintInvalidationReason::kGeometry, - ComputePaintInvalidationReason(box, old_visual_rect, - old_visual_rect.Location())); + ComputePaintInvalidationReason(box, old_paint_offset)); - // Visual rect size change. - old_visual_rect = visual_rect; + // Size change. target.setAttribute(html_names::kStyleAttr, "width: 200px"); GetDocument().View()->UpdateLifecycleToLayoutClean( DocumentUpdateReason::kTest); - // Simulate that PaintInvalidator updates visual rect. - box.GetMutableForPainting().SetVisualRect( - IntRect(visual_rect.Location(), RoundedIntSize(box.Size()))); EXPECT_EQ(PaintInvalidationReason::kIncremental, - ComputePaintInvalidationReason(box, old_visual_rect, - old_visual_rect.Location())); + ComputePaintInvalidationReason(box, paint_offset)); } TEST_P(BoxPaintInvalidatorTest, ComputePaintInvalidationReasonBasic) { @@ -167,45 +143,42 @@ UpdateAllLifecyclePhasesForTest(); box.SetShouldCheckForPaintInvalidation(); - auto visual_rect = box.FirstFragment().VisualRect(); - EXPECT_EQ(IntRect(0, 0, 50, 100), visual_rect); + auto paint_offset = box.FirstFragment().PaintOffset(); + EXPECT_EQ(PhysicalOffset(), paint_offset); // No geometry change. - EXPECT_EQ( - PaintInvalidationReason::kNone, - ComputePaintInvalidationReason(box, visual_rect, visual_rect.Location())); + EXPECT_EQ(PaintInvalidationReason::kNone, + ComputePaintInvalidationReason(box, paint_offset)); - // Visual rect size change. - auto old_visual_rect = visual_rect; + // Size change. target.setAttribute(html_names::kStyleAttr, "background: blue; width: 200px"); GetDocument().View()->UpdateLifecycleToLayoutClean( DocumentUpdateReason::kTest); - // Simulate that PaintInvalidator updates visual rect. - box.GetMutableForPainting().SetVisualRect( - IntRect(visual_rect.Location(), RoundedIntSize(box.Size()))); EXPECT_EQ(PaintInvalidationReason::kIncremental, - ComputePaintInvalidationReason(box, old_visual_rect, - old_visual_rect.Location())); + ComputePaintInvalidationReason(box, paint_offset)); - // Visual rect size change, with paint offset different from location of - // visual rect. - PhysicalOffset fake_paint_offset = - PhysicalOffset(visual_rect.Location()) + PhysicalOffset(10, 20); - box.GetMutableForPainting().FirstFragment().SetPaintOffset(fake_paint_offset); - EXPECT_EQ( - PaintInvalidationReason::kGeometry, - ComputePaintInvalidationReason(box, old_visual_rect, fake_paint_offset)); + // Add visual overflow. + target.setAttribute(html_names::kStyleAttr, + "background: blue; width: 200px; outline: 5px solid red"); + UpdateAllLifecyclePhasesForTest(); + + // Size change with visual overflow. + target.setAttribute(html_names::kStyleAttr, + "background: blue; width: 100px; outline: 5px solid red"); + GetDocument().View()->UpdateLifecycleToLayoutClean( + DocumentUpdateReason::kTest); + + EXPECT_EQ(PaintInvalidationReason::kGeometry, + ComputePaintInvalidationReason(box, paint_offset)); // Should use the existing full paint invalidation reason regardless of // geometry change. box.SetShouldDoFullPaintInvalidation(PaintInvalidationReason::kStyle); - EXPECT_EQ( - PaintInvalidationReason::kStyle, - ComputePaintInvalidationReason(box, visual_rect, visual_rect.Location())); EXPECT_EQ(PaintInvalidationReason::kStyle, - ComputePaintInvalidationReason( - box, visual_rect, visual_rect.Location() + IntSize(10, 20))); + ComputePaintInvalidationReason(box, paint_offset)); + EXPECT_EQ(PaintInvalidationReason::kStyle, + ComputePaintInvalidationReason(box, paint_offset)); } TEST_P(BoxPaintInvalidatorTest,
diff --git a/third_party/blink/renderer/core/paint/box_painter.cc b/third_party/blink/renderer/core/paint/box_painter.cc index 57eea70..3a56e76 100644 --- a/third_party/blink/renderer/core/paint/box_painter.cc +++ b/third_party/blink/renderer/core/paint/box_painter.cc
@@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/paint/object_painter.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/core/paint/scrollable_area_painter.h" #include "third_party/blink/renderer/core/paint/svg_foreign_object_painter.h" @@ -158,7 +159,7 @@ box_decoration_data.GetBackgroundBleedAvoidance())) { state_saver.Save(); FloatRoundedRect border = - style.GetRoundedBorderFor(paint_rect.ToLayoutRect()); + RoundedBorderGeometry::PixelSnappedRoundedBorder(style, paint_rect); paint_info.context.ClipRoundedRect(border); if (box_decoration_data.GetBackgroundBleedAvoidance() ==
diff --git a/third_party/blink/renderer/core/paint/box_painter_base.cc b/third_party/blink/renderer/core/paint/box_painter_base.cc index d31c4b1..c8aaa56 100644 --- a/third_party/blink/renderer/core/paint/box_painter_base.cc +++ b/third_party/blink/renderer/core/paint/box_painter_base.cc
@@ -17,6 +17,7 @@ #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/paint/rounded_inner_rect_clipper.h" #include "third_party/blink/renderer/core/style/border_edge.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -67,9 +68,8 @@ return; GraphicsContext& context = info.context; - FloatRoundedRect border = style.GetRoundedBorderFor( - paint_rect.ToLayoutRect(), include_logical_left_edge, - include_logical_right_edge); + FloatRoundedRect border = RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, paint_rect, include_logical_left_edge, include_logical_right_edge); bool has_border_radius = style.HasBorderRadius(); bool has_opaque_background = @@ -167,9 +167,9 @@ bool include_logical_right_edge) { if (!style.BoxShadow()) return; - auto bounds = style.GetRoundedInnerBorderFor(border_rect.ToLayoutRect(), - include_logical_left_edge, - include_logical_right_edge); + auto bounds = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style, border_rect, include_logical_left_edge, + include_logical_right_edge); PaintInsetBoxShadow(info, bounds, style, include_logical_left_edge, include_logical_right_edge); } @@ -180,8 +180,8 @@ const ComputedStyle& style) { if (!style.BoxShadow()) return; - auto bounds = style.GetRoundedInnerBorderFor(inner_rect.ToLayoutRect(), - LayoutRectOutsets()); + auto bounds = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style, inner_rect, LayoutRectOutsets()); PaintInsetBoxShadow(info, bounds, style); } @@ -533,8 +533,8 @@ if (!image_border.Rect().IsEmpty()) { // We cannot optimize if the tile is too small. - if (geometry.TileSize().Width() < image_border.Rect().Width() || - geometry.TileSize().Height() < image_border.Rect().Height()) + if (geometry.TileSize().width < image_border.Rect().Width() || + geometry.TileSize().height < image_border.Rect().Height()) return false; // Phase calculation uses the actual painted location, given by the @@ -701,12 +701,15 @@ if (!info.is_rounded_fill) return FloatRoundedRect(); - FloatRoundedRect border = style.GetRoundedBorderFor( - rect.ToLayoutRect(), info.include_left_edge, info.include_right_edge); + FloatRoundedRect border = RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, rect, info.include_left_edge, info.include_right_edge); if (object_has_multiple_boxes) { - FloatRoundedRect segment_border = style.GetRoundedBorderFor( - LayoutRect(LayoutPoint(), LayoutSize(FlooredIntSize(flow_box_size))), - info.include_left_edge, info.include_right_edge); + FloatRoundedRect segment_border = + RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, + PhysicalRect(PhysicalOffset(), + PhysicalSize(FlooredIntSize(flow_box_size))), + info.include_left_edge, info.include_right_edge); border.SetRadii(segment_border.GetRadii()); } @@ -718,14 +721,16 @@ } // Clip to the padding or content boxes as necessary. + // Use FastAndLossyFromFloatRect because we know it has been pixel snapped. + PhysicalRect border_rect = + PhysicalRect::FastAndLossyFromFloatRect(border.Rect()); if (bg_layer.Clip() == EFillBox::kContent) { - border = style.GetRoundedInnerBorderFor( - LayoutRect(border.Rect()), border_padding_insets, - info.include_left_edge, info.include_right_edge); + border = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style, border_rect, border_padding_insets, info.include_left_edge, + info.include_right_edge); } else if (bg_layer.Clip() == EFillBox::kPadding) { - border = style.GetRoundedInnerBorderFor(LayoutRect(border.Rect()), - info.include_left_edge, - info.include_right_edge); + border = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + style, border_rect, info.include_left_edge, info.include_right_edge); } return border; }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 45d979ed..7ededbea 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -39,6 +39,7 @@ #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_phase.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/core/paint/scrollable_area_painter.h" #include "third_party/blink/renderer/core/paint/theme_painter.h" @@ -1043,9 +1044,10 @@ } else if (BleedAvoidanceIsClipping( box_decoration_data.GetBackgroundBleedAvoidance())) { state_saver.Save(); - FloatRoundedRect border = style.GetRoundedBorderFor( - paint_rect.ToLayoutRect(), border_edges.line_left, - border_edges.line_right); + FloatRoundedRect border = + RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, paint_rect, border_edges.line_left, + border_edges.line_right); paint_info.context.ClipRoundedRect(border); if (box_decoration_data.GetBackgroundBleedAvoidance() == @@ -1863,7 +1865,8 @@ if (!skip_children && style.HasBorderRadius()) { PhysicalRect bounds_rect(physical_offset, size); skip_children = !hit_test.location.Intersects( - style.GetRoundedInnerBorderFor(bounds_rect.ToLayoutRect())); + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder(style, + bounds_rect)); } } @@ -2043,7 +2046,8 @@ const ComputedStyle& containing_box_style = box_fragment_.Style(); if (containing_box_style.HasBorderRadius() && !hit_test.location.Intersects( - containing_box_style.GetRoundedBorderFor(bounds_rect.ToLayoutRect()))) + RoundedBorderGeometry::PixelSnappedRoundedBorder(containing_box_style, + bounds_rect))) return false; // Now hit test ourselves. @@ -2502,8 +2506,9 @@ PhysicalRect rect(PhysicalOffset(), PhysicalFragment().Size()); rect.Move(border_box_location); const NGBorderEdges& border_edges = BorderEdges(); - return !hit_test_location.Intersects(style.GetRoundedBorderFor( - rect.ToLayoutRect(), border_edges.line_left, border_edges.line_right)); + return !hit_test_location.Intersects( + RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, rect, border_edges.line_left, border_edges.line_right)); } bool NGBoxFragmentPainter::HitTestOverflowControl(
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc index cd0b9e0..7b3edc09 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc
@@ -178,7 +178,7 @@ // are scaled to effective zoom instead so we must take care not to cause // scale of them again. IntSize image_size = RoundedIntSize( - style_image->ImageSize(document, 1, border_image_rect.size.ToLayoutSize(), + style_image->ImageSize(document, 1, FloatSize(border_image_rect.size), kRespectImageOrientation)); scoped_refptr<Image> image = style_image->GetImage(observer, document, style, FloatSize(image_size));
diff --git a/third_party/blink/renderer/core/paint/object_paint_invalidator.cc b/third_party/blink/renderer/core/paint/object_paint_invalidator.cc index 7a0e4f3..34c003039 100644 --- a/third_party/blink/renderer/core/paint/object_paint_invalidator.cc +++ b/third_party/blink/renderer/core/paint/object_paint_invalidator.cc
@@ -183,8 +183,14 @@ DISABLE_CFI_PERF PaintInvalidationReason ObjectPaintInvalidatorWithContext::ComputePaintInvalidationReason() { - // This is before any early return to ensure the background obscuration status - // is saved. + // This is before any early return to ensure the previous visibility status is + // saved. + bool previous_visibility_visible = object_.PreviousVisibilityVisible(); + object_.GetMutableForPainting().UpdatePreviousVisibilityVisible(); + if (object_.VisualRectRespectsVisibility() && !previous_visibility_visible && + object_.StyleRef().Visibility() != EVisibility::kVisible) + return PaintInvalidationReason::kNone; + if (!object_.ShouldCheckForPaintInvalidation() && (!context_.subtree_flags || context_.subtree_flags == @@ -201,45 +207,14 @@ if (object_.ShouldDoFullPaintInvalidation()) return object_.FullPaintInvalidationReason(); - if (object_.GetDocument().InForcedColorsMode() && - object_.IsLayoutBlockFlow() && !context_.old_visual_rect.IsEmpty()) + if (object_.GetDocument().InForcedColorsMode() && object_.IsLayoutBlockFlow()) return PaintInvalidationReason::kBackplate; - if (!(context_.subtree_flags & - PaintInvalidatorContext::kInvalidateEmptyVisualRect) && - context_.old_visual_rect.IsEmpty() && - context_.fragment_data->VisualRect().IsEmpty()) - return PaintInvalidationReason::kNone; - - // Force full paint invalidation if the outline may be affected by descendants - // and this object is marked for checking paint invalidation for any reason. - if (object_.OutlineMayBeAffectedByDescendants() || - object_.PreviousOutlineMayBeAffectedByDescendants()) { - object_.GetMutableForPainting() - .UpdatePreviousOutlineMayBeAffectedByDescendants(); - return PaintInvalidationReason::kOutline; - } - // Force full paint invalidation if the object has background-clip:text to // update the background on any change in the subtree. if (object_.StyleRef().BackgroundClip() == EFillBox::kText) return PaintInvalidationReason::kBackground; - // If the size is zero on one of our bounds then we know we're going to have - // to do a full invalidation of either old bounds or new bounds. - if (context_.old_visual_rect.IsEmpty()) - return PaintInvalidationReason::kAppeared; - if (context_.fragment_data->VisualRect().IsEmpty()) - return PaintInvalidationReason::kDisappeared; - - // If we shifted, we don't know the exact reason so we are conservative and - // trigger a full invalidation. Shifting could be caused by some layout - // property (left / top) or some in-flow layoutObject inserted / removed - // before us in the tree. - if (context_.fragment_data->VisualRect().Location() != - context_.old_visual_rect.Location()) - return PaintInvalidationReason::kGeometry; - // Most paintings are pixel-snapped so subpixel change of paint offset doesn't // directly cause full raster invalidation. if (RoundedIntPoint(context_.fragment_data->PaintOffset()) != @@ -254,9 +229,6 @@ if (object_.IsBox()) return PaintInvalidationReason::kIncremental; - if (context_.old_visual_rect != context_.fragment_data->VisualRect()) - return PaintInvalidationReason::kGeometry; - return PaintInvalidationReason::kNone; }
diff --git a/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc b/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc index 7598eeff..689f5d84 100644 --- a/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc +++ b/third_party/blink/renderer/core/paint/object_paint_invalidator_test.cc
@@ -342,4 +342,46 @@ )HTML"); } +TEST_F(ObjectPaintInvalidatorTest, VisibilityHidden) { + SetBodyInnerHTML(R"HTML( + <style> + #target { + visibility: hidden; + width: 100px; + height: 100px; + background: blue; + } + </style> + <div id="target"></div> + )HTML"); + + auto* target_element = GetDocument().getElementById("target"); + const auto* target = target_element->GetLayoutObject(); + ValidateDisplayItemClient(target); + EXPECT_TRUE(IsValidDisplayItemClient(target)); + + target_element->setAttribute(html_names::kStyleAttr, "width: 200px"); + GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint( + DocumentUpdateReason::kTest); + EXPECT_TRUE(IsValidDisplayItemClient(target)); + UpdateAllLifecyclePhasesForTest(); + + target_element->setAttribute(html_names::kStyleAttr, + "width: 200px; visibility: visible"); + GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint( + DocumentUpdateReason::kTest); + EXPECT_FALSE(IsValidDisplayItemClient(target)); + UpdateAllLifecyclePhasesForTest(); + EXPECT_TRUE(IsValidDisplayItemClient(target)); + + target_element->setAttribute(html_names::kStyleAttr, + "width: 200px; visibility: hidden"); + GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint( + DocumentUpdateReason::kTest); + EXPECT_FALSE(IsValidDisplayItemClient(target)); + UpdateAllLifecyclePhasesForTest(); + // |target| is not validated because it didn't paint anything. + EXPECT_FALSE(IsValidDisplayItemClient(target)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/paint_invalidator.cc b/third_party/blink/renderer/core/paint/paint_invalidator.cc index 424f4da5..54bd89d 100644 --- a/third_party/blink/renderer/core/paint/paint_invalidator.cc +++ b/third_party/blink/renderer/core/paint/paint_invalidator.cc
@@ -276,18 +276,21 @@ DCHECK(context.tree_builder_context_); DCHECK(!pre_paint_info || &fragment_data == &pre_paint_info->fragment_data); - IntRect visual_rect = ComputeVisualRect(object, pre_paint_info, context); + IntRect old_visual_rect = fragment_data.VisualRect(); + IntRect new_visual_rect = ComputeVisualRect(object, pre_paint_info, context); if (pre_paint_info && !object.IsBox()) { DCHECK(object.IsInline()); // Text and non-atomic inlines share the same FragmentData object per block // fragment, and their FragmentData objects are reset when visiting their // first fragment. So just add to the visual rectangle. - visual_rect.Unite(fragment_data.VisualRect()); + // TODO(crbug.com/1043787): Fix this. The way we use FragmentData for + // non-atomic inlines is not ideal for how LayoutNG works. + new_visual_rect.Unite(fragment_data.VisualRect()); } else { DCHECK_EQ(context.tree_builder_context_->current.paint_offset, fragment_data.PaintOffset()); } - fragment_data.SetVisualRect(visual_rect); + fragment_data.SetVisualRect(new_visual_rect); fragment_data.SetOffsetTo2DTranslationRoot( context.tree_builder_context_->current.offset_to_2d_translation_root); @@ -297,7 +300,7 @@ *context.tree_builder_context_->current.transform, *context.tree_builder_context_->current.clip, *context.tree_builder_context_->current_effect), - context.old_visual_rect, fragment_data.VisualRect(), + old_visual_rect, new_visual_rect, FloatSize(context.old_offset_to_2d_translation_root - fragment_data.OffsetTo2DTranslationRoot())); } @@ -362,16 +365,8 @@ if (pre_paint_info) { FragmentData& fragment_data = pre_paint_info->fragment_data; if (!object.IsBox()) { - // Text and non-atomic inlines may generate multiple physical fragments, - // and we're updating the VisualRect in the FragmentData as we visit each - // of them. As such, the current VisualRect in FragmentData is possibly - // incomplete, so letting anyone use it for comparisons is meaningless. - // TODO(crbug.com/1043787): Fix this. The way we use FragmentData for - // non-atomic inlines is not ideal for how LayoutNG works. - context.old_visual_rect = IntRect(); context.old_offset_to_2d_translation_root = PhysicalOffset(); } else { - context.old_visual_rect = fragment_data.VisualRect(); context.old_offset_to_2d_translation_root = fragment_data.OffsetTo2DTranslationRoot(); } @@ -399,7 +394,6 @@ for (auto* fragment_data = &object.GetMutableForPainting().FirstFragment(); fragment_data; fragment_data = fragment_data->NextFragment(), tree_builder_index++) { - context.old_visual_rect = fragment_data->VisualRect(); context.old_offset_to_2d_translation_root = fragment_data->OffsetTo2DTranslationRoot(); context.fragment_data = fragment_data;
diff --git a/third_party/blink/renderer/core/paint/paint_invalidator.h b/third_party/blink/renderer/core/paint/paint_invalidator.h index 79510f7..8be4cf9 100644 --- a/third_party/blink/renderer/core/paint/paint_invalidator.h +++ b/third_party/blink/renderer/core/paint/paint_invalidator.h
@@ -125,8 +125,7 @@ PaintLayer* painting_layer = nullptr; - // The previous VisualRect and PaintOffset of FragmentData. - IntRect old_visual_rect; + // The previous PaintOffset and OffsetTo2DTranslationRoot of FragmentData. PhysicalOffset old_paint_offset; PhysicalOffset old_offset_to_2d_translation_root;
diff --git a/third_party/blink/renderer/core/paint/paint_layer.cc b/third_party/blink/renderer/core/paint/paint_layer.cc index 7476435..2beb306 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.cc +++ b/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -84,6 +84,7 @@ #include "third_party/blink/renderer/core/paint/paint_layer_paint_order_iterator.h" #include "third_party/blink/renderer/core/paint/paint_layer_painter.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/reference_clip_path_operation.h" #include "third_party/blink/renderer/core/style/shape_clip_path_operation.h" #include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h" @@ -2477,7 +2478,8 @@ FloatRect scaled_reference_box(reference_box); scaled_reference_box.Scale(style.EffectiveZoom()); gfx::RRectF backdrop_filter_bounds = - gfx::RRectF(style.GetRoundedBorderFor(LayoutRect(scaled_reference_box))); + gfx::RRectF(RoundedBorderGeometry::PixelSnappedRoundedBorder( + style, PhysicalRect::EnclosingRect(scaled_reference_box))); return backdrop_filter_bounds; } bool PaintLayer::HitTestClippedOutByClipPath(
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 5854e64..4679744 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
@@ -45,6 +45,7 @@ #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_property_tree_printer.h" +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/paint/svg_root_painter.h" #include "third_party/blink/renderer/platform/graphics/bitmap_image.h" #include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h" @@ -1537,12 +1538,12 @@ if (NeedsPaintPropertyUpdate()) { if (NeedsInnerBorderRadiusClip(object_)) { const LayoutBox& box = ToLayoutBox(object_); - LayoutRect box_rect(context_.current.paint_offset.ToLayoutPoint(), - box.Size()); + PhysicalRect box_rect(context_.current.paint_offset, box.Size()); ClipPaintPropertyNode::State state( context_.current.transform, - box.StyleRef().GetInnerBorderFor(box_rect), - box.StyleRef().GetRoundedInnerBorderFor(box_rect)); + RoundedBorderGeometry::RoundedInnerBorder(box.StyleRef(), box_rect), + RoundedBorderGeometry::PixelSnappedRoundedInnerBorder(box.StyleRef(), + box_rect)); OnUpdateClip(properties_->UpdateInnerBorderRadiusClip( *context_.current.clip, std::move(state))); } else { @@ -1633,8 +1634,8 @@ LayoutReplaced::PreSnappedRectForPersistentSizing(content_rect); } // LayoutReplaced clips the foreground by rounded content box. - auto clip_rect = replaced.StyleRef().GetRoundedInnerBorderFor( - content_rect.ToLayoutRect(), + auto clip_rect = RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + replaced.StyleRef(), content_rect, LayoutRectOutsets( -(replaced.PaddingTop() + replaced.BorderTop()), -(replaced.PaddingRight() + replaced.BorderRight()),
diff --git a/third_party/blink/renderer/core/paint/rounded_border_geometry.cc b/third_party/blink/renderer/core/paint/rounded_border_geometry.cc new file mode 100644 index 0000000..ab8ffb8 --- /dev/null +++ b/third_party/blink/renderer/core/paint/rounded_border_geometry.cc
@@ -0,0 +1,146 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" + +#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" +#include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/platform/geometry/float_rounded_rect.h" +#include "third_party/blink/renderer/platform/geometry/layout_rect_outsets.h" +#include "third_party/blink/renderer/platform/geometry/length_functions.h" + +namespace blink { + +static FloatRoundedRect::Radii CalcRadiiFor(const ComputedStyle& style, + FloatSize size) { + return FloatRoundedRect::Radii( + FloatSizeForLengthSize(style.BorderTopLeftRadius(), size), + FloatSizeForLengthSize(style.BorderTopRightRadius(), size), + FloatSizeForLengthSize(style.BorderBottomLeftRadius(), size), + FloatSizeForLengthSize(style.BorderBottomRightRadius(), size)); +} + +FloatRoundedRect RoundedBorderGeometry::RoundedBorder( + const ComputedStyle& style, + const PhysicalRect& border_rect) { + FloatRoundedRect rounded_rect((FloatRect(border_rect))); + if (style.HasBorderRadius()) { + FloatRoundedRect::Radii radii = + CalcRadiiFor(style, FloatSize(border_rect.size)); + rounded_rect.IncludeLogicalEdges(radii, style.IsHorizontalWritingMode(), + /*include_logical_left_edge*/ true, + /*include_logical_right_edge*/ true); + rounded_rect.ConstrainRadii(); + } + return rounded_rect; +} + +FloatRoundedRect RoundedBorderGeometry::PixelSnappedRoundedBorder( + const ComputedStyle& style, + const PhysicalRect& border_rect, + bool include_logical_left_edge, + bool include_logical_right_edge) { + FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); + if (style.HasBorderRadius()) { + FloatRoundedRect::Radii radii = + CalcRadiiFor(style, FloatSize(border_rect.size)); + rounded_rect.IncludeLogicalEdges(radii, style.IsHorizontalWritingMode(), + include_logical_left_edge, + include_logical_right_edge); + rounded_rect.ConstrainRadii(); + } + return rounded_rect; +} + +FloatRoundedRect RoundedBorderGeometry::RoundedInnerBorder( + const ComputedStyle& style, + const PhysicalRect& border_rect) { + int left_width = style.BorderLeftWidth(); + int right_width = style.BorderRightWidth(); + int top_width = style.BorderTopWidth(); + int bottom_width = style.BorderBottomWidth(); + + LayoutRectOutsets insets(-top_width, -right_width, -bottom_width, + -left_width); + + PhysicalRect inner_rect(border_rect); + inner_rect.Expand(insets); + inner_rect.size.ClampNegativeToZero(); + + FloatRoundedRect float_inner_rect((FloatRect(inner_rect))); + + if (style.HasBorderRadius()) { + FloatRoundedRect::Radii radii = + RoundedBorder(style, border_rect).GetRadii(); + // Insets use negative values. + radii.Shrink(-insets.Top().ToFloat(), -insets.Bottom().ToFloat(), + -insets.Left().ToFloat(), -insets.Right().ToFloat()); + float_inner_rect.IncludeLogicalEdges(radii, style.IsHorizontalWritingMode(), + /*include_logical_left_edge*/ true, + /*include_logical_right_edge*/ true); + } + return float_inner_rect; +} + +FloatRoundedRect RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + const ComputedStyle& style, + const PhysicalRect& border_rect, + bool include_logical_left_edge, + bool include_logical_right_edge) { + bool horizontal = style.IsHorizontalWritingMode(); + + int left_width = (!horizontal || include_logical_left_edge) + ? floorf(style.BorderLeftWidth()) + : 0; + int right_width = (!horizontal || include_logical_right_edge) + ? floorf(style.BorderRightWidth()) + : 0; + int top_width = (horizontal || include_logical_left_edge) + ? floorf(style.BorderTopWidth()) + : 0; + int bottom_width = (horizontal || include_logical_right_edge) + ? floorf(style.BorderBottomWidth()) + : 0; + + return PixelSnappedRoundedInnerBorder( + style, border_rect, + LayoutRectOutsets(-top_width, -right_width, -bottom_width, -left_width), + include_logical_left_edge, include_logical_right_edge); +} + +FloatRoundedRect RoundedBorderGeometry::PixelSnappedRoundedInnerBorder( + const ComputedStyle& style, + const PhysicalRect& border_rect, + const LayoutRectOutsets& insets, + bool include_logical_left_edge, + bool include_logical_right_edge) { + PhysicalRect inner_rect = border_rect; + inner_rect.Expand(insets); + inner_rect.size.ClampNegativeToZero(); + + // The standard LayoutRect::PixelSnappedIntRect() method will not + // let small sizes snap to zero, but that has the side effect here of + // preventing an inner border for a very thin element from snapping to + // zero size as occurs when a unit width border is applied to a sub-pixel + // sized element. So round without forcing non-near-zero sizes to one. + FloatRoundedRect rounded_rect(IntRect( + RoundedIntPoint(inner_rect.offset), + IntSize( + SnapSizeToPixelAllowingZero(inner_rect.Width(), inner_rect.X()), + SnapSizeToPixelAllowingZero(inner_rect.Height(), inner_rect.Y())))); + + if (style.HasBorderRadius()) { + FloatRoundedRect::Radii radii = + PixelSnappedRoundedBorder(style, border_rect).GetRadii(); + // Insets use negative values. + radii.Shrink(-insets.Top().ToFloat(), -insets.Bottom().ToFloat(), + -insets.Left().ToFloat(), -insets.Right().ToFloat()); + rounded_rect.IncludeLogicalEdges(radii, style.IsHorizontalWritingMode(), + include_logical_left_edge, + include_logical_right_edge); + } + return rounded_rect; +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/paint/rounded_border_geometry.h b/third_party/blink/renderer/core/paint/rounded_border_geometry.h new file mode 100644 index 0000000..ee5706e4 --- /dev/null +++ b/third_party/blink/renderer/core/paint/rounded_border_geometry.h
@@ -0,0 +1,50 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_ROUNDED_BORDER_GEOMETRY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_ROUNDED_BORDER_GEOMETRY_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" + +namespace blink { + +class ComputedStyle; +class FloatRoundedRect; +class LayoutRectOutsets; +struct PhysicalRect; + +class CORE_EXPORT RoundedBorderGeometry { + STATIC_ONLY(RoundedBorderGeometry); + + public: + static FloatRoundedRect RoundedBorder(const ComputedStyle&, + const PhysicalRect& border_rect); + + static FloatRoundedRect PixelSnappedRoundedBorder( + const ComputedStyle&, + const PhysicalRect& border_rect, + bool include_logical_left_edge = true, + bool include_logical_right_edge = true); + + static FloatRoundedRect RoundedInnerBorder(const ComputedStyle&, + const PhysicalRect& border_rect); + + static FloatRoundedRect PixelSnappedRoundedInnerBorder( + const ComputedStyle&, + const PhysicalRect& border_rect, + bool include_logical_left_edge = true, + bool include_logical_right_edge = true); + + static FloatRoundedRect PixelSnappedRoundedInnerBorder( + const ComputedStyle&, + const PhysicalRect& border_rect, + const LayoutRectOutsets& insets, + bool include_logical_left_edge = true, + bool include_logical_right_edge = true); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_ROUNDED_BORDER_GEOMETRY_H_
diff --git a/third_party/blink/renderer/core/paint/table_paint_invalidator.cc b/third_party/blink/renderer/core/paint/table_paint_invalidator.cc index 549bb77..c4bc1be5 100644 --- a/third_party/blink/renderer/core/paint/table_paint_invalidator.cc +++ b/third_party/blink/renderer/core/paint/table_paint_invalidator.cc
@@ -21,13 +21,11 @@ // col background paints into section's background display item. bool has_col_changed_background = false; if (table_.HasColElements()) { - bool visual_rect_changed = - context_.old_visual_rect != context_.fragment_data->VisualRect(); for (LayoutTableCol* col = table_.FirstColumn(); col; col = col->NextColumn()) { // LayoutTableCol uses the table's LocalVisualRect(). Should check column - // for paint invalidation when table's visual rect changed. - if (visual_rect_changed) + // for paint invalidation in case that the table's visual rect changed. + if (table_.NeedsPaintOffsetAndVisualRectUpdate()) col->SetShouldCheckForPaintInvalidation(); // This ensures that the BackgroundNeedsFullPaintInvalidation flag is // up-to-date.
diff --git a/third_party/blink/renderer/core/paint/view_painter.cc b/third_party/blink/renderer/core/paint/view_painter.cc index c32bbb12a..95e8620 100644 --- a/third_party/blink/renderer/core/paint/view_painter.cc +++ b/third_party/blink/renderer/core/paint/view_painter.cc
@@ -280,7 +280,7 @@ // Offset for BackgroundImageGeometry to offset the image's origin. This makes // background tiling start at the root element's origin instead of the view. // This is different from the offset for painting, which is in |paint_rect|. - LayoutPoint background_image_offset; + PhysicalOffset background_image_offset; if (!root_object || !root_object->IsBox()) { background_renderable = false; } else { @@ -295,10 +295,9 @@ // With transforms, paint offset is encoded in paint property nodes but we // can use the |paint_rect|'s adjusted location as the offset from the // view to the root element. - background_image_offset = paint_rect.Location(); + background_image_offset = PhysicalOffset(paint_rect.Location()); } else { - background_image_offset = - -root_object->FirstFragment().PaintOffset().ToLayoutPoint(); + background_image_offset = -root_object->FirstFragment().PaintOffset(); } }
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index eb48080..85afd48d 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -64,7 +64,6 @@ #include "third_party/blink/renderer/core/style/style_ray.h" #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/fonts/font_selector.h" -#include "third_party/blink/renderer/platform/geometry/float_rounded_rect.h" #include "third_party/blink/renderer/platform/geometry/length_functions.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/path.h" @@ -1365,136 +1364,6 @@ return true; } -static FloatRoundedRect::Radii CalcRadiiFor(const LengthSize& top_left, - const LengthSize& top_right, - const LengthSize& bottom_left, - const LengthSize& bottom_right, - FloatSize size) { - return FloatRoundedRect::Radii(FloatSizeForLengthSize(top_left, size), - FloatSizeForLengthSize(top_right, size), - FloatSizeForLengthSize(bottom_left, size), - FloatSizeForLengthSize(bottom_right, size)); -} - -FloatRoundedRect ComputedStyle::GetBorderFor( - const LayoutRect& border_rect) const { - FloatRoundedRect rounded_rect((FloatRect(border_rect))); - if (HasBorderRadius()) { - FloatRoundedRect::Radii radii = CalcRadiiFor( - BorderTopLeftRadius(), BorderTopRightRadius(), BorderBottomLeftRadius(), - BorderBottomRightRadius(), FloatSize(border_rect.Size())); - rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), true, - true); - rounded_rect.ConstrainRadii(); - } - return rounded_rect; -} - -FloatRoundedRect ComputedStyle::GetRoundedBorderFor( - const LayoutRect& border_rect, - bool include_logical_left_edge, - bool include_logical_right_edge) const { - FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); - if (HasBorderRadius()) { - FloatRoundedRect::Radii radii = CalcRadiiFor( - BorderTopLeftRadius(), BorderTopRightRadius(), BorderBottomLeftRadius(), - BorderBottomRightRadius(), FloatSize(border_rect.Size())); - rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), - include_logical_left_edge, - include_logical_right_edge); - rounded_rect.ConstrainRadii(); - } - return rounded_rect; -} - -FloatRoundedRect ComputedStyle::GetInnerBorderFor( - const LayoutRect& border_rect) const { - int left_width = BorderLeftWidth(); - int right_width = BorderRightWidth(); - int top_width = BorderTopWidth(); - int bottom_width = BorderBottomWidth(); - - LayoutRectOutsets insets(-top_width, -right_width, -bottom_width, - -left_width); - - LayoutRect inner_rect(border_rect); - inner_rect.Expand(insets); - LayoutSize inner_rect_size = inner_rect.Size(); - inner_rect_size.ClampNegativeToZero(); - inner_rect.SetSize(inner_rect_size); - - FloatRoundedRect float_inner_rect((FloatRect(inner_rect))); - - if (HasBorderRadius()) { - FloatRoundedRect::Radii radii = GetBorderFor(border_rect).GetRadii(); - - // Insets use negative values. - radii.Shrink(-insets.Top().ToFloat(), -insets.Bottom().ToFloat(), - -insets.Left().ToFloat(), -insets.Right().ToFloat()); - float_inner_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), true, - true); - } - return float_inner_rect; -} - -FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( - const LayoutRect& border_rect, - bool include_logical_left_edge, - bool include_logical_right_edge) const { - bool horizontal = IsHorizontalWritingMode(); - - int left_width = (!horizontal || include_logical_left_edge) - ? floorf(BorderLeftWidth()) - : 0; - int right_width = (!horizontal || include_logical_right_edge) - ? floorf(BorderRightWidth()) - : 0; - int top_width = - (horizontal || include_logical_left_edge) ? floorf(BorderTopWidth()) : 0; - int bottom_width = (horizontal || include_logical_right_edge) - ? floorf(BorderBottomWidth()) - : 0; - - return GetRoundedInnerBorderFor( - border_rect, - LayoutRectOutsets(-top_width, -right_width, -bottom_width, -left_width), - include_logical_left_edge, include_logical_right_edge); -} - -FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( - const LayoutRect& border_rect, - const LayoutRectOutsets& insets, - bool include_logical_left_edge, - bool include_logical_right_edge) const { - LayoutRect inner_rect(border_rect); - inner_rect.Expand(insets); - LayoutSize inner_rect_size = inner_rect.Size(); - inner_rect_size.ClampNegativeToZero(); - inner_rect.SetSize(inner_rect_size); - - // The standard LayoutRect::PixelSnappedIntRect() method will not - // let small sizes snap to zero, but that has the side effect here of - // preventing an inner border for a very thin element from snapping to - // zero size as occurs when a unit width border is applied to a sub-pixel - // sized element. So round without forcing non-near-zero sizes to one. - FloatRoundedRect rounded_rect(IntRect( - RoundedIntPoint(inner_rect.Location()), - IntSize( - SnapSizeToPixelAllowingZero(inner_rect.Width(), inner_rect.X()), - SnapSizeToPixelAllowingZero(inner_rect.Height(), inner_rect.Y())))); - - if (HasBorderRadius()) { - FloatRoundedRect::Radii radii = GetRoundedBorderFor(border_rect).GetRadii(); - // Insets use negative values. - radii.Shrink(-insets.Top().ToFloat(), -insets.Bottom().ToFloat(), - -insets.Left().ToFloat(), -insets.Right().ToFloat()); - rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), - include_logical_left_edge, - include_logical_right_edge); - } - return rounded_rect; -} - bool ComputedStyle::CanRenderBorderImage() const { if (!HasBorderDecoration()) return false;
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 7afede2..c5d0586 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -75,7 +75,6 @@ class CSSVariableData; class FilterOperations; class Font; -class FloatRoundedRect; class Hyphenation; class LayoutTheme; class NinePieceImage; @@ -1898,25 +1897,6 @@ LengthSize(Length::Fixed(s.Width()), Length::Fixed(s.Height()))); } - FloatRoundedRect GetBorderFor(const LayoutRect& border_rect) const; - - FloatRoundedRect GetRoundedBorderFor( - const LayoutRect& border_rect, - bool include_logical_left_edge = true, - bool include_logical_right_edge = true) const; - - FloatRoundedRect GetInnerBorderFor(const LayoutRect& border_rect) const; - - FloatRoundedRect GetRoundedInnerBorderFor( - const LayoutRect& border_rect, - bool include_logical_left_edge = true, - bool include_logical_right_edge = true) const; - FloatRoundedRect GetRoundedInnerBorderFor( - const LayoutRect& border_rect, - const LayoutRectOutsets& insets, - bool include_logical_left_edge = true, - bool include_logical_right_edge = true) const; - bool CanRenderBorderImage() const; // Float utility functions.
diff --git a/third_party/blink/renderer/core/style/fill_layer.cc b/third_party/blink/renderer/core/style/fill_layer.cc index 92912b7..e200037 100644 --- a/third_party/blink/renderer/core/style/fill_layer.cc +++ b/third_party/blink/renderer/core/style/fill_layer.cc
@@ -391,7 +391,7 @@ // checking for IsEmpty. return image_->KnownToBeOpaque(document, style) && !image_ - ->ImageSize(document, style.EffectiveZoom(), LayoutSize(), + ->ImageSize(document, style.EffectiveZoom(), FloatSize(), kRespectImageOrientation) .IsEmpty(); }
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.cc b/third_party/blink/renderer/core/style/style_fetched_image.cc index 63006da..1489135 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image.cc +++ b/third_party/blink/renderer/core/style/style_fetched_image.cc
@@ -109,7 +109,7 @@ FloatSize StyleFetchedImage::ImageSize( const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum respect_orientation) const { Image* image = image_->GetImage(); if (image_->HasDevicePixelRatioHeaderValue()) {
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.h b/third_party/blink/renderer/core/style/style_fetched_image.h index 0c16029..a0aa856 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image.h +++ b/third_party/blink/renderer/core/style/style_fetched_image.h
@@ -57,7 +57,7 @@ bool ErrorOccurred() const override; FloatSize ImageSize(const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override; void AddClient(ImageResourceObserver*) override;
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.cc b/third_party/blink/renderer/core/style/style_fetched_image_set.cc index 632281d..288d471 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image_set.cc +++ b/third_party/blink/renderer/core/style/style_fetched_image_set.cc
@@ -96,7 +96,7 @@ FloatSize StyleFetchedImageSet::ImageSize( const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum respect_orientation) const { Image* image = best_fit_image_->GetImage(); if (auto* svg_image = DynamicTo<SVGImage>(image)) {
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.h b/third_party/blink/renderer/core/style/style_fetched_image_set.h index f01558c..24ed414 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image_set.h +++ b/third_party/blink/renderer/core/style/style_fetched_image_set.h
@@ -67,7 +67,7 @@ bool ErrorOccurred() const override; FloatSize ImageSize(const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override; void AddClient(ImageResourceObserver*) override;
diff --git a/third_party/blink/renderer/core/style/style_generated_image.cc b/third_party/blink/renderer/core/style/style_generated_image.cc index 1b0148c..349a0aaa 100644 --- a/third_party/blink/renderer/core/style/style_generated_image.cc +++ b/third_party/blink/renderer/core/style/style_generated_image.cc
@@ -57,17 +57,17 @@ FloatSize StyleGeneratedImage::ImageSize(const Document& document, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum) const { if (fixed_size_) { - FloatSize unzoomed_default_object_size(default_object_size); + FloatSize unzoomed_default_object_size = default_object_size; unzoomed_default_object_size.Scale(1 / multiplier); return ApplyZoom(FloatSize(image_generator_value_->FixedSize( document, unzoomed_default_object_size)), multiplier); } - return FloatSize(default_object_size); + return default_object_size; } void StyleGeneratedImage::AddClient(ImageResourceObserver* observer) {
diff --git a/third_party/blink/renderer/core/style/style_generated_image.h b/third_party/blink/renderer/core/style/style_generated_image.h index f1b708f7..17517e9 100644 --- a/third_party/blink/renderer/core/style/style_generated_image.h +++ b/third_party/blink/renderer/core/style/style_generated_image.h
@@ -49,7 +49,7 @@ FloatSize ImageSize(const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum) const override; bool HasIntrinsicSize() const override { return fixed_size_; } void AddClient(ImageResourceObserver*) override;
diff --git a/third_party/blink/renderer/core/style/style_image.cc b/third_party/blink/renderer/core/style/style_image.cc index 41e864d..145db70 100644 --- a/third_party/blink/renderer/core/style/style_image.cc +++ b/third_party/blink/renderer/core/style/style_image.cc
@@ -30,8 +30,8 @@ FloatSize StyleImage::ImageSizeForSVGImage( SVGImage* svg_image, float multiplier, - const LayoutSize& default_object_size) const { - FloatSize unzoomed_default_object_size(default_object_size); + const FloatSize& default_object_size) const { + FloatSize unzoomed_default_object_size = default_object_size; unzoomed_default_object_size.Scale(1 / multiplier); return ApplyZoom(svg_image->ConcreteObjectSize(unzoomed_default_object_size), multiplier);
diff --git a/third_party/blink/renderer/core/style/style_image.h b/third_party/blink/renderer/core/style/style_image.h index c0fa8eff..a6eedc7 100644 --- a/third_party/blink/renderer/core/style/style_image.h +++ b/third_party/blink/renderer/core/style/style_image.h
@@ -35,7 +35,6 @@ class FloatSize; class Image; class ImageResourceContent; -class LayoutSize; class SVGImage; class Document; class ComputedStyle; @@ -92,7 +91,7 @@ // supports it. virtual FloatSize ImageSize(const Document&, float multiplier, - const LayoutSize& default_object_size, + const FloatSize& default_object_size, RespectImageOrientationEnum) const = 0; // The <image> has intrinsic dimensions. @@ -168,7 +167,7 @@ FloatSize ApplyZoom(const FloatSize&, float multiplier) const; FloatSize ImageSizeForSVGImage(SVGImage*, float multiplier, - const LayoutSize& default_object_size) const; + const FloatSize& default_object_size) const; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/style/style_pending_image.h b/third_party/blink/renderer/core/style/style_pending_image.h index ff28692..9612283 100644 --- a/third_party/blink/renderer/core/style/style_pending_image.h +++ b/third_party/blink/renderer/core/style/style_pending_image.h
@@ -71,8 +71,8 @@ } FloatSize ImageSize(const Document&, - float /*multiplier*/, - const LayoutSize& /*defaultObjectSize*/, + float, + const FloatSize&, RespectImageOrientationEnum) const override { return FloatSize(); }
diff --git a/third_party/blink/renderer/core/svg/animation/smil_time_container.cc b/third_party/blink/renderer/core/svg/animation/smil_time_container.cc index 7e47120..e009d30 100644 --- a/third_party/blink/renderer/core/svg/animation/smil_time_container.cc +++ b/third_party/blink/renderer/core/svg/animation/smil_time_container.cc
@@ -445,6 +445,12 @@ } void SMILTimeContainer::ServiceAnimations() { + // If a synchronization is pending, we can flush it now. + if (frame_scheduling_state_ == kSynchronizeAnimations) { + DCHECK(wakeup_timer_.IsActive()); + wakeup_timer_.Stop(); + frame_scheduling_state_ = kAnimationFrame; + } if (frame_scheduling_state_ != kAnimationFrame) return; frame_scheduling_state_ = kIdle;
diff --git a/third_party/blink/renderer/core/svg/animation/smil_time_container_test.cc b/third_party/blink/renderer/core/svg/animation/smil_time_container_test.cc index 1192a7dc..75cbfc2 100644 --- a/third_party/blink/renderer/core/svg/animation/smil_time_container_test.cc +++ b/third_party/blink/renderer/core/svg/animation/smil_time_container_test.cc
@@ -14,6 +14,7 @@ #include "third_party/blink/renderer/core/svg/svg_length.h" #include "third_party/blink/renderer/core/svg/svg_length_context.h" #include "third_party/blink/renderer/core/svg/svg_rect_element.h" +#include "third_party/blink/renderer/core/svg/svg_set_element.h" #include "third_party/blink/renderer/core/svg/svg_svg_element.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" @@ -22,6 +23,71 @@ namespace blink { namespace { +class SMILTimeContainerTest : public PageTestBase { + public: + void SetUp() override { + EnablePlatform(); + platform()->SetAutoAdvanceNowToPendingTasks(false); + PageTestBase::SetUp(); + } + + void Load(base::span<const char> data) { + auto params = WebNavigationParams::CreateWithHTMLString( + data, KURL("http://example.com")); + GetFrame().Loader().CommitNavigation(std::move(params), + nullptr /* extra_data */); + GetAnimationClock().ResetTimeForTesting(); + GetAnimationClock().SetAllowedToDynamicallyUpdateTime(false); + GetDocument().Timeline().ResetForTesting(); + } + + void StepTime(base::TimeDelta delta) { + platform()->RunForPeriod(delta); + current_time_ += delta; + GetAnimationClock().UpdateTime(current_time_); + } + + private: + base::TimeTicks current_time_; +}; + +TEST_F(SMILTimeContainerTest, ServiceAnimationsFlushesPendingSynchronizations) { + Load(R"HTML( + <svg id="container"> + <rect width="100" height="0" fill="green"/> + </svg> + )HTML"); + platform()->RunUntilIdle(); + + auto* svg_root = To<SVGSVGElement>(GetElementById("container")); + ASSERT_TRUE(svg_root); + auto* rect = Traversal<SVGRectElement>::FirstChild(*svg_root); + ASSERT_TRUE(rect); + SVGLengthContext length_context(rect); + + SMILTimeContainer* time_container = svg_root->TimeContainer(); + EXPECT_TRUE(time_container->IsStarted()); + EXPECT_FALSE(time_container->IsPaused()); + EXPECT_EQ(0, rect->height()->CurrentValue()->Value(length_context)); + + // Insert an animation: <set attributeName="height" to="100"/> of the <rect>. + auto* animation = MakeGarbageCollected<SVGSetElement>(GetDocument()); + animation->setAttribute(svg_names::kAttributeTypeAttr, "XML"); + animation->setAttribute(svg_names::kAttributeNameAttr, "height"); + animation->setAttribute(svg_names::kToAttr, "100"); + rect->appendChild(animation); + + // Frame callback before the synchronization timer fires. + SVGDocumentExtensions::ServiceOnAnimationFrame(GetDocument()); + + // The frame callback should have flushed any pending updates. + EXPECT_EQ(100, rect->height()->CurrentValue()->Value(length_context)); + + StepTime(base::TimeDelta::FromMilliseconds(500)); + EXPECT_EQ(100, rect->height()->CurrentValue()->Value(length_context)); + EXPECT_EQ(SMILTime::FromSecondsD(0.5), time_container->Elapsed()); +} + class ContentLoadedEventListener final : public NativeEventListener { public: using CallbackType = base::OnceCallback<void(Document&)>;
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_promise.h b/third_party/blink/renderer/modules/clipboard/clipboard_promise.h index cd903e6..45168da4 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_promise.h +++ b/third_party/blink/renderer/modules/clipboard/clipboard_promise.h
@@ -54,6 +54,8 @@ // Adds the blob to the clipboard items. void OnRead(Blob* blob); + LocalFrame* GetLocalFrame() const; + void Trace(Visitor*) const override; private: @@ -84,7 +86,6 @@ bool allow_without_sanitization, base::OnceCallback<void(::blink::mojom::PermissionStatus)> callback); - LocalFrame* GetLocalFrame() const; scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(); Member<ScriptState> script_state_;
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_reader.cc b/third_party/blink/renderer/modules/clipboard/clipboard_reader.cc index fb48bf2..180fe127 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_reader.cc +++ b/third_party/blink/renderer/modules/clipboard/clipboard_reader.cc
@@ -6,7 +6,10 @@ #include "third_party/blink/public/mojom/clipboard/clipboard.mojom-blink.h" #include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h" #include "third_party/blink/renderer/core/clipboard/system_clipboard.h" +#include "third_party/blink/renderer/core/dom/document_fragment.h" +#include "third_party/blink/renderer/core/editing/serializers/serialization.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" #include "third_party/blink/renderer/modules/clipboard/clipboard_promise.h" #include "third_party/blink/renderer/platform/image-encoders/image_encoder.h" @@ -142,10 +145,77 @@ } }; +class ClipboardHtmlReader final : public ClipboardReader { + public: + explicit ClipboardHtmlReader(SystemClipboard* system_clipboard, + ClipboardPromise* promise) + : ClipboardReader(system_clipboard, promise) {} + ~ClipboardHtmlReader() override = default; + + // This must be called on the main thread because HTML DOM nodes can + // only be used on the main thread. + void Read() override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + KURL url; + unsigned fragment_start = 0; + unsigned fragment_end = 0; + + String html_string = + system_clipboard()->ReadHTML(url, fragment_start, fragment_end); + + // Now sanitize the HTML string. + LocalFrame* frame = promise_->GetLocalFrame(); + DocumentFragment* fragment = CreateSanitizedFragmentFromMarkupWithContext( + *frame->GetDocument(), html_string, fragment_start, + html_string.length(), url); + String sanitized_html = + CreateMarkup(fragment, kIncludeNode, kResolveAllURLs); + + if (sanitized_html.IsEmpty()) { + NextRead(Vector<uint8_t>()); + return; + } + worker_pool::PostTask( + FROM_HERE, + CrossThreadBindOnce(&ClipboardHtmlReader::EncodeHTMLOnBackgroundThread, + std::move(sanitized_html), + WrapCrossThreadPersistent(this), + std::move(clipboard_task_runner_))); + } + + private: + static void EncodeHTMLOnBackgroundThread( + String plain_text, + ClipboardHtmlReader* reader, + scoped_refptr<base::SingleThreadTaskRunner> clipboard_task_runner) { + DCHECK(!IsMainThread()); + + // Encode WTF String to UTF-8, the standard text format for blobs. + StringUTF8Adaptor utf8_text(plain_text); + Vector<uint8_t> utf8_bytes; + utf8_bytes.ReserveInitialCapacity(utf8_text.size()); + utf8_bytes.Append(utf8_text.data(), utf8_text.size()); + + PostCrossThreadTask(*clipboard_task_runner, FROM_HERE, + CrossThreadBindOnce(&ClipboardHtmlReader::NextRead, + WrapCrossThreadPersistent(reader), + std::move(utf8_bytes))); + } + + void NextRead(Vector<uint8_t> utf8_bytes) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + Blob* blob = nullptr; + if (utf8_bytes.size()) { + blob = + Blob::Create(utf8_bytes.data(), utf8_bytes.size(), kMimeTypeTextHTML); + } + promise_->OnRead(blob); + } +}; + } // anonymous namespace // ClipboardReader functions. -// static ClipboardReader* ClipboardReader::Create(SystemClipboard* system_clipboard, const String& mime_type, ClipboardPromise* promise) { @@ -155,6 +225,8 @@ if (mime_type == kMimeTypeTextPlain) return MakeGarbageCollected<ClipboardTextReader>(system_clipboard, promise); + if (mime_type == kMimeTypeTextHTML) + return MakeGarbageCollected<ClipboardHtmlReader>(system_clipboard, promise); // The MIME type is not supported. return nullptr; }
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc index 2891db58..ab6ea03 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc +++ b/third_party/blink/renderer/modules/clipboard/clipboard_writer.cc
@@ -10,8 +10,11 @@ #include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h" #include "third_party/blink/renderer/core/clipboard/raw_system_clipboard.h" #include "third_party/blink/renderer/core/clipboard/system_clipboard.h" +#include "third_party/blink/renderer/core/dom/document_fragment.h" +#include "third_party/blink/renderer/core/editing/serializers/serialization.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/fileapi/file_reader_loader.h" +#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h" #include "third_party/blink/renderer/modules/clipboard/clipboard_promise.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" @@ -33,6 +36,16 @@ ~ClipboardImageWriter() override = default; private: + void StartWrite(scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* raw_data) override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + worker_pool::PostTask( + FROM_HERE, + CrossThreadBindOnce(&ClipboardImageWriter::DecodeOnBackgroundThread, + WrapCrossThreadPersistent(this), task_runner, + WrapCrossThreadPersistent(raw_data))); + } void DecodeOnBackgroundThread( scoped_refptr<base::SingleThreadTaskRunner> task_runner, DOMArrayBuffer* png_data) override { @@ -74,6 +87,16 @@ ~ClipboardTextWriter() override = default; private: + void StartWrite(scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* raw_data) override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + worker_pool::PostTask( + FROM_HERE, + CrossThreadBindOnce(&ClipboardTextWriter::DecodeOnBackgroundThread, + WrapCrossThreadPersistent(this), task_runner, + WrapCrossThreadPersistent(raw_data))); + } void DecodeOnBackgroundThread( scoped_refptr<base::SingleThreadTaskRunner> task_runner, DOMArrayBuffer* raw_data) override { @@ -96,6 +119,50 @@ } }; +class ClipboardHtmlWriter final : public ClipboardWriter { + public: + ClipboardHtmlWriter(SystemClipboard* system_clipboard, + ClipboardPromise* promise) + : ClipboardWriter(system_clipboard, promise) {} + ~ClipboardHtmlWriter() override = default; + + private: + void StartWrite(scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* html_data) override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + String html_string = + String::FromUTF8(reinterpret_cast<const LChar*>(html_data->Data()), + html_data->ByteLengthAsSizeT()); + + // Sanitizing on the main thread because HTML DOM nodes can only be used + // on the main thread. + KURL url; + unsigned fragment_start = 0; + unsigned fragment_end = html_string.length(); + + Document* document = promise_->GetLocalFrame()->GetDocument(); + DocumentFragment* fragment = CreateSanitizedFragmentFromMarkupWithContext( + *document, html_string, fragment_start, fragment_end, url); + String sanitized_html = + CreateMarkup(fragment, kIncludeNode, kResolveAllURLs); + Write(sanitized_html, url); + } + + void DecodeOnBackgroundThread( + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* html_data) override { + NOTREACHED() << "HTML's serializers cannot be used on background threads."; + } + + void Write(const String& sanitized_html, KURL url) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + String plain_text = ""; + system_clipboard()->WriteHTML(sanitized_html, url); + promise_->CompleteWriteRepresentation(); + } +}; + // Writes a blob with arbitrary, unsanitized content to the System Clipboard. class ClipboardRawDataWriter final : public ClipboardWriter { public: @@ -106,6 +173,17 @@ ~ClipboardRawDataWriter() override = default; private: + void StartWrite(scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* raw_data) override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + worker_pool::PostTask( + FROM_HERE, + CrossThreadBindOnce(&ClipboardRawDataWriter::DecodeOnBackgroundThread, + WrapCrossThreadPersistent(this), task_runner, + WrapCrossThreadPersistent(raw_data))); + } + // Unfortunately, in order to use the same ClipboardWriter base, // ClipboardRawDataWriter does need to have these extra 2 thread hops. void DecodeOnBackgroundThread( @@ -156,6 +234,9 @@ if (mime_type == kMimeTypeTextPlain) return MakeGarbageCollected<ClipboardTextWriter>(system_clipboard, promise); + if (mime_type == kMimeTypeTextHTML) + return MakeGarbageCollected<ClipboardHtmlWriter>(system_clipboard, promise); + NOTREACHED() << "Type " << mime_type << " was not implemented"; return nullptr; } @@ -197,9 +278,9 @@ if (is_raw) return type.length() < mojom::blink::RawClipboardHost::kMaxFormatSize; - // TODO(https://crbug.com/931839): Add support for text/html and other - // types. - return type == kMimeTypeImagePng || type == kMimeTypeTextPlain; + // TODO(https://crbug.com/1029857): Add support for other types. + return type == kMimeTypeImagePng || type == kMimeTypeTextPlain || + type == kMimeTypeTextHTML; } void ClipboardWriter::WriteToSystem(Blob* blob) { @@ -222,11 +303,7 @@ DCHECK(array_buffer); file_reader_.reset(); - worker_pool::PostTask( - FROM_HERE, CrossThreadBindOnce(&ClipboardWriter::DecodeOnBackgroundThread, - WrapCrossThreadPersistent(this), - clipboard_task_runner_, - WrapCrossThreadPersistent(array_buffer))); + StartWrite(clipboard_task_runner_, array_buffer); } void ClipboardWriter::DidFail(FileErrorCode error_code) {
diff --git a/third_party/blink/renderer/modules/clipboard/clipboard_writer.h b/third_party/blink/renderer/modules/clipboard/clipboard_writer.h index 527b063..9340afc7 100644 --- a/third_party/blink/renderer/modules/clipboard/clipboard_writer.h +++ b/third_party/blink/renderer/modules/clipboard/clipboard_writer.h
@@ -36,7 +36,10 @@ static ClipboardWriter* Create(RawSystemClipboard* raw_system_clipboard, const String& mime_type, ClipboardPromise* promise); - + static ClipboardWriter* Create(SystemClipboard* system_clipboard, + const String& mime_type, + ClipboardPromise* promise, + LocalFrame* frame); ~ClipboardWriter() override; static bool IsValidType(const String& type, bool is_raw); @@ -55,11 +58,15 @@ ClipboardWriter(RawSystemClipboard* raw_system_clipboard, ClipboardPromise* promise); + virtual void StartWrite( + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + DOMArrayBuffer* raw_data) = 0; virtual void DecodeOnBackgroundThread( scoped_refptr<base::SingleThreadTaskRunner> task_runner, DOMArrayBuffer* raw_data) = 0; // This ClipboardPromise owns this. Member<ClipboardPromise> promise_; + // Ensure that System Clipboard operations occur on the main thread. SEQUENCE_CHECKER(sequence_checker_);
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc b/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc index a998c076..36b0632 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc
@@ -364,6 +364,22 @@ exception_state); } +HeapVector<Member<IDBRequest>> IDBObjectStore::putAll( + ScriptState* script_state, + const HeapVector<ScriptValue>& values, + ExceptionState& exception_state) { + v8::Isolate* isolate = script_state->GetIsolate(); + const ScriptValue& v8_undefined = + ScriptValue(isolate, v8::Undefined(isolate)); + HeapVector<Member<IDBRequest>> requests; + for (const auto& value : values) { + IDBRequest* result = + put(script_state, value, v8_undefined, exception_state); + requests.push_back(*result); + } + return requests; +} + IDBRequest* IDBObjectStore::put(ScriptState* script_state, const ScriptValue& value, const ScriptValue& key,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_object_store.h b/third_party/blink/renderer/modules/indexeddb/idb_object_store.h index c14f53f..58353ab 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_object_store.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_object_store.h
@@ -102,6 +102,9 @@ const ScriptValue& key, ExceptionState&); IDBRequest* put(ScriptState*, const ScriptValue& value, ExceptionState&); + HeapVector<Member<IDBRequest>> putAll(ScriptState*, + const HeapVector<ScriptValue>& values, + ExceptionState&); IDBRequest* put(ScriptState*, const ScriptValue& value, const ScriptValue& key,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_object_store.idl b/third_party/blink/renderer/modules/indexeddb/idb_object_store.idl index c8b9a30..275241c 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_object_store.idl +++ b/third_party/blink/renderer/modules/indexeddb/idb_object_store.idl
@@ -37,6 +37,13 @@ [CallWith=ScriptState, MeasureAs=IndexedDBWrite, NewObject, RaisesException] IDBRequest put(any value, optional any key); + [ + CallWith=ScriptState, + MeasureAs=IndexedDBWrite, + RaisesException, + RuntimeEnabled=IDBPutAll + ] sequence<IDBRequest> putAll(sequence<any> values); + [CallWith=ScriptState, MeasureAs=IndexedDBWrite, NewObject, RaisesException] IDBRequest add(any value, optional any key);
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate_test.cc b/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate_test.cc index 536a78da..b8f19d31 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate_test.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate_test.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/web_test_support.h" +#include "ui/gfx/geometry/rect.h" using testing::_; using testing::AtLeast; @@ -325,12 +326,12 @@ ->is_auto_rotate_enabled_by_user_override_for_testing_ = enabled; } - WebRect ScreenRectFromAngle(uint16_t screen_orientation_angle) { + gfx::Rect ScreenRectFromAngle(uint16_t screen_orientation_angle) { uint16_t portrait_angle_mod_180 = natural_orientation_is_portrait_ ? 0 : 90; bool screen_rect_is_portrait = screen_orientation_angle % 180 == portrait_angle_mod_180; - return screen_rect_is_portrait ? IntRect(0, 0, 1080, 1920) - : IntRect(0, 0, 1920, 1080); + return screen_rect_is_portrait ? gfx::Rect(0, 0, 1080, 1920) + : gfx::Rect(0, 0, 1920, 1080); } void RotateDeviceTo(uint16_t new_device_orientation_angle) {
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_client_test.cc b/third_party/blink/renderer/modules/mediastream/user_media_client_test.cc index b522c91..534fb83 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_client_test.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_client_test.cc
@@ -478,8 +478,8 @@ public: WebScreenInfo GetScreenInfo(LocalFrame&) const override { WebScreenInfo info; - info.rect.width = blink::kDefaultScreenCastWidth; - info.rect.height = blink::kDefaultScreenCastHeight; + info.rect = gfx::Rect(blink::kDefaultScreenCastWidth, + blink::kDefaultScreenCastHeight); return info; } };
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc index 5cfaaa34..3299ed2 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc
@@ -1048,7 +1048,7 @@ if (frame_) { // Can be null in tests. blink::WebScreenInfo info = frame_->GetChromeClient().GetScreenInfo(*frame_); - screen_size = gfx::Size(info.rect.width, info.rect.height); + screen_size = info.rect.size(); } return screen_size; }
diff --git a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc index b235aaa2..d70c54f 100644 --- a/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc +++ b/third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.cc
@@ -4,6 +4,8 @@ #include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_proxy.h" +#include "base/feature_list.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/ice_transport_host.h" #include "third_party/blink/renderer/modules/peerconnection/adapters/web_rtc_cross_thread_copier.h" @@ -24,8 +26,13 @@ delegate_(delegate), feature_handle_for_scheduler_(frame.GetFrameScheduler()->RegisterFeature( SchedulingPolicy::Feature::kWebRTC, - {SchedulingPolicy::DisableAggressiveThrottling(), - SchedulingPolicy::RecordMetricsForBackForwardCache()})) { + base::FeatureList::IsEnabled(features::kOptOutWebRTCFromAllThrottling) + ? SchedulingPolicy{SchedulingPolicy::DisableAllThrottling(), + SchedulingPolicy:: + RecordMetricsForBackForwardCache()} + : SchedulingPolicy{ + SchedulingPolicy::DisableAggressiveThrottling(), + SchedulingPolicy::RecordMetricsForBackForwardCache()})) { DCHECK(host_thread_); DCHECK(delegate_); DCHECK(adapter_factory);
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc index 8a23372..6b8552b 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -810,8 +810,13 @@ feature_handle_for_scheduler_ = window->GetFrame()->GetFrameScheduler()->RegisterFeature( SchedulingPolicy::Feature::kWebRTC, - {SchedulingPolicy::DisableAggressiveThrottling(), - SchedulingPolicy::RecordMetricsForBackForwardCache()}); + base::FeatureList::IsEnabled(features::kOptOutWebRTCFromAllThrottling) + ? SchedulingPolicy{SchedulingPolicy::DisableAllThrottling(), + SchedulingPolicy:: + RecordMetricsForBackForwardCache()} + : SchedulingPolicy{ + SchedulingPolicy::DisableAggressiveThrottling(), + SchedulingPolicy::RecordMetricsForBackForwardCache()}); } RTCPeerConnection::~RTCPeerConnection() {
diff --git a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.cc b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.cc index a0944f2f..09eabe7 100644 --- a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.cc +++ b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.cc
@@ -58,7 +58,7 @@ // Compute the screen orientation using the orientation angle and the screen // width / height. WebScreenOrientationType ScreenOrientationController::ComputeOrientation( - const IntRect& rect, + const gfx::Rect& rect, uint16_t rotation) { // Bypass orientation detection in web tests to get consistent results. // FIXME: The screen dimension should be fixed when running the web tests @@ -66,8 +66,8 @@ if (WebTestSupport::IsRunningWebTest()) return kWebScreenOrientationPortraitPrimary; - bool is_tall_display = rotation % 180 ? rect.Height() < rect.Width() - : rect.Height() > rect.Width(); + bool is_tall_display = rotation % 180 ? rect.height() < rect.width() + : rect.height() > rect.width(); // https://w3c.github.io/screen-orientation/#dfn-current-orientation-angle // allows the UA to associate *-primary and *-secondary values at will. Blink
diff --git a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h index 20604b2..e54a0f5 100644 --- a/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h +++ b/third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h
@@ -16,6 +16,7 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/screen_orientation/web_lock_orientation_callback.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_remote.h" +#include "ui/gfx/geometry/rect.h" namespace blink { @@ -55,7 +56,8 @@ friend class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest; friend class ScreenOrientationControllerTest; - static WebScreenOrientationType ComputeOrientation(const IntRect&, uint16_t); + static WebScreenOrientationType ComputeOrientation(const gfx::Rect&, + uint16_t); // Inherited from ExecutionContextLifecycleObserver and // PageVisibilityObserver.
diff --git a/third_party/blink/renderer/platform/exported/web_screen_info_test.cc b/third_party/blink/renderer/platform/exported/web_screen_info_test.cc index 1fa38b01..b694f3e 100644 --- a/third_party/blink/renderer/platform/exported/web_screen_info_test.cc +++ b/third_party/blink/renderer/platform/exported/web_screen_info_test.cc
@@ -35,8 +35,8 @@ screen_info1.depth = 1; screen_info1.depth_per_component = 1; screen_info1.is_monochrome = false; - screen_info1.rect = WebRect(0, 0, 1024, 1024); - screen_info1.available_rect = WebRect(0, 0, 1024, 1024); + screen_info1.rect = gfx::Rect(1024, 1024); + screen_info1.available_rect = gfx::Rect(1024, 1024); screen_info1.orientation_type = blink::kWebScreenOrientationLandscapePrimary; screen_info1.orientation_angle = 90; @@ -46,8 +46,8 @@ screen_info2.depth = 1; screen_info2.depth_per_component = 1; screen_info2.is_monochrome = false; - screen_info2.rect = WebRect(0, 0, 1024, 1024); - screen_info2.available_rect = WebRect(0, 0, 1024, 1024); + screen_info2.rect = gfx::Rect(1024, 1024); + screen_info2.available_rect = gfx::Rect(1024, 1024); screen_info2.orientation_type = blink::kWebScreenOrientationLandscapePrimary; screen_info2.orientation_angle = 90;
diff --git a/third_party/blink/renderer/platform/graphics/OWNERS b/third_party/blink/renderer/platform/graphics/OWNERS index 0bb32866..4bc6f6e 100644 --- a/third_party/blink/renderer/platform/graphics/OWNERS +++ b/third_party/blink/renderer/platform/graphics/OWNERS
@@ -12,7 +12,6 @@ vollick@chromium.org # For surface ID propagation and synchronization -samans@chromium.org jonross@chromium.org # lowLatency canvas
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc index 4cba6b8..fc04b2ff 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator.cc
@@ -170,7 +170,21 @@ return; } - if (IsFullPaintInvalidationReason(reason)) { + if (!IsFullPaintInvalidationReason(reason) && + old_visual_rect->Location() != new_visual_rect->Location()) + reason = PaintInvalidationReason::kGeometry; + + if (IsFullPaintInvalidationReason(reason) || + old_visual_rect->Location() != new_visual_rect->Location()) { + // Change of selection can cause change of location of visual rect. For now + // simply do full invalidation. This will change when we can calculate + // visual rect for the selection display item and kSelection is no longer + // a partial invalidation reason. + DCHECK(IsFullPaintInvalidationReason(reason) || + reason == PaintInvalidationReason::kSelection); + // This DCHECK will remind us to change this code when we change how we + // invalidate selections. + DCHECK(!IsFullPaintInvalidationReason(PaintInvalidationReason::kSelection)); GenerateFullRasterInvalidation(client, *old_visual_rect, *new_visual_rect, reason); return;
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 2ce4e029..b100eda 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -863,6 +863,10 @@ status: "experimental", }, { + name: "IDBPutAll", + status: "experimental", + }, + { name: "IDBRelaxedDurability", status: "stable", },
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc index 774772a..5583a10 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc
@@ -155,7 +155,13 @@ this, &tracing_controller_, YesNoStateToString), - aggressive_throttling_opt_out_count(0), + all_throttling_opt_out_count_(0), + aggressive_throttling_opt_out_count_(0), + opted_out_from_all_throttling_(false, + "FrameScheduler.AllThrottlingDisabled", + this, + &tracing_controller_, + YesNoStateToString), opted_out_from_aggressive_throttling_( false, "FrameScheduler.AggressiveThrottlingDisabled", @@ -236,8 +242,10 @@ if (parent_page_scheduler_) { parent_page_scheduler_->Unregister(this); - if (opted_out_from_aggressive_throttling()) - parent_page_scheduler_->OnAggressiveThrottlingStatusUpdated(); + if (opted_out_from_all_throttling() || + opted_out_from_aggressive_throttling()) { + parent_page_scheduler_->OnThrottlingStatusUpdated(); + } } // Can be null in tests. @@ -636,6 +644,8 @@ const SchedulingPolicy& policy) { uint64_t old_mask = GetActiveFeaturesTrackedForBackForwardCacheMetricsMask(); + if (policy.disable_all_throttling) + OnAddedAllThrottlingOptOut(); if (policy.disable_aggressive_throttling) OnAddedAggressiveThrottlingOptOut(); if (policy.disable_back_forward_cache) { @@ -659,6 +669,8 @@ const SchedulingPolicy& policy) { uint64_t old_mask = GetActiveFeaturesTrackedForBackForwardCacheMetricsMask(); + if (policy.disable_all_throttling) + OnRemovedAllThrottlingOptOut(); if (policy.disable_aggressive_throttling) OnRemovedAggressiveThrottlingOptOut(); if (policy.disable_back_forward_cache) @@ -705,21 +717,38 @@ return weak_factory_.GetWeakPtr(); } -void FrameSchedulerImpl::OnAddedAggressiveThrottlingOptOut() { - ++aggressive_throttling_opt_out_count; - opted_out_from_aggressive_throttling_ = - static_cast<bool>(aggressive_throttling_opt_out_count); +void FrameSchedulerImpl::OnAddedAllThrottlingOptOut() { + ++all_throttling_opt_out_count_; + opted_out_from_all_throttling_ = + static_cast<bool>(all_throttling_opt_out_count_); if (parent_page_scheduler_) - parent_page_scheduler_->OnAggressiveThrottlingStatusUpdated(); + parent_page_scheduler_->OnThrottlingStatusUpdated(); +} + +void FrameSchedulerImpl::OnRemovedAllThrottlingOptOut() { + DCHECK_GT(all_throttling_opt_out_count_, 0); + --all_throttling_opt_out_count_; + opted_out_from_all_throttling_ = + static_cast<bool>(all_throttling_opt_out_count_); + if (parent_page_scheduler_) + parent_page_scheduler_->OnThrottlingStatusUpdated(); +} + +void FrameSchedulerImpl::OnAddedAggressiveThrottlingOptOut() { + ++aggressive_throttling_opt_out_count_; + opted_out_from_aggressive_throttling_ = + static_cast<bool>(aggressive_throttling_opt_out_count_); + if (parent_page_scheduler_) + parent_page_scheduler_->OnThrottlingStatusUpdated(); } void FrameSchedulerImpl::OnRemovedAggressiveThrottlingOptOut() { - DCHECK_GT(aggressive_throttling_opt_out_count, 0); - --aggressive_throttling_opt_out_count; + DCHECK_GT(aggressive_throttling_opt_out_count_, 0); + --aggressive_throttling_opt_out_count_; opted_out_from_aggressive_throttling_ = - static_cast<bool>(aggressive_throttling_opt_out_count); + static_cast<bool>(aggressive_throttling_opt_out_count_); if (parent_page_scheduler_) - parent_page_scheduler_->OnAggressiveThrottlingStatusUpdated(); + parent_page_scheduler_->OnThrottlingStatusUpdated(); } void FrameSchedulerImpl::OnAddedBackForwardCacheOptOut( @@ -780,11 +809,6 @@ : true; } -bool FrameSchedulerImpl::IsAudioPlaying() const { - return parent_page_scheduler_ ? parent_page_scheduler_->IsAudioPlaying() - : false; -} - void FrameSchedulerImpl::SetPaused(bool frame_paused) { DCHECK(parent_page_scheduler_); if (frame_paused_ == frame_paused) @@ -928,6 +952,8 @@ return false; if (parent_page_scheduler_->IsAudioPlaying()) return false; + if (parent_page_scheduler_->OptedOutFromAllThrottling()) + return false; if (!parent_page_scheduler_->IsPageVisible()) return true; return RuntimeEnabledFeatures::TimerThrottlingForHiddenFramesEnabled() &&
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h index 7d31142c..e5837715 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h
@@ -87,7 +87,6 @@ bool IsFrameVisible() const override; bool IsPageVisible() const override; - bool IsAudioPlaying() const; void SetPaused(bool frame_paused) override; void SetShouldReportPostedTasksWhenDisabled(bool should_report) override; @@ -141,8 +140,15 @@ void UpdatePolicy(); + // Whether the frame is opted-out from any kind of throttling. + bool opted_out_from_all_throttling() const { + return opted_out_from_all_throttling_; + } + // Whether the frame is opted-out from CPU time throttling and intensive wake + // up throttling. bool opted_out_from_aggressive_throttling() const { - return opted_out_from_aggressive_throttling_; + return opted_out_from_all_throttling_ || + opted_out_from_aggressive_throttling_; } void OnTraceLogEnabled() { tracing_controller_.OnTraceLogEnabled(); } @@ -249,6 +255,9 @@ void AddPauseSubresourceLoadingHandle(); void RemovePauseSubresourceLoadingHandle(); + void OnAddedAllThrottlingOptOut(); + void OnRemovedAllThrottlingOptOut(); + void OnAddedAggressiveThrottlingOptOut(); void OnRemovedAggressiveThrottlingOptOut(); @@ -324,9 +333,11 @@ TraceableState<bool, TracingCategoryName::kInfo> task_queues_throttled_; TraceableState<bool, TracingCategoryName::kInfo> preempted_for_cooperative_scheduling_; - // TODO(kraynov): https://crbug.com/827113 - // Trace the count of aggressive throttling opt outs. - int aggressive_throttling_opt_out_count; + // TODO(https://crbug.com/827113): Trace the count of opt-outs. + int all_throttling_opt_out_count_; + int aggressive_throttling_opt_out_count_; + TraceableState<bool, TracingCategoryName::kInfo> + opted_out_from_all_throttling_; TraceableState<bool, TracingCategoryName::kInfo> opted_out_from_aggressive_throttling_; size_t subresource_loading_pause_count_;
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc index 188eeb1..5de0ff8 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc
@@ -31,6 +31,7 @@ #include "third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/resource_loading_task_runner_handle_impl.h" #include "third_party/blink/renderer/platform/scheduler/main_thread/task_type_names.h" +#include "third_party/blink/renderer/platform/scheduler/public/frame_or_worker_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/web_scheduling_priority.h" #include "third_party/blink/renderer/platform/scheduler/public/web_scheduling_task_queue.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" @@ -45,11 +46,14 @@ using FeatureHandle = FrameOrWorkerScheduler::SchedulingAffectingFeatureHandle; using PrioritisationType = MainThreadTaskQueue::QueueTraits::PrioritisationType; - using testing::Return; namespace { +constexpr base::TimeDelta kDefaultThrottledWakeUpInterval = + PageSchedulerImpl::kDefaultThrottledWakeUpInterval; +constexpr base::TimeDelta kShortDelay = base::TimeDelta::FromMilliseconds(10); + // This is a wrapper around MainThreadSchedulerImpl::CreatePageScheduler, that // returns the PageScheduler as a PageSchedulerImpl. std::unique_ptr<PageSchedulerImpl> CreatePageScheduler( @@ -76,6 +80,10 @@ return frame_scheduler_impl; } +void RecordRunTime(std::vector<base::TimeTicks>* run_times) { + run_times->push_back(base::TimeTicks::Now()); +} + } // namespace // All TaskTypes that can be passed to @@ -494,10 +502,9 @@ } const int kNumTasks = 5; - const base::TimeDelta kShortDelay = base::TimeDelta::FromSeconds(1); const base::TimeDelta kGracePeriod = GetIntensiveWakeUpThrottlingGracePeriod(); - const base::TimeDelta kDurationBetweenWakeUps = + const base::TimeDelta kIntensiveThrottlingDurationBetweenWakeUps = GetIntensiveWakeUpThrottlingDurationBetweenWakeUps(); }; @@ -707,7 +714,7 @@ } // namespace -// Verify that tasks in a throttled task queue run at the expected time, when +// Verify that tasks in a throttled task queue cause 1 wake up per second, when // intensive wake up throttling is disabled. Disable the kStopInBackground // feature because it hides the effect of intensive wake up throttling. TEST_F(FrameSchedulerImplStopInBackgroundDisabledTest, ThrottledTaskExecution) { @@ -716,10 +723,6 @@ // throttling is disabled by default. constexpr int kNumTasks = base::TimeDelta::FromMinutes(10) / base::TimeDelta::FromSeconds(1); - // Tasks are posted with a delay shorter than the default throttled wake up - // period, to allow verifying that the default throttled wake up period is - // correctly enforced. - constexpr base::TimeDelta kShortDelay = base::TimeDelta::FromMilliseconds(10); // This TaskRunner is throttled. const scoped_refptr<base::SingleThreadTaskRunner> task_runner = frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); @@ -744,6 +747,103 @@ } } +// Verify that tasks in a throttled task queue are not throttled when there is +// an active opt-out. +TEST_F(FrameSchedulerImplStopInBackgroundDisabledTest, NoThrottlingWithOptOut) { + constexpr int kNumTasks = 3; + // |task_runner| is throttled. + const scoped_refptr<base::SingleThreadTaskRunner> task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + // |other_task_runner| is throttled. It belongs to a different frame on the + // same page. + const auto other_frame_scheduler = CreateFrameScheduler( + page_scheduler_.get(), frame_scheduler_delegate_.get(), nullptr, + FrameScheduler::FrameType::kSubframe); + const scoped_refptr<base::SingleThreadTaskRunner> other_task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + + // Fast-forward the time to a multiple of |kDefaultThrottledWakeUpInterval|. + // Otherwise, the time at which tasks run will vary. + FastForwardToAlignedTime(kDefaultThrottledWakeUpInterval); + + // Hide the page. This enables wake up throttling. + EXPECT_TRUE(page_scheduler_->IsPageVisible()); + page_scheduler_->SetPageVisible(false); + + { + // Wake ups are throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval)); + } + + { + // Create an opt-out. + auto handle = frame_scheduler_->RegisterFeature( + SchedulingPolicy::Feature::kWebRTC, + {SchedulingPolicy::DisableAllThrottling()}); + + { + // A task should run every |kShortDelay|, since there is an opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, + testing::ElementsAre(scope_start + kShortDelay * 1, + scope_start + kShortDelay * 2, + scope_start + kShortDelay * 3)); + } + + { + // Same thing for another frame on the same page. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + other_task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, + testing::ElementsAre(scope_start + kShortDelay * 1, + scope_start + kShortDelay * 2, + scope_start + kShortDelay * 3)); + } + } + + FastForwardToAlignedTime(kDefaultThrottledWakeUpInterval); + + { + // Wake ups are throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval)); + } +} + TEST_F(FrameSchedulerImplTest, FreezeForegroundOnlyTasks) { int counter = 0; ForegroundOnlyTaskQueue()->task_runner()->PostTask( @@ -2480,12 +2580,6 @@ testing::ElementsAre("V1", "V2", "B1", "B2", "U1", "U2")); } -namespace { -void RecordRunTime(std::vector<base::TimeTicks>* run_times) { - run_times->push_back(base::TimeTicks::Now()); -} -} // namespace - // Verify that tasks posted with TaskType::kJavascriptTimer run at the expected // time when throttled. TEST_F(FrameSchedulerImplTest, ThrottledJSTimerTasksRunTime) { @@ -2598,9 +2692,10 @@ const scoped_refptr<base::SingleThreadTaskRunner> task_runner = frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); - // Snap the time to a multiple of |kDurationBetweenWakeUps|. Otherwise, - // the time at which tasks can run after throttling is enabled will vary. - FastForwardToAlignedTime(kDurationBetweenWakeUps); + // Snap the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, the time at which + // tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); const base::TimeTicks test_start = base::TimeTicks::Now(); // Hide the page. This starts the delay to throttle background wake ups. @@ -2616,7 +2711,7 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask(FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - i * kShortDelay); + i * kDefaultThrottledWakeUpInterval); } task_environment_.FastForwardBy(kGracePeriod); @@ -2628,25 +2723,28 @@ scope_start + base::TimeDelta::FromSeconds(4))); } - // After |kGracePeriod|, a wake up can occur |kDurationBetweenWakeUps| after - // the last wake up, or at a time aligned on |kDurationBetweenWakeUps|. + // After |kGracePeriod|, a wake up can occur + // |kIntensiveThrottlingDurationBetweenWakeUps| after the last wake up, or at + // a time aligned on |kIntensiveThrottlingDurationBetweenWakeUps|. - // Test waking up |kDurationBetweenWakeUps| after the last + // Test waking up |kIntensiveThrottlingDurationBetweenWakeUps| after the last // wake up. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(5)); std::vector<base::TimeTicks> run_times; - task_runner->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kShortDelay); + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval); - task_environment_.FastForwardBy(kShortDelay); + task_environment_.FastForwardBy(kDefaultThrottledWakeUpInterval); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromSeconds(1))); } - // Test waking up at a time aligned on ||kDurationBetweenWakeUps|. + // Test waking up at a time aligned on + // ||kIntensiveThrottlingDurationBetweenWakeUps|. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(5) + @@ -2656,11 +2754,11 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask(FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - (i + 1) * kShortDelay); + (i + 1) * kDefaultThrottledWakeUpInterval); } // // All tasks should run at the next aligned time. - FastForwardToAlignedTime(kDurationBetweenWakeUps); + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromSeconds(59), scope_start + base::TimeDelta::FromSeconds(59), @@ -2670,30 +2768,33 @@ } // Post an extra task with a short delay. It should run at the next time - // aligned on |kDurationBetweenWakeUps|. + // aligned on |kIntensiveThrottlingDurationBetweenWakeUps|. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(6)); std::vector<base::TimeTicks> run_times; - task_runner->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kShortDelay); + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval); - task_environment_.FastForwardBy(kDurationBetweenWakeUps); + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromMinutes(1))); } // Post an extra task with a delay that is longer than - // |kDurationBetweenWakeUps|. The task should run at its - // desired run time, even if it's not aligned on |kDurationBetweenWakeUps|. + // |kIntensiveThrottlingDurationBetweenWakeUps|. The task should run at its + // desired run time, even if it's not aligned on + // |kIntensiveThrottlingDurationBetweenWakeUps|. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(7)); std::vector<base::TimeTicks> run_times; const base::TimeDelta kLongDelay = - kDurationBetweenWakeUps * 5 + kShortDelay; + kIntensiveThrottlingDurationBetweenWakeUps * 5 + + kDefaultThrottledWakeUpInterval; task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kLongDelay); @@ -2706,8 +2807,8 @@ // After that, intensive throttling is applied again. { const base::TimeTicks scope_start = base::TimeTicks::Now(); - EXPECT_EQ(scope_start, - test_start + base::TimeDelta::FromMinutes(12) + kShortDelay); + EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(12) + + kDefaultThrottledWakeUpInterval); std::vector<base::TimeTicks> run_times; page_scheduler_->OnTitleOrFaviconUpdated(); @@ -2717,22 +2818,23 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - kShortDelay * (i + 1)); + kDefaultThrottledWakeUpInterval * (i + 1)); } page_scheduler_->OnTitleOrFaviconUpdated(); }), - kShortDelay); + kDefaultThrottledWakeUpInterval); task_environment_.FastForwardUntilNoTasksRemain(); - EXPECT_THAT( - run_times, - testing::ElementsAre( - scope_start + base::TimeDelta::FromSeconds(1), - scope_start + base::TimeDelta::FromSeconds(2), - scope_start + base::TimeDelta::FromSeconds(3), - scope_start - kShortDelay + base::TimeDelta::FromMinutes(1), - scope_start - kShortDelay + base::TimeDelta::FromMinutes(1), - scope_start - kShortDelay + base::TimeDelta::FromMinutes(1))); + EXPECT_THAT(run_times, testing::ElementsAre( + scope_start + base::TimeDelta::FromSeconds(1), + scope_start + base::TimeDelta::FromSeconds(2), + scope_start + base::TimeDelta::FromSeconds(3), + scope_start - kDefaultThrottledWakeUpInterval + + base::TimeDelta::FromMinutes(1), + scope_start - kDefaultThrottledWakeUpInterval + + base::TimeDelta::FromMinutes(1), + scope_start - kDefaultThrottledWakeUpInterval + + base::TimeDelta::FromMinutes(1))); } } @@ -2746,9 +2848,10 @@ const scoped_refptr<base::SingleThreadTaskRunner> task_runner = frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); - // Snap the time to a multiple of |kDurationBetweenWakeUps|. Otherwise, - // the time at which tasks can run after throttling is enabled will vary. - FastForwardToAlignedTime(kDurationBetweenWakeUps); + // Snap the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, the time at which + // tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); const base::TimeTicks test_start = base::TimeTicks::Now(); // Hide the page. This starts the delay to throttle background wake ups. @@ -2764,7 +2867,7 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask(FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - i * kShortDelay); + i * kDefaultThrottledWakeUpInterval); } task_environment_.FastForwardBy(kGracePeriod); @@ -2777,26 +2880,27 @@ } // After |kGracePeriod|, a wake up can occur aligned on - // |kDurationBetweenWakeUps| only. + // |kIntensiveThrottlingDurationBetweenWakeUps| only. // Test posting a first task. It should run at the next aligned time (in a - // main frame, it would have run kDurationBetweenWakeUps + // main frame, it would have run kIntensiveThrottlingDurationBetweenWakeUps // after the last wake up). { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(5)); std::vector<base::TimeTicks> run_times; - task_runner->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kShortDelay); + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval); - task_environment_.FastForwardBy(kDurationBetweenWakeUps); + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromMinutes(1))); } // Test posting many tasks with short delays. They should all run on the next - // time aligned on |kDurationBetweenWakeUps|. + // time aligned on |kIntensiveThrottlingDurationBetweenWakeUps|. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(6)); @@ -2805,10 +2909,10 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask(FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - (i + 1) * kShortDelay); + (i + 1) * kDefaultThrottledWakeUpInterval); } - task_environment_.FastForwardBy(kDurationBetweenWakeUps); + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromMinutes(1), scope_start + base::TimeDelta::FromMinutes(1), @@ -2818,36 +2922,40 @@ } // Post an extra task with a short delay. It should run at the next time - // aligned on |kDurationBetweenWakeUps|. + // aligned on |kIntensiveThrottlingDurationBetweenWakeUps|. { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(7)); std::vector<base::TimeTicks> run_times; - task_runner->PostDelayedTask( - FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kShortDelay); + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval); - task_environment_.FastForwardBy(kDurationBetweenWakeUps); + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_THAT(run_times, testing::ElementsAre( scope_start + base::TimeDelta::FromMinutes(1))); } // Post an extra task with a delay that is longer than - // |kDurationBetweenWakeUps|. The task should run at an aligned time (in a - // main frame, it would have run at is desired unaligned run time). + // |kIntensiveThrottlingDurationBetweenWakeUps|. The task should run at an + // aligned time (in a main frame, it would have run at is desired unaligned + // run time). { const base::TimeTicks scope_start = base::TimeTicks::Now(); EXPECT_EQ(scope_start, test_start + base::TimeDelta::FromMinutes(8)); std::vector<base::TimeTicks> run_times; const base::TimeDelta kLongDelay = - kDurationBetweenWakeUps * 5 + base::TimeDelta::FromSeconds(1); + kIntensiveThrottlingDurationBetweenWakeUps * 5 + + base::TimeDelta::FromSeconds(1); task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), kLongDelay); task_environment_.FastForwardUntilNoTasksRemain(); - EXPECT_THAT(run_times, testing::ElementsAre(scope_start + - kDurationBetweenWakeUps * 6)); + EXPECT_THAT(run_times, testing::ElementsAre( + scope_start + + kIntensiveThrottlingDurationBetweenWakeUps * 6)); } // Post tasks with short delays after the page communicated with the user in @@ -2865,11 +2973,11 @@ for (int i = 0; i < kNumTasks; ++i) { task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), - kShortDelay * (i + 1)); + kDefaultThrottledWakeUpInterval * (i + 1)); } page_scheduler_->OnTitleOrFaviconUpdated(); }), - kShortDelay); + kDefaultThrottledWakeUpInterval); task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_THAT(run_times, testing::ElementsAre( @@ -2900,9 +3008,10 @@ const scoped_refptr<base::SingleThreadTaskRunner> other_task_runner = other_frame_scheduler->GetTaskRunner(TaskType::kJavascriptTimer); - // Snap the time to a multiple of |kDurationBetweenWakeUps|. Otherwise, - // the time at which tasks can run after throttling is enabled will vary. - FastForwardToAlignedTime(kDurationBetweenWakeUps); + // Snap the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, the time at which + // tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); // Hide the page and wait until the intensive throttling grace period has // elapsed. @@ -2914,31 +3023,285 @@ int counter = 0; task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&IncrementCounter, base::Unretained(&counter)), - kShortDelay); + kDefaultThrottledWakeUpInterval); int other_counter = 0; other_task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&IncrementCounter, base::Unretained(&other_counter)), - 2 * kShortDelay); + 2 * kDefaultThrottledWakeUpInterval); // The first task should run at an unaligned time, because no wake up occurred - // in the last |kDurationBetweenWakeUps|. + // in the last |kIntensiveThrottlingDurationBetweenWakeUps|. EXPECT_EQ(0, counter); - task_environment_.FastForwardBy(kShortDelay); + task_environment_.FastForwardBy(kDefaultThrottledWakeUpInterval); EXPECT_EQ(1, counter); // The second task must run at an aligned time. constexpr base::TimeDelta kEpsilon = base::TimeDelta::FromMicroseconds(1); EXPECT_EQ(0, other_counter); - task_environment_.FastForwardBy(kShortDelay); + task_environment_.FastForwardBy(kDefaultThrottledWakeUpInterval); EXPECT_EQ(0, other_counter); - task_environment_.FastForwardBy(kDurationBetweenWakeUps - 2 * kShortDelay - + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps - + 2 * kDefaultThrottledWakeUpInterval - kEpsilon); EXPECT_EQ(0, other_counter); task_environment_.FastForwardBy(kEpsilon); EXPECT_EQ(1, other_counter); } +// Verify that intensive throttling is disabled when there is an opt-out for all +// throttling. +TEST_F(FrameSchedulerImplTestWithIntensiveWakeUpThrottling, ThrottlingOptOut) { + constexpr int kNumTasks = 3; + // |task_runner| is throttled. + const scoped_refptr<base::SingleThreadTaskRunner> task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + // |other_task_runner| is throttled. It belongs to a different frame on the + // same page. + const auto other_frame_scheduler = CreateFrameScheduler( + page_scheduler_.get(), frame_scheduler_delegate_.get(), nullptr, + FrameScheduler::FrameType::kSubframe); + const scoped_refptr<base::SingleThreadTaskRunner> other_task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + + // Fast-forward the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, + // the time at which tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); + + // Hide the page and wait until the intensive throttling grace period has + // elapsed. + EXPECT_TRUE(page_scheduler_->IsPageVisible()); + page_scheduler_->SetPageVisible(false); + task_environment_.FastForwardBy(kGracePeriod); + + { + // Wake ups are intensively throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + // Note: Intensive throttling does not apply when there hasn't been a wake + // up in the last |kIntensiveThrottlingDurationBetweenWakeUps|. + EXPECT_THAT(run_times, + testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps)); + } + + { + // Create an opt-out. + auto handle = frame_scheduler_->RegisterFeature( + SchedulingPolicy::Feature::kWebRTC, + {SchedulingPolicy::DisableAllThrottling()}); + + { + // A task should run every |kShortDelay|, since there is an opt-out for + // all types of throttling. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, + testing::ElementsAre(scope_start + kShortDelay * 1, + scope_start + kShortDelay * 2, + scope_start + kShortDelay * 3)); + } + + { + // Same thing for another frame on the same page. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + other_task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT(run_times, + testing::ElementsAre(scope_start + kShortDelay * 1, + scope_start + kShortDelay * 2, + scope_start + kShortDelay * 3)); + } + } + + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); + + { + // Wake ups are intensively throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + // Note: Intensive throttling does not apply when there hasn't been a wake + // up in the last |kIntensiveThrottlingDurationBetweenWakeUps|. + EXPECT_THAT(run_times, + testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps)); + } +} + +// Verify that intensive throttling is disabled when there is an opt-out for +// aggressive throttling. +TEST_F(FrameSchedulerImplTestWithIntensiveWakeUpThrottling, + AggressiveThrottlingOptOut) { + constexpr int kNumTasks = 3; + // |task_runner| is throttled. + const scoped_refptr<base::SingleThreadTaskRunner> task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + // |other_task_runner| is throttled. It belongs to a different frame on the + // same page. + const auto other_frame_scheduler = CreateFrameScheduler( + page_scheduler_.get(), frame_scheduler_delegate_.get(), nullptr, + FrameScheduler::FrameType::kSubframe); + const scoped_refptr<base::SingleThreadTaskRunner> other_task_runner = + frame_scheduler_->GetTaskRunner(TaskType::kJavascriptTimer); + + // Fast-forward the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, + // the time at which tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); + + // Hide the page and wait until the intensive throttling grace period has + // elapsed. + EXPECT_TRUE(page_scheduler_->IsPageVisible()); + page_scheduler_->SetPageVisible(false); + task_environment_.FastForwardBy(kGracePeriod); + + { + // Wake ups are intensively throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + // Note: Intensive throttling does not apply when there hasn't been a wake + // up in the last |kIntensiveThrottlingDurationBetweenWakeUps|. + EXPECT_THAT(run_times, + testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps)); + } + + { + // Create an opt-out. + auto handle = frame_scheduler_->RegisterFeature( + SchedulingPolicy::Feature::kWebRTC, + {SchedulingPolicy::DisableAggressiveThrottling()}); + + { + // Tasks should run after |kDefaultThrottledWakeUpInterval|, since + // aggressive throttling is disabled, but default wake up throttling + // remains enabled. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT( + run_times, + testing::ElementsAre(scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval)); + } + + { + // Same thing for another frame on the same page. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + other_task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + EXPECT_THAT( + run_times, + testing::ElementsAre(scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval)); + } + } + + // Fast-forward so that there is no recent wake up. Then, align the time on + // |kIntensiveThrottlingDurationBetweenWakeUps| to simplify expectations. + task_environment_.FastForwardBy(kIntensiveThrottlingDurationBetweenWakeUps); + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); + + { + // Wake ups are intensively throttled, since there is no throttling opt-out. + const base::TimeTicks scope_start = base::TimeTicks::Now(); + std::vector<base::TimeTicks> run_times; + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask(FROM_HERE, + base::BindOnce(&RecordRunTime, &run_times), + i * kShortDelay); + } + for (int i = 1; i < kNumTasks + 1; ++i) { + task_runner->PostDelayedTask( + FROM_HERE, base::BindOnce(&RecordRunTime, &run_times), + kDefaultThrottledWakeUpInterval + i * kShortDelay); + } + task_environment_.FastForwardUntilNoTasksRemain(); + // Note: Intensive throttling does not apply when there hasn't been a wake + // up in the last |kIntensiveThrottlingDurationBetweenWakeUps|. + EXPECT_THAT(run_times, + testing::ElementsAre( + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kDefaultThrottledWakeUpInterval, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps, + scope_start + kIntensiveThrottlingDurationBetweenWakeUps)); + } +} + // Verify that tasks run at the same time when a frame switches between being // same-origin and cross-origin with the main frame. TEST_F(FrameSchedulerImplTestWithIntensiveWakeUpThrottling, @@ -2957,9 +3320,10 @@ const scoped_refptr<base::SingleThreadTaskRunner> cross_origin_task_runner = cross_origin_frame_scheduler->GetTaskRunner(TaskType::kJavascriptTimer); - // Snap the time to a multiple of |kDurationBetweenWakeUps|. Otherwise, - // the time at which tasks can run after throttling is enabled will vary. - FastForwardToAlignedTime(kDurationBetweenWakeUps); + // Snap the time to a multiple of + // |kIntensiveThrottlingDurationBetweenWakeUps|. Otherwise, the time at which + // tasks can run after throttling is enabled will vary. + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); // Hide the page and wait until the intensive throttling grace period has // elapsed. @@ -2970,28 +3334,28 @@ { // Post delayed tasks with short delays to both frames. The // main-frame-origin task can run at the desired time, because no wake up - // occurred in the last |kDurationBetweenWakeUps|. The + // occurred in the last |kIntensiveThrottlingDurationBetweenWakeUps|. The // cross-origin task must run at an aligned time. int counter = 0; task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&IncrementCounter, base::Unretained(&counter)), - kShortDelay); + kDefaultThrottledWakeUpInterval); int cross_origin_counter = 0; cross_origin_task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&IncrementCounter, base::Unretained(&cross_origin_counter)), - kShortDelay); + kDefaultThrottledWakeUpInterval); // Make the |frame_scheduler_| cross-origin. Its task must now run at an // aligned time. frame_scheduler_->SetCrossOriginToMainFrame(true); - task_environment_.FastForwardBy(kShortDelay); + task_environment_.FastForwardBy(kDefaultThrottledWakeUpInterval); EXPECT_EQ(0, counter); EXPECT_EQ(0, cross_origin_counter); - FastForwardToAlignedTime(kDurationBetweenWakeUps); + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_EQ(1, counter); EXPECT_EQ(1, cross_origin_counter); } @@ -3000,7 +3364,8 @@ // Post delayed tasks with long delays that aren't aligned with the wake up // interval. They should run at aligned times, since they are cross-origin. const base::TimeDelta kLongUnalignedDelay = - 5 * kDurationBetweenWakeUps + kShortDelay; + 5 * kIntensiveThrottlingDurationBetweenWakeUps + + kDefaultThrottledWakeUpInterval; int counter = 0; task_runner->PostDelayedTask( FROM_HERE, @@ -3020,7 +3385,7 @@ EXPECT_EQ(1, counter); EXPECT_EQ(0, cross_origin_counter); - FastForwardToAlignedTime(kDurationBetweenWakeUps); + FastForwardToAlignedTime(kIntensiveThrottlingDurationBetweenWakeUps); EXPECT_EQ(1, counter); EXPECT_EQ(1, cross_origin_counter); }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.cc b/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.cc index 1f43fc2..aa4cb19f 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.cc
@@ -64,10 +64,6 @@ constexpr base::TimeDelta kDefaultDelayForBackgroundAndNetworkIdleTabFreezing = base::TimeDelta::FromMinutes(1); -// Interval between throttled wake ups, when intensive throttling is disabled. -constexpr base::TimeDelta kDefaultThrottledWakeUpInterval = - base::TimeDelta::FromSeconds(1); - // Duration of a throttled wake up. constexpr base::TimeDelta kThrottledWakeUpDuration = base::TimeDelta::FromMilliseconds(3); @@ -151,6 +147,8 @@ } // namespace +constexpr base::TimeDelta PageSchedulerImpl::kDefaultThrottledWakeUpInterval; + PageSchedulerImpl::PageSchedulerImpl( PageScheduler::Delegate* delegate, MainThreadSchedulerImpl* main_thread_scheduler) @@ -161,6 +159,7 @@ audio_state_(AudioState::kSilent), is_frozen_(false), reported_background_throttling_since_navigation_(false), + opted_out_from_all_throttling_(false), opted_out_from_aggressive_throttling_(false), nested_runloop_(false), is_main_frame_local_(false), @@ -471,6 +470,10 @@ return opted_out_from_aggressive_throttling_; } +bool PageSchedulerImpl::OptedOutFromAllThrottling() const { + return opted_out_from_all_throttling_; +} + bool PageSchedulerImpl::OptedOutFromAggressiveThrottlingForTest() const { return OptedOutFromAggressiveThrottling(); } @@ -502,21 +505,29 @@ return is_cpu_time_throttled_; } -void PageSchedulerImpl::OnAggressiveThrottlingStatusUpdated() { +void PageSchedulerImpl::OnThrottlingStatusUpdated() { + bool opted_out_from_all_throttling = false; bool opted_out_from_aggressive_throttling = false; for (FrameSchedulerImpl* frame_scheduler : frame_schedulers_) { + opted_out_from_all_throttling |= + frame_scheduler->opted_out_from_all_throttling(); opted_out_from_aggressive_throttling |= frame_scheduler->opted_out_from_aggressive_throttling(); } + DCHECK(!opted_out_from_all_throttling || + opted_out_from_aggressive_throttling); - if (opted_out_from_aggressive_throttling_ != - opted_out_from_aggressive_throttling) { + if (opted_out_from_all_throttling_ != opted_out_from_all_throttling || + opted_out_from_aggressive_throttling_ != + opted_out_from_aggressive_throttling) { + opted_out_from_all_throttling_ = opted_out_from_all_throttling; opted_out_from_aggressive_throttling_ = opted_out_from_aggressive_throttling; base::sequence_manager::LazyNow lazy_now( main_thread_scheduler_->tick_clock()); UpdateCPUTimeBudgetPool(&lazy_now); UpdateWakeUpBudgetPools(&lazy_now); + NotifyFrames(); } }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h b/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h index 3c036dd8..e3a3904 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h +++ b/third_party/blink/renderer/platform/scheduler/main_thread/page_scheduler_impl.h
@@ -48,6 +48,10 @@ class PLATFORM_EXPORT PageSchedulerImpl : public PageScheduler { public: + // Interval between throttled wake ups, when intensive throttling is disabled. + static constexpr base::TimeDelta kDefaultThrottledWakeUpInterval = + base::TimeDelta::FromSeconds(1); + PageSchedulerImpl(PageScheduler::Delegate*, MainThreadSchedulerImpl*); ~PageSchedulerImpl() override; @@ -90,8 +94,7 @@ bool IsPageVisible() const; bool IsFrozen() const; - // PageSchedulerImpl::OptedOutFromAggressiveThrottling can be used in non-test - // code, while PageScheduler::OptedOutFromAggressiveThrottlingForTest can't. + bool OptedOutFromAllThrottling() const; bool OptedOutFromAggressiveThrottling() const; // Returns whether CPU time is throttled for the page. Note: This is // independent from wake up rate throttling. @@ -109,7 +112,7 @@ void Unregister(FrameSchedulerImpl*); void OnNavigation(); - void OnAggressiveThrottlingStatusUpdated(); + void OnThrottlingStatusUpdated(); void OnTraceLogEnabled(); @@ -281,6 +284,7 @@ AudioState audio_state_; bool is_frozen_; bool reported_background_throttling_since_navigation_; + bool opted_out_from_all_throttling_; bool opted_out_from_aggressive_throttling_; bool nested_runloop_; bool is_main_frame_local_;
diff --git a/third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h b/third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h index 9e14bc3..791a024 100644 --- a/third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h +++ b/third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h
@@ -22,10 +22,12 @@ static bool IsFeatureSticky(Feature feature); // List of opt-outs which form a policy. + struct DisableAllThrottling {}; struct DisableAggressiveThrottling {}; struct RecordMetricsForBackForwardCache {}; struct ValidPolicies { + ValidPolicies(DisableAllThrottling); ValidPolicies(DisableAggressiveThrottling); ValidPolicies(RecordMetricsForBackForwardCache); }; @@ -35,7 +37,9 @@ base::trait_helpers::AreValidTraits<ValidPolicies, ArgTypes...>::value>> constexpr SchedulingPolicy(ArgTypes... args) - : disable_aggressive_throttling( + : disable_all_throttling( + base::trait_helpers::HasTrait<DisableAllThrottling, ArgTypes...>()), + disable_aggressive_throttling( base::trait_helpers::HasTrait<DisableAggressiveThrottling, ArgTypes...>()), disable_back_forward_cache( @@ -44,6 +48,7 @@ SchedulingPolicy() {} + bool disable_all_throttling = false; bool disable_aggressive_throttling = false; bool disable_back_forward_cache = false; };
diff --git a/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc b/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc index df0e8f3..5e17623a 100644 --- a/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc +++ b/third_party/blink/renderer/platform/widget/input/widget_base_input_handler.cc
@@ -200,57 +200,80 @@ public: HandlingState(base::WeakPtr<WidgetBaseInputHandler> input_handler_param, bool is_touch_start_or_move) - : touch_start_or_move(is_touch_start_or_move), - input_handler(std::move(input_handler_param)) { - previous_was_handling_input = input_handler->handling_input_event_; - previous_state = input_handler->handling_input_state_; - input_handler->handling_input_event_ = true; - input_handler->handling_input_state_ = this; + : touch_start_or_move_(is_touch_start_or_move), + input_handler_(std::move(input_handler_param)) { + previous_was_handling_input_ = input_handler_->handling_input_event_; + previous_state_ = input_handler_->handling_input_state_; + input_handler_->handling_input_event_ = true; + input_handler_->handling_input_state_ = this; } ~HandlingState() { // Unwinding the HandlingState on the stack might result in an // input_handler_ that got destroyed. i.e. via a nested event loop. - if (!input_handler) + if (!input_handler_) return; - input_handler->handling_input_event_ = previous_was_handling_input; - DCHECK_EQ(input_handler->handling_input_state_, this); - input_handler->handling_input_state_ = previous_state; + input_handler_->handling_input_event_ = previous_was_handling_input_; + DCHECK_EQ(input_handler_->handling_input_state_, this); + input_handler_->handling_input_state_ = previous_state_; #if defined(OS_ANDROID) - if (show_virtual_keyboard) - input_handler->ShowVirtualKeyboard(); + if (show_virtual_keyboard_) + input_handler_->ShowVirtualKeyboard(); else - input_handler->UpdateTextInputState(); + input_handler_->UpdateTextInputState(); #endif } + std::unique_ptr<InputHandlerProxy::DidOverscrollParams>& event_overscroll() { + return event_overscroll_; + } + void set_event_overscroll( + std::unique_ptr<InputHandlerProxy::DidOverscrollParams> params) { + event_overscroll_ = std::move(params); + } + + base::Optional<WebTouchAction>& touch_action() { return touch_action_; } + + std::vector<WidgetBaseInputHandler::InjectScrollGestureParams>& + injected_scroll_params() { + return injected_scroll_params_; + } + + bool touch_start_or_move() { return touch_start_or_move_; } + +#if defined(OS_ANDROID) + void set_show_virtual_keyboard(bool show_virtual_keyboard) { + show_virtual_keyboard_ = show_virtual_keyboard; + } +#endif // defined(OS_ANDROID) + + private: // Used to intercept overscroll notifications while an event is being // handled. If the event causes overscroll, the overscroll metadata can be // bundled in the event ack, saving an IPC. Note that we must continue // supporting overscroll IPC notifications due to fling animation updates. - std::unique_ptr<InputHandlerProxy::DidOverscrollParams> event_overscroll; + std::unique_ptr<InputHandlerProxy::DidOverscrollParams> event_overscroll_; - base::Optional<WebTouchAction> touch_action; + base::Optional<WebTouchAction> touch_action_; // Used to hold a sequence of parameters corresponding to scroll gesture // events that should be injected once the current input event is done // being processed. std::vector<WidgetBaseInputHandler::InjectScrollGestureParams> - injected_scroll_params; + injected_scroll_params_; // Whether the event we are handling is a touch start or move. - bool touch_start_or_move; + bool touch_start_or_move_; #if defined(OS_ANDROID) // Whether to show the virtual keyboard or not at the end of processing. - bool show_virtual_keyboard = false; + bool show_virtual_keyboard_ = false; #endif - private: - HandlingState* previous_state; - bool previous_was_handling_input; - base::WeakPtr<WidgetBaseInputHandler> input_handler; + HandlingState* previous_state_; + bool previous_was_handling_input_; + base::WeakPtr<WidgetBaseInputHandler> input_handler_; }; WidgetBaseInputHandler::WidgetBaseInputHandler(WidgetBase* widget) @@ -412,8 +435,8 @@ if (!weak_self) { if (callback) { std::move(callback).Run(GetAckResult(processed), swap_latency_info, - std::move(handling_state.event_overscroll), - handling_state.touch_action); + std::move(handling_state.event_overscroll()), + std::move(handling_state.touch_action())); } return; } @@ -439,9 +462,9 @@ // scroll gestures back into blink, e.g., a mousedown on a scrollbar. We // do this here so that we can attribute latency information from the mouse as // a scroll interaction, instead of just classifying as mouse input. - if (handling_state.injected_scroll_params.size()) { + if (handling_state.injected_scroll_params().size()) { HandleInjectedScrollGestures( - std::move(handling_state.injected_scroll_params), input_event, + std::move(handling_state.injected_scroll_params()), input_event, coalesced_event.latency_info()); } @@ -455,12 +478,12 @@ if (gesture_event.SourceDevice() == WebGestureDevice::kTouchpad || gesture_event.SourceDevice() == WebGestureDevice::kTouchscreen) { gfx::Vector2dF latest_overscroll_delta = - handling_state.event_overscroll - ? handling_state.event_overscroll->latest_overscroll_delta + handling_state.event_overscroll() + ? handling_state.event_overscroll()->latest_overscroll_delta : gfx::Vector2dF(); cc::OverscrollBehavior overscroll_behavior = - handling_state.event_overscroll - ? handling_state.event_overscroll->overscroll_behavior + handling_state.event_overscroll() + ? handling_state.event_overscroll()->overscroll_behavior : cc::OverscrollBehavior(); widget_->client()->ObserveGestureEventAndResult( gesture_event, latest_overscroll_delta, overscroll_behavior, @@ -470,10 +493,10 @@ if (callback) { std::move(callback).Run(GetAckResult(processed), swap_latency_info, - std::move(handling_state.event_overscroll), - handling_state.touch_action); + std::move(handling_state.event_overscroll()), + std::move(handling_state.touch_action())); } else { - DCHECK(!handling_state.event_overscroll) + DCHECK(!handling_state.event_overscroll()) << "Unexpected overscroll for un-acked event"; } @@ -502,7 +525,7 @@ // Ensure all injected scrolls were handled or queue up - any remaining // injected scrolls at this point would not be processed. - DCHECK(handling_state.injected_scroll_params.empty()); + DCHECK(handling_state.injected_scroll_params().empty()); } bool WidgetBaseInputHandler::DidOverscrollFromBlink( @@ -525,7 +548,7 @@ params->current_fling_velocity = velocity; params->causal_event_viewport_point = position; params->overscroll_behavior = behavior; - handling_input_state_->event_overscroll = std::move(params); + handling_input_state_->set_event_overscroll(std::move(params)); return false; } @@ -550,7 +573,7 @@ if (handling_input_state_) { InjectScrollGestureParams params{device, delta, granularity, scrollable_area_element_id, injected_type}; - handling_input_state_->injected_scroll_params.push_back(params); + handling_input_state_->injected_scroll_params().push_back(params); } else { base::TimeTicks now = base::TimeTicks::Now(); std::unique_ptr<WebGestureEvent> gesture_event = @@ -660,16 +683,16 @@ return false; // Ignore setTouchAction calls that result from synthetic touch events (eg. // when blink is emulating touch with mouse). - if (!handling_input_state_->touch_start_or_move) + if (!handling_input_state_->touch_start_or_move()) return false; - handling_input_state_->touch_action = touch_action; + handling_input_state_->touch_action() = touch_action; return true; } void WidgetBaseInputHandler::ShowVirtualKeyboard() { #if defined(OS_ANDROID) if (handling_input_state_) { - handling_input_state_->show_virtual_keyboard = true; + handling_input_state_->set_show_virtual_keyboard(true); return; } #endif
diff --git a/third_party/blink/web_tests/FlagExpectations/layout-ng-fragment-item b/third_party/blink/web_tests/FlagExpectations/layout-ng-fragment-item index 73204cc..aa3b9502 100644 --- a/third_party/blink/web_tests/FlagExpectations/layout-ng-fragment-item +++ b/third_party/blink/web_tests/FlagExpectations/layout-ng-fragment-item
@@ -12,7 +12,6 @@ crbug.com/982194 external/wpt/css/css-fonts/font-variant-position-01.html [ Pass ] crbug.com/982194 external/wpt/css/css-masking/clip-path-svg-content/clip-path-recursion-002.svg [ Pass ] crbug.com/982194 external/wpt/css/css-pseudo/selection-text-shadow-016.html [ Pass ] -crbug.com/982194 external/wpt/css/css-pseudo/textpath-selection-011.html [ Pass ] crbug.com/982194 external/wpt/css/css-ruby/ruby-bidi-001.html [ Pass ] crbug.com/982194 external/wpt/css/css-ruby/ruby-line-breaking-002.html [ Pass ] crbug.com/982194 external/wpt/css/css-sizing/aspect-ratio/abspos-001.tentative.html [ Pass ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 01dd845..0b477f8 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -209,6 +209,10 @@ crbug.com/974720 [ Mac10.13 ] virtual/text-antialias/firstline/capitalize-transform-2.html [ Pass Crash ] crbug.com/974720 [ Mac10.13 ] virtual/text-antialias/firstline/capitalize-transform.html [ Pass Crash ] +# Subpixel differences due to compositing on Mac10.14+. +crbug.com/1079418 [ Mac10.14 ] external/wpt/svg/extensibility/foreignObject/foreign-object-scale-scroll.html [ Failure ] +crbug.com/1079418 [ Mac10.15 ] external/wpt/svg/extensibility/foreignObject/foreign-object-scale-scroll.html [ Failure ] + # This test depends on synchronous focus() which does not exist (anymore?). crbug.com/1074482 external/wpt/html/interaction/focus/the-autofocus-attribute/update-the-rendering.html [ Failure ] crbug.com/1074482 external/wpt/clipboard-apis/feature-policy/clipboard-read/clipboard-read-enabled-by-feature-policy-cross-origin-tentative.https.sub.html [ Pass Failure ] @@ -293,6 +297,9 @@ crbug.com/767318 compositing/reflections/nested-reflection-mask-change.html [ Failure ] # Incorrect scrollbar invalidation. crbug.com/887000 virtual/prefer_compositing_to_lcd_text/scrollbars/hidden-scrollbars-invisible.html [ Failure ] +crbug.com/887000 [ Mac10.14 ] scrollbars/hidden-scrollbars-invisible.html [ Failure ] +crbug.com/887000 [ Mac10.15 ] scrollbars/hidden-scrollbars-invisible.html [ Failure ] + crbug.com/882975 virtual/threaded/fast/events/pinch/gesture-pinch-zoom-prevent-in-handler.html [ Failure Pass ] crbug.com/882975 virtual/threaded/fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Failure Pass ] @@ -1444,7 +1451,7 @@ # Needs triage: crbug.com/1053725 [ Mac ] fast/css/button-height.html [ Skip ] -crbug.com/1053725 [ Mac ] fast/css/css2-system-color.html [ Skip ] +crbug.com/1104697 fast/css/css2-system-color.html [ Pass Failure ] crbug.com/1053725 [ Mac ] fast/css-grid-layout/preferred-width-computed-after-layout.html [ Skip ] crbug.com/1053725 [ Mac ] fast/css/text-overflow-ellipsis-button.html [ Skip ] crbug.com/1053725 [ Mac ] editing/selection/replaced-boundaries-3.html [ Skip ] @@ -2723,9 +2730,6 @@ crbug.com/626703 [ Linux ] external/wpt/wasm/jsapi/functions/incumbent.html [ Crash ] crbug.com/626703 [ Mac ] external/wpt/wasm/jsapi/functions/incumbent.html [ Crash ] crbug.com/626703 [ Win ] external/wpt/wasm/jsapi/functions/incumbent.html [ Crash ] -crbug.com/626703 [ Linux ] external/wpt/css/css-pseudo/textpath-selection-011.html [ Failure ] -crbug.com/626703 [ Mac ] external/wpt/css/css-pseudo/textpath-selection-011.html [ Failure ] -crbug.com/626703 [ Win ] external/wpt/css/css-pseudo/textpath-selection-011.html [ Failure ] crbug.com/626703 [ Mac10.11 ] virtual/cors/external/wpt/preload/download-resources.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] virtual/cors/external/wpt/preload/download-resources.html [ Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/cors/external/wpt/preload/download-resources.html [ Timeout ] @@ -6859,7 +6863,7 @@ crbug.com/1010170 media/video-played-reset.html [ Pass Failure ] #Sheriff 2020-06-30 -crbug.com/1100774 [ Mac10.13 ] virtual/threaded-no-composited-antialiasing/animations/svg-attribute-interpolation/svg-d-interpolation.html [ Pass Failure ] +crbug.com/1099657 [ Mac10.13 ] virtual/threaded-no-composited-antialiasing/animations/svg-attribute-interpolation/svg-d-interpolation.html [ Pass Failure ] crbug.com/1100786 [ Mac10.10 ] fast/scroll-snap/snaps-after-touchpad-scrolling.html [ Failure ] crbug.com/1100786 [ Mac10.10 ] storage/indexeddb/transaction-active-flag.html [ Timeout ] @@ -6888,3 +6892,13 @@ crbug.com/1104195 inspector-protocol/css/css-set-effective-property-value.js [ Pass Failure ] crbug.com/1104333 http/tests/devtools/bindings/inline-styles-binding.js [ Pass Failure ] + +# Sheriff 2020-07-13 + +crbug.com/1104910 [ Mac ] external/wpt/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html [ Pass Failure ] +crbug.com/1104910 [ Mac10.13 ] fast/dom/cssTarget-crash.html [ Pass Failure ] +crbug.com/1104910 [ Mac10.13 ] fast/peerconnection/RTCPeerConnection-reload-interesting-usage.html [ Pass Failure ] +crbug.com/1104910 [ Win ] http/tests/devtools/tracing/timeline-js/timeline-js-line-level-profile-no-url-end-to-end.js [ Pass Failure ] +crbug.com/1104910 [ Linux ] inspector-protocol/stylesheet-tracking-restart.js [ Pass Failure ] +crbug.com/1104910 [ Linux ] virtual/web-components-v0-disabled/fast/dom/cssTarget-crash.html [ Pass Failure ] +crbug.com/1104910 [ Win ] virtual/cache-storage-eager-reading/external/wpt/service-workers/service-worker/registration-updateviacache.https.html [ Pass Failure ] \ No newline at end of file
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 29992e1..492ed176 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
@@ -227974,7 +227974,7 @@ [] ], "lint.py": [ - "75fac67dc8d22cc408205bafcdfe4195ba85a91f", + "14052e7a9723ce52cc3ffd64bc6ef454e834f751", [] ], "rules.py": [ @@ -228030,7 +228030,7 @@ [] ], "typedata.py": [ - "13a041e54c3e240e26db83c18a1f589e05cdc851", + "01bb82705f8445ad531fc2d9ec7d600e6cfc321c", [] ], "update.py": [ @@ -228042,7 +228042,7 @@ [] ], "vcs.py": [ - "80c0512807a95937061fdea672ba75562e60a2f8", + "3dfd7c980d70594ff5d8ef48d034ae696521fbdd", [] ] }, @@ -234391,7 +234391,7 @@ [] ], "config.py": [ - "7766565fe4fd175598b8b6cce0e4ff4b40f10d9d", + "4d653f522a05e5ec53f11542cf3ea48202f9152c", [] ], "constants.py": [
diff --git a/third_party/blink/web_tests/external/wpt/IndexedDB/idbobjectstore_putall.tentative.any.js b/third_party/blink/web_tests/external/wpt/IndexedDB/idbobjectstore_putall.tentative.any.js new file mode 100644 index 0000000..c666695 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/IndexedDB/idbobjectstore_putall.tentative.any.js
@@ -0,0 +1,37 @@ +// META: script=support-promises.js + +/** + * This file contains the webplatform tests for the explicit commit() method + * of the IndexedDB transaction API. + * + * @author nums@google.com + */ + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + const store = createBooksStore(testCase, db); + let values = [ + {isbn: 'one', title: 'title1'}, + {isbn: 'two', title: 'title2'}, + {isbn: 'three', title: 'title3'} + ]; + const putAllRequests = store.putAll(values); + putAllRequests.forEach(async request => { + await promiseForRequest(testCase, request); + }); + }); + + const txn = db.transaction(['books'], 'readonly'); + const objectStore = txn.objectStore('books'); + const getRequest1 = objectStore.get('one'); + const getRequest2 = objectStore.get('two'); + const getRequest3 = objectStore.get('three'); + await promiseForTransaction(testCase, txn); + assert_array_equals( + [getRequest1.result.title, + getRequest2.result.title, + getRequest3.result.title], + ['title1', 'title2', 'title3'], + 'All three retrieved titles should match those that were put.'); + db.close(); +}, 'Data can be successfully inputted into an object store using putAll.'); \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/clipboard-apis/async-html-script-removal.https.html b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-html-script-removal.https.html new file mode 100644 index 0000000..90dc44c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-html-script-removal.https.html
@@ -0,0 +1,56 @@ +<!doctype html> +<meta charset="utf-8"> +<title> + Async Clipboard write ([text/html ClipboardItem]) -> readHtml (and remove scripts) tests +</title> +<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script> +'use strict'; +// This function removes extra spaces between tags in html. For example, the +// following html: "<p> Hello </p> <body> World </body>" would turn into this +// html: "<p> Hello </p> <body> World </body>" +// We remove the extra spaces because in html they are considered equivalent, +// but when we are comparing for equality the spaces make a difference. +function reformatHtml(html) { + const parser = new DOMParser(); + const htmlString = + parser.parseFromString(html, 'text/html').documentElement.innerHTML; + const reformattedString = htmlString.replace(/\>\s*\</g, '> <'); + return reformattedString; +} + +// The string must be concatenated in this way because the html parser +// will recognize a script tag even in quotes as a real script tag. By +// splitting it up in this way we avoid that error. +const html_with_script = + '<title>Title of the document</title> <script>const a = 5;</scr' + + 'ipt> <p>Hello World</p>'; +const html_without_script = + '<title>Title of the document</title> <p>Hello World</p>'; +promise_test(async t => { + await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); + await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); + const blobInput = new Blob([html_with_script], {type: 'text/html'}); + const clipboardItem = new ClipboardItem({'text/html': blobInput}); + await navigator.clipboard.write([clipboardItem]); + const clipboardItems = await navigator.clipboard.read({type: 'text/html'}); + + const html = clipboardItems[0]; + assert_equals(html.types.length, 1); + assert_equals(html.types[0], 'text/html'); + + const blobOutput = await html.getType('text/html'); + assert_equals(blobOutput.type, 'text/html'); + + const blobText = await (new Response(blobOutput)).text(); + + const outputHtml = reformatHtml(blobText); + const inputHtml = reformatHtml(html_without_script); + assert_equals(outputHtml, inputHtml); +}, 'Verify write and read clipboard with scripts removed given text/html: ' + + html_with_script); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/clipboard-apis/async-write-html-read-html.https.html b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-write-html-read-html.https.html new file mode 100644 index 0000000..7c271b9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/clipboard-apis/async-write-html-read-html.https.html
@@ -0,0 +1,58 @@ +<!doctype html> +<meta charset="utf-8"> +<title> + Async Clipboard write ([text/html ClipboardItem]) -> readHtml tests +</title> +<link rel="help" href="https://w3c.github.io/clipboard-apis/#async-clipboard-api"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script> +'use strict'; +// This function removes extra spaces between tags in html. For example, the +// following html: "<p> Hello </p> <body> World </body>" would turn into this +// html: "<p> Hello </p> <body> World </body>" +// We remove the extra spaces because in html they are considered equivalent, +// but when we are comparing for equality the spaces make a difference. +function reformatHtml(html) { + const parser = new DOMParser(); + const htmlString = + parser.parseFromString(html, 'text/html').documentElement.innerHTML; + const reformattedString = htmlString.replace(/\>\s*\</g, '> <'); + return reformattedString; +} + +async function readWriteTest(textInput) { + await test_driver.set_permission({name: 'clipboard-read'}, 'granted'); + await test_driver.set_permission({name: 'clipboard-write'}, 'granted'); + const blobInput = new Blob([textInput], {type: 'text/html'}); + const clipboardItem = new ClipboardItem({'text/html': blobInput}); + await navigator.clipboard.write([clipboardItem]); + const clipboardItems = await navigator.clipboard.read({type: 'text/html'}); + + const html = clipboardItems[0]; + assert_equals(html.types.length, 1); + assert_equals(html.types[0], 'text/html'); + + const blobOutput = await html.getType('text/html'); + assert_equals(blobOutput.type, 'text/html'); + + const blobText = await (new Response(blobOutput)).text(); + + const outputHtml = reformatHtml(blobText); + const inputHtml = reformatHtml(textInput); + assert_equals(outputHtml, inputHtml); +} +const testCases = [`<!doctype html> <html> <head> <title>Title of the + document</title> </head> <body> <p>Hello World</p> + </body> </html>`, + '<title>Title of the document</title> <p>Hello World</p>']; + +promise_test(async t => { + for (const testCase of testCases) { + await readWriteTest(testCase); + } +}, 'Verify read and write of some text/html content'); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/tools/lint/lint.py b/third_party/blink/web_tests/external/wpt/tools/lint/lint.py index 75fac67..14052e7 100644 --- a/third_party/blink/web_tests/external/wpt/tools/lint/lint.py +++ b/third_party/blink/web_tests/external/wpt/tools/lint/lint.py
@@ -704,10 +704,10 @@ return errors -ahem_font_re = re.compile(b"font.*:.*ahem", flags=re.IGNORECASE) +ahem_font_re = re.compile(br"font.*:.*ahem", flags=re.IGNORECASE) # Ahem can appear either in the global location or in the support # directory for legacy Mozilla imports -ahem_stylesheet_re = re.compile(b"\/fonts\/ahem\.css|support\/ahem.css", +ahem_stylesheet_re = re.compile(br"\/fonts\/ahem\.css|support\/ahem.css", flags=re.IGNORECASE)
diff --git a/third_party/blink/web_tests/external/wpt/tools/manifest/typedata.py b/third_party/blink/web_tests/external/wpt/tools/manifest/typedata.py index 13a041e5..01bb827 100644 --- a/third_party/blink/web_tests/external/wpt/tools/manifest/typedata.py +++ b/third_party/blink/web_tests/external/wpt/tools/manifest/typedata.py
@@ -1,6 +1,5 @@ -from collections import MutableMapping - from six import itervalues, iteritems +from six.moves.collections_abc import MutableMapping MYPY = False
diff --git a/third_party/blink/web_tests/external/wpt/tools/manifest/vcs.py b/third_party/blink/web_tests/external/wpt/tools/manifest/vcs.py index 80c0512..3dfd7c9 100644 --- a/third_party/blink/web_tests/external/wpt/tools/manifest/vcs.py +++ b/third_party/blink/web_tests/external/wpt/tools/manifest/vcs.py
@@ -3,9 +3,9 @@ import os import stat from collections import deque -from collections import MutableMapping from six import with_metaclass, PY2 +from six.moves.collections_abc import MutableMapping from .utils import git
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptserve/wptserve/config.py b/third_party/blink/web_tests/external/wpt/tools/wptserve/wptserve/config.py index 7766565..4d653f5 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptserve/wptserve/config.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptserve/wptserve/config.py
@@ -1,8 +1,9 @@ import copy import logging import os +from collections import defaultdict -from collections import defaultdict, Mapping +from six.moves.collections_abc import Mapping from six import integer_types, iteritems, itervalues, string_types from . import sslutils
diff --git a/third_party/blink/web_tests/external/wpt/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html b/third_party/blink/web_tests/external/wpt/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html index bebcc6ab..b34c9685 100644 --- a/third_party/blink/web_tests/external/wpt/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html +++ b/third_party/blink/web_tests/external/wpt/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html
@@ -76,7 +76,7 @@ a1: 0, b1: 1, prefix: 'Sine', - threshold: 4.1724e-7, + threshold: 4.7684e-7, snrThreshold: 130.95 }); task.done();
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index 0157ccf6..9005c8d 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [334, 123, 443, 404] + [334, 523, 443, 4], + [393, 123, 384, 404] ] } ]
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt index a7eb982..f276d46 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [11, 35, 74, 20], + [11, 54, 74, 1], + [11, 35, 73, 20], [11, 11, 58, 20] ] }
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-within-composited-scroller-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-within-composited-scroller-expected.txt index 41f86b19..f6f2702 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-within-composited-scroller-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/selection/selection-within-composited-scroller-expected.txt
@@ -24,7 +24,8 @@ "contentsOpaque": true, "backgroundColor": "#D3D3D3", "invalidations": [ - [0, 610, 22, 20] + [0, 629, 22, 1], + [0, 610, 21, 20] ], "transform": 2 },
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt index 991945e7..82c7392 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt
@@ -4,11 +4,7 @@ "name": "Scrolling background of LayoutView #document", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "invalidations": [ - [85, 70, 91, 92], - [84, 70, 91, 92] - ] + "backgroundColor": "#FFFFFF" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt index 558d0b9..95da955e 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 8, 48, 33] + [8, 8, 48, 32], + [40, 8, 16, 33] ] } ]
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt index 1bb24bd..291a6fb1 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 8, 33, 48] + [8, 40, 33, 16], + [8, 8, 32, 48] ] } ]
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt index 458670f..cdb3cf2 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [7, 8, 33, 48] + [7, 40, 33, 16], + [8, 8, 32, 48] ] } ]
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-with-br-includes-newline-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-with-br-includes-newline-expected.txt index e1bf08d..1f01ada 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-with-br-includes-newline-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/invalidation-rect-with-br-includes-newline-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 24, 32, 17], + [8, 24, 32, 16], + [24, 24, 16, 17], [24, 8, 16, 16], [8, 8, 16, 16] ]
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index 6507a0c0..1c1ffb1 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [334, 123, 441, 404] + [334, 523, 441, 4], + [398, 123, 375, 404] ] } ]
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/001-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/001-expected.png new file mode 100644 index 0000000..82c1a94c --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/001-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/002-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/002-expected.png new file mode 100644 index 0000000..bbde495 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/002-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/003-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/003-expected.png new file mode 100644 index 0000000..523489e --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/003-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/004-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/004-expected.png new file mode 100644 index 0000000..a38ec57e --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/004-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/005-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/005-expected.png new file mode 100644 index 0000000..a38ec57e --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/005-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/006-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/006-expected.png new file mode 100644 index 0000000..51f448f --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/006-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/14498-positionForCoordinates-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/14498-positionForCoordinates-expected.png new file mode 100644 index 0000000..63190e91 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/14498-positionForCoordinates-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/baseline-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/baseline-vertical-expected.png new file mode 100644 index 0000000..f84bf18a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/baseline-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/contenteditable-baseline-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/contenteditable-baseline-expected.png new file mode 100644 index 0000000..6b57a5a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/contenteditable-baseline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/inline-block-vertical-align-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/inline-block-vertical-align-expected.png new file mode 100644 index 0000000..85662049 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/inline-block-vertical-align-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/overflow-clip-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/overflow-clip-expected.png new file mode 100644 index 0000000..a15f143 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/overflow-clip-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/tricky-baseline-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/tricky-baseline-expected.png new file mode 100644 index 0000000..bb43dcf --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/inline-block/tricky-baseline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-expected.png new file mode 100644 index 0000000..da4dcd4 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-vertical-expected.png new file mode 100644 index 0000000..8a05411 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/001-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-expected.png new file mode 100644 index 0000000..f3a15ac --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-vertical-expected.png new file mode 100644 index 0000000..aeb1694 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/002-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-expected.png new file mode 100644 index 0000000..b3b6e72 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-vertical-expected.png new file mode 100644 index 0000000..c1a99b1 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/003-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/004-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/004-expected.png new file mode 100644 index 0000000..e37ceb4 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/004-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-expected.png new file mode 100644 index 0000000..d927ad07 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-vertical-expected.png new file mode 100644 index 0000000..5adcedf --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/005-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-expected.png new file mode 100644 index 0000000..c4b3f405 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-vertical-expected.png new file mode 100644 index 0000000..61a3b6b --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/006-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-expected.png new file mode 100644 index 0000000..50a8dae3 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-vertical-expected.png new file mode 100644 index 0000000..e596b783 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/007-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-expected.png new file mode 100644 index 0000000..9dd2043 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-vertical-expected.png new file mode 100644 index 0000000..e34a3b55 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/008-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-expected.png new file mode 100644 index 0000000..0fbddea --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-vertical-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-vertical-expected.png new file mode 100644 index 0000000..473e625 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/009-vertical-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/anonymous-items-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/anonymous-items-expected.png new file mode 100644 index 0000000..b36b6a64 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/anonymous-items-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/big-list-marker-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/big-list-marker-expected.png new file mode 100644 index 0000000..0259904 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/big-list-marker-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/dynamic-marker-crash-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/dynamic-marker-crash-expected.png new file mode 100644 index 0000000..de8b464 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/dynamic-marker-crash-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inline-before-content-after-list-marker-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inline-before-content-after-list-marker-expected.png new file mode 100644 index 0000000..4c2d7be6 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inline-before-content-after-list-marker-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inlineBoxWrapperNullCheck-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inlineBoxWrapperNullCheck-expected.png new file mode 100644 index 0000000..8d850ea --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/inlineBoxWrapperNullCheck-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-br-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-br-expected.png new file mode 100644 index 0000000..af4623c --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-br-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-style-alpha-huge-value-crash-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-style-alpha-huge-value-crash-expected.png new file mode 100644 index 0000000..1f1751c --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/li-style-alpha-huge-value-crash-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-item-line-height-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-item-line-height-expected.png new file mode 100644 index 0000000..0f583cb --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-item-line-height-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-content-table-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-content-table-expected.png new file mode 100644 index 0000000..7abd825 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-content-table-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-expected.png new file mode 100644 index 0000000..4d2239ce --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-expected.png new file mode 100644 index 0000000..319a971 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-rtl-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-rtl-expected.png new file mode 100644 index 0000000..ecc62e5 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-nested-rtl-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-rtl-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-rtl-expected.png new file mode 100644 index 0000000..b311f490 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-before-float-rtl-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-expected.png new file mode 100644 index 0000000..3bbdd3f --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-rtl-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-rtl-expected.png new file mode 100644 index 0000000..eb89364 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-padding-overflow-hidden-rtl-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-with-line-height-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-with-line-height-expected.png new file mode 100644 index 0000000..ad92cbf --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-marker-with-line-height-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-style-none-crash-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-style-none-crash-expected.png new file mode 100644 index 0000000..70a96e3 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/list-style-none-crash-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-before-empty-inline-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-before-empty-inline-expected.png new file mode 100644 index 0000000..81cafe4 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-before-empty-inline-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-image-error-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-image-error-expected.png new file mode 100644 index 0000000..3509d487 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/marker-image-error-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/markers-in-selection-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/markers-in-selection-expected.png new file mode 100644 index 0000000..749d848 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/markers-in-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/numeric-markers-outside-list-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/numeric-markers-outside-list-expected.png new file mode 100644 index 0000000..9bcb3935 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/numeric-markers-outside-list-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-display-types-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-display-types-expected.png new file mode 100644 index 0000000..c03cb24 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-display-types-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-dynamic-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-dynamic-expected.png new file mode 100644 index 0000000..0bb1b2c4 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-dynamic-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-parsing-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-parsing-expected.png new file mode 100644 index 0000000..508af703 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ol-start-parsing-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/olstart-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/olstart-expected.png new file mode 100644 index 0000000..c16171d --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/olstart-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ordered-list-with-no-ol-tag-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ordered-list-with-no-ol-tag-expected.png new file mode 100644 index 0000000..9e8ebe670 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/ordered-list-with-no-ol-tag-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/scrolled-marker-paint-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/scrolled-marker-paint-expected.png new file mode 100644 index 0000000..6bf5d2f --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/lists/scrolled-marker-paint-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/border-radius-clipped-layer-second-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/border-radius-clipped-layer-second-column-expected.png new file mode 100644 index 0000000..2b04582 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/border-radius-clipped-layer-second-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-inner-multicol-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-inner-multicol-expected.png new file mode 100644 index 0000000..aa63662a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-inner-multicol-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-expected.png new file mode 100644 index 0000000..66c86da --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-translated-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-translated-expected.png new file mode 100644 index 0000000..baa3c40 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-multiple-fragments-translated-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-nested-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-nested-expected.png new file mode 100644 index 0000000..2109eab --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-nested-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-will-change-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-will-change-expected.png new file mode 100644 index 0000000..5686e30 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-layer-will-change-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-opacity-2nd-and-3rd-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-opacity-2nd-and-3rd-column-expected.png new file mode 100644 index 0000000..058d8841 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-opacity-2nd-and-3rd-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-clipped-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-clipped-expected.png new file mode 100644 index 0000000..70a92ab --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-clipped-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-expected.png new file mode 100644 index 0000000..862f2ce --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-in-clipped-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-in-clipped-expected.png new file mode 100644 index 0000000..7f96e34 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-in-clipped-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-overlapping-will-change-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-overlapping-will-change-expected.png new file mode 100644 index 0000000..c53e95a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-overlapping-will-change-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-resize-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-resize-expected.png new file mode 100644 index 0000000..dab48fa4 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-relpos-resize-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-child-layer-in-next-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-child-layer-in-next-column-expected.png new file mode 100644 index 0000000..4c1da8a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-child-layer-in-next-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-overflow-in-next-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-overflow-in-next-column-expected.png new file mode 100644 index 0000000..c3af9d3 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/composited-with-overflow-in-next-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/input-with-overflow-second-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/input-with-overflow-second-column-expected.png new file mode 100644 index 0000000..1f0eedf --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/input-with-overflow-second-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-in-multicol-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-in-multicol-expected.png new file mode 100644 index 0000000..4922dbd --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-in-multicol-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-split-across-columns-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-split-across-columns-expected.png new file mode 100644 index 0000000..0bb28a5d --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/layers-split-across-columns-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png new file mode 100644 index 0000000..02f06f08 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/span/invalid-spanner-in-transform-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/span/invalid-spanner-in-transform-expected.png new file mode 100644 index 0000000..ebbd31dc --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/span/invalid-spanner-in-transform-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/transform-inside-opacity-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/transform-inside-opacity-expected.png new file mode 100644 index 0000000..535733c --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/transform-inside-opacity-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/under-scroll-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/under-scroll-expected.png new file mode 100644 index 0000000..0f2e8844 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/under-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-lr/composited-relpos-overlapping-will-change-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-lr/composited-relpos-overlapping-will-change-expected.png new file mode 100644 index 0000000..d3c7e8c --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-lr/composited-relpos-overlapping-will-change-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-rl/composited-relpos-overlapping-will-change-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-rl/composited-relpos-overlapping-will-change-expected.png new file mode 100644 index 0000000..9570627 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fast/multicol/vertical-rl/composited-relpos-overlapping-will-change-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/column-fill-auto-child-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/column-fill-auto-child-expected.png new file mode 100644 index 0000000..626a5c7 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/column-fill-auto-child-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/outline-crossing-columns-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/outline-crossing-columns-expected.png new file mode 100644 index 0000000..a99fd6f --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/outline-crossing-columns-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/transformed-clip-before-second-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/transformed-clip-before-second-column-expected.png new file mode 100644 index 0000000..ce38ce4a --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/fragmentation/transformed-clip-before-second-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/android/fullscreen/video-fail-to-enter-full-screen-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/android/fullscreen/video-fail-to-enter-full-screen-expected.png new file mode 100644 index 0000000..36d54f8 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/android/fullscreen/video-fail-to-enter-full-screen-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/input-with-overflow-second-column-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/input-with-overflow-second-column-expected.png new file mode 100644 index 0000000..1f0eedf --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/input-with-overflow-second-column-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png new file mode 100644 index 0000000..02f06f08 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/force-device-scale-factor=1.5/virtual/layout_ng_block_frag/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index c851c99..9ebe579 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -731,6 +731,7 @@ method openCursor method openKeyCursor method put + method putAll setter name interface IDBObservation attribute @@toStringTag
diff --git a/third_party/blink/web_tests/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt b/third_party/blink/web_tests/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt index 02a551d..c543542 100644 --- a/third_party/blink/web_tests/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt +++ b/third_party/blink/web_tests/paint/invalidation/transform/invalidation-with-scale-transform-expected.txt
@@ -4,11 +4,7 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "invalidations": [ - [85, 70, 91, 92], - [84, 70, 91, 92] - ] + "backgroundColor": "#FFFFFF" } ] }
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index 1fc5e11..1892afb 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [334, 123, 443, 404] + [334, 523, 443, 4], + [393, 123, 384, 404] ] } ]
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt index b8bfb44..3092adbf 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [11, 35, 74, 20], + [11, 54, 74, 1], + [11, 35, 73, 20], [11, 11, 58, 20] ] }
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-within-composited-scroller-expected.txt b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-within-composited-scroller-expected.txt index 8b2aa2f..b0e7bdaa 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-within-composited-scroller-expected.txt +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/selection/selection-within-composited-scroller-expected.txt
@@ -17,7 +17,8 @@ "contentsOpaque": true, "backgroundColor": "#D3D3D3", "invalidations": [ - [0, 610, 22, 20] + [0, 629, 22, 1], + [0, 610, 21, 20] ], "transform": 2 },
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/overflow-scroll-overlap-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/overflow-scroll-overlap-expected.txt new file mode 100644 index 0000000..fe614ef --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/overflow-scroll-overlap-expected.txt
@@ -0,0 +1,68 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='composited'", + "bounds": [30, 30], + "contentsOpaque": true, + "backgroundColor": "#808080", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='scroller' class='overflow')", + "position": [12, 12], + "bounds": [306, 206], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='box'", + "position": [23, 58], + "bounds": [200, 100], + "contentsOpaque": true, + "backgroundColor": "#0000FF", + "transform": 3 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (relative positioned) DIV class='box')", + "position": [23, 213], + "bounds": [210, 100], + "transform": 3 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [20, 20, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -49, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/scroll-partial-update-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/scroll-partial-update-expected.txt new file mode 100644 index 0000000..65cc8d1 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/layer-creation/scroll-partial-update-expected.txt
@@ -0,0 +1,35 @@ +scroll me +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='composited'", + "bounds": [20, 20], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='overlay')", + "position": [2, 0], + "bounds": [400, 204], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/nested-render-surfaces-with-rotation-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/nested-render-surfaces-with-rotation-expected.png new file mode 100644 index 0000000..1d9447e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/nested-render-surfaces-with-rotation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-overlay-with-touch-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/overflow/overflow-overlay-with-touch-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt new file mode 100644 index 0000000..19b7c986 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [408, 108, 20, 20] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-contenteditable-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-contenteditable-expected.png new file mode 100644 index 0000000..f9ccb4f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-contenteditable-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-input-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-input-expected.png new file mode 100644 index 0000000..5c2f4de7 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/editing/input/reveal-caret-of-multiline-input-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt new file mode 100644 index 0000000..55ec5ca --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt
@@ -0,0 +1,28 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='content'", + "bounds": [285, 1000], + "contentsOpaque": true, + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [50, 50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/box-shadow/box-shadow-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/box-shadow/box-shadow-expected.png new file mode 100644 index 0000000..79aa74d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/box-shadow/box-shadow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/clip/nestedTransparencyClip-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/clip/nestedTransparencyClip-expected.png new file mode 100644 index 0000000..3825a9b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/clip/nestedTransparencyClip-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt new file mode 100644 index 0000000..9d73e16 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt
@@ -0,0 +1,13 @@ +This tests verifies the hit test regions given to the compositor when non-composited iframes are involved. It can only be run in DumpRenderTree. The outputted rects should cover the hit test regions of all the listed elements. Enable visualize mode to quickly validate graphically. + +iframe: layer(800x600) has hit test rect (23,130 290x15) + +iframe-nested: layer(800x600) has hit test rect (33,168 290x15) + +iframe-transform: layer(800x600) has hit test rect (34,207 320x23) + +iframe-fixed: layer(332x22) has hit test rect (0,0 332x22) + +iframe-doc: layer(800x600) has hit test rect (10,284 385x25) + +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt new file mode 100644 index 0000000..1e40f42 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt
@@ -0,0 +1,5 @@ +notclipped: layer(800x600) has hit test rect (1,51 200x25) + +clipped: no rects + +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-appearance-expected.png new file mode 100644 index 0000000..ae72f250 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png new file mode 100644 index 0000000..8138b2d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/controls-refresh-hc/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 similarity index 100% rename from third_party/blink/web_tests/platform/mac-mac10.14/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png rename to 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/control-clip-overflow-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/control-clip-overflow-expected.png new file mode 100644 index 0000000..8b1e861 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/control-clip-overflow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/focus-rect/textarea-scrolled-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/focus-rect/textarea-scrolled-focus-ring-expected.png new file mode 100644 index 0000000..680c7d42 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/focus-rect/textarea-scrolled-focus-ring-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 new file mode 100644 index 0000000..8eeb70d --- /dev/null +++ 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 new file mode 100644 index 0000000..2a2d3d37 --- /dev/null +++ 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/select-disabled-appearance-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/select/select-disabled-appearance-expected.png new file mode 100644 index 0000000..fd3a3704 --- /dev/null +++ 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/forms/textarea/basic-textareas-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-expected.png new file mode 100644 index 0000000..d0dcb04 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png new file mode 100644 index 0000000..d8facb8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrollbar-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrollbar-expected.png new file mode 100644 index 0000000..4ccb966 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrollbar-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png new file mode 100644 index 0000000..bd6278c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-type-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-type-expected.png new file mode 100644 index 0000000..952d468 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/forms/textarea/textarea-scrolled-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-font-size-20px-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/frames/iframe-scaling-with-scroll-expected.png similarity index 61% rename from third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-font-size-20px-expected.png rename to third_party/blink/web_tests/platform/mac-mac10.13/fast/frames/iframe-scaling-with-scroll-expected.png index 336d5609..a260436 100644 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-font-size-20px-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/frames/iframe-scaling-with-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-expected.png new file mode 100644 index 0000000..4ea11765 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-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 new file mode 100644 index 0000000..5159ec1 --- /dev/null +++ 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 new file mode 100644 index 0000000..76d2b83 --- /dev/null +++ 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/fast/overflow/overflow-update-transform-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-expected.png new file mode 100644 index 0000000..f13ddef --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/fast/overflow/overflow-update-transform-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 new file mode 100644 index 0000000..cb8803f6 --- /dev/null +++ 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/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png new file mode 100644 index 0000000..0c991dea --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..924d31d1 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/images/color-profile-svg-foreign-object-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 new file mode 100644 index 0000000..2f2e5c6 --- /dev/null +++ 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 new file mode 100644 index 0000000..d1cfea2a --- /dev/null +++ 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 new file mode 100644 index 0000000..53bb82c --- /dev/null +++ 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 new file mode 100644 index 0000000..877187d3 --- /dev/null +++ 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 new file mode 100644 index 0000000..f894dea --- /dev/null +++ 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 new file mode 100644 index 0000000..f2a2c837 --- /dev/null +++ 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/compositing/iframe-inside-squashed-layer-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt new file mode 100644 index 0000000..407f5d9d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt
@@ -0,0 +1,45 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [785, 1016], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='foo'", + "bounds": [200, 1000], + "contentsOpaque": true, + "backgroundColor": "#D3D3D3", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV)", + "position": [0, -8], + "bounds": [300, 654], + "invalidations": [ + [8, 508, 31, 18], + [285, 500, 15, 150] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt new file mode 100644 index 0000000..81d99918 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [408, 8, 50, 50], + [8, 8, 50, 50] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt new file mode 100644 index 0000000..9d86bbc3 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt
@@ -0,0 +1,37 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='foo2'", + "bounds": [150, 1000], + "contentsOpaque": true, + "backgroundColor": "#ADD8E6", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='foo')", + "bounds": [100, 1000], + "invalidations": [ + [0, 0, 100, 1000] + ], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-color-change-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-color-change-expected.txt new file mode 100644 index 0000000..a2778e68 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-color-change-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 57, 47, 185] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.png new file mode 100644 index 0000000..5bc23811 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.txt new file mode 100644 index 0000000..55f5ee10 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/text-match-highlight-expected.txt
@@ -0,0 +1,21 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [10, 126, 227, 18], + [20, 214, 200, 72], + [10, 180, 139, 12], + [268, 54, 46, 18], + [90, 54, 46, 18], + [282, 36, 45, 18], + [224, 54, 45, 18], + [52, 72, 45, 18] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt new file mode 100644 index 0000000..a7a36ae --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt
@@ -0,0 +1,24 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 275, 75, 18], + [8, 257, 75, 18], + [8, 239, 75, 18], + [8, 221, 75, 18], + [8, 203, 75, 18], + [8, 185, 75, 18], + [8, 167, 75, 18], + [8, 149, 75, 18], + [8, 131, 75, 18], + [8, 113, 75, 18], + [8, 108, 75, 5] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-expected.txt new file mode 100644 index 0000000..fa3bc8e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/compositing/updating-scrolling-container-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 108, 210, 210] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/flexbox/scrollbars-changed-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/flexbox/scrollbars-changed-expected.txt new file mode 100644 index 0000000..320ac66 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/flexbox/scrollbars-changed-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 5, 15, 15] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/float-offscreen-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/float-offscreen-expected.txt new file mode 100644 index 0000000..9da76a0 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/float-offscreen-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [11, 11, 69, 21] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/forms/textarea-caret-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/forms/textarea-caret-expected.txt new file mode 100644 index 0000000..90a10e9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/forms/textarea-caret-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [6, 6, 185, 40] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/line-flow-with-floats-9-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/line-flow-with-floats-9-expected.txt new file mode 100644 index 0000000..444f9a3 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/line-flow-with-floats-9-expected.txt
@@ -0,0 +1,16 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 572, 440, 18], + [8, 74, 418, 516], + [485, 0, 15, 600] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-child-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-child-expected.txt new file mode 100644 index 0000000..3855101 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-child-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [214, 21, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-parent-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-parent-expected.txt new file mode 100644 index 0000000..4217422 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-parent-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [29, 29, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-same-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-same-expected.txt new file mode 100644 index 0000000..1500b04 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/overflow/vertical-overflow-same-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [29, 21, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/position/layout-state-only-positioned-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/position/layout-state-only-positioned-expected.txt new file mode 100644 index 0000000..8f64356 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/position/layout-state-only-positioned-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 50, 106, 106] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/resize-iframe-text-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/resize-iframe-text-expected.txt new file mode 100644 index 0000000..83ca7004 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/resize-iframe-text-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [500, 400], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 200, 500, 200], + [485, 0, 15, 200] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt new file mode 100644 index 0000000..2b8b7b59 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [193, 100, 7, 200] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-scrollbar-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-scrollbar-expected.txt new file mode 100644 index 0000000..2c96288a --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/destroy-scrollbar-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [185, 100, 15, 200] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt new file mode 100644 index 0000000..922d5c9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [200, 150, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt new file mode 100644 index 0000000..922d5c9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [200, 150, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt new file mode 100644 index 0000000..0437fd0 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [187, 102, 15, 200] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt new file mode 100644 index 0000000..98935c1 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [286, 172, 75, 75], + [286, 18, 75, 75], + [172, 172, 75, 75], + [172, 18, 75, 75], + [53, 152, 75, 75], + [18, 18, 75, 75] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt new file mode 100644 index 0000000..5f234433 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 8, 300, 300], + [762, 8, 15, 300] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt new file mode 100644 index 0000000..459cd0c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt
@@ -0,0 +1,34 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [93, 125, 180, 100], + [93, 75, 180, 100], + [308, 65, 15, 175] + ] + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV class='icon'", + "bounds": [40, 40], + "contentsOpaque": true, + "backgroundColor": "#FFDDBB", + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [200, 10, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-delete-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-delete-expected.txt new file mode 100644 index 0000000..29d05cc --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-delete-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 112, 44, 35] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt new file mode 100644 index 0000000..5f234433 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 8, 300, 300], + [762, 8, 15, 300] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt new file mode 100644 index 0000000..71b0103 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt
@@ -0,0 +1,55 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 293, 285, 15] + ] + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='container'", + "bounds": [600, 600], + "contentsOpaque": true, + "backgroundColor": "#FF0000", + "invalidations": [ + [0, 0, 600, 600] + ], + "transform": 3 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-365, 0, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [50, 0, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt new file mode 100644 index 0000000..eb0ab0f1 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt
@@ -0,0 +1,19 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 393, 285, 15], + [8, 193, 85, 15], + [293, 108, 15, 285], + [93, 108, 15, 85], + [293, 393, 15, 15], + [93, 193, 15, 15] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt new file mode 100644 index 0000000..ed615e7 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 108, 100, 100] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt new file mode 100644 index 0000000..b465bdb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [1, 236, 185, 15] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-parts-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-parts-expected.txt new file mode 100644 index 0000000..0565838a --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/scrollbar-parts-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [8, 93, 85, 15], + [93, 8, 15, 85] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt new file mode 100644 index 0000000..4c0135f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt
@@ -0,0 +1,70 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [785, 656], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [353, 8, 15, 640] + ] + }, + { + "name": "LayoutNGBlockFlow (sticky positioned) DIV id='sticky'", + "bounds": [345, 18], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, -0.1], + [0, 0, 0, 1] + ], + "origin": [188, 328] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ], + "flattenInheritedTransform": false + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -35, 0, 1] + ], + "flattenInheritedTransform": false + }, + { + "id": 4, + "parent": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 35, 0, 1] + ], + "flattenInheritedTransform": false + } + ] +} +
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 new file mode 100644 index 0000000..56d84af22 --- /dev/null +++ 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/paint/invalidation/table/scroll-inside-table-cell-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/scroll-inside-table-cell-expected.txt new file mode 100644 index 0000000..9137e22 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/scroll-inside-table-cell-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [314, 114, 435, 450], + [314, 564, 435, 15] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt new file mode 100644 index 0000000..414f86f --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt
@@ -0,0 +1,44 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [1566, 1781], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [1114, 1314, 435, 450], + [1114, 1764, 435, 15] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 585], + "bounds": [785, 15], + "contentsOpaque": true + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 585], + "contentsOpaque": true + }, + { + "name": "Scroll Corner Layer", + "position": [785, 585], + "bounds": [15, 15] + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-781, -1196, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt new file mode 100644 index 0000000..94cfb5a9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [10, 8, 302, 300], + [762, 8, 15, 300] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt new file mode 100644 index 0000000..94cfb5a9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [10, 8, 302, 300], + [762, 8, 15, 300] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/text-match-document-change-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/text-match-document-change-expected.txt new file mode 100644 index 0000000..ef30dc2b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/text-match-document-change-expected.txt
@@ -0,0 +1,15 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [18, 128, 256, 36], + [295, 102, 15, 400] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt new file mode 100644 index 0000000..53c75e82 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt
@@ -0,0 +1,53 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [600, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 600, 250] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [400, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 250] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [400, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 600] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 800, 600] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt new file mode 100644 index 0000000..53c75e82 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt
@@ -0,0 +1,53 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [600, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 600, 250] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [400, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 250] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [400, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 600] + ] + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 800, 600] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt new file mode 100644 index 0000000..2dfe16b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt
@@ -0,0 +1,77 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [585, 3016], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 585, 3016] + ] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [585, 0], + "bounds": [15, 250], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [385, 3016], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 385, 3016] + ] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [385, 0], + "bounds": [15, 250], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [385, 3016], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 385, 3016] + ] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [385, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [785, 3016], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 785, 3016] + ] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/auto-scrollbar-fades-out-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/auto-scrollbar-fades-out-expected.png new file mode 100644 index 0000000..bdfbe7c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/auto-scrollbar-fades-out-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png new file mode 100644 index 0000000..877bbf4 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
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 new file mode 100644 index 0000000..ae2b041 --- /dev/null +++ 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 new file mode 100644 index 0000000..1579827e --- /dev/null +++ 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 new file mode 100644 index 0000000..ac0e003 --- /dev/null +++ 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/custom/getscreenctm-in-scrollable-div-area-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/getscreenctm-in-scrollable-div-area-expected.png new file mode 100644 index 0000000..e0ebe01 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/custom/getscreenctm-in-scrollable-div-area-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/wicd/test-scalable-background-image2-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/wicd/test-scalable-background-image2-expected.png new file mode 100644 index 0000000..832ca090 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/wicd/test-scalable-background-image2-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 new file mode 100644 index 0000000..ce866d95 --- /dev/null +++ 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/cascade/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/cascade/fast/forms/select/basic-selects-expected.png new file mode 100644 index 0000000..8eeb70d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/cascade/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/date/date-picker-month-year-selector-expected.png new file mode 100644 index 0000000..4f58000 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/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-mac10.13/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/dark-color-scheme/datetimelocal-picker/datetimelocal-month-year-selector-expected.png new file mode 100644 index 0000000..1cdafa8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/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-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 new file mode 100644 index 0000000..bbebb23 --- /dev/null +++ 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 new file mode 100644 index 0000000..01971c1 --- /dev/null +++ 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 new file mode 100644 index 0000000..b0175cac --- /dev/null +++ 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/exotic-color-space/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/exotic-color-space/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..b90bb2fc8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/exotic-color-space/images/color-profile-svg-foreign-object-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..9ca782e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-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 76d2b83..279dbdb8 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 cb8803f6..5266e67 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 2f2e5c6..029faa5 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/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/controls-layout-direction-expected.png index d1cfea2a..5dbdb4f 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/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/media/media-controls-clone-expected.png index 53bb82c..314ee140 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 877187d3..deccb02 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 f894dea..0d087479 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 f2a2c837..dba91d8 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/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index a1f57d3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/controls-refresh-hc/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.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 bbebb23..b3fd630 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 01971c1..b09eff5 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 b0175cac..aca486d 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/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png deleted file mode 100644 index 299681d1..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.14/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/mac-mac10.14/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.14/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index a1f57d3..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.14/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-retina/external/wpt/fullscreen/api/element-request-fullscreen-and-move-to-iframe-manual-expected.txt b/third_party/blink/web_tests/platform/mac-retina/external/wpt/fullscreen/api/element-request-fullscreen-and-move-to-iframe-manual-expected.txt deleted file mode 100644 index b405358..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/external/wpt/fullscreen/api/element-request-fullscreen-and-move-to-iframe-manual-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Unhandled rejection: fullscreen error -PASS Element#requestFullscreen() followed by moving the element into an iframe -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-retina/external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize-expected.txt b/third_party/blink/web_tests/platform/mac-retina/external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize-expected.txt deleted file mode 100644 index f733c9a..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize-expected.txt +++ /dev/null
@@ -1,13 +0,0 @@ -This is a testharness.js-based test. -PASS Verify that writing to the width and height attributes of an OffscreenCanvas works when there is no context attached. -PASS Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a 2d context attached. -PASS Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a webgl context attached. -PASS Verify that writing to the width or height attribute of a placeholder canvas throws an exception -PASS Verify that writing to the width or height attribute of a placeholder canvas throws an exception even when not changing the value of the attribute. -PASS Verify that resizing a 2d context resets its state. -PASS Verify that setting the size of a 2d context to the same size it already had resets its state. -PASS Verify that resizing an OffscreenCanvas with a 2d context propagates the new size to its placeholder canvas asynchronously. -FAIL Verify that resizing an OffscreenCanvas with a webgl context propagates the new size to its placeholder canvas asynchronously. assert_equals: expected 30 but got 10 -FAIL Verify that drawImage uses the size of the frame as the intinsic size of a placeholder canvas. assert_equals: expected 10 but got 1 -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-retina/external/wpt/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https-expected.txt b/third_party/blink/web_tests/platform/mac-retina/external/wpt/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https-expected.txt deleted file mode 100644 index e92f6691..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/external/wpt/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL Test consistency of processing after resume() assert_equals: construct time before resume expected 0.005804988662131519 but got 0 -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-retina/external/wpt/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt b/third_party/blink/web_tests/platform/mac-retina/external/wpt/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt deleted file mode 100644 index 0c2d95c..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/external/wpt/webrtc/RTCPeerConnection-perfect-negotiation.https-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -PASS Perfect negotiation setup connects -PASS Perfect negotiation setup connects with roles reversed -FAIL Perfect negotiation glare assert_equals: negotiationneeded always fires in stable state expected "stable" but got "have-remote-offer" -FAIL Perfect negotiation glare with roles reversed assert_unreached: Error in iframe: Error: negotiationneeded always fires in stable state expected stable but got have-remote-offer Reached unreachable code -FAIL Perfect negotiation stress glare assert_unreached: Error in iframe: Error: onmessage SLD worked expected answer but got offer Reached unreachable code -FAIL Perfect negotiation stress glare with roles reversed assert_unreached: Error in iframe: Error: negotiationneeded always fires in stable state expected stable but got have-remote-offer Reached unreachable code -FAIL Perfect negotiation stress glare linear assert_unreached: Error in iframe: Error: onmessage SLD worked expected answer but got offer Reached unreachable code -FAIL Perfect negotiation stress glare linear with roles reversed assert_unreached: Error in iframe: Error: negotiationneeded always fires in stable state expected stable but got have-remote-offer Reached unreachable code -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/button/button-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/button/button-appearance-basic-expected.png deleted file mode 100644 index db92103..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/button/button-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png deleted file mode 100644 index 27c4ab0..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png deleted file mode 100644 index b58d39c..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png deleted file mode 100644 index e8b5811..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png deleted file mode 100644 index 2c95c70..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png deleted file mode 100644 index ca3ec0d..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png deleted file mode 100644 index 982a9482..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png deleted file mode 100644 index b3ac421e..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/svg/custom/svg-fonts-in-html-expected.png b/third_party/blink/web_tests/platform/mac-retina/svg/custom/svg-fonts-in-html-expected.png deleted file mode 100644 index 0ef32ad..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/svg/custom/svg-fonts-in-html-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/button/button-pressed-state-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/button/button-pressed-state-expected.png deleted file mode 100644 index 0d5e2e2..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/button/button-pressed-state-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/checkbox/checkbox-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/checkbox/checkbox-appearance-basic-expected.png deleted file mode 100644 index 11769f8e..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/checkbox/checkbox-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-picker-appearance-expected.png deleted file mode 100644 index c070e4e..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-picker-appearance-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png deleted file mode 100644 index e98c383..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png deleted file mode 100644 index 27c4ab0..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/file/file-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/file/file-appearance-basic-expected.png deleted file mode 100644 index 9d8f436..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/file/file-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png deleted file mode 100644 index b58d39c..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/meter/meter-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/progress/progress-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/progress/progress-appearance-basic-expected.png deleted file mode 100644 index 478f8510..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/progress/progress-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png deleted file mode 100644 index e8b5811..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/radio/radio-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-zoom-2x-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-zoom-2x-expected.png deleted file mode 100644 index 0433490..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-zoom-2x-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-appearance-after-closing-popup-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-appearance-after-closing-popup-expected.png deleted file mode 100644 index 982a9482..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-appearance-after-closing-popup-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png deleted file mode 100644 index 299681d1..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/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/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index c70092c..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/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-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png deleted file mode 100644 index 2c95c70..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-focused-unselected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png deleted file mode 100644 index 06378e10f..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png deleted file mode 100644 index ca3ec0d..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png deleted file mode 100644 index 982a9482..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text-selection-outside-control-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text-selection-outside-control-expected.png deleted file mode 100644 index 330eee3..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text-selection-outside-control-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png deleted file mode 100644 index b3ac421e..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/fast/forms/color-scheme/text/input-basic-box-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/scrollbar/scrollbar-middle-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/scrollbar/scrollbar-middle-expected.png deleted file mode 100644 index 112ad74..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/controls-refresh-hc/scrollbar/scrollbar-middle-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png deleted file mode 100644 index e98c383..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png deleted file mode 100644 index 27c4ab0..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/eye-dropper/fast/forms/color-scheme/color/color-suggestion-picker-appearance-with-scrollbar-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png deleted file mode 100644 index da30bae..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png deleted file mode 100644 index 299681d1..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/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/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png deleted file mode 100644 index c70092c..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/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-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png deleted file mode 100644 index 06378e10f..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-selected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png deleted file mode 100644 index ca3ec0d..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-hover-unselected-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png deleted file mode 100644 index fce436f..0000000 --- a/third_party/blink/web_tests/platform/mac-retina/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-popup-appearance-basic-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/compositing/layer-creation/overflow-scroll-overlap-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/layer-creation/overflow-scroll-overlap-expected.txt new file mode 100644 index 0000000..24c0ac7 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/layer-creation/overflow-scroll-overlap-expected.txt
@@ -0,0 +1,65 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='composited'", + "bounds": [30, 30], + "contentsOpaque": true, + "backgroundColor": "#808080", + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='scroller' class='overflow'", + "bounds": [306, 206], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "position": [3, 3], + "bounds": [285, 365], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [288, 3], + "bounds": [15, 200], + "transform": 2 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [20, 20, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -49, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/compositing/layer-creation/scroll-partial-update-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/layer-creation/scroll-partial-update-expected.txt new file mode 100644 index 0000000..7b2227ab --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/layer-creation/scroll-partial-update-expected.txt
@@ -0,0 +1,71 @@ +scroll me +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='composited'", + "bounds": [20, 20], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='overlay')", + "position": [2, 0], + "bounds": [400, 204], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow DIV id='scroller'", + "bounds": [200, 200], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [185, 400], + "backgroundColor": "#FFFF0080", + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 200], + "transform": 2 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [202, 10, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/compositing/overflow/nested-render-surfaces-with-rotation-expected.png b/third_party/blink/web_tests/platform/mac/compositing/overflow/nested-render-surfaces-with-rotation-expected.png index 1d9447e..c5c8929a 100644 --- a/third_party/blink/web_tests/platform/mac/compositing/overflow/nested-render-surfaces-with-rotation-expected.png +++ b/third_party/blink/web_tests/platform/mac/compositing/overflow/nested-render-surfaces-with-rotation-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-expected.txt new file mode 100644 index 0000000..3fe8b77 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-expected.txt
@@ -0,0 +1,50 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='scroller'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 1000], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt new file mode 100644 index 0000000..3fe8b77 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
@@ -0,0 +1,50 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='scroller'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 1000], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-overlay-with-touch-expected.txt new file mode 100644 index 0000000..3fe8b77 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/overflow/overflow-overlay-with-touch-expected.txt
@@ -0,0 +1,50 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='scroller'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 1000], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt b/third_party/blink/web_tests/platform/mac/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt new file mode 100644 index 0000000..4374f06b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/compositing/squashing/invalidations-with-large-negative-margin-inline-content-expected.txt
@@ -0,0 +1,53 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV", + "bounds": [600, 200], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [585, 500], + "invalidations": [ + [400, 100, 20, 20] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [585, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [585, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [585, 185], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-contenteditable-expected.png b/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-contenteditable-expected.png index f9ccb4f..11460bb 100644 --- a/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-contenteditable-expected.png +++ b/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-contenteditable-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png b/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png index 5c2f4de7..e7b3757 100644 --- a/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png +++ b/third_party/blink/web_tests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt b/third_party/blink/web_tests/platform/mac/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt new file mode 100644 index 0000000..64a7ef2 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/fast/borders/overflow-hidden-border-radius-force-backing-store-expected.txt
@@ -0,0 +1,39 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='inner'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 300], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow DIV id='content'", + "bounds": [285, 1000], + "contentsOpaque": true, + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [50, 50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/fast/box-shadow/box-shadow-expected.png b/third_party/blink/web_tests/platform/mac/fast/box-shadow/box-shadow-expected.png index 79aa74d..f34462d 100644 --- a/third_party/blink/web_tests/platform/mac/fast/box-shadow/box-shadow-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/box-shadow/box-shadow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/clip/nestedTransparencyClip-expected.png b/third_party/blink/web_tests/platform/mac/fast/clip/nestedTransparencyClip-expected.png index 3825a9b..98a8e4e 100644 --- a/third_party/blink/web_tests/platform/mac/fast/clip/nestedTransparencyClip-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/clip/nestedTransparencyClip-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt b/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt new file mode 100644 index 0000000..42dc92b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-iframes-expected.txt
@@ -0,0 +1,14 @@ +This tests verifies the hit test regions given to the compositor when non-composited iframes are involved. It can only be run in DumpRenderTree. The outputted rects should cover the hit test regions of all the listed elements. Enable visualize mode to quickly validate graphically. + +iframe: layer(385x98) has hit test rect (13,33 290x22) + +iframe-nested: layer(335x98) has hit test rect (13,33 290x22) + +iframe-transform: layer(385x98) has hit test rect (13,33 290x22) + +iframe-fixed: layer(332x22) has hit test rect (0,0 332x22) + +iframe-doc: layer(400x25) has hit test rect (0,0 385x25) +iframe-doc: layer(385x58) has hit test rect (0,0 385x58) + +
diff --git a/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt b/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt new file mode 100644 index 0000000..a76ccce --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/fast/events/touch/compositor-touch-hit-rects-non-composited-scroll-overflow-with-handler-expected.txt
@@ -0,0 +1,5 @@ +notclipped: layer(285x200) has hit test rect (0,50 200x25) + +clipped: layer(285x200) has hit test rect (0,175 200x25) + +
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-appearance-expected.png index ae72f250..991c592 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-appearance-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png index 8138b2d..1262a2a5 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/calendar-picker/date-picker-month-selection-changed-appearance-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 299681d1..23a5832 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 a1f57d3..781667b 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/control-clip-overflow-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/control-clip-overflow-expected.png index 8b1e861..592e5fd5 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/control-clip-overflow-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/control-clip-overflow-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/focus-rect/textarea-scrolled-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/focus-rect/textarea-scrolled-focus-ring-expected.png index 680c7d42..231e681 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/focus-rect/textarea-scrolled-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/focus-rect/textarea-scrolled-focus-ring-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 8eeb70d..b2268dd 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 2a2d3d37..352f206 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 43ca74d..82751a6f 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 fd3a3704..2d042fe 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/forms/textarea/basic-textareas-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png index d0dcb04..381fa20 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png index d8facb8..56b3a3e 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/basic-textareas-quirks-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrollbar-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrollbar-expected.png index 4ccb966..b60d1faf 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrollbar-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrollbar-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png index bd6278c..253b481e 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-focus-ring-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-type-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-type-expected.png index 952d468..1fb3ca9 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-type-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/textarea/textarea-scrolled-type-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png b/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png index a260436..aa654aae 100644 --- a/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-expected.png b/third_party/blink/web_tests/platform/mac/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-expected.png index 4ea11765..9ace5ce 100644 --- a/third_party/blink/web_tests/platform/mac/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/hidpi/scrollbar-appearance-increase-device-scale-factor-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 5159ec1..94157645 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/overflow/overflow-of-video-outline-expected.png b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-of-video-outline-expected.png index 0c559777..6b71c1f 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/overflow/overflow-update-transform-expected.png b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png index f13ddef..de77059d 100644 --- a/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/overflow/overflow-update-transform-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 dbcd3eb..b3936e83 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/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png b/third_party/blink/web_tests/platform/mac/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png index 0c991dea..7e33bb6 100644 --- a/third_party/blink/web_tests/platform/mac/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png +++ b/third_party/blink/web_tests/platform/mac/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..f6dcf57 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/images/color-profile-svg-foreign-object-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 6ea7e04..b1729c1 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/controls-layout-direction-expected.png b/third_party/blink/web_tests/platform/mac/media/controls-layout-direction-expected.png index 936569e..2959460 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/media-controls-clone-expected.png b/third_party/blink/web_tests/platform/mac/media/media-controls-clone-expected.png index 59fe10d..60a2818 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 7495290..98e9d38 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 c399b8d..0222d0db 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 c6380b1..6a09559d 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/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt index 407f5d9d..ce737e6 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/iframe-inside-squashed-layer-expected.txt
@@ -18,12 +18,22 @@ "position": [0, -8], "bounds": [300, 654], "invalidations": [ - [8, 508, 31, 18], - [285, 500, 15, 150] + [8, 508, 31, 18] ], "transform": 1 }, { + "name": "Scrolling Contents Layer", + "bounds": [285, 216], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 150], + "transform": 2 + }, + { "name": "ContentsLayer for Vertical Scrollbar Layer", "position": [785, 0], "bounds": [15, 600], @@ -39,6 +49,15 @@ [0, 0, 1, 0], [8, 8, 0, 1] ] + }, + { + "id": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 500, 0, 1] + ] } ] }
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt new file mode 100644 index 0000000..b07ea9c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/invalidations-with-large-negative-margin-expected.txt
@@ -0,0 +1,54 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV", + "bounds": [600, 200], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [585, 400], + "invalidations": [ + [400, 0, 50, 50], + [0, 0, 50, 50] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [585, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [585, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [585, 185], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt new file mode 100644 index 0000000..43310aa --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/repaint-overflow-scrolled-squashed-content-expected.txt
@@ -0,0 +1,60 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV", + "bounds": [200, 200], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [185, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [185, 185], + "bounds": [15, 15], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow DIV id='foo2'", + "bounds": [150, 1000], + "contentsOpaque": true, + "backgroundColor": "#ADD8E6", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='foo')", + "bounds": [100, 1000], + "invalidations": [ + [0, 0, 100, 1000] + ], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-color-change-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-color-change-expected.txt index a2778e68..dc35a27 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-color-change-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-color-change-expected.txt
@@ -4,9 +4,48 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow PRE id='scroller'", + "bounds": [200, 200], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [185, 615], "invalidations": [ - [8, 57, 47, 185] + [0, 0, 47, 615] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [185, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [185, 185], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 57, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.png b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.png index 5bc23811..c28da73 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.png +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.txt index 55f5ee10..71ccc50 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/text-match-highlight-expected.txt
@@ -6,14 +6,55 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [10, 126, 227, 18], - [20, 214, 200, 72], - [10, 180, 139, 12], - [268, 54, 46, 18], - [90, 54, 46, 18], - [282, 36, 45, 18], - [224, 54, 45, 18], - [52, 72, 45, 18] + [282, 36, 45, 18] + ] + }, + { + "name": "LayoutNGBlockFlow DIV", + "bounds": [800, 500], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [785, 1340], + "invalidations": [ + [10, 72, 227, 18], + [20, 160, 200, 72], + [10, 126, 139, 12], + [268, 0, 46, 18], + [90, 0, 46, 18], + [224, 0, 45, 18], + [52, 18, 45, 18] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 485], + "bounds": [785, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 485], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [785, 485], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 54, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt index a7a36ae..d3f2950b 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-and-content-expected.txt
@@ -4,19 +4,70 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='container'", + "bounds": [200, 200], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [185, 234], "invalidations": [ - [8, 275, 75, 18], - [8, 257, 75, 18], - [8, 239, 75, 18], - [8, 221, 75, 18], - [8, 203, 75, 18], - [8, 185, 75, 18], - [8, 167, 75, 18], - [8, 149, 75, 18], - [8, 131, 75, 18], - [8, 113, 75, 18], - [8, 108, 75, 5] + [0, 216, 75, 18], + [0, 198, 75, 18], + [0, 180, 75, 18], + [0, 162, 75, 18], + [0, 144, 75, 18], + [0, 126, 75, 18], + [0, 108, 75, 18], + [0, 90, 75, 18], + [0, 72, 75, 18], + [0, 54, 75, 18], + [0, 36, 75, 18], + [0, 18, 75, 18], + [0, 0, 75, 18] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [185, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [185, 185], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 108, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -49, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-expected.txt new file mode 100644 index 0000000..98ea9d6 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/compositing/updating-scrolling-container-expected.txt
@@ -0,0 +1,54 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='container'", + "bounds": [210, 210], + "invalidations": [ + [0, 0, 210, 210] + ], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [5, 5], + "bounds": [400, 400], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [5, 190], + "bounds": [185, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [190, 5], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [190, 190], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 108, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/flexbox/scrollbars-changed-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/flexbox/scrollbars-changed-expected.txt new file mode 100644 index 0000000..54a7084c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/flexbox/scrollbars-changed-expected.txt
@@ -0,0 +1,28 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='scroller'", + "bounds": [200, 100] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [185, 210], + "backgroundColor": "#80808080", + "invalidations": [ + [0, 5, 15, 15] + ] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 100] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/float-offscreen-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/float-offscreen-expected.txt index 9da76a0..5c83202 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/float-offscreen-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/float-offscreen-expected.txt
@@ -4,9 +4,39 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "invalidations": [ - [11, 11, 69, 21] + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='target'", + "bounds": [784, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [784, 1027], + "transform": 1 + }, + { + "name": "Horizontal Scrollbar Layer", + "position": [0, 300], + "bounds": [784, 0], + "transform": 1 + }, + { + "name": "Vertical Scrollbar Layer", + "position": [784, 0], + "bounds": [0, 300], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/forms/textarea-caret-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/forms/textarea-caret-expected.txt index 90a10e9..df14160 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/forms/textarea-caret-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/forms/textarea-caret-expected.txt
@@ -6,7 +6,71 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [6, 6, 185, 40] + [8, 8, 181, 36] + ] + }, + { + "name": "LayoutTextControl TEXTAREA id='editor'", + "position": [-2, -2], + "bounds": [185, 40], + "invalidations": [ + [0, 0, 185, 40] + ], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [470, 19], + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 470, 19] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [1, 20], + "bounds": [164, 15], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [165, 20], + "bounds": [15, 15], + "invalidations": [ + [0, 0, 15, 15] + ], + "transform": 1 + }, + { + "name": "Decoration Layer", + "position": [-2, -2], + "bounds": [185, 40], + "invalidations": [ + [0, 0, 185, 40] + ], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-291, 0, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/line-flow-with-floats-9-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/line-flow-with-floats-9-expected.txt index 444f9a3..d68020b 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/line-flow-with-floats-9-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/line-flow-with-floats-9-expected.txt
@@ -6,10 +6,17 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 572, 440, 18], - [8, 74, 418, 516], - [485, 0, 15, 600] + [8, 18, 440, 554] ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [485, 606] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [485, 0], + "bounds": [15, 600] } ] }
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-child-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-child-expected.txt new file mode 100644 index 0000000..bcdd642 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-child-expected.txt
@@ -0,0 +1,64 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='container'", + "bounds": [302, 202], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [2100, 185], + "invalidations": [ + [2000, 0, 100, 100] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [1, 186], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [286, 1], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [286, 186], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [28, 20, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-1815, 0, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-parent-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-parent-expected.txt new file mode 100644 index 0000000..450ee51 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-parent-expected.txt
@@ -0,0 +1,54 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='container'", + "bounds": [302, 202], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [2100, 185], + "invalidations": [ + [0, 0, 100, 100] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [1, 186], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [286, 1], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [286, 186], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [28, 28, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-same-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-same-expected.txt new file mode 100644 index 0000000..c59b6fb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/overflow/vertical-overflow-same-expected.txt
@@ -0,0 +1,54 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV class='vertical-rl container'", + "bounds": [302, 202], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [2100, 185], + "invalidations": [ + [0, 0, 100, 100] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [1, 186], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [286, 1], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [286, 186], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [28, 20, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/position/layout-state-only-positioned-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/layout-state-only-positioned-expected.txt new file mode 100644 index 0000000..1761aae --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/position/layout-state-only-positioned-expected.txt
@@ -0,0 +1,45 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 50, 106, 106] + ] + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV", + "bounds": [106, 106], + "invalidations": [ + [0, 0, 106, 106] + ], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [3, 3], + "bounds": [100, 200], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [88, 3], + "bounds": [15, 100], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/resize-iframe-text-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/resize-iframe-text-expected.txt new file mode 100644 index 0000000..0a4aad8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/resize-iframe-text-expected.txt
@@ -0,0 +1,14 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [500, 400], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 200, 500, 200] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-overlay-scrollbar-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-scrollbar-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-scrollbar-expected.txt new file mode 100644 index 0000000..c543542 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/destroy-scrollbar-expected.txt
@@ -0,0 +1,11 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt new file mode 100644 index 0000000..ed0997d --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-child-of-transformed-scrolled-expected.txt
@@ -0,0 +1,63 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='transformed'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 1000], + "invalidations": [ + [100, 150, 100, 100] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [100, 50, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt new file mode 100644 index 0000000..38ca408 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/fixed-descendant-of-transformed-scrolled-expected.txt
@@ -0,0 +1,63 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='transformed'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1050, 1050], + "invalidations": [ + [100, 150, 100, 100] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [100, 50, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt new file mode 100644 index 0000000..fbf8b0db --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/iframe-scrollbar-hover-expected.txt
@@ -0,0 +1,33 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "Scrolling Contents Layer", + "bounds": [185, 316], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [185, 0], + "bounds": [15, 200], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [2, 102, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt index 98935c1..a4d3ea6 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/outline-change-in-scrollers-expected.txt
@@ -6,12 +6,214 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [286, 172, 75, 75], - [286, 18, 75, 75], - [172, 172, 75, 75], - [172, 18, 75, 75], - [53, 152, 75, 75], - [18, 18, 75, 75] + [172, 172, 75, 75] + ] + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='scroll'", + "bounds": [130, 130], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [150, 150], + "invalidations": [ + [0, 0, 75, 75] + ], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [10, 105], + "bounds": [95, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [105, 10], + "bounds": [15, 95], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [105, 105], + "bounds": [15, 15], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='scroll'", + "bounds": [130, 130], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [95, 150], + "invalidations": [ + [20, 0, 75, 75] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [10, 105], + "bounds": [95, 15], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [105, 10], + "bounds": [15, 95], + "transform": 2 + }, + { + "name": "Scroll Corner Layer", + "position": [105, 105], + "bounds": [15, 15], + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='scroll'", + "bounds": [130, 130], + "transform": 3 + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [150, 150], + "invalidations": [ + [0, 0, 75, 75] + ], + "transform": 3 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [10, 105], + "bounds": [95, 15], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [105, 10], + "bounds": [15, 95], + "transform": 3 + }, + { + "name": "Scroll Corner Layer", + "position": [105, 105], + "bounds": [15, 15], + "transform": 3 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='scroll'", + "bounds": [130, 130], + "transform": 4 + }, + { + "name": "Scrolling Contents Layer", + "position": [25, 10], + "bounds": [95, 150], + "invalidations": [ + [20, 0, 75, 75] + ], + "transform": 4 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [25, 105], + "bounds": [95, 15], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [10, 10], + "bounds": [15, 95], + "transform": 4 + }, + { + "name": "Scroll Corner Layer", + "position": [10, 105], + "bounds": [15, 15], + "transform": 4 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='scroll'", + "bounds": [130, 130], + "transform": 5 + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [150, 95], + "invalidations": [ + [0, 20, 75, 75] + ], + "transform": 5 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [10, 105], + "bounds": [95, 15], + "transform": 5 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [105, 10], + "bounds": [15, 95], + "transform": 5 + }, + { + "name": "Scroll Corner Layer", + "position": [105, 105], + "bounds": [15, 15], + "transform": 5 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [142, 8, 0, 1] + ] + }, + { + "id": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [276, 8, 0, 1] + ] + }, + { + "id": 4, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 142, 0, 1] + ] + }, + { + "id": 5, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [276, 142, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt new file mode 100644 index 0000000..a872fb78 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-auto-in-overflow-auto-scrolled-expected.txt
@@ -0,0 +1,84 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='outerDiv'", + "bounds": [784, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [769, 700], + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow DIV id='innerDiv'", + "bounds": [769, 400], + "transform": 3 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [754, 800], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [754, 0], + "bounds": [15, 400], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [769, 0], + "bounds": [15, 300], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -300, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 300, 0, 1] + ] + }, + { + "id": 4, + "parent": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -400, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt new file mode 100644 index 0000000..3b3f003 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-composited-non-stacking-child-expected.txt
@@ -0,0 +1,94 @@ +{ + "layers": [ + { + "name": "LayoutNGBlockFlow HTML", + "bounds": [800, 268] + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV class='back'", + "position": [75, 65], + "bounds": [180, 100], + "contentsOpaque": true, + "backgroundColor": "#CCDDCC", + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow HTML (foreground) Layer", + "bounds": [800, 268] + }, + { + "name": "LayoutNGBlockFlow DIV class='scroller'", + "bounds": [310, 200], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [5, 180], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [290, 5], + "bounds": [15, 175], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [290, 180], + "bounds": [15, 15], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV class='icon'", + "bounds": [40, 40], + "contentsOpaque": true, + "backgroundColor": "#FFDDBB", + "transform": 3 + }, + { + "name": "LayoutNGBlockFlow (relative positioned) DIV class='list'", + "position": [25, 25], + "bounds": [180, 250], + "drawsContent": false, + "transform": 2 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (relative positioned) DIV class='commit')", + "position": [25, 25], + "bounds": [180, 250], + "transform": 2 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [18, 60, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -50, 0, 1] + ] + }, + { + "id": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [200, 10, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-delete-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-delete-expected.txt index 29d05cc..03f2afb 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-delete-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-delete-expected.txt
@@ -4,9 +4,46 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='t'", + "bounds": [80, 69], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [65, 198], "invalidations": [ - [8, 112, 44, 35] + [0, 162, 44, 36] + ], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [65, 0], + "bounds": [15, 69], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 78, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -128, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt new file mode 100644 index 0000000..cb445fe --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/overflow-scroll-in-overflow-scroll-scrolled-expected.txt
@@ -0,0 +1,84 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='outerDiv'", + "bounds": [784, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [769, 700], + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow DIV id='innerDiv'", + "bounds": [769, 400], + "transform": 3 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [754, 800], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [754, 0], + "bounds": [15, 400], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [769, 0], + "bounds": [15, 300], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -320, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 300, 0, 1] + ] + }, + { + "id": 4, + "parent": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -400, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt new file mode 100644 index 0000000..19abd96 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/repaint-composited-child-in-scrolled-container-expected.txt
@@ -0,0 +1,81 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='outer'", + "bounds": [300, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [650, 600], + "backgroundColor": "#0000FF80", + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='container'", + "bounds": [600, 600], + "contentsOpaque": true, + "backgroundColor": "#FF0000", + "invalidations": [ + [0, 0, 600, 600] + ], + "transform": 3 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-365, 0, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [50, 0, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt new file mode 100644 index 0000000..403de2c8 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/resize-scrollable-iframe-expected.txt
@@ -0,0 +1,45 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1008, 1016], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 285], + "bounds": [285, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 285], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [285, 285], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 108, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt new file mode 100644 index 0000000..725212e6 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-ancestor-clip-change-expected.txt
@@ -0,0 +1,50 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='target'", + "bounds": [100, 200], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [400, 400], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 185], + "bounds": [85, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [85, 0], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [85, 185], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt new file mode 100644 index 0000000..8260b99 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint-expected.txt
@@ -0,0 +1,55 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [1000, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "Scrolling Contents Layer", + "bounds": [1000, 600] + }, + { + "name": "LayoutNGBlockFlow DIV id='container'", + "bounds": [202, 202], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [2000, 2000], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [1, 186], + "bounds": [185, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [186, 1], + "bounds": [15, 185], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [186, 186], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 50, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-parts-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-parts-expected.txt new file mode 100644 index 0000000..f880b7b --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/scrollbar-parts-expected.txt
@@ -0,0 +1,50 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV", + "bounds": [100, 100], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [150, 300], + "transform": 1 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 85], + "bounds": [85, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [85, 0], + "bounds": [15, 85], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [85, 85], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt index 4c0135f..b5042ab 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/scroll/sticky/invalidate-after-composited-scroll-with-sticky-expected.txt
@@ -4,10 +4,23 @@ "name": "Scrolling Contents Layer", "bounds": [785, 656], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "invalidations": [ - [353, 8, 15, 640] - ] + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow MAT id='scroller'", + "bounds": [360, 640], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [345, 2018], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [345, 0], + "bounds": [15, 640], + "transform": 2 }, { "name": "LayoutNGBlockFlow (sticky positioned) DIV id='sticky'",
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt index 558d0b9..95da955e 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 8, 48, 33] + [8, 8, 48, 32], + [40, 8, 16, 33] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt index 1bb24bd..291a6fb1 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-lr-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [8, 8, 33, 48] + [8, 40, 33, 16], + [8, 8, 32, 48] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt index 458670f..cdb3cf2 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/invalidation-rect-includes-newline-for-vertical-rl-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [7, 8, 33, 48] + [7, 40, 33, 16], + [8, 8, 32, 48] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index 618857ac..f135e44 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [288, 123, 489, 399] + [288, 515, 489, 7], + [381, 123, 396, 399] ] } ]
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 56d84af22..8159177 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/paint/invalidation/table/scroll-inside-table-cell-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/scroll-inside-table-cell-expected.txt new file mode 100644 index 0000000..2d9e7eb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/scroll-inside-table-cell-expected.txt
@@ -0,0 +1,61 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGTableCell (relative positioned) TD id='cellToScroll' class='relative'", + "bounds": [454, 469], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [2, 2], + "bounds": [950, 450], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [2, 452], + "bounds": [435, 15], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [437, 2], + "bounds": [15, 450], + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [437, 452], + "bounds": [15, 15], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [312, 112, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-515, 0, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt new file mode 100644 index 0000000..b0b8a8c --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/scroll-relative-table-inside-table-cell-expected.txt
@@ -0,0 +1,89 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [1566, 1781], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "transform": 1 + }, + { + "name": "LayoutNGTableCell (relative positioned) TD id='cellToScroll' class='relative'", + "bounds": [454, 469], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "position": [2, 2], + "bounds": [950, 450], + "transform": 3 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [2, 452], + "bounds": [435, 15], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [437, 2], + "bounds": [15, 450], + "transform": 2 + }, + { + "name": "Scroll Corner Layer", + "position": [437, 452], + "bounds": [15, 15], + "transform": 2 + }, + { + "name": "ContentsLayer for Horizontal Scrollbar Layer", + "position": [0, 585], + "bounds": [785, 15], + "contentsOpaque": true + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 585], + "contentsOpaque": true + }, + { + "name": "Scroll Corner Layer", + "position": [785, 585], + "bounds": [15, 15] + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-781, -1196, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [1112, 1312, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [-515, 0, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt new file mode 100644 index 0000000..0f139ef --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-auto-in-overflow-auto-scrolled-expected.txt
@@ -0,0 +1,84 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='outerDiv'", + "bounds": [784, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [769, 700], + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow DIV id='innerDiv'", + "bounds": [769, 400], + "transform": 3 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [754, 810], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [754, 0], + "bounds": [15, 400], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [769, 0], + "bounds": [15, 300], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -320, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 300, 0, 1] + ] + }, + { + "id": 4, + "parent": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -400, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt new file mode 100644 index 0000000..0f139ef --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/table/table-overflow-scroll-in-overflow-scroll-scrolled-expected.txt
@@ -0,0 +1,84 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='outerDiv'", + "bounds": [784, 300], + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [769, 700], + "transform": 2 + }, + { + "name": "LayoutNGBlockFlow DIV id='innerDiv'", + "bounds": [769, 400], + "transform": 3 + }, + { + "name": "Scrolling Contents Layer", + "bounds": [754, 810], + "transform": 4 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [754, 0], + "bounds": [15, 400], + "transform": 3 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [769, 0], + "bounds": [15, 300], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [8, 8, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -320, 0, 1] + ] + }, + { + "id": 3, + "parent": 2, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 300, 0, 1] + ] + }, + { + "id": 4, + "parent": 3, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -400, 0, 1] + ] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/text-match-document-change-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/text-match-document-change-expected.txt index ef30dc2b..d8f2f91e 100644 --- a/third_party/blink/web_tests/platform/mac/paint/invalidation/text-match-document-change-expected.txt +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/text-match-document-change-expected.txt
@@ -4,10 +4,28 @@ "name": "Scrolling Contents Layer", "bounds": [800, 600], "contentsOpaque": true, - "backgroundColor": "#FFFFFF", - "invalidations": [ - [18, 128, 256, 36], - [295, 102, 15, 400] + "backgroundColor": "#FFFFFF" + }, + { + "name": "Scrolling Contents Layer", + "bounds": [285, 1052], + "transform": 1 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [285, 0], + "bounds": [15, 400], + "transform": 1 + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [10, 102, 0, 1] ] } ]
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt new file mode 100644 index 0000000..acf0355e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-centered-expected.txt
@@ -0,0 +1,69 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [600, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 600, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [600, 250] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [400, 250] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [400, 600] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 800, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt new file mode 100644 index 0000000..acf0355e --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-generated-expected.txt
@@ -0,0 +1,69 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [600, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 600, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [600, 250] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [400, 250] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [400, 600] + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 800, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600] + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt new file mode 100644 index 0000000..fbc9fd9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/paint/invalidation/window-resize/window-resize-background-image-fixed-scrolling-contents-expected.txt
@@ -0,0 +1,93 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [600, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 600, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [585, 3016] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [585, 0], + "bounds": [15, 250], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 250], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 250] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [385, 3016] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [385, 0], + "bounds": [15, 250], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [400, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 400, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [385, 3016] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [385, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ] +} +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF", + "invalidations": [ + [0, 0, 800, 600] + ] + }, + { + "name": "Scrolling Contents Layer", + "bounds": [785, 3016] + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [785, 0], + "bounds": [15, 600], + "contentsOpaque": true + } + ] +} +
diff --git a/third_party/blink/web_tests/platform/mac/scrollbars/auto-scrollbar-fades-out-expected.png b/third_party/blink/web_tests/platform/mac/scrollbars/auto-scrollbar-fades-out-expected.png new file mode 100644 index 0000000..62578cc3 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/scrollbars/auto-scrollbar-fades-out-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png b/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png new file mode 100644 index 0000000..6c6c3d3 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt b/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt new file mode 100644 index 0000000..b355d28 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/scrollbars/overlay-scrollbars-within-overflow-scroll-expected.txt
@@ -0,0 +1,64 @@ +{ + "layers": [ + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow DIV id='outer'", + "bounds": [402, 302] + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [400, 602], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow DIV id='inner'", + "bounds": [102, 102], + "transform": 2 + }, + { + "name": "Scrolling Contents Layer", + "position": [1, 1], + "bounds": [100, 500], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [94, 1], + "bounds": [7, 100], + "transform": 2 + }, + { + "name": "ContentsLayer for Vertical Scrollbar Layer", + "position": [394, 1], + "bounds": [7, 300] + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -302, 0, 1] + ] + }, + { + "id": 2, + "parent": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [1, 501, 0, 1] + ] + } + ] +} +
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 ae2b041..c396c630 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/batik/text/verticalText-expected.png b/third_party/blink/web_tests/platform/mac/svg/batik/text/verticalText-expected.png index 1579827e..f66bc22 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 ac0e003..172e1de 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/getscreenctm-in-scrollable-div-area-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/getscreenctm-in-scrollable-div-area-expected.png index e0ebe01..ba11013 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/getscreenctm-in-scrollable-div-area-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/getscreenctm-in-scrollable-div-area-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 6d6d188..89a2feac 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/svg/wicd/test-scalable-background-image2-expected.png b/third_party/blink/web_tests/platform/mac/svg/wicd/test-scalable-background-image2-expected.png index 832ca090..6aa6242 100644 --- a/third_party/blink/web_tests/platform/mac/svg/wicd/test-scalable-background-image2-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/wicd/test-scalable-background-image2-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 ce866d95..1ce9b39 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/virtual/cascade/fast/forms/select/basic-selects-expected.png b/third_party/blink/web_tests/platform/mac/virtual/cascade/fast/forms/select/basic-selects-expected.png index 8eeb70d..b2268dd 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/cascade/fast/forms/select/basic-selects-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/cascade/fast/forms/select/basic-selects-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 299681d1..23a5832 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/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/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index a1f57d3..781667b 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/controls-refresh-hc/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/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 4f58000..ce8a51a 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 1cdafa8..42dd53b8 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/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 bef0c00..d2880c4 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 a14bb19..eefb64d 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 14afcdb..0d6a11cd 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/exotic-color-space/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..dba1431 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/virtual/exotic-color-space/images/color-profile-svg-foreign-object-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-expected.png b/third_party/blink/web_tests/platform/mac/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-expected.png new file mode 100644 index 0000000..5aef6cb --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/virtual/gpu-rasterization/images/color-profile-svg-foreign-object-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 562f5c3..befe4c2d 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 1c35f81..2a6aeab2 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/mac/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png index 299681d1..23a5832 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-inpage-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/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/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png b/third_party/blink/web_tests/platform/mac/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png index a1f57d3..781667b 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/use-common-select-popup/fast/forms/color-scheme/select/select-multiple-appearance-basic-expected.png +++ b/third_party/blink/web_tests/platform/mac/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/win/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/platform/win/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index b49a1c9..17e287c9 100644 --- a/third_party/blink/web_tests/platform/win/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/platform/win/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [307, 123, 470, 404] + [307, 522, 470, 5], + [369, 123, 408, 404] ] } ]
diff --git a/third_party/blink/web_tests/platform/win7/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt b/third_party/blink/web_tests/platform/win7/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt index 1fc5e11..662dad9 100644 --- a/third_party/blink/web_tests/platform/win7/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt +++ b/third_party/blink/web_tests/platform/win7/paint/invalidation/selection/japanese-rl-selection-clear-expected.txt
@@ -6,7 +6,8 @@ "contentsOpaque": true, "backgroundColor": "#FFFFFF", "invalidations": [ - [334, 123, 443, 404] + [334, 522, 443, 5], + [393, 123, 384, 404] ] } ]
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index c97b5f9..7b815d3 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -666,6 +666,7 @@ [Worker] method openCursor [Worker] method openKeyCursor [Worker] method put +[Worker] method putAll [Worker] setter name [Worker] interface IDBObservation [Worker] attribute @@toStringTag
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 a852e03..287a1ca 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
@@ -4411,6 +4411,7 @@ method openCursor method openKeyCursor method put + method putAll setter name interface IDBObservation attribute @@toStringTag
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index 129c04d9..3fb5b88 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -661,6 +661,7 @@ [Worker] method openCursor [Worker] method openKeyCursor [Worker] method put +[Worker] method putAll [Worker] setter name [Worker] interface IDBObservation [Worker] attribute @@toStringTag
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 51a4d68..85d3563 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-10-2-36-gb1286b32a -Revision: b1286b32a9f2bcba3f22c9857ba6df30733b7845 +Version: VER-2-10-2-37-gc922ffa5d +Revision: c922ffa5d2fe359d5e0d788f3a0850a59da4ae20 CPEPrefix: cpe:/a:freetype:freetype:2.10.1 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 8f1d17e..9fb3ecf 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -13516,6 +13516,7 @@ <int value="26" label="Crash.Chrome.MissedCrashes"/> <int value="27" label="Crash.Collector.CollectionCount"/> <int value="28" label="Cryptohome.DoubleMountRequest"/> + <int value="29" label="SessionManager.SafeModeEnabled"/> </enum> <enum name="CrosFirstRunTutorialCompletionType"> @@ -21136,6 +21137,7 @@ <int value="735" label="DeviceNativePrintersAllowlist"/> <int value="736" label="URLBlocklist"/> <int value="737" label="URLAllowlist"/> + <int value="738" label="ExtensionInstallAllowlist"/> </enum> <enum name="EnterprisePolicyDeviceIdValidity"> @@ -39943,6 +39945,7 @@ <int value="-1696619241" label="OmniboxWrapPopupPosition:disabled"/> <int value="-1696366449" label="disable-permissions-bubbles"/> <int value="-1695774453" label="skip-extra-ash-window-positioning"/> + <int value="-1693498375" label="CdmFactoryDaemon:enabled"/> <int value="-1692967465" label="ContextMenuPerformanceInfoAndRemoteHintFetching:enabled"/> <int value="-1692384483" label="disambiguate-autofill-server-name-types"/> @@ -41322,6 +41325,7 @@ <int value="-225505731" label="CCTModule:enabled"/> <int value="-222296540" label="VirtualKeyboardBorderedKey:disabled"/> <int value="-220599034" label="UsePdfCompositorServiceForPrint:enabled"/> + <int value="-217885320" label="CdmFactoryDaemon:disabled"/> <int value="-216219963" label="ash-shelf-color-scheme"/> <int value="-215580565" label="OmniboxEnableClipboardProviderImageSuggestions:disabled"/> @@ -44186,6 +44190,7 @@ <int value="5" label="Profile Chooser"/> <int value="6" label="Passwords Accessory Sheet"/> <int value="7" label="Touch To Fill"/> + <int value="8" label="Safe state bubble"/> </enum> <enum name="ManifestFetchResultType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 071fd36..c51c5272 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -105026,6 +105026,15 @@ </summary> </histogram> +<histogram name="Network.Shill.Cellular.ServiceErrors" + enum="NetworkServiceError" expires_after="2021-07-01"> + <owner>kuabhs@chromium.org</owner> + <owner>cros-network-metrics@google.com</owner> + <summary> + Chrome OS connection manager service errors for cellular interface. + </summary> +</histogram> + <histogram name="Network.Shill.Cellular.SignalStrengthBeforeDrop" units="units" expires_after="2020-12-01"> <owner>benchan@chromium.org</owner> @@ -105492,6 +105501,15 @@ </summary> </histogram> +<histogram name="Network.Shill.Ethernet.ServiceErrors" + enum="NetworkServiceError" expires_after="2021-07-01"> + <owner>kuabhs@chromium.org</owner> + <owner>cros-network-metrics@google.com</owner> + <summary> + Chrome OS connection manager service errors for ethernet interface. + </summary> +</histogram> + <histogram name="Network.Shill.Ethernet.TimeOnline" units="seconds" expires_after="2020-12-01"> <owner>benchan@chromium.org</owner> @@ -105662,9 +105680,12 @@ </histogram> <histogram name="Network.Shill.ServiceErrors" enum="NetworkServiceError" - expires_after="M85"> + expires_after="2021-07-01"> <owner>benchan@chromium.org</owner> - <summary>Chrome OS connection manager service errors seen.</summary> + <owner>cros-network-metrics@google.com</owner> + <summary> + Chrome OS connection manager service errors across all technologies. + </summary> </histogram> <histogram name="Network.Shill.ServicesOnSameNetwork" units="units" @@ -106444,6 +106465,15 @@ </summary> </histogram> +<histogram name="Network.Shill.Wifi.ServiceErrors" enum="NetworkServiceError" + expires_after="2021-07-01"> + <owner>kuabhs@chromium.org</owner> + <owner>cros-network-metrics@google.com</owner> + <summary> + Chrome OS connection manager service errors for wifi interface. + </summary> +</histogram> + <histogram base="true" name="Network.Shill.WiFi.SessionLength" units="ms" expires_after="2020-12-31"> <!-- Name completed by histogram_suffixes name="RoamSecurityType" --> @@ -129339,8 +129369,9 @@ </histogram> <histogram name="Platform.IntelMaxMicroArchitecture" - enum="IntelMaxMicroArchitecture" expires_after="M85"> + enum="IntelMaxMicroArchitecture" expires_after="2021-07-13"> <owner>fbarchard@chromium.org</owner> + <owner>pwnall@chromium.org</owner> <summary> The maximum supported micro-architecture on an Intel platform. This value is logged at program start time. @@ -146029,6 +146060,9 @@ <histogram name="SafeBrowsing.NotificationImageReporter.NetError" enum="NetErrorCodes" expires_after="M85"> + <obsolete> + Removed in M85+. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/perf/core/perf_benchmark.py b/tools/perf/core/perf_benchmark.py index abd0f0d..2968c81 100644 --- a/tools/perf/core/perf_benchmark.py +++ b/tools/perf/core/perf_benchmark.py
@@ -110,7 +110,7 @@ # skip this gpu process for all perf tests to prevent any interference # with the test results. browser_options.AppendExtraBrowserArgs( - '--disable-gpu-process-for-dx12-vulkan-info-collection') + '--disable-gpu-process-for-dx12-info-collection') self.SetExtraBrowserOptions(browser_options)
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index ec914a81..c18946d 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -1,16 +1,16 @@ { "trace_processor_shell": { "win": { - "hash": "b97d7a5fc2444f9b04590c3bcd3d47b026646787", - "remote_path": "perfetto_binaries/trace_processor_shell/win/6ef441ecad8e701f9f27d9539a51780e1a469488/trace_processor_shell.exe" + "hash": "f1007a52f9325c87a36af6253cad89cdcc7db17e", + "remote_path": "perfetto_binaries/trace_processor_shell/win/85cf057d6c800c6722161c2e190ee082f0262adb/trace_processor_shell.exe" }, "mac": { "hash": "16faf26a7fe008bb05baeebf3e739c75cf3dccce", "remote_path": "perfetto_binaries/trace_processor_shell/mac/af5653134716efec117a9428c7f9b44d3e5fbb1d/trace_processor_shell" }, "linux": { - "hash": "9ff6f6dcbc20a0e7ca8af95f453d9f6bd625d028", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/7d22cca0b49fb57933e504aed51f2fa600d4006e/trace_processor_shell" + "hash": "0cda4c1bf5f7b9a4c99f712de4491ced0e45fc60", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/85cf057d6c800c6722161c2e190ee082f0262adb/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/vim/chromium.ycm_extra_conf.py b/tools/vim/chromium.ycm_extra_conf.py index fb9c2b0a..e5ff531 100644 --- a/tools/vim/chromium.ycm_extra_conf.py +++ b/tools/vim/chromium.ycm_extra_conf.py
@@ -337,8 +337,10 @@ return GetClangOptionsFromCommandLine(clang_line, out_dir, additional_flags) +# FlagsForFile entrypoint is deprecated in YCM and has replaced by +# Settings. def FlagsForFile(filename): - """This is the main entry point for YCM. Its interface is fixed. + """This is the old entry point for YCM. Its interface is fixed. Args: filename: (String) Path to source file being edited. @@ -348,6 +350,11 @@ 'flags': (List of Strings) Command line flags. 'do_cache': (Boolean) True if the result should be cached. """ + return Settings(filename=filename) + + +def Settings(**kwargs): + filename = kwargs['filename'] abs_filename = os.path.abspath(filename) chrome_root = FindChromeSrcFromFilename(abs_filename) clang_flags = GetClangOptionsFromNinjaForFilename(chrome_root, abs_filename)
diff --git a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.cc b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.cc index 379fa00..ffc8556 100644 --- a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.cc +++ b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.cc
@@ -8,7 +8,9 @@ #include <vector> #include "base/i18n/string_search.h" +#include "base/win/scoped_safearray.h" #include "base/win/scoped_variant.h" +#include "base/win/variant_vector.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/platform/ax_platform_node_delegate.h" @@ -385,13 +387,14 @@ current_platform_node = static_cast<AXPlatformNodeWin*>( delegate->GetFromNodeID(current_start->GetAnchor()->id())); - base::win::ScopedVariant current_attribute_value; + base::win::VariantVector current_attribute_value; if (FAILED(current_platform_node->GetTextAttributeValue( - text_attribute_id, current_attribute_value.Receive()))) + text_attribute_id, current_start->text_offset(), + current_end->text_offset(), ¤t_attribute_value))) { return E_FAIL; + } - if (VARCMP_EQ == VarCmp(&attribute_val, current_attribute_value.AsInput(), - LOCALE_USER_DEFAULT, 0)) { + if (!current_attribute_value.Compare(attribute_val)) { // When we encounter an AXRange instance that matches the attribute // and its value which we are looking for and no previously matched text // range exists, we expand or initialize the matched range. @@ -469,10 +472,11 @@ UIA_VALIDATE_TEXTRANGEPROVIDER_CALL_1_OUT(value); NormalizeTextRange(); - base::win::ScopedVariant attribute_value_variant; + base::win::VariantVector attribute_value; // The range is inclusive, so advance our endpoint to the next position - auto end = end_->AsLeafTextPosition()->CreateNextAnchorPosition(); + const auto end_leaf_text_position = end_->AsLeafTextPosition(); + auto end = end_leaf_text_position->CreateNextAnchorPosition(); // Iterate over anchor positions for (auto it = start_->AsLeafTextPosition(); @@ -500,25 +504,34 @@ DCHECK(platform_node); } - base::win::ScopedVariant current_variant; + base::win::VariantVector current_value; + const bool at_end_leaf_text_anchor = + it->anchor_id() == end_leaf_text_position->anchor_id() && + it->tree_id() == end_leaf_text_position->tree_id(); + const base::Optional<int> start_offset = + it->IsTextPosition() ? base::make_optional(it->text_offset()) + : base::nullopt; + const base::Optional<int> end_offset = + at_end_leaf_text_anchor + ? base::make_optional(end_leaf_text_position->text_offset()) + : base::nullopt; HRESULT hr = platform_node->GetTextAttributeValue( - attribute_id, current_variant.Receive()); + attribute_id, start_offset, end_offset, ¤t_value); if (FAILED(hr)) return E_FAIL; - if (attribute_value_variant.type() == VT_EMPTY) { - attribute_value_variant.Reset(current_variant); - if (attribute_value_variant.type() == VT_UNKNOWN) { - *value = attribute_value_variant.Release(); - return S_OK; - } - } else if (attribute_value_variant.Compare(current_variant)) { + if (attribute_value.Type() == VT_EMPTY) { + attribute_value = std::move(current_value); + } else if (attribute_value != current_value) { V_VT(value) = VT_UNKNOWN; return ::UiaGetReservedMixedAttributeValue(&V_UNKNOWN(value)); } } - *value = attribute_value_variant.Release(); + if (ShouldReleaseTextAttributeAsSafearray(attribute_id, attribute_value)) + *value = attribute_value.ReleaseAsSafearrayVariant(); + else + *value = attribute_value.ReleaseAsScalarVariant(); return S_OK; } @@ -1290,4 +1303,49 @@ return platform_node->GetLowestAccessibleElement(); } +// static +bool AXPlatformNodeTextRangeProviderWin::TextAttributeIsArrayType( + TEXTATTRIBUTEID attribute_id) { + // https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids + return attribute_id == UIA_AnnotationTypesAttributeId || + attribute_id == UIA_TabsAttributeId; +} + +// static +bool AXPlatformNodeTextRangeProviderWin::TextAttributeIsUiaReservedValue( + const base::win::VariantVector& vector) { + // Reserved values are always IUnknown. + if (vector.Type() != VT_UNKNOWN) + return false; + + base::win::ScopedVariant mixed_attribute_value_variant; + { + Microsoft::WRL::ComPtr<IUnknown> mixed_attribute_value; + HRESULT hr = ::UiaGetReservedMixedAttributeValue(&mixed_attribute_value); + DCHECK(SUCCEEDED(hr)); + mixed_attribute_value_variant.Set(mixed_attribute_value.Get()); + } + + base::win::ScopedVariant not_supported_value_variant; + { + Microsoft::WRL::ComPtr<IUnknown> not_supported_value; + HRESULT hr = ::UiaGetReservedNotSupportedValue(¬_supported_value); + DCHECK(SUCCEEDED(hr)); + not_supported_value_variant.Set(not_supported_value.Get()); + } + + return !vector.Compare(mixed_attribute_value_variant) || + !vector.Compare(not_supported_value_variant); +} + +// static +bool AXPlatformNodeTextRangeProviderWin::ShouldReleaseTextAttributeAsSafearray( + TEXTATTRIBUTEID attribute_id, + const base::win::VariantVector& attribute_value) { + // |vector| may be pre-populated with a UIA reserved value. In such a case, we + // must release as a scalar variant. + return TextAttributeIsArrayType(attribute_id) && + !TextAttributeIsUiaReservedValue(attribute_value); +} + } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.h b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.h index c967b19..d591c89 100644 --- a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.h +++ b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win.h
@@ -171,6 +171,13 @@ const AXNodeRange& new_selection); AXPlatformNodeWin* GetLowestAccessibleCommonPlatformNode() const; + static bool TextAttributeIsArrayType(TEXTATTRIBUTEID attribute_id); + static bool TextAttributeIsUiaReservedValue( + const base::win::VariantVector& vector); + static bool ShouldReleaseTextAttributeAsSafearray( + TEXTATTRIBUTEID attribute_id, + const base::win::VariantVector& vector); + Microsoft::WRL::ComPtr<AXPlatformNodeWin> owner_; AXPositionInstance start_; AXPositionInstance end_;
diff --git a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win_unittest.cc b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win_unittest.cc index 969c068c..6e744360 100644 --- a/ui/accessibility/platform/ax_platform_node_textrangeprovider_win_unittest.cc +++ b/ui/accessibility/platform/ax_platform_node_textrangeprovider_win_unittest.cc
@@ -39,49 +39,29 @@ #define ASSERT_UIA_NOTSUPPORTED(expr) \ ASSERT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr)) -#define EXPECT_UIA_DOUBLE_SAFEARRAY_EQ(safearray, expected_property_values) \ - { \ - EXPECT_EQ(sizeof(V_R8(LPVARIANT(NULL))), \ - ::SafeArrayGetElemsize(safearray)); \ - ASSERT_EQ(1u, SafeArrayGetDim(safearray)); \ - LONG array_lower_bound; \ - ASSERT_HRESULT_SUCCEEDED( \ - SafeArrayGetLBound(safearray, 1, &array_lower_bound)); \ - LONG array_upper_bound; \ - ASSERT_HRESULT_SUCCEEDED( \ - SafeArrayGetUBound(safearray, 1, &array_upper_bound)); \ - double* array_data; \ - ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \ - safearray, reinterpret_cast<void**>(&array_data))); \ - size_t count = array_upper_bound - array_lower_bound + 1; \ - ASSERT_EQ(expected_property_values.size(), count); \ - for (size_t i = 0; i < count; ++i) { \ - EXPECT_EQ(array_data[i], expected_property_values[i]); \ - } \ - ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(safearray)); \ - } - -#define EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(safearray, \ - expected_property_values) \ - { \ - EXPECT_EQ(sizeof(V_UNKNOWN(LPVARIANT(NULL))), \ - ::SafeArrayGetElemsize(safearray)); \ - EXPECT_EQ(1u, SafeArrayGetDim(safearray)); \ - LONG array_lower_bound; \ - EXPECT_HRESULT_SUCCEEDED( \ - SafeArrayGetLBound(safearray, 1, &array_lower_bound)); \ - LONG array_upper_bound; \ - EXPECT_HRESULT_SUCCEEDED( \ - SafeArrayGetUBound(safearray, 1, &array_upper_bound)); \ - ComPtr<IRawElementProviderSimple>* array_data; \ - EXPECT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \ - safearray, reinterpret_cast<void**>(&array_data))); \ - size_t count = array_upper_bound - array_lower_bound + 1; \ - EXPECT_EQ(expected_property_values.size(), count); \ - for (size_t i = 0; i < count; ++i) { \ - EXPECT_EQ(array_data[i].Get(), expected_property_values[i].Get()); \ - } \ - EXPECT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(safearray)); \ +#define EXPECT_UIA_SAFEARRAY_EQ(safearray, expected_property_values) \ + { \ + using T = typename decltype(expected_property_values)::value_type; \ + EXPECT_EQ(sizeof(T), ::SafeArrayGetElemsize(safearray)); \ + EXPECT_EQ(1u, SafeArrayGetDim(safearray)); \ + LONG array_lower_bound; \ + EXPECT_HRESULT_SUCCEEDED( \ + SafeArrayGetLBound(safearray, 1, &array_lower_bound)); \ + LONG array_upper_bound; \ + EXPECT_HRESULT_SUCCEEDED( \ + SafeArrayGetUBound(safearray, 1, &array_upper_bound)); \ + const size_t count = array_upper_bound - array_lower_bound + 1; \ + EXPECT_EQ(expected_property_values.size(), count); \ + if (sizeof(T) == ::SafeArrayGetElemsize(safearray) && \ + count == expected_property_values.size()) { \ + T* array_data; \ + EXPECT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \ + safearray, reinterpret_cast<void**>(&array_data))); \ + for (size_t i = 0; i < count; ++i) { \ + EXPECT_EQ(array_data[i], expected_property_values[i]); \ + } \ + EXPECT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(safearray)); \ + } \ } #define EXPECT_UIA_TEXTATTRIBUTE_EQ(provider, attribute, variant) \ @@ -228,6 +208,30 @@ ASSERT_NE(nullptr, text_range_provider.Get()); } + void CreateTextRangeProviderWin( + ComPtr<AXPlatformNodeTextRangeProviderWin>& text_range_provider_win, + AXPlatformNodeWin* owner, + AXTreeID tree_id, + AXNode::AXID start_anchor_id, + int start_offset, + ax::mojom::TextAffinity start_affinity, + AXNode::AXID end_anchor_id, + int end_offset, + ax::mojom::TextAffinity end_affinity) { + AXNodePosition::AXPositionInstance range_start = + AXNodePosition::CreateTextPosition(tree_id, start_anchor_id, + start_offset, start_affinity); + AXNodePosition::AXPositionInstance range_end = + AXNodePosition::CreateTextPosition(tree_id, end_anchor_id, end_offset, + end_affinity); + + ComPtr<ITextRangeProvider> text_range_provider = + AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( + owner, std::move(range_start), std::move(range_end)); + + text_range_provider->QueryInterface(IID_PPV_ARGS(&text_range_provider_win)); + } + void ComputeWordBoundariesOffsets(const std::string& text, std::vector<int>& word_start_offsets, std::vector<int>& word_end_offsets) { @@ -2920,7 +2924,7 @@ 20, 50, 200, 30, /* check box */ 220, 20, 30, 30, /* line 1 */ 220, 50, 42, 30 /* line 2 */}; - EXPECT_UIA_DOUBLE_SAFEARRAY_EQ(rectangles.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(rectangles.Get(), expected_values); rectangles.Reset(); // Move the text range end back by one character. @@ -2936,7 +2940,7 @@ 20, 50, 200, 30, /* check box */ 220, 20, 30, 30, /* line 1 */ 220, 50, 35, 30 /* line 2 */}; - EXPECT_UIA_DOUBLE_SAFEARRAY_EQ(rectangles.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(rectangles.Get(), expected_values); rectangles.Reset(); // Move the text range end back by one line. @@ -2951,7 +2955,7 @@ expected_values = {20, 20, 200, 30, /* button */ 20, 50, 200, 30, /* check box */ 220, 20, 30, 30 /* line 1 */}; - EXPECT_UIA_DOUBLE_SAFEARRAY_EQ(rectangles.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(rectangles.Get(), expected_values); rectangles.Reset(); // Move the text range end back by one line. @@ -2965,7 +2969,7 @@ text_range_provider->GetBoundingRectangles(rectangles.Receive())); expected_values = {20, 20, 200, 30, /* button */ 20, 50, 200, 30 /* check box */}; - EXPECT_UIA_DOUBLE_SAFEARRAY_EQ(rectangles.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(rectangles.Get(), expected_values); } TEST_F(AXPlatformNodeTextRangeProviderTest, @@ -3524,7 +3528,7 @@ expected_values = {}; - EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(children.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(children.Get(), expected_values); } // Test static_text_6 - a leaf node should have no children. @@ -3540,7 +3544,7 @@ expected_values = {}; - EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(children.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(children.Get(), expected_values); } // Test static_text_3 - children should include inline_box_4 and inline_box_5. @@ -3556,7 +3560,7 @@ expected_values = {inline_box_4_raw, inline_box_5_raw}; - EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(children.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(children.Get(), expected_values); } // Test button_8 - a button should never expose its children. @@ -3572,7 +3576,7 @@ expected_values = {}; - EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(children.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(children.Get(), expected_values); } // Test document_2 - children should not include ignored nodes and nodes under @@ -3592,7 +3596,7 @@ static_text_6_raw, button_8_raw, }; - EXPECT_UIA_VT_UNKNOWN_SAFEARRAY_EQ(children.Get(), expected_values); + EXPECT_UIA_SAFEARRAY_EQ(children.Get(), expected_values); } } @@ -3617,6 +3621,13 @@ text_data.SetTextPosition(ax::mojom::TextPosition::kSubscript); text_data.SetRestriction(ax::mojom::Restriction::kReadOnly); text_data.SetTextAlign(ax::mojom::TextAlign::kCenter); + text_data.AddIntListAttribute(ax::mojom::IntListAttribute::kMarkerTypes, + {(int)ax::mojom::MarkerType::kGrammar, + (int)ax::mojom::MarkerType::kSpelling}); + text_data.AddIntListAttribute(ax::mojom::IntListAttribute::kMarkerStarts, + {0, 5}); + text_data.AddIntListAttribute(ax::mojom::IntListAttribute::kMarkerEnds, + {9, 9}); text_data.SetName("some text"); ui::AXNodeData heading_data; @@ -3643,6 +3654,13 @@ heading_text_data.SetTextPosition(ax::mojom::TextPosition::kSuperscript); heading_text_data.AddState(ax::mojom::State::kEditable); heading_text_data.SetTextAlign(ax::mojom::TextAlign::kJustify); + heading_text_data.AddIntListAttribute( + ax::mojom::IntListAttribute::kMarkerTypes, + {(int)ax::mojom::MarkerType::kSpelling}); + heading_text_data.AddIntListAttribute( + ax::mojom::IntListAttribute::kMarkerStarts, {5}); + heading_text_data.AddIntListAttribute( + ax::mojom::IntListAttribute::kMarkerEnds, {9}); heading_text_data.SetName("more text"); ui::AXNodeData mark_data; @@ -4077,6 +4095,72 @@ UIA_TextFlowDirectionsAttributeId, expected_variant); expected_variant.Reset(); + + { + // |text_node| has a grammar error on the entire text, and a spelling error + // for one word, so the range has mixed annotations. + EXPECT_UIA_TEXTATTRIBUTE_MIXED(text_range_provider, + UIA_AnnotationTypesAttributeId); + + // start: TextPosition, anchor_id=2, text_offset=5, + // annotated_text=some <t>ext + // end : TextPosition, anchor_id=2, text_offset=9, + // annotated_text=some text<> + AXPlatformNodeWin* owner = + static_cast<AXPlatformNodeWin*>(AXPlatformNodeFromNode(text_node)); + ComPtr<AXPlatformNodeTextRangeProviderWin> range_with_annotations; + CreateTextRangeProviderWin( + range_with_annotations, owner, tree_data.tree_id, + /*start_anchor_id=*/text_node->id(), /*start_offset=*/5, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/text_node->id(), /*end_offset=*/9, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); + + base::win::ScopedVariant annotation_types_variant; + EXPECT_HRESULT_SUCCEEDED(range_with_annotations->GetAttributeValue( + UIA_AnnotationTypesAttributeId, annotation_types_variant.Receive())); + + EXPECT_EQ(annotation_types_variant.type(), VT_ARRAY | VT_I4); + std::vector<int> expected_annotations = {AnnotationType_SpellingError, + AnnotationType_GrammarError}; + EXPECT_UIA_SAFEARRAY_EQ(V_ARRAY(annotation_types_variant.ptr()), + expected_annotations); + } + + { + // |heading_text_node| has a a spelling error for one word, and no + // annotations for the remaining text, so the range has mixed annotations. + EXPECT_UIA_TEXTATTRIBUTE_MIXED(heading_text_range_provider, + UIA_AnnotationTypesAttributeId); + + // start: TextPosition, anchor_id=4, text_offset=5, + // annotated_text=more <t>ext + // end : TextPosition, anchor_id=4, text_offset=9, + // annotated_text=more text<> + AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( + AXPlatformNodeFromNode(heading_text_node)); + ComPtr<AXPlatformNodeTextRangeProviderWin> range_with_annotations; + CreateTextRangeProviderWin( + range_with_annotations, owner, tree_data.tree_id, + /*start_anchor_id=*/heading_text_node->id(), /*start_offset=*/5, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/heading_text_node->id(), /*end_offset=*/9, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); + + base::win::ScopedVariant annotation_types_variant; + EXPECT_HRESULT_SUCCEEDED(range_with_annotations->GetAttributeValue( + UIA_AnnotationTypesAttributeId, annotation_types_variant.Receive())); + + std::vector<int> expected_annotations = {AnnotationType_SpellingError}; + EXPECT_UIA_SAFEARRAY_EQ(V_ARRAY(annotation_types_variant.ptr()), + expected_annotations); + } + + { + base::win::ScopedVariant empty_variant; + EXPECT_UIA_TEXTATTRIBUTE_EQ(mark_text_range_provider, + UIA_AnnotationTypesAttributeId, empty_variant); + } } TEST_F(AXPlatformNodeTextRangeProviderTest, @@ -4119,8 +4203,6 @@ EXPECT_UIA_TEXTATTRIBUTE_NOTSUPPORTED(document_range_provider, UIA_AnnotationObjectsAttributeId); EXPECT_UIA_TEXTATTRIBUTE_NOTSUPPORTED(document_range_provider, - UIA_AnnotationTypesAttributeId); - EXPECT_UIA_TEXTATTRIBUTE_NOTSUPPORTED(document_range_provider, UIA_BeforeParagraphSpacingAttributeId); EXPECT_UIA_TEXTATTRIBUTE_NOTSUPPORTED(document_range_provider, UIA_CapStyleAttributeId); @@ -4192,27 +4274,21 @@ Init(initial_state); + // Making |owner| AXID:2 so that |TestAXNodeWrapper::BuildAllWrappers| + // will build the entire subtree, and not only AXID:3 for example. + AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( + AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 2))); + + // start: TextPosition, anchor_id=4, text_offset=0, annotated_text=<s>ome text + // end : TextPosition, anchor_id=2, text_offset=17, + // annotated_text=some textmore tex<t> ComPtr<AXPlatformNodeTextRangeProviderWin> text_range_provider_win; - { - // Making |owner| AXID:2 so that |TestAXNodeWrapper::BuildAllWrappers| - // will build the entire subtree, and not only AXID:3 for example. - AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( - AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 2))); - - AXNodePosition::AXPositionInstance range_start = - AXNodePosition::CreateTextPosition( - tree_id, /*anchor_id=*/4, /*text_offset=*/0, - ax::mojom::TextAffinity::kDownstream); - AXNodePosition::AXPositionInstance range_end = - AXNodePosition::CreateTextPosition( - tree_id, /*anchor_id=*/2, /*text_offset=*/17, - ax::mojom::TextAffinity::kDownstream); - - ComPtr<ITextRangeProvider> text_range_provider = - AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner, std::move(range_start), std::move(range_end)); - text_range_provider->QueryInterface(IID_PPV_ARGS(&text_range_provider_win)); - } + CreateTextRangeProviderWin( + text_range_provider_win, owner, tree_id, + /*start_anchor_id=*/4, /*start_offset=*/0, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/2, /*end_offset=*/17, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); ASSERT_TRUE(GetStart(text_range_provider_win.Get())->IsTextPosition()); ASSERT_EQ(4, GetStart(text_range_provider_win.Get())->anchor_id()); @@ -5225,27 +5301,20 @@ Init(initial_state); + // Making |owner| AXID:1 so that |TestAXNodeWrapper::BuildAllWrappers| + // will build the entire tree. + AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( + AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 1))); + + // start: TextPosition, anchor_id=3, text_offset=1, annotated_text=i<g>nored + // end : TextPosition, anchor_id=3, text_offset=6, annotated_text=ignore<d> ComPtr<AXPlatformNodeTextRangeProviderWin> ignored_range_win; - { - // Making |owner| AXID:1 so that |TestAXNodeWrapper::BuildAllWrappers| - // will build the entire tree. - AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( - AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 1))); - - AXNodePosition::AXPositionInstance range_start = - AXNodePosition::CreateTextPosition( - tree_id, /*anchor_id=*/3, /*text_offset=*/1, - ax::mojom::TextAffinity::kDownstream); - AXNodePosition::AXPositionInstance range_end = - AXNodePosition::CreateTextPosition( - tree_id, /*anchor_id=*/3, /*text_offset=*/6, - ax::mojom::TextAffinity::kDownstream); - - ComPtr<ITextRangeProvider> text_range_provider = - AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner, std::move(range_start), std::move(range_end)); - text_range_provider->QueryInterface(IID_PPV_ARGS(&ignored_range_win)); - } + CreateTextRangeProviderWin( + ignored_range_win, owner, tree_id, + /*start_anchor_id=*/3, /*start_offset=*/1, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/3, /*end_offset=*/6, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); EXPECT_TRUE(GetStart(ignored_range_win.Get())->IsIgnored()); EXPECT_TRUE(GetEnd(ignored_range_win.Get())->IsIgnored()); @@ -5330,26 +5399,18 @@ AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 1))); - // TextPosition, anchor_id=2, text_offset=6, annotated_text=before<> - AXNodePosition::AXPositionInstance range_start = - AXNodePosition::CreateTextPosition(tree_id, /*anchor_id=*/2, - /*text_offset=*/6, - ax::mojom::TextAffinity::kDownstream); - - // TextPosition, anchor_id=5, text_offset=0, annotated_text=<a>fter - AXNodePosition::AXPositionInstance range_end = - AXNodePosition::CreateTextPosition(tree_id, /*anchor_id=*/5, - /*text_offset=*/0, - ax::mojom::TextAffinity::kDownstream); - - ComPtr<AXPlatformNodeTextRangeProviderWin> range_span_ignored_nodes; // Text range before NormalizeTextRange() // |before<>||ignored1||ignored2||<a>fter| // |-----------------------| - ComPtr<ITextRangeProvider> text_range_provider = - AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner, std::move(range_start), std::move(range_end)); - text_range_provider->QueryInterface(IID_PPV_ARGS(&range_span_ignored_nodes)); + // start: TextPosition, anchor_id=2, text_offset=6, annotated_text=before<> + // end : TextPosition, anchor_id=5, text_offset=0, annotated_text=<a>fter + ComPtr<AXPlatformNodeTextRangeProviderWin> range_span_ignored_nodes; + CreateTextRangeProviderWin( + range_span_ignored_nodes, owner, tree_id, + /*start_anchor_id=*/2, /*start_offset=*/6, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/5, /*end_offset=*/0, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); // Text range after NormalizeTextRange() // |before||ignored1||ignored2||<a>fter| @@ -5437,23 +5498,15 @@ AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( AXPlatformNodeFromNode(GetNodeFromTree(tree_data.tree_id, 1))); - // TextPosition, anchor_id=3, text_offset=1, annotated_text=/xFFFC<> - AXNodePosition::AXPositionInstance range_start = - AXNodePosition::CreateTextPosition(tree_data.tree_id, /*anchor_id=*/3, - /*text_offset=*/1, - ax::mojom::TextAffinity::kDownstream); - - // TextPosition, anchor_id=7, text_offset=0, annotated_text=<p>i - AXNodePosition::AXPositionInstance range_end = - AXNodePosition::CreateTextPosition(tree_data.tree_id, /*anchor_id=*/7, - /*text_offset=*/0, - ax::mojom::TextAffinity::kDownstream); - + // start: TextPosition, anchor_id=3, text_offset=1, annotated_text=/xFFFC<> + // end : TextPosition, anchor_id=7, text_offset=0, annotated_text=<p>i ComPtr<AXPlatformNodeTextRangeProviderWin> range; - ComPtr<ITextRangeProvider> text_range_provider = - AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner, std::move(range_start), std::move(range_end)); - text_range_provider->QueryInterface(IID_PPV_ARGS(&range)); + CreateTextRangeProviderWin( + range, owner, tree_data.tree_id, + /*start_anchor_id=*/3, /*start_offset=*/1, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/7, /*end_offset=*/0, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); NormalizeTextRange(range.Get()); EXPECT_EQ(*GetStart(range.Get()), *GetEnd(range.Get())); @@ -5498,21 +5551,15 @@ AXPlatformNodeWin* owner = static_cast<AXPlatformNodeWin*>( AXPlatformNodeFromNode(GetNodeFromTree(tree_id, 1))); - // TextPosition, anchor_id=2, text_offset=9, annotated_text=some text<> - AXNodePosition::AXPositionInstance range_start = - AXNodePosition::CreateTextPosition(tree_id, /*anchor_id=*/1, - /*text_offset=*/0, - ax::mojom::TextAffinity::kDownstream); - - // TextPosition, anchor_id=2, text_offset=9, annotated_text=some text<> - AXNodePosition::AXPositionInstance range_end = - AXNodePosition::CreateTextPosition(tree_id, /*anchor_id=*/3, - /*text_offset=*/9, - ax::mojom::TextAffinity::kDownstream); - - ComPtr<ITextRangeProvider> text_range_provider = - AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner, std::move(range_start), std::move(range_end)); + // start: TextPosition, anchor_id=1, text_offset=0, annotated_text=<s>ome text + // end : TextPosition, anchor_id=3, text_offset=9, annotated_text=more text<> + ComPtr<AXPlatformNodeTextRangeProviderWin> text_range_provider; + CreateTextRangeProviderWin( + text_range_provider, owner, tree_id, + /*start_anchor_id=*/1, /*start_offset=*/0, + /*start_affinity*/ ax::mojom::TextAffinity::kDownstream, + /*end_anchor_id=*/3, /*end_offset=*/9, + /*end_affinity*/ ax::mojom::TextAffinity::kDownstream); // Since the end of the range is at MaxTextOffset, moving it by 1 character // should have an expected_count of 0.
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index f46f2bc9..f74b396 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -28,6 +28,7 @@ #include "base/win/scoped_bstr.h" #include "base/win/scoped_safearray.h" #include "base/win/scoped_variant.h" +#include "base/win/variant_vector.h" #include "skia/ext/skia_utils_win.h" #include "third_party/iaccessible2/ia2_api_all.h" #include "third_party/skia/include/core/SkColor.h" @@ -4075,9 +4076,14 @@ result->lVal = ComputeUIAControlType(); break; - case UIA_CulturePropertyId: - return GetCultureAttributeAsVariant(result); + case UIA_CulturePropertyId: { + base::Optional<LCID> lcid = GetCultureAttributeAsLCID(); + if (!lcid) + return E_FAIL; + result->vt = VT_I4; + result->lVal = lcid.value(); break; + } case UIA_DescribedByPropertyId: result->vt = VT_ARRAY | VT_UNKNOWN; @@ -4594,49 +4600,55 @@ object); } -HRESULT AXPlatformNodeWin::GetTextAttributeValue(TEXTATTRIBUTEID attribute_id, - VARIANT* result) { +HRESULT AXPlatformNodeWin::GetTextAttributeValue( + TEXTATTRIBUTEID attribute_id, + const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + base::win::VariantVector* result) { + DCHECK(!start_offset || start_offset.value() >= 0); + DCHECK(!end_offset || end_offset.value() >= 0); + switch (attribute_id) { + case UIA_AnnotationTypesAttributeId: + return GetAnnotationTypesAttribute(start_offset, end_offset, result); case UIA_BackgroundColorAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = - GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute::kBackgroundColor); + result->Insert<VT_I4>( + GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute::kBackgroundColor)); break; case UIA_BulletStyleAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = ComputeUIABulletStyle(); + result->Insert<VT_I4>(ComputeUIABulletStyle()); break; - case UIA_CultureAttributeId: - return GetCultureAttributeAsVariant(result); + case UIA_CultureAttributeId: { + base::Optional<LCID> lcid = GetCultureAttributeAsLCID(); + if (!lcid) + return E_FAIL; + result->Insert<VT_I4>(lcid.value()); + break; + } case UIA_FontNameAttributeId: - V_VT(result) = VT_BSTR; - V_BSTR(result) = GetFontNameAttributeAsBSTR(); + result->Insert<VT_BSTR>(GetFontNameAttributeAsBSTR()); break; case UIA_FontSizeAttributeId: { base::Optional<float> font_size_in_points = GetFontSizeInPoints(); if (font_size_in_points) { - V_VT(result) = VT_R8; - V_R8(result) = *font_size_in_points; + result->Insert<VT_R8>(*font_size_in_points); } break; } case UIA_FontWeightAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = GetFloatAttribute(ax::mojom::FloatAttribute::kFontWeight); + result->Insert<VT_I4>( + GetFloatAttribute(ax::mojom::FloatAttribute::kFontWeight)); break; case UIA_ForegroundColorAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute::kColor); + result->Insert<VT_I4>( + GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute::kColor)); break; case UIA_IsHiddenAttributeId: - V_VT(result) = VT_BOOL; - V_BOOL(result) = IsInvisibleOrIgnored() ? VARIANT_TRUE : VARIANT_FALSE; + result->Insert<VT_BOOL>(IsInvisibleOrIgnored()); break; case UIA_IsItalicAttributeId: - V_VT(result) = VT_BOOL; - V_BOOL(result) = GetData().HasTextStyle(ax::mojom::TextStyle::kItalic) - ? VARIANT_TRUE - : VARIANT_FALSE; + result->Insert<VT_BOOL>( + GetData().HasTextStyle(ax::mojom::TextStyle::kItalic)); break; case UIA_IsReadOnlyAttributeId: // Placeholder text should return the enclosing element's read-only value. @@ -4644,83 +4656,102 @@ AXPlatformNodeWin* parent_platform_node = static_cast<AXPlatformNodeWin*>( FromNativeViewAccessible(GetParent())); - return parent_platform_node->GetTextAttributeValue(attribute_id, - result); + return parent_platform_node->GetTextAttributeValue( + attribute_id, start_offset, end_offset, result); } - V_VT(result) = VT_BOOL; - V_BOOL(result) = - GetData().IsReadOnlyOrDisabled() ? VARIANT_TRUE : VARIANT_FALSE; + result->Insert<VT_BOOL>(GetData().IsReadOnlyOrDisabled()); break; case UIA_IsSubscriptAttributeId: - V_VT(result) = VT_BOOL; - V_BOOL(result) = - (GetData().GetTextPosition() == ax::mojom::TextPosition::kSubscript) - ? VARIANT_TRUE - : VARIANT_FALSE; + result->Insert<VT_BOOL>(GetData().GetTextPosition() == + ax::mojom::TextPosition::kSubscript); break; case UIA_IsSuperscriptAttributeId: - V_VT(result) = VT_BOOL; - V_BOOL(result) = - (GetData().GetTextPosition() == ax::mojom::TextPosition::kSuperscript) - ? VARIANT_TRUE - : VARIANT_FALSE; + result->Insert<VT_BOOL>(GetData().GetTextPosition() == + ax::mojom::TextPosition::kSuperscript); break; case UIA_OverlineStyleAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = GetUIATextDecorationStyle( - ax::mojom::IntAttribute::kTextOverlineStyle); + result->Insert<VT_I4>(GetUIATextDecorationStyle( + ax::mojom::IntAttribute::kTextOverlineStyle)); break; case UIA_StrikethroughStyleAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = GetUIATextDecorationStyle( - ax::mojom::IntAttribute::kTextStrikethroughStyle); + result->Insert<VT_I4>(GetUIATextDecorationStyle( + ax::mojom::IntAttribute::kTextStrikethroughStyle)); break; case UIA_StyleNameAttributeId: - V_VT(result) = VT_BSTR; - V_BSTR(result) = GetStyleNameAttributeAsBSTR(); + result->Insert<VT_BSTR>(GetStyleNameAttributeAsBSTR()); break; case UIA_StyleIdAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = ComputeUIAStyleId(); + result->Insert<VT_I4>(ComputeUIAStyleId()); break; case UIA_HorizontalTextAlignmentAttributeId: { base::Optional<HorizontalTextAlignment> horizontal_text_alignment = AXTextAlignToUIAHorizontalTextAlignment(GetData().GetTextAlign()); - if (horizontal_text_alignment) { - V_VT(result) = VT_I4; - V_I4(result) = *horizontal_text_alignment; - } + if (horizontal_text_alignment) + result->Insert<VT_I4>(*horizontal_text_alignment); break; } case UIA_UnderlineStyleAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = GetUIATextDecorationStyle( - ax::mojom::IntAttribute::kTextUnderlineStyle); + result->Insert<VT_I4>(GetUIATextDecorationStyle( + ax::mojom::IntAttribute::kTextUnderlineStyle)); break; case UIA_TextFlowDirectionsAttributeId: - V_VT(result) = VT_I4; - V_I4(result) = - TextDirectionToFlowDirections(GetData().GetTextDirection()); + result->Insert<VT_I4>( + TextDirectionToFlowDirections(GetData().GetTextDirection())); break; - default: - V_VT(result) = VT_UNKNOWN; - return ::UiaGetReservedNotSupportedValue(&V_UNKNOWN(result)); + default: { + Microsoft::WRL::ComPtr<IUnknown> not_supported_value; + HRESULT hr = ::UiaGetReservedNotSupportedValue(¬_supported_value); + if (SUCCEEDED(hr)) + result->Insert<VT_UNKNOWN>(not_supported_value.Get()); + return hr; + } break; } return S_OK; } -HRESULT AXPlatformNodeWin::GetCultureAttributeAsVariant(VARIANT* result) const { +HRESULT AXPlatformNodeWin::GetAnnotationTypesAttribute( + const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + base::win::VariantVector* result) { + base::win::VariantVector variant_vector; + + MarkerTypeRangeResult grammar_result = MarkerTypeRangeResult::kNone; + MarkerTypeRangeResult spelling_result = MarkerTypeRangeResult::kNone; + + if (IsText() || IsPlainTextField()) { + grammar_result = GetMarkerTypeFromRange(start_offset, end_offset, + ax::mojom::MarkerType::kGrammar); + spelling_result = GetMarkerTypeFromRange(start_offset, end_offset, + ax::mojom::MarkerType::kSpelling); + } + + if (grammar_result == MarkerTypeRangeResult::kMixed || + spelling_result == MarkerTypeRangeResult::kMixed) { + Microsoft::WRL::ComPtr<IUnknown> mixed_attribute_value; + HRESULT hr = ::UiaGetReservedMixedAttributeValue(&mixed_attribute_value); + if (SUCCEEDED(hr)) + result->Insert<VT_UNKNOWN>(mixed_attribute_value.Get()); + return hr; + } + + if (spelling_result == MarkerTypeRangeResult::kMatch) + result->Insert<VT_I4>(AnnotationType_SpellingError); + if (grammar_result == MarkerTypeRangeResult::kMatch) + result->Insert<VT_I4>(AnnotationType_GrammarError); + + return S_OK; +} + +base::Optional<LCID> AXPlatformNodeWin::GetCultureAttributeAsLCID() const { const base::string16 language = GetInheritedString16Attribute(ax::mojom::StringAttribute::kLanguage); const LCID lcid = LocaleNameToLCID(language.c_str(), LOCALE_ALLOW_NEUTRAL_NAMES); if (!lcid) - return E_FAIL; + return base::nullopt; - V_VT(result) = VT_I4; - V_I4(result) = lcid; - return S_OK; + return lcid; } COLORREF AXPlatformNodeWin::GetIntAttributeAsCOLORREF( @@ -4864,6 +4895,114 @@ } } +// static +void AXPlatformNodeWin::AggregateRangesForMarkerType( + AXPlatformNodeBase* node, + ax::mojom::MarkerType marker_type, + int offset_ranges_amount, + std::vector<std::pair<int, int>>* ranges) { + DCHECK(node->IsText()); + const std::vector<int32_t>& marker_types = + node->GetIntListAttribute(ax::mojom::IntListAttribute::kMarkerTypes); + const std::vector<int>& marker_starts = + node->GetIntListAttribute(ax::mojom::IntListAttribute::kMarkerStarts); + const std::vector<int>& marker_ends = + node->GetIntListAttribute(ax::mojom::IntListAttribute::kMarkerEnds); + + for (size_t i = 0; i < marker_types.size(); ++i) { + if (static_cast<ax::mojom::MarkerType>(marker_types[i]) != marker_type) + continue; + + const int marker_start = marker_starts[i] + offset_ranges_amount; + const int marker_end = marker_ends[i] + offset_ranges_amount; + ranges->emplace_back(std::make_pair(marker_start, marker_end)); + } +} + +AXPlatformNodeWin::MarkerTypeRangeResult +AXPlatformNodeWin::GetMarkerTypeFromRange( + const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + ax::mojom::MarkerType marker_type) { + DCHECK(IsText() || IsPlainTextField()); + std::vector<std::pair<int, int>> relevant_ranges; + + if (IsText()) { + AggregateRangesForMarkerType(this, marker_type, /*offset_ranges_amount=*/0, + &relevant_ranges); + } else if (IsPlainTextField()) { + int offset_ranges_amount = 0; + for (AXPlatformNodeBase* static_text = GetFirstTextOnlyDescendant(); + static_text; static_text = static_text->GetNextSibling()) { + const int child_offset_ranges_amount = offset_ranges_amount; + if (start_offset || end_offset) { + // Break if the current node is after the desired |end_offset|. + if (end_offset && child_offset_ranges_amount > end_offset.value()) + break; + + // Skip over nodes preceding the desired |start_offset|. + offset_ranges_amount += static_text->GetHypertext().length(); + if (start_offset && offset_ranges_amount < start_offset.value()) + continue; + } + + AggregateRangesForMarkerType(static_text, marker_type, + child_offset_ranges_amount, + &relevant_ranges); + } + } + + // Sort the ranges by their start offset. + const auto sort_ranges_by_start_offset = [](const std::pair<int, int>& a, + const std::pair<int, int>& b) { + return a.first < b.first; + }; + std::sort(relevant_ranges.begin(), relevant_ranges.end(), + sort_ranges_by_start_offset); + + // Validate that the desired range has a contiguous MarkerType. + base::Optional<std::pair<int, int>> contiguous_range; + for (const std::pair<int, int>& range : relevant_ranges) { + if (end_offset && range.first > end_offset.value()) + break; + if (start_offset && range.second < start_offset.value()) + continue; + + if (!contiguous_range) { + contiguous_range = range; + continue; + } + + // If there is a gap, then the range must be mixed. + if ((range.first - contiguous_range->second) > 1) + return MarkerTypeRangeResult::kMixed; + + // Expand the range if possible. + contiguous_range->second = std::max(contiguous_range->second, range.second); + } + + // The desired range does not overlap with |marker_type|. + if (!contiguous_range) + return MarkerTypeRangeResult::kNone; + + // If there is a partial overlap, then the desired range must be mixed. + // 1. The |start_offset| is not specified, treat it as offset 0. + if (!start_offset && contiguous_range->first > 0) + return MarkerTypeRangeResult::kMixed; + // 2. The |end_offset| is not specified, treat it as max text offset. + if (!end_offset && size_t{contiguous_range->second} < GetHypertext().length()) + return MarkerTypeRangeResult::kMixed; + // 3. The |start_offset| is specified, but is before the first matching range. + if (start_offset && start_offset.value() < contiguous_range->first) + return MarkerTypeRangeResult::kMixed; + // 4. The |end_offset| is specified, but is after the last matching range. + if (end_offset && end_offset.value() > contiguous_range->second) + return MarkerTypeRangeResult::kMixed; + + // The desired range is a complete match for |marker_type|. + return MarkerTypeRangeResult::kMatch; +} + // IRawElementProviderSimple support methods. bool AXPlatformNodeWin::IsPatternProviderSupported(PATTERNID pattern_id) { @@ -7944,6 +8083,17 @@ return nullptr; } +AXPlatformNodeWin* AXPlatformNodeWin::GetFirstTextOnlyDescendant() { + for (auto* child = static_cast<AXPlatformNodeWin*>(GetFirstChild()); child; + child = static_cast<AXPlatformNodeWin*>(child->GetNextSibling())) { + if (child->IsText()) + return child; + if (AXPlatformNodeWin* descendant = child->GetFirstTextOnlyDescendant()) + return descendant; + } + return nullptr; +} + void AXPlatformNodeWin::SanitizeTextAttributeValue(const std::string& input, std::string* output) const { SanitizeStringAttributeForIA2(input, output);
diff --git a/ui/accessibility/platform/ax_platform_node_win.h b/ui/accessibility/platform/ax_platform_node_win.h index 489a0ca2..682149b 100644 --- a/ui/accessibility/platform/ax_platform_node_win.h +++ b/ui/accessibility/platform/ax_platform_node_win.h
@@ -311,6 +311,12 @@ return E_INVALIDARG; \ *arg = {}; +namespace base { +namespace win { +class VariantVector; +} // namespace win +} // namespace base + namespace ui { class AXPlatformNodeWin; @@ -1059,8 +1065,13 @@ REFIID riid, void** object); - // Support method for ITextRangeProvider::GetAttributeValue - HRESULT GetTextAttributeValue(TEXTATTRIBUTEID attribute_id, VARIANT* result); + // Support method for ITextRangeProvider::GetAttributeValue. + // If either |start_offset| or |end_offset| are not provided then the + // endpoint is treated as the start or end of the node respectively. + HRESULT GetTextAttributeValue(TEXTATTRIBUTEID attribute_id, + const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + base::win::VariantVector* result); // IRawElementProviderSimple support method. bool IsPatternProviderSupported(PATTERNID pattern_id); @@ -1095,6 +1106,10 @@ // Returns the parent node that makes this node inaccessible. AXPlatformNodeWin* GetLowestAccessibleElement(); + // Returns the first |IsTextOnlyObject| descendant using + // depth-first pre-order traversal. + AXPlatformNodeWin* GetFirstTextOnlyDescendant(); + // Convert a mojo event to an MSAA event. Exposed for testing. static base::Optional<DWORD> MojoEventToMSAAEvent(ax::mojom::Event event); @@ -1338,8 +1353,13 @@ // Getters for UIA GetTextAttributeValue // - // Lookup the LCID for the language this node is using - HRESULT GetCultureAttributeAsVariant(VARIANT* result) const; + // Computes the AnnotationTypes Attribute for the current node. + HRESULT GetAnnotationTypesAttribute(const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + base::win::VariantVector* result); + // Lookup the LCID for the language this node is using. + // Returns base::nullopt if there was an error. + base::Optional<LCID> GetCultureAttributeAsLCID() const; // Converts an int attribute to a COLORREF COLORREF GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute attribute) const; // Converts the ListStyle to UIA BulletStyle @@ -1356,6 +1376,30 @@ // Convert mojom TextDirection to UIA FlowDirections enumeration static FlowDirections TextDirectionToFlowDirections(ax::mojom::TextDirection); + // Helper method for |GetMarkerTypeFromRange| which aggregates all + // of the ranges for |marker_type| attached to |node|. + static void AggregateRangesForMarkerType( + AXPlatformNodeBase* node, + ax::mojom::MarkerType marker_type, + int offset_ranges_amount, + std::vector<std::pair<int, int>>* ranges); + + enum class MarkerTypeRangeResult { + // The MarkerType does not overlap the range. + kNone, + // The MarkerType overlaps the entire range. + kMatch, + // The MarkerType partially overlaps the range. + kMixed, + }; + + // Determine if a text range overlaps a |marker_type|, and whether + // the overlap is a partial or or complete match. + MarkerTypeRangeResult GetMarkerTypeFromRange( + const base::Optional<int>& start_offset, + const base::Optional<int>& end_offset, + ax::mojom::MarkerType marker_type); + bool IsAncestorComboBox(); bool IsPlaceholderText() const;
diff --git a/ui/android/OWNERS b/ui/android/OWNERS index 4f91a99..2a99c692 100644 --- a/ui/android/OWNERS +++ b/ui/android/OWNERS
@@ -10,7 +10,6 @@ jinsukkim@chromium.org # for CC and Viz integration -ericrk@chromium.org khushalsagar@chromium.org # COMPONENT: UI
diff --git a/ui/android/delegated_frame_host_android.h b/ui/android/delegated_frame_host_android.h index 21417a6..e263edf 100644 --- a/ui/android/delegated_frame_host_android.h +++ b/ui/android/delegated_frame_host_android.h
@@ -68,9 +68,6 @@ return ResizeTimeout() / viz::BeginFrameArgs::DefaultInterval(); } - // FrameEvictorClient implementation. - void EvictDelegatedFrame() override; - // Advances the fallback surface to the first surface after navigation. This // ensures that stale surfaces are not presented to the user for an indefinite // period of time. @@ -123,6 +120,9 @@ void SetTopControlsVisibleHeight(float height); private: + // FrameEvictorClient implementation. + void EvictDelegatedFrame() override; + // viz::HostFrameSinkClient implementation. void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override; void OnFrameTokenChanged(uint32_t frame_token) override;
diff --git a/ui/gl/OWNERS b/ui/gl/OWNERS index 7b3ab11..cb9ad84 100644 --- a/ui/gl/OWNERS +++ b/ui/gl/OWNERS
@@ -1,5 +1,4 @@ backer@chromium.org -ericrk@chromium.org kbr@chromium.org sunnyps@chromium.org zmo@chromium.org
diff --git a/ui/message_center/views/notification_view_md_unittest.cc b/ui/message_center/views/notification_view_md_unittest.cc index a6ee86e9..d26a472 100644 --- a/ui/message_center/views/notification_view_md_unittest.cc +++ b/ui/message_center/views/notification_view_md_unittest.cc
@@ -486,7 +486,7 @@ EXPECT_TRUE(notification_view()->actions_row_->GetVisible()); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); // Now construct a mouse move event 1 pixel inside the boundary of the action // button. @@ -498,12 +498,12 @@ generator.MoveMouseTo(cursor_location); EXPECT_EQ(views::Button::STATE_HOVERED, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); notification_view()->CreateOrUpdateViews(*notification); EXPECT_EQ(views::Button::STATE_HOVERED, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); // Now construct a mouse move event 1 pixel outside the boundary of the // widget. @@ -513,7 +513,7 @@ generator.MoveMouseTo(cursor_location); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); } TEST_F(NotificationViewMDTest, UpdateButtonCountTest) { @@ -528,9 +528,9 @@ EXPECT_TRUE(notification_view()->actions_row_->GetVisible()); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[1]->state()); + notification_view()->action_buttons_[1]->GetState()); // Now construct a mouse move event 1 pixel inside the boundary of the action // button. @@ -542,15 +542,15 @@ generator.MoveMouseTo(cursor_location); EXPECT_EQ(views::Button::STATE_HOVERED, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[1]->state()); + notification_view()->action_buttons_[1]->GetState()); notification->set_buttons(CreateButtons(1)); UpdateNotificationViews(*notification); EXPECT_EQ(views::Button::STATE_HOVERED, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); EXPECT_EQ(1u, notification_view()->action_buttons_.size()); // Now construct a mouse move event 1 pixel outside the boundary of the @@ -561,7 +561,7 @@ generator.MoveMouseTo(cursor_location); EXPECT_EQ(views::Button::STATE_NORMAL, - notification_view()->action_buttons_[0]->state()); + notification_view()->action_buttons_[0]->GetState()); } TEST_F(NotificationViewMDTest, TestActionButtonClick) {
diff --git a/ui/ozone/demo/window_manager.cc b/ui/ozone/demo/window_manager.cc index 07cb5d7c..473c383 100644 --- a/ui/ozone/demo/window_manager.cc +++ b/ui/ozone/demo/window_manager.cc
@@ -69,13 +69,13 @@ } is_configuring_ = true; - delegate_->GetDisplays(base::BindOnce(&WindowManager::OnDisplaysAquired, + delegate_->GetDisplays(base::BindOnce(&WindowManager::OnDisplaysAcquired, base::Unretained(this))); } void WindowManager::OnDisplaySnapshotsInvalidated() {} -void WindowManager::OnDisplaysAquired( +void WindowManager::OnDisplaysAcquired( const std::vector<display::DisplaySnapshot*>& displays) { windows_.clear();
diff --git a/ui/ozone/demo/window_manager.h b/ui/ozone/demo/window_manager.h index a31b01d..14f3e4c84 100644 --- a/ui/ozone/demo/window_manager.h +++ b/ui/ozone/demo/window_manager.h
@@ -36,7 +36,7 @@ void RemoveWindow(DemoWindow* window); private: - void OnDisplaysAquired( + void OnDisplaysAcquired( const std::vector<display::DisplaySnapshot*>& displays); void OnDisplayConfigured(const gfx::Rect& bounds, bool success);
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn index b0dda08..9960b327 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn
@@ -1078,6 +1078,7 @@ "controls/progress_bar_unittest.cc", "controls/resize_area_unittest.cc", "controls/scroll_view_unittest.cc", + "controls/scrollbar/base_scroll_bar_button_unittest.cc", "controls/scrollbar/scrollbar_unittest.cc", "controls/separator_unittest.cc", "controls/slider_unittest.cc", @@ -1142,6 +1143,7 @@ "//components/viz/common", "//mojo/core/embedder", "//skia", + "//testing/gmock", "//testing/gtest", "//third_party/icu", "//ui/accessibility", @@ -1151,6 +1153,7 @@ "//ui/base/clipboard:clipboard_test_support", "//ui/base/ime/init", "//ui/compositor:test_support", + "//ui/display:test_support", "//ui/events:dom_keycode_converter", "//ui/events:events_base", "//ui/events:test_support",
diff --git a/ui/views/DEPS b/ui/views/DEPS index 69da070..6723a35 100644 --- a/ui/views/DEPS +++ b/ui/views/DEPS
@@ -23,8 +23,6 @@ "+ui/touch_selection", "+ui/wm/core", "+ui/wm/public", - - "-testing/gmock", ] specific_include_rules = {
diff --git a/ui/views/controls/button/button.h b/ui/views/controls/button/button.h index 5ec4cd4..e0d9e3b 100644 --- a/ui/views/controls/button/button.h +++ b/ui/views/controls/button/button.h
@@ -110,9 +110,6 @@ const base::string16& GetAccessibleName() const; // Get/sets the current display state of the button. - // TODO(pkasting): Replace all calls to state() with GetState(), and remove - // state(). - ButtonState state() const { return state_; } ButtonState GetState() const; // Clients passing in STATE_DISABLED should consider calling // SetEnabled(false) instead because the enabled flag can affect other things
diff --git a/ui/views/controls/button/button_controller.cc b/ui/views/controls/button/button_controller.cc index 9f96300..4e90ed4 100644 --- a/ui/views/controls/button/button_controller.cc +++ b/ui/views/controls/button/button_controller.cc
@@ -21,9 +21,9 @@ ButtonController::~ButtonController() = default; bool ButtonController::OnMousePressed(const ui::MouseEvent& event) { - if (button_->state() == Button::STATE_DISABLED) + if (button_->GetState() == Button::STATE_DISABLED) return true; - if (button_->state() != Button::STATE_PRESSED && + if (button_->GetState() != Button::STATE_PRESSED && button_controller_delegate_->ShouldEnterPushedState(event) && button_->HitTestPoint(event.location())) { button_->SetState(Button::STATE_PRESSED); @@ -40,7 +40,7 @@ } void ButtonController::OnMouseReleased(const ui::MouseEvent& event) { - if (button_->state() != Button::STATE_DISABLED) { + if (button_->GetState() != Button::STATE_DISABLED) { if (!button_->HitTestPoint(event.location())) { button_->SetState(Button::STATE_NORMAL); } else { @@ -59,7 +59,7 @@ } void ButtonController::OnMouseMoved(const ui::MouseEvent& event) { - if (button_->state() != Button::STATE_DISABLED) { + if (button_->GetState() != Button::STATE_DISABLED) { button_->SetState(button_->HitTestPoint(event.location()) ? Button::STATE_HOVERED : Button::STATE_NORMAL); @@ -67,19 +67,19 @@ } void ButtonController::OnMouseEntered(const ui::MouseEvent& event) { - if (button_->state() != Button::STATE_DISABLED) + if (button_->GetState() != Button::STATE_DISABLED) button_->SetState(Button::STATE_HOVERED); } void ButtonController::OnMouseExited(const ui::MouseEvent& event) { // Starting a drag results in a MouseExited, we need to ignore it. - if (button_->state() != Button::STATE_DISABLED && + if (button_->GetState() != Button::STATE_DISABLED && !button_controller_delegate_->InDrag()) button_->SetState(Button::STATE_NORMAL); } bool ButtonController::OnKeyPressed(const ui::KeyEvent& event) { - if (button_->state() == Button::STATE_DISABLED) + if (button_->GetState() == Button::STATE_DISABLED) return false; switch (button_->GetKeyClickActionForEvent(event)) { @@ -104,7 +104,7 @@ } bool ButtonController::OnKeyReleased(const ui::KeyEvent& event) { - const bool click_button = button_->state() == Button::STATE_PRESSED && + const bool click_button = button_->GetState() == Button::STATE_PRESSED && button_->GetKeyClickActionForEvent(event) == Button::KeyClickAction::kOnKeyRelease; if (!click_button) @@ -116,7 +116,7 @@ } void ButtonController::OnGestureEvent(ui::GestureEvent* event) { - if (button_->state() == Button::STATE_DISABLED) + if (button_->GetState() == Button::STATE_DISABLED) return; if (event->type() == ui::ET_GESTURE_TAP &&
diff --git a/ui/views/controls/button/button_unittest.cc b/ui/views/controls/button/button_unittest.cc index 886f7b29..c4aa752 100644 --- a/ui/views/controls/button/button_unittest.cc +++ b/ui/views/controls/button/button_unittest.cc
@@ -260,22 +260,22 @@ TEST_F(ButtonTest, HoverStateOnVisibilityChange) { event_generator()->MoveMouseTo(button()->GetBoundsInScreen().CenterPoint()); event_generator()->PressLeftButton(); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); event_generator()->ReleaseLeftButton(); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); button()->SetEnabled(false); - EXPECT_EQ(Button::STATE_DISABLED, button()->state()); + EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); button()->SetEnabled(true); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); button()->SetVisible(false); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); button()->SetVisible(true); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); #if defined(USE_AURA) { @@ -290,16 +290,16 @@ second_widget.GetNativeWindow()->SetCapture(); button()->SetEnabled(false); - EXPECT_EQ(Button::STATE_DISABLED, button()->state()); + EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); button()->SetEnabled(true); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); button()->SetVisible(false); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); button()->SetVisible(true); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); } #endif @@ -313,16 +313,16 @@ cursor_client.DisableMouseEvents(); button()->SetEnabled(false); - EXPECT_EQ(Button::STATE_DISABLED, button()->state()); + EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); button()->SetEnabled(true); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); button()->SetVisible(false); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); button()->SetVisible(true); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); #endif // !defined(OS_MACOSX) || defined(USE_AURA) } @@ -331,11 +331,11 @@ TEST_F(ButtonTest, HoverStatePreservedOnDescendantViewHierarchyChange) { event_generator()->MoveMouseTo(button()->GetBoundsInScreen().CenterPoint()); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); Label* child = new Label(base::string16()); button()->AddChildView(child); delete child; - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); } // Tests the different types of NotifyActions. @@ -346,13 +346,13 @@ button()->OnMousePressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); EXPECT_FALSE(button()->pressed()); button()->OnMouseReleased(ui::MouseEvent( ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); EXPECT_TRUE(button()->pressed()); // Set the notify action to its listener on mouse press. @@ -362,7 +362,7 @@ button()->OnMousePressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); EXPECT_TRUE(button()->pressed()); // The button should no longer notify on mouse release. @@ -370,7 +370,7 @@ button()->OnMouseReleased(ui::MouseEvent( ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); EXPECT_FALSE(button()->pressed()); } @@ -425,16 +425,16 @@ TEST_F(ButtonTest, GestureEventsSetState) { aura::test::TestCursorClient cursor_client(GetRootWindow(widget())); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); PerformGesture(button(), ui::ET_GESTURE_TAP_DOWN); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); PerformGesture(button(), ui::ET_GESTURE_SHOW_PRESS); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); PerformGesture(button(), ui::ET_GESTURE_TAP_CANCEL); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); } // Tests that if the button was disabled in its button press handler, gesture @@ -444,9 +444,9 @@ button()->set_on_button_pressed_handler(base::BindRepeating( [](TestButton* button) { button->SetEnabled(false); }, button())); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); event_generator()->GestureTapAt(button()->GetBoundsInScreen().CenterPoint()); - EXPECT_EQ(Button::STATE_DISABLED, button()->state()); + EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); } #endif // !defined(OS_MACOSX) || defined(USE_AURA) @@ -507,13 +507,13 @@ event_generator()->PressLeftButton(); EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop->GetTargetInkDropState()); - EXPECT_EQ(Button::ButtonState::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::ButtonState::STATE_PRESSED, button()->GetState()); SetDraggedView(button()); widget()->SetCapture(button()); widget()->ReleaseCapture(); SetDraggedView(nullptr); EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); - EXPECT_EQ(Button::ButtonState::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::ButtonState::STATE_NORMAL, button()->GetState()); } TEST_F(ButtonTest, HideInkDropWhenShowingContextMenu) { @@ -806,10 +806,10 @@ EXPECT_TRUE(button()->OnKeyPressed(space_press)); #if defined(OS_MACOSX) - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_TRUE(button()->pressed()); #else - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); EXPECT_FALSE(button()->pressed()); #endif @@ -821,7 +821,7 @@ EXPECT_TRUE(button()->OnKeyReleased(space_release)); #endif - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_TRUE(button()->pressed()); } @@ -838,11 +838,11 @@ #if defined(OS_MACOSX) EXPECT_FALSE(button()->OnKeyPressed(return_press)); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_FALSE(button()->pressed()); #else EXPECT_TRUE(button()->OnKeyPressed(return_press)); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_TRUE(button()->pressed()); #endif @@ -863,7 +863,7 @@ ui::KeyEvent control_press(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, ui::EF_NONE); EXPECT_TRUE(button()->OnKeyPressed(control_press)); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_TRUE(button()->pressed()); ui::KeyEvent control_release(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL,
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index e026cd2fd95..8a25c40 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc
@@ -172,7 +172,7 @@ images_[STATE_NORMAL], images_[STATE_HOVERED], hover_animation().GetCurrentValue()); } else { - img = images_[state()]; + img = images_[GetState()]; } return !img.isNull() ? img : images_[STATE_NORMAL]; @@ -233,7 +233,7 @@ const gfx::ImageSkia* image) { if (toggled_) { images_[image_state] = image ? *image : gfx::ImageSkia(); - if (state() == image_state) + if (GetState() == image_state) SchedulePaint(); } else { alternate_images_[image_state] = image ? *image : gfx::ImageSkia(); @@ -260,7 +260,7 @@ alternate_images_[image_state] = image; } else { images_[image_state] = image; - if (state() == image_state) + if (GetState() == image_state) SchedulePaint(); } PreferredSizeChanged();
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc index ff3ee5e..9fc78c95 100644 --- a/ui/views/controls/button/label_button.cc +++ b/ui/views/controls/button/label_button.cc
@@ -107,7 +107,7 @@ button_state_colors_[for_state] = color; if (for_state == STATE_DISABLED) label_->SetDisabledColor(color); - else if (for_state == state()) + else if (for_state == GetState()) label_->SetEnabledColor(color); explicitly_set_colors_[for_state] = true; } @@ -379,7 +379,7 @@ ui::NativeTheme::State LabelButton::GetThemeState( ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); - switch (state()) { + switch (GetState()) { case STATE_NORMAL: return ui::NativeTheme::kNormal; case STATE_HOVERED: @@ -543,12 +543,12 @@ const bool force_disabled = PlatformStyle::kInactiveWidgetControlsAppearDisabled && GetWidget() && !GetWidget()->ShouldPaintAsActive(); - return force_disabled ? STATE_DISABLED : state(); + return force_disabled ? STATE_DISABLED : GetState(); } void LabelButton::VisualStateChanged() { UpdateImage(); - label_->SetEnabled(state() != STATE_DISABLED); + label_->SetEnabled(GetState() != STATE_DISABLED); } void LabelButton::ResetColorsFromNativeTheme() { @@ -573,8 +573,8 @@ } void LabelButton::ResetLabelEnabledColor() { - const SkColor color = button_state_colors_[state()]; - if (state() != STATE_DISABLED && label_->GetEnabledColor() != color) + const SkColor color = button_state_colors_[GetState()]; + if (GetState() != STATE_DISABLED && label_->GetEnabledColor() != color) label_->SetEnabledColor(color); }
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc index 38443891..156149d 100644 --- a/ui/views/controls/button/label_button_unittest.cc +++ b/ui/views/controls/button/label_button_unittest.cc
@@ -154,7 +154,7 @@ ax::mojom::StringAttribute::kName)); EXPECT_FALSE(button.GetIsDefault()); - EXPECT_EQ(Button::STATE_NORMAL, button.state()); + EXPECT_EQ(Button::STATE_NORMAL, button.GetState()); EXPECT_EQ(button.image()->parent(), &button); EXPECT_EQ(button.label()->parent(), &button);
diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc index 1dada94..5f66ba1 100644 --- a/ui/views/controls/button/md_text_button.cc +++ b/ui/views/controls/button/md_text_button.cc
@@ -111,7 +111,7 @@ is_prominent_ ? ui::NativeTheme::kColorId_ProminentButtonInkDropShadowColor : ui::NativeTheme::kColorId_ButtonInkDropShadowColor; - if (state() == STATE_HOVERED) { + if (GetState() == STATE_HOVERED) { fill_color_id = is_prominent_ ? ui::NativeTheme::kColorId_ProminentButtonHoverColor : ui::NativeTheme::kColorId_ButtonHoverColor; @@ -228,7 +228,7 @@ } void MdTextButton::UpdateColors() { - bool is_disabled = state() == STATE_DISABLED; + bool is_disabled = GetState() == STATE_DISABLED; SkColor enabled_text_color = style::GetColor(*this, label()->GetTextContext(), is_prominent_ ? style::STYLE_DIALOG_BUTTON_DEFAULT @@ -264,7 +264,7 @@ } } - if (state() == STATE_PRESSED) { + if (GetState() == STATE_PRESSED) { bg_color = theme->GetSystemButtonPressedColor(bg_color); }
diff --git a/ui/views/controls/button/menu_button_controller.cc b/ui/views/controls/button/menu_button_controller.cc index f44ae6f..70c3cc3 100644 --- a/ui/views/controls/button/menu_button_controller.cc +++ b/ui/views/controls/button/menu_button_controller.cc
@@ -100,7 +100,7 @@ if (button()->request_focus_on_press()) button()->RequestFocus(); - if (button()->state() != Button::STATE_DISABLED && + if (button()->GetState() != Button::STATE_DISABLED && button()->HitTestPoint(event.location()) && IsTriggerableEvent(event)) { return Activate(&event); } @@ -112,7 +112,7 @@ } void MenuButtonController::OnMouseReleased(const ui::MouseEvent& event) { - if (button()->state() != Button::STATE_DISABLED && + if (button()->GetState() != Button::STATE_DISABLED && delegate()->IsTriggerableEvent(event) && button()->HitTestPoint(event.location()) && !delegate()->InDrag()) { Activate(&event); @@ -186,14 +186,14 @@ } void MenuButtonController::OnGestureEvent(ui::GestureEvent* event) { - if (button()->state() != Button::STATE_DISABLED) { + if (button()->GetState() != Button::STATE_DISABLED) { auto ref = weak_factory_.GetWeakPtr(); if (delegate()->IsTriggerableEvent(*event) && !Activate(event)) { // When |Activate()| returns |false|, it means the click was handled by // a button listener and has handled the gesture event. So, there is no // need to further process the gesture event here. However, if the // listener didn't run menu code, we should make sure to reset our state. - if (ref && button()->state() == Button::STATE_HOVERED) + if (ref && button()->GetState() == Button::STATE_HOVERED) button()->SetState(Button::STATE_NORMAL); return; @@ -202,7 +202,7 @@ event->SetHandled(); if (pressed_lock_count_ == 0) button()->SetState(Button::STATE_HOVERED); - } else if (button()->state() == Button::STATE_HOVERED && + } else if (button()->GetState() == Button::STATE_HOVERED && (event->type() == ui::ET_GESTURE_TAP_CANCEL || event->type() == ui::ET_GESTURE_END) && pressed_lock_count_ == 0) { @@ -300,8 +300,8 @@ &MenuButtonController::OnButtonStateChangedWhilePressedLocked, base::Unretained(this))); } - should_disable_after_press_ = button()->state() == Button::STATE_DISABLED; - if (button()->state() != Button::STATE_PRESSED) { + should_disable_after_press_ = button()->GetState() == Button::STATE_DISABLED; + if (button()->GetState() != Button::STATE_PRESSED) { if (snap_ink_drop_to_activated) delegate()->GetInkDrop()->SnapToActivated(); else @@ -332,7 +332,7 @@ button()->SetState(desired_state); // The widget may be null during shutdown. If so, it doesn't make sense to // try to add an ink drop effect. - if (button()->GetWidget() && button()->state() != Button::STATE_PRESSED) + if (button()->GetWidget() && button()->GetState() != Button::STATE_PRESSED) button()->AnimateInkDrop(InkDropState::DEACTIVATED, nullptr /* event */); } } @@ -342,9 +342,9 @@ // pressed state. This shouldn't happen, but conceivably could if a caller // tries to switch from enabled to disabled or vice versa while the button is // pressed. - if (button()->state() == Button::STATE_NORMAL) + if (button()->GetState() == Button::STATE_NORMAL) should_disable_after_press_ = false; - else if (button()->state() == Button::STATE_DISABLED) + else if (button()->GetState() == Button::STATE_DISABLED) should_disable_after_press_ = true; }
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc index e3e7095..5a504de 100644 --- a/ui/views/controls/button/menu_button_unittest.cc +++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -135,7 +135,7 @@ last_sender_ = sender; Button* button = Button::AsButton(sender); DCHECK(button); - last_sender_state_ = button->state(); + last_sender_state_ = button->GetState(); last_event_type_ = event.type(); } @@ -146,7 +146,7 @@ } Button* last_sender() { return last_sender_; } - Button::ButtonState last_sender_state() { return last_sender_state_; } + Button::ButtonState last_sender_GetState() { return last_sender_state_; } ui::EventType last_event_type() { return last_event_type_; } private: @@ -300,7 +300,7 @@ // The MenuButton itself doesn't set the PRESSED state during Activate() or // ButtonPressed(). That should be handled by the MenuController or, // if no menu is shown, the listener. - EXPECT_EQ(Button::STATE_HOVERED, source->state()); + EXPECT_EQ(Button::STATE_HOVERED, source->GetState()); } private: @@ -318,7 +318,7 @@ // Check that MenuButton has notified the listener, while it was in pressed // state. EXPECT_EQ(button(), button_listener.last_sender()); - EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_state()); + EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_GetState()); } TEST_F(MenuButtonTest, ActivateOnKeyPress) { @@ -369,7 +369,7 @@ MenuButtonController::PressedLock pressed_lock(button()->button_controller(), false, &click_event); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); EXPECT_EQ( click_point, InkDropHostViewTestApi(button()).GetInkDropCenterBasedOnLastEvent()); @@ -381,58 +381,58 @@ // Move the mouse over the button; the button should be in a hovered state. generator()->MoveMouseTo(gfx::Point(10, 10)); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); // Introduce a PressedLock, which should make the button pressed. std::unique_ptr<MenuButtonController::PressedLock> pressed_lock1( new MenuButtonController::PressedLock(button()->button_controller())); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); // Even if we move the mouse outside of the button, it should remain pressed. generator()->MoveMouseTo(gfx::Point(300, 10)); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); // Creating a new lock should obviously keep the button pressed. std::unique_ptr<MenuButtonController::PressedLock> pressed_lock2( new MenuButtonController::PressedLock(button()->button_controller())); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); // The button should remain pressed while any locks are active. pressed_lock1.reset(); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); // Resetting the final lock should return the button's state to normal... pressed_lock2.reset(); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); // ...And it should respond to mouse movement again. generator()->MoveMouseTo(gfx::Point(10, 10)); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); // Test that the button returns to the appropriate state after the press; if // the mouse ends over the button, the button should be hovered. pressed_lock1 = button()->button_controller()->TakeLock(); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); pressed_lock1.reset(); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); // If the button is disabled before the pressed lock, it should be disabled // after the pressed lock. button()->SetState(Button::STATE_DISABLED); pressed_lock1 = button()->button_controller()->TakeLock(); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); pressed_lock1.reset(); - EXPECT_EQ(Button::STATE_DISABLED, button()->state()); + EXPECT_EQ(Button::STATE_DISABLED, button()->GetState()); generator()->MoveMouseTo(gfx::Point(300, 10)); // Edge case: the button is disabled, a pressed lock is added, and then the // button is re-enabled. It should be enabled after the lock is removed. pressed_lock1 = button()->button_controller()->TakeLock(); - EXPECT_EQ(Button::STATE_PRESSED, button()->state()); + EXPECT_EQ(Button::STATE_PRESSED, button()->GetState()); button()->SetState(Button::STATE_NORMAL); pressed_lock1.reset(); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); } // Test that if a sibling menu is shown, the original menu button releases its @@ -443,7 +443,7 @@ // Move the mouse over the button; the button should be in a hovered state. generator()->MoveMouseTo(gfx::Point(10, 10)); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); generator()->ClickLeftButton(); // Test is continued in TestShowSiblingButtonListener::ButtonPressed(). } @@ -461,7 +461,7 @@ generator()->ReleaseLeftButton(); EXPECT_EQ(button(), button_listener.last_sender()); - EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_state()); + EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_GetState()); } TEST_F(MenuButtonTest, InkDropStateForMenuButtonActivationsWithoutListener) { @@ -570,7 +570,7 @@ generator()->DragMouseBy(10, 0); EXPECT_EQ(nullptr, button_listener.last_sender()); - EXPECT_EQ(Button::STATE_NORMAL, button_listener.last_sender_state()); + EXPECT_EQ(Button::STATE_NORMAL, button_listener.last_sender_GetState()); button()->RemovePreTargetHandler(&drag_client); } @@ -595,10 +595,10 @@ // Check that MenuButton has notified the listener, while it was in pressed // state. EXPECT_EQ(button(), button_listener.last_sender()); - EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_state()); + EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_GetState()); // The button should go back to it's normal state since the gesture ended. - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); } // Tests that the button enters a hovered state upon a tap down, before becoming @@ -607,10 +607,10 @@ TestButtonListener button_listener; CreateMenuButtonWithButtonListener(&button_listener); generator()->PressTouch(); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); generator()->ReleaseTouch(); - EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_state()); + EXPECT_EQ(Button::STATE_HOVERED, button_listener.last_sender_GetState()); } // Tests that a move event that exits the button returns it to the normal state, @@ -619,11 +619,11 @@ TestButtonListener button_listener; CreateMenuButtonWithButtonListener(&button_listener); generator()->PressTouch(); - EXPECT_EQ(Button::STATE_HOVERED, button()->state()); + EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); generator()->MoveTouch(gfx::Point(10, 30)); generator()->ReleaseTouch(); - EXPECT_EQ(Button::STATE_NORMAL, button()->state()); + EXPECT_EQ(Button::STATE_NORMAL, button()->GetState()); EXPECT_EQ(nullptr, button_listener.last_sender()); }
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index 72903d7..25efa36 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc
@@ -622,7 +622,7 @@ gfx::Rect bounds(menu_position, lb.size()); - Button::ButtonState original_state = arrow_button_->state(); + Button::ButtonState original_state = arrow_button_->GetState(); arrow_button_->SetState(Button::STATE_PRESSED); // Allow |menu_runner_| to be set by the testing API, but if this method is
diff --git a/ui/views/controls/scrollbar/base_scroll_bar_button.cc b/ui/views/controls/scrollbar/base_scroll_bar_button.cc index 122d1c1..e16c7b3 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar_button.cc +++ b/ui/views/controls/scrollbar/base_scroll_bar_button.cc
@@ -11,10 +11,12 @@ namespace views { -BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener) +BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener, + const base::TickClock* tick_clock) : Button(listener), repeater_(base::BindRepeating(&BaseScrollBarButton::RepeaterNotifyClick, - base::Unretained(this))) {} + base::Unretained(this)), + tick_clock) {} BaseScrollBarButton::~BaseScrollBarButton() = default;
diff --git a/ui/views/controls/scrollbar/base_scroll_bar_button.h b/ui/views/controls/scrollbar/base_scroll_bar_button.h index 052f5f1..b055ffd8 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar_button.h +++ b/ui/views/controls/scrollbar/base_scroll_bar_button.h
@@ -11,6 +11,10 @@ #include "build/build_config.h" #include "ui/views/repeat_controller.h" +namespace base { +class TickClock; +} + namespace views { /////////////////////////////////////////////////////////////////////////////// @@ -26,7 +30,8 @@ public: METADATA_HEADER(BaseScrollBarButton); - explicit BaseScrollBarButton(ButtonListener* listener); + explicit BaseScrollBarButton(ButtonListener* listener, + const base::TickClock* tick_clock = nullptr); ~BaseScrollBarButton() override; protected:
diff --git a/ui/views/controls/scrollbar/base_scroll_bar_button_unittest.cc b/ui/views/controls/scrollbar/base_scroll_bar_button_unittest.cc new file mode 100644 index 0000000..9c5f679c --- /dev/null +++ b/ui/views/controls/scrollbar/base_scroll_bar_button_unittest.cc
@@ -0,0 +1,134 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/views/controls/scrollbar/base_scroll_bar_button.h" + +#include <memory> + +#include "base/test/task_environment.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/display/test/scoped_screen_override.h" +#include "ui/display/test/test_screen.h" +#include "ui/events/base_event_utils.h" +#include "ui/events/event.h" +#include "ui/views/repeat_controller.h" +#include "ui/views/test/view_metadata_test_utils.h" + +namespace views { + +namespace { + +using testing::_; +using testing::AtLeast; +using testing::AtMost; + +class MockButtonListener : public ButtonListener { + public: + MockButtonListener() = default; + MockButtonListener(const MockButtonListener&) = delete; + MockButtonListener& operator=(const MockButtonListener&) = delete; + ~MockButtonListener() override = default; + + // ButtonListener: + MOCK_METHOD(void, + ButtonPressed, + (Button * sender, const ui::Event& event), + (override)); +}; + +class BaseScrollBarButtonTest : public testing::Test { + public: + BaseScrollBarButtonTest() + : button_(std::make_unique<BaseScrollBarButton>( + &listener_, + task_environment_.GetMockTickClock())) {} + + ~BaseScrollBarButtonTest() override = default; + + protected: + testing::StrictMock<MockButtonListener>& listener() { return listener_; } + Button* button() { return button_.get(); } + + void AdvanceTime(base::TimeDelta time_delta) { + task_environment_.FastForwardBy(time_delta); + } + + private: + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + display::test::TestScreen test_screen_; + display::test::ScopedScreenOverride screen_override{&test_screen_}; + + testing::StrictMock<MockButtonListener> listener_; + const std::unique_ptr<Button> button_; +}; + +} // namespace + +TEST_F(BaseScrollBarButtonTest, Metadata) { + test::TestViewMetadata(button()); +} + +TEST_F(BaseScrollBarButtonTest, CallbackFiresOnMouseDown) { + EXPECT_CALL(listener(), ButtonPressed(_, _)); + + // By default the button should notify its listener on mouse release. + button()->OnMousePressed(ui::MouseEvent( + ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); +} + +TEST_F(BaseScrollBarButtonTest, CallbackFilesMultipleTimesMouseHeldDown) { + EXPECT_CALL(listener(), ButtonPressed(_, _)).Times(AtLeast(2)); + + // By default the button should notify its listener on mouse release. + button()->OnMousePressed(ui::MouseEvent( + ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); + + AdvanceTime(RepeatController::GetInitialWaitForTesting() * 10); +} + +TEST_F(BaseScrollBarButtonTest, CallbackStopsFiringAfterMouseReleased) { + EXPECT_CALL(listener(), ButtonPressed(_, _)).Times(AtLeast(2)); + + // By default the button should notify its listener on mouse release. + button()->OnMousePressed(ui::MouseEvent( + ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); + + AdvanceTime(RepeatController::GetInitialWaitForTesting() * 10); + + testing::Mock::VerifyAndClearExpectations(&listener()); + + button()->OnMouseReleased(ui::MouseEvent( + ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); + + AdvanceTime(RepeatController::GetInitialWaitForTesting() * 10); + + EXPECT_CALL(listener(), ButtonPressed(_, _)).Times(AtMost(0)); +} + +TEST_F(BaseScrollBarButtonTest, CallbackStopsFiringAfterMouseCaptureReleased) { + EXPECT_CALL(listener(), ButtonPressed(_, _)).Times(AtLeast(2)); + + // By default the button should notify its listener on mouse release. + button()->OnMousePressed(ui::MouseEvent( + ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); + + AdvanceTime(RepeatController::GetInitialWaitForTesting() * 10); + + testing::Mock::VerifyAndClearExpectations(&listener()); + + button()->OnMouseCaptureLost(); + + AdvanceTime(RepeatController::GetInitialWaitForTesting() * 10); + + EXPECT_CALL(listener(), ButtonPressed(_, _)).Times(AtMost(0)); +} + +} // namespace views
diff --git a/ui/views/controls/scrollbar/scroll_bar_views.cc b/ui/views/controls/scrollbar/scroll_bar_views.cc index 5da0afbd..7d85eb0ac 100644 --- a/ui/views/controls/scrollbar/scroll_bar_views.cc +++ b/ui/views/controls/scrollbar/scroll_bar_views.cc
@@ -95,7 +95,7 @@ ui::NativeTheme::ExtraParams ScrollBarButton::GetNativeThemeParams() const { ui::NativeTheme::ExtraParams params; - switch (state()) { + switch (GetState()) { case Button::STATE_HOVERED: params.scrollbar_arrow.is_hovering = true; break; @@ -124,7 +124,7 @@ } ui::NativeTheme::State ScrollBarButton::GetNativeThemeState() const { - switch (state()) { + switch (GetState()) { case Button::STATE_HOVERED: return ui::NativeTheme::kHovered; case Button::STATE_PRESSED:
diff --git a/ui/views/window/frame_caption_button.cc b/ui/views/window/frame_caption_button.cc index 5a57f099..12b9bf4 100644 --- a/ui/views/window/frame_caption_button.cc +++ b/ui/views/window/frame_caption_button.cc
@@ -202,7 +202,7 @@ if (hover_animation().is_animating()) { highlight_alpha = hover_animation().CurrentValueBetween( SK_AlphaTRANSPARENT, kHighlightVisibleOpacity); - } else if (state() == STATE_HOVERED || state() == STATE_PRESSED) { + } else if (GetState() == STATE_HOVERED || GetState() == STATE_PRESSED) { // Painting a circular highlight in both "hovered" and "pressed" states // simulates and ink drop highlight mode of // AutoHighlightMode::SHOW_ON_RIPPLE. @@ -264,7 +264,7 @@ if (hover_animation().is_animating()) { inactive_alpha = hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); - } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { + } else if (GetState() == STATE_PRESSED || GetState() == STATE_HOVERED) { inactive_alpha = 1.0f; } return base_alpha * inactive_alpha;
diff --git a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/TabTest.java b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/TabTest.java index 89c07eb..9717e8c 100644 --- a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/TabTest.java +++ b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/TabTest.java
@@ -6,7 +6,10 @@ import android.graphics.Bitmap; import android.graphics.Color; +import android.view.View; +import android.view.ViewGroup; +import androidx.fragment.app.Fragment; import androidx.test.filters.SmallTest; import org.junit.Assert; @@ -241,4 +244,24 @@ mActivityTestRule.navigateAndWait( tab, mActivityTestRule.getTestDataURL("simple_page.html"), false); } + + @Test + @SmallTest + @MinWebLayerVersion(86) // New behavior added in 86 + public void testViewDetachedTabIsInvisible() throws Exception { + mActivity = mActivityTestRule.launchShellWithUrl("about:blank"); + + boolean hidden = mActivityTestRule.executeScriptAndExtractBoolean("document.hidden;"); + Assert.assertFalse(hidden); + + Fragment fragment = mActivityTestRule.getFragment(); + TestThreadUtils.runOnUiThreadBlocking(() -> { + View fragmentView = fragment.getView(); + ViewGroup parent = (ViewGroup) fragmentView.getParent(); + parent.removeView(fragmentView); + }); + + hidden = mActivityTestRule.executeScriptAndExtractBoolean("document.hidden;"); + Assert.assertTrue(hidden); + } }
diff --git a/weblayer/browser/browser_impl.cc b/weblayer/browser/browser_impl.cc index c3bb780..d480488 100644 --- a/weblayer/browser/browser_impl.cc +++ b/weblayer/browser/browser_impl.cc
@@ -13,6 +13,7 @@ #include "base/stl_util.h" #include "components/base32/base32.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/web_preferences.h" #include "weblayer/browser/browser_list.h" #include "weblayer/browser/feature_list_creator.h" @@ -114,6 +115,11 @@ TabImpl* BrowserImpl::CreateTabForSessionRestore( std::unique_ptr<content::WebContents> web_contents, const std::string& guid) { + if (!web_contents) { + content::WebContents::CreateParams create_params( + profile_->GetBrowserContext()); + web_contents = content::WebContents::Create(create_params); + } std::unique_ptr<TabImpl> tab = std::make_unique<TabImpl>(profile_, std::move(web_contents), guid); #if defined(OS_ANDROID)
diff --git a/weblayer/browser/java/BUILD.gn b/weblayer/browser/java/BUILD.gn index d2f31e0af..a424a6d 100644 --- a/weblayer/browser/java/BUILD.gn +++ b/weblayer/browser/java/BUILD.gn
@@ -114,8 +114,8 @@ "org/chromium/weblayer_private/WebLayerExceptionFilter.java", "org/chromium/weblayer_private/WebLayerFactoryImpl.java", "org/chromium/weblayer_private/WebLayerImpl.java", - "org/chromium/weblayer_private/WebLayerNotificationBuilder.java", "org/chromium/weblayer_private/WebLayerNotificationChannels.java", + "org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java", "org/chromium/weblayer_private/WebLayerSiteSettingsClient.java", "org/chromium/weblayer_private/WebLayerTabModalPresenter.java", "org/chromium/weblayer_private/WebMessageReplyProxyImpl.java",
diff --git a/weblayer/browser/java/DEPS b/weblayer/browser/java/DEPS index 819b5a6..75b1b714 100644 --- a/weblayer/browser/java/DEPS +++ b/weblayer/browser/java/DEPS
@@ -11,11 +11,13 @@ "+components/webapk/android/libs", "+services/device/public/java/src/org/chromium/device/geolocation", - # WebLayerNotificationBuilder should be used for all notifications. - "-components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java", + # WebLayerNotificationWrapperBuilder should be used for all notifications. + "-components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java", + "-components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java", ] specific_include_rules = { - "WebLayerNotificationBuilder.java": [ - "+components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationBuilder.java", + "WebLayerNotificationWrapperBuilder.java": [ + "+components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperCompatBuilder.java", + "+components/browser_ui/notifications/android/java/src/org/chromium/components/browser_ui/notifications/NotificationWrapperStandardBuilder.java", ] }
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java index 66433bd..3a04aadc 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java
@@ -36,7 +36,7 @@ * Implementation of {@link IBrowser}. */ @JNINamespace("weblayer") -public class BrowserImpl extends IBrowser.Stub { +public class BrowserImpl extends IBrowser.Stub implements View.OnAttachStateChangeListener { private final ObserverList<VisibleSecurityStateObserver> mVisibleSecurityStateObservers = new ObserverList<VisibleSecurityStateObserver>(); @@ -68,6 +68,7 @@ private Boolean mPasswordEchoEnabled; private Boolean mDarkThemeEnabled; private Float mFontScale; + private boolean mViewAttachedToWindow; // Created in the constructor from saved state and used in setClient(). private PersistenceInfo mPersistenceInfo; @@ -135,7 +136,7 @@ assert mEmbedderActivityContext == null; mWindowAndroid = windowAndroid; mEmbedderActivityContext = embedderAppContext; - mViewController = new BrowserViewController(windowAndroid); + mViewController = new BrowserViewController(windowAndroid, this); mLocaleReceiver = new LocaleChangedBroadcastReceiver(windowAndroid.getContext().get()); mPasswordEchoEnabled = null; } @@ -488,6 +489,30 @@ return mFragmentStoppedForConfigurationChange; } + public boolean isViewAttachedToWindow() { + return mViewAttachedToWindow; + } + + @Override + public void onViewAttachedToWindow(View v) { + mViewAttachedToWindow = true; + updateAllTabsViewAttachedState(); + } + + @Override + public void onViewDetachedFromWindow(View v) { + // Note this separate state is needed because v.isAttachedToWindow() + // still returns true inside this call. + mViewAttachedToWindow = false; + updateAllTabsViewAttachedState(); + } + + private void updateAllTabsViewAttachedState() { + for (Object tab : getTabs()) { + ((TabImpl) tab).updateViewAttachedStateFromBrowser(); + } + } + private void destroyAttachmentState() { if (mLocaleReceiver != null) { mLocaleReceiver.destroy(); @@ -496,6 +521,8 @@ if (mViewController != null) { mViewController.destroy(); mViewController = null; + mViewAttachedToWindow = false; + updateAllTabsViewAttachedState(); } if (mWindowAndroid != null) { mWindowAndroid.destroy();
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/BrowserViewController.java b/weblayer/browser/java/org/chromium/weblayer_private/BrowserViewController.java index 1fca2c4..033aeca 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/BrowserViewController.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/BrowserViewController.java
@@ -53,6 +53,7 @@ RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); private final FragmentWindowAndroid mWindowAndroid; + private final View.OnAttachStateChangeListener mOnAttachedStateChangeListener; private final ModalDialogManager mModalDialogManager; private TabImpl mTab; @@ -66,10 +67,13 @@ */ private boolean mCachedDoBrowserControlsShrinkRendererSize; - public BrowserViewController(FragmentWindowAndroid windowAndroid) { + public BrowserViewController( + FragmentWindowAndroid windowAndroid, View.OnAttachStateChangeListener listener) { mWindowAndroid = windowAndroid; + mOnAttachedStateChangeListener = listener; Context context = mWindowAndroid.getContext().get(); mContentViewRenderView = new ContentViewRenderView(context); + mContentViewRenderView.addOnAttachStateChangeListener(listener); mContentViewRenderView.onNativeLibraryLoaded( mWindowAndroid, ContentViewRenderView.MODE_SURFACE_VIEW); @@ -116,6 +120,7 @@ public void destroy() { mWindowAndroid.setModalDialogManager(null); setActiveTab(null); + mContentViewRenderView.removeOnAttachStateChangeListener(mOnAttachedStateChangeListener); mTopControlsContainerView.destroy(); mBottomControlsContainerView.destroy(); mContentViewRenderView.destroy();
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/DownloadImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/DownloadImpl.java index 88ff310..6dd5292d 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/DownloadImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/DownloadImpl.java
@@ -340,7 +340,7 @@ ? WebLayerNotificationChannels.ChannelId.COMPLETED_DOWNLOADS : WebLayerNotificationChannels.ChannelId.ACTIVE_DOWNLOADS; - WebLayerNotificationBuilder builder = WebLayerNotificationBuilder.create( + WebLayerNotificationWrapperBuilder builder = WebLayerNotificationWrapperBuilder.create( channelId, new NotificationMetadata(0, NOTIFICATION_TAG, mNotificationId)); builder.setOngoing(true) .setDeleteIntent(deletePendingIntent) @@ -443,7 +443,7 @@ cancelPendingIntent, 0 /* no action for UMA */); } - notificationManager.notify(builder.buildChromeNotification()); + notificationManager.notify(builder.buildNotificationWrapper()); } /**
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/ExternalNavigationDelegateImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/ExternalNavigationDelegateImpl.java index c854195..0038ec5 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/ExternalNavigationDelegateImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/ExternalNavigationDelegateImpl.java
@@ -15,7 +15,6 @@ import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.external_intents.ExternalNavigationDelegate; import org.chromium.components.external_intents.ExternalNavigationDelegate.StartActivityIfNeededResult; -import org.chromium.components.external_intents.ExternalNavigationHandler; import org.chromium.components.external_intents.ExternalNavigationHandler.OverrideUrlLoadingResult; import org.chromium.components.external_intents.ExternalNavigationParams; import org.chromium.components.webapk.lib.client.ChromeWebApkHostSignature; @@ -92,14 +91,6 @@ return StartActivityIfNeededResult.DID_NOT_HANDLE; } - @Override - public boolean startIncognitoIntent(final Intent intent, final String referrerUrl, - final String fallbackUrl, final boolean needsToCloseTab, final boolean proxy) { - // TODO(crbug.com/1063399): Determine if this behavior should be refined. - ExternalNavigationHandler.startActivity(intent, proxy, this); - return true; - } - // This method should never be invoked as WebLayer does not handle incoming intents. @Override public @OverrideUrlLoadingResult int handleIncognitoIntentTargetingSelf( @@ -196,6 +187,11 @@ } @Override + public boolean canCloseTabOnIncognitoIntentLaunch() { + return hasValidTab(); + } + + @Override public boolean isIntentForTrustedCallingApp(Intent intent) { return false; }
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java b/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java index a36125a..c0b875c8 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java
@@ -12,10 +12,10 @@ import org.chromium.components.browser_ui.media.MediaNotificationController; import org.chromium.components.browser_ui.media.MediaNotificationInfo; import org.chromium.components.browser_ui.media.MediaSessionHelper; -import org.chromium.components.browser_ui.notifications.ChromeNotification; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; import org.chromium.components.browser_ui.notifications.ForegroundServiceUtils; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; /** * A glue class for MediaSession. @@ -37,7 +37,7 @@ // notification hasn't been shown. See similar logic in {@link // ChromeMediaNotificationControllerDelegate}. MediaNotificationController.finishStartingForegroundServiceOnO( - service, createChromeNotificationBuilder().buildChromeNotification()); + service, createNotificationWrapperBuilder().buildNotificationWrapper()); // Call stopForeground to guarantee Android unset the foreground bit. ForegroundServiceUtils.getInstance().stopForeground( service, Service.STOP_FOREGROUND_REMOVE); @@ -109,8 +109,8 @@ } @Override - public ChromeNotificationBuilder createChromeNotificationBuilder() { - return MediaSessionManager.createChromeNotificationBuilder(); + public NotificationWrapperBuilder createNotificationWrapperBuilder() { + return MediaSessionManager.createNotificationWrapperBuilder(); } @Override @@ -119,17 +119,17 @@ } @Override - public void logNotificationShown(ChromeNotification notification) {} + public void logNotificationShown(NotificationWrapper notification) {} } - private static ChromeNotificationBuilder createChromeNotificationBuilder() { + private static NotificationWrapperBuilder createNotificationWrapperBuilder() { ensureNotificationId(); // Only the null tag will work as expected, because {@link Service#startForeground()} only // takes an ID and no tag. If we pass a tag here, then the notification that's used to // display a paused state (no foreground service) will not be identified as the same one // that's used with the foreground service. - return WebLayerNotificationBuilder.create( + return WebLayerNotificationWrapperBuilder.create( WebLayerNotificationChannels.ChannelId.MEDIA_PLAYBACK, new NotificationMetadata(0, null /*notificationTag*/, sNotificationId)); }
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java b/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java index 90925f10..12834007 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java
@@ -16,10 +16,10 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; -import org.chromium.components.browser_ui.notifications.ChromeNotification; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.PendingIntentProvider; import org.chromium.components.webrtc.MediaCaptureNotificationUtil; import org.chromium.components.webrtc.MediaCaptureNotificationUtil.MediaType; @@ -224,8 +224,8 @@ : audio ? MediaType.AUDIO_ONLY : MediaType.VIDEO_ONLY; // TODO(crbug/1076098): don't pass a URL in incognito. - ChromeNotification notification = MediaCaptureNotificationUtil.createNotification( - WebLayerNotificationBuilder.create( + NotificationWrapper notification = MediaCaptureNotificationUtil.createNotification( + WebLayerNotificationWrapperBuilder.create( WebLayerNotificationChannels.ChannelId.WEBRTC_CAM_AND_MIC, new NotificationMetadata(0, AV_STREAM_TAG, mNotificationId)), mediaType, mTab.getWebContents().getVisibleUrl().getSpec(),
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java index 9de5d65..0fc6241b 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java
@@ -311,7 +311,7 @@ mWebContents.setTopLevelNativeWindow(mBrowser.getWindowAndroid()); mViewAndroidDelegate.setContainerView(mBrowser.getViewAndroidDelegateContainerView()); doInitAfterSettingContainerView(); - updateWebContentsVisibility(); + updateViewAttachedStateFromBrowser(); boolean attached = (mBrowser.getContext() != null); mInterceptNavigationDelegateClient.onActivityAttachmentChanged(attached); @@ -343,6 +343,10 @@ } } + public void updateViewAttachedStateFromBrowser() { + updateWebContentsVisibility(); + } + public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) { if (mAutofillProvider == null) return; mAutofillProvider.onProvideAutoFillVirtualStructure(structure, flags); @@ -411,8 +415,9 @@ * Returns whether this Tab is visible. */ public boolean isVisible() { - return (mBrowser.getActiveTab() == this - && (mBrowser.isStarted() || mBrowser.isFragmentStoppedForConfigurationChange())); + return mBrowser.getActiveTab() == this + && (mBrowser.isStarted() || mBrowser.isFragmentStoppedForConfigurationChange()) + && mBrowser.isViewAttachedToWindow(); } private void updateWebContentsVisibility() {
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationBuilder.java b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java similarity index 86% rename from weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationBuilder.java rename to weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java index 50984bb6..fac8a47 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationBuilder.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java
@@ -15,32 +15,32 @@ import androidx.annotation.NonNull; import org.chromium.base.ContextUtils; -import org.chromium.components.browser_ui.notifications.ChromeNotificationBuilder; -import org.chromium.components.browser_ui.notifications.NotificationBuilder; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; +import org.chromium.components.browser_ui.notifications.NotificationWrapperStandardBuilder; import org.chromium.components.browser_ui.notifications.channels.ChannelsInitializer; /** A notification builder for WebLayer which has extra logic to make icons work correctly. */ -final class WebLayerNotificationBuilder extends NotificationBuilder { +final class WebLayerNotificationWrapperBuilder extends NotificationWrapperStandardBuilder { /** Creates a notification builder. */ - public static WebLayerNotificationBuilder create( + public static WebLayerNotificationWrapperBuilder create( @WebLayerNotificationChannels.ChannelId String channelId, @NonNull NotificationMetadata metadata) { Context appContext = ContextUtils.getApplicationContext(); ChannelsInitializer initializer = new ChannelsInitializer(new NotificationManagerProxyImpl(appContext), WebLayerNotificationChannels.getInstance(), appContext.getResources()); - return new WebLayerNotificationBuilder(appContext, channelId, initializer, metadata); + return new WebLayerNotificationWrapperBuilder(appContext, channelId, initializer, metadata); } - private WebLayerNotificationBuilder(Context context, String channelId, + private WebLayerNotificationWrapperBuilder(Context context, String channelId, ChannelsInitializer channelsInitializer, NotificationMetadata metadata) { super(context, channelId, channelsInitializer, metadata); } @Override - public ChromeNotificationBuilder setSmallIcon(int icon) { + public NotificationWrapperBuilder setSmallIcon(int icon) { if (WebLayerImpl.isAndroidResource(icon)) { super.setSmallIcon(icon); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { @@ -54,7 +54,8 @@ @Override @SuppressWarnings("deprecation") - public ChromeNotificationBuilder addAction(int icon, CharSequence title, PendingIntent intent) { + public NotificationWrapperBuilder addAction( + int icon, CharSequence title, PendingIntent intent) { if (WebLayerImpl.isAndroidResource(icon)) { super.addAction(icon, title, intent); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
diff --git a/weblayer/browser/java/res/layout/weblayer_url_bar.xml b/weblayer/browser/java/res/layout/weblayer_url_bar.xml index 1e8828d..e5f2b57b 100644 --- a/weblayer/browser/java/res/layout/weblayer_url_bar.xml +++ b/weblayer/browser/java/res/layout/weblayer_url_bar.xml
@@ -24,7 +24,7 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_vertical" - android:maxLines="1" + android:singleLine="true" android:paddingEnd="@dimen/url_text_edge_padding" android:paddingStart="@dimen/url_text_edge_padding" android:ellipsize="start"
diff --git a/weblayer/browser/tab_impl.cc b/weblayer/browser/tab_impl.cc index 03cf238..f5ca506 100644 --- a/weblayer/browser/tab_impl.cc +++ b/weblayer/browser/tab_impl.cc
@@ -240,8 +240,10 @@ return nullptr; } -TabImpl::TabImpl(ProfileImpl* profile, const JavaParamRef<jobject>& java_impl) - : TabImpl(profile) { +TabImpl::TabImpl(ProfileImpl* profile, + const JavaParamRef<jobject>& java_impl, + std::unique_ptr<content::WebContents> web_contents) + : TabImpl(profile, std::move(web_contents)) { java_impl_ = java_impl; } #endif @@ -253,16 +255,10 @@ web_contents_(std::move(web_contents)), guid_(guid.empty() ? base::GenerateGUID() : guid) { GetTabs().insert(this); - if (web_contents_) { - // This code path is hit when the page requests a new tab, which should - // only be possible from the same profile. - DCHECK_EQ(profile_->GetBrowserContext(), - web_contents_->GetBrowserContext()); - } else { - content::WebContents::CreateParams create_params( - profile_->GetBrowserContext()); - web_contents_ = content::WebContents::Create(create_params); - } + DCHECK(web_contents_); + // This code path is hit when the page requests a new tab, which should + // only be possible from the same profile. + DCHECK_EQ(profile_->GetBrowserContext(), web_contents_->GetBrowserContext()); // By default renderer initiated navigations inherit the user-agent override // of the current NavigationEntry. For WebLayer, the user-agent override is @@ -542,8 +538,12 @@ static jlong JNI_TabImpl_CreateTab(JNIEnv* env, jlong profile, const JavaParamRef<jobject>& java_impl) { - return reinterpret_cast<intptr_t>( - new TabImpl(reinterpret_cast<ProfileImpl*>(profile), java_impl)); + ProfileImpl* profile_impl = reinterpret_cast<ProfileImpl*>(profile); + content::WebContents::CreateParams create_params( + profile_impl->GetBrowserContext()); + create_params.initially_hidden = true; + return reinterpret_cast<intptr_t>(new TabImpl( + profile_impl, java_impl, content::WebContents::Create(create_params))); } static void JNI_TabImpl_DeleteTab(JNIEnv* env, jlong tab) {
diff --git a/weblayer/browser/tab_impl.h b/weblayer/browser/tab_impl.h index 8148eb1f..2b36d03 100644 --- a/weblayer/browser/tab_impl.h +++ b/weblayer/browser/tab_impl.h
@@ -99,10 +99,11 @@ // TODO(sky): investigate a better way to not have so many ifdefs. #if defined(OS_ANDROID) TabImpl(ProfileImpl* profile, - const base::android::JavaParamRef<jobject>& java_impl); + const base::android::JavaParamRef<jobject>& java_impl, + std::unique_ptr<content::WebContents> web_contents); #endif explicit TabImpl(ProfileImpl* profile, - std::unique_ptr<content::WebContents> = nullptr, + std::unique_ptr<content::WebContents> web_contents, const std::string& guid = std::string()); ~TabImpl() override;
diff --git a/weblayer/shell/browser/shell_views.cc b/weblayer/shell/browser/shell_views.cc index ed79983..33bc2736 100644 --- a/weblayer/shell/browser/shell_views.cc +++ b/weblayer/shell/browser/shell_views.cc
@@ -105,7 +105,7 @@ void UpdateLoadProgress(double progress = 0.) { std::string stop_text("Stop"); - if (stop_button_->state() == views::Button::STATE_NORMAL) + if (stop_button_->GetState() == views::Button::STATE_NORMAL) stop_text = base::StringPrintf("Stop (%.0f%%)", progress * 100); stop_button_->SetText(base::ASCIIToUTF16(stop_text)); }