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

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

Issue 799123003: text-combine should scale rather than fall back to none when wide (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments fixed Created 5 years, 11 months 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RenderCombineText* combinedText = styleToUse->hasTextCombine() && m_inlineTe xtBox.renderer().isCombineText() && toRenderCombineText(m_inlineTextBox.renderer ()).isCombined() ? &toRenderCombineText(m_inlineTextBox.renderer()) : 0; 110 bool shouldRotate = false;
111 111 RenderCombineText* combinedText = nullptr;
112 bool shouldRotate = !m_inlineTextBox.isHorizontal() && !combinedText; 112 if (!m_inlineTextBox.isHorizontal()) {
113 if (shouldRotate) 113 if (styleToUse->hasTextCombine() && m_inlineTextBox.renderer().isCombine Text()) {
114 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise )); 114 combinedText = &toRenderCombineText(m_inlineTextBox.renderer());
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 }
115 125
116 // Determine whether or not we have composition underlines to draw. 126 // Determine whether or not we have composition underlines to draw.
117 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex tBox.renderer().node(); 127 bool containsComposition = m_inlineTextBox.renderer().node() && m_inlineText Box.renderer().frame()->inputMethodController().compositionNode() == m_inlineTex tBox.renderer().node();
118 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer() .frame()->inputMethodController().compositionUsesCustomUnderlines(); 128 bool useCustomUnderlines = containsComposition && m_inlineTextBox.renderer() .frame()->inputMethodController().compositionUsesCustomUnderlines();
119 129
120 // Determine text colors. 130 // Determine text colors.
121 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting); 131 TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBo x.renderer(), styleToUse, paintInfo.forceBlackText(), isPrinting);
122 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t extStyle); 132 TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_in lineTextBox.renderer(), haveSelection, paintInfo.forceBlackText(), isPrinting, t extStyle);
123 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); 133 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
124 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle; 134 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle;
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 RenderTheme::theme().platformActiveTextSearchHighlightColor() : 806 RenderTheme::theme().platformActiveTextSearchHighlightColor() :
797 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); 807 RenderTheme::theme().platformInactiveTextSearchHighlightColor();
798 GraphicsContextStateSaver stateSaver(*pt); 808 GraphicsContextStateSaver stateSaver(*pt);
799 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight)); 809 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight));
800 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos); 810 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos);
801 } 811 }
802 } 812 }
803 813
804 814
805 } // namespace blink 815 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698