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

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

Issue 1261653002: Move SelectionState out of LayoutObject and into Line Layout API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2 legit 5ever Created 5 years, 4 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/InlineFlowBoxPainter.cpp ('k') | Source/core/paint/ListMarkerPainter.cpp » ('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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // We round the y-axis to ensure consistent line heights. 66 // We round the y-axis to ensure consistent line heights.
67 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round()); 67 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round());
68 68
69 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) 69 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart)
70 return; 70 return;
71 71
72 bool isPrinting = paintInfo.isPrinting(); 72 bool isPrinting = paintInfo.isPrinting();
73 73
74 // Determine whether or not we're selected. 74 // Determine whether or not we're selected.
75 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != LayoutObject::SelectionNone; 75 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != SelectionNone;
76 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { 76 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) {
77 // 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.
78 return; 78 return;
79 } 79 }
80 80
81 // Determine whether or not we have composition underlines to draw. 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(); 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(); 83 bool useCustomUnderlines = containsComposition && m_inlineTextBox.layoutObje ct().frame()->inputMethodController().compositionUsesCustomUnderlines();
84 84
85 // 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
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 LayoutTheme::theme().platformActiveTextSearchHighlightColor() : 813 LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
814 LayoutTheme::theme().platformInactiveTextSearchHighlightColor(); 814 LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
815 GraphicsContextStateSaver stateSaver(*pt); 815 GraphicsContextStateSaver stateSaver(*pt);
816 pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); 816 pt->clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight));
817 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); 817 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos);
818 } 818 }
819 } 819 }
820 820
821 821
822 } // namespace blink 822 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/InlineFlowBoxPainter.cpp ('k') | Source/core/paint/ListMarkerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698