diff options
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/config.h | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/android/FileChooserAndroid.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/rendering/InlineTextBox.cpp | 71 | ||||
-rw-r--r-- | Source/WebCore/rendering/InlineTextBox.h | 10 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderText.cpp | 17 |
6 files changed, 4 insertions, 104 deletions
diff --git a/Source/WebCore/config.h b/Source/WebCore/config.h index 77a3ab4..64901db 100644 --- a/Source/WebCore/config.h +++ b/Source/WebCore/config.h @@ -146,8 +146,6 @@ #define ANDROID_FIX -#define ANDROID_DISABLE_ROUNDING_HACKS - // Ensure that the fixed elements are always relative to the top document. #define ANDROID_FIXED_ELEMENTS diff --git a/Source/WebCore/platform/android/FileChooserAndroid.cpp b/Source/WebCore/platform/android/FileChooserAndroid.cpp index f2ad3b9..43abee3 100644 --- a/Source/WebCore/platform/android/FileChooserAndroid.cpp +++ b/Source/WebCore/platform/android/FileChooserAndroid.cpp @@ -38,7 +38,7 @@ String FileChooser::basenameForWidth(const Font& font, int width) const return fileButtonNoFileSelectedLabel(); String output = pathGetFileName(m_filenames[0]); - return StringTruncator::centerTruncate(output, static_cast<float>(width), font, false); + return StringTruncator::centerTruncate(output, static_cast<float>(width), font); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 012c1a8..4656354 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -617,7 +617,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) } } -static void setrectForUnderline(SkRect* r, GraphicsContext* context, const IntPoint& point, int yOffset, int width) +static void setrectForUnderline(SkRect* r, GraphicsContext* context, const FloatPoint& point, int yOffset, float width) { float lineThickness = context->strokeThickness(); #if 0 @@ -630,7 +630,7 @@ static void setrectForUnderline(SkRect* r, GraphicsContext* context, const IntPo r->fBottom = r->fTop + SkFloatToScalar(lineThickness); } -void GraphicsContext::drawLineForText(IntPoint const& pt, int width, bool) +void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool) { if (paintingDisabled()) return; @@ -646,7 +646,7 @@ void GraphicsContext::drawLineForText(IntPoint const& pt, int width, bool) } // TODO: Should we draw different based on TextCheckingLineStyle? -void GraphicsContext::drawLineForTextChecking(const IntPoint& pt, int width, TextCheckingLineStyle) +void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width, TextCheckingLineStyle) { if (paintingDisabled()) return; diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index 6d6ca4d..3c3e450 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -163,15 +163,8 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos) ePos = len; } -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - TextRun textRun = TextRun(characters, len, textObj->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !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_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride), IntPoint(), selHeight, sPos, ePos)); -#endif int logicalWidth = r.width(); if (r.x() > m_logicalWidth) @@ -626,10 +619,6 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) adjustCharactersAndLengthForHyphen(charactersWithHyphen, styleToUse, characters, length); TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || styleToUse->visuallyOrdered()); -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - if (m_disableRoundingHacks) - textRun.disableRoundingHacks(); -#endif int sPos = 0; int ePos = 0; @@ -781,24 +770,11 @@ void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& b int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop(); int selHeight = selectionHeight(); -<<<<<<< HEAD - 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_expansion, trailingExpansionBehavior(), - !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); - if (m_disableRoundingHacks) - textRun.disableRoundingHacks(); - context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); -#else -======= FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); context->clip(FloatRect(localOrigin, FloatSize(m_logicalWidth, selHeight))); ->>>>>>> WebKit at r80534 context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); -#endif context->restore(); } @@ -819,22 +795,10 @@ void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const F int deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop(); int selHeight = selectionHeight(); -<<<<<<< HEAD - 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_expansion, trailingExpansionBehavior(), - !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); - if (m_disableRoundingHacks) - textRun.disableRoundingHacks(); - context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); -#else -======= FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); ->>>>>>> WebKit at r80534 context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), localOrigin, selHeight, c, style->colorSpace(), sPos, ePos); -#endif context->restore(); } @@ -995,16 +959,8 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, const Floa int selHeight = selectionHeight(); FloatPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY); TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); -<<<<<<< HEAD -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - if (m_disableRoundingHacks) - run.disableRoundingHacks(); -#endif - -======= // FIXME: Convert the document markers to float rects. ->>>>>>> WebKit at r80534 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, selHeight, startPosition, endPosition)); start = markerRect.x() - startPoint.x(); width = markerRect.width(); @@ -1048,10 +1004,6 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& 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_expansion, trailingExpansionBehavior(), !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)); @@ -1080,10 +1032,6 @@ void InlineTextBox::computeRectForReplacementMarker(const DocumentMarker& marker 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_expansion, trailingExpansionBehavior(), !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. @@ -1243,16 +1191,9 @@ int InlineTextBox::offsetForPosition(float lineOffset, bool includePartialGlyphs 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_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); - if (m_disableRoundingHacks) - textRun.disableRoundingHacks(); - int offset = f->offsetForPosition(textRun, lineOffset - logicalLeft(), includePartialGlyphs); -#else int offset = f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()), lineOffset - logicalLeft(), includePartialGlyphs); -#endif if (blockIsInOppositeDirection && (!offset || offset == m_len)) return !offset ? m_len : 0; return offset; @@ -1271,20 +1212,8 @@ float 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? -<<<<<<< HEAD -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - TextRun textRun = TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride); - if (m_disableRoundingHacks) - textRun.disableRoundingHacks(); - return enclosingIntRect(f.selectionRectForText(textRun, IntPoint(logicalLeft(), 0), 0, from, to)).maxX(); -#else - return enclosingIntRect(f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride), - IntPoint(logicalLeft(), 0), 0, from, to)).maxX(); -#endif -======= return f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, trailingExpansionBehavior(), !isLeftToRightDirection(), m_dirOverride), IntPoint(logicalLeft(), 0), 0, from, to).maxX(); ->>>>>>> WebKit at r80534 } bool InlineTextBox::containsCaretOffset(int offset) const diff --git a/Source/WebCore/rendering/InlineTextBox.h b/Source/WebCore/rendering/InlineTextBox.h index a900a71..d894b85 100644 --- a/Source/WebCore/rendering/InlineTextBox.h +++ b/Source/WebCore/rendering/InlineTextBox.h @@ -41,20 +41,13 @@ Color correctedTextColor(Color textColor, Color backgroundColor); class InlineTextBox : public InlineBox { public: -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - InlineTextBox(RenderObject* obj, bool disableRoundingHacks = false) -#else InlineTextBox(RenderObject* obj) -#endif : InlineBox(obj) , m_prevTextBox(0) , m_nextTextBox(0) , m_start(0) , m_len(0) , m_truncation(cNoTruncation) -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - , m_disableRoundingHacks(disableRoundingHacks) -#endif { } @@ -149,9 +142,6 @@ private: unsigned short m_truncation; // Where to truncate when text overflow is applied. We use special constants to // denote no truncation (the whole run paints) and full truncation (nothing paints at all). -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - bool m_disableRoundingHacks; -#endif protected: void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, int startPos, int endPos); diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index d4f4166..3e696d3 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -1185,27 +1185,10 @@ void RenderText::dirtyLineBoxes(bool fullLayout) } m_linesDirty = false; } -#ifdef ANDROID_DISABLE_ROUNDING_HACKS -static bool disableRoundingHacks(RenderText* renderText) -{ - RenderObject* renderer = renderText; - while (renderer) { - if (renderer->isTextControl()) { - return true; - } - renderer = renderer->parent(); - } - return false; -} -#endif InlineTextBox* RenderText::createTextBox() { -#ifdef ANDROID_DISABLE_ROUNDING_HACKS - return new (renderArena()) InlineTextBox(this, disableRoundingHacks(this)); -#else return new (renderArena()) InlineTextBox(this); -#endif } InlineTextBox* RenderText::createInlineTextBox() |