diff --git a/third_party/polymer/README.chromium b/third_party/polymer/README.chromium index afbdc267067158..bc16ae73561be3 100644 --- a/third_party/polymer/README.chromium +++ b/third_party/polymer/README.chromium @@ -1,8 +1,8 @@ Name: Polymer Short Name: polymer -URL: http://www.polymer-project.org -Version: 1.9.1 -Revision: (see v1_0/components_summary.txt) +URL: https://polymer-library.polymer-project.org +Version: 3.2.0 +Revision: N/A License: BSD License File: LICENSE.polymer Security Critical: no @@ -10,7 +10,7 @@ Security Critical: no Description: This directory contains a copy of the Polymer framework and some elements from the Polymer elements catalog (https://elements.polymer-project.org/). See -v1_0/components_summary.txt for a full list of components. +v3_0/package.json for a full list of components. The source git repositories can be found at: https://github.com/Polymer/polymer @@ -26,7 +26,7 @@ becomes smaller and better over time. technologies called the Polymer. Local Modifications: -- Applied modifications that can be found in v1_0/chromium.patch. +- Applied modifications that can be found in v3_0/chromium.patch. - All inline JavaScript blocks are extracted from Polymer HTML elements to external JS files. This version of the Polymer is used in a web UI, where CSP forbids an execution of inline scripts. The extraction was made with the help of @@ -34,29 +34,17 @@ the Crisper tool (https://github.com/PolymerLabs/crisper). - Removed executable bit from some files. - Resolved encoding issues. - Replaced CRLF line endings with LF line endings in text files. -- Removed files that are not needed by Chromium, see v1_0/rsync_exclude.txt. +- Removed files that are not needed by Chromium, see v3_0/rsync_exclude.txt. - Re-implemented using Web Animations API (which, as of 2/21/2017 does not work in Safari or IE). This is a complete fork from Polymer's . - Removed CSS properties that are not needed in Chromium using css_strip_prefixes.py script. -- Bundled and minified Polymer 2 with minify_polymer.py, since Polymer 2 repo - does not distribute minified files (unlike Polymer 1). -- Note that the Polymer 2 bundle does not include dir-mixin.html which is +- Bundled and minified Polymer 3 with minify_polymer.py, since Polymer 3 repo + does not distribute minified files. +- Note that the Polymer 3 bundle does not include dir-mixin.js which is responsible for polyfylling :dir() CSS rules, because it causes a performance regression (and it is unnecessary), see crbug.com/899603 for more context. To restore a content of the 'components-chromium' directory from scratch, run -./v1_0/reproduce.sh on a Linux machine. - -Note on Bower: -The directory can be updated by running "bower update". A new component can be -installed by running "bower install -S PolymerElements/#version". -Be sure to add the .bower.json file to the repository as it includes the -revision information of the polymer component. -Also be sure that you listed all the added packages in bower.json. - -Polymer 3 notes -Polymer 3 resides under v3_0/, and uses NPM instead of Bower. To restore the -contents of the 'components-chromium' directory from scratch, run ./v3_0/reproduce.sh on a Linux machine. diff --git a/third_party/polymer/v1_0/css_strip_prefixes.py b/third_party/polymer/v3_0/css_strip_prefixes.py similarity index 100% rename from third_party/polymer/v1_0/css_strip_prefixes.py rename to third_party/polymer/v3_0/css_strip_prefixes.py diff --git a/third_party/polymer/v1_0/css_strip_prefixes_test.py b/third_party/polymer/v3_0/css_strip_prefixes_test.py similarity index 100% rename from third_party/polymer/v1_0/css_strip_prefixes_test.py rename to third_party/polymer/v3_0/css_strip_prefixes_test.py diff --git a/third_party/polymer/v1_0/generate_gn.sh b/third_party/polymer/v3_0/generate_gn.sh similarity index 60% rename from third_party/polymer/v1_0/generate_gn.sh rename to third_party/polymer/v3_0/generate_gn.sh index 2cae8c9a977517..60eb8a7765232e 100755 --- a/third_party/polymer/v1_0/generate_gn.sh +++ b/third_party/polymer/v3_0/generate_gn.sh @@ -6,26 +6,13 @@ dirs=$(find components-chromium -type d | grep -v 'components-chromium/polymer') gn_files='' -polymer_version=$1 - -if [ "$polymer_version" -eq 3 ]; - then - file_extension="js"; - else - file_extension="html"; -fi for dir in $dirs; do - files=$(\ls $dir/*.$file_extension 2>/dev/null) + files=$(\ls $dir/*.js 2>/dev/null) if [ "$files" ]; then echo "Analyzing $dir" gn_file="$dir/BUILD.gn" - if [ "$polymer_version" -eq 3 ]; - then - content=$(../../../tools/polymer/generate_gn_v3.py $files); - else - content=$(../../../tools/polymer/generate_gn.py $files); - fi + content=$(../../../tools/polymer/generate_gn_v3.py $files); if [ "$content" ]; then echo "Writing $gn_file" echo "$content" > "$gn_file" @@ -40,10 +27,6 @@ done # Copy components-chromium/polymer BUILD.gn file manually, since it is not # auto-generated by generate_gn_v3.py. -if [ "$polymer_version" -eq 3 ]; - then - cp ./BUILD_polymer.gn "components-chromium/polymer/BUILD.gn" -fi - +cp ./BUILD_polymer.gn "components-chromium/polymer/BUILD.gn" git cl format $gn_files diff --git a/third_party/polymer/v3_0/reproduce.sh b/third_party/polymer/v3_0/reproduce.sh index a9af73b0950da6..25b1481eebe71b 100755 --- a/third_party/polymer/v3_0/reproduce.sh +++ b/third_party/polymer/v3_0/reproduce.sh @@ -108,13 +108,13 @@ if [[ ! -z "${new}${deleted}" ]]; then fi echo 'Stripping unnecessary prefixed CSS rules...' -python ../v1_0/css_strip_prefixes.py --file_extension=js +python css_strip_prefixes.py --file_extension=js echo 'Generating -rgb versions of --google-* vars in paper-style/colors.js...' -python ../v1_0/rgbify_hex_vars.py --filter-prefix=google --replace \ +python rgbify_hex_vars.py --filter-prefix=google --replace \ components-chromium/paper-styles/color.js # TODO create components summary echo 'Creating GN files for interfaces and externs...' -../v1_0/generate_gn.sh 3 # polymer_version=3 +./generate_gn.sh diff --git a/third_party/polymer/v1_0/rgbify_hex_vars.py b/third_party/polymer/v3_0/rgbify_hex_vars.py similarity index 100% rename from third_party/polymer/v1_0/rgbify_hex_vars.py rename to third_party/polymer/v3_0/rgbify_hex_vars.py diff --git a/third_party/polymer/v1_0/rgbify_hex_vars_test.py b/third_party/polymer/v3_0/rgbify_hex_vars_test.py similarity index 100% rename from third_party/polymer/v1_0/rgbify_hex_vars_test.py rename to third_party/polymer/v3_0/rgbify_hex_vars_test.py diff --git a/tools/polymer/generate_gn.py b/tools/polymer/generate_gn.py deleted file mode 100755 index 96413fab995f4a..00000000000000 --- a/tools/polymer/generate_gn.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -from __future__ import print_function - -from bs4 import BeautifulSoup -from datetime import date -import os.path as path -import sys - -_COMPILE_JS = '//third_party/closure_compiler/compile_js.gni' -_POLYMERS = ['polymer.html', 'polymer-mini.html', 'polymer-micro.html'] -_COMPILED_RESOURCES_TEMPLATE = ''' -# Copyright %d 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. -# -# NOTE: Created with %s, please do not edit. - -import("%s") - -%s -'''.strip() - - -def main(created_by, html_files): - targets = '' - - def _html_to_extracted(html_file): - assert html_file.endswith('.html') - return html_file[:-len('.html')] + '-extracted' - - def _target_name(target_file): - return _html_to_extracted(path.basename(target_file)) - - def _has_extracted_js(html_file): - return path.isfile(_html_to_extracted(html_file) + '.js') - - html_files = filter(_has_extracted_js, html_files) - - for html_file in sorted(html_files, key=_target_name): - html_base = path.basename(html_file) - if html_base in _POLYMERS: - continue - - parsed = BeautifulSoup(open(html_file), 'html.parser') - imports = set( - i.get('href') for i in parsed.find_all('link', rel='import')) - - html_dir = path.dirname(html_file) - dependencies = [] - externs = '' - - for html_import in sorted(imports): - import_dir, import_base = path.split(html_import.encode('ascii')) - if import_base in _POLYMERS: - continue - - # Only exclude these after appending web animations externs. - if not _has_extracted_js(path.join(html_dir, html_import)): - continue - - target = ':' + _target_name(import_base) - - dependencies.append(import_dir + target) - - targets += '\njs_library("%s-extracted") {' % html_base[:-5] - if dependencies: - targets += '\n deps = [' - targets += '\n "%s",' % '",\n "'.join(dependencies) - targets += '\n ]' - targets += externs - targets += '\n}\n' - - targets = targets.strip() - - if targets: - current_year = date.today().year - print(_COMPILED_RESOURCES_TEMPLATE % (current_year, created_by, - _COMPILE_JS, targets)) - - -if __name__ == '__main__': - main(path.basename(sys.argv[0]), sys.argv[1:]) diff --git a/ui/webui/resources/html/BUILD.gn b/ui/webui/resources/html/BUILD.gn index b030f490b80a82..5e21e61ec68d46 100644 --- a/ui/webui/resources/html/BUILD.gn +++ b/ui/webui/resources/html/BUILD.gn @@ -5,8 +5,6 @@ import("//build/config/chromeos/ui_mode.gni") import("//ui/webui/resources/tools/generate_grd.gni") -include_polymer = !is_android && !is_ios - generate_grd("build_grdp") { grd_prefix = "webui_html" out_grd = "$target_gen_dir/resources.grdp" @@ -36,15 +34,11 @@ generate_grd("build_grdp") { ] } - if (include_polymer) { - input_files += [ "polymer.html" ] - - if (is_chromeos_ash) { - input_files += [ - "i18n_behavior.html", - "web_ui_listener_behavior.html", - ] - } + if (is_chromeos_ash) { + input_files += [ + "i18n_behavior.html", + "web_ui_listener_behavior.html", + ] } input_files_base_dir = rebase_path(".", "//") } diff --git a/ui/webui/resources/html/polymer.html b/ui/webui/resources/html/polymer.html deleted file mode 100644 index 6639e7dd54148f..00000000000000 --- a/ui/webui/resources/html/polymer.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ui/webui/resources/js/BUILD.gn b/ui/webui/resources/js/BUILD.gn index 2fe0c9f0017256..caa8f78f7e3e25 100644 --- a/ui/webui/resources/js/BUILD.gn +++ b/ui/webui/resources/js/BUILD.gn @@ -100,7 +100,6 @@ preprocess_if_expr("preprocess_src") { "i18n_template_no_process.js", "list_property_update_behavior.js", "parse_html_subset.js", - "polymer_config.js", "promise_resolver.js", "web_ui_listener_behavior.js", ] diff --git a/ui/webui/resources/js/polymer_config.js b/ui/webui/resources/js/polymer_config.js deleted file mode 100644 index 3433f39d0de693..00000000000000 --- a/ui/webui/resources/js/polymer_config.js +++ /dev/null @@ -1,17 +0,0 @@ -// 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 (typeof Polymer === 'undefined') { - Polymer = { - dom: 'shadow', - lazyRegister: true, - legacyOptimizations: true, - preserveStyleIncludes: true, // Only matters when using polymer-css-build. - suppressBindingNotifications: true, - suppressTemplateNotifications: true, - useNativeCSSProperties: true, - }; -} else { - console.error('Polymer is already defined.'); -}