Skip to content

Commit 6d5a049

Browse files
author
Victor Porof
committed
Bug 1503824 - Migrate the treecols binding into a custom element. r=bgrins
1 parent a056a49 commit 6d5a049

File tree

4 files changed

+29
-30
lines changed

4 files changed

+29
-30
lines changed

layout/generic/crashtests/crashtests.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ load 382199-1.html
115115
load 382208-1.xhtml
116116
load 382262-1.html
117117
load 382396-1.xhtml
118-
asserts(1) load 382745-1.xhtml # Bug 758695
118+
load 382745-1.xhtml # Bug 758695
119119
load 383089-1.html
120120
load 385265-1.xhtml
121121
load 385295-1.xhtml

toolkit/content/widgets/tree.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,4 +410,30 @@
410410

411411
customElements.define("treecol", MozTreecol);
412412

413+
class MozTreecols extends MozElements.BaseControl {
414+
connectedCallback() {
415+
if (this.delayConnectedCallback()) {
416+
return;
417+
}
418+
419+
if (!this.querySelector("treecolpicker")) {
420+
this.appendChild(MozXULElement.parseXULToFragment(`
421+
<treecolpicker class="treecol-image" fixed="true"></treecolpicker>
422+
`));
423+
}
424+
425+
let treecolpicker = this.querySelector("treecolpicker");
426+
this.inheritAttribute(treecolpicker, "tooltiptext=pickertooltiptext");
427+
428+
// Set resizeafter="farthest" on the splitters if nothing else has been
429+
// specified.
430+
Array.forEach(this.getElementsByTagName("splitter"), function(splitter) {
431+
if (!splitter.hasAttribute("resizeafter"))
432+
splitter.setAttribute("resizeafter", "farthest");
433+
});
434+
}
435+
}
436+
437+
customElements.define("treecols", MozTreecols);
438+
413439
}

toolkit/content/widgets/tree.xml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -884,25 +884,6 @@
884884
</handlers>
885885
</binding>
886886

887-
<binding id="treecols">
888-
<content orient="horizontal">
889-
<xul:hbox class="tree-scrollable-columns" flex="1">
890-
<children includes="treecol|splitter"/>
891-
</xul:hbox>
892-
<xul:treecolpicker class="treecol-image" fixed="true" xbl:inherits="tooltiptext=pickertooltiptext"/>
893-
</content>
894-
<implementation>
895-
<constructor><![CDATA[
896-
// Set resizeafter="farthest" on the splitters if nothing else has been
897-
// specified.
898-
Array.forEach(this.getElementsByTagName("splitter"), function(splitter) {
899-
if (!splitter.hasAttribute("resizeafter"))
900-
splitter.setAttribute("resizeafter", "farthest");
901-
});
902-
]]></constructor>
903-
</implementation>
904-
</binding>
905-
906887
<binding id="treerows" extends="chrome://global/content/bindings/general.xml#basecontrol">
907888
<content>
908889
<xul:hbox flex="1" class="tree-bodybox">
@@ -1008,6 +989,7 @@
1008989
var menuitem = document.getAnonymousElementByAttribute(this, "anonid", "menuitem");
1009990
if (event.originalTarget == menuitem) {
1010991
tree.columns.restoreNaturalOrder();
992+
this.removeAttribute("ordinal");
1011993
tree._ensureColumnOrder();
1012994
} else {
1013995
var colindex = event.originalTarget.getAttribute("colindex");

toolkit/content/xul.css

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,7 @@ tree {
438438
-moz-binding: url("chrome://global/content/bindings/tree.xml#tree");
439439
}
440440

441-
treecols {
442-
-moz-binding: url("chrome://global/content/bindings/tree.xml#treecols");
443-
}
444-
445-
treecol {
441+
treecolpicker {
446442
-moz-box-ordinal-group: 2147483646;
447443
}
448444

@@ -481,11 +477,6 @@ treecol[hidden="true"] {
481477
display: -moz-box;
482478
}
483479

484-
.tree-scrollable-columns {
485-
/* Yes, Virginia, this makes it scrollable */
486-
overflow: hidden;
487-
}
488-
489480
/* ::::: lines connecting cells ::::: */
490481
tree:not([treelines="true"]) > treechildren::-moz-tree-line {
491482
visibility: hidden;

0 commit comments

Comments
 (0)