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/editing/CompositionUnderline.h" | 8 #include "core/editing/CompositionUnderline.h" |
9 #include "core/editing/CompositionUnderlineRangeFilter.h" | 9 #include "core/editing/CompositionUnderlineRangeFilter.h" |
10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // within a DrawingRecorder. | 86 // within a DrawingRecorder. |
87 Optional<DrawingRecorder> drawingRecorder; | 87 Optional<DrawingRecorder> drawingRecorder; |
88 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai
ntPhaseTextClip) { | 88 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && paintInfo.phase != Pai
ntPhaseTextClip) { |
89 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in
lineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) | 89 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in
lineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) |
90 return; | 90 return; |
91 LayoutRect paintRect(logicalVisualOverflow); | 91 LayoutRect paintRect(logicalVisualOverflow); |
92 m_inlineTextBox.logicalRectToPhysicalRect(paintRect); | 92 m_inlineTextBox.logicalRectToPhysicalRect(paintRect); |
93 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || contains
Composition || paintsMarkerHighlights(m_inlineTextBox.layoutObject()))) | 93 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || contains
Composition || paintsMarkerHighlights(m_inlineTextBox.layoutObject()))) |
94 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s
tart(), m_inlineTextBox.start() + m_inlineTextBox.len())); | 94 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s
tart(), m_inlineTextBox.start() + m_inlineTextBox.len())); |
95 paintRect.moveBy(adjustedPaintOffset); | 95 paintRect.moveBy(adjustedPaintOffset); |
96 drawingRecorder.emplace(*paintInfo.context, m_inlineTextBox, DisplayItem
::paintPhaseToDrawingType(paintInfo.phase), paintRect); | 96 drawingRecorder.emplace(*paintInfo.context, m_inlineTextBox, DisplayItem
::paintPhaseToDrawingType(paintInfo.phase), FloatRect(paintRect)); |
97 } | 97 } |
98 | 98 |
99 if (m_inlineTextBox.truncation() != cNoTruncation) { | 99 if (m_inlineTextBox.truncation() != cNoTruncation) { |
100 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR
ightDirection() != m_inlineTextBox.isLeftToRightDirection()) { | 100 if (m_inlineTextBox.layoutObject().containingBlock()->style()->isLeftToR
ightDirection() != m_inlineTextBox.isLeftToRightDirection()) { |
101 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin | 101 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin |
102 // at which we start drawing text. | 102 // at which we start drawing text. |
103 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: | 103 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: |
104 // |Hello|CBA| -> |...He|CBA| | 104 // |Hello|CBA| -> |...He|CBA| |
105 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing | 105 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing |
106 // farther to the right. | 106 // farther to the right. |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri
cs().ascent()); | 829 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri
cs().ascent()); |
830 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline
TextBox.isHorizontal()); | 830 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline
TextBox.isHorizontal()); |
831 | 831 |
832 textPainter.paint(sPos, ePos, length, textStyle, 0); | 832 textPainter.paint(sPos, ePos, length, textStyle, 0); |
833 } | 833 } |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 | 837 |
838 } // namespace blink | 838 } // namespace blink |
OLD | NEW |