diff --git a/chrome/browser/browser_process_platform_part_chromeos.cc b/chrome/browser/browser_process_platform_part_chromeos.cc index c7a44467..6f06d96 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.cc +++ b/chrome/browser/browser_process_platform_part_chromeos.cc
@@ -193,16 +193,24 @@ system_clock_.reset(); } -void BrowserProcessPlatformPart::AddCompatibleCrOSComponent( - const std::string& name) { - compatible_cros_components_.insert(name); +void BrowserProcessPlatformPart::SetCompatibleCrosComponentPath( + const std::string& name, + const base::FilePath& path) { + compatible_cros_components_[name] = path; } -bool BrowserProcessPlatformPart::IsCompatibleCrOSComponent( - const std::string& name) { +bool BrowserProcessPlatformPart::IsCompatibleCrosComponent( + const std::string& name) const { return compatible_cros_components_.count(name) > 0; } +base::FilePath BrowserProcessPlatformPart::GetCompatibleCrosComponentPath( + const std::string& name) const { + const auto it = compatible_cros_components_.find(name); + return it == compatible_cros_components_.end() ? base::FilePath() + : it->second; +} + ui::InputDeviceControllerClient* BrowserProcessPlatformPart::GetInputDeviceControllerClient() { if (!input_device_controller_client_) {
diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h index 0aca3df..86e57d54f 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.h +++ b/chrome/browser/browser_process_platform_part_chromeos.h
@@ -9,7 +9,7 @@ #include <string> #include "base/compiler_specific.h" -#include "base/containers/flat_set.h" +#include "base/containers/flat_map.h" #include "base/macros.h" #include "base/sequence_checker.h" #include "chrome/browser/browser_process_platform_part_base.h" @@ -104,9 +104,17 @@ chromeos::system::SystemClock* GetSystemClock(); void DestroySystemClock(); - void AddCompatibleCrOSComponent(const std::string& name); + // Saves the name and install path of a compatible component. + void SetCompatibleCrosComponentPath(const std::string& name, + const base::FilePath& path); - bool IsCompatibleCrOSComponent(const std::string& name); + // Checks if the current installed component is compatible given a component + // |name|. If compatible, sets |path| to be its installed path. + bool IsCompatibleCrosComponent(const std::string& name) const; + + // Returns installed path of a compatible component given |name|. Returns an + // empty path if the component isn't compatible. + base::FilePath GetCompatibleCrosComponentPath(const std::string& name) const; ui::InputDeviceControllerClient* GetInputDeviceControllerClient(); @@ -136,7 +144,8 @@ std::unique_ptr<ScopedKeepAlive> keep_alive_; - base::flat_set<std::string> compatible_cros_components_; + // Maps from a compatible component name to its installed path. + base::flat_map<std::string, base::FilePath> compatible_cros_components_; #if defined(USE_OZONE) std::unique_ptr<ui::InputDeviceControllerClient>
diff --git a/chrome/browser/chromeos/file_system_provider/operations/operation.cc b/chrome/browser/chromeos/file_system_provider/operations/operation.cc index 5e80089..41308dc 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/operation.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/operation.cc
@@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" #include "extensions/browser/event_router.h" +#include "extensions/common/extension_id.h" namespace chromeos { namespace file_system_provider { @@ -18,7 +19,7 @@ // Default implementation for dispatching an event. Can be replaced for unit // tests by Operation::SetDispatchEventImplForTest(). bool DispatchEventImpl(extensions::EventRouter* event_router, - const std::string& extension_id, + const extensions::ExtensionId& extension_id, std::unique_ptr<extensions::Event> event) { if (!event_router->ExtensionHasEventListener(extension_id, event->event_name)) return false;
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc index f41adf2..cf22de1 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc
@@ -16,7 +16,8 @@ ProviderId::ProviderId() : type_(INVALID) {} // static -ProviderId ProviderId::CreateFromExtensionId(const std::string& extension_id) { +ProviderId ProviderId::CreateFromExtensionId( + const extensions::ExtensionId& extension_id) { return ProviderId(extension_id, EXTENSION); } @@ -25,7 +26,7 @@ return ProviderId(native_id, NATIVE); } -const std::string& ProviderId::GetExtensionId() const { +const extensions::ExtensionId& ProviderId::GetExtensionId() const { CHECK_EQ(EXTENSION, type_); return internal_id_; } @@ -111,7 +112,7 @@ } ProvidedFileSystemInfo::ProvidedFileSystemInfo( - const std::string& extension_id, + const extensions::ExtensionId& extension_id, const MountOptions& mount_options, const base::FilePath& mount_path, bool configurable,
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h index de5199f45..ecd14853 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h
@@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h" +#include "extensions/common/extension_id.h" namespace chromeos { namespace file_system_provider { @@ -36,11 +37,12 @@ enum ProviderType : uint32_t { EXTENSION, NATIVE, INVALID }; ProviderId(); - static ProviderId CreateFromExtensionId(const std::string& extension_id); + static ProviderId CreateFromExtensionId( + const extensions::ExtensionId& extension_id); static ProviderId CreateFromNativeId(const std::string& native_id); const std::string& GetIdUnsafe() const; - const std::string& GetExtensionId() const; + const extensions::ExtensionId& GetExtensionId() const; const std::string& GetNativeId() const; std::string ToString() const; ProviderType GetType() const; @@ -67,7 +69,7 @@ bool watchable, extensions::FileSystemProviderSource source); - ProvidedFileSystemInfo(const std::string& extension_id, + ProvidedFileSystemInfo(const extensions::ExtensionId& extension_id, const MountOptions& mount_options, const base::FilePath& mount_path, bool configurable,
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc index b1d9809..1fae447 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
@@ -29,6 +29,7 @@ #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/event_router.h" +#include "extensions/common/extension_id.h" #include "storage/browser/fileapi/watcher_manager.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,7 +63,7 @@ // Handles an event which would normally be routed to an extension. Instead // replies with a hard coded response. void DispatchEventToExtension( - const std::string& extension_id, + const extensions::ExtensionId& extension_id, std::unique_ptr<extensions::Event> event) override { ASSERT_TRUE(file_system_); std::string file_system_id;
diff --git a/chrome/browser/chromeos/file_system_provider/service.cc b/chrome/browser/chromeos/file_system_provider/service.cc index e488229..6265c544 100644 --- a/chrome/browser/chromeos/file_system_provider/service.cc +++ b/chrome/browser/chromeos/file_system_provider/service.cc
@@ -24,6 +24,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/common/extension_id.h" #include "extensions/common/permissions/api_permission.h" #include "extensions/common/permissions/permissions_data.h" #include "storage/browser/fileapi/external_mount_points.h" @@ -321,8 +322,9 @@ // TODO(mtomasz): Refactor providers into per-filesystem, enabling this code // duplication to be removed. -bool Service::GetProvidingExtensionInfo(const std::string& extension_id, - ProvidingExtensionInfo* result) const { +bool Service::GetProvidingExtensionInfo( + const extensions::ExtensionId& extension_id, + ProvidingExtensionInfo* result) const { DCHECK(result); extensions::ExtensionRegistry* const registry = extensions::ExtensionRegistry::Get(profile_);
diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h index efa9c22..3614a359 100644 --- a/chrome/browser/chromeos/file_system_provider/service.h +++ b/chrome/browser/chromeos/file_system_provider/service.h
@@ -127,7 +127,7 @@ // Fills information of the specified providing extension and returns true. // If the extension is not a provider, or it doesn't exist, then false is // returned. - bool GetProvidingExtensionInfo(const std::string& extension_id, + bool GetProvidingExtensionInfo(const extensions::ExtensionId& extension_id, ProvidingExtensionInfo* result) const; // Adds and removes observers.
diff --git a/chrome/browser/chromeos/file_system_provider/service_unittest.cc b/chrome/browser/chromeos/file_system_provider/service_unittest.cc index b249617..f3cf4fe5 100644 --- a/chrome/browser/chromeos/file_system_provider/service_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/service_unittest.cc
@@ -34,6 +34,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" +#include "extensions/common/extension_id.h" #include "extensions/common/manifest_constants.h" #include "storage/browser/fileapi/external_mount_points.h" #include "testing/gtest/include/gtest/gtest.h" @@ -56,7 +57,7 @@ // Creates a fake extension with the specified |extension_id|. // TODO(mtomasz): Use the extension builder. scoped_refptr<extensions::Extension> CreateFakeExtension( - const std::string& extension_id) { + const extensions::ExtensionId& extension_id) { base::DictionaryValue manifest; std::string error; manifest.SetKey(extensions::manifest_keys::kVersion, base::Value("1.0.0.0"));
diff --git a/chrome/browser/component_updater/cros_component_installer.cc b/chrome/browser/component_updater/cros_component_installer.cc index b519d4d..82c3ff47 100644 --- a/chrome/browser/component_updater/cros_component_installer.cc +++ b/chrome/browser/component_updater/cros_component_installer.cc
@@ -52,32 +52,6 @@ using ConfigMap = std::map<std::string, std::map<std::string, std::string>>; -void LogRegistrationResult(base::Optional<bool> result) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!result.has_value()) { - DVLOG(1) << "Call to imageloader service failed."; - return; - } - if (!result.value()) { - DVLOG(1) << "Component registration failed"; - return; - } -} - -void ImageLoaderRegistration(const std::string& version, - const base::FilePath& install_dir, - const std::string& name) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - chromeos::ImageLoaderClient* loader = - chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); - if (loader) { - loader->RegisterComponent(name, version, install_dir.value(), - base::BindOnce(&LogRegistrationResult)); - } else { - DVLOG(1) << "Failed to get ImageLoaderClient object."; - } -} - ComponentConfig::ComponentConfig(const std::string& name, const std::string& env_version, const std::string& sha2hashstr) @@ -109,23 +83,10 @@ CrOSComponentInstallerPolicy::OnCustomInstall( const base::DictionaryValue& manifest, const base::FilePath& install_dir) { - std::string version; - if (!manifest.GetString("version", &version)) { - return ToInstallerResult(update_client::InstallError::GENERIC_ERROR); - } - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::BindOnce(&ImageLoaderRegistration, version, install_dir, name)); return update_client::CrxInstaller::Result(update_client::InstallError::NONE); } void CrOSComponentInstallerPolicy::OnCustomUninstall() { - chromeos::ImageLoaderClient* loader = - chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); - if (loader) { - loader->RemoveComponent( - name, base::BindOnce(base::Callback<void(base::Optional<bool>)>())); - } } void CrOSComponentInstallerPolicy::ComponentReady( @@ -135,7 +96,8 @@ std::string min_env_version; if (manifest && manifest->GetString("min_env_version", &min_env_version)) { if (IsCompatible(env_version, min_env_version)) { - g_browser_process->platform_part()->AddCompatibleCrOSComponent(GetName()); + g_browser_process->platform_part()->SetCompatibleCrosComponentPath( + GetName(), path); } } } @@ -194,15 +156,22 @@ static void LoadComponentInternal( const std::string& name, base::OnceCallback<void(const std::string&)> load_callback) { - DCHECK(g_browser_process->platform_part()->IsCompatibleCrOSComponent(name)); + DCHECK(g_browser_process->platform_part()->IsCompatibleCrosComponent(name)); chromeos::ImageLoaderClient* loader = chromeos::DBusThreadManager::Get()->GetImageLoaderClient(); if (loader) { - loader->LoadComponent( - name, base::BindOnce(&LoadResult, std::move(load_callback))); - } else { - base::PostTask(FROM_HERE, base::BindOnce(std::move(load_callback), "")); + base::FilePath path; + path = g_browser_process->platform_part()->GetCompatibleCrosComponentPath( + name); + // path is empty if no compatible component is available to load. + if (!path.empty()) { + loader->LoadComponentAtPath( + name, path, base::BindOnce(&LoadResult, std::move(load_callback))); + return; + } } + base::PostTask(FROM_HERE, + base::BindOnce(std::move(load_callback), std::string())); } // It calls LoadComponentInternal to load the installed component. @@ -239,7 +208,8 @@ const ConfigMap components = CONFIG_MAP_CONTENT; const auto it = components.find(name); if (name.empty() || it == components.end()) { - base::PostTask(FROM_HERE, base::BindOnce(std::move(load_callback), "")); + base::PostTask(FROM_HERE, + base::BindOnce(std::move(load_callback), std::string())); return; } ComponentConfig config(it->first, it->second.find("env_version")->second, @@ -256,7 +226,7 @@ void CrOSComponent::LoadComponent( const std::string& name, base::OnceCallback<void(const std::string&)> load_callback) { - if (!g_browser_process->platform_part()->IsCompatibleCrOSComponent(name)) { + if (!g_browser_process->platform_part()->IsCompatibleCrosComponent(name)) { // A compatible component is not installed, start installation process. auto* const cus = g_browser_process->component_updater(); InstallComponent(cus, name, std::move(load_callback));
diff --git a/chrome/browser/component_updater/cros_component_installer_unittest.cc b/chrome/browser/component_updater/cros_component_installer_unittest.cc index 3477646..16992ac 100644 --- a/chrome/browser/component_updater/cros_component_installer_unittest.cc +++ b/chrome/browser/component_updater/cros_component_installer_unittest.cc
@@ -57,10 +57,16 @@ void load_callback(const std::string& result) {} TEST_F(CrOSComponentInstallerTest, BPPPCompatibleCrOSComponent) { + const std::string kComponent = "a"; BrowserProcessPlatformPart bppp; - ASSERT_EQ(bppp.IsCompatibleCrOSComponent("a"), false); - bppp.AddCompatibleCrOSComponent("a"); - ASSERT_EQ(bppp.IsCompatibleCrOSComponent("a"), true); + EXPECT_FALSE(bppp.IsCompatibleCrosComponent(kComponent)); + EXPECT_EQ(bppp.GetCompatibleCrosComponentPath(kComponent).value(), + std::string()); + + const base::FilePath kPath("/component/path/v0"); + bppp.SetCompatibleCrosComponentPath(kComponent, kPath); + EXPECT_TRUE(bppp.IsCompatibleCrosComponent(kComponent)); + EXPECT_EQ(bppp.GetCompatibleCrosComponentPath("a"), kPath); } TEST_F(CrOSComponentInstallerTest, ComponentReadyCorrectManifest) {
diff --git a/chromeos/dbus/fake_image_loader_client.cc b/chromeos/dbus/fake_image_loader_client.cc index 1af9ea7f..9dcef0b 100644 --- a/chromeos/dbus/fake_image_loader_client.cc +++ b/chromeos/dbus/fake_image_loader_client.cc
@@ -23,6 +23,12 @@ DBusMethodCallback<std::string> callback) { std::move(callback).Run(base::nullopt); } +void FakeImageLoaderClient::LoadComponentAtPath( + const std::string& name, + const base::FilePath& path, + DBusMethodCallback<std::string> callback) { + std::move(callback).Run(base::nullopt); +} void FakeImageLoaderClient::RemoveComponent(const std::string& name, DBusMethodCallback<bool> callback) {
diff --git a/chromeos/dbus/fake_image_loader_client.h b/chromeos/dbus/fake_image_loader_client.h index 81c58c8..24898b8 100644 --- a/chromeos/dbus/fake_image_loader_client.h +++ b/chromeos/dbus/fake_image_loader_client.h
@@ -28,6 +28,9 @@ DBusMethodCallback<bool> callback) override; void LoadComponent(const std::string& name, DBusMethodCallback<std::string> callback) override; + void LoadComponentAtPath(const std::string& name, + const base::FilePath& path, + DBusMethodCallback<std::string> callback) override; void RemoveComponent(const std::string& name, DBusMethodCallback<bool> callback) override; void RequestComponentVersion(
diff --git a/chromeos/dbus/image_loader_client.cc b/chromeos/dbus/image_loader_client.cc index f128f02..bad965a 100644 --- a/chromeos/dbus/image_loader_client.cc +++ b/chromeos/dbus/image_loader_client.cc
@@ -51,6 +51,19 @@ std::move(callback))); } + void LoadComponentAtPath(const std::string& name, + const base::FilePath& path, + DBusMethodCallback<std::string> callback) override { + dbus::MethodCall method_call(imageloader::kImageLoaderServiceInterface, + imageloader::kLoadComponentAtPath); + dbus::MessageWriter writer(&method_call); + writer.AppendString(name); + writer.AppendString(path.value()); + proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::BindOnce(&ImageLoaderClientImpl::OnStringMethod, + std::move(callback))); + } + void RemoveComponent(const std::string& name, DBusMethodCallback<bool> callback) override { dbus::MethodCall method_call(imageloader::kImageLoaderServiceInterface,
diff --git a/chromeos/dbus/image_loader_client.h b/chromeos/dbus/image_loader_client.h index aa76add..8880ccee 100644 --- a/chromeos/dbus/image_loader_client.h +++ b/chromeos/dbus/image_loader_client.h
@@ -8,6 +8,7 @@ #include <string> #include "base/callback.h" +#include "base/files/file_path.h" #include "base/macros.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" @@ -33,6 +34,13 @@ virtual void LoadComponent(const std::string& name, DBusMethodCallback<std::string> callback) = 0; + // Mounts a component given the |name| and install path |path|, then returns + // the mount point (if call is successful). + virtual void LoadComponentAtPath( + const std::string& name, + const base::FilePath& path, + DBusMethodCallback<std::string> callback) = 0; + // Requests the currently registered version of the given component |name|. virtual void RequestComponentVersion( const std::string& name,
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 91c2b6de..13ec20e 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -8074,8 +8074,7 @@ crbug.com/591099 virtual/layout_ng/fast/block/margin-collapse/self-collapsing-cols-creates-block-formatting-context.html [ Pass ] crbug.com/591099 virtual/layout_ng/overflow/overflow-basic-003.html [ Pass ] crbug.com/591099 virtual/layout_ng/overflow/overflow-bug-chrome-ng-001.html [ Pass ] -crbug.com/714962 virtual/layout_ng_paint/fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure Pass ] -crbug.com/591099 virtual/layout_ng_paint/fast/inline/inline-box-adjust-position-crash.html [ Pass ] +crbug.com/591099 virtual/layout_ng_paint/ [ Skip ] crbug.com/591099 virtual/mojo-blobs/ [ Skip ] crbug.com/591099 virtual/mojo-localstorage/ [ Skip ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/anchor-empty-focus.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 8e8ae697..1d3fd3d4 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -642,6 +642,61 @@ crbug.com/714962 virtual/layout_ng_paint/fast/inline/outline-continuations.html [ Failure ] crbug.com/714962 virtual/layout_ng_paint/fast/inline/styledEmptyInlinesWithBRs.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/Kusa-Makura-background-canvas.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/auto-margins-across-boundaries.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/auto-sizing-orthogonal-flows.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/background-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/background-vertical-rl.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/basic-vertical-line.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/block-level-images.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-image-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-image-vertical-rl.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-radius-clipping-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-styles-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-styles-vertical-rl.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/border-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/borders.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/box-shadow-horizontal-tb-tile-edge.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/box-shadow-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/box-shadow-vertical-rl.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/broken-ideograph-small-caps.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/broken-ideographic-font.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/english-lr-text.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/english-rl-text.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/fallback-orientation.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/fieldsets.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/flipped-blocks-hit-test-line-edges.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/flipped-blocks-inline-map-local-to-container.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/flipped-blocks-text-map-local-to-container.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-lr-selection.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-lr-text.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-rl-selection.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-rl-text-with-broken-font.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-rl-text.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-ruby-vertical-lr.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/japanese-ruby-vertical-rl.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/logical-height-after-clear.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/margins.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/orthogonal-inline-block.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/orthogonal-writing-modes-available-width-absolute-crash.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/orthogonal-writing-modes-in-layoutview-with-floats.html [ Crash ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/percentage-height-orthogonal-writing-modes.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/percentage-margins-absolute-replaced.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/percentage-margins-absolute.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/table-hit-test.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/table-percent-width-quirk.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/text-combine-compress.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/text-combine-justify.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/text-combine-line-break.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/text-combine-various-fonts.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/text-orientation-basic.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/vertical-align-table-baseline.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/vertical-baseline-alignment.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/vertical-font-fallback.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/vertical-lr-replaced-selection.html [ Failure ] +crbug.com/714962 virtual/layout_ng_paint/fast/writing-mode/vertical-rl-replaced-selection.html [ Failure ] + # ====== LayoutNG-only failures until here ====== # ====== IncrementalShadowDOM-only failures from here ======
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites index ed52f0f0..ffa8aef5 100644 --- a/third_party/WebKit/LayoutTests/VirtualTestSuites +++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -423,6 +423,11 @@ "args": ["--enable-blink-features=LayoutNG,LayoutNGPaintFragments"] }, { + "prefix": "layout_ng_paint", + "base": "fast/writing-mode", + "args": ["--enable-blink-features=LayoutNG,LayoutNGPaintFragments"] + }, + { "prefix": "feature-policy", "base": "http/tests/feature-policy", "args": ["--enable-blink-features=FeaturePolicy"]
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/README.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/README.txt new file mode 100644 index 0000000..a690ea15 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/README.txt
@@ -0,0 +1,3 @@ +# This suite runs the tests in fast/writing-mode with +# --enable-blink-features=LayoutNG,LayoutNGPaintFragments. +# The LayoutNG project is described here: http://goo.gl/1hwhfX
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/floats-in-block-layout-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/floats-in-block-layout-expected.txt new file mode 100644 index 0000000..0669b5f --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/floats-in-block-layout-expected.txt
@@ -0,0 +1,10 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 308x600 + LayoutNGBlockFlow {HTML} at (0,0) size 308x600 + LayoutNGBlockFlow {BODY} at (8,8) size 100x584 + LayoutNGBlockFlow {DIV} at (0,0) size 100x584 [bgcolor=#FFFF00] + LayoutNGBlockFlow (floating) {DIV} at (100,10) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow (floating) {DIV} at (100,474) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow (floating) {DIV} at (200,10) size 100x100 [bgcolor=#800080] + LayoutNGBlockFlow (floating) {DIV} at (200,474) size 100x100 [bgcolor=#800080]
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/inline-direction-positioning-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/inline-direction-positioning-expected.txt new file mode 100644 index 0000000..6e2ed19e --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/inline-direction-positioning-expected.txt
@@ -0,0 +1,9 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x224 + LayoutNGBlockFlow {HTML} at (0,0) size 800x224 + LayoutNGBlockFlow {BODY} at (8,8) size 784x208 + LayoutNGBlockFlow {DIV} at (0,0) size 604x104 [border: (2px solid #000000)] + LayoutNGBlockFlow {DIV} at (52,2) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (0,104) size 604x104 [border: (2px solid #000000)] + LayoutNGBlockFlow {DIV} at (452,2) size 100x100 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/margin-collapse-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/margin-collapse-expected.txt new file mode 100644 index 0000000..1b38423d --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/margin-collapse-expected.txt
@@ -0,0 +1,10 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x580 + LayoutNGBlockFlow {HTML} at (0,0) size 800x580 + LayoutNGBlockFlow {BODY} at (8,8) size 784x564 + LayoutNGBlockFlow {DIV} at (0,0) size 784x564 [border: (2px solid #000000)] + LayoutNGBlockFlow {DIV} at (18,34) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (18,166) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (18,298) size 100x100 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (18,430) size 100x100 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/root-lr-basic-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/root-lr-basic-expected.txt new file mode 100644 index 0000000..75d38dd5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/root-lr-basic-expected.txt
@@ -0,0 +1,5 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 104x600 + LayoutNGBlockFlow {HTML} at (0,0) size 104x600 [border: (2px solid #000000)] + LayoutNGBlockFlow {BODY} at (10,10) size 0x580
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/self-collapsing-block-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/self-collapsing-block-expected.txt new file mode 100644 index 0000000..2253835 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/self-collapsing-block-expected.txt
@@ -0,0 +1,8 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 316x600 + LayoutNGBlockFlow {HTML} at (0,0) size 316x600 + LayoutNGBlockFlow {BODY} at (8,8) size 300x584 + LayoutNGBlockFlow {DIV} at (0,0) size 100x584 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (200,0) size 0x100 + LayoutNGBlockFlow {DIV} at (200,0) size 100x584 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/table-percent-width-quirk-expected.txt b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/table-percent-width-quirk-expected.txt new file mode 100644 index 0000000..bec71f1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/layout_ng_paint/fast/writing-mode/table-percent-width-quirk-expected.txt
@@ -0,0 +1,56 @@ +layer at (0,0) size 800x600 + LayoutView at (0,0) size 800x600 +layer at (0,0) size 800x8 + LayoutNGBlockFlow {HTML} at (0,0) size 800x8 + LayoutNGBlockFlow {BODY} at (8,8) size 784x0 +layer at (8,50) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,50) size 100x50 [bgcolor=#808080] +layer at (8,50) size 20x40 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 20x40 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutNGBlockFlow {DIV} at (0,20) size 20x20 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 +layer at (8,125) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,125) size 100x50 [bgcolor=#808080] +layer at (8,125) size 20x40 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 20x40 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutTable {TABLE} at (0,20) size 20x20 [bgcolor=#008000] + LayoutTableSection {TBODY} at (0,0) size 20x20 + LayoutTableRow {TR} at (0,0) size 20x20 + LayoutNGTableCell {TD} at (0,0) size 20x20 [r=0 c=0 rs=1 cs=1] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 +layer at (8,200) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,200) size 100x50 [bgcolor=#808080] +layer at (68,200) size 40x20 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 40x20 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutTable {TABLE} at (20,0) size 20x20 [bgcolor=#008000] + LayoutTableSection {TBODY} at (0,0) size 20x20 + LayoutTableRow {TR} at (0,0) size 20x20 + LayoutNGTableCell {TD} at (0,0) size 20x20 [r=0 c=0 rs=1 cs=1] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 +layer at (8,275) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,275) size 100x50 [bgcolor=#808080] +layer at (68,275) size 40x20 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 40x20 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutNGBlockFlow {DIV} at (20,0) size 20x20 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 +layer at (8,350) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,350) size 100x50 [bgcolor=#808080] +layer at (-712,350) size 820x20 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 820x20 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutTable {TABLE} at (20,0) size 800x20 [bgcolor=#008000] + LayoutTableSection {TBODY} at (0,0) size 800x20 + LayoutTableRow {TR} at (0,0) size 800x20 + LayoutNGTableCell {TD} at (0,0) size 800x20 [r=0 c=0 rs=1 cs=1] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 +layer at (8,425) size 100x50 + LayoutNGBlockFlow (positioned) {DIV} at (8,425) size 100x50 [bgcolor=#808080] +layer at (-712,425) size 820x20 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 + LayoutNGBlockFlow (positioned) {DIV} at (0,0) size 820x20 [bgcolor=#0000FF] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20 + LayoutNGBlockFlow {DIV} at (20,0) size 800x20 [bgcolor=#008000] + LayoutNGBlockFlow {DIV} at (0,0) size 20x20
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp index c2adfe2..311e19d 100644 --- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp +++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -687,15 +687,43 @@ paint_range_ = new_range.PaintRange(); if (paint_range_.IsNull()) return; - if (paint_range_.StartLayoutObject() == paint_range_.EndLayoutObject()) { - DCHECK_EQ(paint_range_.StartLayoutObject()->GetSelectionState(), - SelectionState::kStartAndEnd); - return; + // TODO(yoichio): Remove this if state. + // This SelectionState reassignment is ad-hoc patch for + // prohibiting use-after-free(crbug.com/752715). + // LayoutText::setSelectionState(state) propergates |state| to ancestor + // LayoutObjects, which can accidentally change start/end LayoutObject state + // then LayoutObject::IsSelectionBorder() returns false although we should + // clear selection at LayoutObject::WillBeRemoved(). + // We should make LayoutObject::setSelectionState() trivial and remove + // such propagation or at least do it in LayoutSelection. + if ((paint_range_.StartLayoutObject()->GetSelectionState() != + SelectionState::kStart && + paint_range_.StartLayoutObject()->GetSelectionState() != + SelectionState::kStartAndEnd) || + (paint_range_.EndLayoutObject()->GetSelectionState() != + SelectionState::kEnd && + paint_range_.EndLayoutObject()->GetSelectionState() != + SelectionState::kStartAndEnd)) { + if (paint_range_.StartLayoutObject() == paint_range_.EndLayoutObject()) { + paint_range_.StartLayoutObject()->LayoutObject::SetSelectionState( + SelectionState::kStartAndEnd); + } else { + paint_range_.StartLayoutObject()->LayoutObject::SetSelectionState( + SelectionState::kStart); + paint_range_.EndLayoutObject()->LayoutObject::SetSelectionState( + SelectionState::kEnd); + } } - DCHECK_EQ(paint_range_.StartLayoutObject()->GetSelectionState(), - SelectionState::kStart); - DCHECK_EQ(paint_range_.EndLayoutObject()->GetSelectionState(), - SelectionState::kEnd); + // TODO(yoichio): If start == end, they should be kStartAndEnd. + // If not, start.SelectionState == kStart and vice versa. + DCHECK(paint_range_.StartLayoutObject()->GetSelectionState() == + SelectionState::kStart || + paint_range_.StartLayoutObject()->GetSelectionState() == + SelectionState::kStartAndEnd); + DCHECK(paint_range_.EndLayoutObject()->GetSelectionState() == + SelectionState::kEnd || + paint_range_.EndLayoutObject()->GetSelectionState() == + SelectionState::kStartAndEnd); } void LayoutSelection::OnDocumentShutdown() {
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc index 1f68ead..c9534086 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc
@@ -39,9 +39,6 @@ LayoutPoint box_origin(offset.left, offset.top); box_origin.Move(adjusted_paint_offset.X(), adjusted_paint_offset.Y()); - LayoutRect box_rect( - box_origin, LayoutSize(fragment_.Size().width, fragment_.Size().height)); - GraphicsContext& context = paint_info.context; bool is_printing = paint_info.IsPrinting(); @@ -85,6 +82,21 @@ const NGPhysicalTextFragment& text_fragment = ToNGPhysicalTextFragment(fragment_.PhysicalFragment()); + LayoutRect box_rect(box_origin, fragment_.Size().ToLayoutSize()); + Optional<GraphicsContextStateSaver> state_saver; + NGLineOrientation orientation = text_fragment.LineOrientation(); + if (orientation != NGLineOrientation::kHorizontal) { + state_saver.emplace(context); + // Because we rotate the GraphicsContext to be logical, flip the + // |box_rect| to match to it. + box_rect.SetSize( + LayoutSize(fragment_.Size().height, fragment_.Size().width)); + context.ConcatCTM(TextPainterBase::Rotation( + box_rect, orientation == NGLineOrientation::kClockWiseVertical + ? TextPainterBase::kClockwise + : TextPainterBase::kCounterclockwise)); + } + NGTextPainter text_painter(context, font, text_fragment, text_origin, box_rect, text_fragment.IsHorizontal()); @@ -100,13 +112,15 @@ bool has_line_through_decoration = false; if (style.TextDecorationsInEffect() != TextDecoration::kNone) { LayoutPoint local_origin = LayoutPoint(box_origin); - LayoutUnit width = fragment_.Size().width; + LayoutUnit width = box_rect.Width(); const NGPhysicalBoxFragment* decorating_box = nullptr; const ComputedStyle* decorating_box_style = decorating_box ? &decorating_box->Style() : nullptr; - // TODO(eae): Use correct baseline when available. - FontBaseline baseline_type = kAlphabeticBaseline; + const FontDescription& font_description = font.GetFontDescription(); + FontBaseline baseline_type = font_description.IsVerticalAnyUpright() + ? kIdeographicBaseline + : kAlphabeticBaseline; text_painter.ComputeDecorationInfo(decoration_info, box_origin, local_origin, width, baseline_type,
diff --git a/third_party/WebKit/Source/devtools/front_end/color_picker/Spectrum.js b/third_party/WebKit/Source/devtools/front_end/color_picker/Spectrum.js index 5dc129f..018b7cb 100644 --- a/third_party/WebKit/Source/devtools/front_end/color_picker/Spectrum.js +++ b/third_party/WebKit/Source/devtools/front_end/color_picker/Spectrum.js
@@ -591,8 +591,10 @@ * @param {?SDK.CSSModel.ContrastInfo} contrastInfo */ setContrastInfo(contrastInfo) { - if (this._contrastInfo) - this._contrastInfo.update(contrastInfo); + if (!this._contrastInfo) + return; + + this._contrastInfo.update(contrastInfo); // Contrast info may cause contrast details to become visible. if (this._contrastDetails.visible())