🐛 Use border-box to prevent losing subpixel AA

When highlights are positioned outside the line box, they could get
hidden by a subsequent tile (because of its opaque background). As a
result, subpixel anti-aliasing gets disabled by Chrome.

Using `border-box` as the default `boxSizing` allows highlights to
always fit within the line (except if a styling like `margin` is
applied).
This commit is contained in:
Antonio Scandurra
2015-07-23 11:52:32 +02:00
parent 1e22fd50f2
commit 07dbc545ac

View File

@@ -76,6 +76,10 @@ class HighlightsComponent
unless oldHighlightState.regions[i]?
oldHighlightState.regions[i] = {}
regionNode = document.createElement('div')
# This prevents highlights at the tiles boundaries to be hidden by the
# subsequent tile. When this happens, subpixel anti-aliasing gets
# disabled.
regionNode.style.boxSizing = "border-box"
regionNode.classList.add('region')
regionNode.classList.add(newHighlightState.deprecatedRegionClass) if newHighlightState.deprecatedRegionClass?
@regionNodesByHighlightId[id][i] = regionNode