| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |