@Override
  public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) {
    TextRange valueTextRange = myXmlAttribute.getValueTextRange();
    int displayStart = myXmlAttribute.physicalToDisplay(rangeInsideHost.getStartOffset());

    int dp =
        myXmlAttribute.displayToPhysical(
            offsetInDecoded + displayStart - valueTextRange.getStartOffset());
    if (dp == -1) return -1;
    return dp + valueTextRange.getStartOffset();
  }
 @Override
 public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
   ProperTextRange.assertProperRange(rangeInsideHost);
   TextRange valueTextRange = myXmlAttribute.getValueTextRange();
   int startInDecoded =
       myXmlAttribute.physicalToDisplay(
           rangeInsideHost.getStartOffset() - valueTextRange.getStartOffset());
   int endInDecoded =
       myXmlAttribute.physicalToDisplay(
           rangeInsideHost.getEndOffset() - valueTextRange.getStartOffset());
   String displayValue = myXmlAttribute.getDisplayValue();
   // todo investigate IIOB http://www.jetbrains.net/jira/browse/IDEADEV-16796
   startInDecoded =
       startInDecoded < 0
           ? 0
           : startInDecoded > displayValue.length() ? displayValue.length() : startInDecoded;
   endInDecoded =
       endInDecoded < 0
           ? 0
           : endInDecoded > displayValue.length() ? displayValue.length() : endInDecoded;
   if (startInDecoded > endInDecoded) endInDecoded = startInDecoded;
   outChars.append(displayValue, startInDecoded, endInDecoded);
   return true;
 }