Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: Source/core/paint/InlineTextBoxPainter.cpp

Issue 734313004: Move InlineTextBox::rotation to TextPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/EllipsisBoxPainter.cpp ('k') | Source/core/paint/TextPainter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -m_i nlineTextBox.logicalHeight()); 102 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -m_i nlineTextBox.logicalHeight());
103 103
104 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping(); 104 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping();
105 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to Float()); 105 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to Float());
106 FloatRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_in lineTextBox.logicalHeight())); 106 FloatRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_in lineTextBox.logicalHeight()));
107 107
108 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer ()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0; 108 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer ()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0;
109 109
110 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText; 110 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText;
111 if (shouldRotate) 111 if (shouldRotate)
112 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clock wise)); 112 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise ));
113 113
114 // Determine whether or not we have composition underlines to draw. 114 // Determine whether or not we have composition underlines to draw.
115 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex tBox.renderer().node(); 115 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex tBox.renderer().node();
116 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer() .frame()->inputMethodController().compositionUsesCustomUnderlines(); 116 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer() .frame()->inputMethodController().compositionUsesCustomUnderlines();
117 117
118 // Determine text colors. 118 // Determine text colors.
119 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting); 119 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting);
120 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t extStyle); 120 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t extStyle);
121 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); 121 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
122 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle; 122 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 cachedTextBlob = addToTextBlobCache(m_inlineTextBox); 210 cachedTextBlob = addToTextBlobCache(m_inlineTextBox);
211 textPainter.paint(selectionStart, selectionEnd, length, selectionStyle, cachedTextBlob); 211 textPainter.paint(selectionStart, selectionEnd, length, selectionStyle, cachedTextBlob);
212 } 212 }
213 213
214 // Paint decorations 214 // Paint decorations
215 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); 215 TextDecoration textDecorations = styleToUse->textDecorationsInEffect();
216 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { 216 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) {
217 GraphicsContextStateSaver stateSaver(*context, false); 217 GraphicsContextStateSaver stateSaver(*context, false);
218 TextPainter::updateGraphicsContext(context, textStyle, m_inlineTextBox.i sHorizontal(), stateSaver); 218 TextPainter::updateGraphicsContext(context, textStyle, m_inlineTextBox.i sHorizontal(), stateSaver);
219 if (combinedText) 219 if (combinedText)
220 220 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock wise));
221 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::C lockwise));
222 paintDecoration(context, boxOrigin, textDecorations); 221 paintDecoration(context, boxOrigin, textDecorations);
223 if (combinedText) 222 if (combinedText)
224 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::C ounterclockwise)); 223 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Count erclockwise));
225 } 224 }
226 225
227 if (paintInfo.phase == PaintPhaseForeground) { 226 if (paintInfo.phase == PaintPhaseForeground) {
228 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); 227 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false);
229 228
230 // Paint custom underlines for compositions. 229 // Paint custom underlines for compositions.
231 if (useCustomUnderlines) { 230 if (useCustomUnderlines) {
232 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.ren derer().frame()->inputMethodController().customCompositionUnderlines(); 231 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.ren derer().frame()->inputMethodController().customCompositionUnderlines();
233 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.s tart(), m_inlineTextBox.end()); 232 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.s tart(), m_inlineTextBox.end());
234 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begi n(); it != filter.end(); ++it) { 233 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begi n(); it != filter.end(); ++it) {
235 if (it->color == Color::transparent) 234 if (it->color == Color::transparent)
236 continue; 235 continue;
237 paintCompositionUnderline(context, boxOrigin, *it); 236 paintCompositionUnderline(context, boxOrigin, *it);
238 } 237 }
239 } 238 }
240 } 239 }
241 240
242 if (shouldRotate) 241 if (shouldRotate)
243 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Count erclockwise)); 242 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Countercl ockwise));
244 } 243 }
245 244
246 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline) 245 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline)
247 { 246 {
248 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st artOffset); 247 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st artOffset);
249 } 248 }
250 249
251 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und erline) 250 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und erline)
252 { 251 {
253 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset) ; // end() points at the last char, not past it. 252 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset) ; // end() points at the last char, not past it.
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 RenderTheme::theme().platformActiveTextSearchHighlightColor() : 793 RenderTheme::theme().platformActiveTextSearchHighlightColor() :
795 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); 794 RenderTheme::theme().platformInactiveTextSearchHighlightColor();
796 GraphicsContextStateSaver stateSaver(*pt); 795 GraphicsContextStateSaver stateSaver(*pt);
797 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight)); 796 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight));
798 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos); 797 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos);
799 } 798 }
800 } 799 }
801 800
802 801
803 } // namespace blink 802 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/EllipsisBoxPainter.cpp ('k') | Source/core/paint/TextPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698