| 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 "core/paint/InlineTextBoxPainter.h" | 5 #include "core/paint/InlineTextBoxPainter.h" |
| 6 | 6 |
| 7 #include "core/editing/CompositionUnderline.h" | 7 #include "core/editing/CompositionUnderline.h" |
| 8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
| 9 #include "core/editing/markers/DocumentMarkerController.h" | 9 #include "core/editing/markers/DocumentMarkerController.h" |
| 10 #include "core/editing/markers/RenderedDocumentMarker.h" | 10 #include "core/editing/markers/RenderedDocumentMarker.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 static bool paintsCompositionMarkers(const LayoutObject& layoutObject) | 51 static bool paintsCompositionMarkers(const LayoutObject& layoutObject) |
| 52 { | 52 { |
| 53 return layoutObject.node() && layoutObject.document().markers().markersFor(l
ayoutObject.node(), DocumentMarker::Composition).size() > 0; | 53 return layoutObject.node() && layoutObject.document().markers().markersFor(l
ayoutObject.node(), DocumentMarker::Composition).size() > 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 56 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
| 57 { | 57 { |
| 58 if (!shouldPaintTextBox(paintInfo)) | 58 if (!shouldPaintTextBox(paintInfo)) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhase
SelfOutline && paintInfo.phase != PaintPhaseDescendantOutlines); | 61 ASSERT(!shouldPaintSelfOutline(paintInfo.phase) && !shouldPaintDescendantOut
lines(paintInfo.phase)); |
| 62 | 62 |
| 63 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect(); | 63 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect(); |
| 64 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor
izontal() ? paintOffset.x() : paintOffset.y()); | 64 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor
izontal() ? paintOffset.x() : paintOffset.y()); |
| 65 LayoutUnit logicalExtent = logicalVisualOverflow.width(); | 65 LayoutUnit logicalExtent = logicalVisualOverflow.width(); |
| 66 | 66 |
| 67 // We round the y-axis to ensure consistent line heights. | 67 // We round the y-axis to ensure consistent line heights. |
| 68 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y
().round()); | 68 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y
().round()); |
| 69 | 69 |
| 70 if (m_inlineTextBox.isHorizontal()) { | 70 if (m_inlineTextBox.isHorizontal()) { |
| 71 if (!paintInfo.cullRect().intersectsHorizontalRange(logicalStart, logica
lStart + logicalExtent)) | 71 if (!paintInfo.cullRect().intersectsHorizontalRange(logicalStart, logica
lStart + logicalExtent)) |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 | 870 |
| 871 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker->
activeMatch()); | 871 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker->
activeMatch()); |
| 872 GraphicsContext& context = paintInfo.context; | 872 GraphicsContext& context = paintInfo.context; |
| 873 GraphicsContextStateSaver stateSaver(context); | 873 GraphicsContextStateSaver stateSaver(context); |
| 874 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF
loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); | 874 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF
loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); |
| 875 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(),
(boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); | 875 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(),
(boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); |
| 876 } | 876 } |
| 877 | 877 |
| 878 | 878 |
| 879 } // namespace blink | 879 } // namespace blink |
| OLD | NEW |