void (boolean underlined, @NotNull Element element) { AttributeSet attributes = element.getAttributes(); Object attribute = attributes.getAttribute(HTML.Tag.A); if (attribute instanceof MutableAttributeSet a) { Object href = a.getAttribute(HTML.Attribute.HREF); Pair<Integer, Integer> aRange = findRangeOfParentTagWithGivenAttribute(element, href, HTML.Tag.A, HTML.Attribute.HREF); a.addAttribute(CSS.Attribute.TEXT_DECORATION, underlined ? "underline" : "none"); ((StyledDocument)element.getDocument()).setCharacterAttributes(aRange.first, aRange.second - aRange.first, a, false); } }