| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/InlineTextBoxPainter.h" | 6 #include "core/paint/InlineTextBoxPainter.h" |
| 7 | 7 |
| 8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
| 9 #include "core/dom/RenderedDocumentMarker.h" | 9 #include "core/dom/RenderedDocumentMarker.h" |
| 10 #include "core/editing/CompositionUnderline.h" | 10 #include "core/editing/CompositionUnderline.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (haveSelection && !useCustomUnderlines) | 142 if (haveSelection && !useCustomUnderlines) |
| 143 paintSelection(context, boxOrigin, styleToUse, font, selectionStyle.
fillColor); | 143 paintSelection(context, boxOrigin, styleToUse, font, selectionStyle.
fillColor); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // 2. Now paint the foreground, including text and decorations like underlin
e/overline (in quirks mode only). | 146 // 2. Now paint the foreground, including text and decorations like underlin
e/overline (in quirks mode only). |
| 147 int length = m_inlineTextBox.len(); | 147 int length = m_inlineTextBox.len(); |
| 148 int maximumLength; | 148 int maximumLength; |
| 149 StringView string; | 149 StringView string; |
| 150 if (!combinedText) { | 150 if (!combinedText) { |
| 151 string = m_inlineTextBox.renderer().text().createView(); | 151 string = m_inlineTextBox.renderer().text().createView(); |
| 152 ASSERT(m_inlineTextBox.start() + length <= string.length()); |
| 152 if (static_cast<unsigned>(length) != string.length() || m_inlineTextBox.
start()) | 153 if (static_cast<unsigned>(length) != string.length() || m_inlineTextBox.
start()) |
| 153 string.narrow(m_inlineTextBox.start(), length); | 154 string.narrow(m_inlineTextBox.start(), length); |
| 154 maximumLength = m_inlineTextBox.renderer().textLength() - m_inlineTextBo
x.start(); | 155 maximumLength = m_inlineTextBox.renderer().textLength() - m_inlineTextBo
x.start(); |
| 155 } else { | 156 } else { |
| 156 combinedText->getStringToRender(m_inlineTextBox.start(), string, length)
; | 157 combinedText->getStringToRender(m_inlineTextBox.start(), string, length)
; |
| 157 maximumLength = length; | 158 maximumLength = length; |
| 158 } | 159 } |
| 159 | 160 |
| 160 StringBuilder charactersWithHyphen; | 161 StringBuilder charactersWithHyphen; |
| 161 TextRun textRun = m_inlineTextBox.constructTextRun(styleToUse, font, string,
maximumLength, m_inlineTextBox.hasHyphen() ? &charactersWithHyphen : 0); | 162 TextRun textRun = m_inlineTextBox.constructTextRun(styleToUse, font, string,
maximumLength, m_inlineTextBox.hasHyphen() ? &charactersWithHyphen : 0); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 RenderTheme::theme().platformActiveTextSearchHighlightColor() : | 796 RenderTheme::theme().platformActiveTextSearchHighlightColor() : |
| 796 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); | 797 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); |
| 797 GraphicsContextStateSaver stateSaver(*pt); | 798 GraphicsContextStateSaver stateSaver(*pt); |
| 798 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); | 799 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); |
| 799 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); | 800 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); |
| 800 } | 801 } |
| 801 } | 802 } |
| 802 | 803 |
| 803 | 804 |
| 804 } // namespace blink | 805 } // namespace blink |
| OLD | NEW |