| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 741 |
| 742 StringBuilder charactersWithHyphen; | 742 StringBuilder charactersWithHyphen; |
| 743 bool respectHyphen = ePos == length && hasHyphen(); | 743 bool respectHyphen = ePos == length && hasHyphen(); |
| 744 TextRun textRun = constructTextRun(style, font, string, renderer().textLengt
h() - m_start, respectHyphen ? &charactersWithHyphen : 0); | 744 TextRun textRun = constructTextRun(style, font, string, renderer().textLengt
h() - m_start, respectHyphen ? &charactersWithHyphen : 0); |
| 745 if (respectHyphen) | 745 if (respectHyphen) |
| 746 ePos = textRun.length(); | 746 ePos = textRun.length(); |
| 747 | 747 |
| 748 LayoutUnit selectionBottom = root().selectionBottom(); | 748 LayoutUnit selectionBottom = root().selectionBottom(); |
| 749 LayoutUnit selectionTop = root().selectionTopAdjustedForPrecedingBlock(); | 749 LayoutUnit selectionTop = root().selectionTopAdjustedForPrecedingBlock(); |
| 750 | 750 |
| 751 int deltaY = roundToInt(renderer().style()->isFlippedLinesWritingMode() ? se
lectionBottom - logicalBottom() : logicalTop() - selectionTop); | 751 int deltaY = roundToInt(logicalTop() - selectionTop); |
| 752 int selHeight = std::max(0, roundToInt(selectionBottom - selectionTop)); | 752 int selHeight = std::max(0, roundToInt(selectionBottom - selectionTop)); |
| 753 | 753 |
| 754 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); | 754 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); |
| 755 FloatRect clipRect(localOrigin, FloatSize(m_logicalWidth, selHeight)); | 755 FloatRect clipRect(localOrigin, FloatSize(m_logicalWidth, selHeight)); |
| 756 | 756 |
| 757 GraphicsContextStateSaver stateSaver(*context); | 757 GraphicsContextStateSaver stateSaver(*context); |
| 758 context->clip(clipRect); | 758 context->clip(clipRect); |
| 759 context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, sPos
, ePos); | 759 context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, sPos
, ePos); |
| 760 } | 760 } |
| 761 | 761 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 772 return paintEnd; | 772 return paintEnd; |
| 773 } | 773 } |
| 774 | 774 |
| 775 void InlineTextBox::paintSingleCompositionBackgroundRun(GraphicsContext* context
, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, Color backg
roundColor, int startPos, int endPos) | 775 void InlineTextBox::paintSingleCompositionBackgroundRun(GraphicsContext* context
, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, Color backg
roundColor, int startPos, int endPos) |
| 776 { | 776 { |
| 777 int sPos = std::max(startPos - m_start, 0); | 777 int sPos = std::max(startPos - m_start, 0); |
| 778 int ePos = std::min(endPos - m_start, static_cast<int>(m_len)); | 778 int ePos = std::min(endPos - m_start, static_cast<int>(m_len)); |
| 779 if (sPos >= ePos) | 779 if (sPos >= ePos) |
| 780 return; | 780 return; |
| 781 | 781 |
| 782 int deltaY = renderer().style()->isFlippedLinesWritingMode() ? selectionBott
om() - logicalBottom() : logicalTop() - selectionTop(); | 782 int deltaY = logicalTop() - selectionTop(); |
| 783 int selHeight = selectionHeight(); | 783 int selHeight = selectionHeight(); |
| 784 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); | 784 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); |
| 785 context->drawHighlightForText(font, constructTextRun(style, font), localOrig
in, selHeight, backgroundColor, sPos, ePos); | 785 context->drawHighlightForText(font, constructTextRun(style, font), localOrig
in, selHeight, backgroundColor, sPos, ePos); |
| 786 } | 786 } |
| 787 | 787 |
| 788 static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorati
onStyle) | 788 static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorati
onStyle) |
| 789 { | 789 { |
| 790 StrokeStyle strokeStyle = SolidStroke; | 790 StrokeStyle strokeStyle = SolidStroke; |
| 791 switch (decorationStyle) { | 791 switch (decorationStyle) { |
| 792 case TextDecorationStyleSolid: | 792 case TextDecorationStyleSolid: |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 markerSpansWholeBox = false; | 1085 markerSpansWholeBox = false; |
| 1086 | 1086 |
| 1087 if (!markerSpansWholeBox || grammar) { | 1087 if (!markerSpansWholeBox || grammar) { |
| 1088 int startPosition = std::max<int>(marker->startOffset() - m_start, 0); | 1088 int startPosition = std::max<int>(marker->startOffset() - m_start, 0); |
| 1089 int endPosition = std::min<int>(marker->endOffset() - m_start, m_len); | 1089 int endPosition = std::min<int>(marker->endOffset() - m_start, m_len); |
| 1090 | 1090 |
| 1091 if (m_truncation != cNoTruncation) | 1091 if (m_truncation != cNoTruncation) |
| 1092 endPosition = std::min<int>(endPosition, m_truncation); | 1092 endPosition = std::min<int>(endPosition, m_truncation); |
| 1093 | 1093 |
| 1094 // Calculate start & width | 1094 // Calculate start & width |
| 1095 int deltaY = renderer().style()->isFlippedLinesWritingMode() ? selection
Bottom() - logicalBottom() : logicalTop() - selectionTop(); | 1095 int deltaY = logicalTop() - selectionTop(); |
| 1096 int selHeight = selectionHeight(); | 1096 int selHeight = selectionHeight(); |
| 1097 FloatPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY); | 1097 FloatPoint startPoint(boxOrigin.x(), boxOrigin.y() - deltaY); |
| 1098 TextRun run = constructTextRun(style, font); | 1098 TextRun run = constructTextRun(style, font); |
| 1099 | 1099 |
| 1100 // FIXME: Convert the document markers to float rects. | 1100 // FIXME: Convert the document markers to float rects. |
| 1101 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, sta
rtPoint, selHeight, startPosition, endPosition)); | 1101 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, sta
rtPoint, selHeight, startPosition, endPosition)); |
| 1102 start = markerRect.x() - startPoint.x(); | 1102 start = markerRect.x() - startPoint.x(); |
| 1103 width = markerRect.width(); | 1103 width = markerRect.width(); |
| 1104 | 1104 |
| 1105 // Store rendered rects for bad grammar markers, so we can hit-test agai
nst it elsewhere in order to | 1105 // Store rendered rects for bad grammar markers, so we can hit-test agai
nst it elsewhere in order to |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1419 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1420 const int rendererCharacterOffset = 24; | 1420 const int rendererCharacterOffset = 24; |
| 1421 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1421 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1422 fputc(' ', stderr); | 1422 fputc(' ', stderr); |
| 1423 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1423 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 #endif | 1426 #endif |
| 1427 | 1427 |
| 1428 } // namespace blink | 1428 } // namespace blink |
| OLD | NEW |