summaryrefslogtreecommitdiffstats
path: root/layout/style/res/accessiblecaret.css
blob: a994910a5634c9d932104b98c8606e4098325a93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* 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/. */

:host {
  /* Add transition effect to make caret size changing smoother. */
  transition-property: width, height, margin-left;

  position: absolute;
  z-index: 2147483647;
}

#image,
#text-overlay {
  width: 100%;

  /* Override this property in moz-custom-content-container to make dummy touch
   * listener work. */
  pointer-events: auto;
}

#image {
  background-position: center top;
  background-size: 100%;
  background-repeat: no-repeat;
  background-origin: content-box;
}

:host(.normal) #image {
  background-image: image-set(
    url("resource://gre-resources/accessiblecaret-normal@1x.png"),
    url("resource://gre-resources/accessiblecaret-normal@1.5x.png") 1.5x,
    url("resource://gre-resources/accessiblecaret-normal@2x.png") 2x,
    url("resource://gre-resources/accessiblecaret-normal@2.25x.png") 2.25x
  );
}

:host(.left) #image,
:host(.left) #text-overlay {
  margin-left: -39%;
}

:host(.left) > #image {
  background-image: image-set(
    url("resource://gre-resources/accessiblecaret-tilt-left@1x.png"),
    url("resource://gre-resources/accessiblecaret-tilt-left@1.5x.png") 1.5x,
    url("resource://gre-resources/accessiblecaret-tilt-left@2x.png") 2x,
    url("resource://gre-resources/accessiblecaret-tilt-left@2.25x.png") 2.25x
  );
}

:host(.right) #image,
:host(.right) #text-overlay {
  margin-left: 41%;
}

:host(.right) #image {
  background-image: image-set(
    url("resource://gre-resources/accessiblecaret-tilt-right@1x.png"),
    url("resource://gre-resources/accessiblecaret-tilt-right@1.5x.png") 1.5x,
    url("resource://gre-resources/accessiblecaret-tilt-right@2x.png") 2x,
    url("resource://gre-resources/accessiblecaret-tilt-right@2.25x.png") 2.25x
  );
}

:host(.none) {
  display: none;
}

:host(.hidden) {
  visibility: hidden;
}

@media (-moz-platform: android) {
  #image,
  #text-overlay {
    /* border: 0.1px solid red; */ /* Uncomment border to see the touch target. */
    padding-left: 59%; /* Enlarge the touch area. ((48-22)/2)px / 22px ~= 59% */
    padding-right: 59%; /* Enlarge the touch area. */
    margin-left: -59%;
  }

  #image {
    padding-bottom: 59%; /* Enlarge the touch area. */
  }

  :host(.normal) #image {
    background-image: url("resource://gre-resources/accessiblecaret-normal.svg");
  }

  :host(.left) #image,
  :host(.left) #text-overlay {
    margin-left: -109%;
  }

  :host(.left) #image {
    background-image: url("resource://gre-resources/accessiblecaret-tilt-left.svg");
  }

  :host(.right) #image,
  :host(.right) #text-overlay {
    margin-left: -12%;
  }

  :host(.right) #image {
    background-image: url("resource://gre-resources/accessiblecaret-tilt-right.svg");
  }
}