browser/metro/base/content/bindings/selectionoverlay.xml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/metro/base/content/bindings/selectionoverlay.xml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,111 @@
     1.4 +<?xml version="1.0"?>
     1.5 +
     1.6 +<bindings
     1.7 +    xmlns="http://www.mozilla.org/xbl"
     1.8 +    xmlns:xbl="http://www.mozilla.org/xbl"
     1.9 +    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.10 +    xmlns:html="http://www.w3.org/1999/xhtml">
    1.11 +  <binding id="selection-binding">  
    1.12 +    <content>
    1.13 +      <html:div flex="1" class="selection-overlay-inner window-width window-height" anonid="selection-overlay-inner">
    1.14 +        <xul:stack>
    1.15 +          <html:div anonid="selection-overlay-debug" class="window-width window-height"/>
    1.16 +          <xul:toolbarbutton anonid="selectionhandle-mark1" class="selectionhandle" label="^" left="10" top="10" hidden="true"/>
    1.17 +          <xul:toolbarbutton anonid="selectionhandle-mark2" class="selectionhandle" label="^" left="10" top="10" hidden="true"/>
    1.18 +          <xul:toolbarbutton anonid="selectionhandle-mark3" class="selectionhandle" label="^" left="10" top="10" hidden="true"/>
    1.19 +        </xul:stack>
    1.20 +      </html:div>
    1.21 +    </content>
    1.22 +
    1.23 +    <implementation implements="nsIDOMEventListener">
    1.24 +      <field name="_selectionOverlay" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "selection-overlay-inner").parentNode;</field>
    1.25 +      <field name="_selectionDebugOverlay" readonly="true">document.getAnonymousElementByAttribute(this, "anonid", "selection-overlay-debug");</field>
    1.26 +
    1.27 +      <property name="enabled">
    1.28 +        <setter>
    1.29 +          <![CDATA[
    1.30 +            if (val) {
    1.31 +              this._selectionOverlay.setAttribute("class", "selection-overlay window-width window-height");
    1.32 +            } else {
    1.33 +              this._selectionOverlay.setAttribute("class", "selection-overlay-hidden");
    1.34 +            }
    1.35 +            return val;
    1.36 +          ]]>
    1.37 +        </setter>
    1.38 +        <getter>
    1.39 +          <![CDATA[
    1.40 +          return (this._selectionOverlay.getAttribute("class") == "selection-overlay");
    1.41 +        ]]>
    1.42 +        </getter>
    1.43 +      </property>
    1.44 +
    1.45 +      <property name="displayDebugLayer">
    1.46 +        <setter>
    1.47 +          <![CDATA[
    1.48 +            if (val) {
    1.49 +              this._selectionDebugOverlay.style.display = "block";
    1.50 +              this._debugLayerVisible = true;
    1.51 +            } else {
    1.52 +              this._selectionDebugOverlay.style.display = "none";
    1.53 +              this._debugLayerVisible = false;
    1.54 +              while(this._selectionDebugOverlay.hasChildNodes()) this._selectionDebugOverlay.removeChild(this._selectionDebugOverlay.firstChild);
    1.55 +            }
    1.56 +            return this._debugLayerVisible;
    1.57 +          ]]>
    1.58 +        </setter>
    1.59 +        <getter>
    1.60 +          <![CDATA[
    1.61 +          if (this._debugLayerVisible == "undefined")
    1.62 +            this._debugLayerVisible = false;
    1.63 +          return this._debugLayerVisible;
    1.64 +        ]]>
    1.65 +        </getter>
    1.66 +      </property>
    1.67 +
    1.68 +      <method name="getMarker">
    1.69 +        <parameter name="aMarkerId"/>
    1.70 +        <body>
    1.71 +          <![CDATA[
    1.72 +            return document.getAnonymousElementByAttribute(this, "anonid", aMarkerId);
    1.73 +          ]]>
    1.74 +        </body>
    1.75 +      </method>
    1.76 +
    1.77 +      <method name="addDebugRect">
    1.78 +        <parameter name="aLeft"/>
    1.79 +        <parameter name="aTop"/>
    1.80 +        <parameter name="aRight"/>
    1.81 +        <parameter name="aBottom"/>
    1.82 +        <parameter name="aColor"/>
    1.83 +        <parameter name="aFill"/>
    1.84 +        <parameter name="aId"/>
    1.85 +        <body>
    1.86 +          <![CDATA[
    1.87 +            let e = document.createElement("div");
    1.88 +            this._selectionDebugOverlay.appendChild(e);
    1.89 +            e.style.position = "fixed";
    1.90 +            e.style.left = aLeft +"px";
    1.91 +            e.style.top = aTop +"px";
    1.92 +            e.style.right = aRight +"px";
    1.93 +            e.style.bottom = aBottom +"px";
    1.94 +            e.style.maxWidth = (aRight - aLeft) +"px";
    1.95 +            e.style.width = (aRight - aLeft) +"px";
    1.96 +            e.style.maxHeight = (aBottom - aTop) +"px";
    1.97 +            e.style.height = (aBottom - aTop) +"px";
    1.98 +            e.style.pointerEvents = "none";
    1.99 +            if (aFill == undefined) {
   1.100 +              e.style.backgroundColor = aColor;
   1.101 +            } else {
   1.102 +              if (aFill) {
   1.103 +                e.style.backgroundColor = aColor;
   1.104 +              } else {
   1.105 +                e.style.border = "2px solid " + aColor;
   1.106 +              }
   1.107 +            }
   1.108 +            e.style.opacity = "0.5";
   1.109 +          ]]>
   1.110 +        </body>
   1.111 +      </method>
   1.112 +    </implementation>
   1.113 +  </binding>
   1.114 +</bindings>

mercurial