Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js

Issue 2074813002: Roll Polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chromium.patch Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js b/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
index 5f16e701b00421cb92231cadffaa48b4e0b5daff..1a0b2eb77c394f50c154b720adf56f4fcdf578d1 100644
--- a/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
@@ -215,8 +215,7 @@ return n;
return root;
}
}
-};
-(function () {
+};(function () {
function resolveCss(cssText, ownerDocument) {
return cssText.replace(CSS_URL_RX, function (m, pre, url, post) {
return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + post;
@@ -274,8 +273,7 @@ resolveCss: resolveCss,
resolveAttrs: resolveAttrs,
resolveUrl: resolveUrl
};
-}());
-Polymer.Base._addFeature({
+}());Polymer.Base._addFeature({
_prepAnnotations: function () {
if (!this._template) {
this._notes = [];
@@ -315,10 +313,12 @@ this._processAnnotations(note.templateContent._notes);
var pp = note.templateContent._parentProps = this._discoverTemplateParentProps(note.templateContent._notes);
var bindings = [];
for (var prop in pp) {
+var name = '_parent_' + prop;
bindings.push({
index: note.index,
kind: 'property',
-name: '_parent_' + prop,
+name: name,
+propertyName: name,
parts: [{
mode: '{',
model: prop,
@@ -343,6 +343,9 @@ if (model) {
pp[model] = true;
}
}
+if (p.signature.dynamicFn) {
+pp[p.signature.method] = true;
+}
} else {
if (p.model) {
pp[p.model] = true;
@@ -433,8 +436,7 @@ this.listen(node, e.name, e.value);
}
}
}
-});
-Polymer.Base._addFeature({
+});Polymer.Base._addFeature({
listeners: {},
_listenListeners: function (listeners) {
var node, name, eventName;
@@ -515,8 +517,7 @@ node.addEventListener(eventName, handler);
_unlisten: function (node, eventName, handler) {
node.removeEventListener(eventName, handler);
}
-});
-(function () {
+});(function () {
'use strict';
var wrap = Polymer.DomApi.wrap;
var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
@@ -697,9 +698,9 @@ if (type === 'touchstart' || type === 'touchmove') {
Gestures.handleTouchAction(ev);
}
}
-if (type === 'touchend' && !ev.__polymerSimulatedTouch) {
+if (type === 'touchend') {
POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget;
-ignoreMouse(true);
+ignoreMouse();
}
}
}
@@ -847,6 +848,11 @@ var recognizer = this.findRecognizerByEvent(evName);
if (recognizer.info) {
recognizer.info.prevent = true;
}
+},
+resetMouseCanceller: function () {
+if (POINTERSTATE.mouse.mouseIgnoreJob) {
+POINTERSTATE.mouse.mouseIgnoreJob.complete();
+}
}
};
Gestures.register({
@@ -1159,8 +1165,7 @@ Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
}
});
Polymer.Gestures = Gestures;
-}());
-Polymer.Base._addFeature({
+}());Polymer.Base._addFeature({
$$: function (slctr) {
return Polymer.dom(this.root).querySelector(slctr);
},
@@ -1336,9 +1341,7 @@ return this !== node && this.contains(node) && Polymer.dom(this).getOwnerRoot()
isLocalDescendant: function (node) {
return this.root === Polymer.dom(node).getOwnerRoot();
}
-});
-Polymer.Bind = {
-_dataEventCache: {},
+});Polymer.Bind = {
prepareModel: function (model) {
Polymer.Base.mixin(model, this._modelApi);
},
@@ -1511,8 +1514,7 @@ element.addEventListener(event, function (e) {
return context._notifyListener(changedFn, e);
});
}
-};
-Polymer.Base.extend(Polymer.Bind, {
+};Polymer.Base.extend(Polymer.Bind, {
_shouldAddListener: function (effect) {
return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !effect.isCompound && effect.parts[0].mode === '{';
},
@@ -1521,10 +1523,7 @@ if (source != effect.value) {
value = this._get(effect.value);
this.__data__[effect.value] = value;
}
-var calc = effect.negate ? !value : value;
-if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) {
-return this._applyEffectValue(effect, calc);
-}
+this._applyEffectValue(effect, value);
},
_reflectEffect: function (source, value, effect) {
this.reflectPropertyToAttribute(source, effect.attribute, value);
@@ -1577,9 +1576,6 @@ if (fn) {
var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
if (args) {
var computedvalue = fn.apply(computedHost, args);
-if (effect.negate) {
-computedvalue = !computedvalue;
-}
this._applyEffectValue(effect, computedvalue);
}
} else if (effect.dynamicFn) {
@@ -1597,17 +1593,19 @@ var name = arg.name;
var v;
if (arg.literal) {
v = arg.value;
-} else if (arg.structured) {
-v = Polymer.Base._get(name, model);
+} else if (path === name) {
+v = value;
} else {
v = model[name];
+if (v === undefined && arg.structured) {
+v = Polymer.Base._get(name, model);
+}
}
if (bailoutEarly && v === undefined) {
return;
}
if (arg.wildcard) {
-var baseChanged = name.indexOf(path + '.') === 0;
-var matches = effect.trigger.name.indexOf(name) === 0 && !baseChanged;
+var matches = path.indexOf(name + '.') === 0;
values[i] = {
path: matches ? path : name,
value: matches ? value : v,
@@ -1619,8 +1617,7 @@ values[i] = v;
}
return values;
}
-});
-Polymer.Base._addFeature({
+});Polymer.Base._addFeature({
_addPropertyEffect: function (property, kind, effect) {
var prop = Polymer.Bind.addPropertyEffect(this, property, kind, effect);
prop.pathFn = this['_' + prop.kind + 'PathEffect'];
@@ -1855,33 +1852,45 @@ Polymer.Bind.setupBindListeners(this);
_applyEffectValue: function (info, value) {
var node = this._nodes[info.index];
var property = info.name;
+value = this._computeFinalAnnotationValue(node, property, value, info);
+if (info.customEvent && node[property] === value) {
+return;
+}
+if (info.kind == 'attribute') {
+this.serializeValueToAttribute(value, property, node);
+} else {
+var pinfo = node._propertyInfo && node._propertyInfo[property];
+if (pinfo && pinfo.readOnly) {
+return;
+}
+this.__setProperty(property, value, false, node);
+}
+},
+_computeFinalAnnotationValue: function (node, property, value, info) {
+if (info.negate) {
+value = !value;
+}
if (info.isCompound) {
var storage = node.__compoundStorage__[property];
storage[info.compoundIndex] = value;
value = storage.join('');
}
-if (info.kind == 'attribute') {
-this.serializeValueToAttribute(value, property, node);
-} else {
+if (info.kind !== 'attribute') {
if (property === 'className') {
value = this._scopeElementClass(node, value);
}
if (property === 'textContent' || node.localName == 'input' && property == 'value') {
value = value == undefined ? '' : value;
}
-var pinfo;
-if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.readOnly) {
-this.__setProperty(property, value, false, node);
-}
}
+return value;
},
_executeStaticEffects: function () {
if (this._propertyEffects && this._propertyEffects.__static__) {
this._effectEffects('__static__', null, this._propertyEffects.__static__);
}
}
-});
-(function () {
+});(function () {
var usePolyfillProto = Polymer.Settings.usePolyfillProto;
Polymer.Base._addFeature({
_setupConfigure: function (initialConfig) {
@@ -1948,13 +1957,14 @@ for (var p in config) {
var fx = fx$[p];
if (fx) {
for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
-if (x.kind === 'annotation' && !x.isCompound) {
+if (x.kind === 'annotation') {
var node = this._nodes[x.effect.index];
var name = x.effect.propertyName;
var isAttr = x.effect.kind == 'attribute';
var hasEffect = node._propertyEffects && node._propertyEffects[name];
if (node._configValue && (hasEffect || !isAttr)) {
var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config);
+value = this._computeFinalAnnotationValue(node, name, value, x.effect);
if (isAttr) {
value = node.deserialize(this.serialize(value), node._propertyInfo[name].type);
}
@@ -2008,13 +2018,15 @@ h[0].call(this, h[1], h[2], h[3]);
this._handlers = [];
}
});
-}());
-(function () {
+}());(function () {
'use strict';
Polymer.Base._addFeature({
notifyPath: function (path, value, fromAbove) {
var info = {};
-this._get(path, this, info);
+var v = this._get(path, this, info);
+if (arguments.length === 1) {
+value = v;
+}
if (info.path) {
this._notifyPath(info.path, value, fromAbove);
}
@@ -2212,17 +2224,13 @@ var change = {
keySplices: Polymer.Collection.applySplices(array, splices),
indexSplices: splices
};
-if (!array.hasOwnProperty('splices')) {
-Object.defineProperty(array, 'splices', {
-configurable: true,
-writable: true
-});
-}
-array.splices = change;
-this._notifyPath(path + '.splices', change);
+var splicesPath = path + '.splices';
+this._notifyPath(splicesPath, change);
this._notifyPath(path + '.length', array.length);
-change.keySplices = null;
-change.indexSplices = null;
+this.__data__[splicesPath] = {
+keySplices: null,
+indexSplices: null
+};
},
_notifySplice: function (array, path, index, added, removed) {
this._notifySplices(array, path, [{
@@ -2317,8 +2325,7 @@ _getPathParts: Polymer.Base._getPathParts
});
}
});
-}());
-Polymer.Base._addFeature({
+}());Polymer.Base._addFeature({
resolveUrl: function (url) {
var module = Polymer.DomModule.import(this.is);
var root = '';
@@ -2328,8 +2335,7 @@ root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
}
return Polymer.ResolveUrl.resolveUrl(url, root);
}
-});
-Polymer.CssParse = function () {
+});Polymer.CssParse = function () {
return {
parse: function (text) {
text = this._clean(text);
@@ -2472,8 +2478,7 @@ VAR_START: '--',
MEDIA_START: '@media',
AT_START: '@'
};
-}();
-Polymer.StyleUtil = function () {
+}();Polymer.StyleUtil = function () {
return {
MODULE_STYLES_SELECTOR: 'style:not([no-process]), link[rel=import][type~=css], template',
INCLUDE_ATTR: 'include',
@@ -2523,6 +2528,9 @@ this.forEachRule(r, styleRuleCallback, keyframesRuleCallback);
},
applyCss: function (cssText, moniker, target, contextNode) {
var style = this.createScopeStyle(cssText, moniker);
+return this.applyStyle(style, target, contextNode);
+},
+applyStyle: function (style, target, contextNode) {
target = target || document.head;
var after = contextNode && contextNode.nextSibling || target.firstChild;
this.__lastHeadApplyNode = style;
@@ -2591,8 +2599,7 @@ resolveCss: Polymer.ResolveUrl.resolveCss,
parser: Polymer.CssParse,
ruleTypes: Polymer.CssParse.types
};
-}();
-Polymer.StyleTransformer = function () {
+}();Polymer.StyleTransformer = function () {
var nativeShadow = Polymer.Settings.useNativeShadow;
var styleUtil = Polymer.StyleUtil;
var api = {
@@ -2775,8 +2782,7 @@ var PSEUDO_PREFIX = ':';
var CLASS = 'class';
var CONTENT_START = new RegExp('^(' + CONTENT + ')');
return api;
-}();
-Polymer.StyleExtends = function () {
+}();Polymer.StyleExtends = function () {
var styleUtil = Polymer.StyleUtil;
return {
hasExtends: function (cssText) {
@@ -2846,8 +2852,7 @@ EXTEND: /@extends\(([^)]*)\)\s*?;/gim,
STRIP: /%[^,]*$/
}
};
-}();
-(function () {
+}();(function () {
var prepElement = Polymer.Base._prepElement;
var nativeShadow = Polymer.Settings.useNativeShadow;
var styleUtil = Polymer.StyleUtil;
@@ -2952,8 +2957,7 @@ return mo;
}
}
});
-}());
-Polymer.StyleProperties = function () {
+}());Polymer.StyleProperties = function () {
'use strict';
var nativeShadow = Polymer.Settings.useNativeShadow;
var matchesSelector = Polymer.DomApi.matchesSelector;
@@ -3215,12 +3219,20 @@ if (s._useCount <= 0 && s.parentNode) {
s.parentNode.removeChild(s);
}
}
-if (nativeShadow || (!style || !style.parentNode)) {
-if (nativeShadow && element._customStyle) {
+if (nativeShadow) {
+if (element._customStyle) {
element._customStyle.textContent = cssText;
style = element._customStyle;
} else if (cssText) {
-style = styleUtil.applyCss(cssText, selector, nativeShadow ? element.root : null, element._scopeStyle);
+style = styleUtil.applyCss(cssText, selector, element.root);
+}
+} else {
+if (!style) {
+if (cssText) {
+style = styleUtil.applyCss(cssText, selector, null, element._scopeStyle);
+}
+} else if (!style.parentNode) {
+styleUtil.applyStyle(style, null, element._scopeStyle);
}
}
if (style) {
@@ -3261,8 +3273,7 @@ var o = parseInt(n / 32);
var v = 1 << n % 32;
bits[o] = (bits[o] || 0) | v;
}
-}();
-(function () {
+}();(function () {
Polymer.StyleCache = function () {
this.cache = {};
};
@@ -3308,8 +3319,7 @@ _objectsStrictlyEqual: function (target, source) {
return this._objectsEqual(target, source) && this._objectsEqual(source, target);
}
};
-}());
-Polymer.StyleDefaults = function () {
+}());Polymer.StyleDefaults = function () {
var styleProperties = Polymer.StyleProperties;
var StyleCache = Polymer.StyleCache;
var api = {
@@ -3350,8 +3360,7 @@ s._apply();
}
};
return api;
-}();
-(function () {
+}();(function () {
'use strict';
var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
var propertyUtils = Polymer.StyleProperties;
@@ -3512,8 +3521,7 @@ var styleCache = new Polymer.StyleCache();
Polymer.customStyleCache = styleCache;
var SCOPE_NAME = styleTransformer.SCOPE_NAME;
var XSCOPE_NAME = propertyUtils.XSCOPE_NAME;
-}());
-Polymer.Base._addFeature({
+}());Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();
this._prepConstructor();
@@ -3559,8 +3567,7 @@ if (b.listeners) {
this._listenListeners(b.listeners);
}
}
-});
-(function () {
+});(function () {
var propertyUtils = Polymer.StyleProperties;
var styleUtil = Polymer.StyleUtil;
var cssParse = Polymer.CssParse;
@@ -3633,8 +3640,7 @@ rule.cssText = propertyUtils.valueForProperties(css, props);
});
}
});
-}());
-Polymer.Templatizer = {
+}());Polymer.Templatizer = {
properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
_instanceProps: Polymer.nob,
_parentPropPrefix: '_parent_',
@@ -3824,7 +3830,7 @@ var dot = path.indexOf('.');
var root = dot < 0 ? path : path.slice(0, dot);
dataHost._forwardInstancePath.call(dataHost, this, path, value);
if (root in dataHost._parentProps) {
-dataHost._templatized.notifyPath(dataHost._parentPropPrefix + path, value);
+dataHost._templatized._notifyPath(dataHost._parentPropPrefix + path, value);
}
},
_pathEffectorImpl: function (path, value, fromAbove) {
@@ -3877,6 +3883,7 @@ var host = this._rootDataHost;
if (host) {
return host._scopeElementClass(node, value);
}
+return value;
},
stamp: function (model) {
model = model || {};
@@ -3904,8 +3911,7 @@ el = el.parentNode;
}
}
}
-};
-Polymer({
+};Polymer({
is: 'dom-template',
extends: 'template',
_template: null,
@@ -3913,8 +3919,7 @@ behaviors: [Polymer.Templatizer],
ready: function () {
this.templatize(this);
}
-});
-Polymer._collections = new WeakMap();
+});Polymer._collections = new WeakMap();
Polymer.Collection = function (userArray) {
Polymer._collections.set(userArray, this);
this.userArray = userArray;
@@ -4049,8 +4054,7 @@ return Polymer._collections.get(userArray) || new Polymer.Collection(userArray);
Polymer.Collection.applySplices = function (userArray, splices) {
var coll = Polymer._collections.get(userArray);
return coll ? coll._applySplices(splices) : null;
-};
-Polymer({
+};Polymer({
is: 'dom-repeat',
extends: 'template',
_template: null,
@@ -4516,8 +4520,7 @@ indexForElement: function (el) {
var instance = this.modelForElement(el);
return instance && instance[this.indexAs];
}
-});
-Polymer({
+});Polymer({
is: 'array-selector',
_template: null,
properties: {
@@ -4608,8 +4611,7 @@ this.linkPaths('selectedItem', 'items.' + key);
}
}
}
-});
-Polymer({
+});Polymer({
is: 'dom-if',
extends: 'template',
_template: null,
@@ -4709,8 +4711,7 @@ if (this._instance) {
this._instance._notifyPath(path, value, true);
}
}
-});
-Polymer({
+});Polymer({
is: 'dom-bind',
extends: 'template',
_template: null,

Powered by Google App Engine
This is Rietveld 408576698