diff --git a/chrome/VERSION b/chrome/VERSION index 2188503..d9bd8fe3 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=57 MINOR=0 -BUILD=2959 +BUILD=2960 PATCH=0
diff --git a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc index 7f8a499..d21ef00b 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.cc
@@ -4,37 +4,93 @@ #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" +#include "base/command_line.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" +#include "chrome/browser/chromeos/arc/arc_session_manager.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" +#include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/common/extensions/extension_constants.h" +#include "chromeos/chromeos_switches.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "ui/base/window_open_disposition.h" +#include "ui/events/event_constants.h" namespace wallpaper_manager_util { +namespace { + +const char kAndroidWallpapersAppPackage[] = "com.google.android.apps.wallpaper"; +const char kAndroidWallpapersAppActivity[] = + "com.google.android.apps.wallpaper.picker.CategoryPickerActivity"; + +const char kAndroidWallpapersAppTrialName[] = "AndroidWallpapersAppOnChromeOS"; +const char kEnableAndroidWallpapersApp[] = + "Enable-android-wallpapers-app_Dogfood"; + +} // namespace + +// Only if the current profile is the primary profile && Arc service is enabled +// && the Android Wallpapers App has been installed && the finch experiment or +// chrome flag is enabled, launch the Android Wallpapers App. Otherwise launch +// the old Chrome OS Wallpaper Picker App. +bool ShouldUseAndroidWallpapersApp(Profile* profile) { + if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) + return false; + + // Check if the ARC++ is enabled. + const arc::ArcSessionManager* const arc_session_manager = + arc::ArcSessionManager::Get(); + if (!arc_session_manager || !arc_session_manager->IsArcEnabled()) + return false; + + // Check if Android Wallpapers App has been installed. + const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile); + if (!prefs || prefs->GetAppsForPackage(kAndroidWallpapersAppPackage).empty()) + return false; + + // Check if the finch experiment or the chrome flag is enabled. + if (base::FieldTrialList::FindFullName(kAndroidWallpapersAppTrialName) != + kEnableAndroidWallpapersApp && + !base::CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kEnableAndroidWallpapersApp)) { + return false; + } + + return true; +} + void OpenWallpaperManager() { Profile* profile = ProfileManager::GetActiveUserProfile(); DCHECK(profile); - ExtensionService* service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - if (!service) - return; + if (ShouldUseAndroidWallpapersApp(profile)) { + const std::string app_id = ArcAppListPrefs::GetAppId( + kAndroidWallpapersAppPackage, kAndroidWallpapersAppActivity); + arc::LaunchApp(profile, app_id, ui::EF_NONE); + } else { + ExtensionService* service = + extensions::ExtensionSystem::Get(profile)->extension_service(); + if (!service) + return; - const extensions::Extension* extension = - service->GetExtensionById(extension_misc::kWallpaperManagerId, false); - if (!extension) - return; + const extensions::Extension* extension = + service->GetExtensionById(extension_misc::kWallpaperManagerId, false); + if (!extension) + return; - OpenApplication(AppLaunchParams( - profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, - WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL)); + OpenApplication(AppLaunchParams( + profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, + WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL)); + } } } // namespace wallpaper_manager_util
diff --git a/chrome/browser/chromeos/extensions/wallpaper_manager_util.h b/chrome/browser/chromeos/extensions/wallpaper_manager_util.h index 42a9334b..a1a32280 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_manager_util.h +++ b/chrome/browser/chromeos/extensions/wallpaper_manager_util.h
@@ -5,8 +5,12 @@ #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_MANAGER_UTIL_H_ #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_MANAGER_UTIL_H_ +class Profile; + namespace wallpaper_manager_util { +bool ShouldUseAndroidWallpapersApp(Profile* profile); + // Opens wallpaper manager application. void OpenWallpaperManager();
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc index 2b7b988..87733f9 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -31,6 +31,7 @@ #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/image_decoder.h" #include "chrome/browser/ui/ash/ash_util.h" #include "chrome/common/chrome_paths.h" @@ -87,6 +88,17 @@ const char kDeviceWallpaperDir[] = "device_wallpaper"; const char kDeviceWallpaperFile[] = "device_wallpaper_image.jpg"; +// The Wallpaper App that the user is using right now on Chrome OS. It's the +// app that is used when the user right clicks on desktop and selects "Set +// wallpaper" or when the user selects "Set wallpaper" from chrome://settings +// page. This is recorded at user login. It's used to back an UMA histogram so +// it should be treated as append-only. +enum WallpaperAppsType { + WALLPAPERS_PICKER_APP_CHROMEOS = 0, + WALLPAPERS_APP_ANDROID = 1, + WALLPAPERS_APPS_NUM = 2, +}; + // These global default values are used to set customized default // wallpaper path in WallpaperManager::InitializeWallpaper(). base::FilePath GetCustomizedWallpaperDefaultRescaledFileName( @@ -423,6 +435,7 @@ if (GetLoggedInUserWallpaperInfo(&info)) { UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Type", info.type, user_manager::User::WALLPAPER_TYPE_COUNT); + RecordWallpaperAppType(); if (info == current_user_wallpaper_info_) return; } @@ -1386,4 +1399,16 @@ DoSetDefaultWallpaper(EmptyAccountId(), MovableOnDestroyCallbackHolder()); } +void WallpaperManager::RecordWallpaperAppType() { + user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); + Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); + + UMA_HISTOGRAM_ENUMERATION( + "Ash.Wallpaper.Apps", + wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) + ? WALLPAPERS_APP_ANDROID + : WALLPAPERS_PICKER_APP_CHROMEOS, + WALLPAPERS_APPS_NUM); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h index f4c1a952..b203984f 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
@@ -191,6 +191,7 @@ std::unique_ptr<gfx::ImageSkia> small_wallpaper_image, const base::FilePath& customized_default_wallpaper_file_large, std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override; + void RecordWallpaperAppType() override; mojo::Binding<ash::mojom::WallpaperPicker> binding_;
diff --git a/chrome/browser/resources/md_downloads/vulcanized.html b/chrome/browser/resources/md_downloads/vulcanized.html index ad971a0..fd1b423 100644 --- a/chrome/browser/resources/md_downloads/vulcanized.html +++ b/chrome/browser/resources/md_downloads/vulcanized.html
@@ -25,6 +25,23 @@ --> <meta charset="utf-8"> <title>$i18n{title}</title> + <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> + <style> +/* 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. */ + +:root { + /* This is a custom, Chrome-specific color that does not have a --paper or + * --google equivalent. */ + --md-background-color: #f1f1f1; + --md-loading-message-color: #6e6e6e; + /* This is --google-blue-700, rewritten as a native custom property for speed. + */ + --md-toolbar-color: rgb(51, 103, 214); +} + +</style> <style> html { background: var(--md-background-color); @@ -46,35 +63,9 @@ } </style> </head> -<body><div hidden="" by-vulcanize=""><link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"><style> -/* 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. */ - -:root { - /* This is a custom, Chrome-specific color that does not have a --paper or - * --google equivalent. */ - --md-background-color: #f1f1f1; - --md-loading-message-color: #6e6e6e; - /* This is --google-blue-700, rewritten as a native custom property for speed. - */ - --md-toolbar-color: rgb(51, 103, 214); -} - -</style></div> - <downloads-manager></downloads-manager> -<if expr="is_macosx"> - <command id="clear-all-command" shortcut="Alt|c Alt|ç"></command> - <command id="undo-command" shortcut="Meta|z"></command> - <command id="find-command" shortcut="Meta|f"></command> -</if> -<if expr="not is_macosx"> - <command id="clear-all-command" shortcut="Alt|c"></command> - <command id="undo-command" shortcut="Ctrl|z"></command> - <command id="find-command" shortcut="Ctrl|f"></command> -</if> - <div hidden="" by-vulcanize=""></div><link rel="import" href="chrome://resources/html/polymer.html"> - <div hidden="" by-vulcanize=""><script src="chrome://resources/js/load_time_data.js"></script><script src="chrome://downloads/strings.js"></script></div><div hidden="" by-vulcanize=""><dom-module id="iron-list" assetpath="chrome://resources/polymer/v1_0/iron-list/" css-build="shadow"> +<body><div hidden="" by-vulcanize=""><script src="chrome://resources/js/load_time_data.js"></script> +<script src="chrome://downloads/strings.js"></script> +<dom-module id="iron-list" assetpath="chrome://resources/polymer/v1_0/iron-list/" css-build="shadow"> <template> <style scope="iron-list">:host { display: block; @@ -243,6 +234,8 @@ } </style> + + <dom-module id="iron-icon" assetpath="chrome://resources/polymer/v1_0/iron-icon/" css-build="shadow"> <template> <style scope="iron-icon">:host { @@ -388,6 +381,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-button" assetpath="chrome://resources/polymer/v1_0/paper-button/" css-build="shadow"> <template strip-whitespace=""> <style scope="paper-button">:host { @@ -830,6 +825,8 @@ } </style> + + <dom-module id="paper-progress" assetpath="chrome://resources/polymer/v1_0/paper-progress/" css-build="shadow"> <template> <style scope="paper-progress">:host { @@ -857,7 +854,7 @@ } #progressContainer, .indeterminate::after { - background: var(--paper-progress-container-color,var(--google-grey-300)); + background: var(--paper-progress-container-color,var(--google-grey-300));; } :host(.transiting) #primaryProgress, :host(.transiting) #secondaryProgress { @@ -887,19 +884,19 @@ } #primaryProgress { - background: var(--paper-progress-active-color,var(--google-green-500)); + background: var(--paper-progress-active-color,var(--google-green-500));; } #secondaryProgress { - background: var(--paper-progress-secondary-color,var(--google-green-100)); + background: var(--paper-progress-secondary-color,var(--google-green-100));; } :host([disabled]) #primaryProgress { - background: var(--paper-progress-disabled-active-color,var(--google-grey-500)); + background: var(--paper-progress-disabled-active-color,var(--google-grey-500));; } :host([disabled]) #secondaryProgress { - background: var(--paper-progress-disabled-secondary-color,var(--google-grey-300)); + background: var(--paper-progress-disabled-secondary-color,var(--google-grey-300));; } :host(:not([disabled])) #primaryProgress.indeterminate { @@ -1316,8 +1313,6 @@ </dom-module> - - <style is="custom-style" css-build="shadow">html { --primary-text-color: var(--light-theme-text-color); --primary-background-color: var(--light-theme-background-color); @@ -1358,6 +1353,38 @@ } </style> +<style> +/* Copyright 2015 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. */ + +<if expr="not chromeos and not is_android"> +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), + url("chrome://resources/roboto/roboto-regular.woff2") format('woff2'); +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + src: local('Roboto Medium'), local('Roboto-Medium'), + url("chrome://resources/roboto/roboto-medium.woff2") format('woff2'); +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), + url("chrome://resources/roboto/roboto-bold.woff2") format('woff2'); +} +</if> + +</style> <style is="custom-style" css-build="shadow">html { --paper-font-common-base_-_font-family: 'Roboto', 'Noto', sans-serif; --paper-font-common-base_-_-webkit-font-smoothing: antialiased;; @@ -1399,38 +1426,7 @@ } </style> -<style> -/* Copyright 2015 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. */ - -<if expr="not chromeos and not is_android"> -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), - url("chrome://resources/roboto/roboto-regular.woff2") format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), - url("chrome://resources/roboto/roboto-medium.woff2") format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: local('Roboto Bold'), local('Roboto-Bold'), - url("chrome://resources/roboto/roboto-bold.woff2") format('woff2'); -} -</if> - -</style><dom-module id="paper-item-shared-styles" assetpath="chrome://resources/polymer/v1_0/paper-item/" css-build="shadow"> +<dom-module id="paper-item-shared-styles" assetpath="chrome://resources/polymer/v1_0/paper-item/" css-build="shadow"> <template> <style scope="paper-item-shared-styles">:host, .paper-item { display: block; @@ -1459,7 +1455,7 @@ } :host([disabled]), .paper-item[disabled] { - color: var(--paper-item-disabled-color,var(--disabled-text-color)); + color: var(--paper-item-disabled-color,var(--disabled-text-color));; ; } @@ -1485,6 +1481,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-item" assetpath="chrome://resources/polymer/v1_0/paper-item/" css-build="shadow"> <template> @@ -1515,7 +1513,7 @@ } :host([disabled]), .paper-item[disabled] { - color: var(--paper-item-disabled-color,var(--disabled-text-color)); + color: var(--paper-item-disabled-color,var(--disabled-text-color));; ; } @@ -1561,7 +1559,7 @@ } .selectable-content > ::content > [disabled] { - color: var(--paper-menu-disabled-color,var(--disabled-text-color)); + color: var(--paper-menu-disabled-color,var(--disabled-text-color));; } .selectable-content > ::content > *:focus { @@ -1588,6 +1586,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-menu" assetpath="chrome://resources/polymer/v1_0/paper-menu/" css-build="shadow"> <template> @@ -1598,7 +1598,7 @@ } .selectable-content > ::content > [disabled] { - color: var(--paper-menu-disabled-color,var(--disabled-text-color)); + color: var(--paper-menu-disabled-color,var(--disabled-text-color));; } .selectable-content > ::content > *:focus { @@ -1626,8 +1626,8 @@ display: block; padding: 8px 0; - background: var(--paper-menu-background-color,var(--primary-background-color)); - color: var(--paper-menu-color,var(--primary-text-color)); + background: var(--paper-menu-background-color,var(--primary-background-color));; + color: var(--paper-menu-color,var(--primary-text-color));; ; } @@ -1640,7 +1640,7 @@ </template> </dom-module> -<dom-module id="iron-overlay-backdrop" assetpath="/" css-build="shadow"> +<dom-module id="iron-overlay-backdrop" assetpath="chrome://resources/polymer/v1_0/iron-overlay-behavior/" css-build="shadow"> <template> <style scope="iron-overlay-backdrop">:host { @@ -1669,7 +1669,10 @@ </dom-module> -<script src="chrome://resources/polymer/v1_0/web-animations-js/web-animations-next-lite.min.js"></script><dom-module id="iron-dropdown" assetpath="chrome://resources/polymer/v1_0/iron-dropdown/" css-build="shadow"> +<script src="chrome://resources/polymer/v1_0/web-animations-js/web-animations-next-lite.min.js"></script> + + +<dom-module id="iron-dropdown" assetpath="chrome://resources/polymer/v1_0/iron-dropdown/" css-build="shadow"> <template> <style scope="iron-dropdown">:host { position: fixed; @@ -1718,7 +1721,7 @@ position: relative; border-radius: 2px; - background-color: var(--paper-menu-button-dropdown-background,var(--primary-background-color)); + background-color: var(--paper-menu-button-dropdown-background,var(--primary-background-color));; ; } @@ -1782,12 +1785,12 @@ } :host #ink { - color: var(--paper-icon-button-ink-color,var(--primary-text-color)); + color: var(--paper-icon-button-ink-color,var(--primary-text-color));; opacity: 0.6; } :host([disabled]) { - color: var(--paper-icon-button-disabled-text,var(--disabled-text-color)); + color: var(--paper-icon-button-disabled-text,var(--disabled-text-color));; pointer-events: none; cursor: auto; @@ -1863,23 +1866,23 @@ height: 100%; opacity: 0; white-space: nowrap; - border-color: var(--paper-spinner-color,var(--google-blue-500)); + border-color: var(--paper-spinner-color,var(--google-blue-500));; } .layer-1 { - border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500)); + border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500));; } .layer-2 { - border-color: var(--paper-spinner-layer-2-color,var(--google-red-500)); + border-color: var(--paper-spinner-layer-2-color,var(--google-red-500));; } .layer-3 { - border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500)); + border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500));; } .layer-4 { - border-color: var(--paper-spinner-layer-4-color,var(--google-green-500)); + border-color: var(--paper-spinner-layer-4-color,var(--google-green-500));; } .active .spinner-layer { @@ -2347,6 +2350,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-spinner-lite" assetpath="chrome://resources/polymer/v1_0/paper-spinner/" css-build="shadow"> <template strip-whitespace=""> <style scope="paper-spinner-lite">:host { @@ -2401,23 +2406,23 @@ height: 100%; opacity: 0; white-space: nowrap; - border-color: var(--paper-spinner-color,var(--google-blue-500)); + border-color: var(--paper-spinner-color,var(--google-blue-500));; } .layer-1 { - border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500)); + border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500));; } .layer-2 { - border-color: var(--paper-spinner-layer-2-color,var(--google-red-500)); + border-color: var(--paper-spinner-layer-2-color,var(--google-red-500));; } .layer-3 { - border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500)); + border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500));; } .layer-4 { - border-color: var(--paper-spinner-layer-4-color,var(--google-green-500)); + border-color: var(--paper-spinner-layer-4-color,var(--google-green-500));; } .active .spinner-layer { @@ -3283,7 +3288,9 @@ --md-toolbar-color: rgb(51, 103, 214); } -</style><dom-module id="downloads-manager" assetpath="chrome://downloads/" css-build="shadow"> +</style> + +<dom-module id="downloads-manager" assetpath="chrome://downloads/" css-build="shadow"> <template> <style scope="downloads-manager">:host { display: flex; @@ -3375,4 +3382,17 @@ </div> </template> </dom-module> -</div><script src="crisper.js"></script></body></html> \ No newline at end of file +</div> + <downloads-manager></downloads-manager> +<if expr="is_macosx"> + <command id="clear-all-command" shortcut="Alt|c Alt|ç"></command> + <command id="undo-command" shortcut="Meta|z"></command> + <command id="find-command" shortcut="Meta|f"></command> +</if> +<if expr="not is_macosx"> + <command id="clear-all-command" shortcut="Alt|c"></command> + <command id="undo-command" shortcut="Ctrl|z"></command> + <command id="find-command" shortcut="Ctrl|f"></command> +</if> + <link rel="import" href="chrome://resources/html/polymer.html"> + <script src="crisper.js"></script></body></html> \ No newline at end of file
diff --git a/chrome/browser/resources/md_history/app.vulcanized.html b/chrome/browser/resources/md_history/app.vulcanized.html index ebc7206..db2c070 100644 --- a/chrome/browser/resources/md_history/app.vulcanized.html +++ b/chrome/browser/resources/md_history/app.vulcanized.html
@@ -22,9 +22,27 @@ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt ---><meta charset="UTF-8"> +--><meta charset="UTF-8"><link rel="import" href="chrome://resources/html/polymer.html"> +<style> +/* 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. */ -</head><body><div hidden="" by-vulcanize=""><link rel="import" href="chrome://resources/html/polymer.html"><dom-module id="iron-pages" assetpath="chrome://resources/polymer/v1_0/iron-pages/" css-build="shadow"> +:root { + /* This is a custom, Chrome-specific color that does not have a --paper or + * --google equivalent. */ + --md-background-color: #f1f1f1; + --md-loading-message-color: #6e6e6e; + /* This is --google-blue-700, rewritten as a native custom property for speed. + */ + --md-toolbar-color: rgb(51, 103, 214); +} + +</style> + + + +</head><body><div hidden="" by-vulcanize=""><dom-module id="iron-pages" assetpath="chrome://resources/polymer/v1_0/iron-pages/" css-build="shadow"> <template> <style scope="iron-pages">:host { @@ -167,6 +185,8 @@ } </style> + + <dom-module id="iron-icon" assetpath="chrome://resources/polymer/v1_0/iron-icon/" css-build="shadow"> <template> <style scope="iron-icon">:host { @@ -279,46 +299,6 @@ </template> </dom-module> <style is="custom-style" css-build="shadow">html { - --primary-text-color: var(--light-theme-text-color); - --primary-background-color: var(--light-theme-background-color); - --secondary-text-color: var(--light-theme-secondary-color); - --disabled-text-color: var(--light-theme-disabled-color); - --divider-color: var(--light-theme-divider-color); - --error-color: var(--paper-deep-orange-a700); - - - --primary-color: var(--paper-indigo-500); - --light-primary-color: var(--paper-indigo-100); - --dark-primary-color: var(--paper-indigo-700); - - --accent-color: var(--paper-pink-a200); - --light-accent-color: var(--paper-pink-a100); - --dark-accent-color: var(--paper-pink-a400); - - - - --light-theme-background-color: #ffffff; - --light-theme-base-color: #000000; - --light-theme-text-color: var(--paper-grey-900); - --light-theme-secondary-color: #737373; - --light-theme-disabled-color: #9b9b9b; - --light-theme-divider-color: #dbdbdb; - - - --dark-theme-background-color: var(--paper-grey-900); - --dark-theme-base-color: #ffffff; - --dark-theme-text-color: #ffffff; - --dark-theme-secondary-color: #bcbcbc; - --dark-theme-disabled-color: #646464; - --dark-theme-divider-color: #3c3c3c; - - - --text-primary-color: var(--dark-theme-text-color); - --default-primary-color: var(--primary-color); -} - -</style> -<style is="custom-style" css-build="shadow">html { --google-red-100: #f4c7c3; --google-red-300: #e67c73; --google-red-500: #db4437; @@ -633,6 +613,50 @@ } </style> + + +<style is="custom-style" css-build="shadow">html { + --primary-text-color: var(--light-theme-text-color); + --primary-background-color: var(--light-theme-background-color); + --secondary-text-color: var(--light-theme-secondary-color); + --disabled-text-color: var(--light-theme-disabled-color); + --divider-color: var(--light-theme-divider-color); + --error-color: var(--paper-deep-orange-a700); + + + --primary-color: var(--paper-indigo-500); + --light-primary-color: var(--paper-indigo-100); + --dark-primary-color: var(--paper-indigo-700); + + --accent-color: var(--paper-pink-a200); + --light-accent-color: var(--paper-pink-a100); + --dark-accent-color: var(--paper-pink-a400); + + + + --light-theme-background-color: #ffffff; + --light-theme-base-color: #000000; + --light-theme-text-color: var(--paper-grey-900); + --light-theme-secondary-color: #737373; + --light-theme-disabled-color: #9b9b9b; + --light-theme-divider-color: #dbdbdb; + + + --dark-theme-background-color: var(--paper-grey-900); + --dark-theme-base-color: #ffffff; + --dark-theme-text-color: #ffffff; + --dark-theme-secondary-color: #bcbcbc; + --dark-theme-disabled-color: #646464; + --dark-theme-divider-color: #3c3c3c; + + + --text-primary-color: var(--dark-theme-text-color); + --default-primary-color: var(--primary-color); +} + +</style> + + <dom-module id="paper-icon-button" assetpath="chrome://resources/polymer/v1_0/paper-icon-button/" css-build="shadow"> <template strip-whitespace=""> <style scope="paper-icon-button">:host { @@ -662,12 +686,12 @@ } :host #ink { - color: var(--paper-icon-button-ink-color,var(--primary-text-color)); + color: var(--paper-icon-button-ink-color,var(--primary-text-color));; opacity: 0.6; } :host([disabled]) { - color: var(--paper-icon-button-disabled-text,var(--disabled-text-color)); + color: var(--paper-icon-button-disabled-text,var(--disabled-text-color));; pointer-events: none; cursor: auto; @@ -743,23 +767,23 @@ height: 100%; opacity: 0; white-space: nowrap; - border-color: var(--paper-spinner-color,var(--google-blue-500)); + border-color: var(--paper-spinner-color,var(--google-blue-500));; } .layer-1 { - border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500)); + border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500));; } .layer-2 { - border-color: var(--paper-spinner-layer-2-color,var(--google-red-500)); + border-color: var(--paper-spinner-layer-2-color,var(--google-red-500));; } .layer-3 { - border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500)); + border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500));; } .layer-4 { - border-color: var(--paper-spinner-layer-4-color,var(--google-green-500)); + border-color: var(--paper-spinner-layer-4-color,var(--google-green-500));; } .active .spinner-layer { @@ -1227,6 +1251,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-spinner-lite" assetpath="chrome://resources/polymer/v1_0/paper-spinner/" css-build="shadow"> <template strip-whitespace=""> <style scope="paper-spinner-lite">:host { @@ -1281,23 +1307,23 @@ height: 100%; opacity: 0; white-space: nowrap; - border-color: var(--paper-spinner-color,var(--google-blue-500)); + border-color: var(--paper-spinner-color,var(--google-blue-500));; } .layer-1 { - border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500)); + border-color: var(--paper-spinner-layer-1-color,var(--google-blue-500));; } .layer-2 { - border-color: var(--paper-spinner-layer-2-color,var(--google-red-500)); + border-color: var(--paper-spinner-layer-2-color,var(--google-red-500));; } .layer-3 { - border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500)); + border-color: var(--paper-spinner-layer-3-color,var(--google-yellow-500));; } .layer-4 { - border-color: var(--paper-spinner-layer-4-color,var(--google-green-500)); + border-color: var(--paper-spinner-layer-4-color,var(--google-green-500));; } .active .spinner-layer { @@ -2055,7 +2081,8 @@ </div> </template> </dom-module> -<link rel="import" href="chrome://history/constants.html"><iron-iconset-svg size="24" name="history"> +<link rel="import" href="chrome://history/constants.html"> +<iron-iconset-svg size="24" name="history"> <svg> <defs> @@ -2171,6 +2198,8 @@ </style> </template> </dom-module> + + <dom-module id="history-toolbar" assetpath="chrome://history/" css-build="shadow"> <template> <style scope="history-toolbar">[hidden] { @@ -2449,9 +2478,6 @@ </template> </dom-module> - - - <style is="custom-style" css-build="shadow">html { --cr-actionable_-_cursor: pointer;; --cr-focused-item-color: var(--google-grey-300); @@ -2472,6 +2498,7 @@ } </style> + <dom-module id="cr-shared-style" assetpath="chrome://resources/cr_elements/" css-build="shadow"> <template> <style scope="cr-shared-style">paper-spinner { @@ -2682,9 +2709,12 @@ } </style> -<link rel="import" href="chrome://resources/html/util.html"><dom-module id="history-searched-label" assetpath="/" css-build="shadow"> +<link rel="import" href="chrome://resources/html/util.html"> +<dom-module id="history-searched-label" assetpath="chrome://history/" css-build="shadow"> </dom-module> -<dom-module id="history-item" assetpath="/" css-build="shadow"> + + +<dom-module id="history-item" assetpath="chrome://history/" css-build="shadow"> <template> <style scope="history-item">[hidden] { display: none !important; @@ -3093,6 +3123,8 @@ </iron-scroll-threshold> </template> </dom-module> + + <dom-module id="history-list-container" assetpath="chrome://history/" css-build="shadow"> <template> <style scope="history-list-container">[hidden] { @@ -3328,6 +3360,38 @@ </iron-query-params> </template> </dom-module> +<style> +/* Copyright 2015 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. */ + +<if expr="not chromeos and not is_android"> +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), + url("chrome://resources/roboto/roboto-regular.woff2") format('woff2'); +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + src: local('Roboto Medium'), local('Roboto-Medium'), + url("chrome://resources/roboto/roboto-medium.woff2") format('woff2'); +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + src: local('Roboto Bold'), local('Roboto-Bold'), + url("chrome://resources/roboto/roboto-bold.woff2") format('woff2'); +} +</if> + +</style> <style is="custom-style" css-build="shadow">html { --paper-font-common-base_-_font-family: 'Roboto', 'Noto', sans-serif; --paper-font-common-base_-_-webkit-font-smoothing: antialiased;; @@ -3369,38 +3433,7 @@ } </style> -<style> -/* Copyright 2015 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. */ - -<if expr="not chromeos and not is_android"> -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), - url("chrome://resources/roboto/roboto-regular.woff2") format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), - url("chrome://resources/roboto/roboto-medium.woff2") format('woff2'); -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: local('Roboto Bold'), local('Roboto-Bold'), - url("chrome://resources/roboto/roboto-bold.woff2") format('woff2'); -} -</if> - -</style><dom-module id="history-side-bar" assetpath="chrome://history/" css-build="shadow"> +<dom-module id="history-side-bar" assetpath="chrome://history/" css-build="shadow"> <template> <style scope="history-side-bar">[hidden] { display: none !important; @@ -3587,22 +3620,7 @@ </iron-selector> </template> </dom-module> -<style> -/* 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. */ - -:root { - /* This is a custom, Chrome-specific color that does not have a --paper or - * --google equivalent. */ - --md-background-color: #f1f1f1; - --md-loading-message-color: #6e6e6e; - /* This is --google-blue-700, rewritten as a native custom property for speed. - */ - --md-toolbar-color: rgb(51, 103, 214); -} - -</style></div><dom-module id="history-app" css-build="shadow"> +</div><dom-module id="history-app" css-build="shadow"> <template> <style scope="history-app">[hidden] { display: none !important;
diff --git a/chrome/browser/resources/md_history/lazy_load.vulcanized.html b/chrome/browser/resources/md_history/lazy_load.vulcanized.html index 3c1dfb8..480e582 100644 --- a/chrome/browser/resources/md_history/lazy_load.vulcanized.html +++ b/chrome/browser/resources/md_history/lazy_load.vulcanized.html
@@ -245,6 +245,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-button" assetpath="chrome://resources/polymer/v1_0/paper-button/" css-build="shadow"> <template strip-whitespace=""> <style scope="paper-button">:host { @@ -364,7 +366,7 @@ } :host([disabled]), .paper-item[disabled] { - color: var(--paper-item-disabled-color,var(--disabled-text-color)); + color: var(--paper-item-disabled-color,var(--disabled-text-color));; ; } @@ -390,6 +392,8 @@ </style> </template> </dom-module> + + <dom-module id="paper-item" assetpath="chrome://resources/polymer/v1_0/paper-item/" css-build="shadow"> <template> @@ -420,7 +424,7 @@ } :host([disabled]), .paper-item[disabled] { - color: var(--paper-item-disabled-color,var(--disabled-text-color)); + color: var(--paper-item-disabled-color,var(--disabled-text-color));; ; } @@ -1242,7 +1246,7 @@ } paper-ripple { - color: var(--paper-tab-ink,var(--paper-yellow-a100)); + color: var(--paper-tab-ink,var(--paper-yellow-a100));; } .tab-content > ::content > a { @@ -1265,6 +1269,8 @@ <g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g> </defs></svg> </iron-iconset-svg> + + <dom-module id="paper-tabs" assetpath="chrome://resources/polymer/v1_0/paper-tabs/" css-build="shadow"> <template> <style scope="paper-tabs">:host { @@ -1347,7 +1353,7 @@ bottom: 0; left: 0; right: 0; - background-color: var(--paper-tabs-selection-bar-color,var(--paper-yellow-a100)); + background-color: var(--paper-tabs-selection-bar-color,var(--paper-yellow-a100));; -webkit-transform: scale(0); transform: scale(0); -webkit-transform-origin: left center;
diff --git a/chrome/browser/safe_browsing/permission_reporter_browsertest.cc b/chrome/browser/safe_browsing/permission_reporter_browsertest.cc index 678c15c..5afff18 100644 --- a/chrome/browser/safe_browsing/permission_reporter_browsertest.cc +++ b/chrome/browser/safe_browsing/permission_reporter_browsertest.cc
@@ -82,7 +82,7 @@ // Test that permission action report will be sent if the user is opted into it. IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, - PermissionActionReporting) { + DISABLED_PermissionActionReporting) { // Set up the Sync client. ASSERT_TRUE(SetupSync()); Profile* profile = GetProfile(0); @@ -126,7 +126,7 @@ } IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, - PermissionActionReportingPriorIgnoreCount) { + DISABLED_PermissionActionReportingPriorIgnoreCount) { // Set up the Sync client. ASSERT_TRUE(SetupSync()); Profile* profile = GetProfile(0);
diff --git a/chrome/test/media_router/BUILD.gn b/chrome/test/media_router/BUILD.gn index e86de86..f58d024 100644 --- a/chrome/test/media_router/BUILD.gn +++ b/chrome/test/media_router/BUILD.gn
@@ -16,7 +16,7 @@ "telemetry/", "../../../third_party/catapult/", "../../../tools/perf/", - "../../../tools/variations/fieldtrial_util.py", + "../../../tools/variations/", ] }
diff --git a/components/nacl/browser/nacl_broker_host_win.cc b/components/nacl/browser/nacl_broker_host_win.cc index fb6cd81..4ad581a21 100644 --- a/components/nacl/browser/nacl_broker_host_win.cc +++ b/components/nacl/browser/nacl_broker_host_win.cc
@@ -7,6 +7,7 @@ #include "base/base_switches.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "components/nacl/browser/nacl_broker_service_win.h" #include "components/nacl/browser/nacl_browser.h" #include "components/nacl/common/nacl_cmd_line.h" @@ -68,8 +69,10 @@ if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) cmd_line->AppendSwitch(switches::kNoErrorDialogs); - process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line, - true); + process_->Launch( + base::MakeUnique<NaClBrokerSandboxedProcessLauncherDelegate>(), + base::WrapUnique(cmd_line), + true); return true; }
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index f8b4711..5cf4cf49 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc
@@ -577,8 +577,8 @@ return true; } #endif - process_->Launch(new NaClSandboxedProcessLauncherDelegate(), - cmd_line.release(), true); + process_->Launch(base::MakeUnique<NaClSandboxedProcessLauncherDelegate>(), + std::move(cmd_line), true); return true; }
diff --git a/components/wallpaper/wallpaper_manager_base.cc b/components/wallpaper/wallpaper_manager_base.cc index 7e6f39c..0596845 100644 --- a/components/wallpaper/wallpaper_manager_base.cc +++ b/components/wallpaper/wallpaper_manager_base.cc
@@ -323,6 +323,7 @@ if (GetLoggedInUserWallpaperInfo(&info)) { UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Type", info.type, user_manager::User::WALLPAPER_TYPE_COUNT); + RecordWallpaperAppType(); if (info == current_user_wallpaper_info_) return; }
diff --git a/components/wallpaper/wallpaper_manager_base.h b/components/wallpaper/wallpaper_manager_base.h index cd18065d..4e9aed7 100644 --- a/components/wallpaper/wallpaper_manager_base.h +++ b/components/wallpaper/wallpaper_manager_base.h
@@ -573,6 +573,9 @@ MovableOnDestroyCallbackHolder on_finish, std::unique_ptr<user_manager::UserImage>* result_out) = 0; + // Record the Wallpaper App that the user is using right now on Chrome OS. + virtual void RecordWallpaperAppType() = 0; + // Returns wallpaper subdirectory name for current resolution. virtual const char* GetCustomWallpaperSubdirForCurrentResolution();
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index 3bca51b7..5b155f4 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -227,13 +227,13 @@ } void BrowserChildProcessHostImpl::Launch( - SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, bool terminate_on_shutdown) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - GetContentClient()->browser()->AppendExtraCommandLineSwitches( - cmd_line, data_.id); + GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line.get(), + data_.id); const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); @@ -256,7 +256,7 @@ notify_child_disconnected_ = true; child_process_.reset(new ChildProcessLauncher( - delegate, cmd_line, data_.id, this, child_token_, + std::move(delegate), std::move(cmd_line), data_.id, this, child_token_, base::Bind(&BrowserChildProcessHostImpl::OnMojoError, weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()),
diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h index 08521db..9975dc1 100644 --- a/content/browser/browser_child_process_host_impl.h +++ b/content/browser/browser_child_process_host_impl.h
@@ -69,8 +69,8 @@ // BrowserChildProcessHost implementation: bool Send(IPC::Message* message) override; - void Launch(SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, + void Launch(std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, bool terminate_on_shutdown) override; const ChildProcessData& GetData() const override; ChildProcessHost* GetHost() const override;
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index 12b2dee..e93bb08 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc
@@ -115,14 +115,14 @@ } #endif -void LaunchOnLauncherThread(const NotifyCallback& callback, - BrowserThread::ID client_thread_id, - int child_process_id, - SandboxedProcessLauncherDelegate* delegate, - mojo::edk::ScopedPlatformHandle client_handle, - base::CommandLine* cmd_line) { +void LaunchOnLauncherThread( + const NotifyCallback& callback, + BrowserThread::ID client_thread_id, + int child_process_id, + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + mojo::edk::ScopedPlatformHandle client_handle, + std::unique_ptr<base::CommandLine> cmd_line) { DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); - std::unique_ptr<SandboxedProcessLauncherDelegate> delegate_deleter(delegate); #if !defined(OS_ANDROID) ZygoteHandle zygote = nullptr; int launch_result = LAUNCH_RESULT_FAILURE; @@ -134,7 +134,6 @@ #elif defined(OS_POSIX) && !defined(OS_ANDROID) base::EnvironmentMap env = delegate->GetEnvironment(); #endif - std::unique_ptr<base::CommandLine> cmd_line_deleter(cmd_line); base::TimeTicks begin_launch_time = base::TimeTicks::Now(); base::Process process; @@ -152,8 +151,8 @@ cmd_line->AppendSwitchASCII( mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch, base::UintToString(base::win::HandleToUint32(handles[0]))); - launch_result = - StartSandboxedProcess(delegate, cmd_line, handles, &process); + launch_result = StartSandboxedProcess( + delegate.get(), cmd_line.get(), handles, &process); } #elif defined(OS_POSIX) std::string process_type = @@ -333,7 +332,7 @@ } // After updating the broker, release the lock and let the child's - // messasge be processed on the broker's thread. + // message be processed on the broker's thread. broker->GetLock().Release(); #endif // defined(OS_MACOSX) } @@ -392,8 +391,8 @@ } // namespace ChildProcessLauncher::ChildProcessLauncher( - SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, int child_process_id, Client* client, const std::string& mojo_child_token, @@ -416,7 +415,7 @@ weak_factory_(this) { DCHECK(CalledOnValidThread()); CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_)); - Launch(delegate, cmd_line, child_process_id); + Launch(std::move(delegate), std::move(cmd_line), child_process_id); } ChildProcessLauncher::~ChildProcessLauncher() { @@ -430,9 +429,10 @@ } } -void ChildProcessLauncher::Launch(SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, - int child_process_id) { +void ChildProcessLauncher::Launch( + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, + int child_process_id) { DCHECK(CalledOnValidThread()); #if defined(OS_ANDROID) @@ -458,7 +458,7 @@ if (delegate->ShouldLaunchElevated()) { mojo::edk::NamedPlatformChannelPair named_pair; server_handle = named_pair.PassServerHandle(); - named_pair.PrepareToPassClientHandleToChildProcess(cmd_line); + named_pair.PrepareToPassClientHandleToChildProcess(cmd_line.get()); } else #endif { @@ -473,8 +473,8 @@ BrowserThread::PostTask( BrowserThread::PROCESS_LAUNCHER, FROM_HERE, base::Bind(&LaunchOnLauncherThread, reply_callback, client_thread_id_, - child_process_id, delegate, - base::Passed(&client_handle), cmd_line)); + child_process_id, base::Passed(&delegate), + base::Passed(&client_handle), base::Passed(&cmd_line))); } void ChildProcessLauncher::UpdateTerminationStatus(bool known_dead) {
diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h index c7646bd..8e1e1b3 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h
@@ -76,8 +76,8 @@ // is encountered when processing messages from the child process. This // callback must be safe to call from any thread. ChildProcessLauncher( - SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, int child_process_id, Client* client, const std::string& mojo_child_token, @@ -115,8 +115,8 @@ private: // Posts a task to the launcher thread to do the actual work. - void Launch(SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, + void Launch(std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, int child_process_id); void UpdateTerminationStatus(bool known_dead);
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 4a0a6e4..b6ead8eb 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -206,7 +206,8 @@ class GpuSandboxedProcessLauncherDelegate : public SandboxedProcessLauncherDelegate { public: - explicit GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line) + explicit GpuSandboxedProcessLauncherDelegate( + const base::CommandLine& cmd_line) #if defined(OS_WIN) : cmd_line_(cmd_line) #endif @@ -217,7 +218,7 @@ #if defined(OS_WIN) bool ShouldSandbox() override { - bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); + bool sandbox = !cmd_line_.HasSwitch(switches::kDisableGpuSandbox); if (!sandbox) { DVLOG(1) << "GPU sandbox is disabled"; } @@ -234,12 +235,12 @@ // desktop. bool PreSpawnTarget(sandbox::TargetPolicy* policy) override { if (base::win::GetVersion() > base::win::VERSION_XP) { - if (cmd_line_->GetSwitchValueASCII(switches::kUseGL) == + if (cmd_line_.GetSwitchValueASCII(switches::kUseGL) == gl::kGLImplementationDesktopName) { // Open GL path. policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, sandbox::USER_LIMITED); - SetJobLevel(*cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); + SetJobLevel(cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); } else { policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, @@ -251,7 +252,7 @@ // turn blocks on the browser UI thread. So, instead we forgo a window // message pump entirely and just add job restrictions to prevent child // processes. - SetJobLevel(*cmd_line_, + SetJobLevel(cmd_line_, sandbox::JOB_LIMITED_USER, JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS | JOB_OBJECT_UILIMIT_DESKTOP | @@ -262,7 +263,7 @@ policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); } } else { - SetJobLevel(*cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); + SetJobLevel(cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); policy->SetTokenLevel(sandbox::USER_UNPROTECTED, sandbox::USER_LIMITED); } @@ -279,7 +280,7 @@ // Block this DLL even if it is not loaded by the browser process. policy->AddDllToUnload(L"cmsetac.dll"); - if (cmd_line_->HasSwitch(switches::kEnableLogging)) { + if (cmd_line_.HasSwitch(switches::kEnableLogging)) { base::string16 log_file_path = logging::GetLogFileFullPath(); if (!log_file_path.empty()) { result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, @@ -300,7 +301,7 @@ private: #if defined(OS_WIN) - base::CommandLine* cmd_line_; + base::CommandLine cmd_line_; #endif // OS_WIN }; @@ -985,8 +986,8 @@ // crbug.com/447735. readlink("self/proc/exe") sometimes fails on Android // at startup with EACCES. As a workaround ignore this here, since the // executable name is actually not used or useful anyways. - base::CommandLine* cmd_line = - new base::CommandLine(base::CommandLine::NO_PROGRAM); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(base::CommandLine::NO_PROGRAM); #else #if defined(OS_LINUX) int child_flags = gpu_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : @@ -999,12 +1000,13 @@ if (exe_path.empty()) return false; - base::CommandLine* cmd_line = new base::CommandLine(exe_path); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(exe_path); #endif cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); - BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); + BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line.get()); #if defined(OS_WIN) cmd_line->AppendArg(switches::kPrefetchArgumentGpu); @@ -1024,9 +1026,9 @@ switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches); GetContentClient()->browser()->AppendExtraCommandLineSwitches( - cmd_line, process_->GetData().id); + cmd_line.get(), process_->GetData().id); - GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line, + GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line.get(), gpu_preferences); if (cmd_line->HasSwitch(switches::kUseGL)) { swiftshader_rendering_ = @@ -1047,8 +1049,9 @@ if (!gpu_launcher.empty()) cmd_line->PrependWrapper(gpu_launcher); - process_->Launch(new GpuSandboxedProcessLauncherDelegate(cmd_line), cmd_line, - true); + std::unique_ptr<GpuSandboxedProcessLauncherDelegate> delegate = + base::MakeUnique<GpuSandboxedProcessLauncherDelegate>(*cmd_line); + process_->Launch(std::move(delegate), std::move(cmd_line), true); process_launched_ = true; UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 04595bb..5a1c8788 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc
@@ -373,11 +373,12 @@ return false; } - base::CommandLine* cmd_line = new base::CommandLine(exe_path); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, is_broker_ ? switches::kPpapiBrokerProcess : switches::kPpapiPluginProcess); - BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); + BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line.get()); #if defined(OS_WIN) cmd_line->AppendArg(is_broker_ ? switches::kPrefetchArgumentPpapiBroker @@ -436,8 +437,9 @@ // On posix, never use the zygote for the broker. Also, only use the zygote if // we are not using a plugin launcher - having a plugin launcher means we need // to use another process instead of just forking the zygote. - process_->Launch(new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_), - cmd_line, true); + process_->Launch( + base::MakeUnique<PpapiPluginSandboxedProcessLauncherDelegate>(is_broker_), + std::move(cmd_line), true); return true; }
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index c4c30d20..415e9df 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -883,17 +883,19 @@ } else { // Build command line for renderer. We call AppendRendererCommandLine() // first so the process type argument will appear first. - base::CommandLine* cmd_line = new base::CommandLine(renderer_path); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(renderer_path); if (!renderer_prefix.empty()) cmd_line->PrependWrapper(renderer_prefix); - AppendRendererCommandLine(cmd_line); + AppendRendererCommandLine(cmd_line.get()); // Spawn the child process asynchronously to avoid blocking the UI thread. // As long as there's no renderer prefix, we can use the zygote process // at this stage. child_process_launcher_.reset(new ChildProcessLauncher( - new RendererSandboxedProcessLauncherDelegate(), cmd_line, GetID(), this, - child_token_, base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); + base::MakeUnique<RendererSandboxedProcessLauncherDelegate>(), + std::move(cmd_line), GetID(), this, child_token_, + base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); channel_->Pause(); fast_shutdown_started_ = false;
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc index 70bb8c0..4d50421 100644 --- a/content/browser/utility_process_host_impl.cc +++ b/content/browser/utility_process_host_impl.cc
@@ -274,8 +274,8 @@ // readlink("/prof/self/exe") sometimes fails on Android at startup. // As a workaround skip calling it here, since the executable name is // not needed on Android anyway. See crbug.com/500854. - base::CommandLine* cmd_line = - new base::CommandLine(base::CommandLine::NO_PROGRAM); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(base::CommandLine::NO_PROGRAM); #else int child_flags = child_flags_; @@ -293,7 +293,8 @@ return false; } - base::CommandLine* cmd_line = new base::CommandLine(exe_path); + std::unique_ptr<base::CommandLine> cmd_line = + base::MakeUnique<base::CommandLine>(exe_path); #endif cmd_line->AppendSwitchASCII(switches::kProcessType, @@ -337,9 +338,9 @@ cmd_line->AppendSwitch(switches::kUtilityProcessRunningElevated); #endif - process_->Launch(new UtilitySandboxedProcessLauncherDelegate( + process_->Launch(base::MakeUnique<UtilitySandboxedProcessLauncherDelegate>( exposed_dir_, run_elevated_, no_sandbox_, env_), - cmd_line, true); + std::move(cmd_line), true); } return true;
diff --git a/content/public/browser/browser_child_process_host.h b/content/public/browser/browser_child_process_host.h index 7f8bb93..48c36195 100644 --- a/content/public/browser/browser_child_process_host.h +++ b/content/public/browser/browser_child_process_host.h
@@ -58,10 +58,10 @@ ~BrowserChildProcessHost() override {} // Derived classes call this to launch the child process asynchronously. - // Takes ownership of |cmd_line| and |delegate|. - virtual void Launch(SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line, - bool terminate_on_shutdown) = 0; + virtual void Launch( + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, + bool terminate_on_shutdown) = 0; virtual const ChildProcessData& GetData() const = 0;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 2e4e4b99..5f63dba 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -1778,10 +1778,16 @@ ChildThreadImpl::OnProcessPurgeAndSuspend(); if (!RendererIsHidden()) return; + + // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. + if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) + return; + if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { - // TODO(tasak,bashi): After enabling MemoryCoordinator, stop calling - // SuspendRenderer() here. - SuspendRenderer(); + // TODO(tasak): After enabling MemoryCoordinator, remove this Notify + // and follow MemoryCoordinator's request. + base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( + base::MemoryState::SUSPENDED); } // Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...), // we need to wait until the task is finished. So wait 15 seconds and @@ -1888,10 +1894,16 @@ if (!RendererIsHidden()) return; + + // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. + if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) + return; + if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) { - // TODO(tasak,bashi): After enabling MemoryCoordinator, stop calling - // ResumeRenderer() here. - ResumeRenderer(); + // TODO(tasak): after enabling MemoryCoordinator, remove this Notify + // and follow MemoryCoordinator's request. + base::MemoryCoordinatorClientRegistry::GetInstance()->Notify( + base::MemoryState::NORMAL); } } @@ -2258,10 +2270,10 @@ } switch (state) { case base::MemoryState::NORMAL: - // TODO(bashi): When the renderer is suspended, resume it. + ResumeRenderer(); break; case base::MemoryState::THROTTLED: - // TODO(bashi): When the renderer is suspended, resume it. + ResumeRenderer(); // TODO(bashi): Figure out what kind of strategy is suitable on // THROTTLED state. crbug.com/674815 #if defined(OS_ANDROID) @@ -2273,10 +2285,7 @@ ReleaseFreeMemory(); break; case base::MemoryState::SUSPENDED: - // TODO(bashi): Suspend the renderer. - OnTrimMemoryImmediately(); - ReleaseFreeMemory(); - ClearMemory(); + SuspendRenderer(); break; case base::MemoryState::UNKNOWN: NOTREACHED(); @@ -2289,12 +2298,18 @@ OnTrimMemoryImmediately(); ReleaseFreeMemory(); ClearMemory(); - renderer_scheduler_->SuspendRenderer(); + // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. + if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator) && + base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) + renderer_scheduler_->SuspendRenderer(); } void RenderThreadImpl::ResumeRenderer() { DCHECK(IsMainThread()); - renderer_scheduler_->ResumeRenderer(); + // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled. + if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator) && + base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) + renderer_scheduler_->ResumeRenderer(); } void RenderThreadImpl::ClearMemory() {
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 516b20c..3705e47 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -83,8 +83,6 @@ crbug.com/587737 [ Mac ] virtual/gpu-rasterization/images/color-profile-filter.html [ Timeout Failure ] crbug.com/624233 virtual/gpu-rasterization/images/color-profile-background-clip-text.html [ Pass Failure Crash ] -crbug.com/657839 [ Linux ] virtual/gpu-rasterization/images/color-profile-filter.html [ NeedsRebaseline ] - crbug.com/657839 images/color-profile-layer.html [ Skip ] crbug.com/626748 paint/invalidation/table/cached-change-row-border-color.html [ Failure ] @@ -1915,6 +1913,7 @@ crbug.com/659917 virtual/mojo-loading/http/tests/xmlhttprequest/upload-onloadend-event-after-abort.html [ Timeout ] crbug.com/659917 virtual/mojo-loading/http/tests/xmlhttprequest/workers/xmlhttprequest-response-type-blob.html [ Pass Timeout ] crbug.com/659917 virtual/mojo-loading/http/tests/xmlhttprequest/workers/xmlhttprequest-response-type-blob-sync.html [ Pass Timeout ] +crbug.com/659917 virtual/mojo-loading/http/tests/xmlhttprequest/workers/shared-worker-response-type-blob.html [ Pass Timeout ] crbug.com/659917 virtual/mojo-loading/http/tests/xmlhttprequest/workers/shared-worker-response-type-blob-sync.html [ Pass Timeout ] crbug.com/669357 virtual/mojo-loading/http/tests/local/formdata/upload-events.html [ Failure ] @@ -2216,6 +2215,9 @@ # Added 2016-12-20 crbug.com/675907 fast/input/placeholder-wrongly-placed-if-too-tall.html [ Pass Timeout ] +# Added 2016-12-22 +crbug.com/676537 fast/css/imageTileOpacity.html [ Pass Failure ] + # ====== Random order flaky tests from here ====== # These tests are flaky when run in random order, which is the default on Linux & Mac since since 2016-12-16.
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMStringMap-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMStringMap-expected.txt deleted file mode 100644 index 4ccc2a6..0000000 --- a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMStringMap-expected.txt +++ /dev/null
@@ -1,11 +0,0 @@ -This is a testharness.js-based test. -PASS setter on DOMStringMap must enqueue an attributeChanged reaction when adding an observed data attribute -PASS setter on DOMStringMap must not enqueue an attributeChanged reaction when adding an unobserved data attribute -PASS setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute -FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute to the same value assert_array_equals: lengths differ, expected 1 got 0 -PASS setter on DOMStringMap must not enqueue an attributeChanged reaction when mutating the value of an unobserved data attribute -PASS deleter on DOMStringMap must enqueue an attributeChanged reaction when removing an observed data attribute -PASS deleter on DOMStringMap must not enqueue an attributeChanged reaction when removing an unobserved data attribute -PASS deleter on DOMStringMap must not enqueue an attributeChanged reaction when it does not remove a data attribute -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMTokenList-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMTokenList-expected.txt index d6a0834..61941d795 100644 --- a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMTokenList-expected.txt +++ b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/DOMTokenList-expected.txt
@@ -6,7 +6,7 @@ PASS add on DOMTokenList must enqueue exactly one attributeChanged reaction when adding multiple values to an attribute PASS remove on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute PASS remove on DOMTokenList must enqueue exactly one attributeChanged reaction when removing multiple values to an attribute -FAIL remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute assert_array_equals: lengths differ, expected 1 got 0 +PASS remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute PASS remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a value from an unobserved attribute PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an attribute PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute @@ -18,6 +18,6 @@ PASS the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when adding an unobserved attribute PASS the stringifier of DOMTokenList must enqueue an attributeChanged reaction when mutating the value of an observed attribute PASS the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when mutating the value of an unobserved attribute -FAIL the stringifier of DOMTokenList must enqueue an attributeChanged reaction when the setter is called with the original value of the attribute assert_array_equals: lengths differ, expected 1 got 0 +PASS the stringifier of DOMTokenList must enqueue an attributeChanged reaction when the setter is called with the original value of the attribute Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt deleted file mode 100644 index c553245..0000000 --- a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL length on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element assert_array_equals: lengths differ, expected 1 got 0 -PASS The indexed setter on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element -PASS The indexed setter on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element -PASS add on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element -PASS remove on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/MutationObserver-attributes-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/MutationObserver-attributes-expected.txt index d2b7bb2..660cad8 100644 --- a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/MutationObserver-attributes-expected.txt +++ b/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/MutationObserver-attributes-expected.txt
@@ -16,7 +16,7 @@ FAIL attributes Element.classList.add: same value mutation assert_equals: mutation records must match expected 2 but got 1 PASS attributes Element.classList.remove: single token removal mutation PASS attributes Element.classList.remove: multiple tokens removal mutation -FAIL attributes Element.classList.remove: missing token removal mutation assert_equals: mutation records must match expected 2 but got 1 +PASS attributes Element.classList.remove: missing token removal mutation PASS attributes Element.classList.toggle: token removal mutation PASS attributes Element.classList.toggle: token addition mutation PASS attributes Element.classList.toggle: forced token removal mutation
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/images/color-profile-filter-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/images/color-profile-filter-expected.png index d081bed..ac212269 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/images/color-profile-filter-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/images/color-profile-filter-expected.png Binary files differ
diff --git a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp index aeabc41..8ec6efcf 100644 --- a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.cpp
@@ -124,9 +124,10 @@ start.nonInterpolableValue.release()); } -InterpolationValue CSSBasicShapeInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue +CSSBasicShapeInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return BasicShapeInterpolationFunctions::maybeConvertBasicShape( BasicShapePropertyFunctions::getBasicShape(cssProperty(), style), style.effectiveZoom());
diff --git a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.h index df616f53..f0b2af3 100644 --- a/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSBasicShapeInterpolationType.h
@@ -14,8 +14,8 @@ CSSBasicShapeInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp index bec967f..ae4f207 100644 --- a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.cpp
@@ -261,10 +261,10 @@ SideNumbers(quad), std::move(nonInterpolableValues))); } -InterpolationValue -CSSBorderImageLengthBoxInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue CSSBorderImageLengthBoxInterpolationType:: + maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return convertBorderImageLengthBox( BorderImageLengthBoxPropertyFunctions::getBorderImageLengthBox( cssProperty(), style),
diff --git a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.h index 16ffcc3..b233475 100644 --- a/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSBorderImageLengthBoxInterpolationType.h
@@ -14,8 +14,8 @@ CSSBorderImageLengthBoxInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp index a0d75c1d8..e15d098 100644 --- a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.cpp
@@ -222,12 +222,12 @@ CSSClipNonInterpolableValue::create(autos)); } -InterpolationValue CSSClipInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - if (environment.state().style()->hasAutoClip()) +InterpolationValue +CSSClipInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + if (state.style()->hasAutoClip()) return nullptr; - return createClipValue(environment.state().style()->clip(), - environment.state().style()->effectiveZoom()); + return createClipValue(state.style()->clip(), state.style()->effectiveZoom()); } PairwiseInterpolationValue CSSClipInterpolationType::maybeMergeSingles(
diff --git a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.h index e8ed22e..1355f63 100644 --- a/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSClipInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyClip); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp index 410d124a..eb899ff 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.cpp
@@ -238,13 +238,12 @@ return InterpolationValue(std::move(colorPair)); } -InterpolationValue CSSColorInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSColorInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { return convertStyleColorPair( - ColorPropertyFunctions::getUnvisitedColor(cssProperty(), - *environment.state().style()), - ColorPropertyFunctions::getVisitedColor(cssProperty(), - *environment.state().style())); + ColorPropertyFunctions::getUnvisitedColor(cssProperty(), *state.style()), + ColorPropertyFunctions::getVisitedColor(cssProperty(), *state.style())); } void CSSColorInterpolationType::applyStandardPropertyValue(
diff --git a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h index 8e31028..2d5c0eeb 100644 --- a/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSColorInterpolationType.h
@@ -19,8 +19,8 @@ CSSColorInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp index 3af3c3a..aeba30d 100644 --- a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.cpp
@@ -162,9 +162,10 @@ NonInterpolableList::create(std::move(nonInterpolableValues))); } -InterpolationValue CSSFilterListInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue +CSSFilterListInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return convertFilterList( FilterListPropertyFunctions::getFilterList(cssProperty(), style), style.effectiveZoom());
diff --git a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.h index 010464d..3cd69ab 100644 --- a/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSFilterListInterpolationType.h
@@ -14,8 +14,8 @@ CSSFilterListInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp index 72522469..faaa8918 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.cpp
@@ -126,9 +126,10 @@ conversionCheckers); } -InterpolationValue CSSFontSizeInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return convertFontSize(environment.state().style()->specifiedFontSize()); +InterpolationValue +CSSFontSizeInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return convertFontSize(state.style()->specifiedFontSize()); } void CSSFontSizeInterpolationType::applyStandardPropertyValue(
diff --git a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.h index 304da5f..aa91533 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSFontSizeInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyFontSize); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp index 2c5699e..1c5c182 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
@@ -127,9 +127,10 @@ } } -InterpolationValue CSSFontWeightInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return createFontWeightValue(environment.state().style()->fontWeight()); +InterpolationValue +CSSFontWeightInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return createFontWeightValue(state.style()->fontWeight()); } void CSSFontWeightInterpolationType::applyStandardPropertyValue(
diff --git a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.h index fdb0499a9..a9f3645 100644 --- a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.h
@@ -17,8 +17,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyFontWeight); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp index c3be227..a191025 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.cpp
@@ -219,11 +219,11 @@ return maybeConvertCSSValue(value, true); } -InterpolationValue CSSImageInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSImageInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { return maybeConvertStyleImage( - ImagePropertyFunctions::getStyleImage(cssProperty(), - *environment.state().style()), + ImagePropertyFunctions::getStyleImage(cssProperty(), *state.style()), true); }
diff --git a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.h index 82f185f..5e5205b 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSImageInterpolationType.h
@@ -16,8 +16,8 @@ CSSImageInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp index 0e10f90..30cd2a8 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp
@@ -149,11 +149,12 @@ CSSImageInterpolationType::staticMergeSingleConversions); } -InterpolationValue CSSImageListInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSImageListInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { StyleImageList underlyingImageList; - ImageListPropertyFunctions::getImageList( - cssProperty(), *environment.state().style(), underlyingImageList); + ImageListPropertyFunctions::getImageList(cssProperty(), *state.style(), + underlyingImageList); return maybeConvertStyleImageList(underlyingImageList); }
diff --git a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.h index b2d171f..bb748f8 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.h
@@ -15,8 +15,8 @@ CSSImageListInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp index 2c41e0e..89e987a1 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.cpp
@@ -217,9 +217,10 @@ CSSImageSliceNonInterpolableValue::create(SliceTypes(slice))); } -InterpolationValue CSSImageSliceInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue +CSSImageSliceInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return convertImageSlice( ImageSlicePropertyFunctions::getImageSlice(cssProperty(), style), style.effectiveZoom());
diff --git a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.h index 3d61e22e..8d6418a 100644 --- a/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSImageSliceInterpolationType.h
@@ -14,8 +14,8 @@ CSSImageSliceInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp index 6785e24..c784ceb 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -89,6 +89,13 @@ return maybeConvertValue(*value, environment.state(), conversionCheckers); } +InterpolationValue CSSInterpolationType::maybeConvertUnderlyingValue( + const InterpolationEnvironment& environment) const { + // TODO(alancutter): Add support for converting underlying registered custom + // property values. + return maybeConvertStandardPropertyUnderlyingValue(environment.state()); +} + void CSSInterpolationType::apply( const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue,
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSInterpolationType.h index 0898733..a9553a1 100644 --- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.h
@@ -30,6 +30,12 @@ virtual InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverState&, ConversionCheckers&) const = 0; + + InterpolationValue maybeConvertUnderlyingValue( + const InterpolationEnvironment&) const final; + virtual InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const = 0; + void apply(const InterpolableValue&, const NonInterpolableValue*, InterpolationEnvironment&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp index 87053e37..bced1df 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.cpp
@@ -107,14 +107,15 @@ std::move(end)); } -InterpolationValue CSSLengthInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSLengthInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { Length underlyingLength; - if (!LengthPropertyFunctions::getLength( - cssProperty(), *environment.state().style(), underlyingLength)) + if (!LengthPropertyFunctions::getLength(cssProperty(), *state.style(), + underlyingLength)) return nullptr; return LengthInterpolationFunctions::maybeConvertLength( - underlyingLength, effectiveZoom(*environment.state().style())); + underlyingLength, effectiveZoom(*state.style())); } void CSSLengthInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h index e774aa48..7561fae 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSLengthInterpolationType.h
@@ -17,8 +17,8 @@ public: CSSLengthInterpolationType(PropertyHandle); - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp index c4f8a65..c99029fc 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.cpp
@@ -126,14 +126,15 @@ LengthInterpolationFunctions::mergeSingles); } -InterpolationValue CSSLengthListInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSLengthListInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { Vector<Length> underlyingLengthList; - if (!LengthListPropertyFunctions::getLengthList( - cssProperty(), *environment.state().style(), underlyingLengthList)) + if (!LengthListPropertyFunctions::getLengthList(cssProperty(), *state.style(), + underlyingLengthList)) return nullptr; return maybeConvertLengthList(underlyingLengthList, - environment.state().style()->effectiveZoom()); + state.style()->effectiveZoom()); } void CSSLengthListInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.h index f548e54..5fb2e8c 100644 --- a/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSLengthListInterpolationType.h
@@ -15,8 +15,8 @@ public: CSSLengthListInterpolationType(PropertyHandle); - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp index 4f4cd50..ef2dae4 100644 --- a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.cpp
@@ -79,11 +79,12 @@ return createNumberValue(toCSSPrimitiveValue(value).getDoubleValue()); } -InterpolationValue CSSNumberInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSNumberInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { double underlyingNumber; - if (!NumberPropertyFunctions::getNumber( - cssProperty(), *environment.state().style(), underlyingNumber)) + if (!NumberPropertyFunctions::getNumber(cssProperty(), *state.style(), + underlyingNumber)) return nullptr; return createNumberValue(underlyingNumber); }
diff --git a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.h index fa9863c..d2eae88 100644 --- a/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSNumberInterpolationType.h
@@ -14,8 +14,8 @@ CSSNumberInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.cpp index 78aa125..3ae0877 100644 --- a/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.cpp
@@ -141,9 +141,9 @@ } InterpolationValue -CSSOffsetRotateInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return convertOffsetRotate(environment.state().style()->offsetRotation()); +CSSOffsetRotateInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return convertOffsetRotate(state.style()->offsetRotation()); } void CSSOffsetRotateInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.h index 76411fd..8b43201 100644 --- a/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSOffsetRotateInterpolationType.h
@@ -17,8 +17,8 @@ cssProperty() == CSSPropertyOffsetRotation); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp index cfd1308..8e7dee4 100644 --- a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.cpp
@@ -88,13 +88,14 @@ return InterpolationValue(std::move(interpolableColor)); } -InterpolationValue CSSPaintInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSPaintInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { // TODO(alancutter): Support capturing and animating with the visited paint // color. StyleColor underlyingColor; - if (!PaintPropertyFunctions::getColor( - cssProperty(), *environment.state().style(), underlyingColor)) + if (!PaintPropertyFunctions::getColor(cssProperty(), *state.style(), + underlyingColor)) return nullptr; return InterpolationValue( CSSColorInterpolationType::createInterpolableColor(underlyingColor));
diff --git a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.h index 2bad2aec..dc88f1a 100644 --- a/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSPaintInterpolationType.h
@@ -14,8 +14,8 @@ CSSPaintInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp index ca884dc..40b05f7 100644 --- a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.cpp
@@ -95,11 +95,12 @@ toCSSPathValue(value).byteStream()); } -InterpolationValue CSSPathInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSPathInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { DCHECK_EQ(cssProperty(), CSSPropertyD); return PathInterpolationFunctions::convertValue( - environment.state().style()->svgStyle().d()); + state.style()->svgStyle().d()); } PairwiseInterpolationValue CSSPathInterpolationType::maybeMergeSingles(
diff --git a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.h index 480b09a..d6ecce4 100644 --- a/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSPathInterpolationType.h
@@ -32,8 +32,8 @@ InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverState&, ConversionCheckers&) const final; - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp index fb0bbac5..7753731 100644 --- a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.cpp
@@ -186,9 +186,10 @@ toCSSRotateNonInterpolableValue(*end.nonInterpolableValue))); } -InterpolationValue CSSRotateInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return convertRotation(getRotation(*environment.state().style())); +InterpolationValue +CSSRotateInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return convertRotation(getRotation(*state.style())); } void CSSRotateInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.h index 35e96ae..0ed79e0 100644 --- a/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSRotateInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyRotate); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const InterpolationValue& underlying,
diff --git a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp index a98f1f6..d7b611c 100644 --- a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.cpp
@@ -186,10 +186,11 @@ toCSSScaleNonInterpolableValue(*end.nonInterpolableValue))); } -InterpolationValue CSSScaleInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { +InterpolationValue +CSSScaleInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { return InterpolationValue( - Scale(environment.state().style()->scale()).createInterpolableValue()); + Scale(state.style()->scale()).createInterpolableValue()); } void CSSScaleInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.h index feefd9a6..90eb0a49 100644 --- a/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyScale); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp index 3318db7b..eb78765 100644 --- a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.cpp
@@ -119,13 +119,14 @@ ShadowInterpolationFunctions::maybeMergeSingles); } -InterpolationValue CSSShadowListInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - if (!environment.state().style()) +InterpolationValue +CSSShadowListInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + if (!state.style()) return nullptr; - return convertShadowList(ShadowListPropertyFunctions::getShadowList( - cssProperty(), *environment.state().style()), - environment.state().style()->effectiveZoom()); + return convertShadowList( + ShadowListPropertyFunctions::getShadowList(cssProperty(), *state.style()), + state.style()->effectiveZoom()); } void CSSShadowListInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.h index 0835cad..8f3472f 100644 --- a/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.h
@@ -16,8 +16,8 @@ CSSShadowListInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.cpp index bb37ea2..e6158e0 100644 --- a/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.cpp
@@ -153,9 +153,10 @@ SizeInterpolationFunctions::maybeMergeSingles); } -InterpolationValue CSSSizeListInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue +CSSSizeListInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return convertSizeList( SizeListPropertyFunctions::getSizeList(cssProperty(), style), style.effectiveZoom());
diff --git a/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.h index a695d6d..47a0074 100644 --- a/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.h
@@ -14,8 +14,8 @@ CSSSizeListInterpolationType(PropertyHandle property) : CSSInterpolationType(property) {} - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void composite(UnderlyingValueOwner&, double underlyingFraction, const InterpolationValue&,
diff --git a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp index 661af64..6b5f2aa 100644 --- a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp
@@ -176,9 +176,10 @@ length.nonInterpolableValue.release(), IndentMode(line, type))); } -InterpolationValue CSSTextIndentInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - const ComputedStyle& style = *environment.state().style(); +InterpolationValue +CSSTextIndentInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + const ComputedStyle& style = *state.style(); return createValue(style.textIndent(), IndentMode(style), style.effectiveZoom()); }
diff --git a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.h index c6ddb85..37b83ecc 100644 --- a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyTextIndent); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp index 03bf8eb..f6ebc4bb 100644 --- a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.cpp
@@ -233,9 +233,10 @@ toCSSTransformNonInterpolableValue(*end.nonInterpolableValue)))); } -InterpolationValue CSSTransformInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return convertTransform(environment.state().style()->transform()); +InterpolationValue +CSSTransformInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return convertTransform(state.style()->transform()); } void CSSTransformInterpolationType::composite(
diff --git a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.h index 7601f6b..28e4e4ba 100644 --- a/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSTransformInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyTransform); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe&, const InterpolationEnvironment&, const InterpolationValue& underlying,
diff --git a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp index a1e9934..aa63b35 100644 --- a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.cpp
@@ -137,11 +137,11 @@ return InterpolationValue(std::move(result)); } -InterpolationValue CSSTranslateInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return convertTranslateOperation( - environment.state().style()->translate(), - environment.state().style()->effectiveZoom()); +InterpolationValue +CSSTranslateInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return convertTranslateOperation(state.style()->translate(), + state.style()->effectiveZoom()); } void CSSTranslateInterpolationType::applyStandardPropertyValue(
diff --git a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.h index 49a1ff4..c88bc6fd 100644 --- a/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSTranslateInterpolationType.h
@@ -16,8 +16,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyTranslate); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; void applyStandardPropertyValue(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const final;
diff --git a/third_party/WebKit/Source/core/animation/CSSValueInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSValueInterpolationType.h index e70ed9d..606859b 100644 --- a/third_party/WebKit/Source/core/animation/CSSValueInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSValueInterpolationType.h
@@ -30,8 +30,8 @@ const InterpolationValue& underlying, ConversionCheckers&) const final; - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final { + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final { return nullptr; }
diff --git a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp index d2dd496b..8f7fb6dd3c 100644 --- a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.cpp
@@ -152,9 +152,10 @@ } } -InterpolationValue CSSVisibilityInterpolationType::maybeConvertUnderlyingValue( - const InterpolationEnvironment& environment) const { - return createVisibilityValue(environment.state().style()->visibility()); +InterpolationValue +CSSVisibilityInterpolationType::maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState& state) const { + return createVisibilityValue(state.style()->visibility()); } PairwiseInterpolationValue CSSVisibilityInterpolationType::maybeMergeSingles(
diff --git a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.h b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.h index 8fcab504..b5273fbe 100644 --- a/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.h +++ b/third_party/WebKit/Source/core/animation/CSSVisibilityInterpolationType.h
@@ -17,8 +17,8 @@ DCHECK_EQ(cssProperty(), CSSPropertyVisibility); } - InterpolationValue maybeConvertUnderlyingValue( - const InterpolationEnvironment&) const final; + InterpolationValue maybeConvertStandardPropertyUnderlyingValue( + const StyleResolverState&) const final; PairwiseInterpolationValue maybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const final;
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h index 7956a9a..75086fd 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -1586,13 +1586,13 @@ case EListStyleType::CjkHeavenlyStem: m_valueID = CSSValueCjkHeavenlyStem; break; - case EListStyleType::CJKIdeographic: + case EListStyleType::CjkIdeographic: m_valueID = CSSValueCjkIdeographic; break; case EListStyleType::DecimalLeadingZero: m_valueID = CSSValueDecimalLeadingZero; break; - case EListStyleType::DecimalListStyle: + case EListStyleType::Decimal: m_valueID = CSSValueDecimal; break; case EListStyleType::Devanagari: @@ -1685,7 +1685,7 @@ case EListStyleType::Myanmar: m_valueID = CSSValueMyanmar; break; - case EListStyleType::NoneListStyle: + case EListStyleType::None: m_valueID = CSSValueNone; break; case EListStyleType::Oriya: @@ -1740,7 +1740,7 @@ inline EListStyleType CSSIdentifierValue::convertTo() const { switch (m_valueID) { case CSSValueNone: - return EListStyleType::NoneListStyle; + return EListStyleType::None; case CSSValueArabicIndic: return EListStyleType::ArabicIndic; case CSSValueArmenian: @@ -1756,11 +1756,11 @@ case CSSValueCjkHeavenlyStem: return EListStyleType::CjkHeavenlyStem; case CSSValueCjkIdeographic: - return EListStyleType::CJKIdeographic; + return EListStyleType::CjkIdeographic; case CSSValueDecimalLeadingZero: return EListStyleType::DecimalLeadingZero; case CSSValueDecimal: - return EListStyleType::DecimalListStyle; + return EListStyleType::Decimal; case CSSValueDevanagari: return EListStyleType::Devanagari; case CSSValueDisc: @@ -1856,7 +1856,7 @@ } NOTREACHED(); - return EListStyleType::NoneListStyle; + return EListStyleType::None; } template <> @@ -2880,13 +2880,13 @@ inline CSSIdentifierValue::CSSIdentifierValue(WritingMode e) : CSSValue(IdentifierClass) { switch (e) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: m_valueID = CSSValueHorizontalTb; break; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: m_valueID = CSSValueVerticalRl; break; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: m_valueID = CSSValueVerticalLr; break; } @@ -2900,19 +2900,19 @@ case CSSValueLrTb: case CSSValueRl: case CSSValueRlTb: - return TopToBottomWritingMode; + return WritingMode::HorizontalTb; case CSSValueVerticalRl: case CSSValueTb: case CSSValueTbRl: - return RightToLeftWritingMode; + return WritingMode::VerticalRl; case CSSValueVerticalLr: - return LeftToRightWritingMode; + return WritingMode::VerticalLr; default: break; } ASSERT_NOT_REACHED(); - return TopToBottomWritingMode; + return WritingMode::HorizontalTb; } template <>
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.in b/third_party/WebKit/Source/core/css/CSSProperties.in index 64c16b0e..36a63603 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.in +++ b/third_party/WebKit/Source/core/css/CSSProperties.in
@@ -279,7 +279,7 @@ line-height interpolable, inherited, getter=specifiedLineHeight, converter=convertLineHeight list-style-image interpolable, inherited, custom_value, typedom_types=[Image] list-style-position inherited, independent, keyword_only, keywords=[outside|inside], initial_keyword=outside -list-style-type inherited +list-style-type inherited, keyword_only, keywords=[disc|circle|square|decimal|decimal-leading-zero|arabic-indic|bengali|cambodian|khmer|devanagari|gujarati|gurmukhi|kannada|lao|malayalam|mongolian|myanmar|oriya|persian|urdu|telugu|tibetan|thai|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|cjk-earthly-branch|cjk-heavenly-stem|ethiopic-halehame|ethiopic-halehame-am|ethiopic-halehame-ti-er|ethiopic-halehame-ti-et|hangul|hangul-consonant|korean-hangul-formal|korean-hanja-formal|korean-hanja-informal|hebrew|armenian|lower-armenian|upper-armenian|georgian|cjk-ideographic|simp-chinese-formal|simp-chinese-informal|trad-chinese-formal|trad-chinese-informal|hiragana|katakana|hiragana-iroha|katakana-iroha|none], initial_keyword=disc margin-bottom interpolable, initial=initialMargin, converter=convertQuirkyLength margin-left interpolable, initial=initialMargin, converter=convertQuirkyLength margin-right interpolable, initial=initialMargin, converter=convertQuirkyLength
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index e7c58fd..55cf044 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -1482,7 +1482,7 @@ CSSCustomIdentValue::create(counter->identifier()); CSSStringValue* separator = CSSStringValue::create(counter->separator()); CSSValueID listStyleIdent = CSSValueNone; - if (counter->listStyle() != EListStyleType::NoneListStyle) { + if (counter->listStyle() != EListStyleType::None) { // TODO(sashab): Change this to use a converter instead of // CSSPrimitiveValueMappings. listStyleIdent =
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp index 55275ee1..282d838 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -363,10 +363,10 @@ // FIXME: Since we don't support block-flow on flexible boxes yet, disallow // setting of block-flow to anything other than TopToBottomWritingMode. // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. - if (style.getWritingMode() != TopToBottomWritingMode && + if (style.getWritingMode() != WritingMode::HorizontalTb && (style.display() == EDisplay::WebkitBox || style.display() == EDisplay::WebkitInlineBox)) - style.setWritingMode(TopToBottomWritingMode); + style.setWritingMode(WritingMode::HorizontalTb); if (parentStyle.isDisplayFlexibleOrGridBox()) { style.setFloating(EFloat::None);
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp index 3755fa7..89082f87 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -758,7 +758,7 @@ ContentData::create(state.styleImage(CSSPropertyContent, *item)); } else if (item->isCounterValue()) { const CSSCounterValue* counterValue = toCSSCounterValue(item.get()); - EListStyleType listStyleType = EListStyleType::NoneListStyle; + EListStyleType listStyleType = EListStyleType::None; CSSValueID listStyleIdent = counterValue->listStyle(); if (listStyleIdent != CSSValueNone) listStyleType =
diff --git a/third_party/WebKit/Source/core/dom/DOMTokenList.cpp b/third_party/WebKit/Source/core/dom/DOMTokenList.cpp index b931c68..1149d40 100644 --- a/third_party/WebKit/Source/core/dom/DOMTokenList.cpp +++ b/third_party/WebKit/Source/core/dom/DOMTokenList.cpp
@@ -153,8 +153,7 @@ } } - if (found) - setValue(removeTokens(value(), tokens)); + setValue(found ? removeTokens(value(), tokens) : value()); } bool DOMTokenList::toggle(const AtomicString& token, @@ -291,8 +290,10 @@ } void DOMTokenList::setValue(const AtomicString& value) { + bool valueChanged = m_value != value; m_value = value; - m_tokens.set(value, SpaceSplitString::ShouldNotFoldCase); + if (valueChanged) + m_tokens.set(value, SpaceSplitString::ShouldNotFoldCase); if (m_observer) m_observer->valueWasSet(); }
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index a483dda..d1c874cb 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -2512,8 +2512,13 @@ AtomicString valueBeingRemoved = attributes[index].value(); if (!inSynchronizationOfLazyAttribute) { - if (!valueBeingRemoved.isNull()) + if (!valueBeingRemoved.isNull()) { willModifyAttribute(name, valueBeingRemoved, nullAtom); + } else if (getCustomElementState() == CustomElementState::Custom) { + // This would otherwise be enqueued by willModifyAttribute. + CustomElement::enqueueAttributeChangedCallback( + this, name, valueBeingRemoved, nullAtom); + } } if (Attr* attrNode = attrIfExists(name)) @@ -3512,14 +3517,17 @@ updateName(oldValue, newValue); } + if (getCustomElementState() == CustomElementState::Custom) { + CustomElement::enqueueAttributeChangedCallback(this, name, oldValue, + newValue); + } + if (oldValue != newValue) { document().styleEngine().attributeChangedForElement(name, *this); - if (getCustomElementState() == CustomElementState::Custom) - CustomElement::enqueueAttributeChangedCallback(this, name, oldValue, - newValue); - else if (isUpgradedV0CustomElement()) + if (isUpgradedV0CustomElement()) { V0CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue); + } } if (MutationObserverInterestGroup* recipients =
diff --git a/third_party/WebKit/Source/core/html/HTMLOptionsCollection.idl b/third_party/WebKit/Source/core/html/HTMLOptionsCollection.idl index c0838a4f0..f5e32f3 100644 --- a/third_party/WebKit/Source/core/html/HTMLOptionsCollection.idl +++ b/third_party/WebKit/Source/core/html/HTMLOptionsCollection.idl
@@ -26,7 +26,7 @@ SetWrapperReferenceFrom=ownerNode, ] interface HTMLOptionsCollection : HTMLCollection { // inherits item() - [RaisesException=Setter] attribute unsigned long length; // shadows inherited length + [CEReactions, RaisesException=Setter] attribute unsigned long length; // shadows inherited length // FIXME: The spec has a legacycaller HTMLOptionElement? (DOMString name); [CEReactions, RaisesException] setter void (unsigned long index, HTMLOptionElement? option); [CEReactions, RaisesException] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
diff --git a/third_party/WebKit/Source/core/layout/LayoutDetailsMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutDetailsMarker.cpp index 52903bb..e58624e 100644 --- a/third_party/WebKit/Source/core/layout/LayoutDetailsMarker.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutDetailsMarker.cpp
@@ -34,15 +34,15 @@ LayoutDetailsMarker::Orientation LayoutDetailsMarker::getOrientation() const { switch (style()->getWritingMode()) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: if (style()->isLeftToRightDirection()) return isOpen() ? Down : Right; return isOpen() ? Down : Left; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: if (style()->isLeftToRightDirection()) return isOpen() ? Left : Down; return isOpen() ? Left : Up; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: if (style()->isLeftToRightDirection()) return isOpen() ? Right : Down; return isOpen() ? Right : Up;
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp index 07b85d0..20d7cde 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -611,23 +611,23 @@ WritingMode mode = style()->getWritingMode(); if (!isColumnFlow()) { static_assert( - static_cast<TransformedWritingMode>(TopToBottomWritingMode) == + static_cast<TransformedWritingMode>(WritingMode::HorizontalTb) == TransformedWritingMode::TopToBottomWritingMode && - static_cast<TransformedWritingMode>(LeftToRightWritingMode) == + static_cast<TransformedWritingMode>(WritingMode::VerticalLr) == TransformedWritingMode::LeftToRightWritingMode && - static_cast<TransformedWritingMode>(RightToLeftWritingMode) == + static_cast<TransformedWritingMode>(WritingMode::VerticalRl) == TransformedWritingMode::RightToLeftWritingMode, "WritingMode and TransformedWritingMode must match values."); return static_cast<TransformedWritingMode>(mode); } switch (mode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return style()->isLeftToRightDirection() ? TransformedWritingMode::LeftToRightWritingMode : TransformedWritingMode::RightToLeftWritingMode; - case LeftToRightWritingMode: - case RightToLeftWritingMode: + case WritingMode::VerticalLr: + case WritingMode::VerticalRl: return style()->isLeftToRightDirection() ? TransformedWritingMode::TopToBottomWritingMode : TransformedWritingMode::BottomToTopWritingMode;
diff --git a/third_party/WebKit/Source/core/layout/LayoutListItem.cpp b/third_party/WebKit/Source/core/layout/LayoutListItem.cpp index 56b4c6d1..d2193b7 100644 --- a/third_party/WebKit/Source/core/layout/LayoutListItem.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutListItem.cpp
@@ -52,7 +52,7 @@ LayoutBlockFlow::styleDidChange(diff, oldStyle); StyleImage* currentImage = style()->listStyleImage(); - if (style()->listStyleType() != EListStyleType::NoneListStyle || + if (style()->listStyleType() != EListStyleType::None || (currentImage && !currentImage->errorOccurred())) { if (!m_marker) m_marker = LayoutListMarker::createAnonymous(this);
diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp index 46ce9025..91eec1f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
@@ -370,7 +370,7 @@ LayoutListMarker::ListStyleCategory LayoutListMarker::getListStyleCategory() const { switch (style()->listStyleType()) { - case EListStyleType::NoneListStyle: + case EListStyleType::None: return ListStyleCategory::None; case EListStyleType::Disc: case EListStyleType::Circle: @@ -380,11 +380,11 @@ case EListStyleType::Armenian: case EListStyleType::Bengali: case EListStyleType::Cambodian: - case EListStyleType::CJKIdeographic: + case EListStyleType::CjkIdeographic: case EListStyleType::CjkEarthlyBranch: case EListStyleType::CjkHeavenlyStem: case EListStyleType::DecimalLeadingZero: - case EListStyleType::DecimalListStyle: + case EListStyleType::Decimal: case EListStyleType::Devanagari: case EListStyleType::EthiopicHalehame: case EListStyleType::EthiopicHalehameAm:
diff --git a/third_party/WebKit/Source/core/layout/ListMarkerText.cpp b/third_party/WebKit/Source/core/layout/ListMarkerText.cpp index 2826380..a0ff14a 100644 --- a/third_party/WebKit/Source/core/layout/ListMarkerText.cpp +++ b/third_party/WebKit/Source/core/layout/ListMarkerText.cpp
@@ -467,7 +467,7 @@ case EListStyleType::Cambodian: case EListStyleType::Circle: case EListStyleType::DecimalLeadingZero: - case EListStyleType::DecimalListStyle: + case EListStyleType::Decimal: case EListStyleType::Devanagari: case EListStyleType::Disc: case EListStyleType::Gujarati: @@ -478,7 +478,7 @@ case EListStyleType::Malayalam: case EListStyleType::Mongolian: case EListStyleType::Myanmar: - case EListStyleType::NoneListStyle: + case EListStyleType::None: case EListStyleType::Oriya: case EListStyleType::Persian: case EListStyleType::Square: @@ -489,7 +489,7 @@ case EListStyleType::KoreanHangulFormal: case EListStyleType::KoreanHanjaFormal: case EListStyleType::KoreanHanjaInformal: - case EListStyleType::CJKIdeographic: + case EListStyleType::CjkIdeographic: case EListStyleType::SimpChineseFormal: case EListStyleType::SimpChineseInformal: case EListStyleType::TradChineseFormal: @@ -498,18 +498,14 @@ case EListStyleType::Armenian: case EListStyleType::LowerArmenian: case EListStyleType::UpperArmenian: - return (count < 1 || count > 99999999) ? EListStyleType::DecimalListStyle - : type; + return (count < 1 || count > 99999999) ? EListStyleType::Decimal : type; case EListStyleType::Georgian: - return (count < 1 || count > 19999) ? EListStyleType::DecimalListStyle - : type; + return (count < 1 || count > 19999) ? EListStyleType::Decimal : type; case EListStyleType::Hebrew: - return (count < 0 || count > 999999) ? EListStyleType::DecimalListStyle - : type; + return (count < 0 || count > 999999) ? EListStyleType::Decimal : type; case EListStyleType::LowerRoman: case EListStyleType::UpperRoman: - return (count < 1 || count > 3999) ? EListStyleType::DecimalListStyle - : type; + return (count < 1 || count > 3999) ? EListStyleType::Decimal : type; case EListStyleType::CjkEarthlyBranch: case EListStyleType::CjkHeavenlyStem: case EListStyleType::EthiopicHalehameAm: @@ -527,7 +523,7 @@ case EListStyleType::LowerLatin: case EListStyleType::UpperAlpha: case EListStyleType::UpperLatin: - return (count < 1) ? EListStyleType::DecimalListStyle : type; + return (count < 1) ? EListStyleType::Decimal : type; } ASSERT_NOT_REACHED(); @@ -545,7 +541,7 @@ switch (effectiveType) { case EListStyleType::Circle: case EListStyleType::Disc: - case EListStyleType::NoneListStyle: + case EListStyleType::None: case EListStyleType::Square: return ' '; case EListStyleType::EthiopicHalehame: @@ -557,11 +553,11 @@ case EListStyleType::ArabicIndic: case EListStyleType::Bengali: case EListStyleType::Cambodian: - case EListStyleType::CJKIdeographic: + case EListStyleType::CjkIdeographic: case EListStyleType::CjkEarthlyBranch: case EListStyleType::CjkHeavenlyStem: case EListStyleType::DecimalLeadingZero: - case EListStyleType::DecimalListStyle: + case EListStyleType::Decimal: case EListStyleType::Devanagari: case EListStyleType::Georgian: case EListStyleType::Gujarati: @@ -614,7 +610,7 @@ // outside its ordinal range then we fallback to some list style that can // represent |count|. switch (effectiveListMarkerType(type, count)) { - case EListStyleType::NoneListStyle: + case EListStyleType::None: return ""; // We use the same characters for text security. @@ -628,7 +624,7 @@ // instead, but I think this looks better. return String(&blackSquareCharacter, 1); - case EListStyleType::DecimalListStyle: + case EListStyleType::Decimal: return String::number(count); case EListStyleType::DecimalLeadingZero: if (count < -9 || count > 9) @@ -889,7 +885,7 @@ 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000}; return toCJKIdeographic(count, koreanHanjaInformalTable, Informal); } - case EListStyleType::CJKIdeographic: + case EListStyleType::CjkIdeographic: case EListStyleType::TradChineseInformal: { static const UChar traditionalChineseInformalTable[22] = { Chinese, 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 0x5341,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc index 039ca524..c4a4410b 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -200,7 +200,7 @@ ComputeBorders(Style()) + ComputePadding(ConstraintSpace(), Style()); WTF::Optional<MinAndMaxContentSizes> sizes; - if (NeedMinAndMaxContentSizes(Style())) { + if (NeedMinAndMaxContentSizes(ConstraintSpace(), Style())) { // TODOO(layout-ng): Implement sizes = MinAndMaxContentSizes(); } @@ -442,11 +442,19 @@ NGConstraintSpace* NGBlockLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() const { + // TODO(layout-ng): Orthogonal children should also shrink to fit (in *their* + // inline axis) + // We have to keep this commented out for now until we correctly compute + // min/max content sizes in Layout(). + // bool shrink_to_fit = CurrentChildStyle().display() == EDisplay::InlineBlock + // || CurrentChildStyle().isFloating(); + bool shrink_to_fit = false; DCHECK(current_child_); space_builder_ ->SetIsNewFormattingContext( IsNewFormattingContextForInFlowBlockLevelChild(ConstraintSpace(), CurrentChildStyle())) + .SetIsShrinkToFit(shrink_to_fit) .SetWritingMode( FromPlatformWritingMode(CurrentChildStyle().getWritingMode())) .SetTextDirection(CurrentChildStyle().direction());
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc index 374994461..df0aee4d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -120,13 +120,13 @@ const int kMarginLeft = 100; RefPtr<ComputedStyle> div1_style = ComputedStyle::create(); - div1_style->setWritingMode(LeftToRightWritingMode); + div1_style->setWritingMode(WritingMode::VerticalLr); NGBlockNode* div1 = new NGBlockNode(div1_style.get()); RefPtr<ComputedStyle> div2_style = ComputedStyle::create(); div2_style->setHeight(Length(kHeight, Fixed)); div2_style->setWidth(Length(kWidth, Fixed)); - div1_style->setWritingMode(TopToBottomWritingMode); + div1_style->setWritingMode(WritingMode::HorizontalTb); div2_style->setMarginLeft(Length(kMarginLeft, Fixed)); NGBlockNode* div2 = new NGBlockNode(div2_style.get()); @@ -393,7 +393,7 @@ style_->setWidth(Length(500, Fixed)); style_->setHeight(Length(500, Fixed)); - style_->setWritingMode(LeftToRightWritingMode); + style_->setWritingMode(WritingMode::VerticalLr); // Vertical DIV RefPtr<ComputedStyle> vertical_style = ComputedStyle::create(); @@ -404,7 +404,7 @@ // Horizontal DIV RefPtr<ComputedStyle> horizontal_style = ComputedStyle::create(); horizontal_style->setMarginLeft(Length(kHorizontalDivMarginLeft, Fixed)); - horizontal_style->setWritingMode(TopToBottomWritingMode); + horizontal_style->setWritingMode(WritingMode::HorizontalTb); NGBlockNode* horizontal_div = new NGBlockNode(horizontal_style.get()); vertical_div->SetNextSibling(horizontal_div); @@ -448,7 +448,7 @@ RefPtr<ComputedStyle> div1_style = ComputedStyle::create(); div1_style->setWidth(Length(kWidth, Fixed)); div1_style->setHeight(Length(kHeight, Fixed)); - div1_style->setWritingMode(RightToLeftWritingMode); + div1_style->setWritingMode(WritingMode::VerticalRl); div1_style->setMarginBottom(Length(kMarginBottom, Fixed)); NGBlockNode* div1 = new NGBlockNode(div1_style.get());
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc index 4fb438d..9ec2d52 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -18,6 +18,7 @@ NGLogicalSize percentage_resolution_size, bool is_fixed_size_inline, bool is_fixed_size_block, + bool is_shrink_to_fit, bool is_inline_direction_triggers_scrollbar, bool is_block_direction_triggers_scrollbar, NGFragmentationType block_direction_fragmentation_type, @@ -27,6 +28,7 @@ percentage_resolution_size_(percentage_resolution_size), is_fixed_size_inline_(is_fixed_size_inline), is_fixed_size_block_(is_fixed_size_block), + is_shrink_to_fit_(is_shrink_to_fit), is_inline_direction_triggers_scrollbar_( is_inline_direction_triggers_scrollbar), is_block_direction_triggers_scrollbar_( @@ -78,6 +80,8 @@ box.styleRef().overflowBlockDirection() == EOverflow::Auto) .SetIsFixedSizeInline(fixed_inline) .SetIsFixedSizeBlock(fixed_block) + .SetIsShrinkToFit( + box.sizesLogicalWidthToFitContent(box.styleRef().logicalWidth())) .SetIsNewFormattingContext(is_new_fc) .SetTextDirection(box.styleRef().direction()) .ToConstraintSpace();
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h index a392af7..e85a720 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
@@ -94,6 +94,10 @@ bool IsFixedSizeBlock() const { return is_fixed_size_block_; } + // Whether an auto inline-size should be interpreted as shrink-to-fit + // (ie. fit-content). This is used for inline-block, floats, etc. + bool IsShrinkToFit() const { return is_shrink_to_fit_; } + // If specified a layout should produce a Fragment which fragments at the // blockSize if possible. NGFragmentationType BlockFragmentationType() const; @@ -120,6 +124,7 @@ NGLogicalSize percentage_resolution_size, bool is_fixed_size_inline, bool is_fixed_size_block, + bool is_shrink_to_fit, bool is_inline_direction_triggers_scrollbar, bool is_block_direction_triggers_scrollbar, NGFragmentationType block_direction_fragmentation_type, @@ -132,6 +137,8 @@ unsigned is_fixed_size_inline_ : 1; unsigned is_fixed_size_block_ : 1; + unsigned is_shrink_to_fit_ : 1; + unsigned is_inline_direction_triggers_scrollbar_ : 1; unsigned is_block_direction_triggers_scrollbar_ : 1;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc index 71e50ca..33c52f6 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
@@ -14,6 +14,7 @@ parent_writing_mode_(writing_mode_), is_fixed_size_inline_(false), is_fixed_size_block_(false), + is_shrink_to_fit_(false), is_inline_direction_triggers_scrollbar_(false), is_block_direction_triggers_scrollbar_(false), fragmentation_type_(kFragmentNone), @@ -26,6 +27,7 @@ parent_writing_mode_(writing_mode_), is_fixed_size_inline_(false), is_fixed_size_block_(false), + is_shrink_to_fit_(false), is_inline_direction_triggers_scrollbar_(false), is_block_direction_triggers_scrollbar_(false), fragmentation_type_(kFragmentNone), @@ -63,6 +65,12 @@ return *this; } +NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsShrinkToFit( + bool shrink_to_fit) { + is_shrink_to_fit_ = shrink_to_fit; + return *this; +} + NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsInlineDirectionTriggersScrollbar( bool is_inline_direction_triggers_scrollbar) { @@ -114,7 +122,7 @@ {available_size_.inline_size, available_size_.block_size}, {percentage_resolution_size_.inline_size, percentage_resolution_size_.block_size}, - is_fixed_size_inline_, is_fixed_size_block_, + is_fixed_size_inline_, is_fixed_size_block_, is_shrink_to_fit_, is_inline_direction_triggers_scrollbar_, is_block_direction_triggers_scrollbar_, static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, @@ -127,7 +135,7 @@ {available_size_.block_size, available_size_.inline_size}, {percentage_resolution_size_.block_size, percentage_resolution_size_.inline_size}, - is_fixed_size_block_, is_fixed_size_inline_, + is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, is_block_direction_triggers_scrollbar_, is_inline_direction_triggers_scrollbar_, static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h index b1ac274..4ba9e69 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
@@ -27,6 +27,8 @@ NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); + NGConstraintSpaceBuilder& SetIsShrinkToFit(bool shrink_to_fit); + NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( bool is_inline_direction_triggers_scrollbar); NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( @@ -55,6 +57,7 @@ unsigned parent_writing_mode_ : 2; unsigned is_fixed_size_inline_ : 1; unsigned is_fixed_size_block_ : 1; + unsigned is_shrink_to_fit_ : 1; unsigned is_inline_direction_triggers_scrollbar_ : 1; unsigned is_block_direction_triggers_scrollbar_ : 1; unsigned fragmentation_type_ : 2;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc index 05b2737..44a104f7 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
@@ -17,21 +17,22 @@ // - positioned and/or replaced calculations // - Take scrollbars into account -bool NeedMinAndMaxContentSizes(const ComputedStyle& style) { - // TODO(layout-ng): In the future we may pass a shrink-to-fit flag through the - // constraint space; if so, this function needs to take a constraint space - // as well to take that into account. +bool NeedMinAndMaxContentSizes(const NGConstraintSpace& constraint_space, + const ComputedStyle& style) { // This check is technically too broad (fill-available does not need intrinsic // size computation) but that's a rare case and only affects performance, not // correctness. - return style.logicalWidth().isIntrinsic() || + return constraint_space.IsShrinkToFit() || + style.logicalWidth().isIntrinsic() || style.logicalMinWidth().isIntrinsic() || style.logicalMaxWidth().isIntrinsic(); } bool NeedMinAndMaxContentSizesForContentContribution( const ComputedStyle& style) { - return NeedMinAndMaxContentSizes(style) || style.logicalWidth().isAuto(); + return style.logicalWidth().isIntrinsicOrAuto() || + style.logicalMinWidth().isIntrinsic() || + style.logicalMaxWidth().isIntrinsic(); } LayoutUnit ResolveInlineLength( @@ -234,9 +235,12 @@ if (space.IsFixedSizeInline()) return space.AvailableSize().inline_size; - LayoutUnit extent = - ResolveInlineLength(space, style, min_and_max, style.logicalWidth(), - LengthResolveType::kContentSize); + Length logicalWidth = style.logicalWidth(); + if (logicalWidth.isAuto() && space.IsShrinkToFit()) + logicalWidth = Length(FitContent); + + LayoutUnit extent = ResolveInlineLength( + space, style, min_and_max, logicalWidth, LengthResolveType::kContentSize); Length max_length = style.logicalMaxWidth(); if (!max_length.isMaxSizeNone()) {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.h b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.h index 9e67b62..a53ba2e3 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.h
@@ -33,7 +33,8 @@ // pass them to ResolveInlineLength / ComputeInlineSizeForFragment. // If this function returns false, it is safe to pass an empty // MinAndMaxContentSizes struct to those functions. -CORE_EXPORT bool NeedMinAndMaxContentSizes(const ComputedStyle&); +CORE_EXPORT bool NeedMinAndMaxContentSizes(const NGConstraintSpace&, + const ComputedStyle&); // Like NeedMinAndMaxContentSizes, but for use when calling // ComputeMinAndMaxContentContribution.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc index 9714710..0df5c67d 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
@@ -362,7 +362,7 @@ style_->setBorderRightStyle(BorderStyleSolid); style_->setBorderBottomStyle(BorderStyleSolid); style_->setBorderLeftStyle(BorderStyleSolid); - style_->setWritingMode(LeftToRightWritingMode); + style_->setWritingMode(WritingMode::VerticalLr); NGBoxStrut borders = ComputeBorders(*style_); @@ -377,7 +377,7 @@ style_->setPaddingRight(Length(52, Fixed)); style_->setPaddingBottom(Length(Auto)); style_->setPaddingLeft(Length(11, Percent)); - style_->setWritingMode(RightToLeftWritingMode); + style_->setWritingMode(WritingMode::VerticalRl); NGConstraintSpace* constraintSpace(ConstructConstraintSpace(200, 300));
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_writing_mode.cc b/third_party/WebKit/Source/core/layout/ng/ng_writing_mode.cc index 9dab422..8a9fef3 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_writing_mode.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_writing_mode.cc
@@ -10,11 +10,11 @@ NGWritingMode FromPlatformWritingMode(WritingMode mode) { switch (mode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return kHorizontalTopBottom; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return kVerticalRightLeft; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return kVerticalLeftRight; default: NOTREACHED();
diff --git a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp index 2dfb59f..9267fa5 100644 --- a/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/BoxShapeTest.cpp
@@ -41,7 +41,7 @@ std::unique_ptr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin) { - return Shape::createLayoutBoxShape(bounds, TopToBottomWritingMode, + return Shape::createLayoutBoxShape(bounds, WritingMode::HorizontalTb, shapeMargin); } };
diff --git a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp index 1a4fa4a..f67685c 100644 --- a/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp
@@ -226,11 +226,11 @@ inline LayoutUnit borderBeforeInWritingMode(const LayoutBox& layoutBox, WritingMode writingMode) { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return LayoutUnit(layoutBox.borderTop()); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return LayoutUnit(layoutBox.borderLeft()); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return LayoutUnit(layoutBox.borderRight()); } @@ -242,11 +242,11 @@ const LayoutBox& layoutBox, WritingMode writingMode) { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return layoutBox.borderTop() + layoutBox.paddingTop(); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return layoutBox.borderLeft() + layoutBox.paddingLeft(); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return layoutBox.borderRight() + layoutBox.paddingRight(); }
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp index 070c725a..ee09e1a 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -856,8 +856,7 @@ other.borderRightStyle() == BorderStyleHidden))) return true; } else if (display() == EDisplay::ListItem) { - if (m_inheritedData.m_listStyleType != - other.m_inheritedData.m_listStyleType || + if (listStyleType() != other.listStyleType() || listStylePosition() != other.listStylePosition()) return true; } @@ -2170,11 +2169,11 @@ const BorderValue& ComputedStyle::borderBefore() const { switch (getWritingMode()) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return borderTop(); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return borderLeft(); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return borderRight(); } ASSERT_NOT_REACHED(); @@ -2183,11 +2182,11 @@ const BorderValue& ComputedStyle::borderAfter() const { switch (getWritingMode()) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return borderBottom(); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return borderRight(); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return borderLeft(); } ASSERT_NOT_REACHED(); @@ -2208,11 +2207,11 @@ int ComputedStyle::borderBeforeWidth() const { switch (getWritingMode()) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return borderTopWidth(); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return borderLeftWidth(); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return borderRightWidth(); } ASSERT_NOT_REACHED(); @@ -2221,11 +2220,11 @@ int ComputedStyle::borderAfterWidth() const { switch (getWritingMode()) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return borderBottomWidth(); - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return borderRightWidth(); - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return borderLeftWidth(); } ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index eb4fdde..52c3c937 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -198,8 +198,7 @@ // inherit struct InheritedData { bool operator==(const InheritedData& other) const { - return (m_listStyleType == other.m_listStyleType) && - (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && + return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && (m_cursorStyle == other.m_cursorStyle) && (m_direction == other.m_direction) && (m_rtlOrdering == other.m_rtlOrdering) && @@ -211,7 +210,6 @@ return !(*this == other); } - unsigned m_listStyleType : 7; // EListStyleType unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only // text decoration on this element. unsigned m_cursorStyle : 6; // ECursor @@ -313,14 +311,12 @@ void setBitDefaults() { ComputedStyleBase::setBitDefaults(); - m_inheritedData.m_listStyleType = - static_cast<unsigned>(initialListStyleType()); m_inheritedData.m_hasSimpleUnderline = false; m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); m_inheritedData.m_direction = static_cast<unsigned>(initialDirection()); m_inheritedData.m_rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); m_inheritedData.m_insideLink = NotInsideLink; - m_inheritedData.m_writingMode = initialWritingMode(); + m_inheritedData.m_writingMode = static_cast<unsigned>(initialWritingMode()); m_nonInheritedData.m_effectiveDisplay = m_nonInheritedData.m_originalDisplay = @@ -2060,15 +2056,6 @@ void setLineHeight(const Length& specifiedLineHeight); // List style properties. - // list-style-type - static EListStyleType initialListStyleType() { return EListStyleType::Disc; } - EListStyleType listStyleType() const { - return static_cast<EListStyleType>(m_inheritedData.m_listStyleType); - } - void setListStyleType(EListStyleType v) { - m_inheritedData.m_listStyleType = static_cast<unsigned>(v); - } - // list-style-image static StyleImage* initialListStyleImage() { return 0; } StyleImage* listStyleImage() const; @@ -2218,11 +2205,13 @@ void setLineBreak(LineBreak b) { SET_VAR(m_rareInheritedData, lineBreak, b); } // writing-mode (aka -webkit-writing-mode, -epub-writing-mode) - static WritingMode initialWritingMode() { return TopToBottomWritingMode; } + static WritingMode initialWritingMode() { return WritingMode::HorizontalTb; } WritingMode getWritingMode() const { return static_cast<WritingMode>(m_inheritedData.m_writingMode); } - void setWritingMode(WritingMode v) { m_inheritedData.m_writingMode = v; } + void setWritingMode(WritingMode v) { + m_inheritedData.m_writingMode = static_cast<unsigned>(v); + } // Text emphasis properties. static TextEmphasisFill initialTextEmphasisFill() {
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h index 65f97d9..4a36aba 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h +++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
@@ -262,65 +262,6 @@ enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; -enum class EListStyleType : unsigned { - Disc, - Circle, - Square, - DecimalListStyle, - DecimalLeadingZero, - ArabicIndic, - Bengali, - Cambodian, - Khmer, - Devanagari, - Gujarati, - Gurmukhi, - Kannada, - Lao, - Malayalam, - Mongolian, - Myanmar, - Oriya, - Persian, - Urdu, - Telugu, - Tibetan, - Thai, - LowerRoman, - UpperRoman, - LowerGreek, - LowerAlpha, - LowerLatin, - UpperAlpha, - UpperLatin, - CjkEarthlyBranch, - CjkHeavenlyStem, - EthiopicHalehame, - EthiopicHalehameAm, - EthiopicHalehameTiEr, - EthiopicHalehameTiEt, - Hangul, - HangulConsonant, - KoreanHangulFormal, - KoreanHanjaFormal, - KoreanHanjaInformal, - Hebrew, - Armenian, - LowerArmenian, - UpperArmenian, - Georgian, - CJKIdeographic, - SimpChineseFormal, - SimpChineseInformal, - TradChineseFormal, - TradChineseInformal, - Hiragana, - Katakana, - HiraganaIroha, - KatakanaIroha, - NoneListStyle -}; - enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; enum EAnimPlayState { AnimPlayStatePlaying, AnimPlayStatePaused };
diff --git a/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js b/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js index 2a2cb03..a2d99df 100644 --- a/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js +++ b/third_party/WebKit/Source/devtools/front_end/platform/DOMExtension.js
@@ -277,6 +277,12 @@ * @return {boolean} */ Node.prototype.hasSelection = function() { + // TODO(luoe): use contains(node, {includeShadow: true}) when it is fixed for shadow dom. + var contents = this.querySelectorAll('content'); + for (var content of contents) { + if (Array.prototype.some.call(content.getDistributedNodes(), node => node.hasSelection())) + return true; + } if (this.isComponentSelectionCollapsed()) return false; return this.getComponentSelection().containsNode(this, true);
diff --git a/third_party/WebKit/Source/platform/LengthBox.cpp b/third_party/WebKit/Source/platform/LengthBox.cpp index a64a689..372a6a1c 100644 --- a/third_party/WebKit/Source/platform/LengthBox.cpp +++ b/third_party/WebKit/Source/platform/LengthBox.cpp
@@ -42,11 +42,11 @@ const Length& LengthBox::before(WritingMode writingMode) const { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return m_top; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return m_left; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return m_right; } ASSERT_NOT_REACHED(); @@ -55,11 +55,11 @@ const Length& LengthBox::after(WritingMode writingMode) const { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return m_bottom; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return m_right; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return m_left; } ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp index be433103..ac2802d1 100644 --- a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp +++ b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp
@@ -68,11 +68,11 @@ LayoutUnit LayoutRectOutsets::before(WritingMode writingMode) const { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return m_top; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return m_left; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return m_right; } ASSERT_NOT_REACHED(); @@ -81,11 +81,11 @@ LayoutUnit LayoutRectOutsets::after(WritingMode writingMode) const { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: return m_bottom; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: return m_right; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: return m_left; } ASSERT_NOT_REACHED(); @@ -116,13 +116,13 @@ void LayoutRectOutsets::setBefore(WritingMode writingMode, LayoutUnit value) { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: m_top = value; break; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: m_left = value; break; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: m_right = value; break; default: @@ -133,13 +133,13 @@ void LayoutRectOutsets::setAfter(WritingMode writingMode, LayoutUnit value) { switch (writingMode) { - case TopToBottomWritingMode: + case WritingMode::HorizontalTb: m_bottom = value; break; - case LeftToRightWritingMode: + case WritingMode::VerticalLr: m_right = value; break; - case RightToLeftWritingMode: + case WritingMode::VerticalRl: m_left = value; break; default:
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp index 32194ce9..55676bb8 100644 --- a/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp +++ b/third_party/WebKit/Source/platform/geometry/LayoutRectOutsetsTest.cpp
@@ -12,25 +12,25 @@ TEST(LayoutRectOutsetsTest, LogicalOutsets_Horizontal) { LayoutRectOutsets outsets(1, 2, 3, 4); EXPECT_EQ(LayoutRectOutsets(1, 2, 3, 4), - outsets.logicalOutsets(TopToBottomWritingMode)); + outsets.logicalOutsets(WritingMode::HorizontalTb)); } TEST(LayoutRectOutsetsTest, LogicalOutsets_Vertical) { LayoutRectOutsets outsets(1, 2, 3, 4); EXPECT_EQ(LayoutRectOutsets(4, 3, 2, 1), - outsets.logicalOutsets(LeftToRightWritingMode)); + outsets.logicalOutsets(WritingMode::VerticalLr)); EXPECT_EQ(LayoutRectOutsets(4, 3, 2, 1), - outsets.logicalOutsets(RightToLeftWritingMode)); + outsets.logicalOutsets(WritingMode::VerticalRl)); } TEST(LayoutRectOutsetsTest, LogicalOutsetsWithFlippedLines) { LayoutRectOutsets outsets(1, 2, 3, 4); EXPECT_EQ(LayoutRectOutsets(1, 2, 3, 4), - outsets.logicalOutsetsWithFlippedLines(TopToBottomWritingMode)); + outsets.logicalOutsetsWithFlippedLines(WritingMode::HorizontalTb)); EXPECT_EQ(LayoutRectOutsets(2, 3, 4, 1), - outsets.logicalOutsetsWithFlippedLines(LeftToRightWritingMode)); + outsets.logicalOutsetsWithFlippedLines(WritingMode::VerticalLr)); EXPECT_EQ(LayoutRectOutsets(4, 3, 2, 1), - outsets.logicalOutsetsWithFlippedLines(RightToLeftWritingMode)); + outsets.logicalOutsetsWithFlippedLines(WritingMode::VerticalRl)); } } // namespace
diff --git a/third_party/WebKit/Source/platform/text/WritingMode.h b/third_party/WebKit/Source/platform/text/WritingMode.h index e59527d5..b18c4602 100644 --- a/third_party/WebKit/Source/platform/text/WritingMode.h +++ b/third_party/WebKit/Source/platform/text/WritingMode.h
@@ -33,26 +33,26 @@ namespace blink { -enum WritingMode { - TopToBottomWritingMode, - RightToLeftWritingMode, - LeftToRightWritingMode -}; +// These values are named to match the CSS keywords they correspond to: namely +// horizontal-tb, vertical-rl and vertical-lr. +// Since these names aren't very self-explanatory, where possible use the +// inline utility functions below. +enum class WritingMode : unsigned { HorizontalTb, VerticalRl, VerticalLr }; // Lines have horizontal orientation; modes horizontal-tb. inline bool isHorizontalWritingMode(WritingMode writingMode) { - return writingMode == TopToBottomWritingMode; + return writingMode == WritingMode::HorizontalTb; } // Bottom of the line occurs earlier in the block; modes vertical-lr. inline bool isFlippedLinesWritingMode(WritingMode writingMode) { - return writingMode == LeftToRightWritingMode; + return writingMode == WritingMode::VerticalLr; } // Block progression increases in the opposite direction to normal; modes // vertical-rl. inline bool isFlippedBlocksWritingMode(WritingMode writingMode) { - return writingMode == RightToLeftWritingMode; + return writingMode == WritingMode::VerticalRl; } } // namespace blink
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 63c46a9..817f4bc 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -1990,6 +1990,16 @@ </summary> </histogram> +<histogram name="Ash.Wallpaper.Apps" enum="WallpaperApps"> + <owner>xdai@chromium.org</owner> + <summary> + The Wallpaper App that the user is using right now on Chrome OS. It's the + app that is used when the user right clicks on desktop and selects "Set + wallpaper" or when the user selects "Set wallpaper" from + chrome://settings page. This is recorded at user login. + </summary> +</histogram> + <histogram name="Ash.Wallpaper.CustomLayout" enum="WallpaperLayout"> <owner>xdai@chromium.org</owner> <summary> @@ -106808,6 +106818,11 @@ <int value="11" label="Require phone number"/> </enum> +<enum name="WallpaperApps" type="int"> + <int value="0" label="Chrome OS Wallpaper Picker App"/> + <int value="1" label="Android Wallpapers App"/> +</enum> + <enum name="WallpaperLayout" type="int"> <int value="0" label="Center"/> <int value="1" label="Center Cropped"/>
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn index 2e0936ae..0c762ff 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn
@@ -664,6 +664,8 @@ "animation/test/test_ink_drop_ripple_observer.h", "controls/textfield/textfield_test_api.cc", "controls/textfield/textfield_test_api.h", + "corewm/test/tooltip_aura_test_api.cc", + "corewm/test/tooltip_aura_test_api.h", "test/capture_tracking_view.cc", "test/capture_tracking_view.h", "test/combobox_test_api.cc",
diff --git a/ui/views/corewm/test/tooltip_aura_test_api.cc b/ui/views/corewm/test/tooltip_aura_test_api.cc new file mode 100644 index 0000000..385fcc4 --- /dev/null +++ b/ui/views/corewm/test/tooltip_aura_test_api.cc
@@ -0,0 +1,20 @@ +// 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 "ui/views/corewm/test/tooltip_aura_test_api.h" + +#include "ui/gfx/render_text.h" +#include "ui/views/corewm/tooltip_aura.h" + +namespace views { +namespace corewm { +namespace test { + +gfx::RenderText* TooltipAuraTestApi::GetRenderText() { + return tooltip_aura_->GetRenderTextForTest(); +} + +} // namespace test +} // namespace corewm +} // namespace views
diff --git a/ui/views/corewm/test/tooltip_aura_test_api.h b/ui/views/corewm/test/tooltip_aura_test_api.h new file mode 100644 index 0000000..15db1e8 --- /dev/null +++ b/ui/views/corewm/test/tooltip_aura_test_api.h
@@ -0,0 +1,39 @@ +// 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 UI_VIEWS_COREWM_TEST_TOOLTIP_AURA_TEST_API_H_ +#define UI_VIEWS_COREWM_TEST_TOOLTIP_AURA_TEST_API_H_ + +#include <stddef.h> + +#include "base/macros.h" + +namespace gfx { +class RenderText; +} + +namespace views { +namespace corewm { +class TooltipAura; + +namespace test { + +class TooltipAuraTestApi { + public: + explicit TooltipAuraTestApi(TooltipAura* tooltip_aura) + : tooltip_aura_(tooltip_aura) {} + + gfx::RenderText* GetRenderText(); + + private: + TooltipAura* tooltip_aura_; + + DISALLOW_COPY_AND_ASSIGN(TooltipAuraTestApi); +}; + +} // namespace test +} // namespace corewm +} // namespace views + +#endif // UI_VIEWS_COREWM_TEST_TOOLTIP_AURA_TEST_API_H_
diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc index 256a4fb..4cce40b 100644 --- a/ui/views/corewm/tooltip_aura.cc +++ b/ui/views/corewm/tooltip_aura.cc
@@ -141,11 +141,11 @@ ResetDisplayRect(); } + gfx::RenderText* render_text_for_test() { return render_text_.get(); } + private: void ResetDisplayRect() { - gfx::Insets insets = border()->GetInsets(); - int max_text_width = max_width_ - insets.width(); - render_text_->SetDisplayRect(gfx::Rect(0, 0, max_text_width, 100000)); + render_text_->SetDisplayRect(gfx::Rect(0, 0, max_width_, 100000)); } std::unique_ptr<gfx::RenderText> render_text_; @@ -164,6 +164,10 @@ DestroyWidget(); } +gfx::RenderText* TooltipAura::GetRenderTextForTest() { + return tooltip_view_->render_text_for_test(); +} + void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos, const gfx::Size& tooltip_size) { gfx::Rect tooltip_rect(mouse_pos, tooltip_size);
diff --git a/ui/views/corewm/tooltip_aura.h b/ui/views/corewm/tooltip_aura.h index 84f8f672..4540c36 100644 --- a/ui/views/corewm/tooltip_aura.h +++ b/ui/views/corewm/tooltip_aura.h
@@ -12,6 +12,7 @@ #include "ui/views/widget/widget_observer.h" namespace gfx { +class RenderText; class Size; } // namespace gfx @@ -20,6 +21,9 @@ class Widget; namespace corewm { +namespace test { +class TooltipAuraTestApi; +} // Implementation of Tooltip that shows the tooltip using a Widget and Label. class VIEWS_EXPORT TooltipAura : public Tooltip, public WidgetObserver { @@ -30,6 +34,9 @@ private: class TooltipView; + friend class test::TooltipAuraTestApi; + gfx::RenderText* GetRenderTextForTest(); + // Adjusts the bounds given by the arguments to fit inside the desktop // and applies the adjusted bounds to the label_. void SetTooltipBounds(const gfx::Point& mouse_pos,
diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc index 54aa14f8..f41136c5 100644 --- a/ui/views/corewm/tooltip_controller_unittest.cc +++ b/ui/views/corewm/tooltip_controller_unittest.cc
@@ -19,7 +19,9 @@ #include "ui/events/test/event_generator.h" #include "ui/gfx/font.h" #include "ui/gfx/geometry/point.h" +#include "ui/gfx/render_text.h" #include "ui/gfx/text_elider.h" +#include "ui/views/corewm/test/tooltip_aura_test_api.h" #include "ui/views/corewm/tooltip_aura.h" #include "ui/views/corewm/tooltip_controller_test_helper.h" #include "ui/views/test/desktop_test_views_delegate.h" @@ -93,9 +95,9 @@ new wm::DefaultActivationClient(root_window); #if defined(OS_CHROMEOS) - controller_.reset( - new TooltipController(std::unique_ptr<views::corewm::Tooltip>( - new views::corewm::TooltipAura))); + tooltip_aura_ = new views::corewm::TooltipAura(); + controller_.reset(new TooltipController( + std::unique_ptr<views::corewm::Tooltip>(tooltip_aura_))); root_window->AddPreTargetHandler(controller_.get()); SetTooltipClient(root_window, controller_.get()); #endif @@ -161,6 +163,11 @@ std::unique_ptr<TooltipControllerTestHelper> helper_; std::unique_ptr<ui::test::EventGenerator> generator_; + protected: +#if defined(OS_CHROMEOS) + TooltipAura* tooltip_aura_; // not owned. +#endif + private: std::unique_ptr<TooltipController> controller_; @@ -201,6 +208,33 @@ EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); } +#if defined(OS_CHROMEOS) +// crbug.com/664370. +TEST_F(TooltipControllerTest, MaxWidth) { + // TODO: these tests use GetContext(). That should go away for aura-mus + // client. http://crbug.com/663781. + if (IsAuraMusClient() || IsMus()) + return; + + base::string16 text = base::ASCIIToUTF16( + "Really really realy long long long long long tooltips that exceeds max " + "width"); + view_->set_tooltip_text(text); + gfx::Point center = GetWindow()->bounds().CenterPoint(); + generator_->MoveMouseTo(center); + + // Fire tooltip timer so tooltip becomes visible. + helper_->FireTooltipTimer(); + + EXPECT_TRUE(helper_->IsTooltipVisible()); + gfx::RenderText* render_text = + test::TooltipAuraTestApi(tooltip_aura_).GetRenderText(); + + int max = helper_->controller()->GetMaxWidth(center); + EXPECT_EQ(max, render_text->display_rect().width()); +} +#endif + TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { // TODO: these tests use GetContext(). That should go away for aura-mus // client. http://crbug.com/663781.
diff --git a/ui/webui/resources/.clang-format b/ui/webui/resources/.clang-format new file mode 100644 index 0000000..d27bf2e --- /dev/null +++ b/ui/webui/resources/.clang-format
@@ -0,0 +1,5 @@ +BasedOnStyle: Chromium + +# Renaming quotes in <include> and <if> break things. +# For normal JS code, please prefer ' to ". +JavaScriptQuotes: Leave
diff --git a/ui/webui/resources/PRESUBMIT.py b/ui/webui/resources/PRESUBMIT.py index 2f40f71..2ea4cee 100644 --- a/ui/webui/resources/PRESUBMIT.py +++ b/ui/webui/resources/PRESUBMIT.py
@@ -30,11 +30,11 @@ def CheckChangeOnUpload(input_api, output_api): - return _CheckForTranslations(input_api, output_api) + return _CommonChecks(input_api, output_api) def CheckChangeOnCommit(input_api, output_api): - return _CheckForTranslations(input_api, output_api) + return _CommonChecks(input_api, output_api) def _CheckForTranslations(input_api, output_api): @@ -70,3 +70,10 @@ Don't embed translations directly in shared UI code. Instead, inject your translation from the place using the shared code. For an example: see <cr-dialog>#closeText (http://bit.ly/2eLEsqh).""")] + + +def _CommonChecks(input_api, output_api): + results = [] + results += _CheckForTranslations(input_api, output_api) + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) + return results
diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js index 51c87e5..7b912fa 100644 --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
@@ -41,9 +41,7 @@ }, /** override */ - detached: function() { - this.removeResizeListener_(); - }, + detached: function() { this.removeResizeListener_(); }, /** @private */ removeResizeListener_: function() { @@ -75,7 +73,7 @@ if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return; - var nextOption = this.getNextOption_(e.key == 'ArrowDown' ? 1 : - 1); + var nextOption = this.getNextOption_(e.key == 'ArrowDown' ? 1 : -1); if (nextOption) nextOption.focus(); @@ -95,8 +93,8 @@ var counter = 0; var nextOption = null; var numOptions = this.options_.length; - var focusedIndex = Array.prototype.indexOf.call( - this.options_, this.root.activeElement); + var focusedIndex = + Array.prototype.indexOf.call(this.options_, this.root.activeElement); do { focusedIndex = (numOptions + focusedIndex + step) % numOptions; @@ -144,10 +142,9 @@ // Attempt to show the menu starting from the top of the rectangle and // extending downwards. If that does not fit within the window, fallback to // starting from the bottom and extending upwards. - var top = rect.top + this.offsetHeight <= window.innerHeight ? - rect.top : - rect.bottom - this.offsetHeight - Math.max( - rect.bottom - window.innerHeight, 0); + var top = rect.top + this.offsetHeight <= window.innerHeight ? rect.top : + rect.bottom - + this.offsetHeight - Math.max(rect.bottom - window.innerHeight, 0); this.style.top = top + 'px'; },
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js index d15ed9b..0114ebd 100644 --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -55,7 +55,5 @@ }, /** @return {!PaperIconButtonElement} */ - getCloseButton: function() { - return this.$.close; - }, + getCloseButton: function() { return this.$.close; }, });
diff --git a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js index b92d11c..1a4d7b7 100644 --- a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js +++ b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js
@@ -19,20 +19,12 @@ * If true, the button is in the expanded state and will show the * 'expand-less' icon. If false, the button shows the 'expand-more' icon. */ - expanded: { - type: Boolean, - value: false, - notify: true - }, + expanded: {type: Boolean, value: false, notify: true}, /** * If true, the button will be disabled and greyed out. */ - disabled: { - type: Boolean, - value: false, - reflectToAttribute: true - }, + disabled: {type: Boolean, value: false, reflectToAttribute: true}, /** A11y text descriptor for this control. */ alt: String, @@ -46,7 +38,5 @@ * @param {Event} event * @private */ - stopTap_: function(event) { - event.stopPropagation(); - }, + stopTap_: function(event) { event.stopPropagation(); }, });
diff --git a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js index 627505a4..47ed5bed 100644 --- a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js +++ b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
@@ -18,9 +18,7 @@ is: 'cr-lazy-render', extends: 'template', - behaviors: [ - Polymer.Templatizer - ], + behaviors: [Polymer.Templatizer], /** @private {TemplatizerNode} */ child_: null, @@ -39,9 +37,7 @@ * @return {?Element} The element contained in the template, if it has * already been stamped. */ - getIfExists: function() { - return this.child_; - }, + getIfExists: function() { return this.child_; }, /** @private */ render_: function() {
diff --git a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js index 9f6f9da4..df8421e 100644 --- a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js +++ b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js
@@ -18,19 +18,13 @@ * The list of profile avatar URLs and labels. * @type {!Array<!AvatarIcon>} */ - avatars: { - type: Array, - value: function() { return []; } - }, + avatars: {type: Array, value: function() { return []; }}, /** * The currently selected profile avatar URL. May be a data URI. * @type {string} */ - selectedAvatarUrl: { - type: String, - notify: true - }, + selectedAvatarUrl: {type: String, notify: true}, ignoreModifiedKeyEvents: { type: Boolean, @@ -43,7 +37,5 @@ * @return {string} A CSS imageset for multiple scale factors. * @private */ - getIconImageset_: function(iconUrl) { - return cr.icon.getImage(iconUrl); - }, + getIconImageset_: function(iconUrl) { return cr.icon.getImage(iconUrl); }, });
diff --git a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js index 6278d6d1..d0f4b02 100644 --- a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js +++ b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
@@ -38,10 +38,7 @@ var CrScrollableBehavior = { properties: { /** @private {number|null} */ - intervalId_: { - type: Number, - value: null - } + intervalId_: {type: Number, value: null} }, ready: function() {
diff --git a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js index 68c15d4..8729c86 100644 --- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js +++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
@@ -36,9 +36,7 @@ /** * @return {string} The value of the search field. */ - getValue: function() { - return this.getSearchInput().value; - }, + getValue: function() { return this.getSearchInput().value; }, /** * Sets the value of the search field.
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js index 4b607fe..10986a9 100644 --- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
@@ -27,10 +27,7 @@ spinnerActive: Boolean, // Controls whether the menu button is shown at the start of the menu. - showMenu: { - type: Boolean, - value: false - }, + showMenu: {type: Boolean, value: false}, // Whether to show menu promo tooltip. showMenuPromo: { @@ -41,10 +38,7 @@ closeMenuPromo: String, /** @private */ - narrow_: { - type: Boolean, - reflectToAttribute: true - }, + narrow_: {type: Boolean, reflectToAttribute: true}, /** @private */ showingSearch_: { @@ -58,30 +52,25 @@ ], /** @return {!CrToolbarSearchFieldElement} */ - getSearchField: function() { - return this.$.search; - }, + getSearchField: function() { return this.$.search; }, /** @private */ - onClosePromoTap_: function() { - this.fire('cr-toolbar-menu-promo-close'); - }, + onClosePromoTap_: function() { this.fire('cr-toolbar-menu-promo-close'); }, /** @private */ - onMenuTap_: function() { - this.fire('cr-toolbar-menu-tap'); - }, + onMenuTap_: function() { this.fire('cr-toolbar-menu-tap'); }, /** @private */ possiblyShowMenuPromo_: function() { Polymer.RenderStatus.afterNextRender(this, function() { if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { - this.$$('#menuPromo').animate({ - opacity: [0, .9], - }, /** @type {!KeyframeEffectOptions} */({ - duration: 500, - fill: 'forwards' - })); + this.$$('#menuPromo') + .animate( + { + opacity: [0, .9], + }, + /** @type {!KeyframeEffectOptions} */ ( + {duration: 500, fill: 'forwards'})); this.fire('cr-toolbar-menu-promo-shown'); } }.bind(this));
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js index 19318681..916d7d5 100644 --- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
@@ -29,16 +29,10 @@ // When true, show a loading spinner to indicate that the backend is // processing the search. Will only show if the search field is open. - spinnerActive: { - type: Boolean, - reflectToAttribute: true - }, + spinnerActive: {type: Boolean, reflectToAttribute: true}, /** @private */ - hasSearchText_: { - type: Boolean, - reflectToAttribute: true - }, + hasSearchText_: {type: Boolean, reflectToAttribute: true}, /** @private */ isSpinnerShown_: { @@ -47,10 +41,7 @@ }, /** @private */ - searchFocused_: { - type: Boolean, - value: false - }, + searchFocused_: {type: Boolean, value: false}, }, listeners: { @@ -59,9 +50,7 @@ }, /** @return {!HTMLInputElement} */ - getSearchInput: function() { - return this.$.searchInput; - }, + getSearchInput: function() { return this.$.searchInput; }, /** * Sets the value of the search field. Overridden from CrSearchFieldBehavior. @@ -75,9 +64,7 @@ }, /** @return {boolean} */ - isSearchFocused: function() { - return this.searchFocused_; - }, + isSearchFocused: function() { return this.searchFocused_; }, showAndFocus: function() { this.showingSearch = true; @@ -85,18 +72,14 @@ }, /** @private */ - focus_: function() { - this.getSearchInput().focus(); - }, + focus_: function() { this.getSearchInput().focus(); }, /** * @param {boolean} narrow * @return {number} * @private */ - computeIconTabIndex_: function(narrow) { - return narrow ? 0 : -1; - }, + computeIconTabIndex_: function(narrow) { return narrow ? 0 : -1; }, /** * @return {boolean} @@ -107,9 +90,7 @@ }, /** @private */ - onInputFocus_: function() { - this.searchFocused_ = true; - }, + onInputFocus_: function() { this.searchFocused_ = true; }, /** @private */ onInputBlur_: function() {
diff --git a/ui/webui/resources/cr_elements/network/cr_network_icon.js b/ui/webui/resources/cr_elements/network/cr_network_icon.js index b666290..4bccaf7 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_icon.js +++ b/ui/webui/resources/cr_elements/network/cr_network_icon.js
@@ -17,281 +17,282 @@ var NetworkIconParamType; (function() { -/** @const {string} */ var RESOURCE_IMAGE_BASE = - 'chrome://resources/cr_elements/network/'; + /** @const {string} */ var RESOURCE_IMAGE_BASE = + 'chrome://resources/cr_elements/network/'; -/** @const {string} */ var RESOURCE_IMAGE_EXT = '.png'; + /** @const {string} */ var RESOURCE_IMAGE_EXT = '.png'; -/** + /** * Gets the icon type from the network type. This allows multiple types * (i.e. Cellular, WiMAX) to map to the same icon type (i.e. mobile). * @param {chrome.networkingPrivate.NetworkType} networkType * @return {string} The icon type: ethernet, wifi, mobile, or vpn. */ -function getIconTypeFromNetworkType(networkType) { - if (!networkType || networkType == CrOnc.Type.ETHERNET) + function getIconTypeFromNetworkType(networkType) { + if (!networkType || networkType == CrOnc.Type.ETHERNET) + return 'ethernet'; + else if (networkType == CrOnc.Type.WI_FI) + return 'wifi'; + else if (networkType == CrOnc.Type.CELLULAR) + return 'mobile'; + else if (networkType == CrOnc.Type.WI_MAX) + return 'mobile'; + else if (networkType == CrOnc.Type.VPN) + return 'vpn'; + + console.error('Unrecognized network type for icon: ' + networkType); return 'ethernet'; - else if (networkType == CrOnc.Type.WI_FI) - return 'wifi'; - else if (networkType == CrOnc.Type.CELLULAR) - return 'mobile'; - else if (networkType == CrOnc.Type.WI_MAX) - return 'mobile'; - else if (networkType == CrOnc.Type.VPN) - return 'vpn'; + } - console.error('Unrecognized network type for icon: ' + networkType); - return 'ethernet'; -} + /** + * Polymer class definition for 'cr-network-icon'. + */ + Polymer({ + is: 'cr-network-icon', -/** - * Polymer class definition for 'cr-network-icon'. - */ -Polymer({ - is: 'cr-network-icon', + properties: { + /** + * If set, the ONC properties will be used to display the icon. This may + * either be the complete set of NetworkProperties or the subset of + * NetworkStateProperties. + * @type + * {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined} + */ + networkState: { + type: Object, + observer: 'networkStateChanged_', + }, - properties: { - /** - * If set, the ONC properties will be used to display the icon. This may - * either be the complete set of NetworkProperties or the subset of - * NetworkStateProperties. - * @type {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined} - */ - networkState: { - type: Object, - observer: 'networkStateChanged_', + /** + * If set, the ONC network type will be used to display the icon. + * @type {?chrome.networkingPrivate.NetworkType} + */ + networkType: { + type: String, + value: null, + observer: 'networkTypeChanged_', + }, + + /** + * If true, the icon is part of a list of networks and may be displayed + * differently, e.g. the disconnected image will never be shown for + * list items. + */ + isListItem: { + type: Boolean, + value: false, + observer: 'isListItemChanged_', + }, + + /** The icon type to use for the base image of the icon. */ + iconType_: { + type: String, + value: 'ethernet', + }, + + /** Set to true to show a badge for roaming networks. */ + roaming_: { + type: Boolean, + value: false, + }, + + /** Set to true to show a badge for secure networks. */ + secure_: { + type: Boolean, + value: false, + }, + + /** Set to the name of a technology to show show a badge. */ + technology_: { + type: String, + value: '', + }, }, /** - * If set, the ONC network type will be used to display the icon. - * @type {?chrome.networkingPrivate.NetworkType} + * Polymer networkState changed method. Updates the icon based on the + * network state. + * @private */ - networkType: { - type: String, - value: null, - observer: 'networkTypeChanged_', + networkStateChanged_: function() { + if (!this.networkState) + return; + + this.networkType = null; + this.iconType_ = getIconTypeFromNetworkType(this.networkState.Type); + var strength = CrOnc.getSignalStrength(this.networkState); + var params = /** @type {NetworkIconParamType} */ { + showBadges: true, + showDisconnected: !this.isListItem, + strength: strength + }; + this.setIcon_(params); }, /** - * If true, the icon is part of a list of networks and may be displayed - * differently, e.g. the disconnected image will never be shown for - * list items. + * Polymer networkType changed method. Updates the icon based on the type + * of network, showing a disconnected icon where appropriate and no badges. + * @private */ - isListItem: { - type: Boolean, - value: false, - observer: 'isListItemChanged_', + networkTypeChanged_: function() { + if (!this.networkType) + return; + + this.networkState = undefined; + this.iconType_ = getIconTypeFromNetworkType(this.networkType); + var params = /** @type {NetworkIconParamType} */ { + showBadges: false, + showDisconnected: true, + strength: 0, + }; + this.setIcon_(params); }, - /** The icon type to use for the base image of the icon. */ - iconType_: { - type: String, - value: 'ethernet', + /** + * Polymer isListItem changed method. + * @private + */ + isListItemChanged_: function() { + if (this.networkState) + this.networkStateChanged_(); + else if (this.networkType) + this.networkTypeChanged_(); }, - /** Set to true to show a badge for roaming networks. */ - roaming_: { - type: Boolean, - value: false, - }, - - /** Set to true to show a badge for secure networks. */ - secure_: { - type: Boolean, - value: false, - }, - - /** Set to the name of a technology to show show a badge. */ - technology_: { - type: String, - value: '', - }, - }, - - /** - * Polymer networkState changed method. Updates the icon based on the - * network state. - * @private - */ - networkStateChanged_: function() { - if (!this.networkState) - return; - - this.networkType = null; - this.iconType_ = getIconTypeFromNetworkType(this.networkState.Type); - var strength = CrOnc.getSignalStrength(this.networkState); - var params = /** @type {NetworkIconParamType} */ { - showBadges: true, - showDisconnected: !this.isListItem, - strength: strength - }; - this.setIcon_(params); - }, - - /** - * Polymer networkType changed method. Updates the icon based on the type - * of network, showing a disconnected icon where appropriate and no badges. - * @private - */ - networkTypeChanged_: function() { - if (!this.networkType) - return; - - this.networkState = undefined; - this.iconType_ = getIconTypeFromNetworkType(this.networkType); - var params = /** @type {NetworkIconParamType} */ { - showBadges: false, - showDisconnected: true, - strength: 0, - }; - this.setIcon_(params); - }, - - /** - * Polymer isListItem changed method. - * @private - */ - isListItemChanged_: function() { - if (this.networkState) - this.networkStateChanged_(); - else if (this.networkType) - this.networkTypeChanged_(); - }, - - /** + /** * Returns the url for an image based on identifier |id|. * @param {string} id The identifier describing the image. * @return {string} The url to use for the image 'src' property. * @private */ - toImageSrc_: function(id) { - return id ? RESOURCE_IMAGE_BASE + id + RESOURCE_IMAGE_EXT : ''; - }, + toImageSrc_: function(id) { + return id ? RESOURCE_IMAGE_BASE + id + RESOURCE_IMAGE_EXT : ''; + }, - /** + /** * Returns the url for a badge image based on identifier |id|. * @param {string} id The identifier describing the badge. * @return {string} The url to use for the badge image 'src' property. * @private */ - toBadgeImageSrc_: function(id) { - return id ? this.toImageSrc_('badge_' + id) : ''; - }, + toBadgeImageSrc_: function(id) { + return id ? this.toImageSrc_('badge_' + id) : ''; + }, - /** - * Sets the icon and badge based on the current state and |strength|. - * @param {!NetworkIconParamType} params Set of params describing the icon. - * @private - */ - setIcon_: function(params) { - var icon = this.$.icon; + /** + * Sets the icon and badge based on the current state and |strength|. + * @param {!NetworkIconParamType} params Set of params describing the icon. + * @private + */ + setIcon_: function(params) { + var icon = this.$.icon; - var multiLevel = (this.iconType_ == 'wifi' || this.iconType_ == 'mobile'); + var multiLevel = (this.iconType_ == 'wifi' || this.iconType_ == 'mobile'); - if (this.networkState && multiLevel) { - this.setMultiLevelIcon_(params); - } else { - icon.classList.toggle('multi-level', multiLevel); - icon.classList.toggle('level0', multiLevel); - icon.classList.toggle('level1', false); - icon.classList.toggle('level2', false); - icon.classList.toggle('level3', false); - icon.classList.toggle('level4', false); - } - - this.setIconBadges_(params); - }, - - /** - * Toggles icon classes based on strength and connecting properties. - * |this.networkState| is expected to be specified. - * @param {!NetworkIconParamType} params Set of params describing the icon. - * @private - */ - setMultiLevelIcon_: function(params) { - // Set the strength or connecting properties. - var networkState = this.networkState; - - var connectionState = networkState.ConnectionState; - var connecting = false; - var strength = -1; - if (connectionState == CrOnc.ConnectionState.CONNECTING) { - strength = 0; - connecting = true; - } else if ( - connectionState == CrOnc.ConnectionState.CONNECTED || - !params.showDisconnected) { - strength = params.strength || 0; - } - - var icon = this.$.icon; - icon.classList.toggle('multi-level', true); - icon.classList.toggle('connecting', connecting); - icon.classList.toggle('level0', strength < 0); - icon.classList.toggle('level1', strength >= 0 && strength <= 25); - icon.classList.toggle('level2', strength > 25 && strength <= 50); - icon.classList.toggle('level3', strength > 50 && strength <= 75); - icon.classList.toggle('level4', strength > 75); - }, - - /** - * Sets the icon badge visibility properties: roaming, secure, technology. - * @param {!NetworkIconParamType} params Set of params describing the icon. - * @private - */ - setIconBadges_: function(params) { - var networkState = this.networkState; - - var type = (params.showBadges && networkState) ? networkState.Type : ''; - if (type == CrOnc.Type.WI_FI) { - this.roaming_ = false; - var security = networkState.WiFi ? networkState.WiFi.Security : ''; - this.secure_ = !!security && security != 'None'; - this.technology_ = ''; - } else if (type == CrOnc.Type.WI_MAX) { - this.roaming_ = false; - this.secure_ = false; - this.technology_ = '4g'; - } else if (type == CrOnc.Type.CELLULAR && networkState.Cellular) { - this.roaming_ = - networkState.Cellular.RoamingState == CrOnc.RoamingState.ROAMING; - this.secure_ = false; - var oncTechnology = networkState.Cellular.NetworkTechnology; - switch (oncTechnology) { - case CrOnc.NetworkTechnology.CDMA1XRTT: - this.technology_ = '1x'; - break; - case CrOnc.NetworkTechnology.EDGE: - this.technology_ = 'edge'; - break; - case CrOnc.NetworkTechnology.EVDO: - this.technology_ = 'evdo'; - break; - case CrOnc.NetworkTechnology.GPRS: - case CrOnc.NetworkTechnology.GSM: - this.technology_ = 'gsm'; - break; - case CrOnc.NetworkTechnology.HSPA: - this.technology_ = 'hspa'; - break; - case CrOnc.NetworkTechnology.HSPA_PLUS: - this.technology_ = 'hspa_plus'; - break; - case CrOnc.NetworkTechnology.LTE: - this.technology_ = 'lte'; - break; - case CrOnc.NetworkTechnology.LTE_ADVANCED: - this.technology_ = 'lte_advanced'; - break; - case CrOnc.NetworkTechnology.UMTS: - this.technology_ = '3g'; - break; + if (this.networkState && multiLevel) { + this.setMultiLevelIcon_(params); + } else { + icon.classList.toggle('multi-level', multiLevel); + icon.classList.toggle('level0', multiLevel); + icon.classList.toggle('level1', false); + icon.classList.toggle('level2', false); + icon.classList.toggle('level3', false); + icon.classList.toggle('level4', false); } - } else { - this.roaming_ = false; - this.secure_ = false; - this.technology_ = ''; - } - }, -}); + + this.setIconBadges_(params); + }, + + /** + * Toggles icon classes based on strength and connecting properties. + * |this.networkState| is expected to be specified. + * @param {!NetworkIconParamType} params Set of params describing the icon. + * @private + */ + setMultiLevelIcon_: function(params) { + // Set the strength or connecting properties. + var networkState = this.networkState; + + var connectionState = networkState.ConnectionState; + var connecting = false; + var strength = -1; + if (connectionState == CrOnc.ConnectionState.CONNECTING) { + strength = 0; + connecting = true; + } else if ( + connectionState == CrOnc.ConnectionState.CONNECTED || + !params.showDisconnected) { + strength = params.strength || 0; + } + + var icon = this.$.icon; + icon.classList.toggle('multi-level', true); + icon.classList.toggle('connecting', connecting); + icon.classList.toggle('level0', strength < 0); + icon.classList.toggle('level1', strength >= 0 && strength <= 25); + icon.classList.toggle('level2', strength > 25 && strength <= 50); + icon.classList.toggle('level3', strength > 50 && strength <= 75); + icon.classList.toggle('level4', strength > 75); + }, + + /** + * Sets the icon badge visibility properties: roaming, secure, technology. + * @param {!NetworkIconParamType} params Set of params describing the icon. + * @private + */ + setIconBadges_: function(params) { + var networkState = this.networkState; + + var type = (params.showBadges && networkState) ? networkState.Type : ''; + if (type == CrOnc.Type.WI_FI) { + this.roaming_ = false; + var security = networkState.WiFi ? networkState.WiFi.Security : ''; + this.secure_ = !!security && security != 'None'; + this.technology_ = ''; + } else if (type == CrOnc.Type.WI_MAX) { + this.roaming_ = false; + this.secure_ = false; + this.technology_ = '4g'; + } else if (type == CrOnc.Type.CELLULAR && networkState.Cellular) { + this.roaming_ = + networkState.Cellular.RoamingState == CrOnc.RoamingState.ROAMING; + this.secure_ = false; + var oncTechnology = networkState.Cellular.NetworkTechnology; + switch (oncTechnology) { + case CrOnc.NetworkTechnology.CDMA1XRTT: + this.technology_ = '1x'; + break; + case CrOnc.NetworkTechnology.EDGE: + this.technology_ = 'edge'; + break; + case CrOnc.NetworkTechnology.EVDO: + this.technology_ = 'evdo'; + break; + case CrOnc.NetworkTechnology.GPRS: + case CrOnc.NetworkTechnology.GSM: + this.technology_ = 'gsm'; + break; + case CrOnc.NetworkTechnology.HSPA: + this.technology_ = 'hspa'; + break; + case CrOnc.NetworkTechnology.HSPA_PLUS: + this.technology_ = 'hspa_plus'; + break; + case CrOnc.NetworkTechnology.LTE: + this.technology_ = 'lte'; + break; + case CrOnc.NetworkTechnology.LTE_ADVANCED: + this.technology_ = 'lte_advanced'; + break; + case CrOnc.NetworkTechnology.UMTS: + this.technology_ = '3g'; + break; + } + } else { + this.roaming_ = false; + this.secure_ = false; + this.technology_ = ''; + } + }, + }); })();
diff --git a/ui/webui/resources/cr_elements/network/cr_network_list.js b/ui/webui/resources/cr_elements/network/cr_network_list.js index e1ded9a..595ea7b 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_list.js +++ b/ui/webui/resources/cr_elements/network/cr_network_list.js
@@ -26,23 +26,13 @@ * The list of network state properties for the items to display. * @type {!Array<!CrOnc.NetworkStateProperties>} */ - networks: { - type: Array, - value: function() { - return []; - } - }, + networks: {type: Array, value: function() { return []; }}, /** * The list of custom items to display after the list of networks. * @type {!Array<!CrNetworkList.CustomItemState>} */ - customItems: { - type: Array, - value: function() { - return []; - } - }, + customItems: {type: Array, value: function() { return []; }}, /** True if action buttons should be shown for the itmes. */ showButtons: { @@ -78,9 +68,7 @@ }, /** @private */ - listChanged_: function() { - this.updateScrollableContents(); - }, + listChanged_: function() { this.updateScrollableContents(); }, /** * Returns a combined list of networks and custom items.
diff --git a/ui/webui/resources/cr_elements/network/cr_network_list_item.js b/ui/webui/resources/cr_elements/network/cr_network_list_item.js index 4ec86667..37b63313 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_list_item.js +++ b/ui/webui/resources/cr_elements/network/cr_network_list_item.js
@@ -101,9 +101,7 @@ }, /** @private */ - isStateTextConnected_() { - return this.isListItem && this.isConnected_(); - }, + isStateTextConnected_() { return this.isListItem && this.isConnected_(); }, /** * This only gets called for network items once networkState is set.
diff --git a/ui/webui/resources/cr_elements/network/cr_network_select.js b/ui/webui/resources/cr_elements/network/cr_network_select.js index de4cdef..30e67e81 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_select.js +++ b/ui/webui/resources/cr_elements/network/cr_network_select.js
@@ -76,12 +76,7 @@ * List of all network state data for all visible networks. * @type {!Array<!CrOnc.NetworkStateProperties>} */ - networkStateList: { - type: Array, - value: function() { - return []; - } - }, + networkStateList: {type: Array, value: function() { return []; }}, /** * The list of custom items to display after the list of networks. @@ -90,9 +85,7 @@ */ customItems: { type: Array, - value: function() { - return []; - }, + value: function() { return []; }, }, /**
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js b/ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js index 606d81a4..832c0a30 100644 --- a/ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js +++ b/ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js
@@ -26,7 +26,7 @@ */ isIndicatorVisible: function(type) { return type != CrPolicyIndicatorType.NONE && - type != CrPolicyIndicatorType.EXTENSION; + type != CrPolicyIndicatorType.EXTENSION; }, /** @@ -62,7 +62,7 @@ * @param {string=} opt_name An optional name argument. * @return The translated string. */ - i18n_: function (id, opt_name) { + i18n_: function(id, opt_name) { return loadTimeData.getStringF(id, opt_name); },
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js b/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js index ac1e779..494d6f4 100644 --- a/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js +++ b/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
@@ -51,13 +51,14 @@ // We ignore UserEditable unless there is a UserPolicy. this.indicatorType = CrPolicyIndicatorType.RECOMMENDED; this.recommended = - /** @type {CrOnc.NetworkPropertyType} */(property.UserPolicy); - } else if (property.DeviceEditable === true && - property.hasOwnProperty('DevicePolicy')) { + /** @type {CrOnc.NetworkPropertyType} */ (property.UserPolicy); + } else if ( + property.DeviceEditable === true && + property.hasOwnProperty('DevicePolicy')) { // We ignore DeviceEditable unless there is a DevicePolicy. this.indicatorType = CrPolicyIndicatorType.RECOMMENDED; this.recommended = - /** @type {CrOnc.NetworkPropertyType} */(property.DevicePolicy); + /** @type {CrOnc.NetworkPropertyType} */ (property.DevicePolicy); } else if (effective == 'UserPolicy') { this.indicatorType = CrPolicyIndicatorType.USER_POLICY; } else if (effective == 'DevicePolicy') {
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js b/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js index 2c4a3014..47ca23bc 100644 --- a/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js +++ b/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js
@@ -14,7 +14,7 @@ */ isPrefPolicyControlled: function(pref) { return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED && - pref.controlledBy != chrome.settingsPrivate.ControlledBy.EXTENSION; + pref.controlledBy != chrome.settingsPrivate.ControlledBy.EXTENSION; }, /**
diff --git a/ui/webui/resources/js/action_link.js b/ui/webui/resources/js/action_link.js index a9e1ffd6..4cfcc95 100644 --- a/ui/webui/resources/js/action_link.js +++ b/ui/webui/resources/js/action_link.js
@@ -54,9 +54,7 @@ } }); - function preventDefault(e) { - e.preventDefault(); - } + function preventDefault(e) { e.preventDefault(); } function removePreventDefault() { document.removeEventListener('selectstart', preventDefault); @@ -75,9 +73,8 @@ this.classList.add('no-outline'); }); - this.addEventListener('blur', function() { - this.classList.remove('no-outline'); - }); + this.addEventListener( + 'blur', function() { this.classList.remove('no-outline'); }); }, /** @type {boolean} */ @@ -88,9 +85,7 @@ HTMLAnchorElement.prototype.removeAttribute.call(this, 'disabled'); this.tabIndex = disabled ? -1 : 0; }, - get disabled() { - return this.hasAttribute('disabled'); - }, + get disabled() { return this.hasAttribute('disabled'); }, /** @override */ setAttribute: function(attr, val) {
diff --git a/ui/webui/resources/js/assert.js b/ui/webui/resources/js/assert.js index 94f2535..a404b68 100644 --- a/ui/webui/resources/js/assert.js +++ b/ui/webui/resources/js/assert.js
@@ -65,8 +65,9 @@ // We don't use assert immediately here so that we avoid constructing an error // message if we don't have to. if (!(value instanceof type)) { - assertNotReached(opt_message || 'Value ' + value + - ' is not a[n] ' + (type.name || typeof type)); + assertNotReached( + opt_message || + 'Value ' + value + ' is not a[n] ' + (type.name || typeof type)); } return value; }
diff --git a/ui/webui/resources/js/chromeos/ui_account_tweaks.js b/ui/webui/resources/js/chromeos/ui_account_tweaks.js index 6dab42b4..278af2eb 100644 --- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js +++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -25,8 +25,7 @@ * Encapsulated handling of ChromeOS accounts options page. * @constructor */ - function UIAccountTweaks() { - } + function UIAccountTweaks() {} /** * @return {boolean} Whether the current user is owner or not. @@ -74,7 +73,7 @@ } element.disabled = false; - } + }; /** * Disables or hides some elements in specified type of session in ChromeOS. @@ -86,9 +85,10 @@ * @param {string} sessionType name of the session type processed. * @private */ - UIAccountTweaks.applySessionTypeVisibility_ = function(document, - sessionType) { - var elements = document.querySelectorAll('['+ sessionType + '-visibility]'); + UIAccountTweaks.applySessionTypeVisibility_ = function( + document, sessionType) { + var elements = + document.querySelectorAll('[' + sessionType + '-visibility]'); for (var i = 0; i < elements.length; i++) { var element = elements[i]; var visibility = element.getAttribute(sessionType + '-visibility'); @@ -97,7 +97,7 @@ else if (visibility == 'disabled') UIAccountTweaks.disableElementsForSessionType(element, sessionType); } - } + }; /** * Updates specific visibility of elements for Guest session in ChromeOS. @@ -109,7 +109,7 @@ if (!UIAccountTweaks.loggedInAsGuest()) return; UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_GUEST); - } + }; /** * Updates specific visibility of elements for Public account session in @@ -121,7 +121,7 @@ if (!UIAccountTweaks.loggedInAsPublicAccount()) return; UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_PUBLIC); - } + }; /** * Disables and marks page elements for specified session type. @@ -133,20 +133,18 @@ * disabled. * @param {string} sessionType session type specificator. */ - UIAccountTweaks.disableElementsForSessionType = function(element, - sessionType) { + UIAccountTweaks.disableElementsForSessionType = function( + element, sessionType) { UIAccountTweaks.disableElementForSessionType_(element, sessionType); // Walk the tree, searching each ELEMENT node. - var walker = document.createTreeWalker(element, - NodeFilter.SHOW_ELEMENT, - null, - false); + var walker = document.createTreeWalker( + element, NodeFilter.SHOW_ELEMENT, null, false); var node = walker.nextNode(); while (node) { UIAccountTweaks.disableElementForSessionType_( - /** @type {!Element} */(node), sessionType); + /** @type {!Element} */ (node), sessionType); node = walker.nextNode(); } }; @@ -161,23 +159,18 @@ * @param {!Element} element Element that should be disabled. * @param {string} sessionType account session Type specificator. */ - UIAccountTweaks.disableElementForSessionType_ = function(element, - sessionType) { + UIAccountTweaks.disableElementForSessionType_ = function( + element, sessionType) { element.classList.add(sessionType + '-disabled'); - if (element.nodeName == 'INPUT' || - element.nodeName == 'SELECT' || + if (element.nodeName == 'INPUT' || element.nodeName == 'SELECT' || element.nodeName == 'BUTTON') { element.disabled = true; } else if (element.nodeName == 'A') { - element.onclick = function() { - return false; - }; + element.onclick = function() { return false; }; } }; // Export - return { - UIAccountTweaks: UIAccountTweaks - }; + return {UIAccountTweaks: UIAccountTweaks}; });
diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js index 3c1b75e..14bccfb 100644 --- a/ui/webui/resources/js/cr.js +++ b/ui/webui/resources/js/cr.js
@@ -109,19 +109,13 @@ switch (kind) { case PropertyKind.JS: var privateName = name + '_'; - return function() { - return this[privateName]; - }; + return function() { return this[privateName]; }; case PropertyKind.ATTR: var attributeName = getAttributeName(name); - return function() { - return this.getAttribute(attributeName); - }; + return function() { return this.getAttribute(attributeName); }; case PropertyKind.BOOL_ATTR: var attributeName = getAttributeName(name); - return function() { - return this.hasAttribute(attributeName); - }; + return function() { return this.hasAttribute(attributeName); }; } // TODO(dbeam): replace with assertNotReached() in assert.js when I can coax @@ -220,9 +214,7 @@ /** * @return {number} A new unique ID. */ - function createUid() { - return uidCounter++; - } + function createUid() { return uidCounter++; } /** * Returns a unique ID for the item. This mutates the item so it needs to be @@ -280,8 +272,8 @@ // Maybe we should check the prototype chain here? The current usage // pattern is always using an object literal so we only care about own // properties. - var propertyDescriptor = Object.getOwnPropertyDescriptor(exports, - propertyName); + var propertyDescriptor = + Object.getOwnPropertyDescriptor(exports, propertyName); if (propertyDescriptor) Object.defineProperty(obj, propertyName, propertyDescriptor); } @@ -311,7 +303,7 @@ methods.forEach(function(method) { ctor[method] = function() { var target = opt_target ? document.getElementById(opt_target) : - ctor.getInstance(); + ctor.getInstance(); return target[method + '_'].apply(target, arguments); }; }); @@ -448,38 +440,24 @@ webUIListenerCallback: webUIListenerCallback, webUIResponse: webUIResponse, - get doc() { - return document; - }, + get doc() { return document; }, /** Whether we are using a Mac or not. */ - get isMac() { - return /Mac/.test(navigator.platform); - }, + get isMac() { return /Mac/.test(navigator.platform); }, /** Whether this is on the Windows platform or not. */ - get isWindows() { - return /Win/.test(navigator.platform); - }, + get isWindows() { return /Win/.test(navigator.platform); }, /** Whether this is on chromeOS or not. */ - get isChromeOS() { - return /CrOS/.test(navigator.userAgent); - }, + get isChromeOS() { return /CrOS/.test(navigator.userAgent); }, /** Whether this is on vanilla Linux (not chromeOS). */ - get isLinux() { - return /Linux/.test(navigator.userAgent); - }, + get isLinux() { return /Linux/.test(navigator.userAgent); }, /** Whether this is on Android. */ - get isAndroid() { - return /Android/.test(navigator.userAgent); - }, + get isAndroid() { return /Android/.test(navigator.userAgent); }, /** Whether this is on iOS. */ - get isIOS() { - return /iPad|iPhone|iPod/.test(navigator.platform); - } + get isIOS() { return /iPad|iPhone|iPod/.test(navigator.platform); } }; }();
diff --git a/ui/webui/resources/js/cr/event_target.js b/ui/webui/resources/js/cr/event_target.js index 1154d282..c9e09140 100644 --- a/ui/webui/resources/js/cr/event_target.js +++ b/ui/webui/resources/js/cr/event_target.js
@@ -20,8 +20,7 @@ * @constructor * @implements {EventTarget} */ - function EventTarget() { - } + function EventTarget() {} EventTarget.prototype = { /** @@ -77,9 +76,7 @@ // Since we are using DOM Event objects we need to override some of the // properties and methods so that we can emulate this correctly. var self = this; - event.__defineGetter__('target', function() { - return self; - }); + event.__defineGetter__('target', function() { return self; }); var type = event.type; var prevented = 0; @@ -99,7 +96,5 @@ }; // Export - return { - EventTarget: EventTarget - }; + return {EventTarget: EventTarget}; });
diff --git a/ui/webui/resources/js/cr/link_controller.js b/ui/webui/resources/js/cr/link_controller.js index 0e93f75..589f6aa3 100644 --- a/ui/webui/resources/js/cr/link_controller.js +++ b/ui/webui/resources/js/cr/link_controller.js
@@ -46,9 +46,7 @@ * links. * @constructor */ - function LinkController(localStrings) { - this.localStrings_ = localStrings; - } + function LinkController(localStrings) { this.localStrings_ = localStrings; } LinkController.prototype = { /** @@ -85,10 +83,10 @@ var kind; var ctrl = cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey; - if (e.button == 1 || ctrl) // middle, ctrl or keyboard + if (e.button == 1 || ctrl) // middle, ctrl or keyboard kind = e.shiftKey ? cr.LinkKind.FOREGROUND_TAB : - cr.LinkKind.BACKGROUND_TAB; - else // left or keyboard + cr.LinkKind.BACKGROUND_TAB; + else // left or keyboard kind = e.shiftKey ? cr.LinkKind.WINDOW : cr.LinkKind.SELF; this.openUrls([url], kind); @@ -101,9 +99,7 @@ * @param {string} url The URL to open. * @param {cr.LinkKind} kind The kind of open we want to do. */ - openUrl: function(url, kind) { - this.openUrls([url], kind); - }, + openUrl: function(url, kind) { this.openUrls([url], kind); }, /** * Opens URLs in new tab, window or incognito mode. @@ -122,23 +118,18 @@ // Fix '#124' URLs since opening those in a new window does not work. We // prepend the base URL when we encounter those. var base = this.window.location.href.split('#')[0]; - urls = urls.map(function(url) { - return url[0] == '#' ? base + url : url; - }); + urls = + urls.map(function(url) { return url[0] == '#' ? base + url : url; }); var incognito = kind == cr.LinkKind.INCOGNITO; if (kind == cr.LinkKind.WINDOW || incognito) { - chrome.windows.create({ - url: urls, - incognito: incognito - }); - } else if (kind == cr.LinkKind.FOREGROUND_TAB || - kind == cr.LinkKind.BACKGROUND_TAB) { + chrome.windows.create({url: urls, incognito: incognito}); + } else if ( + kind == cr.LinkKind.FOREGROUND_TAB || + kind == cr.LinkKind.BACKGROUND_TAB) { urls.forEach(function(url, i) { - chrome.tabs.create({ - url: url, - selected: kind == cr.LinkKind.FOREGROUND_TAB && !i - }); + chrome.tabs.create( + {url: url, selected: kind == cr.LinkKind.FOREGROUND_TAB && !i}); }); } else { this.window.location.href = urls[0];
diff --git a/ui/webui/resources/js/cr/ui.js b/ui/webui/resources/js/cr/ui.js index 7e41d4a6..9c9cc21b 100644 --- a/ui/webui/resources/js/cr/ui.js +++ b/ui/webui/resources/js/cr/ui.js
@@ -123,7 +123,7 @@ var inputRect = el.getBoundingClientRect(); // box-sizing var parentRect = parentEl.getBoundingClientRect(); var startPos = rtl ? parentRect.right - inputRect.right : - inputRect.left - parentRect.left; + inputRect.left - parentRect.left; // Add up border and padding of the input. var inner = parseInt(computedStyle.borderLeftWidth, 10) + @@ -133,7 +133,7 @@ // We also need to subtract the padding of parent to prevent it to overflow. var parentPadding = rtl ? parseInt(parentComputedStyle.paddingLeft, 10) : - parseInt(parentComputedStyle.paddingRight, 10); + parseInt(parentComputedStyle.paddingRight, 10); var max = parentEl.clientWidth - startPos - inner - parentPadding; if (opt_scale)
diff --git a/ui/webui/resources/js/cr/ui/alert_overlay.js b/ui/webui/resources/js/cr/ui/alert_overlay.js index 062f5b3..f3962d1 100644 --- a/ui/webui/resources/js/cr/ui/alert_overlay.js +++ b/ui/webui/resources/js/cr/ui/alert_overlay.js
@@ -52,8 +52,9 @@ * user presses the cancel button. Can be undefined if |opt_cancelTitle| * is falsey. */ - function setValues(title, message, opt_okTitle, opt_cancelTitle, - opt_okCallback, opt_cancelCallback) { + function setValues( + title, message, opt_okTitle, opt_cancelTitle, opt_okCallback, + opt_cancelCallback) { if (typeof title != 'undefined') $('alertOverlayTitle').textContent = title; $('alertOverlayTitle').hidden = typeof title == 'undefined'; @@ -74,10 +75,7 @@ }; // Export - return { - initialize: initialize, - setValues: setValues - }; + return {initialize: initialize, setValues: setValues}; }); document.addEventListener('DOMContentLoaded', alertOverlay.initialize);
diff --git a/ui/webui/resources/js/cr/ui/array_data_model.js b/ui/webui/resources/js/cr/ui/array_data_model.js index 969f948..5138cef 100644 --- a/ui/webui/resources/js/cr/ui/array_data_model.js +++ b/ui/webui/resources/js/cr/ui/array_data_model.js
@@ -41,9 +41,7 @@ * The length of the data model. * @type {number} */ - get length() { - return this.array_.length; - }, + get length() { return this.array_.length; }, /** * Returns the item at the given index. @@ -63,9 +61,7 @@ * @param {string} field The field to get compare function for. * @return {function(*, *): number} Compare function set for given field. */ - compareFunction: function(field) { - return this.compareFunctions_[field]; - }, + compareFunction: function(field) { return this.compareFunctions_[field]; }, /** * Sets compare function for given field. @@ -125,8 +121,9 @@ */ slice: function(opt_from, opt_to) { var arr = this.array_; - return this.indexes_.slice(opt_from, opt_to).map( - function(index) { return arr[index] }); + return this.indexes_.slice(opt_from, opt_to).map(function(index) { + return arr[index] + }); }, /** @@ -181,8 +178,8 @@ var status = this.sortStatus; // if sortStatus.field is null, this restores original order. - var sortPermutation = this.doSort_(this.sortStatus.field, - this.sortStatus.direction); + var sortPermutation = + this.doSort_(this.sortStatus.field, this.sortStatus.direction); if (sortPermutation) { var splicePermutation = deletePermutation.map(function(element) { return element != -1 ? sortPermutation[element] : -1; @@ -246,9 +243,7 @@ * This runs sort after updating. * @param {number} index The index of the item to update. */ - updateIndex: function(index) { - this.updateIndexes([index]); - }, + updateIndex: function(index) { this.updateIndexes([index]); }, /** * Notifies of update of the items in the array. This does not remove and @@ -270,8 +265,8 @@ if (this.sortStatus.field) { var status = this.sortStatus; - var sortPermutation = this.doSort_(this.sortStatus.field, - this.sortStatus.direction); + var sortPermutation = + this.doSort_(this.sortStatus.field, this.sortStatus.direction); if (sortPermutation) this.dispatchPermutedEvent_(sortPermutation); // We should first call prepareSort (data may change), and then sort. @@ -288,10 +283,7 @@ * @return {!Object} Created sort status. */ createSortStatus: function(field, direction) { - return { - field: field, - direction: direction - }; + return {field: field, direction: direction}; }, /** @@ -302,9 +294,7 @@ * @param {function()} callback The function to invoke when preparation * is complete. */ - prepareSort: function(field, callback) { - callback(); - }, + prepareSort: function(field, callback) { callback(); }, /** * Sorts data model according to given field and direction and dispathes @@ -426,8 +416,8 @@ compareResult = compareFunction.call(null, item1, item2); if (compareResult != 0) return dirMultiplier * compareResult; - return dirMultiplier * this.defaultValuesCompareFunction(index1, - index2); + return dirMultiplier * + this.defaultValuesCompareFunction(index1, index2); }.bind(this); }, @@ -444,7 +434,5 @@ } }; - return { - ArrayDataModel: ArrayDataModel - }; + return {ArrayDataModel: ArrayDataModel}; });
diff --git a/ui/webui/resources/js/cr/ui/autocomplete_list.js b/ui/webui/resources/js/cr/ui/autocomplete_list.js index 71e3e2f..0c140cb 100644 --- a/ui/webui/resources/js/cr/ui/autocomplete_list.js +++ b/ui/webui/resources/js/cr/ui/autocomplete_list.js
@@ -126,17 +126,14 @@ * Requests new suggestions. Called when new suggestions are needed. * @param {string} query the text to autocomplete from. */ - requestSuggestions: function(query) { - }, + requestSuggestions: function(query) {}, /** * Handles the Enter keydown event. * By default, clears and hides the autocomplete popup. Note that the * keydown event bubbles up, so the input field can handle the event. */ - handleEnterKeydown: function() { - this.suggestions = []; - }, + handleEnterKeydown: function() { this.suggestions = []; }, /** * Handles the selected suggestion. Called when a suggestion is selected. @@ -225,9 +222,7 @@ * @return {HTMLElement} The text field the autocomplete popup is currently * attached to, if any. */ - get targetInput() { - return this.targetInput_; - }, + get targetInput() { return this.targetInput_; }, /** * Handles input field key events that should be interpreted as autocomplete @@ -265,7 +260,5 @@ }, }; - return { - AutocompleteList: AutocompleteList - }; + return {AutocompleteList: AutocompleteList}; });
diff --git a/ui/webui/resources/js/cr/ui/bubble.js b/ui/webui/resources/js/cr/ui/bubble.js index 1f3ee8f..a2cc09d 100644 --- a/ui/webui/resources/js/cr/ui/bubble.js +++ b/ui/webui/resources/js/cr/ui/bubble.js
@@ -98,8 +98,7 @@ */ decorate: function() { this.className = 'bubble'; - this.innerHTML = - '<div class="bubble-content"></div>' + + this.innerHTML = '<div class="bubble-content"></div>' + '<div class="bubble-shadow"></div>' + '<div class="bubble-arrow"></div>'; this.hidden = true; @@ -142,11 +141,11 @@ return; this.arrowAtRight_ = location == cr.ui.ArrowLocation.TOP_END || - location == cr.ui.ArrowLocation.BOTTOM_END; + location == cr.ui.ArrowLocation.BOTTOM_END; if (document.documentElement.dir == 'rtl') this.arrowAtRight_ = !this.arrowAtRight_; this.arrowAtTop_ = location == cr.ui.ArrowLocation.TOP_START || - location == cr.ui.ArrowLocation.TOP_END; + location == cr.ui.ArrowLocation.TOP_END; }, /** @@ -181,8 +180,8 @@ // specified by the arrow location). If the bubble is not entirely // within view, it is then shifted, preserving the arrow tip position. var left = this.arrowAtRight_ ? - anchorMid + BubbleBase.ARROW_OFFSET - bubble.width : - anchorMid - BubbleBase.ARROW_OFFSET; + anchorMid + BubbleBase.ARROW_OFFSET - bubble.width : + anchorMid - BubbleBase.ARROW_OFFSET; var max_left_pos = documentWidth - bubble.width - BubbleBase.MIN_VIEWPORT_EDGE_MARGIN; var min_left_pos = BubbleBase.MIN_VIEWPORT_EDGE_MARGIN; @@ -191,9 +190,10 @@ else left = Math.max(Math.min(left, max_left_pos), min_left_pos); var arrowTip = Math.min( - Math.max(arrow.width / 2, - this.arrowAtRight_ ? left + bubble.width - anchorMid : - anchorMid - left), + Math.max( + arrow.width / 2, this.arrowAtRight_ ? + left + bubble.width - anchorMid : + anchorMid - left), bubble.width - arrow.width / 2); // Work out the vertical placement, attempting to fit the bubble @@ -208,15 +208,16 @@ // * Outside the anchor, arrow tip overlapping the anchor (arrow at // bottom/top, opposite the specified arrow location). // * Overlapping the anchor. - var offsetTop = Math.min(documentHeight - anchor.bottom - bubble.height, - arrow.height / 2); - var offsetBottom = Math.min(anchor.top - bubble.height, - arrow.height / 2); + var offsetTop = Math.min( + documentHeight - anchor.bottom - bubble.height, arrow.height / 2); + var offsetBottom = + Math.min(anchor.top - bubble.height, arrow.height / 2); if (offsetTop < 0 && offsetBottom < 0) { var top = 0; this.updateArrowPosition_(false, false, arrowTip); - } else if (offsetTop > offsetBottom || - offsetTop == offsetBottom && this.arrowAtTop_) { + } else if ( + offsetTop > offsetBottom || + offsetTop == offsetBottom && this.arrowAtTop_) { var top = anchor.bottom + offsetTop; this.updateArrowPosition_(true, true, arrowTip); } else { @@ -226,17 +227,18 @@ } else { if (this.bubbleAlignment_ == cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE) { - var left = this.arrowAtRight_ ? anchor.right - bubble.width : - anchor.left; + var left = + this.arrowAtRight_ ? anchor.right - bubble.width : anchor.left; } else { var left = this.arrowAtRight_ ? anchorMid - this.clientWidth + BubbleBase.ARROW_OFFSET : anchorMid - BubbleBase.ARROW_OFFSET; } - var top = this.arrowAtTop_ ? anchor.bottom + arrow.height / 2 : + var top = this.arrowAtTop_ ? + anchor.bottom + arrow.height / 2 : anchor.top - this.clientHeight - arrow.height / 2; - this.updateArrowPosition_(true, this.arrowAtTop_, - BubbleBase.ARROW_OFFSET); + this.updateArrowPosition_( + true, this.arrowAtTop_, BubbleBase.ARROW_OFFSET); } this.style.left = left + 'px'; @@ -289,9 +291,7 @@ * Attach the bubble to the document's DOM. * @private */ - attachToDOM_: function() { - document.body.appendChild(this); - }, + attachToDOM_: function() { document.body.appendChild(this); }, /** * Update the arrow so that it appears at the correct position. @@ -407,9 +407,10 @@ // Dismiss the bubble when the user clicks on the close button. if (event.target == this.querySelector('.bubble-close')) { this.handleCloseEvent_(); - // Dismiss the bubble when the user clicks outside it after the - // specified delay has passed. - } else if (!this.contains(event.target) && + // Dismiss the bubble when the user clicks outside it after the + // specified delay has passed. + } else if ( + !this.contains(event.target) && Date.now() - this.showTime_ >= this.deactivateToDismissDelay_) { this.hide(); }
diff --git a/ui/webui/resources/js/cr/ui/bubble_button.js b/ui/webui/resources/js/cr/ui/bubble_button.js index fa1d8a8..a5901e5 100644 --- a/ui/webui/resources/js/cr/ui/bubble_button.js +++ b/ui/webui/resources/js/cr/ui/bubble_button.js
@@ -88,7 +88,5 @@ }; // Export. - return { - BubbleButton: BubbleButton - }; + return {BubbleButton: BubbleButton}; });
diff --git a/ui/webui/resources/js/cr/ui/card_slider.js b/ui/webui/resources/js/cr/ui/card_slider.js index f1919912..4de3934 100644 --- a/ui/webui/resources/js/cr/ui/card_slider.js +++ b/ui/webui/resources/js/cr/ui/card_slider.js
@@ -119,11 +119,14 @@ */ initialize: function(ignoreMouseWheelEvents) { var view = this.container_.ownerDocument.defaultView; - assert(view.getComputedStyle(this.container_).display == '-webkit-box', + assert( + view.getComputedStyle(this.container_).display == '-webkit-box', 'Container should be display -webkit-box.'); - assert(view.getComputedStyle(this.frame_).overflow == 'hidden', + assert( + view.getComputedStyle(this.frame_).overflow == 'hidden', 'Frame should be overflow hidden.'); - assert(view.getComputedStyle(this.container_).position == 'static', + assert( + view.getComputedStyle(this.container_).position == 'static', 'Container should be position static.'); this.updateCardWidths_(); @@ -133,8 +136,8 @@ this.mouseWheelIsContinuous_ = false; this.scrollClearTimeout_ = null; if (!ignoreMouseWheelEvents) { - this.frame_.addEventListener('mousewheel', - this.onMouseWheel_.bind(this)); + this.frame_.addEventListener( + 'mousewheel', this.onMouseWheel_.bind(this)); } this.container_.addEventListener( 'webkitTransitionEnd', this.onWebkitTransitionEnd_.bind(this)); @@ -144,14 +147,14 @@ // no touch events (eg. we're mainly just adding listeners for events that // will never trigger). var TouchHandler = cr.ui.TouchHandler; - this.container_.addEventListener(TouchHandler.EventType.TOUCH_START, - this.onTouchStart_.bind(this)); - this.container_.addEventListener(TouchHandler.EventType.DRAG_START, - this.onDragStart_.bind(this)); - this.container_.addEventListener(TouchHandler.EventType.DRAG_MOVE, - this.onDragMove_.bind(this)); - this.container_.addEventListener(TouchHandler.EventType.DRAG_END, - this.onDragEnd_.bind(this)); + this.container_.addEventListener( + TouchHandler.EventType.TOUCH_START, this.onTouchStart_.bind(this)); + this.container_.addEventListener( + TouchHandler.EventType.DRAG_START, this.onDragStart_.bind(this)); + this.container_.addEventListener( + TouchHandler.EventType.DRAG_MOVE, this.onDragMove_.bind(this)); + this.container_.addEventListener( + TouchHandler.EventType.DRAG_END, this.onDragEnd_.bind(this)); this.touchHandler_.enable(/* opt_capture */ false); }, @@ -180,7 +183,8 @@ * navigate to. */ setCards: function(cards, index) { - assert(index >= 0 && index < cards.length, + assert( + index >= 0 && index < cards.length, 'Invalid index in CardSlider#setCards'); this.cards_ = cards; @@ -224,42 +228,32 @@ * Returns the index of the current card. * @return {number} index of the current card. */ - get currentCard() { - return this.currentCard_; - }, + get currentCard() { return this.currentCard_; }, /** * Allows setting the current card index. * @param {number} index A new index to set the current index to. * @return {number} The new index after having been set. */ - set currentCard(index) { - return (this.currentCard_ = index); - }, + set currentCard(index) { return (this.currentCard_ = index); }, /** * Returns the number of cards. * @return {number} number of cards. */ - get cardCount() { - return this.cards_.length; - }, + get cardCount() { return this.cards_.length; }, /** * Returns the current card itself. * @return {!Element} the currently shown card. */ - get currentCardValue() { - return this.cards_[this.currentCard_]; - }, + get currentCardValue() { return this.cards_[this.currentCard_]; }, /** * Returns the frame holding the cards. * @return {Element} The frame used to position the cards. */ - get frame() { - return this.frame_; - }, + get frame() { return this.frame_; }, /** * Handle horizontal scrolls to flip between pages. @@ -283,15 +277,16 @@ // For continuous devices, detect a page swipe when the accumulated // delta matches a pre-defined threshhold. After changing the page, // ignore wheel events for a short time before repeating this process. - if (this.mouseWheelCardSelected_) return; + if (this.mouseWheelCardSelected_) + return; this.mouseWheelScrollAmount_ += e.wheelDeltaX; if (Math.abs(this.mouseWheelScrollAmount_) >= 600) { var pagesToScroll = this.mouseWheelScrollAmount_ > 0 ? 1 : -1; if (!isRTL()) pagesToScroll *= -1; var newCardIndex = this.currentCard + pagesToScroll; - newCardIndex = Math.min(this.cards_.length - 1, - Math.max(0, newCardIndex)); + newCardIndex = + Math.min(this.cards_.length - 1, Math.max(0, newCardIndex)); this.selectCard(newCardIndex, true); this.mouseWheelCardSelected_ = true; } @@ -301,8 +296,8 @@ if (!isRTL()) pagesToScroll *= -1; var newCardIndex = this.currentCard + pagesToScroll; - newCardIndex = Math.min(this.cards_.length - 1, - Math.max(0, newCardIndex)); + newCardIndex = + Math.min(this.cards_.length - 1, Math.max(0, newCardIndex)); this.selectCard(newCardIndex, true); } @@ -463,9 +458,7 @@ * the likely event it needs to be updated by a card being inserted or * removed in the flow. */ - repositionFrame: function() { - this.transformToCurrentCard_(); - }, + repositionFrame: function() { this.transformToCurrentCard_(); }, /** * Checks the the given |index| exists in this.cards_. @@ -487,10 +480,8 @@ * @param {boolean=} opt_forceChange If true, ignore if the card already * selected. */ - selectCard: function(newCardIndex, - opt_animate, - opt_dontNotify, - opt_forceChange) { + selectCard: function( + newCardIndex, opt_animate, opt_dontNotify, opt_forceChange) { this.assertValidIndex_(newCardIndex); var previousCard = this.currentCardValue; @@ -516,11 +507,10 @@ // We also dispatch an event on the cards themselves. if (previousCard) { - cr.dispatchSimpleEvent(previousCard, 'carddeselected', - true, true); + cr.dispatchSimpleEvent(previousCard, 'carddeselected', true, true); } - cr.dispatchSimpleEvent(this.currentCardValue, 'cardselected', - true, true); + cr.dispatchSimpleEvent( + this.currentCardValue, 'cardselected', true, true); } // If we're not changing, animated, or transitioning, fire a @@ -566,8 +556,8 @@ // enough to change cards. var transition = ''; if (opt_animate) { - transition = 'transform ' + CardSlider.TRANSITION_TIME_ + - 'ms ease-in-out'; + transition = + 'transform ' + CardSlider.TRANSITION_TIME_ + 'ms ease-in-out'; } this.container_.style.WebkitTransition = transition; this.translateTo_(this.currentLeft_); @@ -598,7 +588,7 @@ * @private */ onTouchStart_: function(e) { - e = /** @type {!cr.ui.TouchHandler.Event} */(e); + e = /** @type {!cr.ui.TouchHandler.Event} */ (e); this.container_.style.WebkitTransition = ''; e.enableDrag = true; }, @@ -610,9 +600,9 @@ * @private */ onDragStart_: function(e) { - e = /** @type {!cr.ui.TouchHandler.Event} */(e); - e.enableDrag = this.cardCount > 1 && Math.abs(e.dragDeltaX) > - Math.abs(e.dragDeltaY); + e = /** @type {!cr.ui.TouchHandler.Event} */ (e); + e.enableDrag = + this.cardCount > 1 && Math.abs(e.dragDeltaX) > Math.abs(e.dragDeltaY); }, /** @@ -622,7 +612,7 @@ * @private */ onDragMove_: function(e) { - e = /** @type {!cr.ui.TouchHandler.Event} */(e); + e = /** @type {!cr.ui.TouchHandler.Event} */ (e); var deltaX = e.dragDeltaX; // If dragging beyond the first or last card then apply a backoff so the // dragging feels stickier than usual. @@ -640,14 +630,14 @@ * @private */ onDragEnd_: function(e) { - e = /** @type {!cr.ui.TouchHandler.Event} */(e); + e = /** @type {!cr.ui.TouchHandler.Event} */ (e); var deltaX = e.dragDeltaX; var velocity = this.touchHandler_.getEndVelocity().x; var newX = this.currentLeft_ + deltaX; var newCardIndex = Math.round(-newX / this.cardWidth_); - if (newCardIndex == this.currentCard && Math.abs(velocity) > - CardSlider.TRANSITION_VELOCITY_THRESHOLD_) { + if (newCardIndex == this.currentCard && + Math.abs(velocity) > CardSlider.TRANSITION_VELOCITY_THRESHOLD_) { // The drag wasn't far enough to change cards but the velocity was // high enough to transition anyways. If the velocity is to the left // (negative) then the user wishes to go right (card + 1). @@ -675,7 +665,5 @@ }, }; - return { - CardSlider: CardSlider - }; + return {CardSlider: CardSlider}; });
diff --git a/ui/webui/resources/js/cr/ui/command.js b/ui/webui/resources/js/cr/ui/command.js index ec96779..3f857aff 100644 --- a/ui/webui/resources/js/cr/ui/command.js +++ b/ui/webui/resources/js/cr/ui/command.js
@@ -108,8 +108,8 @@ * @param {Node=} opt_node Node for which to actuate command state. */ canExecuteChange: function(opt_node) { - dispatchCanExecuteEvent(this, - opt_node || this.ownerDocument.activeElement); + dispatchCanExecuteEvent( + this, opt_node || this.ownerDocument.activeElement); }, /** @@ -129,9 +129,7 @@ * @type {string} */ shortcut_: '', - get shortcut() { - return this.shortcut_; - }, + get shortcut() { return this.shortcut_; }, set shortcut(shortcut) { var oldShortcut = this.shortcut_; if (shortcut !== oldShortcut) { @@ -141,8 +139,8 @@ // Set this after the keyboardShortcuts_ since that might throw. this.shortcut_ = shortcut; - cr.dispatchPropertyChange(this, 'shortcut', this.shortcut_, - oldShortcut); + cr.dispatchPropertyChange( + this, 'shortcut', this.shortcut_, oldShortcut); } }, @@ -312,9 +310,7 @@ * @type {boolean} */ canExecute_: false, - get canExecute() { - return this.canExecute_; - }, + get canExecute() { return this.canExecute_; }, set canExecute(canExecute) { this.canExecute_ = !!canExecute; this.stopPropagation(); @@ -323,8 +319,5 @@ }; // Export - return { - Command: Command, - CanExecuteEvent: CanExecuteEvent - }; + return {Command: Command, CanExecuteEvent: CanExecuteEvent}; });
diff --git a/ui/webui/resources/js/cr/ui/context_menu_button.js b/ui/webui/resources/js/cr/ui/context_menu_button.js index 51d1b52..aadf840 100644 --- a/ui/webui/resources/js/cr/ui/context_menu_button.js +++ b/ui/webui/resources/js/cr/ui/context_menu_button.js
@@ -86,7 +86,5 @@ }; // Export - return { - ContextMenuButton: ContextMenuButton - }; + return {ContextMenuButton: ContextMenuButton}; });
diff --git a/ui/webui/resources/js/cr/ui/context_menu_handler.js b/ui/webui/resources/js/cr/ui/context_menu_handler.js index 7a48736e..2266801 100644 --- a/ui/webui/resources/js/cr/ui/context_menu_handler.js +++ b/ui/webui/resources/js/cr/ui/context_menu_handler.js
@@ -14,9 +14,7 @@ * @extends {cr.EventTarget} * @implements {EventListener} */ - function ContextMenuHandler() { - this.showingEvents_ = new EventTracker(); - } + function ContextMenuHandler() { this.showingEvents_ = new EventTracker(); } ContextMenuHandler.prototype = { __proto__: EventTarget.prototype, @@ -25,10 +23,7 @@ * The menu that we are currently showing. * @type {cr.ui.Menu} */ - menu_: null, - get menu() { - return this.menu_; - }, + menu_: null, get menu() { return this.menu_; }, /** * Shows a menu as a context menu. @@ -113,8 +108,8 @@ // to detect this. if (this.keyIsDown_) { var rect = element.getRectForContextMenu ? - element.getRectForContextMenu() : - element.getBoundingClientRect(); + element.getRectForContextMenu() : + element.getBoundingClientRect(); var offset = Math.min(rect.width, rect.height) / 2; x = rect.left + offset; y = rect.top + offset; @@ -153,12 +148,11 @@ case 'mousedown': if (!this.menu.contains(e.target)) { this.hideMenu(); - if(e.button == 0 /* Left click */) { + if (e.button == 0 /* Left click */) { e.preventDefault(); e.stopPropagation(); } - } - else + } else e.preventDefault(); break; @@ -173,7 +167,7 @@ e.stopPropagation(); e.preventDefault(); - // If the menu is visible we let it handle all the keyboard events. + // If the menu is visible we let it handle all the keyboard events. } else if (this.menu) { this.menu.handleKeyDown(e); e.preventDefault(); @@ -182,10 +176,10 @@ break; case 'activate': - var hideDelayed = e.target instanceof cr.ui.MenuItem && - e.target.checkable; - this.hideMenu(hideDelayed ? cr.ui.HideType.DELAYED : - cr.ui.HideType.INSTANT); + var hideDelayed = + e.target instanceof cr.ui.MenuItem && e.target.checkable; + this.hideMenu( + hideDelayed ? cr.ui.HideType.DELAYED : cr.ui.HideType.INSTANT); break; case 'focus': @@ -220,11 +214,11 @@ */ addContextMenuProperty: function(elementOrClass) { var target = typeof elementOrClass == 'function' ? - elementOrClass.prototype : elementOrClass; + elementOrClass.prototype : + elementOrClass; - target.__defineGetter__('contextMenu', function() { - return this.contextMenu_; - }); + target.__defineGetter__( + 'contextMenu', function() { return this.contextMenu_; }); target.__defineSetter__('contextMenu', function(menu) { var oldContextMenu = this.contextMenu;
diff --git a/ui/webui/resources/js/cr/ui/controlled_indicator.js b/ui/webui/resources/js/cr/ui/controlled_indicator.js index fbf8f17..249c90a 100644 --- a/ui/webui/resources/js/cr/ui/controlled_indicator.js +++ b/ui/webui/resources/js/cr/ui/controlled_indicator.js
@@ -117,10 +117,7 @@ * modified (Chrome OS only). * - unset: The value is controlled by the user alone. */ - cr.defineProperty(ControlledIndicator, 'controlledBy', - cr.PropertyKind.ATTR); + cr.defineProperty(ControlledIndicator, 'controlledBy', cr.PropertyKind.ATTR); - return { - ControlledIndicator: ControlledIndicator - }; + return {ControlledIndicator: ControlledIndicator}; });
diff --git a/ui/webui/resources/js/cr/ui/dialogs.js b/ui/webui/resources/js/cr/ui/dialogs.js index eb37f1d..4ec7ed4 100644 --- a/ui/webui/resources/js/cr/ui/dialogs.js +++ b/ui/webui/resources/js/cr/ui/dialogs.js
@@ -40,13 +40,13 @@ var doc = this.document_; this.container_ = doc.createElement('div'); this.container_.className = 'cr-dialog-container'; - this.container_.addEventListener('keydown', - this.onContainerKeyDown_.bind(this)); + this.container_.addEventListener( + 'keydown', this.onContainerKeyDown_.bind(this)); this.shield_ = doc.createElement('div'); this.shield_.className = 'cr-dialog-shield'; this.container_.appendChild(this.shield_); - this.container_.addEventListener('mousedown', - this.onContainerMouseDown_.bind(this)); + this.container_.addEventListener( + 'mousedown', this.onContainerMouseDown_.bind(this)); this.frame_ = doc.createElement('div'); this.frame_.className = 'cr-dialog-frame'; @@ -61,8 +61,7 @@ this.closeButton_ = doc.createElement('div'); this.closeButton_.className = 'cr-dialog-close'; - this.closeButton_.addEventListener('click', - this.onCancelClick_.bind(this)); + this.closeButton_.addEventListener('click', this.onCancelClick_.bind(this)); this.frame_.appendChild(this.closeButton_); this.text_ = doc.createElement('div'); @@ -82,8 +81,8 @@ this.cancelButton_ = doc.createElement('button'); this.cancelButton_.className = 'cr-dialog-cancel'; this.cancelButton_.textContent = BaseDialog.CANCEL_LABEL; - this.cancelButton_.addEventListener('click', - this.onCancelClick_.bind(this)); + this.cancelButton_.addEventListener( + 'click', this.onCancelClick_.bind(this)); this.buttons.appendChild(this.cancelButton_); this.initialFocusElement_ = this.okButton_; @@ -164,8 +163,8 @@ * @param {Function=} opt_onCancel * @param {Function=} opt_onShow */ - BaseDialog.prototype.showHtml = function(title, message, - opt_onOk, opt_onCancel, opt_onShow) { + BaseDialog.prototype.showHtml = function( + title, message, opt_onOk, opt_onCancel, opt_onShow) { this.text_.innerHTML = message; this.show_(title, opt_onOk, opt_onCancel, opt_onShow); }; @@ -173,8 +172,7 @@ /** @private */ BaseDialog.prototype.findFocusableElements_ = function(doc) { var elements = Array.prototype.filter.call( - doc.querySelectorAll('*'), - function(n) { return n.tabIndex >= 0; }); + doc.querySelectorAll('*'), function(n) { return n.tabIndex >= 0; }); var iframes = doc.querySelectorAll('iframe'); for (var i = 0; i < iframes.length; i++) { @@ -184,7 +182,8 @@ var contentDoc; try { contentDoc = iframe.contentDocument; - } catch(e) {} // ignore SecurityError + } catch (e) { + } // ignore SecurityError if (contentDoc) elements = elements.concat(this.findFocusableElements_(contentDoc)); } @@ -198,8 +197,8 @@ * @param {Function=} opt_onCancel * @param {Function=} opt_onShow */ - BaseDialog.prototype.showWithTitle = function(title, message, - opt_onOk, opt_onCancel, opt_onShow) { + BaseDialog.prototype.showWithTitle = function( + title, message, opt_onOk, opt_onCancel, opt_onShow) { this.text_.textContent = message; this.show_(title, opt_onOk, opt_onCancel, opt_onShow); }; @@ -215,10 +214,10 @@ title, opt_onOk, opt_onCancel, opt_onShow) { // Make all outside nodes unfocusable while the dialog is active. this.deactivatedNodes_ = this.findFocusableElements_(this.document_); - this.tabIndexes_ = this.deactivatedNodes_.map( - function(n) { return n.getAttribute('tabindex'); }); - this.deactivatedNodes_.forEach( - function(n) { n.tabIndex = -1; }); + this.tabIndexes_ = this.deactivatedNodes_.map(function(n) { + return n.getAttribute('tabindex'); + }); + this.deactivatedNodes_.forEach(function(n) { n.tabIndex = -1; }); this.previousActiveElement_ = this.document_.activeElement; this.parentNode_.appendChild(this.container_); @@ -307,9 +306,7 @@ * @constructor * @extends {cr.ui.dialogs.BaseDialog} */ - function ConfirmDialog(parentNode) { - BaseDialog.call(this, parentNode); - } + function ConfirmDialog(parentNode) { BaseDialog.call(this, parentNode); } ConfirmDialog.prototype = {__proto__: BaseDialog.prototype}; @@ -360,9 +357,7 @@ this, message, opt_onOk, opt_onCancel, opt_onShow); }; - PromptDialog.prototype.getValue = function() { - return this.input_.value; - }; + PromptDialog.prototype.getValue = function() { return this.input_.value; }; /** @private */ PromptDialog.prototype.onOkClick_ = function(event) {
diff --git a/ui/webui/resources/js/cr/ui/drag_wrapper.js b/ui/webui/resources/js/cr/ui/drag_wrapper.js index c2b17536..60d7cef 100644 --- a/ui/webui/resources/js/cr/ui/drag_wrapper.js +++ b/ui/webui/resources/js/cr/ui/drag_wrapper.js
@@ -41,14 +41,11 @@ * @param {!cr.ui.DragWrapperDelegate} delegate * @constructor */ - function DragWrapper(target, delegate) { - this.initialize(target, delegate); - } + function DragWrapper(target, delegate) { this.initialize(target, delegate); } DragWrapper.prototype = { initialize: function(target, delegate) { - target.addEventListener('dragenter', - this.onDragEnter_.bind(this)); + target.addEventListener('dragenter', this.onDragEnter_.bind(this)); target.addEventListener('dragover', this.onDragOver_.bind(this)); target.addEventListener('drop', this.onDrop_.bind(this)); target.addEventListener('dragleave', this.onDragLeave_.bind(this));
diff --git a/ui/webui/resources/js/cr/ui/expandable_bubble.js b/ui/webui/resources/js/cr/ui/expandable_bubble.js index 57c8b331..16a7635 100644 --- a/ui/webui/resources/js/cr/ui/expandable_bubble.js +++ b/ui/webui/resources/js/cr/ui/expandable_bubble.js
@@ -25,10 +25,9 @@ decorate: function() { this.className = 'expandable-bubble'; - this.innerHTML = - '<div class="expandable-bubble-contents">' + - '<div class="expandable-bubble-title"></div>' + - '<div class="expandable-bubble-main" hidden></div>' + + this.innerHTML = '<div class="expandable-bubble-contents">' + + '<div class="expandable-bubble-title"></div>' + + '<div class="expandable-bubble-main" hidden></div>' + '</div>' + '<div class="expandable-bubble-close" hidden></div>'; @@ -76,9 +75,7 @@ * is clicked. By default is set to this.hide. * @param {Function} func A function with no parameters. */ - set handleCloseEvent(func) { - this.handleCloseEvent_ = func; - }, + set handleCloseEvent(func) { this.handleCloseEvent_ = func; }, /** * Temporarily suppresses the bubble from view (and toggles it back). @@ -197,7 +194,7 @@ * Node.prototype.contains() will be fixed. */ onNotificationClick_: function(e) { - if (!this.contains(/** @type {!Node} */(e.target))) + if (!this.contains(/** @type {!Node} */ (e.target))) return; if (!this.expanded) { @@ -223,10 +220,10 @@ this.resizeAndReposition(); this.eventTracker_ = new EventTracker; - this.eventTracker_.add(window, - 'load', this.resizeAndReposition.bind(this)); - this.eventTracker_.add(window, - 'resize', this.resizeAndReposition.bind(this)); + this.eventTracker_.add( + window, 'load', this.resizeAndReposition.bind(this)); + this.eventTracker_.add( + window, 'resize', this.resizeAndReposition.bind(this)); this.eventTracker_.add(this, 'click', this.onNotificationClick_); var doc = this.ownerDocument; @@ -269,7 +266,7 @@ if (e.target == this.querySelector('.expandable-bubble-close')) { this.handleCloseEvent_(); handled = true; - } else if (!this.contains(/** @type {!Node} */(e.target))) { + } else if (!this.contains(/** @type {!Node} */ (e.target))) { if (this.expanded) { this.collapseBubble_(); handled = true; @@ -301,7 +298,5 @@ */ cr.defineProperty(ExpandableBubble, 'masked', cr.PropertyKind.BOOL_ATTR); - return { - ExpandableBubble: ExpandableBubble - }; + return {ExpandableBubble: ExpandableBubble}; });
diff --git a/ui/webui/resources/js/cr/ui/focus_grid.js b/ui/webui/resources/js/cr/ui/focus_grid.js index cd3205e..e2dc5ad 100644 --- a/ui/webui/resources/js/cr/ui/focus_grid.js +++ b/ui/webui/resources/js/cr/ui/focus_grid.js
@@ -109,9 +109,7 @@ * Adds |row| to the end of this list. * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid. */ - addRow: function(row) { - this.addRowBefore(row, null); - }, + addRow: function(row) { this.addRowBefore(row, null); }, /** * Adds |row| before |nextRow|. If |nextRow| is not in the list or it's
diff --git a/ui/webui/resources/js/cr/ui/focus_manager.js b/ui/webui/resources/js/cr/ui/focus_manager.js index aa6ff4b1..8fb528d 100644 --- a/ui/webui/resources/js/cr/ui/focus_manager.js +++ b/ui/webui/resources/js/cr/ui/focus_manager.js
@@ -9,8 +9,7 @@ * the topmost overlay) do not receive focus. * @constructor */ - function FocusManager() { - } + function FocusManager() {} FocusManager.prototype = { /** @@ -37,9 +36,7 @@ * allowed to receive focus. * @return {Element} The element containing focusable elements. */ - getFocusParent: function() { - return document.body; - }, + getFocusParent: function() { return document.body; }, /** * Returns the elements on the page capable of receiving focus. @@ -50,8 +47,7 @@ // Create a TreeWalker object to traverse the DOM from |focusableDiv|. var treeWalker = document.createTreeWalker( - focusableDiv, - NodeFilter.SHOW_ELEMENT, + focusableDiv, NodeFilter.SHOW_ELEMENT, /** @type {NodeFilter} */ ({ acceptNode: function(node) { @@ -150,7 +146,7 @@ onDocumentFocus_: function(event) { // If the element being focused is a descendant of the currently visible // page, focus is valid. - var targetNode = /** @type {Node} */(event.target); + var targetNode = /** @type {Node} */ (event.target); if (this.isDescendantOf_(this.getFocusParent(), targetNode)) { this.dispatchFocusEvent_(event.target); return; @@ -187,10 +183,10 @@ * Initializes the FocusManager by listening for events in the document. */ initialize: function() { - document.addEventListener('focus', this.onDocumentFocus_.bind(this), - true); - document.addEventListener('keydown', this.onDocumentKeyDown_.bind(this), - true); + document.addEventListener( + 'focus', this.onDocumentFocus_.bind(this), true); + document.addEventListener( + 'keydown', this.onDocumentKeyDown_.bind(this), true); }, };
diff --git a/ui/webui/resources/js/cr/ui/focus_outline_manager.js b/ui/webui/resources/js/cr/ui/focus_outline_manager.js index 5a8ed8e..8ca4f92 100644 --- a/ui/webui/resources/js/cr/ui/focus_outline_manager.js +++ b/ui/webui/resources/js/cr/ui/focus_outline_manager.js
@@ -31,13 +31,11 @@ var self = this; - doc.addEventListener('keydown', function(e) { - self.focusByKeyboard_ = true; - }, true); + doc.addEventListener( + 'keydown', function(e) { self.focusByKeyboard_ = true; }, true); - doc.addEventListener('mousedown', function(e) { - self.focusByKeyboard_ = false; - }, true); + doc.addEventListener( + 'mousedown', function(e) { self.focusByKeyboard_ = false; }, true); doc.addEventListener('focus', function(event) { // Update visibility only when focus is actually changed. @@ -64,20 +62,14 @@ */ focusByKeyboard_: true, - updateVisibility: function() { - this.visible = this.focusByKeyboard_; - }, + updateVisibility: function() { this.visible = this.focusByKeyboard_; }, /** * Whether the focus outline should be visible. * @type {boolean} */ - set visible(visible) { - this.classList_.toggle(CLASS_NAME, visible); - }, - get visible() { - return this.classList_.contains(CLASS_NAME); - } + set visible(visible) { this.classList_.toggle(CLASS_NAME, visible); }, + get visible() { return this.classList_.contains(CLASS_NAME); } }; /** @@ -102,7 +94,5 @@ return manager; }; - return { - FocusOutlineManager: FocusOutlineManager - }; + return {FocusOutlineManager: FocusOutlineManager}; });
diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js index 415c1ea9..36b5865 100644 --- a/ui/webui/resources/js/cr/ui/focus_row.js +++ b/ui/webui/resources/js/cr/ui/focus_row.js
@@ -121,15 +121,12 @@ this.eventTracker.add(element, 'blur', this.onBlur_.bind(this)); this.eventTracker.add(element, 'focus', this.onFocus_.bind(this)); this.eventTracker.add(element, 'keydown', this.onKeydown_.bind(this)); - this.eventTracker.add(element, 'mousedown', - this.onMousedown_.bind(this)); + this.eventTracker.add(element, 'mousedown', this.onMousedown_.bind(this)); return true; }, /** Dereferences nodes and removes event handlers. */ - destroy: function() { - this.eventTracker.removeAll(); - }, + destroy: function() { this.eventTracker.removeAll(); }, /** * @param {!Element} sampleElement An element for to find an equivalent for. @@ -222,10 +219,10 @@ * @private */ onBlur_: function(e) { - if (!this.boundary_.contains(/** @type {Element} */(e.relatedTarget))) + if (!this.boundary_.contains(/** @type {Element} */ (e.relatedTarget))) return; - var currentTarget = /** @type {!Element} */(e.currentTarget); + var currentTarget = /** @type {!Element} */ (e.currentTarget); if (this.getFocusableElements().indexOf(currentTarget) >= 0) this.makeActive(false); }, @@ -259,7 +256,7 @@ */ onKeydown_: function(e) { var elements = this.getFocusableElements(); - var currentElement = /** @type {!Element} */(e.currentTarget); + var currentElement = /** @type {!Element} */ (e.currentTarget); var elementIndex = elements.indexOf(currentElement); assert(elementIndex >= 0);
diff --git a/ui/webui/resources/js/cr/ui/grid.js b/ui/webui/resources/js/cr/ui/grid.js index 6d7ba8c..aa0b9288 100644 --- a/ui/webui/resources/js/cr/ui/grid.js +++ b/ui/webui/resources/js/cr/ui/grid.js
@@ -73,9 +73,7 @@ * Shows a warning at the setter because cr.ui.Grid does not support this. * @type {boolean} */ - get fixedHeight() { - return true; - }, + get fixedHeight() { return true; }, set fixedHeight(fixedHeight) { if (!fixedHeight) console.warn('cr.ui.Grid does not support fixedHeight = false'); @@ -208,18 +206,14 @@ * of multiple columns. * @override */ - getItemRow: function(index) { - return Math.floor(index / this.columns); - }, + getItemRow: function(index) { return Math.floor(index / this.columns); }, /** * @param {number} row The row. * @return {number} The index of the first item in the row. * @override */ - getFirstItemInRow: function(row) { - return row * this.columns; - }, + getFirstItemInRow: function(row) { return row * this.columns; }, /** * Creates the selection controller to use internally. @@ -245,16 +239,14 @@ var firstIndex = this.autoExpands ? 0 : this.getIndexForListOffset_(scrollTop); var columns = this.columns; - var count = this.autoExpands_ ? this.dataModel.length : Math.max( - columns * (Math.ceil(clientHeight / itemHeight) + 1), - this.countItemsInRange_(firstIndex, scrollTop + clientHeight)); + var count = this.autoExpands_ ? + this.dataModel.length : + Math.max( + columns * (Math.ceil(clientHeight / itemHeight) + 1), + this.countItemsInRange_(firstIndex, scrollTop + clientHeight)); count = columns * Math.ceil(count / columns); count = Math.min(count, this.dataModel.length - firstIndex); - return { - first: firstIndex, - length: count, - last: firstIndex + count - 1 - }; + return {first: firstIndex, length: count, last: firstIndex + count - 1}; }, /** @@ -301,7 +293,7 @@ function isSpacer(child) { return child.classList.contains('spacer') && - child != afterFiller; // Must not be removed. + child != afterFiller; // Must not be removed. } }, @@ -329,7 +321,7 @@ isItem: function(child) { // Non-items are before-, afterFiller and spacers added in mergeItems. return child.nodeType == Node.ELEMENT_NODE && - !child.classList.contains('spacer'); + !child.classList.contains('spacer'); }, redraw: function() { @@ -371,8 +363,8 @@ */ isAccessibilityEnabled: function() { return window.cvox && window.cvox.Api && - window.cvox.Api.isChromeVoxActive && - window.cvox.Api.isChromeVoxActive(); + window.cvox.Api.isChromeVoxActive && + window.cvox.Api.isChromeVoxActive(); }, /** @@ -412,9 +404,7 @@ * @return {number} The index before or -1 if not found. * @override */ - getIndexBefore: function(index) { - return index - 1; - }, + getIndexBefore: function(index) { return index - 1; }, /** * Returns the index after (x axis) the given element.
diff --git a/ui/webui/resources/js/cr/ui/list.js b/ui/webui/resources/js/cr/ui/list.js index d85af80..a5a0b99 100644 --- a/ui/webui/resources/js/cr/ui/list.js +++ b/ui/webui/resources/js/cr/ui/list.js
@@ -28,9 +28,9 @@ var x = e.clientX; var y = e.clientY; return x >= rect.left + el.clientLeft && - x < rect.left + el.clientLeft + el.clientWidth && - y >= rect.top + el.clientTop && - y < rect.top + el.clientTop + el.clientHeight; + x < rect.left + el.clientLeft + el.clientWidth && + y >= rect.top + el.clientTop && + y < rect.top + el.clientTop + el.clientHeight; } function getComputedStyle(el) { @@ -94,9 +94,7 @@ * Function used to create grid items. * @return {function(new:cr.ui.ListItem, *)} */ - get itemConstructor() { - return this.itemConstructor_; - }, + get itemConstructor() { return this.itemConstructor_; }, set itemConstructor(func) { if (func != this.itemConstructor_) { this.itemConstructor_ = func; @@ -124,10 +122,9 @@ if (this.dataModel_) { this.dataModel_.removeEventListener( - 'permuted', - this.boundHandleDataModelPermuted_); - this.dataModel_.removeEventListener('change', - this.boundHandleDataModelChange_); + 'permuted', this.boundHandleDataModelPermuted_); + this.dataModel_.removeEventListener( + 'change', this.boundHandleDataModelChange_); } this.dataModel_ = dataModel; @@ -140,26 +137,22 @@ if (this.dataModel_) { this.dataModel_.addEventListener( - 'permuted', - this.boundHandleDataModelPermuted_); - this.dataModel_.addEventListener('change', - this.boundHandleDataModelChange_); + 'permuted', this.boundHandleDataModelPermuted_); + this.dataModel_.addEventListener( + 'change', this.boundHandleDataModelChange_); } this.redraw(); this.onSetDataModelComplete(); }, - get dataModel() { - return this.dataModel_; - }, + get dataModel() { return this.dataModel_; }, /** * Override to be notified when |this.dataModel| is set. * @protected */ - onSetDataModelComplete: function() { - }, + onSetDataModelComplete: function() {}, /** * Cached item for measuring the default item size by measureItem(). @@ -171,9 +164,7 @@ * The selection model to use. * @type {cr.ui.ListSelectionModel} */ - get selectionModel() { - return this.selectionModel_; - }, + get selectionModel() { return this.selectionModel_; }, set selectionModel(sm) { var oldSm = this.selectionModel_; if (oldSm == sm) @@ -186,8 +177,8 @@ if (oldSm) { oldSm.removeEventListener('change', this.boundHandleOnChange_); - oldSm.removeEventListener('leadIndexChange', - this.boundHandleLeadChange_); + oldSm.removeEventListener( + 'leadIndexChange', this.boundHandleLeadChange_); } this.selectionModel_ = sm; @@ -203,9 +194,7 @@ * Whether or not the list auto-expands. * @type {boolean} */ - get autoExpands() { - return this.autoExpands_; - }, + get autoExpands() { return this.autoExpands_; }, set autoExpands(autoExpands) { if (this.autoExpands_ == autoExpands) return; @@ -217,9 +206,7 @@ * Whether or not the rows on list have various heights. * @type {boolean} */ - get fixedHeight() { - return this.fixedHeight_; - }, + get fixedHeight() { return this.fixedHeight_; }, set fixedHeight(fixedHeight) { if (this.fixedHeight_ == fixedHeight) return; @@ -256,9 +243,7 @@ var indexes = this.selectionModel.selectedIndexes; var dataModel = this.dataModel; if (dataModel) { - return indexes.map(function(i) { - return dataModel.item(i); - }); + return indexes.map(function(i) { return dataModel.item(i); }); } return []; }, @@ -268,8 +253,7 @@ * @type {HTMLCollection} */ get items() { - return Array.prototype.filter.call(this.children, - this.isItem, this); + return Array.prototype.filter.call(this.children, this.isItem, this); }, /** @@ -280,7 +264,7 @@ */ isItem: function(child) { return child.nodeType == Node.ELEMENT_NODE && - child != this.beforeFiller_ && child != this.afterFiller_; + child != this.beforeFiller_ && child != this.afterFiller_; }, batchCount_: 0, @@ -291,9 +275,7 @@ * sure that the code will not return without calling endBatchUpdates or the * list will not be correctly updated. */ - startBatchUpdates: function() { - this.batchCount_++; - }, + startBatchUpdates: function() { this.batchCount_++; }, /** * See startBatchUpdates. @@ -401,8 +383,14 @@ measureItem: function(opt_item) { var dataModel = this.dataModel; if (!dataModel || !dataModel.length) { - return {height: 0, marginTop: 0, marginBottom: 0, - width: 0, marginLeft: 0, marginRight: 0}; + return { + height: 0, + marginTop: 0, + marginBottom: 0, + width: 0, + marginLeft: 0, + marginRight: 0 + }; } var item = opt_item || this.cachedMeasuredItem_ || this.createItem(dataModel.item(0)); @@ -444,10 +432,13 @@ if (!opt_item) this.removeChild(item); return { - height: Math.max(0, h), - marginTop: mt, marginBottom: mb, - width: Math.max(0, w), - marginLeft: ml, marginRight: mr}; + height: Math.max(0, h), + marginTop: mt, + marginBottom: mb, + width: Math.max(0, w), + marginLeft: ml, + marginRight: mr + }; }, /** @@ -459,7 +450,7 @@ if (this.disabled) return; - var target = /** @type {HTMLElement} */(e.target); + var target = /** @type {HTMLElement} */ (e.target); var ancestor = this.getListItemAncestor(target); var index = -1; @@ -483,7 +474,7 @@ if (this.disabled) return; - var target = /** @type {HTMLElement} */(e.target); + var target = /** @type {HTMLElement} */ (e.target); // If the target was this element we need to make sure that the user did // not click on a border or a scrollbar. @@ -693,17 +684,13 @@ * @return {number} The row of the item. May vary in the case * of multiple columns. */ - getItemRow: function(index) { - return index; - }, + getItemRow: function(index) { return index; }, /** * @param {number} row The row. * @return {number} The index of the first item in the row. */ - getFirstItemInRow: function(row) { - return row; - }, + getFirstItemInRow: function(row) { return row; }, /** * Ensures that a given index is inside the viewport. @@ -720,15 +707,13 @@ var clientHeight = this.clientHeight; var cs = getComputedStyle(this); - var paddingY = parseInt(cs.paddingTop, 10) + - parseInt(cs.paddingBottom, 10); + var paddingY = + parseInt(cs.paddingTop, 10) + parseInt(cs.paddingBottom, 10); var availableHeight = clientHeight - paddingY; var self = this; // Function to adjust the tops of viewport and row. - function scrollToAdjustTop() { - self.scrollTop = top; - } + function scrollToAdjustTop() { self.scrollTop = top; } // Function to adjust the bottoms of viewport and row. function scrollToAdjustBottom() { self.scrollTop = top + itemHeight - availableHeight; @@ -862,8 +847,8 @@ return this.dataModel.length; // Estimates index. - var estimatedIndex = Math.min(Math.floor(offset / itemHeight), - this.dataModel.length - 1); + var estimatedIndex = + Math.min(Math.floor(offset / itemHeight), this.dataModel.length - 1); var isIncrementing = this.getItemTop(estimatedIndex) < offset; // Searchs the correct index. @@ -906,7 +891,8 @@ return { first: 0, length: this.dataModel.length, - last: this.dataModel.length}; + last: this.dataModel.length + }; } else { var firstIndex = this.getIndexForListOffset_(scrollTop); var lastIndex = this.getIndexForListOffset_(scrollTop + clientHeight); @@ -914,7 +900,8 @@ return { first: firstIndex, length: lastIndex - firstIndex + 1, - last: lastIndex + 1}; + last: lastIndex + 1 + }; } }, @@ -933,8 +920,8 @@ function insert() { var dataItem = dataModel.item(currentIndex); - var newItem = self.cachedItems_[currentIndex] || - self.createItem(dataItem); + var newItem = + self.cachedItems_[currentIndex] || self.createItem(dataItem); newItem.listIndex = currentIndex; self.cachedItems_[currentIndex] = newItem; self.insertBefore(newItem, item); @@ -1083,8 +1070,7 @@ // Draws the hidden rows just above/below the viewport to prevent // flashing in scroll. var firstIndex = Math.max( - 0, - Math.min(dataModel.length - 1, itemsInViewPort.first - 1)); + 0, Math.min(dataModel.length - 1, itemsInViewPort.first - 1)); var lastIndex = Math.min(itemsInViewPort.last + 1, dataModel.length); var beforeFillerHeight = @@ -1188,8 +1174,7 @@ * event. * @param {number} index The index of the activated item. */ - activateItemAtIndex: function(index) { - }, + activateItemAtIndex: function(index) {}, /** * Returns a ListItem for the leadIndex. If the item isn't present in the @@ -1208,8 +1193,8 @@ return null; var cachedItems = this.cachedItems_ || {}; - var item = cachedItems[index] || - this.createItem(this.dataModel.item(index)); + var item = + cachedItems[index] || this.createItem(this.dataModel.item(index)); if (this.pinnedItem_ != item && this.pinnedItem_ && this.pinnedItem_.hidden) { this.removeChild(this.pinnedItem_); @@ -1282,7 +1267,7 @@ * @param {Event} e The mouse event object. */ function handleMouseDown(e) { - e.target = /** @type {!HTMLElement} */(e.target); + e.target = /** @type {!HTMLElement} */ (e.target); var listItem = this.getListItemAncestor(e.target); var wasSelected = listItem && listItem.selected; this.handlePointerDownUp_(e); @@ -1314,7 +1299,7 @@ * @param {Event} e The event object for 'dragstart'. */ function handleDragStart(e) { - e = /** @type {MouseEvent} */(e); + e = /** @type {MouseEvent} */ (e); var element = e.target.ownerDocument.elementFromPoint(e.clientX, e.clientY); var listItem = this.getListItemAncestor(element); if (!listItem) @@ -1338,14 +1323,12 @@ */ function containsFocusableElement(start, root) { for (var element = start; element && element != root; - element = element.parentElement) { + element = element.parentElement) { if (element.tabIndex >= 0 && !element.disabled) return true; } return false; } - return { - List: List - }; + return {List: List}; });
diff --git a/ui/webui/resources/js/cr/ui/list_item.js b/ui/webui/resources/js/cr/ui/list_item.js index cb6aacf..d86191a9 100644 --- a/ui/webui/resources/js/cr/ui/list_item.js +++ b/ui/webui/resources/js/cr/ui/list_item.js
@@ -25,12 +25,8 @@ * Plain text label. * @type {string} */ - get label() { - return this.textContent; - }, - set label(label) { - this.textContent = label; - }, + get label() { return this.textContent; }, + set label(label) { this.textContent = label; }, /** * This item's index in the containing list. @@ -50,18 +46,16 @@ /** * Called when the selection state of this element changes. */ - selectionChanged: function() { - }, + selectionChanged: function() {}, }; /** * Whether the item is selected. Setting this does not update the underlying * selection model. This is only used for display purpose. */ - cr.defineProperty(ListItem, 'selected', cr.PropertyKind.BOOL_ATTR, - function() { - this.selectionChanged(); - }); + cr.defineProperty( + ListItem, 'selected', cr.PropertyKind.BOOL_ATTR, + function() { this.selectionChanged(); }); /** * Whether the item is the lead in a selection. Setting this does not update @@ -75,7 +69,5 @@ */ cr.defineProperty(ListItem, 'listIndex'); - return { - ListItem: ListItem - }; + return {ListItem: ListItem}; });
diff --git a/ui/webui/resources/js/cr/ui/list_selection_controller.js b/ui/webui/resources/js/cr/ui/list_selection_controller.js index b2a7abf..ef925ea4 100644 --- a/ui/webui/resources/js/cr/ui/list_selection_controller.js +++ b/ui/webui/resources/js/cr/ui/list_selection_controller.js
@@ -26,9 +26,7 @@ * The selection model we are interacting with. * @type {cr.ui.ListSelectionModel} */ - get selectionModel() { - return this.selectionModel_; - }, + get selectionModel() { return this.selectionModel_; }, /** * Returns the index below (y axis) the given element. @@ -46,9 +44,7 @@ * @param {number} index The index to get the index above. * @return {number} The index below or -1 if not found. */ - getIndexAbove: function(index) { - return index - 1; - }, + getIndexAbove: function(index) { return index - 1; }, /** * Returns the index before (x axis) the given element. This returns -1 @@ -58,9 +54,7 @@ * @param {number} index The index to get the index before. * @return {number} The index before or -1 if not found. */ - getIndexBefore: function(index) { - return -1; - }, + getIndexBefore: function(index) { return -1; }, /** * Returns the index after (x axis) the given element. This returns -1 @@ -70,9 +64,7 @@ * @param {number} index The index to get the index after. * @return {number} The index after or -1 if not found. */ - getIndexAfter: function(index) { - return -1; - }, + getIndexAfter: function(index) { return -1; }, /** * Returns the next list index. This is the next logical and should not @@ -92,23 +84,17 @@ * @param {number} index The index to get the previous index for. * @return {number} The previous index or -1 if not found. */ - getPreviousIndex: function(index) { - return index - 1; - }, + getPreviousIndex: function(index) { return index - 1; }, /** * @return {number} The first index. */ - getFirstIndex: function() { - return 0; - }, + getFirstIndex: function() { return 0; }, /** * @return {number} The last index. */ - getLastIndex: function() { - return this.selectionModel.length - 1; - }, + getLastIndex: function() { return this.selectionModel.length - 1; }, /** * Called by the view when the user does a mousedown or mouseup on the @@ -137,8 +123,8 @@ if (sm.multiple) sm.unselectAll(); } else { - if (sm.multiple && (cr.isMac ? e.metaKey : - (e.ctrlKey && !e.shiftKey))) { + if (sm.multiple && + (cr.isMac ? e.metaKey : (e.ctrlKey && !e.shiftKey))) { // Selection is handled at mouseUp on windows/linux, mouseDown on mac. if (cr.isMac ? isDown : !isDown) { // Toggle the current one and make it anchor index. @@ -187,7 +173,8 @@ if (inputType == 'checkbox' || inputType == 'radio') { if (e.key == ' ') return; - // Protect all but the most basic navigation commands in anything else. + // Protect all but the most basic navigation commands in anything + // else. } else if (e.key != 'ArrowUp' && e.key != 'ArrowDown') { return; } @@ -227,22 +214,22 @@ newIndex = this.getLastIndex(); break; case 'ArrowUp': - newIndex = leadIndex == -1 ? - this.getLastIndex() : this.getIndexAbove(leadIndex); + newIndex = leadIndex == -1 ? this.getLastIndex() : + this.getIndexAbove(leadIndex); break; case 'ArrowDown': - newIndex = leadIndex == -1 ? - this.getFirstIndex() : this.getIndexBelow(leadIndex); + newIndex = leadIndex == -1 ? this.getFirstIndex() : + this.getIndexBelow(leadIndex); break; case 'ArrowLeft': case 'MediaPreviousTrack': - newIndex = leadIndex == -1 ? - this.getLastIndex() : this.getIndexBefore(leadIndex); + newIndex = leadIndex == -1 ? this.getLastIndex() : + this.getIndexBefore(leadIndex); break; case 'ArrowRight': case 'MediaNextTrack': - newIndex = leadIndex == -1 ? - this.getFirstIndex() : this.getIndexAfter(leadIndex); + newIndex = leadIndex == -1 ? this.getFirstIndex() : + this.getIndexAfter(leadIndex); break; default: prevent = false; @@ -280,7 +267,5 @@ } }; - return { - ListSelectionController: ListSelectionController - }; + return {ListSelectionController: ListSelectionController}; });
diff --git a/ui/webui/resources/js/cr/ui/list_selection_model.js b/ui/webui/resources/js/cr/ui/list_selection_model.js index f9aca63..1609e75 100644 --- a/ui/webui/resources/js/cr/ui/list_selection_model.js +++ b/ui/webui/resources/js/cr/ui/list_selection_model.js
@@ -30,9 +30,7 @@ * The number of items in the model. * @type {number} */ - get length() { - return this.length_; - }, + get length() { return this.length_; }, /** * The selected indexes. @@ -229,15 +227,15 @@ // |anchorIndex| has been actually changed in the batch. this.leadIndex_ = this.adjustIndex_(this.leadIndex_); if (this.leadIndex_ != this.oldLeadIndex_) { - cr.dispatchPropertyChange(this, 'leadIndex', - this.leadIndex_, this.oldLeadIndex_); + cr.dispatchPropertyChange( + this, 'leadIndex', this.leadIndex_, this.oldLeadIndex_); } this.oldLeadIndex_ = null; this.anchorIndex_ = this.adjustIndex_(this.anchorIndex_); if (this.anchorIndex_ != this.oldAnchorIndex_) { - cr.dispatchPropertyChange(this, 'anchorIndex', - this.anchorIndex_, this.oldAnchorIndex_); + cr.dispatchPropertyChange( + this, 'anchorIndex', this.anchorIndex_, this.oldAnchorIndex_); } this.oldAnchorIndex_ = null; @@ -264,9 +262,7 @@ * the user is moving using the arrow keys. * @type {number} */ - get leadIndex() { - return this.leadIndex_; - }, + get leadIndex() { return this.leadIndex_; }, set leadIndex(leadIndex) { var oldValue = this.leadIndex_; var newValue = this.adjustIndex_(leadIndex); @@ -283,9 +279,7 @@ * The anchorIndex is used with multiple selection. * @type {number} */ - get anchorIndex() { - return this.anchorIndex_; - }, + get anchorIndex() { return this.anchorIndex_; }, set anchorIndex(anchorIndex) { var oldValue = this.anchorIndex_; var newValue = this.adjustIndex_(anchorIndex); @@ -317,9 +311,7 @@ * Whether the selection model supports multiple selected items. * @type {boolean} */ - get multiple() { - return true; - }, + get multiple() { return true; }, /** * Adjusts the selection after reordering of items in the table. @@ -331,11 +323,10 @@ var oldAnchorIndex = this.anchorIndex; var oldSelectedItemsCount = this.selectedIndexes.length; - this.selectedIndexes = this.selectedIndexes.map(function(oldIndex) { - return permutation[oldIndex]; - }).filter(function(index) { - return index != -1; - }); + this.selectedIndexes = + this.selectedIndexes + .map(function(oldIndex) { return permutation[oldIndex]; }) + .filter(function(index) { return index != -1; }); // Will be adjusted in endChange. if (oldLeadIndex != -1) @@ -357,12 +348,8 @@ * Adjusts selection model length. * @param {number} length New selection model length. */ - adjustLength: function(length) { - this.length_ = length; - } + adjustLength: function(length) { this.length_ = length; } }; - return { - ListSelectionModel: ListSelectionModel - }; + return {ListSelectionModel: ListSelectionModel}; });
diff --git a/ui/webui/resources/js/cr/ui/list_single_selection_model.js b/ui/webui/resources/js/cr/ui/list_single_selection_model.js index 209ee8e8..a5676496b 100644 --- a/ui/webui/resources/js/cr/ui/list_single_selection_model.js +++ b/ui/webui/resources/js/cr/ui/list_single_selection_model.js
@@ -29,9 +29,7 @@ * The number of items in the model. * @type {number} */ - get length() { - return this.length_; - }, + get length() { return this.length_; }, /** * @type {!Array} The selected indexes. @@ -49,9 +47,7 @@ * Setter also changes lead and anchor indexes if value is nonegative. * @type {number} */ - get selectedIndex() { - return this.selectedIndex_; - }, + get selectedIndex() { return this.selectedIndex_; }, set selectedIndex(selectedIndex) { var oldSelectedIndex = this.selectedIndex; var i = Math.max(-1, Math.min(this.length_ - 1, selectedIndex)); @@ -95,9 +91,7 @@ /** * Unselects all selected items. */ - unselectAll: function() { - this.selectedIndex = -1; - }, + unselectAll: function() { this.selectedIndex = -1; }, /** * Sets the selected state for an index. @@ -121,9 +115,7 @@ * @param {number} index The index to check. * @return {boolean} Whether an index is selected. */ - getIndexSelected: function(index) { - return index == this.selectedIndex_; - }, + getIndexSelected: function(index) { return index == this.selectedIndex_; }, /** * This is used to begin batching changes. Call {@code endChange} when you @@ -161,14 +153,11 @@ createChangeEvent: function(eventName) { var e = new Event(eventName); var indexes = [this.selectedIndexBefore_, this.selectedIndex_]; - e.changes = indexes.filter(function(index) { - return index != -1; - }).map(function(index) { - return { - index: index, - selected: index == this.selectedIndex_ - }; - }, this); + e.changes = + indexes.filter(function(index) { return index != -1; }) + .map(function(index) { + return {index: index, selected: index == this.selectedIndex_}; + }, this); return e; }, @@ -180,9 +169,7 @@ * the user is moving using the arrow keys. * @type {number} */ - get leadIndex() { - return this.leadIndex_; - }, + get leadIndex() { return this.leadIndex_; }, set leadIndex(leadIndex) { var li = this.adjustIndex_(leadIndex); if (li != this.leadIndex_) { @@ -204,20 +191,14 @@ * The anchorIndex is used with multiple selection. * @type {number} */ - get anchorIndex() { - return this.leadIndex; - }, - set anchorIndex(anchorIndex) { - this.leadIndex = anchorIndex; - }, + get anchorIndex() { return this.leadIndex; }, + set anchorIndex(anchorIndex) { this.leadIndex = anchorIndex; }, /** * Whether the selection model supports multiple selected items. * @type {boolean} */ - get multiple() { - return false; - }, + get multiple() { return false; }, /** * Adjusts the selection after reordering of items in the table. @@ -237,12 +218,8 @@ * Adjusts selection model length. * @param {number} length New selection model length. */ - adjustLength: function(length) { - this.length_ = length; - } + adjustLength: function(length) { this.length_ = length; } }; - return { - ListSingleSelectionModel: ListSingleSelectionModel - }; + return {ListSingleSelectionModel: ListSingleSelectionModel}; });
diff --git a/ui/webui/resources/js/cr/ui/menu.js b/ui/webui/resources/js/cr/ui/menu.js index fbf0522c..cac465d 100644 --- a/ui/webui/resources/js/cr/ui/menu.js +++ b/ui/webui/resources/js/cr/ui/menu.js
@@ -77,9 +77,7 @@ /** * Clears menu. */ - clear: function() { - this.textContent = ''; - }, + clear: function() { this.textContent = ''; }, /** * Walks up the ancestors of |node| until a menu item belonging to this menu @@ -101,7 +99,7 @@ * @private */ handleMouseOver_: function(e) { - var overItem = this.findMenuItem_(/** @type {Element} */(e.target)); + var overItem = this.findMenuItem_(/** @type {Element} */ (e.target)); this.selectedItem = overItem; }, @@ -110,9 +108,7 @@ * @param {Event} e The mouseout event. * @private */ - handleMouseOut_: function(e) { - this.selectedItem = null; - }, + handleMouseOut_: function(e) { this.selectedItem = null; }, /** * If there's a mouseup that happens quickly in about the same position, @@ -122,7 +118,7 @@ * @private */ handleMouseUp_: function(e) { - assert(this.contains(/** @type {Element} */(e.target))); + assert(this.contains(/** @type {Element} */ (e.target))); if (!this.trustEvent_(e) || Date.now() - this.shown_.time > 200) return; @@ -141,9 +137,7 @@ * @private * @suppress {checkTypes} */ - trustEvent_: function(e) { - return e.isTrusted || e.isTrustedForTesting; - }, + trustEvent_: function(e) { return e.isTrusted || e.isTrustedForTesting; }, get menuItems() { return this.querySelectorAll(this.menuItemSelector || '*'); @@ -153,9 +147,7 @@ * The selected menu item or null if none. * @type {cr.ui.MenuItem} */ - get selectedItem() { - return this.menuItems[this.selectedIndex]; - }, + get selectedItem() { return this.menuItems[this.selectedIndex]; }, set selectedItem(item) { var index = Array.prototype.indexOf.call(this.menuItems, item); this.selectedIndex = index; @@ -180,9 +172,7 @@ /** * Menu length */ - get length() { - return this.menuItems.length; - }, + get length() { return this.menuItems.length; }, /** * Returns if the menu has any visible item. @@ -310,8 +300,8 @@ * The selected menu item. * type {number} */ - cr.defineProperty(Menu, 'selectedIndex', cr.PropertyKind.JS, - selectedIndexChanged); + cr.defineProperty( + Menu, 'selectedIndex', cr.PropertyKind.JS, selectedIndexChanged); /** * Selector for children which are menu items. @@ -319,7 +309,5 @@ cr.defineProperty(Menu, 'menuItemSelector', cr.PropertyKind.ATTR); // Export - return { - Menu: Menu - }; + return {Menu: Menu}; });
diff --git a/ui/webui/resources/js/cr/ui/menu_button.js b/ui/webui/resources/js/cr/ui/menu_button.js index ff6c256..a42aa3e 100644 --- a/ui/webui/resources/js/cr/ui/menu_button.js +++ b/ui/webui/resources/js/cr/ui/menu_button.js
@@ -67,9 +67,7 @@ * The menu associated with the menu button. * @type {cr.ui.Menu} */ - get menu() { - return this.menu_; - }, + get menu() { return this.menu_; }, set menu(menu) { if (typeof menu == 'string' && menu[0] == '#') { menu = assert(this.ownerDocument.getElementById(menu.slice(1))); @@ -143,8 +141,8 @@ } break; case 'activate': - var hideDelayed = e.target instanceof cr.ui.MenuItem && - e.target.checkable; + var hideDelayed = + e.target instanceof cr.ui.MenuItem && e.target.checkable; this.hideMenu(hideDelayed ? HideType.DELAYED : HideType.INSTANT); break; case 'scroll': @@ -183,11 +181,8 @@ this.menu.updateCommands(this); - var event = new UIEvent('menushow',{ - bubbles: true, - cancelable: true, - view: window - }); + var event = new UIEvent( + 'menushow', {bubbles: true, cancelable: true, view: window}); if (!this.dispatchEvent(event)) return; @@ -232,11 +227,8 @@ this.showingEvents_.removeAll(); this.focus(); - var event = new UIEvent('menuhide', { - bubbles: true, - cancelable: false, - view: window - }); + var event = new UIEvent( + 'menuhide', {bubbles: true, cancelable: false, view: window}); this.dispatchEvent(event); // On windows we might hide the menu in a right mouse button up and if @@ -248,9 +240,7 @@ /** * Whether the menu is shown. */ - isMenuShown: function() { - return this.hasAttribute('menu-shown'); - }, + isMenuShown: function() { return this.hasAttribute('menu-shown'); }, /** * Positions the menu below the menu button. At this point we do not use any @@ -258,8 +248,8 @@ * @private */ positionMenu_: function() { - positionPopupAroundElement(this, this.menu, this.anchorType, - this.invertLeftRight); + positionPopupAroundElement( + this, this.menu, this.anchorType, this.invertLeftRight); }, /**
diff --git a/ui/webui/resources/js/cr/ui/menu_item.js b/ui/webui/resources/js/cr/ui/menu_item.js index bfe7eaa..eaf5b62 100644 --- a/ui/webui/resources/js/cr/ui/menu_item.js +++ b/ui/webui/resources/js/cr/ui/menu_item.js
@@ -58,9 +58,7 @@ * @type {cr.ui.Command} */ command_: null, - get command() { - return this.command_; - }, + get command() { return this.command_; }, set command(command) { if (this.command_) { this.command_.removeEventListener('labelChange', this); @@ -98,30 +96,20 @@ * The text label. * @type {string} */ - get label() { - return this.textContent; - }, - set label(label) { - this.textContent = label; - }, + get label() { return this.textContent; }, + set label(label) { this.textContent = label; }, /** * Menu icon. * @type {string} */ - get iconUrl() { - return this.style.backgroundImage; - }, - set iconUrl(url) { - this.style.backgroundImage = 'url(' + url + ')'; - }, + get iconUrl() { return this.style.backgroundImage; }, + set iconUrl(url) { this.style.backgroundImage = 'url(' + url + ')'; }, /** * @return {boolean} Whether the menu item is a separator. */ - isSeparator: function() { - return this.tagName == 'HR'; - }, + isSeparator: function() { return this.tagName == 'HR'; }, /** * Updates shortcut text according to associated command. If command has @@ -130,8 +118,7 @@ updateShortcut_: function() { this.removeAttribute('shortcutText'); - if (!this.command_ || - !this.command_.shortcut || + if (!this.command_ || !this.command_.shortcut || this.command_.hideShortcutText) return; @@ -185,7 +172,7 @@ * @private */ handleMouseUp_: function(e) { - e = /** @type {!MouseEvent} */(e); + e = /** @type {!MouseEvent} */ (e); // Only dispatch an activate event for left or middle click. if (e.button > 1) return; @@ -193,8 +180,9 @@ if (!this.disabled && !this.isSeparator() && this.selected) { // Store |contextElement| since it'll be removed by {Menu} on handling // 'activate' event. - var contextElement = /** @type {{contextElement: Element}} */( - this.parentNode).contextElement; + var contextElement = + /** @type {{contextElement: Element}} */ (this.parentNode) + .contextElement; var activationEvent = cr.doc.createEvent('Event'); activationEvent.initEvent('activate', true, true); activationEvent.originalEvent = e; @@ -267,7 +255,5 @@ cr.defineProperty(MenuItem, 'checkable', cr.PropertyKind.BOOL_ATTR); // Export - return { - MenuItem: MenuItem - }; + return {MenuItem: MenuItem}; });
diff --git a/ui/webui/resources/js/cr/ui/overlay.js b/ui/webui/resources/js/cr/ui/overlay.js index c7b19e61..2ea09c34 100644 --- a/ui/webui/resources/js/cr/ui/overlay.js +++ b/ui/webui/resources/js/cr/ui/overlay.js
@@ -13,7 +13,7 @@ * @return {HTMLElement} The overlay. */ function getTopOverlay() { - var overlays = /** @type !NodeList<!HTMLElement> */( + var overlays = /** @type !NodeList<!HTMLElement> */ ( document.querySelectorAll('.overlay:not([hidden])')); return overlays[overlays.length - 1]; } @@ -27,7 +27,7 @@ */ function getDefaultButton(overlay) { function isHidden(node) { return node.hidden; } - var defaultButtons = /** @type !NodeList<!HTMLElement> */( + var defaultButtons = /** @type !NodeList<!HTMLElement> */ ( overlay.querySelectorAll('.page .button-strip > .default-button')); for (var i = 0; i < defaultButtons.length; i++) { if (!findAncestor(defaultButtons[i], isHidden)) @@ -81,8 +81,7 @@ * height. */ function setMaxHeightAllPages() { - var pages = document.querySelectorAll( - '.overlay .page:not(.not-resizable)'); + var pages = document.querySelectorAll('.overlay .page:not(.not-resizable)'); var maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px'; for (var i = 0; i < pages.length; i++) @@ -112,9 +111,8 @@ else this.removeAttribute('hidden'); }); - overlay.__defineGetter__('hidden', function() { - return this.hasAttribute('hidden'); - }); + overlay.__defineGetter__( + 'hidden', function() { return this.hasAttribute('hidden'); }); // Shake when the user clicks away. overlay.addEventListener('click', function(e) {
diff --git a/ui/webui/resources/js/cr/ui/page_manager/page.js b/ui/webui/resources/js/cr/ui/page_manager/page.js index a78da80..d4ad8929 100644 --- a/ui/webui/resources/js/cr/ui/page_manager/page.js +++ b/ui/webui/resources/js/cr/ui/page_manager/page.js
@@ -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 src="../node_utils.js"> +// <include src="../node_utils.js"> cr.define('cr.ui.pageManager', function() { var PageManager = cr.ui.pageManager.PageManager; @@ -78,9 +78,7 @@ * Sets focus on the first focusable element. Override for a custom focus * strategy. */ - focus: function() { - cr.ui.setInitialFocus(this.pageDiv); - }, + focus: function() { cr.ui.setInitialFocus(this.pageDiv); }, /** * Reverse any buttons strips in this page (only applies to overlays). @@ -96,9 +94,7 @@ * Whether it should be possible to show the page. * @return {boolean} True if the page should be shown. */ - canShowPage: function() { - return true; - }, + canShowPage: function() { return true; }, /** * Updates the hash of the current page. If the page is topmost, the history @@ -152,8 +148,7 @@ get visible() { // If this is an overlay dialog it is no longer considered visible while // the overlay is fading out. See http://crbug.com/118629. - if (this.isOverlay && - this.container.classList.contains('transparent')) { + if (this.isOverlay && this.container.classList.contains('transparent')) { return false; } if (this.pageDiv.hidden) @@ -188,17 +183,13 @@ * page even if sub-pages change. * @type {boolean} True if this page is sticky. */ - get sticky() { - return false; - }, + get sticky() { return false; }, /** * @type {boolean} True if this page should always be considered the * top-most page when visible. */ - get alwaysOnTop() { - return this.alwaysOnTop_; - }, + get alwaysOnTop() { return this.alwaysOnTop_; }, /** * @type {boolean} True if this page should always be considered the @@ -244,13 +235,13 @@ // TODO(flackr): Use an event delegate to avoid having to subscribe and // unsubscribe for webkitTransitionEnd events. container.addEventListener('webkitTransitionEnd', function f(e) { - var propName = e.propertyName; - if (e.target != e.currentTarget || - (propName && propName != 'opacity')) { - return; - } - container.removeEventListener('webkitTransitionEnd', f); - self.fadeCompleted_(); + var propName = e.propertyName; + if (e.target != e.currentTarget || + (propName && propName != 'opacity')) { + return; + } + container.removeEventListener('webkitTransitionEnd', f); + self.fadeCompleted_(); }); // -webkit-transition is 200ms. Let's wait for 400ms. ensureTransitionEndEvent(container, 400); @@ -267,8 +258,8 @@ this.pageDiv.removeAttribute('aria-hidden'); if (this.parentPage) { - this.parentPage.pageDiv.parentElement.setAttribute('aria-hidden', - true); + this.parentPage.pageDiv.parentElement.setAttribute( + 'aria-hidden', true); } container.classList.remove('transparent'); PageManager.onPageVisibilityChanged(this); @@ -301,7 +292,5 @@ }; // Export - return { - Page: Page - }; + return {Page: Page}; });
diff --git a/ui/webui/resources/js/cr/ui/page_manager/page_manager.js b/ui/webui/resources/js/cr/ui/page_manager/page_manager.js index 9d2492b..325bacf 100644 --- a/ui/webui/resources/js/cr/ui/page_manager/page_manager.js +++ b/ui/webui/resources/js/cr/ui/page_manager/page_manager.js
@@ -61,13 +61,13 @@ this.handleScroll_(); // Shake the dialog if the user clicks outside the dialog bounds. - var containers = /** @type {!NodeList<!HTMLElement>} */( + var containers = /** @type {!NodeList<!HTMLElement>} */ ( document.querySelectorAll('body > .overlay')); for (var i = 0; i < containers.length; i++) { var overlay = containers[i]; cr.ui.overlay.setupOverlay(overlay); - overlay.addEventListener('cancelOverlay', - this.cancelOverlay.bind(this)); + overlay.addEventListener( + 'cancelOverlay', this.cancelOverlay.bind(this)); } cr.ui.overlay.globalInitialization(); @@ -90,9 +90,7 @@ * @param {Array} associatedControls Array of control elements associated * with this page. */ - registerOverlay: function(overlay, - parentPage, - associatedControls) { + registerOverlay: function(overlay, parentPage, associatedControls) { this.registeredOverlayPages[overlay.name.toLowerCase()] = overlay; overlay.parentPage = parentPage; if (associatedControls) { @@ -121,8 +119,9 @@ * showing the page (defaults to true). */ showDefaultPage: function(opt_updateHistory) { - assert(this.defaultPage_ instanceof cr.ui.pageManager.Page, - 'PageManager must be initialized with a default page.'); + assert( + this.defaultPage_ instanceof cr.ui.pageManager.Page, + 'PageManager must be initialized with a default page.'); this.showPageByName(this.defaultPage_.name, opt_updateHistory); }, @@ -135,9 +134,7 @@ * replaceState (if history state should be replaced instead of pushed). * hash (a hash state to attach to the page). */ - showPageByName: function(pageName, - opt_updateHistory, - opt_propertyBag) { + showPageByName: function(pageName, opt_updateHistory, opt_propertyBag) { opt_updateHistory = opt_updateHistory !== false; opt_propertyBag = opt_propertyBag || {}; @@ -188,8 +185,8 @@ // Update visibilities to show only the hierarchy of the target page. this.forEachPage_(!isRootPageLocked, function(page) { - page.visible = page.name == pageName || - this.isAncestorOfPage(page, targetPage); + page.visible = + page.name == pageName || this.isAncestorOfPage(page, targetPage); }); // Update the history and current location. @@ -276,7 +273,7 @@ */ isTopLevelOverlay: function(page) { return page.isOverlay && - (page.alwaysOnTop || this.getNestingLevel(page) == 1); + (page.alwaysOnTop || this.getNestingLevel(page) == 1); }, /** @@ -409,8 +406,7 @@ var currentOverlay = this.getVisibleOverlay_(); var lowercaseName = pageName.toLowerCase(); var newPage = this.registeredPages[lowercaseName] || - this.registeredOverlayPages[lowercaseName] || - this.defaultPage_; + this.registeredOverlayPages[lowercaseName] || this.defaultPage_; if (currentOverlay && !this.isAncestorOfPage(currentOverlay, newPage)) { currentOverlay.visible = false; currentOverlay.didClosePage(); @@ -451,17 +447,13 @@ * Change the horizontal offset used to reposition elements while showing an * overlay from the default. */ - set horizontalOffset(value) { - this.horizontalOffset_ = value; - }, + set horizontalOffset(value) { this.horizontalOffset_ = value; }, /** * @param {!cr.ui.pageManager.PageManager.Observer} observer The observer to * register. */ - addObserver: function(observer) { - this.observers_.push(observer); - }, + addObserver: function(observer) { this.observers_.push(observer); }, /** * Shows a registered overlay page. Does not update history. @@ -484,8 +476,7 @@ if (currentPage && focusOutlineManager.visible) currentPage.lastFocusedElement = document.activeElement; - if ((!rootPage || !rootPage.sticky) && - overlay.parentPage && + if ((!rootPage || !rootPage.sticky) && overlay.parentPage && !overlay.parentPage.visible) { this.showPageByName(overlay.parentPage.name, false); } @@ -518,9 +509,7 @@ * @return {boolean} True if an overlay is visible. * @private */ - isOverlayVisible_: function() { - return this.getVisibleOverlay_() != null; - }, + isOverlayVisible_: function() { return this.getVisibleOverlay_() != null; }, /** * Returns the currently visible overlay, or null if no page is visible. @@ -538,7 +527,7 @@ return page; if (!topmostPage || - this.getNestingLevel(page) > this.getNestingLevel(topmostPage)) { + this.getNestingLevel(page) > this.getNestingLevel(topmostPage)) { topmostPage = page; } } @@ -684,9 +673,7 @@ * but should only behave as if they are fixed for vertical scrolling. * @private */ - handleScroll_: function() { - this.updateAllFrozenElementPositions_(); - }, + handleScroll_: function() { this.updateAllFrozenElementPositions_(); }, /** * Updates all frozen pages to match the horizontal scroll position. @@ -725,8 +712,9 @@ pageNames = Object.keys(this.registeredPages).concat(pageNames); pageNames.forEach(function(name) { - callback.call(this, this.registeredOverlayPages[name] || - this.registeredPages[name]); + callback.call( + this, + this.registeredOverlayPages[name] || this.registeredPages[name]); }, this); }, }; @@ -735,7 +723,7 @@ * An observer of PageManager. * @interface */ - PageManager.Observer = function() {} + PageManager.Observer = function() {}; PageManager.Observer.prototype = { /** @@ -759,7 +747,5 @@ }; // Export - return { - PageManager: PageManager - }; + return {PageManager: PageManager}; });
diff --git a/ui/webui/resources/js/cr/ui/position_util.js b/ui/webui/resources/js/cr/ui/position_util.js index c0c483b..dc7ea03 100644 --- a/ui/webui/resources/js/cr/ui/position_util.js +++ b/ui/webui/resources/js/cr/ui/position_util.js
@@ -57,8 +57,8 @@ * @param {boolean=} opt_invertLeftRight Whether to invert the right/left * alignment. */ - function positionPopupAroundRect(anchorRect, popupElement, type, - opt_invertLeftRight) { + function positionPopupAroundRect( + anchorRect, popupElement, type, opt_invertLeftRight) { var popupRect = popupElement.getBoundingClientRect(); var availRect; var ownerDoc = popupElement.ownerDocument; @@ -161,11 +161,11 @@ if (anchorRect.right - popupRect.width >= 0) { style.right = availRect.width - anchorRect.right + 'px'; - // align left edges + // align left edges } else if (anchorRect.left + popupRect.width <= availRect.width) { style.left = anchorRect.left + 'px'; - // not enough room on either side + // not enough room on either side } else { style.right = '0'; } @@ -174,11 +174,11 @@ if (anchorRect.left + popupRect.width <= availRect.width) { style.left = anchorRect.left + 'px'; - // align right edges + // align right edges } else if (anchorRect.right - popupRect.width >= 0) { style.right = availRect.width - anchorRect.right + 'px'; - // not enough room on either side + // not enough room on either side } else { style.left = '0'; } @@ -191,7 +191,7 @@ if (anchorRect.top + popupRect.height <= availRect.height) { style.top = anchorRect.top + 'px'; - // align bottom edges + // align bottom edges } else if (anchorRect.bottom - popupRect.height >= 0) { style.bottom = availRect.height - anchorRect.bottom + 'px'; @@ -214,11 +214,11 @@ * @param {boolean=} opt_invertLeftRight Whether to invert the right/left * alignment. */ - function positionPopupAroundElement(anchorElement, popupElement, type, - opt_invertLeftRight) { + function positionPopupAroundElement( + anchorElement, popupElement, type, opt_invertLeftRight) { var anchorRect = anchorElement.getBoundingClientRect(); - positionPopupAroundRect(anchorRect, popupElement, type, - !!opt_invertLeftRight); + positionPopupAroundRect( + anchorRect, popupElement, type, !!opt_invertLeftRight); } /** @@ -229,14 +229,7 @@ * @param {cr.ui.AnchorType=} opt_anchorType The type of anchoring we want. */ function positionPopupAtPoint(x, y, popupElement, opt_anchorType) { - var rect = { - left: x, - top: y, - width: 0, - height: 0, - right: x, - bottom: y - }; + var rect = {left: x, top: y, width: 0, height: 0, right: x, bottom: y}; var anchorType = opt_anchorType || AnchorType.BELOW; positionPopupAroundRect(rect, popupElement, anchorType);
diff --git a/ui/webui/resources/js/cr/ui/repeating_button.js b/ui/webui/resources/js/cr/ui/repeating_button.js index 696ff9f..26124fd9 100644 --- a/ui/webui/resources/js/cr/ui/repeating_button.js +++ b/ui/webui/resources/js/cr/ui/repeating_button.js
@@ -15,9 +15,7 @@ /** * DOM Events that may be fired by the Repeating button. */ - RepeatingButton.Event = { - BUTTON_HELD: 'buttonHeld' - }; + RepeatingButton.Event = {BUTTON_HELD: 'buttonHeld'}; RepeatingButton.prototype = { __proto__: HTMLButtonElement.prototype, @@ -104,12 +102,12 @@ if (typeof self.armRepeaterCallbackId_ != 'undefined') { self.armRepeaterCallbackId_ = undefined; self.buttonHeld_(); - self.intervalCallbackId_ = setInterval(self.buttonHeld_.bind(self), - self.holdRepeatIntervalTime_); + self.intervalCallbackId_ = setInterval( + self.buttonHeld_.bind(self), self.holdRepeatIntervalTime_); } }; - this.armRepeaterCallbackId_ = setTimeout(armRepeaterCallback, - this.holdDelayTime_); + this.armRepeaterCallbackId_ = + setTimeout(armRepeaterCallback, this.holdDelayTime_); }, /** @@ -117,9 +115,7 @@ * @param {!Event} e The triggered event. * @private */ - buttonUp_: function(e) { - this.clearTimeout_(); - }, + buttonUp_: function(e) { this.clearTimeout_(); }, /** * Resets the interval callback. @@ -148,37 +144,26 @@ * Getter for the initial delay before repeating. * @type {number} The delay in milliseconds. */ - get repeatDelay() { - return this.holdDelayTime_; - }, + get repeatDelay() { return this.holdDelayTime_; }, /** * Setter for the initial delay before repeating. * @type {number} The delay in milliseconds. */ - set repeatDelay(delay) { - this.holdDelayTime_ = delay; - }, + set repeatDelay(delay) { this.holdDelayTime_ = delay; }, /** * Getter for the repeat interval. * @type {number} The repeat interval in milliseconds. */ - get repeatInterval() { - return this.holdRepeatIntervalTime_; - }, + get repeatInterval() { return this.holdRepeatIntervalTime_; }, /** * Setter for the repeat interval. * @type {number} The interval in milliseconds. */ - set repeatInterval(delay) { - this.holdRepeatIntervalTime_ = delay; - } + set repeatInterval(delay) { this.holdRepeatIntervalTime_ = delay; } }; - return { - RepeatingButton: RepeatingButton - }; + return {RepeatingButton: RepeatingButton}; }); -
diff --git a/ui/webui/resources/js/cr/ui/splitter.js b/ui/webui/resources/js/cr/ui/splitter.js index c457e421..b2c601a 100644 --- a/ui/webui/resources/js/cr/ui/splitter.js +++ b/ui/webui/resources/js/cr/ui/splitter.js
@@ -42,8 +42,8 @@ */ function getZoomFactor(doc) { var dummyElement = doc.createElement('div'); - dummyElement.style.cssText = - 'position:absolute;width:100px;height:100px;top:-1000px;overflow:hidden'; + dummyElement.style.cssText = 'position:absolute;width:100px;height:100px;' + + 'top:-1000px;overflow:hidden'; doc.body.appendChild(dummyElement); var cs = doc.defaultView.getComputedStyle(dummyElement); var rect = dummyElement.getBoundingClientRect(); @@ -67,10 +67,10 @@ * Initializes the element. */ decorate: function() { - this.addEventListener('mousedown', this.handleMouseDown_.bind(this), - true); - this.addEventListener('touchstart', this.handleTouchStart_.bind(this), - true); + this.addEventListener( + 'mousedown', this.handleMouseDown_.bind(this), true); + this.addEventListener( + 'touchstart', this.handleTouchStart_.bind(this), true); this.resizeNextElement_ = false; }, @@ -78,9 +78,7 @@ * @param {boolean} resizeNext True if resize the next element. * By default, splitter resizes previous (left) element. */ - set resizeNextElement(resizeNext) { - this.resizeNextElement_ = resizeNext; - }, + set resizeNextElement(resizeNext) { this.resizeNextElement_ = resizeNext; }, /** * Starts the dragging of the splitter. Adds listeners for mouse or touch @@ -162,7 +160,7 @@ * @private */ handleMouseDown_: function(e) { - e = /** @type {!MouseEvent} */(e); + e = /** @type {!MouseEvent} */ (e); if (e.button) return; this.startDrag(e.clientX, false); @@ -176,7 +174,7 @@ * @private */ handleTouchStart_: function(e) { - e = /** @type {!TouchEvent} */(e); + e = /** @type {!TouchEvent} */ (e); if (e.touches.length == 1) { this.startDrag(e.touches[0].clientX, true); e.preventDefault(); @@ -189,9 +187,7 @@ * @param {!MouseEvent} e The mouse event. * @private */ - handleMouseMove_: function(e) { - this.handleMove_(e.clientX); - }, + handleMouseMove_: function(e) { this.handleMove_(e.clientX); }, /** * Handles the touch move event. @@ -209,8 +205,9 @@ * @private */ handleMove_: function(clientX) { - var rtl = this.ownerDocument.defaultView.getComputedStyle(this). - direction == 'rtl'; + var rtl = + this.ownerDocument.defaultView.getComputedStyle(this).direction == + 'rtl'; var dirMultiplier = rtl ? -1 : 1; var deltaX = dirMultiplier * (clientX - this.startX_); this.handleSplitterDragMove(deltaX); @@ -221,9 +218,7 @@ * @param {!MouseEvent} e The mouse event. * @private */ - handleMouseUp_: function(e) { - this.endDrag_(); - }, + handleMouseUp_: function(e) { this.endDrag_(); }, /** * Handles start of the splitter dragging. Saves current width of the @@ -235,8 +230,8 @@ // box sizing the element has. var targetElement = this.getResizeTarget_(); var doc = targetElement.ownerDocument; - this.startWidth_ = parseFloat( - doc.defaultView.getComputedStyle(targetElement).width); + this.startWidth_ = + parseFloat(doc.defaultView.getComputedStyle(targetElement).width); }, /** @@ -259,14 +254,12 @@ // Check if the size changed. var targetElement = this.getResizeTarget_(); var doc = targetElement.ownerDocument; - var computedWidth = parseFloat( - doc.defaultView.getComputedStyle(targetElement).width); + var computedWidth = + parseFloat(doc.defaultView.getComputedStyle(targetElement).width); if (this.startWidth_ != computedWidth) cr.dispatchSimpleEvent(this, 'resize'); }, }; - return { - Splitter: Splitter - }; + return {Splitter: Splitter}; });
diff --git a/ui/webui/resources/js/cr/ui/table.js b/ui/webui/resources/js/cr/ui/table.js index 3e7b301..fed8ea7 100644 --- a/ui/webui/resources/js/cr/ui/table.js +++ b/ui/webui/resources/js/cr/ui/table.js
@@ -32,27 +32,25 @@ * * @type {cr.ui.ArrayDataModel} */ - get dataModel() { - return this.list_.dataModel; - }, + get dataModel() { return this.list_.dataModel; }, set dataModel(dataModel) { if (this.list_.dataModel != dataModel) { if (this.list_.dataModel) { - this.list_.dataModel.removeEventListener('sorted', - this.boundHandleSorted_); - this.list_.dataModel.removeEventListener('change', - this.boundHandleChangeList_); - this.list_.dataModel.removeEventListener('splice', - this.boundHandleChangeList_); + this.list_.dataModel.removeEventListener( + 'sorted', this.boundHandleSorted_); + this.list_.dataModel.removeEventListener( + 'change', this.boundHandleChangeList_); + this.list_.dataModel.removeEventListener( + 'splice', this.boundHandleChangeList_); } this.list_.dataModel = dataModel; if (this.list_.dataModel) { - this.list_.dataModel.addEventListener('sorted', - this.boundHandleSorted_); - this.list_.dataModel.addEventListener('change', - this.boundHandleChangeList_); - this.list_.dataModel.addEventListener('splice', - this.boundHandleChangeList_); + this.list_.dataModel.addEventListener( + 'sorted', this.boundHandleSorted_); + this.list_.dataModel.addEventListener( + 'change', this.boundHandleChangeList_); + this.list_.dataModel.addEventListener( + 'splice', this.boundHandleChangeList_); } this.header_.redraw(); } @@ -63,18 +61,14 @@ * * @type {cr.ui.List} */ - get list() { - return this.list_; - }, + get list() { return this.list_; }, /** * The table column model. * * @type {cr.ui.table.TableColumnModel} */ - get columnModel() { - return this.columnModel_; - }, + get columnModel() { return this.columnModel_; }, set columnModel(columnModel) { if (this.columnModel_ != columnModel) { if (this.columnModel_) @@ -94,9 +88,7 @@ * @type * {cr.ui.ListSelectionModel|cr.ui.ListSingleSelectionModel} */ - get selectionModel() { - return this.list_.selectionModel; - }, + get selectionModel() { return this.list_.selectionModel; }, set selectionModel(selectionModel) { if (this.list_.selectionModel != selectionModel) { if (this.dataModel) @@ -110,27 +102,17 @@ * * @type {boolean} */ - get autoExpands() { - return this.list_.autoExpands; - }, - set autoExpands(autoExpands) { - this.list_.autoExpands = autoExpands; - }, + get autoExpands() { return this.list_.autoExpands; }, + set autoExpands(autoExpands) { this.list_.autoExpands = autoExpands; }, - get fixedHeight() { - return this.list_.fixedHeight; - }, - set fixedHeight(fixedHeight) { - this.list_.fixedHeight = fixedHeight; - }, + get fixedHeight() { return this.list_.fixedHeight; }, + set fixedHeight(fixedHeight) { this.list_.fixedHeight = fixedHeight; }, /** * Returns render function for row. * @return {function(*, cr.ui.Table): HTMLElement} Render function. */ - getRenderFunction: function() { - return this.list_.renderFunction_; - }, + getRenderFunction: function() { return this.list_.renderFunction_; }, /** * Sets render function for row. @@ -150,9 +132,7 @@ * * @type {cr.ui.table.TableColumnModel} */ - get header() { - return this.header_; - }, + get header() { return this.header_; }, /** * Initializes the element. @@ -219,9 +199,7 @@ * Ensures that a given index is inside the viewport. * @param {number} i The index of the item to scroll into view. */ - scrollIndexIntoView: function(i) { - this.list_.scrollIndexIntoView(i); - }, + scrollIndexIntoView: function(i) { this.list_.scrollIndexIntoView(i); }, /** * Find the list item element at the given index. @@ -237,9 +215,7 @@ * After sorting we need to redraw header * @param {Event} e The 'sorted' event. */ - handleSorted_: function(e) { - this.header_.redraw(); - }, + handleSorted_: function(e) { this.header_.redraw(); }, /** * This handles data model 'change' and 'splice' events. @@ -342,10 +318,10 @@ dm.prepareSort(columnId, function() { // Select at most MAXIMUM_ROWS_TO_MEASURE items around visible area. var items = list.getItemsInViewPort(list.scrollTop, listHeight); - var firstIndex = Math.floor(Math.max(0, - (items.last + items.first - MAXIMUM_ROWS_TO_MEASURE) / 2)); - var lastIndex = Math.min(dm.length, - firstIndex + MAXIMUM_ROWS_TO_MEASURE); + var firstIndex = Math.floor(Math.max( + 0, (items.last + items.first - MAXIMUM_ROWS_TO_MEASURE) / 2)); + var lastIndex = + Math.min(dm.length, firstIndex + MAXIMUM_ROWS_TO_MEASURE); for (var i = firstIndex; i < lastIndex; i++) { var item = dm.item(i); var div = doc.createElement('div'); @@ -373,7 +349,5 @@ */ cr.defineProperty(Table, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR); - return { - Table: Table - }; + return {Table: Table}; });
diff --git a/ui/webui/resources/js/cr/ui/table/table_column.js b/ui/webui/resources/js/cr/ui/table/table_column.js index 66f77ec..5977383 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column.js +++ b/ui/webui/resources/js/cr/ui/table/table_column.js
@@ -36,13 +36,13 @@ * @return {cr.ui.table.TableColumn} Clone of the given column. */ clone: function() { - var tableColumn = new TableColumn(this.id_, this.name_, this.width_, - this.endAlign_); + var tableColumn = + new TableColumn(this.id_, this.name_, this.width_, this.endAlign_); tableColumn.renderFunction = this.renderFunction_; tableColumn.headerRenderFunction = this.headerRenderFunction_; tableColumn.defaultOrder = this.defaultOrder_; - tableColumn.visible_ = this.visible_; + tableColumn.visible_ = this.visible_; return tableColumn; }, @@ -75,18 +75,14 @@ * The width of the column. Hidden columns have zero width. * @type {number} */ - get width() { - return this.visible_ ? this.width_ : 0; - }, + get width() { return this.visible_ ? this.width_ : 0; }, /** * The width of the column, disregarding visibility. For hidden columns, * this would be the width of the column if it were to be made visible. * @type {number} */ - get absoluteWidth() { - return this.width_; - }, + get absoluteWidth() { return this.width_; }, }; /** @@ -137,7 +133,5 @@ */ cr.defineProperty(TableColumn, 'defaultOrder'); - return { - TableColumn: TableColumn - }; + return {TableColumn: TableColumn}; });
diff --git a/ui/webui/resources/js/cr/ui/table/table_column_model.js b/ui/webui/resources/js/cr/ui/table/table_column_model.js index d159fd5..1f6322bd 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column_model.js +++ b/ui/webui/resources/js/cr/ui/table/table_column_model.js
@@ -32,18 +32,14 @@ * The number of the columns. * @type {number} */ - get size() { - return this.columns_.length; - }, + get size() { return this.columns_.length; }, /** * Returns id of column at the given index. * @param {number} index The index of the column. * @return {string} Column id. */ - getId: function(index) { - return this.columns_[index].id; - }, + getId: function(index) { return this.columns_[index].id; }, /** * Returns name of column at the given index. Name is used as column header @@ -51,9 +47,7 @@ * @param {number} index The index of the column. * @return {string} Column name. */ - getName: function(index) { - return this.columns_[index].name; - }, + getName: function(index) { return this.columns_[index].name; }, /** * Sets name of column at the given index. @@ -75,18 +69,14 @@ * @param {number} index The index of the column. * @return {string} Column width in pixels. */ - getWidth: function(index) { - return this.columns_[index].width; - }, + getWidth: function(index) { return this.columns_[index].width; }, /** * Check if the column at the given index should align to the end. * @param {number} index The index of the column. * @return {boolean} True if the column is aligned to end. */ - isEndAlign: function(index) { - return this.columns_[index].endAlign; - }, + isEndAlign: function(index) { return this.columns_[index].endAlign; }, /** * Sets width of column at the given index. @@ -213,12 +203,8 @@ * @param {number} index The column index. * @return {boolean} Whether the column is visible. */ - isVisible: function(index) { - return this.columns_[index].visible; - } + isVisible: function(index) { return this.columns_[index].visible; } }; - return { - TableColumnModel: TableColumnModel - }; + return {TableColumnModel: TableColumnModel}; });
diff --git a/ui/webui/resources/js/cr/ui/table/table_header.js b/ui/webui/resources/js/cr/ui/table/table_header.js index 2b1916d..053448b 100644 --- a/ui/webui/resources/js/cr/ui/table/table_header.js +++ b/ui/webui/resources/js/cr/ui/table/table_header.js
@@ -31,8 +31,8 @@ this.headerInner_ = this.ownerDocument.createElement('div'); this.headerInner_.className = 'table-header-inner'; this.appendChild(this.headerInner_); - this.addEventListener('touchstart', - this.handleTouchStart_.bind(this), false); + this.addEventListener( + 'touchstart', this.handleTouchStart_.bind(this), false); }, /** @@ -64,9 +64,7 @@ batchCount_: 0, - startBatchUpdates: function() { - this.batchCount_++; - }, + startBatchUpdates: function() { this.batchCount_++; }, endBatchUpdates: function() { this.batchCount_--; @@ -87,7 +85,7 @@ this.updateWidth(); this.headerInner_.textContent = ''; - if (!cm || ! dm) { + if (!cm || !dm) { return; } @@ -100,8 +98,8 @@ cell.hidden = !cm.isVisible(i); cell.className = 'table-header-cell'; if (dm.isSortable(cm.getId(i))) - cell.addEventListener('click', - this.createSortFunction_(i).bind(this)); + cell.addEventListener( + 'click', this.createSortFunction_(i).bind(this)); cell.appendChild(this.createHeaderLabel_(i)); this.headerInner_.appendChild(cell); @@ -119,8 +117,8 @@ // splitter should use CSS for background image. var splitter = new TableSplitter({table: this.table_}); splitter.columnIndex = i; - splitter.addEventListener('dblclick', - this.handleDblClick_.bind(this, i)); + splitter.addEventListener( + 'dblclick', this.handleDblClick_.bind(this, i)); // Don't display splitters for hidden columns. Don't omit the splitter // completely, as it's much simpler if the number of splitter elements // and columns are in sync. @@ -182,9 +180,7 @@ * @param {number} index The index of the column to sort by. */ createSortFunction_: function(index) { - return function() { - this.table_.sort(index); - }.bind(this); + return function() { this.table_.sort(index); }.bind(this); }, /** @@ -225,9 +221,7 @@ * @param {number} index Column index. * @param {Event} e The double click event. */ - handleDblClick_: function(index, e) { - this.table_.fitColumn(index); - }, + handleDblClick_: function(index, e) { this.table_.fitColumn(index); }, /** * Determines whether a full redraw is required. @@ -261,7 +255,5 @@ */ TableHeader.TOUCH_DRAG_AREA_WIDTH = 30; - return { - TableHeader: TableHeader - }; + return {TableHeader: TableHeader}; });
diff --git a/ui/webui/resources/js/cr/ui/table/table_list.js b/ui/webui/resources/js/cr/ui/table/table_list.js index 665dd01..853d171 100644 --- a/ui/webui/resources/js/cr/ui/table/table_list.js +++ b/ui/webui/resources/js/cr/ui/table/table_list.js
@@ -23,7 +23,7 @@ table_: null, - /** + /** * Initializes the element. */ decorate: function() { @@ -83,7 +83,8 @@ getAfterFillerHeight: function(lastIndex) { // If the list is empty set height to 1 to show horizontal // scroll bar. - return lastIndex == 0 ? 1 : + return lastIndex == 0 ? + 1 : cr.ui.List.prototype.getAfterFillerHeight.call(this, lastIndex); }, @@ -215,7 +216,5 @@ */ cr.defineProperty(TableList, 'table'); - return { - TableList: TableList - }; + return {TableList: TableList}; });
diff --git a/ui/webui/resources/js/cr/ui/table/table_splitter.js b/ui/webui/resources/js/cr/ui/table/table_splitter.js index 0954be483..0966f884 100644 --- a/ui/webui/resources/js/cr/ui/table/table_splitter.js +++ b/ui/webui/resources/js/cr/ui/table/table_splitter.js
@@ -55,8 +55,8 @@ * @override */ handleSplitterDragMove: function(deltaX) { - this.table_.columnModel.setWidth(this.columnIndex, - this.columnWidth_ + deltaX); + this.table_.columnModel.setWidth( + this.columnIndex, this.columnWidth_ + deltaX); }, /** @@ -81,7 +81,5 @@ */ cr.defineProperty(TableSplitter, 'table'); - return { - TableSplitter: TableSplitter - }; + return {TableSplitter: TableSplitter}; });
diff --git a/ui/webui/resources/js/cr/ui/tabs.js b/ui/webui/resources/js/cr/ui/tabs.js index d3256d8..e3a2649 100644 --- a/ui/webui/resources/js/cr/ui/tabs.js +++ b/ui/webui/resources/js/cr/ui/tabs.js
@@ -10,9 +10,8 @@ * @return {TabBox} The tab box if found. */ function getTabBox(el) { - return findAncestor(el, function(node) { - return node.tagName == 'TABBOX'; - }); + return findAncestor( + el, function(node) { return node.tagName == 'TABBOX'; }); } /** @@ -105,8 +104,8 @@ handleSelectedChange_: function(e) { var target = e.target; if (e.newValue && isTabElement(target) && getTabBox(target) == this) { - var index = Array.prototype.indexOf.call(target.parentElement.children, - target); + var index = + Array.prototype.indexOf.call(target.parentElement.children, target); this.selectedIndex = index; } }, @@ -118,8 +117,8 @@ * The index of the selected tab or -1 if no tab is selected. * @type {number} */ - cr.defineProperty(TabBox, 'selectedIndex', cr.PropertyKind.JS_PROP, - selectedIndexSetHook); + cr.defineProperty( + TabBox, 'selectedIndex', cr.PropertyKind.JS_PROP, selectedIndexSetHook); /** * Creates a new tabs element.
diff --git a/ui/webui/resources/js/cr/ui/touch_handler.js b/ui/webui/resources/js/cr/ui/touch_handler.js index 563daa87..b0e2f102 100644 --- a/ui/webui/resources/js/cr/ui/touch_handler.js +++ b/ui/webui/resources/js/cr/ui/touch_handler.js
@@ -138,8 +138,8 @@ * @param {!Element} touchedElement The element at the current location of the * touch. */ - TouchHandler.Event = function(type, bubbles, clientX, clientY, - touchedElement) { + TouchHandler.Event = function( + type, bubbles, clientX, clientY, touchedElement) { var event = document.createEvent('Event'); event.initEvent(type, bubbles, true); event.__proto__ = TouchHandler.Event.prototype; @@ -355,12 +355,12 @@ // Just listen to start events for now. When a touch is occuring we'll // want to be subscribed to move and end events on the document, but we // don't want to incur the cost of lots of no-op handlers on the document. - this.events_.add(this.element_, 'touchstart', this.onStart_.bind(this), - capture); + this.events_.add( + this.element_, 'touchstart', this.onStart_.bind(this), capture); if (opt_mouse) { - this.events_.add(this.element_, 'mousedown', - this.mouseToTouchCallback_(this.onStart_.bind(this)), - capture); + this.events_.add( + this.element_, 'mousedown', + this.mouseToTouchCallback_(this.onStart_.bind(this)), capture); } // If the element is long-pressed, we may need to swallow a click @@ -414,9 +414,7 @@ * Begin tracking the touchable element, it is eligible for dragging. * @private */ - beginTracking_: function() { - this.tracking_ = true; - }, + beginTracking_: function() { this.tracking_ = true; }, /** * Stop tracking the touchable element, it is no longer dragging. @@ -496,20 +494,20 @@ // Note that we do this on the document so that even if the user drags // their finger off the element, we'll still know what they're doing. if (e.type == 'mousedown') { - this.events_.add(document, 'mouseup', + this.events_.add( + document, 'mouseup', this.mouseToTouchCallback_(this.onEnd_.bind(this)), false); } else { this.events_.add(document, 'touchend', this.onEnd_.bind(this), false); - this.events_.add(document, 'touchcancel', this.onEnd_.bind(this), - false); + this.events_.add( + document, 'touchcancel', this.onEnd_.bind(this), false); } // This timeout is cleared on touchEnd and onDrag // If we invoke the function then we have a real long press window.clearTimeout(this.longPressTimeout_); this.longPressTimeout_ = window.setTimeout( - this.onLongPress_.bind(this), - TouchHandler.TIME_FOR_LONG_PRESS_); + this.onLongPress_.bind(this), TouchHandler.TIME_FOR_LONG_PRESS_); // Dispatch the TOUCH_START event this.draggingEnabled_ = @@ -517,7 +515,8 @@ // We want dragging notifications if (e.type == 'mousedown') { - this.events_.add(document, 'mousemove', + this.events_.add( + document, 'mousemove', this.mouseToTouchCallback_(this.onMove_.bind(this)), false); } else { this.events_.add(document, 'touchmove', this.onMove_.bind(this), false); @@ -581,8 +580,7 @@ this.lastTouchX_ = clientX; this.lastTouchY_ = clientY; - var couldBeTap = - this.totalMoveY_ <= TouchHandler.MAX_TRACKING_FOR_TAP_ || + var couldBeTap = this.totalMoveY_ <= TouchHandler.MAX_TRACKING_FOR_TAP_ || this.totalMoveX_ <= TouchHandler.MAX_TRACKING_FOR_TAP_; if (!couldBeTap) @@ -596,8 +594,8 @@ // allowed or not. Note that this relies on the current value of // startTouchX/Y - handlers may use the initial drag delta to determine // if dragging should be permitted. - this.dragging_ = this.dispatchEvent_( - TouchHandler.EventType.DRAG_START, touch); + this.dragging_ = + this.dispatchEvent_(TouchHandler.EventType.DRAG_START, touch); if (this.dragging_) { // Update the start position here so that drag deltas have better @@ -615,10 +613,10 @@ if (this.dragging_) { this.dispatchEvent_(TouchHandler.EventType.DRAG_MOVE, touch); - this.removeTouchesInWrongDirection_(this.recentTouchesX_, - this.lastMoveX_, moveX); - this.removeTouchesInWrongDirection_(this.recentTouchesY_, - this.lastMoveY_, moveY); + this.removeTouchesInWrongDirection_( + this.recentTouchesX_, this.lastMoveX_, moveX); + this.removeTouchesInWrongDirection_( + this.recentTouchesY_, this.lastMoveY_, moveY); this.removeOldTouches_(this.recentTouchesX_, e.timeStamp); this.removeOldTouches_(this.recentTouchesY_, e.timeStamp); this.recentTouchesX_.push(clientX, e.timeStamp); @@ -640,8 +638,8 @@ * @param {number} recentMove The x or y component of the most recent move. * @private */ - removeTouchesInWrongDirection_: function(recentTouches, lastMove, - recentMove) { + removeTouchesInWrongDirection_: function( + recentTouches, lastMove, recentMove) { if (lastMove && recentMove && recentTouches.length > 2 && (lastMove > 0 ^ recentMove > 0)) { recentTouches.splice(0, recentTouches.length - 2); @@ -658,10 +656,10 @@ * @private */ removeOldTouches_: function(recentTouches, recentTime) { - while (recentTouches.length && recentTime - recentTouches[1] > - TouchHandler.MAX_TRACKING_TIME_ || - recentTouches.length > - TouchHandler.MAX_TRACKING_TOUCHES_ * 2) { + while (recentTouches.length && + recentTime - recentTouches[1] > + TouchHandler.MAX_TRACKING_TIME_ || + recentTouches.length > TouchHandler.MAX_TRACKING_TOUCHES_ * 2) { recentTouches.splice(0, 2); } }, @@ -687,8 +685,8 @@ } // This is touchEnd for the touch we're monitoring - assert(!this.findActiveTouch_(e.touches), - 'Touch ended also still active'); + assert( + !this.findActiveTouch_(e.touches), 'Touch ended also still active'); // Indicate that touching has finished this.stopTouching_(); @@ -739,18 +737,17 @@ // Note that we could move velocity to just be an end-event parameter. var velocityX = this.recentTouchesX_.length ? (this.endTouchX_ - this.recentTouchesX_[0]) / - (this.endTime_ - this.recentTouchesX_[1]) : 0; + (this.endTime_ - this.recentTouchesX_[1]) : + 0; var velocityY = this.recentTouchesY_.length ? (this.endTouchY_ - this.recentTouchesY_[0]) / - (this.endTime_ - this.recentTouchesY_[1]) : 0; + (this.endTime_ - this.recentTouchesY_[1]) : + 0; velocityX = this.correctVelocity_(velocityX); velocityY = this.correctVelocity_(velocityY); - return { - x: velocityX, - y: velocityY - }; + return {x: velocityX, y: velocityY}; }, /** @@ -771,7 +768,7 @@ if (absVelocity > TouchHandler.MAXIMUM_VELOCITY_) { absVelocity = this.recentTouchesY_.length < 3 ? TouchHandler.VELOCITY_FOR_INCORRECT_EVENTS_ : - TouchHandler.MAXIMUM_VELOCITY_; + TouchHandler.MAXIMUM_VELOCITY_; } return absVelocity * (velocity < 0 ? -1 : 1); }, @@ -790,9 +787,10 @@ // Dispatch to the LONG_PRESS assert(typeof this.startTouchX_ == 'number'); assert(typeof this.startTouchY_ == 'number'); - this.dispatchEventXY_(TouchHandler.EventType.LONG_PRESS, this.element_, - /** @type {number} */(this.startTouchX_), - /** @type {number} */(this.startTouchY_)); + this.dispatchEventXY_( + TouchHandler.EventType.LONG_PRESS, this.element_, + /** @type {number} */ (this.startTouchX_), + /** @type {number} */ (this.startTouchY_)); }, /** @@ -829,12 +827,12 @@ if (eventType == TouchHandler.EventType.TOUCH_START) { touchedElement = assertInstanceof(touch.target, Element); } else { - touchedElement = assert(this.element_.ownerDocument. - elementFromPoint(touch.clientX, touch.clientY)); + touchedElement = assert(this.element_.ownerDocument.elementFromPoint( + touch.clientX, touch.clientY)); } - return this.dispatchEventXY_(eventType, touchedElement, touch.clientX, - touch.clientY); + return this.dispatchEventXY_( + eventType, touchedElement, touch.clientX, touch.clientY); }, /** @@ -848,16 +846,17 @@ * @private */ dispatchEventXY_: function(eventType, touchedElement, clientX, clientY) { - var isDrag = (eventType == TouchHandler.EventType.DRAG_START || - eventType == TouchHandler.EventType.DRAG_MOVE || - eventType == TouchHandler.EventType.DRAG_END); + var isDrag = + (eventType == TouchHandler.EventType.DRAG_START || + eventType == TouchHandler.EventType.DRAG_MOVE || + eventType == TouchHandler.EventType.DRAG_END); // Drag events don't bubble - we're really just dragging the element, // not affecting its parent at all. var bubbles = !isDrag; - var event = new TouchHandler.Event(eventType, bubbles, clientX, clientY, - touchedElement); + var event = new TouchHandler.Event( + eventType, bubbles, clientX, clientY, touchedElement); // Set enableDrag when it can be overridden if (eventType == TouchHandler.EventType.TOUCH_START) @@ -875,7 +874,5 @@ } }; - return { - TouchHandler: TouchHandler - }; + return {TouchHandler: TouchHandler}; });
diff --git a/ui/webui/resources/js/cr/ui/tree.js b/ui/webui/resources/js/cr/ui/tree.js index 1eed9e1d..04b68ae0 100644 --- a/ui/webui/resources/js/cr/ui/tree.js +++ b/ui/webui/resources/js/cr/ui/tree.js
@@ -64,17 +64,13 @@ /** * Returns the tree item that are children of this tree. */ - get items() { - return this.children; - }, + get items() { return this.children; }, /** * Adds a tree item to the tree. * @param {!cr.ui.TreeItem} treeItem The item to add. */ - add: function(treeItem) { - this.addAt(treeItem, 0xffffffff); - }, + add: function(treeItem) { this.addAt(treeItem, 0xffffffff); }, /** * Adds a tree item at the given index. @@ -95,16 +91,14 @@ * @param {!cr.ui.TreeItem=} treeItem The tree item to remove. */ remove: function(treeItem) { - this.removeChild(/** @type {!cr.ui.TreeItem} */(treeItem)); + this.removeChild(/** @type {!cr.ui.TreeItem} */ (treeItem)); }, /** * The depth of the node. This is 0 for the tree itself. * @type {number} */ - get depth() { - return 0; - }, + get depth() { return 0; }, /** * Handles click events on the tree and forwards the event to the relevant @@ -112,13 +106,13 @@ * @param {Event} e The click event object. */ handleClick: function(e) { - var treeItem = findTreeItem(/** @type {!Node} */(e.target)); + var treeItem = findTreeItem(/** @type {!Node} */ (e.target)); if (treeItem) treeItem.handleClick(e); }, handleMouseDown: function(e) { - if (e.button == 2) // right + if (e.button == 2) // right this.handleClick(e); }, @@ -127,7 +121,7 @@ * @param {Event} e The dblclick event object. */ handleDblClick: function(e) { - var treeItem = findTreeItem(/** @type {!Node} */(e.target)); + var treeItem = findTreeItem(/** @type {!Node} */ (e.target)); if (treeItem) treeItem.expanded = !treeItem.expanded; }, @@ -150,12 +144,11 @@ switch (e.key) { case 'ArrowUp': - itemToSelect = item ? getPrevious(item) : - this.items[this.items.length - 1]; + itemToSelect = + item ? getPrevious(item) : this.items[this.items.length - 1]; break; case 'ArrowDown': - itemToSelect = item ? getNext(item) : - this.items[0]; + itemToSelect = item ? getNext(item) : this.items[0]; break; case 'ArrowLeft': case 'ArrowRight': @@ -193,9 +186,7 @@ * The selected tree item or null if none. * @type {cr.ui.TreeItem} */ - get selectedItem() { - return this.selectedItem_ || null; - }, + get selectedItem() { return this.selectedItem_ || null; }, set selectedItem(item) { var oldSelectedItem = this.selectedItem_; if (oldSelectedItem != item) { @@ -211,7 +202,7 @@ if (item.id) this.setAttribute('aria-activedescendant', item.id); } else { - this.removeAttribute('aria-activedescendant'); + this.removeAttribute('aria-activedescendant'); } cr.dispatchSimpleEvent(this, 'change'); } @@ -282,8 +273,8 @@ * Initializes the element. */ decorate: function() { - var labelId = 'tree-item-label-autogen-id-' + - treeItemAutoGeneratedIdCounter; + var labelId = + 'tree-item-label-autogen-id-' + treeItemAutoGeneratedIdCounter; this.labelElement.id = labelId; this.setAttribute('aria-labelledby', labelId); }, @@ -291,18 +282,13 @@ /** * The tree items children. */ - get items() { - return this.lastElementChild.children; - }, + get items() { return this.lastElementChild.children; }, /** * The depth of the tree item. * @type {number} */ - depth_: 0, - get depth() { - return this.depth_; - }, + depth_: 0, get depth() { return this.depth_; }, /** * Sets the depth. @@ -311,8 +297,8 @@ */ setDepth_: function(depth) { if (depth != this.depth_) { - this.rowElement.style.WebkitPaddingStart = Math.max(0, depth - 1) * - INDENT + 'px'; + this.rowElement.style.WebkitPaddingStart = + Math.max(0, depth - 1) * INDENT + 'px'; this.depth_ = depth; var items = this.items; for (var i = 0, item; item = items[i]; i++) { @@ -325,9 +311,7 @@ * Adds a tree item as a child. * @param {!cr.ui.TreeItem} child The child to add. */ - add: function(child) { - this.addAt(child, 0xffffffff); - }, + add: function(child) { this.addAt(child, 0xffffffff); }, /** * Adds a tree item as a child at a given index. @@ -353,7 +337,7 @@ if (selectedItem && child.contains(selectedItem)) this.selected = true; - this.lastElementChild.removeChild(/** @type {!cr.ui.TreeItem} */(child)); + this.lastElementChild.removeChild(/** @type {!cr.ui.TreeItem} */ (child)); if (this.items.length == 0) this.hasChildren = false; }, @@ -386,9 +370,7 @@ * Whether the tree item is expanded or not. * @type {boolean} */ - get expanded() { - return this.hasAttribute('expanded'); - }, + get expanded() { return this.hasAttribute('expanded'); }, set expanded(b) { if (this.expanded == b) return; @@ -435,28 +417,20 @@ * The element representing the row that gets highlighted. * @type {!HTMLElement} */ - get rowElement() { - return this.firstElementChild; - }, + get rowElement() { return this.firstElementChild; }, /** * The element containing the label text and the icon. * @type {!HTMLElement} */ - get labelElement() { - return this.firstElementChild.lastElementChild; - }, + get labelElement() { return this.firstElementChild.lastElementChild; }, /** * The label text. * @type {string} */ - get label() { - return this.labelElement.textContent; - }, - set label(s) { - this.labelElement.textContent = s; - }, + get label() { return this.labelElement.textContent; }, + set label(s) { this.labelElement.textContent = s; }, /** * The URL for the icon. @@ -473,9 +447,7 @@ * Whether the tree item is selected or not. * @type {boolean} */ - get selected() { - return this.hasAttribute('selected'); - }, + get selected() { return this.hasAttribute('selected'); }, set selected(b) { if (this.selected == b) return; @@ -500,9 +472,7 @@ * Whether the tree item has children. * @type {boolean} */ - get mayHaveChildren_() { - return this.hasAttribute('may-have-children'); - }, + get mayHaveChildren_() { return this.hasAttribute('may-have-children'); }, set mayHaveChildren_(b) { var rowItem = this.firstElementChild; if (b) { @@ -518,9 +488,7 @@ * Whether the tree item has children. * @type {boolean} */ - get hasChildren() { - return !!this.items[0]; - }, + get hasChildren() { return !!this.items[0]; }, /** * Whether the tree item has children. @@ -573,15 +541,13 @@ switch (e.key) { case 'Escape': input.value = text; - // fall through + // fall through case 'Enter': self.tree.focus(); } } - function stopPropagation(e) { - e.stopPropagation(); - } + function stopPropagation(e) { e.stopPropagation(); } if (editing) { this.selected = true; @@ -598,9 +564,8 @@ labelEl.appendChild(input); input.addEventListener('keydown', handleKeydown); - input.addEventListener('blur', (function() { - this.editing = false; - }).bind(this)); + input.addEventListener( + 'blur', (function() { this.editing = false; }).bind(this)); // Make sure that double clicks do not expand and collapse the tree // item. @@ -638,9 +603,7 @@ } }, - get editing() { - return this.hasAttribute('editing'); - } + get editing() { return this.hasAttribute('editing'); } }; /** @@ -702,8 +665,5 @@ } // Export - return { - Tree: Tree, - TreeItem: TreeItem - }; + return {Tree: Tree, TreeItem: TreeItem}; });
diff --git a/ui/webui/resources/js/i18n_behavior.js b/ui/webui/resources/js/i18n_behavior.js index b5663cf9..e8c55f5b 100644 --- a/ui/webui/resources/js/i18n_behavior.js +++ b/ui/webui/resources/js/i18n_behavior.js
@@ -25,7 +25,8 @@ * @private */ i18nRaw_: function(id, var_args) { - return arguments.length == 1 ? loadTimeData.getString(id) : + return arguments.length == 1 ? + loadTimeData.getString(id) : loadTimeData.getStringF.apply(loadTimeData, arguments); }, @@ -63,9 +64,7 @@ * @param {string} id * @return {boolean} */ - i18nExists: function(id) { - return loadTimeData.valueExists(id); - }, + i18nExists: function(id) { return loadTimeData.valueExists(id); }, }; /**
diff --git a/ui/webui/resources/js/i18n_template_no_process.js b/ui/webui/resources/js/i18n_template_no_process.js index 2ae2ebd..94af5c8 100644 --- a/ui/webui/resources/js/i18n_template_no_process.js +++ b/ui/webui/resources/js/i18n_template_no_process.js
@@ -113,7 +113,7 @@ } } } else { - element.setAttribute(propName, /** @type {string} */(value)); + element.setAttribute(propName, /** @type {string} */ (value)); } }); } @@ -127,9 +127,12 @@ prefixes.push('* /deep/ '); var attributeNames = Object.keys(handlers); - var selector = prefixes.map(function(prefix) { - return prefix + '[' + attributeNames.join('], ' + prefix + '[') + ']'; - }).join(', '); + var selector = prefixes + .map(function(prefix) { + return prefix + '[' + + attributeNames.join('], ' + prefix + '[') + ']'; + }) + .join(', '); /** * Processes a DOM tree using a |data| source to populate template values. @@ -158,7 +161,7 @@ var importLinks = root.querySelectorAll('link[rel=import]'); for (var i = 0; i < importLinks.length; ++i) { - var importLink = /** @type {!HTMLLinkElement} */(importLinks[i]); + var importLink = /** @type {!HTMLLinkElement} */ (importLinks[i]); if (!importLink.import) { // Happens when a <link rel=import> is inside a <template>. // TODO(dbeam): should we log an error if we detect that here? @@ -169,7 +172,7 @@ var templates = root.querySelectorAll('template'); for (var i = 0; i < templates.length; ++i) { - var template = /** @type {HTMLTemplateElement} */(templates[i]); + var template = /** @type {HTMLTemplateElement} */ (templates[i]); if (!template.content) continue; processWithoutCycles(template.content, data, visited, mark); @@ -177,7 +180,7 @@ var isElement = root instanceof Element; if (isElement && root.webkitMatchesSelector(selector)) - processElement(/** @type {!Element} */(root), data, visited); + processElement(/** @type {!Element} */ (root), data, visited); var elements = root.querySelectorAll(selector); for (var i = 0; i < elements.length; ++i) { @@ -209,7 +212,5 @@ } } - return { - process: process - }; + return {process: process}; }());
diff --git a/ui/webui/resources/js/load_time_data.js b/ui/webui/resources/js/load_time_data.js index 4075b62..1ed68a6 100644 --- a/ui/webui/resources/js/load_time_data.js +++ b/ui/webui/resources/js/load_time_data.js
@@ -15,7 +15,7 @@ // Expose this type globally as a temporary work around until // https://github.com/google/closure-compiler/issues/544 is fixed. /** @constructor */ -function LoadTimeData() {} +function LoadTimeData(){} (function() { 'use strict'; @@ -39,17 +39,13 @@ * Returns a JsEvalContext for |data_|. * @returns {JsEvalContext} */ - createJsEvalContext: function() { - return new JsEvalContext(this.data_); - }, + createJsEvalContext: function() { return new JsEvalContext(this.data_); }, /** * @param {string} id An ID of a value that might exist. * @return {boolean} True if |id| is a key in the dictionary. */ - valueExists: function(id) { - return id in this.data_; - }, + valueExists: function(id) { return id in this.data_; }, /** * Fetches a value, expecting that it exists. @@ -88,9 +84,8 @@ return ''; var varArgs = arguments; - return value.replace(/\$[$1-9]/g, function(m) { - return m == '$$' ? '$' : varArgs[m[1]]; - }); + return value.replace( + /\$[$1-9]/g, function(m) { return m == '$$' ? '$' : varArgs[m[1]]; }); }, /** @@ -121,8 +116,9 @@ * @param {Object} replacements The dictionary object of keys to replace. */ overrideValues: function(replacements) { - expect(typeof replacements == 'object', - 'Replacements must be a dictionary object.'); + expect( + typeof replacements == 'object', + 'Replacements must be a dictionary object.'); for (var key in replacements) { this.data_[key] = replacements[key]; } @@ -136,8 +132,8 @@ */ function expect(condition, message) { if (!condition) { - console.error('Unexpected condition on ' + document.location.href + ': ' + - message); + console.error( + 'Unexpected condition on ' + document.location.href + ': ' + message); } } @@ -148,8 +144,8 @@ * @param {string} type The type we expect |value| to be. */ function expectIsType(id, value, type) { - expect(typeof value == type, '[' + value + '] (' + id + - ') is not a ' + type); + expect( + typeof value == type, '[' + value + '] (' + id + ') is not a ' + type); } expect(!loadTimeData, 'should only include this file once');
diff --git a/ui/webui/resources/js/parse_html_subset.js b/ui/webui/resources/js/parse_html_subset.js index 3fa9bfe..bd53e8e 100644 --- a/ui/webui/resources/js/parse_html_subset.js +++ b/ui/webui/resources/js/parse_html_subset.js
@@ -18,8 +18,8 @@ var allowedAttributes = { 'href': function(node, value) { // Only allow a[href] starting with chrome:// and https:// - return node.tagName == 'A' && (value.startsWith('chrome://') || - value.startsWith('https://')); + return node.tagName == 'A' && + (value.startsWith('chrome://') || value.startsWith('https://')); }, 'target': function(node, value) { // Only allow a[target='_blank'].
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js index 75ea9da6..77d7835 100644 --- a/ui/webui/resources/js/util.js +++ b/ui/webui/resources/js/util.js
@@ -40,9 +40,7 @@ element.style.height = '0px'; element.innerText = msg; document.body.appendChild(element); - window.setTimeout(function() { - document.body.removeChild(element); - }, 0); + window.setTimeout(function() { document.body.removeChild(element); }, 0); } /** @@ -106,7 +104,7 @@ * @return {Element} A node with class of |className| or null if none is found. */ function findAncestorByClass(el, className) { - return /** @type {Element} */(findAncestor(el, function(el) { + return /** @type {Element} */ (findAncestor(el, function(el) { return el.classList && el.classList.contains(className); })); } @@ -166,7 +164,7 @@ */ function preventDefaultOnPoundLinkClicks() { document.addEventListener('click', function(e) { - var anchor = findAncestor(/** @type {Node} */(e.target), function(el) { + var anchor = findAncestor(/** @type {Node} */ (e.target), function(el) { return el.tagName == 'A'; }); // Use getAttribute() to prevent URL normalization. @@ -191,8 +189,8 @@ * @return {!HTMLElement} the Element. */ function getRequiredElement(id) { - return assertInstanceof($(id), HTMLElement, - 'Missing required element: ' + id); + return assertInstanceof( + $(id), HTMLElement, 'Missing required element: ' + id); } /** @@ -206,8 +204,8 @@ */ function queryRequiredElement(selectors, opt_context) { var element = (opt_context || document).querySelector(selectors); - return assertInstanceof(element, HTMLElement, - 'Missing required element: ' + selectors); + return assertInstanceof( + element, HTMLElement, 'Missing required element: ' + selectors); } // Handle click on a link. If the link points to a chrome: or file: url, then @@ -215,7 +213,7 @@ ['click', 'auxclick'].forEach(function(eventName) { document.addEventListener(eventName, function(e) { if (e.button > 1) - return; // Ignore buttons other than left and middle. + return; // Ignore buttons other than left and middle. if (e.defaultPrevented) return; @@ -244,16 +242,11 @@ if (!anchor) return; - anchor = /** @type {!HTMLAnchorElement} */(anchor); + anchor = /** @type {!HTMLAnchorElement} */ (anchor); if ((anchor.protocol == 'file:' || anchor.protocol == 'about:') && (e.button == 0 || e.button == 1)) { chrome.send('navigateToUrl', [ - anchor.href, - anchor.target, - e.button, - e.altKey, - e.ctrlKey, - e.metaKey, + anchor.href, anchor.target, e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]); e.preventDefault(); @@ -365,10 +358,10 @@ */ function HTMLEscape(original) { return original.replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); } /** @@ -428,7 +421,7 @@ if (!('key' in KeyboardEvent.prototype)) { Object.defineProperty(KeyboardEvent.prototype, 'key', { /** @this {KeyboardEvent} */ - get: function () { + get: function() { // 0-9 if (this.keyCode >= 0x30 && this.keyCode <= 0x39) return String.fromCharCode(this.keyCode); @@ -442,48 +435,83 @@ } // Special characters - switch(this.keyCode) { - case 0x08: return 'Backspace'; - case 0x09: return 'Tab'; - case 0x0d: return 'Enter'; - case 0x10: return 'Shift'; - case 0x11: return 'Control'; - case 0x12: return 'Alt'; - case 0x1b: return 'Escape'; - case 0x20: return ' '; - case 0x21: return 'PageUp'; - case 0x22: return 'PageDown'; - case 0x23: return 'End'; - case 0x24: return 'Home'; - case 0x25: return 'ArrowLeft'; - case 0x26: return 'ArrowUp'; - case 0x27: return 'ArrowRight'; - case 0x28: return 'ArrowDown'; - case 0x2d: return 'Insert'; - case 0x2e: return 'Delete'; - case 0x5b: return 'Meta'; - case 0x70: return 'F1'; - case 0x71: return 'F2'; - case 0x72: return 'F3'; - case 0x73: return 'F4'; - case 0x74: return 'F5'; - case 0x75: return 'F6'; - case 0x76: return 'F7'; - case 0x77: return 'F8'; - case 0x78: return 'F9'; - case 0x79: return 'F10'; - case 0x7a: return 'F11'; - case 0x7b: return 'F12'; - case 0xbb: return '='; - case 0xbd: return '-'; - case 0xdb: return '['; - case 0xdd: return ']'; + switch (this.keyCode) { + case 0x08: + return 'Backspace'; + case 0x09: + return 'Tab'; + case 0x0d: + return 'Enter'; + case 0x10: + return 'Shift'; + case 0x11: + return 'Control'; + case 0x12: + return 'Alt'; + case 0x1b: + return 'Escape'; + case 0x20: + return ' '; + case 0x21: + return 'PageUp'; + case 0x22: + return 'PageDown'; + case 0x23: + return 'End'; + case 0x24: + return 'Home'; + case 0x25: + return 'ArrowLeft'; + case 0x26: + return 'ArrowUp'; + case 0x27: + return 'ArrowRight'; + case 0x28: + return 'ArrowDown'; + case 0x2d: + return 'Insert'; + case 0x2e: + return 'Delete'; + case 0x5b: + return 'Meta'; + case 0x70: + return 'F1'; + case 0x71: + return 'F2'; + case 0x72: + return 'F3'; + case 0x73: + return 'F4'; + case 0x74: + return 'F5'; + case 0x75: + return 'F6'; + case 0x76: + return 'F7'; + case 0x77: + return 'F8'; + case 0x78: + return 'F9'; + case 0x79: + return 'F10'; + case 0x7a: + return 'F11'; + case 0x7b: + return 'F12'; + case 0xbb: + return '='; + case 0xbd: + return '-'; + case 0xdb: + return '['; + case 0xdd: + return ']'; } return 'Unidentified'; } }); } else { - window.console.log("KeyboardEvent.Key polyfill not required"); + window.console.log('KeyboardEvent.Key polyfill not required'); } // </if> /* is_ios */ @@ -495,9 +523,7 @@ */ function importModules(moduleNames) { return new Promise(function(resolve) { - define(moduleNames, function() { - resolve(Array.from(arguments)); - }); + define(moduleNames, function() { resolve(Array.from(arguments)); }); }); }
diff --git a/ui/webui/resources/js/webui_resource_test.js b/ui/webui/resources/js/webui_resource_test.js index 16d2298..55ce865 100644 --- a/ui/webui/resources/js/webui_resource_test.js +++ b/ui/webui/resources/js/webui_resource_test.js
@@ -64,7 +64,7 @@ var triggeredError = false; try { f(); - } catch(err) { + } catch (err) { triggeredError = true; } if (!triggeredError) @@ -90,7 +90,7 @@ } if (!equal) { var message = - ['Assertion Failed', 'Observed: ' + v2, 'Expected: ' + v1].join('\n '); + ['Assertion Failed', 'Observed: ' + v2, 'Expected: ' + v1].join('\n '); throw new Error(message); } } @@ -154,7 +154,7 @@ try { if (window.setUpPage) window.setUpPage(); - } catch(err) { + } catch (err) { cleanTestRun = false; } continueTesting(); @@ -182,7 +182,7 @@ window.setUp(); pendingTearDown = window.tearDown; window[fn](continueTesting); - } catch(err) { + } catch (err) { console.error('Failure in test ' + fn + '\n' + err); console.log(err.stack); cleanTestRun = false;