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

Unified Diff: chrome/browser/resources/md_history/app.crisper.js

Issue 2282403005: MD WebUI: Move history-lazy-render into cr-elements (Closed)
Patch Set: Rebase Created 4 years, 3 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: chrome/browser/resources/md_history/app.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 5c59999cf99ed85493d2ec41e31eb44ffd69c83d..8d12dc9b2acc3404c50574e36a829109968e579b 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -5380,6 +5380,53 @@ Polymer({
}
});
+// 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.
+Polymer({
+ is: 'cr-lazy-render',
+ "extends": 'template',
+ behaviors: [ Polymer.Templatizer ],
+ _renderPromise: null,
+ _instance: null,
+ get: function() {
+ if (!this._renderPromise) {
+ this._renderPromise = new Promise(function(resolve) {
+ this._debounceTemplate(function() {
+ this._render();
+ this._renderPromise = null;
+ resolve(this.getIfExists());
+ }.bind(this));
+ }.bind(this));
+ }
+ return this._renderPromise;
+ },
+ getIfExists: function() {
+ if (this._instance) {
+ var children = this._instance._children;
+ for (var i = 0; i < children.length; i++) {
+ if (children[i].nodeType == Node.ELEMENT_NODE) return children[i];
+ }
+ }
+ return null;
+ },
+ _render: function() {
+ if (!this.ctor) this.templatize(this);
+ var parentNode = this.parentNode;
+ if (parentNode && !this._instance) {
+ this._instance = this.stamp({});
+ var root = this._instance.root;
+ parentNode.insertBefore(root, this);
+ }
+ },
+ _forwardParentProp: function(prop, value) {
+ if (this._instance) this._instance.__setProperty(prop, value, true);
+ },
+ _forwardParentPath: function(path, value) {
+ if (this._instance) this._instance._notifyPath(path, value, true);
+ }
+});
+
(function() {
'use strict';
Polymer.IronA11yAnnouncer = Polymer({
@@ -6040,53 +6087,6 @@ Polymer({
}
});
-// 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.
-Polymer({
- is: 'history-lazy-render',
- "extends": 'template',
- behaviors: [ Polymer.Templatizer ],
- _renderPromise: null,
- _instance: null,
- get: function() {
- if (!this._renderPromise) {
- this._renderPromise = new Promise(function(resolve) {
- this._debounceTemplate(function() {
- this._render();
- this._renderPromise = null;
- resolve(this.getIfExists());
- }.bind(this));
- }.bind(this));
- }
- return this._renderPromise;
- },
- getIfExists: function() {
- if (this._instance) {
- var children = this._instance._children;
- for (var i = 0; i < children.length; i++) {
- if (children[i].nodeType == Node.ELEMENT_NODE) return children[i];
- }
- }
- return null;
- },
- _render: function() {
- if (!this.ctor) this.templatize(this);
- var parentNode = this.parentNode;
- if (parentNode && !this._instance) {
- this._instance = this.stamp({});
- var root = this._instance.root;
- parentNode.insertBefore(root, this);
- }
- },
- _forwardParentProp: function(prop, value) {
- if (this._instance) this._instance.__setProperty(prop, value, true);
- },
- _forwardParentPath: function(path, value) {
- if (this._instance) this._instance._notifyPath(path, value, true);
- }
-});
-
// 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.

Powered by Google App Engine
This is Rietveld 408576698