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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/GraphicsContextAnnotator.cpp ('k') | Source/core/paint/LayerPainter.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // We round the y-axis to ensure consistent line heights. 59 // We round the y-axis to ensure consistent line heights.
60 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round()); 60 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round());
61 61
62 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) 62 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart)
63 return; 63 return;
64 64
65 bool isPrinting = m_inlineTextBox.renderer().document().printing(); 65 bool isPrinting = m_inlineTextBox.renderer().document().printing();
66 66
67 // Determine whether or not we're selected. 67 // Determine whether or not we're selected.
68 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != RenderObject::SelectionNone; 68 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != LayoutObject::SelectionNone;
69 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { 69 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) {
70 // When only painting the selection, don't bother to paint if there is n one. 70 // When only painting the selection, don't bother to paint if there is n one.
71 return; 71 return;
72 } 72 }
73 73
74 // The text clip phase already has a DrawingRecorder. Text clips are initiat ed only in BoxPainter::paintLayerExtended, which is already 74 // The text clip phase already has a DrawingRecorder. Text clips are initiat ed only in BoxPainter::paintLayerExtended, which is already
75 // within a DrawingRecorder. 75 // within a DrawingRecorder.
76 OwnPtr<DrawingRecorder> drawingRecorder; 76 OwnPtr<DrawingRecorder> drawingRecorder;
77 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai ntPhaseTextClip) { 77 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai ntPhaseTextClip) {
78 drawingRecorder = adoptPtr(new DrawingRecorder(paintInfo.context, m_inli neTextBox.displayItemClient(), DisplayItem::paintPhaseToDrawingType(paintInfo.ph ase), pixelSnappedIntRect(adjustedPaintOffset, logicalVisualOverflow.size()))); 78 drawingRecorder = adoptPtr(new DrawingRecorder(paintInfo.context, m_inli neTextBox.displayItemClient(), DisplayItem::paintPhaseToDrawingType(paintInfo.ph ase), pixelSnappedIntRect(adjustedPaintOffset, logicalVisualOverflow.size())));
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 x += 2 * step; 658 x += 2 * step;
659 path.addBezierCurveTo(controlPoint1, controlPoint2, FloatPoint(x, yA xis)); 659 path.addBezierCurveTo(controlPoint1, controlPoint2, FloatPoint(x, yA xis));
660 } 660 }
661 } 661 }
662 662
663 context->setShouldAntialias(true); 663 context->setShouldAntialias(true);
664 context->strokePath(path); 664 context->strokePath(path);
665 } 665 }
666 666
667 static void paintAppliedDecoration(GraphicsContext* context, FloatPoint start, f loat width, float doubleOffset, int wavyOffsetFactor, 667 static void paintAppliedDecoration(GraphicsContext* context, FloatPoint start, f loat width, float doubleOffset, int wavyOffsetFactor,
668 RenderObject::AppliedTextDecoration decoration, float thickness, bool antial iasDecoration, bool isPrinting) 668 LayoutObject::AppliedTextDecoration decoration, float thickness, bool antial iasDecoration, bool isPrinting)
669 { 669 {
670 context->setStrokeStyle(textDecorationStyleToStrokeStyle(decoration.style)); 670 context->setStrokeStyle(textDecorationStyleToStrokeStyle(decoration.style));
671 context->setStrokeColor(decoration.color); 671 context->setStrokeColor(decoration.color);
672 672
673 switch (decoration.style) { 673 switch (decoration.style) {
674 case TextDecorationStyleWavy: 674 case TextDecorationStyleWavy:
675 strokeWavyTextDecoration(context, start + FloatPoint(0, doubleOffset * w avyOffsetFactor), start + FloatPoint(width, doubleOffset * wavyOffsetFactor), th ickness); 675 strokeWavyTextDecoration(context, start + FloatPoint(0, doubleOffset * w avyOffsetFactor), start + FloatPoint(width, doubleOffset * wavyOffsetFactor), th ickness);
676 break; 676 break;
677 case TextDecorationStyleDotted: 677 case TextDecorationStyleDotted:
678 case TextDecorationStyleDashed: 678 case TextDecorationStyleDashed:
(...skipping 17 matching lines...) Expand all
696 FloatPoint localOrigin = boxOrigin; 696 FloatPoint localOrigin = boxOrigin;
697 697
698 float width = m_inlineTextBox.logicalWidth(); 698 float width = m_inlineTextBox.logicalWidth();
699 if (m_inlineTextBox.truncation() != cNoTruncation) { 699 if (m_inlineTextBox.truncation() != cNoTruncation) {
700 width = m_inlineTextBox.renderer().width(m_inlineTextBox.start(), m_inli neTextBox.truncation(), m_inlineTextBox.textPos(), m_inlineTextBox.isLeftToRight Direction() ? LTR : RTL, m_inlineTextBox.isFirstLineStyle()); 700 width = m_inlineTextBox.renderer().width(m_inlineTextBox.start(), m_inli neTextBox.truncation(), m_inlineTextBox.textPos(), m_inlineTextBox.isLeftToRight Direction() ? LTR : RTL, m_inlineTextBox.isFirstLineStyle());
701 if (!m_inlineTextBox.isLeftToRightDirection()) 701 if (!m_inlineTextBox.isLeftToRightDirection())
702 localOrigin.move(m_inlineTextBox.logicalWidth() - width, 0); 702 localOrigin.move(m_inlineTextBox.logicalWidth() - width, 0);
703 } 703 }
704 704
705 // Get the text decoration colors. 705 // Get the text decoration colors.
706 RenderObject::AppliedTextDecoration underline, overline, linethrough; 706 LayoutObject::AppliedTextDecoration underline, overline, linethrough;
707 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, lin ethrough, true); 707 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, lin ethrough, true);
708 if (m_inlineTextBox.isFirstLineStyle()) 708 if (m_inlineTextBox.isFirstLineStyle())
709 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, linethrough, true, true); 709 m_inlineTextBox.renderer().getTextDecorations(deco, underline, overline, linethrough, true, true);
710 710
711 // Use a special function for underlines to get the positioning exactly righ t. 711 // Use a special function for underlines to get the positioning exactly righ t.
712 bool isPrinting = m_inlineTextBox.renderer().document().printing(); 712 bool isPrinting = m_inlineTextBox.renderer().document().printing();
713 713
714 const RenderStyle& styleToUse = m_inlineTextBox.renderer().styleRef(m_inline TextBox.isFirstLineStyle()); 714 const RenderStyle& styleToUse = m_inlineTextBox.renderer().styleRef(m_inline TextBox.isFirstLineStyle());
715 int baseline = styleToUse.fontMetrics().ascent(); 715 int baseline = styleToUse.fontMetrics().ascent();
716 716
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : 799 LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
800 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); 800 LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
801 GraphicsContextStateSaver stateSaver(*pt); 801 GraphicsContextStateSaver stateSaver(*pt);
802 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight)); 802 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo x.logicalWidth(), selHeight));
803 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos); 803 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin. y() - deltaY), selHeight, color, sPos, ePos);
804 } 804 }
805 } 805 }
806 806
807 807
808 } // namespace blink 808 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/GraphicsContextAnnotator.cpp ('k') | Source/core/paint/LayerPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698