Chromium Code Reviews| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 TextRun run = m_inlineTextBox.constructTextRun(style, font); | 806 TextRun run = m_inlineTextBox.constructTextRun(style, font); |
| 807 | 807 |
| 808 // Optionally highlight the text | 808 // Optionally highlight the text |
| 809 if (m_inlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHig hlighted()) { | 809 if (m_inlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHig hlighted()) { |
| 810 Color color = marker->activeMatch() ? | 810 Color color = marker->activeMatch() ? |
| 811 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : | 811 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : |
| 812 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); | 812 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); |
| 813 GraphicsContextStateSaver stateSaver(*pt); | 813 GraphicsContextStateSaver stateSaver(*pt); |
| 814 pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); | 814 pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); |
| 815 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); | 815 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); |
| 816 | |
| 817 // Also Highlight the text with color:transparent | |
| 818 if (style.visitedDependentColor(CSSPropertyColor) == Color::transparent) { | |
| 819 int length = m_inlineTextBox.len(); | |
| 820 StringView string = m_inlineTextBox.layoutObject().text().createView (); | |
| 821 TextRun textRun = m_inlineTextBox.constructTextRun(style, font, stri ng, length, 0); | |
|
pdr.
2015/07/21 22:03:57
You're constructing a new textrun here. Why doesn'
| |
| 822 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inli neTextBox.layoutObject(), style, true, false); | |
| 823 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidt h(), m_inlineTextBox.logicalHeight())); | |
| 824 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent()); | |
| 825 TextPainter textPainter(pt, font, textRun, textOrigin, boxRect, m_in lineTextBox.isHorizontal()); | |
| 826 | |
| 827 textPainter.paint(sPos, ePos, length, textStyle, 0); | |
| 828 } | |
| 816 } | 829 } |
| 817 } | 830 } |
| 818 | 831 |
| 819 | 832 |
| 820 } // namespace blink | 833 } // namespace blink |
| OLD | NEW |