Commit 9d00b88f authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI Polymer 2: Don't include dir-mixin.html in the final bundle.

Locally modify Polymer 2 to exclude dir-mixin.html, since it is unnecessary
currently (we don't directly* use any :dir() CSS rules), and also causes a
performance regression (more notice-able in chrome://md-user-manager), due to a
Regex running over a fairly large amount of text (because of inlined PNG background
images).

*The only usage of :dir() was in paper-input-container.html, which is still used
by ChromeOS <gaia-input> element. Modified <paper-input-container> to directly
use :host-context instead. Also :dir() is not implemented in Chrome, so we should
not be using it in our own code anyway.

Ideally the usage of this mixin should be exposed as a Polymer option, so that
we don't need to manually modify our local Polymer 2 copy.

Bug: 899603
Change-Id: Ia20535fb2adb2c9a6bebf3046e4405a4ca31af6c
Reviewed-on: https://chromium-review.googlesource.com/c/1306515Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604759}
parent 68f78e87
......@@ -44,6 +44,9 @@ the Crisper tool (https://github.com/PolymerLabs/crisper).
handler code which was hiding ripples for pointer interactions.
- 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
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.
......
......@@ -144,3 +144,41 @@ index 2e63d3731be1..217c7ff1414c 100644
});
/**
diff --git a/components-chromium/paper-input/paper-input-container.html b/components-chromium/paper-input/paper-input-container.html
index 55714942c93c..46fb9adf6a04 100644
--- a/components-chromium/paper-input/paper-input-container.html
+++ b/components-chromium/paper-input/paper-input-container.html
@@ -254,8 +254,8 @@ This element is `display:block` by default, but you can set the `inline` attribu
@apply --paper-input-container-label-floating;
}
- :host(:dir(rtl)) .input-content.label-is-floating ::slotted(label),
- :host(:dir(rtl)) .input-content.label-is-floating ::slotted(.paper-input-label) {
+ :host-context([dir="rtl"]) .input-content.label-is-floating ::slotted(label),
+ :host-context([dir="rtl"]) .input-content.label-is-floating ::slotted(.paper-input-label) {
right: 0;
left: auto;
transform-origin: right top;
diff --git a/components-chromium/polymer2/lib/legacy/legacy-element-mixin.html b/components-chromium/polymer2/lib/legacy/legacy-element-mixin.html
index 7306c651407e..9c88699a3924 100644
--- a/components-chromium/polymer2/lib/legacy/legacy-element-mixin.html
+++ b/components-chromium/polymer2/lib/legacy/legacy-element-mixin.html
@@ -11,7 +11,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../../shadycss/apply-shim.html">
<link rel="import" href="../mixins/element-mixin.html">
<link rel="import" href="../mixins/gesture-event-listeners.html">
-<link rel="import" href="../mixins/dir-mixin.html">
<link rel="import" href="../utils/mixin.html">
<link rel="import" href="../utils/import-href.html">
<link rel="import" href="../utils/render-status.html">
@@ -47,9 +46,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @extends {base}
* @implements {Polymer_ElementMixin}
* @implements {Polymer_GestureEventListeners}
- * @implements {Polymer_DirMixin}
*/
- const legacyElementBase = Polymer.DirMixin(Polymer.GestureEventListeners(Polymer.ElementMixin(base)));
+ const legacyElementBase = Polymer.GestureEventListeners(Polymer.ElementMixin(base));
/**
* Map of simple names to touch action names
......@@ -254,8 +254,8 @@ This element is `display:block` by default, but you can set the `inline` attribu
@apply --paper-input-container-label-floating;
}
:host(:dir(rtl)) .input-content.label-is-floating ::slotted(label),
:host(:dir(rtl)) .input-content.label-is-floating ::slotted(.paper-input-label) {
:host-context([dir="rtl"]) .input-content.label-is-floating ::slotted(label),
:host-context([dir="rtl"]) .input-content.label-is-floating ::slotted(.paper-input-label) {
right: 0;
left: auto;
transform-origin: right top;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -68,9 +68,6 @@ sed -i 's/['"$NBSP"']/\\u00A0/g' components/polymer/polymer-mini.html
rsync -c --delete -r -v --exclude-from="rsync_exclude.txt" \
--prune-empty-dirs "components/" "components-chromium/"
echo 'Minifying Polymer 2, since it comes non-minified from bower.'
python minify_polymer.py
find "components-chromium/" -name "*.html" \
! -path "components-chromium/polymer2*" | \
xargs grep -l "<script>" | \
......@@ -85,6 +82,9 @@ done
# a Polymer issue and/or pull request to minimize these patches.
patch -p1 --forward -r - < chromium.patch
echo 'Minifying Polymer 2, since it comes non-minified from bower.'
python minify_polymer.py
# Undo any changes in paper-ripple, since Chromium's implementation is a fork of
# the original paper-ripple.
git checkout -- components-chromium/paper-ripple/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment