/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

%include tree.css
%filter substitution
%define selectedBorderColor rgb(217,217,217)
%define hoverAndFocusBorderColor rgb(125,162,206)
%define selectedFocusBorderColor rgb(132,172,221)
%define hoverBorderColor rgb(184,214,251)
%define whiteOpacityBorderColor rgba(255,255,255,.4)
%define whiteOpacityBottomBorderColor rgba(255,255,255,.6)
%define selectedGradientColor1 rgba(190,190,190,.1)
%define selectedGradientColor2 rgba(190,190,190,.4)
%define selectedFocusGradientColor1 rgba(131,183,249,.16)
%define selectedFocusGradientColor2 rgba(131,183,249,.375)
%define hoverAndCurrentFocusGradientColor1 rgba(131,183,249,.28)
%define hoverAndCurrentFocusGradientColor2 rgba(131,183,249,.5)
%define hoverGradientColor1 rgba(131,183,249,.05)
%define hoverGradientColor2 rgba(131,183,249,.16)

/* ::::: twisty :::::  */

treechildren::-moz-tree-indentation {
  width: 12px;
}

treechildren::-moz-tree-twisty {
  -moz-padding-end: 1px;
  width: 9px;
}

/*
  Please note that the following RTL icons are only available in Aero themes:
   * chrome://global/skin/tree/twisty-clsd-hover.png
   * chrome://global/skin/tree/twisty-open-hover.png
   * chrome://global/skin/tree/twisty-clsd-rtl.png
   * chrome://global/skin/tree/twisty-open-rtl.png
   * chrome://global/skin/tree/twisty-clsd-hover-rtl.png
   * chrome://global/skin/tree/twisty-open-hover-rtl.png
*/
treechildren::-moz-tree-twisty(hover) {
  list-style-image: url("chrome://global/skin/tree/twisty-clsd-hover.png");
}

treechildren::-moz-tree-twisty(hover, open) {
  list-style-image: url("chrome://global/skin/tree/twisty-open-hover.png");
}

treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty {
  list-style-image: url("chrome://global/skin/tree/twisty-clsd-rtl.png");
}

treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(open) {
  list-style-image: url("chrome://global/skin/tree/twisty-open-rtl.png");
}

treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover) {
  list-style-image: url("chrome://global/skin/tree/twisty-clsd-hover-rtl.png");
}

treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover, open) {
  list-style-image: url("chrome://global/skin/tree/twisty-open-hover-rtl.png");
}

@media (-moz-windows-default-theme) {
  treechildren:not(.autocomplete-treebody)::-moz-tree-row {
    height: 1.8em;
    color: -moz-FieldText;
    -moz-margin-start: 1px;
    -moz-margin-end: 1px;
    border-width: 2px;
    border-color: transparent;
    border-radius: 3px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    -moz-outline-radius: 3px;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected) {
    -moz-border-top-colors: @selectedBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @selectedBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @selectedBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @selectedBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@selectedGradientColor1@, @selectedGradientColor2@);
    background-color: transparent;
    outline: 1px solid @whiteOpacityBorderColor@;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(current, focus) {
    border-style: solid;
    -moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @hoverAndFocusBorderColor@ @whiteOpacityBottomBorderColor@;
    outline: 1px solid @whiteOpacityBorderColor@;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected, focus),
  treechildren::-moz-tree-row(dropOn) {
    -moz-border-top-colors: @selectedFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @selectedFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @selectedFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @selectedFocusBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@selectedFocusGradientColor1@, @selectedFocusGradientColor2@);
    background-color: transparent;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected, current, focus) {
    border-style: solid;
    -moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @hoverAndFocusBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@hoverAndCurrentFocusGradientColor1@, @hoverAndCurrentFocusGradientColor2@);
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover) {
    -moz-border-top-colors: @hoverBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @hoverBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @hoverBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @hoverBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@hoverGradientColor1@, @hoverGradientColor2@);
    outline: 1px solid @whiteOpacityBorderColor@;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover, current) {
    -moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @hoverAndFocusBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@hoverGradientColor1@, @hoverGradientColor2@);
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover, selected) {
    -moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
    -moz-border-bottom-colors: @hoverAndFocusBorderColor@ @whiteOpacityBottomBorderColor@;
    background-image: linear-gradient(@hoverAndCurrentFocusGradientColor1@, @hoverAndCurrentFocusGradientColor2@);
  }

  tree[disabled="true"] > treechildren::-moz-tree-row {
    background: none;
    -moz-border-top-colors: transparent;
    -moz-border-right-colors: transparent;
    -moz-border-left-colors: transparent;
    -moz-border-bottom-colors: transparent;
  }

  treechildren::-moz-tree-cell(dropOn) {
    background-image: none;
    background-color: transparent;
    border-radius: 0;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-cell-text {
    padding-bottom: initial;
    border-color: transparent;
    background-color: transparent;
  }

  treechildren:not(.autocomplete-treebody)::-moz-tree-cell-text(selected, focus) {
    color: -moz-DialogText;
  }

  @media (-moz-os-version: windows-win8) {
    treechildren:not(.autocomplete-treebody)::-moz-tree-row {
      border-width: 1px;
      border-radius: 0;
      -moz-outline-radius: 0;
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected) {
      background-image: linear-gradient(@selectedGradientColor2@, @selectedGradientColor2@);
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected, focus),
    treechildren::-moz-tree-row(dropOn) {
      background-image: linear-gradient(@selectedFocusGradientColor2@, @selectedFocusGradientColor2@);
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected, current, focus) {
      background-image: linear-gradient(@hoverAndCurrentFocusGradientColor2@, @hoverAndCurrentFocusGradientColor2@);
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover) {
      background-image: linear-gradient(@hoverGradientColor2@, @hoverGradientColor2@);
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover, current) {
      background-image: linear-gradient(@hoverGradientColor2@, @hoverGradientColor2@);
    }

    treechildren:not(.autocomplete-treebody)::-moz-tree-row(hover, selected) {
      background-image: linear-gradient(@hoverAndCurrentFocusGradientColor2@, @hoverAndCurrentFocusGradientColor2@);
    }
  }
}
