| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 GraphicsContext* context = paintInfo.context; | 101 GraphicsContext* context = paintInfo.context; |
| 102 RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTextBox.i
sFirstLineStyle()); | 102 RenderStyle* styleToUse = m_inlineTextBox.renderer().style(m_inlineTextBox.i
sFirstLineStyle()); |
| 103 | 103 |
| 104 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? LayoutUn
it() : -m_inlineTextBox.logicalHeight().toLayoutUnit()); | 104 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? LayoutUn
it() : -m_inlineTextBox.logicalHeight().toLayoutUnit()); |
| 105 | 105 |
| 106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping(); | 106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping(); |
| 107 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); | 107 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
| 108 FloatRect boxRect(boxOrigin, FloatSize(m_inlineTextBox.logicalWidth(), m_inl
ineTextBox.logicalHeight())); | 108 FloatRect boxRect(boxOrigin, FloatSize(m_inlineTextBox.logicalWidth(), m_inl
ineTextBox.logicalHeight())); |
| 109 | 109 |
| 110 bool shouldRotate = false; | 110 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe
xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer
()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0; |
| 111 RenderCombineText* combinedText = nullptr; | 111 |
| 112 if (!m_inlineTextBox.isHorizontal()) { | 112 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText; |
| 113 if (styleToUse->hasTextCombine() && m_inlineTextBox.renderer().isCombine
Text()) { | 113 if (shouldRotate) |
| 114 combinedText = &toRenderCombineText(m_inlineTextBox.renderer()); | 114 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise
)); |
| 115 if (!combinedText->isCombined()) | |
| 116 combinedText = nullptr; | |
| 117 } | |
| 118 if (combinedText) { | |
| 119 combinedText->updateFont(); | |
| 120 } else { | |
| 121 shouldRotate = true; | |
| 122 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock
wise)); | |
| 123 } | |
| 124 } | |
| 125 | 115 |
| 126 // Determine whether or not we have composition underlines to draw. | 116 // Determine whether or not we have composition underlines to draw. |
| 127 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText
Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex
tBox.renderer().node(); | 117 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText
Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex
tBox.renderer().node(); |
| 128 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer()
.frame()->inputMethodController().compositionUsesCustomUnderlines(); | 118 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer()
.frame()->inputMethodController().compositionUsesCustomUnderlines(); |
| 129 | 119 |
| 130 // Determine text colors. | 120 // Determine text colors. |
| 131 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo
x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting); | 121 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo
x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting); |
| 132 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in
lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t
extStyle); | 122 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in
lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t
extStyle); |
| 133 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); | 123 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); |
| 134 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; | 124 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 RenderTheme::theme().platformActiveTextSearchHighlightColor() : | 796 RenderTheme::theme().platformActiveTextSearchHighlightColor() : |
| 807 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); | 797 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); |
| 808 GraphicsContextStateSaver stateSaver(*pt); | 798 GraphicsContextStateSaver stateSaver(*pt); |
| 809 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)); |
| 810 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); |
| 811 } | 801 } |
| 812 } | 802 } |
| 813 | 803 |
| 814 | 804 |
| 815 } // namespace blink | 805 } // namespace blink |
| OLD | NEW |