|
1 <?xml version="1.0"?> |
|
2 |
|
3 <bindings |
|
4 xmlns="http://www.mozilla.org/xbl" |
|
5 xmlns:xbl="http://www.mozilla.org/xbl" |
|
6 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
7 xmlns:html="http://www.w3.org/1999/xhtml"> |
|
8 <binding id="selection-binding"> |
|
9 <content> |
|
10 <html:div flex="1" class="selection-overlay-inner window-width window-height" anonid="selection-overlay-inner"> |
|
11 <xul:stack> |
|
12 <html:div anonid="selection-overlay-debug" class="window-width window-height"/> |
|
13 <xul:toolbarbutton anonid="selectionhandle-mark1" class="selectionhandle" label="^" left="10" top="10" hidden="true"/> |
|
14 <xul:toolbarbutton anonid="selectionhandle-mark2" class="selectionhandle" label="^" left="10" top="10" hidden="true"/> |
|
15 <xul:toolbarbutton anonid="selectionhandle-mark3" class="selectionhandle" label="^" left="10" top="10" hidden="true"/> |
|
16 </xul:stack> |
|
17 </html:div> |
|
18 </content> |
|
19 |
|
20 <implementation implements="nsIDOMEventListener"> |
|
21 <field name="_selectionOverlay" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "selection-overlay-inner").parentNode;</field> |
|
22 <field name="_selectionDebugOverlay" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "selection-overlay-debug");</field> |
|
23 |
|
24 <property name="enabled"> |
|
25 <setter> |
|
26 <![CDATA[ |
|
27 if (val) { |
|
28 this._selectionOverlay.setAttribute("class", "selection-overlay window-width window-height"); |
|
29 } else { |
|
30 this._selectionOverlay.setAttribute("class", "selection-overlay-hidden"); |
|
31 } |
|
32 return val; |
|
33 ]]> |
|
34 </setter> |
|
35 <getter> |
|
36 <![CDATA[ |
|
37 return (this._selectionOverlay.getAttribute("class") == "selection-overlay"); |
|
38 ]]> |
|
39 </getter> |
|
40 </property> |
|
41 |
|
42 <property name="displayDebugLayer"> |
|
43 <setter> |
|
44 <![CDATA[ |
|
45 if (val) { |
|
46 this._selectionDebugOverlay.style.display = "block"; |
|
47 this._debugLayerVisible = true; |
|
48 } else { |
|
49 this._selectionDebugOverlay.style.display = "none"; |
|
50 this._debugLayerVisible = false; |
|
51 while(this._selectionDebugOverlay.hasChildNodes()) this._selectionDebugOverlay.removeChild(this._selectionDebugOverlay.firstChild); |
|
52 } |
|
53 return this._debugLayerVisible; |
|
54 ]]> |
|
55 </setter> |
|
56 <getter> |
|
57 <![CDATA[ |
|
58 if (this._debugLayerVisible == "undefined") |
|
59 this._debugLayerVisible = false; |
|
60 return this._debugLayerVisible; |
|
61 ]]> |
|
62 </getter> |
|
63 </property> |
|
64 |
|
65 <method name="getMarker"> |
|
66 <parameter name="aMarkerId"/> |
|
67 <body> |
|
68 <![CDATA[ |
|
69 return document.getAnonymousElementByAttribute(this, "anonid", aMarkerId); |
|
70 ]]> |
|
71 </body> |
|
72 </method> |
|
73 |
|
74 <method name="addDebugRect"> |
|
75 <parameter name="aLeft"/> |
|
76 <parameter name="aTop"/> |
|
77 <parameter name="aRight"/> |
|
78 <parameter name="aBottom"/> |
|
79 <parameter name="aColor"/> |
|
80 <parameter name="aFill"/> |
|
81 <parameter name="aId"/> |
|
82 <body> |
|
83 <![CDATA[ |
|
84 let e = document.createElement("div"); |
|
85 this._selectionDebugOverlay.appendChild(e); |
|
86 e.style.position = "fixed"; |
|
87 e.style.left = aLeft +"px"; |
|
88 e.style.top = aTop +"px"; |
|
89 e.style.right = aRight +"px"; |
|
90 e.style.bottom = aBottom +"px"; |
|
91 e.style.maxWidth = (aRight - aLeft) +"px"; |
|
92 e.style.width = (aRight - aLeft) +"px"; |
|
93 e.style.maxHeight = (aBottom - aTop) +"px"; |
|
94 e.style.height = (aBottom - aTop) +"px"; |
|
95 e.style.pointerEvents = "none"; |
|
96 if (aFill == undefined) { |
|
97 e.style.backgroundColor = aColor; |
|
98 } else { |
|
99 if (aFill) { |
|
100 e.style.backgroundColor = aColor; |
|
101 } else { |
|
102 e.style.border = "2px solid " + aColor; |
|
103 } |
|
104 } |
|
105 e.style.opacity = "0.5"; |
|
106 ]]> |
|
107 </body> |
|
108 </method> |
|
109 </implementation> |
|
110 </binding> |
|
111 </bindings> |