ePos = len;
}
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ TextRun textRun = TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride);
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+ IntRect r = enclosingIntRect(f.selectionRectForText(textRun, IntPoint(), selHeight, sPos, ePos));
+#else
IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride),
IntPoint(), selHeight, sPos, ePos));
+#endif
int logicalWidth = r.width();
if (r.x() > m_logicalWidth)
adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length);
TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || styleToUse->visuallyOrdered());
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+#endif
int sPos = 0;
int ePos = 0;
int selHeight = selectionHeight();
IntPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY);
context->clip(IntRect(localOrigin, IntSize(m_logicalWidth, selHeight)));
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ TextRun textRun = TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
+ !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+ context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
+#else
context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
!isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
+#endif
context->restore();
}
int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
int selHeight = selectionHeight();
IntPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY);
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ TextRun textRun = TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd,
+ !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+ context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
+#else
context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd,
!isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
localOrigin, selHeight, c, style->colorSpace(), sPos, ePos);
+#endif
context->restore();
}
int selHeight = selectionHeight();
IntPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY);
TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ if (m_disableRoundingHacks)
+ run.disableRoundingHacks();
+#endif
IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, selHeight, startPosition, endPosition));
start = markerRect.x() - startPoint.x();
int sPos = max(marker.startOffset - m_start, (unsigned)0);
int ePos = min(marker.endOffset - m_start, (unsigned)m_len);
TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ if (m_disableRoundingHacks)
+ run.disableRoundingHacks();
+#endif
// Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates.
IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, selectionTop()), selHeight, sPos, ePos));
int sPos = max(marker.startOffset - m_start, (unsigned)0);
int ePos = min(marker.endOffset - m_start, (unsigned)m_len);
TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ if (m_disableRoundingHacks)
+ run.disableRoundingHacks();
+#endif
IntPoint startPoint = IntPoint(m_x, y);
// Compute and store the rect associated with this marker.
RenderText* text = toRenderText(renderer());
RenderStyle* style = text->style(m_firstLine);
const Font* f = &style->font();
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ TextRun textRun = TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+ return f->offsetForPosition(textRun, lineOffset - logicalLeft(), includePartialGlyphs);
+#else
return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
lineOffset - logicalLeft(), includePartialGlyphs);
+#endif
}
int InlineTextBox::positionForOffset(int offset) const
int from = !isLeftToRightDirection() ? offset - m_start : 0;
int to = !isLeftToRightDirection() ? m_len : offset - m_start;
// FIXME: Do we need to add rightBearing here?
+#ifdef ANDROID_DISABLE_ROUNDING_HACKS
+ TextRun textRun = TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride);
+ if (m_disableRoundingHacks)
+ textRun.disableRoundingHacks();
+ return enclosingIntRect(f.selectionRectForText(textRun, IntPoint(logicalLeft(), 0), 0, from, to)).right();
+#else
return enclosingIntRect(f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride),
IntPoint(logicalLeft(), 0), 0, from, to)).right();
+#endif
}
bool InlineTextBox::containsCaretOffset(int offset) const