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

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

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 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: third_party/polymer/components-chromium/core-splitter/core-splitter-extracted.js
diff --git a/third_party/polymer/components-chromium/core-splitter/core-splitter-extracted.js b/third_party/polymer/components-chromium/core-splitter/core-splitter-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..32135ab2cee5677c21b28ad07e2519f51f817407
--- /dev/null
+++ b/third_party/polymer/components-chromium/core-splitter/core-splitter-extracted.js
@@ -0,0 +1,92 @@
+
+
+ Polymer('core-splitter', {
+
+ /**
+ * Possible values are "left", "right", "up" and "down".
+ *
+ * @attribute direction
+ * @type string
+ * @default 'left'
+ */
+ direction: 'left',
+
+ /**
+ * Minimum width to which the splitter target can be sized
+ *
+ * @attribute minSize
+ * @type number
+ * @default 0
+ */
+ minSize: 0,
+
+ /**
+ * Locks the split bar so it can't be dragged.
+ *
+ * @attribute locked
+ * @type boolean
+ * @default false
+ */
+ locked: false,
+
+ /**
+ * By default the parent and siblings of the splitter are set to overflow hidden. This helps
+ * avoid elements bleeding outside the splitter regions. Set this property to true to allow
+ * these elements to overflow.
+ *
+ * @attribute allowOverflow
+ * @type boolean
+ * @default false
+ */
+ allowOverflow: false,
+
+ ready: function() {
+ this.directionChanged();
+ },
+
+ domReady: function() {
+ if (!this.allowOverflow) {
+ this.parentNode.style.overflow = this.nextElementSibling.style.overflow =
+ this.previousElementSibling.style.overflow = 'hidden';
+ }
+ },
+
+ directionChanged: function() {
+ this.isNext = this.direction === 'right' || this.direction === 'down';
+ this.horizontal = this.direction === 'up' || this.direction === 'down';
+ this.update();
+ },
+
+ update: function() {
+ this.target = this.isNext ? this.nextElementSibling : this.previousElementSibling;
+ this.dimension = this.horizontal ? 'height' : 'width';
+ this.classList.toggle('horizontal', this.horizontal);
+ },
+
+ targetChanged: function(old) {
+ if (old) {
+ old.style[old.__splitterMinSize] = '';
+ }
+ var min = this.target.__splitterMinSize = this.horizontal ? 'minHeight' : 'minWidth';
+ this.target.style[min] = this.minSize + 'px';
+ },
+
+ trackStart: function() {
+ this.update();
+ this.size = parseInt(getComputedStyle(this.target)[this.dimension]);
+ },
+
+ track: function(e) {
+ if (this.locked) {
+ return;
+ }
+ var d = e[this.horizontal ? 'dy' : 'dx'];
+ this.target.style[this.dimension] =
+ this.size + (this.isNext ? -d : d) + 'px';
+ },
+
+ preventSelection: function(e) {
+ e.preventDefault();
+ }
+ });
+

Powered by Google App Engine
This is Rietveld 408576698