| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip &&
m_inlineTextBox.selectionState() != LayoutObject::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 LayoutRect paintRect = logicalVisualOverflow; | 78 LayoutRect paintRect(m_inlineTextBox.logicalRectToPhysicalRect(logicalVi
sualOverflow)); |
| 79 paintRect.moveBy(adjustedPaintOffset); | 79 paintRect.moveBy(adjustedPaintOffset); |
| 80 drawingRecorder = adoptPtr(new DrawingRecorder(paintInfo.context, m_inli
neTextBox.displayItemClient(), DisplayItem::paintPhaseToDrawingType(paintInfo.ph
ase), paintRect)); | 80 drawingRecorder = adoptPtr(new DrawingRecorder(paintInfo.context, m_inli
neTextBox.displayItemClient(), DisplayItem::paintPhaseToDrawingType(paintInfo.ph
ase), paintRect)); |
| 81 if (drawingRecorder->canUseCachedDrawing()) | 81 if (drawingRecorder->canUseCachedDrawing()) |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (m_inlineTextBox.truncation() != cNoTruncation) { | 85 if (m_inlineTextBox.truncation() != cNoTruncation) { |
| 86 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR
ightDirection() != m_inlineTextBox.isLeftToRightDirection()) { | 86 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR
ightDirection() != m_inlineTextBox.isLeftToRightDirection()) { |
| 87 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin | 87 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin |
| 88 // at which we start drawing text. | 88 // at which we start drawing text. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |