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

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

Issue 940373003: Rename RenderText to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/paint/InlineTextBoxPainter.h ('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"
11 #include "core/editing/CompositionUnderlineRangeFilter.h" 11 #include "core/editing/CompositionUnderlineRangeFilter.h"
12 #include "core/editing/Editor.h" 12 #include "core/editing/Editor.h"
13 #include "core/editing/InputMethodController.h" 13 #include "core/editing/InputMethodController.h"
14 #include "core/frame/LocalFrame.h" 14 #include "core/frame/LocalFrame.h"
15 #include "core/layout/LayoutBlock.h" 15 #include "core/layout/LayoutBlock.h"
16 #include "core/layout/LayoutTextCombine.h"
16 #include "core/layout/LayoutTheme.h" 17 #include "core/layout/LayoutTheme.h"
17 #include "core/layout/PaintInfo.h" 18 #include "core/layout/PaintInfo.h"
18 #include "core/layout/line/InlineTextBox.h" 19 #include "core/layout/line/InlineTextBox.h"
19 #include "core/paint/BoxPainter.h" 20 #include "core/paint/BoxPainter.h"
20 #include "core/paint/TextPainter.h" 21 #include "core/paint/TextPainter.h"
21 #include "core/rendering/RenderCombineText.h"
22 #include "platform/graphics/paint/DrawingRecorder.h" 22 #include "platform/graphics/paint/DrawingRecorder.h"
23 23
24 namespace blink { 24 namespace blink {
25 25
26 typedef WTF::HashMap<const InlineTextBox*, TextBlobPtr> InlineTextBoxBlobCacheMa p; 26 typedef WTF::HashMap<const InlineTextBox*, TextBlobPtr> InlineTextBoxBlobCacheMa p;
27 static InlineTextBoxBlobCacheMap* gTextBlobCache; 27 static InlineTextBoxBlobCacheMap* gTextBlobCache;
28 28
29 static const int misspellingLineThickness = 3; 29 static const int misspellingLineThickness = 3;
30 30
31 void InlineTextBoxPainter::removeFromTextBlobCache(InlineTextBox& inlineTextBox) 31 void InlineTextBoxPainter::removeFromTextBlobCache(InlineTextBox& inlineTextBox)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 GraphicsContext* context = paintInfo.context; 101 GraphicsContext* context = paintInfo.context;
102 const LayoutStyle& styleToUse = m_inlineTextBox.renderer().styleRef(m_inline TextBox.isFirstLineStyle()); 102 const LayoutStyle& styleToUse = m_inlineTextBox.renderer().styleRef(m_inline TextBox.isFirstLineStyle());
103 103
104 adjustedPaintOffset.move(0, styleToUse.isHorizontalWritingMode() ? LayoutUni t() : -m_inlineTextBox.logicalHeight().toLayoutUnit()); 104 adjustedPaintOffset.move(0, styleToUse.isHorizontalWritingMode() ? LayoutUni t() : -m_inlineTextBox.logicalHeight().toLayoutUnit());
105 105
106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping().toFloatPo int(); 106 FloatPoint boxOrigin = m_inlineTextBox.locationIncludingFlipping().toFloatPo int();
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 bool shouldRotate = false;
111 RenderCombineText* combinedText = nullptr; 111 LayoutTextCombine* combinedText = nullptr;
112 if (!m_inlineTextBox.isHorizontal()) { 112 if (!m_inlineTextBox.isHorizontal()) {
113 if (styleToUse.hasTextCombine() && m_inlineTextBox.renderer().isCombineT ext()) { 113 if (styleToUse.hasTextCombine() && m_inlineTextBox.renderer().isCombineT ext()) {
114 combinedText = &toRenderCombineText(m_inlineTextBox.renderer()); 114 combinedText = &toLayoutTextCombine(m_inlineTextBox.renderer());
115 if (!combinedText->isCombined()) 115 if (!combinedText->isCombined())
116 combinedText = nullptr; 116 combinedText = nullptr;
117 } 117 }
118 if (combinedText) { 118 if (combinedText) {
119 combinedText->updateFont(); 119 combinedText->updateFont();
120 boxRect.setWidth(combinedText->inlineWidthForLayout()); 120 boxRect.setWidth(combinedText->inlineWidthForLayout());
121 } else { 121 } else {
122 shouldRotate = true; 122 shouldRotate = true;
123 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock wise)); 123 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clock wise));
124 } 124 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // Place the underline at the very bottom of the text in small/medium fo nts. 426 // Place the underline at the very bottom of the text in small/medium fo nts.
427 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness; 427 underlineOffset = m_inlineTextBox.logicalHeight() - lineThickness;
428 } else { 428 } else {
429 // In larger fonts, though, place the underline up near the baseline to prevent a big gap. 429 // In larger fonts, though, place the underline up near the baseline to prevent a big gap.
430 underlineOffset = baseline + 2; 430 underlineOffset = baseline + 2;
431 } 431 }
432 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y( ) + underlineOffset), width, lineStyleForMarkerType(marker->type())); 432 pt->drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y( ) + underlineOffset), width, lineStyleForMarkerType(marker->type()));
433 } 433 }
434 434
435 template <InlineTextBoxPainter::PaintOptions options> 435 template <InlineTextBoxPainter::PaintOptions options>
436 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatR ect& boxRect, const LayoutStyle& style, const Font& font, Color textColor, Rende rCombineText* combinedText) 436 void InlineTextBoxPainter::paintSelection(GraphicsContext* context, const FloatR ect& boxRect, const LayoutStyle& style, const Font& font, Color textColor, Layou tTextCombine* combinedText)
437 { 437 {
438 // See if we have a selection to paint at all. 438 // See if we have a selection to paint at all.
439 int sPos, ePos; 439 int sPos, ePos;
440 m_inlineTextBox.selectionStartEnd(sPos, ePos); 440 m_inlineTextBox.selectionStartEnd(sPos, ePos);
441 if (sPos >= ePos) 441 if (sPos >= ePos)
442 return; 442 return;
443 443
444 Color c = m_inlineTextBox.renderer().selectionBackgroundColor(); 444 Color c = m_inlineTextBox.renderer().selectionBackgroundColor();
445 if (!c.alpha()) 445 if (!c.alpha())
446 return; 446 return;
(...skipping 14 matching lines...) Expand all
461 StringBuilder charactersWithHyphen; 461 StringBuilder charactersWithHyphen;
462 bool respectHyphen = ePos == length && m_inlineTextBox.hasHyphen(); 462 bool respectHyphen = ePos == length && m_inlineTextBox.hasHyphen();
463 TextRun textRun = m_inlineTextBox.constructTextRun(style, font, string, m_in lineTextBox.renderer().textLength() - m_inlineTextBox.start(), respectHyphen ? & charactersWithHyphen : 0); 463 TextRun textRun = m_inlineTextBox.constructTextRun(style, font, string, m_in lineTextBox.renderer().textLength() - m_inlineTextBox.start(), respectHyphen ? & charactersWithHyphen : 0);
464 if (respectHyphen) 464 if (respectHyphen)
465 ePos = textRun.length(); 465 ePos = textRun.length();
466 466
467 GraphicsContextStateSaver stateSaver(*context); 467 GraphicsContextStateSaver stateSaver(*context);
468 468
469 if (options == InlineTextBoxPainter::PaintOptions::CombinedText) { 469 if (options == InlineTextBoxPainter::PaintOptions::CombinedText) {
470 ASSERT(combinedText); 470 ASSERT(combinedText);
471 // We can't use the height of m_inlineTextBox because RenderCombineText' s inlineTextBox is horizontal within vertical flow 471 // We can't use the height of m_inlineTextBox because LayoutTextCombine' s inlineTextBox is horizontal within vertical flow
472 FloatRect clipRect = boxRect; 472 FloatRect clipRect = boxRect;
473 combinedText->transformLayoutRect(clipRect); 473 combinedText->transformLayoutRect(clipRect);
474 context->clip(clipRect); 474 context->clip(clipRect);
475 combinedText->transformToInlineCoordinates(*context, boxRect); 475 combinedText->transformToInlineCoordinates(*context, boxRect);
476 context->drawHighlightForText(font, textRun, boxRect.location(), boxRect .height(), c, sPos, ePos); 476 context->drawHighlightForText(font, textRun, boxRect.location(), boxRect .height(), c, sPos, ePos);
477 return; 477 return;
478 } 478 }
479 479
480 LayoutUnit selectionBottom = m_inlineTextBox.root().selectionBottom(); 480 LayoutUnit selectionBottom = m_inlineTextBox.root().selectionBottom();
481 LayoutUnit selectionTop = m_inlineTextBox.root().selectionTopAdjustedForPrec edingBlock(); 481 LayoutUnit selectionTop = m_inlineTextBox.root().selectionTopAdjustedForPrec edingBlock();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : 815 LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
816 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); 816 LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
817 GraphicsContextStateSaver stateSaver(*pt); 817 GraphicsContextStateSaver stateSaver(*pt);
818 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight)); 818 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight));
819 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos); 819 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos);
820 } 820 }
821 } 821 }
822 822
823 823
824 } // namespace blink 824 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/InlineTextBoxPainter.h ('k') | Source/core/paint/TextPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698