| 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 "core/paint/TextPainter.h" | 5 #include "core/paint/TextPainter.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
| 10 #include "core/layout/LayoutTextCombine.h" | 10 #include "core/layout/LayoutTextCombine.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 TextPainter::Style selectionStyle = textStyle; | 161 TextPainter::Style selectionStyle = textStyle; |
| 162 bool usesTextAsClip = paintInfo.phase == PaintPhaseTextClip; | 162 bool usesTextAsClip = paintInfo.phase == PaintPhaseTextClip; |
| 163 bool isPrinting = paintInfo.isPrinting(); | 163 bool isPrinting = paintInfo.isPrinting(); |
| 164 | 164 |
| 165 if (haveSelection) { | 165 if (haveSelection) { |
| 166 if (!usesTextAsClip) { | 166 if (!usesTextAsClip) { |
| 167 selectionStyle.fillColor = layoutObject.selectionForegroundColor(pai
ntInfo.getGlobalPaintFlags()); | 167 selectionStyle.fillColor = layoutObject.selectionForegroundColor(pai
ntInfo.getGlobalPaintFlags()); |
| 168 selectionStyle.emphasisMarkColor = layoutObject.selectionEmphasisMar
kColor(paintInfo.getGlobalPaintFlags()); | 168 selectionStyle.emphasisMarkColor = layoutObject.selectionEmphasisMar
kColor(paintInfo.getGlobalPaintFlags()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 if (const ComputedStyle* pseudoStyle = layoutObject.getCachedPseudoStyle
(SELECTION)) { | 171 if (const ComputedStyle* pseudoStyle = layoutObject.getCachedPseudoStyle
(PseudoIdSelection)) { |
| 172 selectionStyle.strokeColor = usesTextAsClip ? Color::black : layoutO
bject.resolveColor(*pseudoStyle, CSSPropertyWebkitTextStrokeColor); | 172 selectionStyle.strokeColor = usesTextAsClip ? Color::black : layoutO
bject.resolveColor(*pseudoStyle, CSSPropertyWebkitTextStrokeColor); |
| 173 selectionStyle.strokeWidth = pseudoStyle->textStrokeWidth(); | 173 selectionStyle.strokeWidth = pseudoStyle->textStrokeWidth(); |
| 174 selectionStyle.shadow = usesTextAsClip ? 0 : pseudoStyle->textShadow
(); | 174 selectionStyle.shadow = usesTextAsClip ? 0 : pseudoStyle->textShadow
(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Text shadows are disabled when printing. http://crbug.com/258321 | 177 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 178 if (isPrinting) | 178 if (isPrinting) |
| 179 selectionStyle.shadow = 0; | 179 selectionStyle.shadow = 0; |
| 180 } | 180 } |
| 181 | 181 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 TextRun placeholderTextRun(&ideographicFullStopCharacter, 1); | 223 TextRun placeholderTextRun(&ideographicFullStopCharacter, 1); |
| 224 FloatPoint emphasisMarkTextOrigin(m_textBounds.x().toFloat(), m_textBounds.y
().toFloat() + m_font.fontMetrics().ascent() + m_emphasisMarkOffset); | 224 FloatPoint emphasisMarkTextOrigin(m_textBounds.x().toFloat(), m_textBounds.y
().toFloat() + m_font.fontMetrics().ascent() + m_emphasisMarkOffset); |
| 225 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); | 225 TextRunPaintInfo textRunPaintInfo(placeholderTextRun); |
| 226 textRunPaintInfo.bounds = FloatRect(m_textBounds); | 226 textRunPaintInfo.bounds = FloatRect(m_textBounds); |
| 227 m_graphicsContext.concatCTM(rotation(m_textBounds, Clockwise)); | 227 m_graphicsContext.concatCTM(rotation(m_textBounds, Clockwise)); |
| 228 m_graphicsContext.drawEmphasisMarks(m_combinedText->originalFont(), textRunP
aintInfo, m_emphasisMark, emphasisMarkTextOrigin); | 228 m_graphicsContext.drawEmphasisMarks(m_combinedText->originalFont(), textRunP
aintInfo, m_emphasisMark, emphasisMarkTextOrigin); |
| 229 m_graphicsContext.concatCTM(rotation(m_textBounds, Counterclockwise)); | 229 m_graphicsContext.concatCTM(rotation(m_textBounds, Counterclockwise)); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace blink | 232 } // namespace blink |
| OLD | NEW |