| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() != RenderObject::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<RenderDrawingRecorder> drawingRecorder; | 76 OwnPtr<RenderDrawingRecorder> drawingRecorder; |
| 77 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai
ntPhaseTextClip) | 77 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai
ntPhaseTextClip) { |
| 78 drawingRecorder = adoptPtr(new RenderDrawingRecorder(paintInfo.context,
&m_inlineTextBox.renderer(), paintInfo.phase, pixelSnappedIntRect(adjustedPaintO
ffset, logicalVisualOverflow.size()))); | 78 drawingRecorder = adoptPtr(new RenderDrawingRecorder(paintInfo.context,
m_inlineTextBox.renderer(), paintInfo.phase, pixelSnappedIntRect(adjustedPaintOf
fset, logicalVisualOverflow.size()))); |
| 79 if (drawingRecorder->canUseCachedDrawing()) |
| 80 return; |
| 81 } |
| 79 | 82 |
| 80 if (m_inlineTextBox.truncation() != cNoTruncation) { | 83 if (m_inlineTextBox.truncation() != cNoTruncation) { |
| 81 if (m_inlineTextBox.renderer().containingBlock()->style()->isLeftToRight
Direction() != m_inlineTextBox.isLeftToRightDirection()) { | 84 if (m_inlineTextBox.renderer().containingBlock()->style()->isLeftToRight
Direction() != m_inlineTextBox.isLeftToRightDirection()) { |
| 82 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin | 85 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin |
| 83 // at which we start drawing text. | 86 // at which we start drawing text. |
| 84 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: | 87 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: |
| 85 // |Hello|CBA| -> |...He|CBA| | 88 // |Hello|CBA| -> |...He|CBA| |
| 86 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing | 89 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing |
| 87 // farther to the right. | 90 // farther to the right. |
| 88 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the | 91 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 RenderTheme::theme().platformActiveTextSearchHighlightColor() : | 795 RenderTheme::theme().platformActiveTextSearchHighlightColor() : |
| 793 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); | 796 RenderTheme::theme().platformInactiveTextSearchHighlightColor(); |
| 794 GraphicsContextStateSaver stateSaver(*pt); | 797 GraphicsContextStateSaver stateSaver(*pt); |
| 795 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); | 798 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_inlineTextBo
x.logicalWidth(), selHeight)); |
| 796 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); | 799 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.
y() - deltaY), selHeight, color, sPos, ePos); |
| 797 } | 800 } |
| 798 } | 801 } |
| 799 | 802 |
| 800 | 803 |
| 801 } // namespace blink | 804 } // namespace blink |
| OLD | NEW |