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

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

Issue 1330233003: Revert of Avoid style clobbering in setCompositionFromExistingText. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/core/editing/markers/DocumentMarkerControllerTest.cpp ('k') | Source/web/WebViewImpl.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/editing/CompositionUnderline.h" 8 #include "core/editing/CompositionUnderline.h"
9 #include "core/editing/CompositionUnderlineRangeFilter.h"
9 #include "core/editing/Editor.h" 10 #include "core/editing/Editor.h"
11 #include "core/editing/InputMethodController.h"
10 #include "core/editing/markers/DocumentMarkerController.h" 12 #include "core/editing/markers/DocumentMarkerController.h"
11 #include "core/editing/markers/RenderedDocumentMarker.h" 13 #include "core/editing/markers/RenderedDocumentMarker.h"
12 #include "core/frame/LocalFrame.h" 14 #include "core/frame/LocalFrame.h"
13 #include "core/layout/LayoutBlock.h" 15 #include "core/layout/LayoutBlock.h"
14 #include "core/layout/LayoutTextCombine.h" 16 #include "core/layout/LayoutTextCombine.h"
15 #include "core/layout/LayoutTheme.h" 17 #include "core/layout/LayoutTheme.h"
16 #include "core/layout/line/InlineTextBox.h" 18 #include "core/layout/line/InlineTextBox.h"
17 #include "core/paint/BoxPainter.h" 19 #include "core/paint/BoxPainter.h"
18 #include "core/paint/PaintInfo.h" 20 #include "core/paint/PaintInfo.h"
19 #include "core/paint/TextPainter.h" 21 #include "core/paint/TextPainter.h"
(...skipping 19 matching lines...) Expand all
39 if (!gTextBlobCache) 41 if (!gTextBlobCache)
40 gTextBlobCache = new InlineTextBoxBlobCacheMap; 42 gTextBlobCache = new InlineTextBoxBlobCacheMap;
41 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value; 43 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value;
42 } 44 }
43 45
44 static bool paintsMarkerHighlights(const LayoutObject& layoutObject) 46 static bool paintsMarkerHighlights(const LayoutObject& layoutObject)
45 { 47 {
46 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l ayoutObject.node()); 48 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l ayoutObject.node());
47 } 49 }
48 50
49 static bool paintsCompositionMarkers(const LayoutObject& layoutObject)
50 {
51 return layoutObject.node() && layoutObject.document().markers().markersFor(l ayoutObject.node(), DocumentMarker::Composition).size() > 0;
52 }
53
54 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 51 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
55 { 52 {
56 if (m_inlineTextBox.isLineBreak() || !paintInfo.shouldPaintWithinRoot(&m_inl ineTextBox.layoutObject()) || m_inlineTextBox.layoutObject().style()->visibility () != VISIBLE 53 if (m_inlineTextBox.isLineBreak() || !paintInfo.shouldPaintWithinRoot(&m_inl ineTextBox.layoutObject()) || m_inlineTextBox.layoutObject().style()->visibility () != VISIBLE
57 || m_inlineTextBox.truncation() == cFullTruncation || paintInfo.phase == PaintPhaseOutline || !m_inlineTextBox.len()) 54 || m_inlineTextBox.truncation() == cFullTruncation || paintInfo.phase == PaintPhaseOutline || !m_inlineTextBox.len())
58 return; 55 return;
59 56
60 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines); 57 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines);
61 58
62 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect(); 59 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect();
63 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y()); 60 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y());
(...skipping 10 matching lines...) Expand all
74 71
75 bool isPrinting = paintInfo.isPrinting(); 72 bool isPrinting = paintInfo.isPrinting();
76 73
77 // Determine whether or not we're selected. 74 // Determine whether or not we're selected.
78 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != SelectionNone; 75 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != SelectionNone;
79 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { 76 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) {
80 // When only painting the selection, don't bother to paint if there is n one. 77 // When only painting the selection, don't bother to paint if there is n one.
81 return; 78 return;
82 } 79 }
83 80
81 // Determine whether or not we have composition underlines to draw.
82 bool containsComposition = m_inlineTextBox.layoutObject().node() && m_inline TextBox.layoutObject().frame()->inputMethodController().compositionNode() == m_i nlineTextBox.layoutObject().node();
83 bool useCustomUnderlines = containsComposition && m_inlineTextBox.layoutObje ct().frame()->inputMethodController().compositionUsesCustomUnderlines();
84
84 // The text clip phase already has a DrawingRecorder. Text clips are initiat ed only in BoxPainter::paintLayerExtended, which is already 85 // The text clip phase already has a DrawingRecorder. Text clips are initiat ed only in BoxPainter::paintLayerExtended, which is already
85 // within a DrawingRecorder. 86 // within a DrawingRecorder.
86 Optional<DrawingRecorder> drawingRecorder; 87 Optional<DrawingRecorder> drawingRecorder;
87 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai ntPhaseTextClip) { 88 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai ntPhaseTextClip) {
88 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in lineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) 89 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in lineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase)))
89 return; 90 return;
90 LayoutRect paintRect(logicalVisualOverflow); 91 LayoutRect paintRect(logicalVisualOverflow);
91 m_inlineTextBox.logicalRectToPhysicalRect(paintRect); 92 m_inlineTextBox.logicalRectToPhysicalRect(paintRect);
92 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || paintsMa rkerHighlights(m_inlineTextBox.layoutObject()))) 93 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || contains Composition || paintsMarkerHighlights(m_inlineTextBox.layoutObject())))
93 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s tart(), m_inlineTextBox.start() + m_inlineTextBox.len())); 94 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s tart(), m_inlineTextBox.start() + m_inlineTextBox.len()));
94 paintRect.moveBy(adjustedPaintOffset); 95 paintRect.moveBy(adjustedPaintOffset);
95 drawingRecorder.emplace(*paintInfo.context, m_inlineTextBox, DisplayItem ::paintPhaseToDrawingType(paintInfo.phase), FloatRect(paintRect)); 96 drawingRecorder.emplace(*paintInfo.context, m_inlineTextBox, DisplayItem ::paintPhaseToDrawingType(paintInfo.phase), FloatRect(paintRect));
96 } 97 }
97 98
98 if (m_inlineTextBox.truncation() != cNoTruncation) { 99 if (m_inlineTextBox.truncation() != cNoTruncation) {
99 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR ightDirection() != m_inlineTextBox.isLeftToRightDirection()) { 100 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR ightDirection() != m_inlineTextBox.isLeftToRightDirection()) {
100 // Make the visible fragment of text hug the edge closest to the res t of the run by moving the origin 101 // Make the visible fragment of text hug the edge closest to the res t of the run by moving the origin
101 // at which we start drawing text. 102 // at which we start drawing text.
102 // e.g. In the case of LTR text truncated in an RTL Context, the cor rect behavior is: 103 // e.g. In the case of LTR text truncated in an RTL Context, the cor rect behavior is:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle; 145 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se lectionStyle;
145 146
146 // Set our font. 147 // Set our font.
147 const Font& font = styleToUse.font(); 148 const Font& font = styleToUse.font();
148 149
149 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().asc ent()); 150 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().asc ent());
150 151
151 // 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection 152 // 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection
152 // and composition highlights. 153 // and composition highlights.
153 if (paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseT extClip && !isPrinting) { 154 if (paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseT extClip && !isPrinting) {
155 if (containsComposition) {
156 paintCompositionBackgrounds(context, boxOrigin, styleToUse, font, us eCustomUnderlines);
157 }
158
154 paintDocumentMarkers(context, boxOrigin, styleToUse, font, true); 159 paintDocumentMarkers(context, boxOrigin, styleToUse, font, true);
155 160
156 if (haveSelection && !paintsCompositionMarkers(m_inlineTextBox.layoutObj ect())) { 161 if (haveSelection && !useCustomUnderlines) {
157 if (combinedText) 162 if (combinedText)
158 paintSelection<InlineTextBoxPainter::PaintOptions::CombinedText> (context, boxRect, styleToUse, font, selectionStyle.fillColor, combinedText); 163 paintSelection<InlineTextBoxPainter::PaintOptions::CombinedText> (context, boxRect, styleToUse, font, selectionStyle.fillColor, combinedText);
159 else 164 else
160 paintSelection<InlineTextBoxPainter::PaintOptions::Normal>(conte xt, boxRect, styleToUse, font, selectionStyle.fillColor); 165 paintSelection<InlineTextBoxPainter::PaintOptions::Normal>(conte xt, boxRect, styleToUse, font, selectionStyle.fillColor);
161 } 166 }
162 } 167 }
163 168
164 // 2. Now paint the foreground, including text and decorations like underlin e/overline (in quirks mode only). 169 // 2. Now paint the foreground, including text and decorations like underlin e/overline (in quirks mode only).
165 int length = m_inlineTextBox.len(); 170 int length = m_inlineTextBox.len();
166 StringView string = m_inlineTextBox.layoutObject().text().createView(); 171 StringView string = m_inlineTextBox.layoutObject().text().createView();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { 235 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) {
231 GraphicsContextStateSaver stateSaver(*context, false); 236 GraphicsContextStateSaver stateSaver(*context, false);
232 TextPainter::updateGraphicsContext(context, textStyle, m_inlineTextBox.i sHorizontal(), stateSaver); 237 TextPainter::updateGraphicsContext(context, textStyle, m_inlineTextBox.i sHorizontal(), stateSaver);
233 if (combinedText) 238 if (combinedText)
234 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock wise)); 239 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock wise));
235 paintDecoration(paintInfo, boxOrigin, textDecorations); 240 paintDecoration(paintInfo, boxOrigin, textDecorations);
236 if (combinedText) 241 if (combinedText)
237 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Count erclockwise)); 242 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Count erclockwise));
238 } 243 }
239 244
240 if (paintInfo.phase == PaintPhaseForeground) 245 if (paintInfo.phase == PaintPhaseForeground) {
241 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); 246 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false);
242 247
248 // Paint custom underlines for compositions.
249 if (useCustomUnderlines) {
250 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.lay outObject().frame()->inputMethodController().customCompositionUnderlines();
251 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.s tart(), m_inlineTextBox.end());
252 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begi n(); it != filter.end(); ++it) {
253 if (it->color == Color::transparent)
254 continue;
255 paintCompositionUnderline(context, boxOrigin, *it);
256 }
257 }
258 }
259
243 if (shouldRotate) 260 if (shouldRotate)
244 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Countercl ockwise)); 261 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Countercl ockwise));
245 } 262 }
246 263
247 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline) 264 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline)
248 { 265 {
249 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st artOffset); 266 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st artOffset);
250 } 267 }
251 268
252 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und erline) 269 unsigned InlineTextBoxPainter::underlinePaintEnd(const CompositionUnderline& und erline)
253 { 270 {
254 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset) ; // end() points at the last char, not past it. 271 unsigned paintEnd = std::min(m_inlineTextBox.end() + 1, underline.endOffset) ; // end() points at the last char, not past it.
255 if (m_inlineTextBox.truncation() != cNoTruncation) 272 if (m_inlineTextBox.truncation() != cNoTruncation)
256 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star t() + m_inlineTextBox.truncation())); 273 paintEnd = std::min(paintEnd, static_cast<unsigned>(m_inlineTextBox.star t() + m_inlineTextBox.truncation()));
257 return paintEnd; 274 return paintEnd;
258 } 275 }
259 276
277 void InlineTextBoxPainter::paintCompositionBackgrounds(GraphicsContext* pt, cons t LayoutPoint& boxOrigin, const ComputedStyle& style, const Font& font, bool use CustomUnderlines)
278 {
279 if (useCustomUnderlines) {
280 // Paint custom background highlights for compositions.
281 const Vector<CompositionUnderline>& underlines = m_inlineTextBox.layoutO bject().frame()->inputMethodController().customCompositionUnderlines();
282 CompositionUnderlineRangeFilter filter(underlines, m_inlineTextBox.start (), m_inlineTextBox.end());
283 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begin(); it != filter.end(); ++it) {
284 if (it->backgroundColor == Color::transparent)
285 continue;
286 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, it-> backgroundColor, underlinePaintStart(*it), underlinePaintEnd(*it));
287 }
288
289 } else {
290 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, font, LayoutTh eme::theme().platformDefaultCompositionBackgroundColor(),
291 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp ositionStart(),
292 m_inlineTextBox.layoutObject().frame()->inputMethodController().comp ositionEnd());
293 }
294 }
295
260 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext* context, const LayoutPoint& boxOrigin, const ComputedStyle& style, const Font& f ont, Color backgroundColor, int startPos, int endPos) 296 void InlineTextBoxPainter::paintSingleCompositionBackgroundRun(GraphicsContext* context, const LayoutPoint& boxOrigin, const ComputedStyle& style, const Font& f ont, Color backgroundColor, int startPos, int endPos)
261 { 297 {
262 if (backgroundColor == Color::transparent)
263 return;
264
265 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0) ; 298 int sPos = std::max(startPos - static_cast<int>(m_inlineTextBox.start()), 0) ;
266 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat ic_cast<int>(m_inlineTextBox.len())); 299 int ePos = std::min(endPos - static_cast<int>(m_inlineTextBox.start()), stat ic_cast<int>(m_inlineTextBox.len()));
267 if (sPos >= ePos) 300 if (sPos >= ePos)
268 return; 301 return;
269 302
270 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom( ) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop(); 303 int deltaY = m_inlineTextBox.layoutObject().style()->isFlippedLinesWritingMo de() ? m_inlineTextBox.root().selectionBottom() - m_inlineTextBox.logicalBottom( ) : m_inlineTextBox.logicalTop() - m_inlineTextBox.root().selectionTop();
271 int selHeight = m_inlineTextBox.root().selectionHeight(); 304 int selHeight = m_inlineTextBox.root().selectionHeight();
272 FloatPoint localOrigin(boxOrigin.x().toFloat(), boxOrigin.y().toFloat() - de ltaY); 305 FloatPoint localOrigin(boxOrigin.x().toFloat(), boxOrigin.y().toFloat() - de ltaY);
273 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style, font), localOrigin, selHeight, backgroundColor, sPos, ePos); 306 context->drawHighlightForText(font, m_inlineTextBox.constructTextRun(style, font), localOrigin, selHeight, backgroundColor, sPos, ePos);
274 } 307 }
(...skipping 15 matching lines...) Expand all
290 switch (marker->type()) { 323 switch (marker->type()) {
291 case DocumentMarker::Grammar: 324 case DocumentMarker::Grammar:
292 case DocumentMarker::Spelling: 325 case DocumentMarker::Spelling:
293 if (background) 326 if (background)
294 continue; 327 continue;
295 break; 328 break;
296 case DocumentMarker::TextMatch: 329 case DocumentMarker::TextMatch:
297 if (!background) 330 if (!background)
298 continue; 331 continue;
299 break; 332 break;
300 case DocumentMarker::Composition:
301 break;
302 default: 333 default:
303 continue; 334 continue;
304 } 335 }
305 336
306 if (marker->endOffset() <= m_inlineTextBox.start()) { 337 if (marker->endOffset() <= m_inlineTextBox.start()) {
307 // marker is completely before this run. This might be a marker tha t sits before the 338 // marker is completely before this run. This might be a marker tha t sits before the
308 // first run we draw, or markers that were within runs we skipped du e to truncation. 339 // first run we draw, or markers that were within runs we skipped du e to truncation.
309 continue; 340 continue;
310 } 341 }
311 if (marker->startOffset() > m_inlineTextBox.end()) { 342 if (marker->startOffset() > m_inlineTextBox.end()) {
312 // marker is completely after this run, bail. A later run will pain t it. 343 // marker is completely after this run, bail. A later run will pain t it.
313 break; 344 break;
314 } 345 }
315 346
316 // marker intersects this run. Paint it. 347 // marker intersects this run. Paint it.
317 switch (marker->type()) { 348 switch (marker->type()) {
318 case DocumentMarker::Spelling: 349 case DocumentMarker::Spelling:
319 m_inlineTextBox.paintDocumentMarker(pt, boxOrigin, marker, style, fo nt, false); 350 m_inlineTextBox.paintDocumentMarker(pt, boxOrigin, marker, style, fo nt, false);
320 break; 351 break;
321 case DocumentMarker::Grammar: 352 case DocumentMarker::Grammar:
322 m_inlineTextBox.paintDocumentMarker(pt, boxOrigin, marker, style, fo nt, true); 353 m_inlineTextBox.paintDocumentMarker(pt, boxOrigin, marker, style, fo nt, true);
323 break; 354 break;
324 case DocumentMarker::TextMatch: 355 case DocumentMarker::TextMatch:
325 m_inlineTextBox.paintTextMatchMarker(pt, boxOrigin, marker, style, f ont); 356 m_inlineTextBox.paintTextMatchMarker(pt, boxOrigin, marker, style, f ont);
326 break; 357 break;
327 case DocumentMarker::Composition:
328 {
329 CompositionUnderline underline(marker->startOffset(), marker->en dOffset(), marker->underlineColor(), marker->thick(), marker->backgroundColor()) ;
330 if (background)
331 paintSingleCompositionBackgroundRun(pt, boxOrigin, style, fo nt, underline.backgroundColor, underlinePaintStart(underline), underlinePaintEnd (underline));
332 else
333 paintCompositionUnderline(pt, boxOrigin, underline);
334 }
335 break;
336 default: 358 default:
337 ASSERT_NOT_REACHED(); 359 ASSERT_NOT_REACHED();
338 } 360 }
339 } 361 }
340 } 362 }
341 363
342 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM arker::MarkerType markerType) 364 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM arker::MarkerType markerType)
343 { 365 {
344 switch (markerType) { 366 switch (markerType) {
345 case DocumentMarker::Spelling: 367 case DocumentMarker::Spelling:
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 paintAppliedDecoration(context, FloatPoint(localOrigin), width.toFloat() , -doubleOffset, 1, overline, textDecorationThickness, antialiasDecoration, isPr inting); 758 paintAppliedDecoration(context, FloatPoint(localOrigin), width.toFloat() , -doubleOffset, 1, overline, textDecorationThickness, antialiasDecoration, isPr inting);
737 } 759 }
738 if (deco & TextDecorationLineThrough) { 760 if (deco & TextDecorationLineThrough) {
739 const float lineThroughOffset = 2 * baseline / 3; 761 const float lineThroughOffset = 2 * baseline / 3;
740 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0, lineThroughOffset), width.toFloat(), doubleOffset, 0, linethrough, textDecoratio nThickness, antialiasDecoration, isPrinting); 762 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0, lineThroughOffset), width.toFloat(), doubleOffset, 0, linethrough, textDecoratio nThickness, antialiasDecoration, isPrinting);
741 } 763 }
742 } 764 }
743 765
744 void InlineTextBoxPainter::paintCompositionUnderline(GraphicsContext* ctx, const LayoutPoint& boxOrigin, const CompositionUnderline& underline) 766 void InlineTextBoxPainter::paintCompositionUnderline(GraphicsContext* ctx, const LayoutPoint& boxOrigin, const CompositionUnderline& underline)
745 { 767 {
746 if (underline.color == Color::transparent)
747 return;
748
749 if (m_inlineTextBox.truncation() == cFullTruncation) 768 if (m_inlineTextBox.truncation() == cFullTruncation)
750 return; 769 return;
751 770
752 unsigned paintStart = underlinePaintStart(underline); 771 unsigned paintStart = underlinePaintStart(underline);
753 unsigned paintEnd = underlinePaintEnd(underline); 772 unsigned paintEnd = underlinePaintEnd(underline);
754 773
755 // start of line to draw, relative to paintOffset. 774 // start of line to draw, relative to paintOffset.
756 float start = paintStart == static_cast<unsigned>(m_inlineTextBox.start()) ? 0 : 775 float start = paintStart == static_cast<unsigned>(m_inlineTextBox.start()) ? 0 :
757 m_inlineTextBox.layoutObject().width(m_inlineTextBox.start(), paintStart - m_inlineTextBox.start(), m_inlineTextBox.textPos(), m_inlineTextBox.isLeftToR ightDirection() ? LTR : RTL, m_inlineTextBox.isFirstLineStyle()); 776 m_inlineTextBox.layoutObject().width(m_inlineTextBox.start(), paintStart - m_inlineTextBox.start(), m_inlineTextBox.textPos(), m_inlineTextBox.isLeftToR ightDirection() ? LTR : RTL, m_inlineTextBox.isFirstLineStyle());
758 // how much line to draw 777 // how much line to draw
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent()); 829 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent());
811 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal()); 830 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal());
812 831
813 textPainter.paint(sPos, ePos, length, textStyle, 0); 832 textPainter.paint(sPos, ePos, length, textStyle, 0);
814 } 833 }
815 } 834 }
816 } 835 }
817 836
818 837
819 } // namespace blink 838 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/markers/DocumentMarkerControllerTest.cpp ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698