chromium/third_party/polymer/README.chromium

Name: Polymer
Short Name: polymer
URL: https://polymer-library.polymer-project.org
Version: 3.5.0
Revision: N/A
License: BSD
License File: LICENSE.polymer
Security Critical: no
Shipped: yes

Description:
This directory contains a copy of the Polymer framework and some elements from
the Polymer elements catalog (https://elements.polymer-project.org/). See
v3_0/package.json for a full list of components.

The source git repositories can be found at:
https://github.com/Polymer/polymer
https://github.com/PolymerElements/<component-name>
https://github.com/PolymerLabs/polymer-externs

Polymer is comprised of two efforts:
1. A set of core platform features (Shadow DOM, Custom Elements, MDV).
Initially, these core features will be enabled with a set of polyfills. As
browsers begin to implement these new primitives, the polyfill platform layer
becomes smaller and better over time.
2. A next-generation web application framework built upon these core
technologies called the Polymer.

Local Modifications:
- Applied modifications that can be found in various v3_0/*.patch files.
- 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 v3_0/rsync_exclude.txt.
- Re-implemented <paper-ripple> 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 <paper-ripple>.
- Modified iron-iconset-svg to apply icons to an element's shadowRoot if
  it exists, instead of always using Polymer's dom() method on element.root.
  This allows elements written in Lit to use icons from an iron-iconset-svg.
- Modified iron-iconset-svg to fire the 'iron-iconset-added' event
  synchronously, which in turn makes it possible to automatically detect missing
  iron-iconset-svg dependencies in client code.
- Removed CSS properties that are not needed in Chromium using
  css_strip_prefixes.py script.
- 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.
- Applied workaround for explicit calls to attachShadow() at
  https://github.com/Polymer/polymer/issues/5574#issuecomment-649854825 since
  that issue has not yet been fixed in the upstream repository.
- Several modifications were introduced in v3.5.0 to save size, by pruning out
  codepaths related to
  1) ShadyDOM support (not needed by Chromium since native ShadowDOM is used).
     Done by passing --define window.ShadyDOM=false flag to Terser.
  2) ShadyCSS support (not needed by Chromium since no CSS mixins are used).
     Done by passing --define window.ShadyCSS=false flag to Terser, as well as
     by exluding all imports of shadycss/, which effectively removes the
     shadycss polyfil from the final Polymer bundle.
  3) PolymerElement#updateStyles() was modified to not rely on the ShadyCSS
     polyfil anymore, and call the native this.style.setProperty() API instead
     (required after the changes in #1)
  4) PolymerElement#getComputedStyleValue() is now defunct (it was relying on
     ShadyCSS stuff), and the native HTMLElement#computedStyleMap() API should
     be used instead.
  5) Polymer codepaths guarded by flags to preserve legacy Polymer behavior.
     Specifically legacyWarnings, syncInitialRender, legacyUndefined,
     legacyNoObservedAttributes.
  6) Polymer codepaths guarded by flags implementing various
     new optimizations introduced to v3.5.0. Specifically
     removeNestedTemplates, fastDomIf, suppressTemplateNotifications,
     useAdoptedStyleSheetsWithBuiltCSS.

To restore the content of the 'components-chromium' directory from scratch, run
./v3_0/reproduce.sh on a Linux machine.

To make further changes to the patched components, here's a tutorial. In the
below example, we update the patch for `iron-list`, an element that we have
already patched. Patching an element that has never been patched will just skip
a few steps.

1. Before beginning, make sure Python is installed and accessible as the
   `python` binary. For example Debian-based systems may need to install the
   `python-is-python3` package first.

2. `reproduce.sh` is the script used to pull the upstream Polymer repo and
   apply the Chromium specific patches.

3. If you need to update an already patched element, first comment out the
   command to patch that element. For example, for iron-list, comment out:

   patch -p1 --forward < iron_list.patch

   If you are patching an element that has never been patched before, you can
   skip this step.

4. Run `reproduce.sh` locally. Now you should have a copy of the Polymer in the
   repository that matches the existing committed version, but you'll have the
   upstream version of `iron-list`, because you commented out that line.

5. Commit this version locally (without the changes to `reproduce.sh`), because
   that will make it easy to generate a patchset later.

6. Now run the patch you skipped manually. This will apply the Chromium-specific
   patch, and now `git diff --relative` will print a copy of what's already in
   `iron_list.patch`.

7. Make the further updates to `iron-list.js` as desired, and test it.

8. Once you're satisfied, generate a new patch into the patch file, like this:

   git diff --relative components-chromium/iron-list/iron-list.js > iron_list.patch

9. Commit both the new patch file and the new patched element source. Be sure to
   undo and NOT commit any changes you made to `reproduce.sh`.

10. Rerun `reproduce.sh` and confirm that `git diff` shows no changes. This
    verifies that the above steps were successful and the patch was generated
    correctly.

11. Upload and submit the CL for review.

12. Probably you also want to clean up the `node_modules` file you created in
    this directory by `rm -rf node_modules` here.