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/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 bool InlineTextBoxPainter::shouldPaintTextBox(const PaintInfo& paintInfo) | 231 bool InlineTextBoxPainter::shouldPaintTextBox(const PaintInfo& paintInfo) |
232 { | 232 { |
233 // When painting selection, we want to include a highlight when the | 233 // When painting selection, we want to include a highlight when the |
234 // selection spans line breaks. In other cases such as invisible elements | 234 // selection spans line breaks. In other cases such as invisible elements |
235 // or those with no text that are not line breaks, we can skip painting | 235 // or those with no text that are not line breaks, we can skip painting |
236 // wholesale. | 236 // wholesale. |
237 // TODO(wkorman): Constrain line break painting to appropriate paint phase. | 237 // TODO(wkorman): Constrain line break painting to appropriate paint phase. |
238 // This code path is only called in PaintPhaseForeground whereas we would | 238 // This code path is only called in PaintPhaseForeground whereas we would |
239 // expect PaintPhaseSelection. The existing haveSelection logic in paint() | 239 // expect PaintPhaseSelection. The existing haveSelection logic in paint() |
240 // tests for != PaintPhaseTextClip. | 240 // tests for != PaintPhaseTextClip. |
241 if (m_inlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE | 241 if (m_inlineTextBox.getLineLayoutItem().style()->visibility() != EVisibility
::Visible |
242 || m_inlineTextBox.truncation() == cFullTruncation | 242 || m_inlineTextBox.truncation() == cFullTruncation |
243 || !m_inlineTextBox.len()) | 243 || !m_inlineTextBox.len()) |
244 return false; | 244 return false; |
245 return true; | 245 return true; |
246 } | 246 } |
247 | 247 |
248 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u
nderline) | 248 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u
nderline) |
249 { | 249 { |
250 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st
artOffset); | 250 return std::max(static_cast<unsigned>(m_inlineTextBox.start()), underline.st
artOffset); |
251 } | 251 } |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 GraphicsContext& context = paintInfo.context; | 840 GraphicsContext& context = paintInfo.context; |
841 GraphicsContextStateSaver stateSaver(context); | 841 GraphicsContextStateSaver stateSaver(context); |
842 | 842 |
843 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_i
nlineTextBox.logicalHeight())); | 843 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_i
nlineTextBox.logicalHeight())); |
844 context.clip(FloatRect(boxRect)); | 844 context.clip(FloatRect(boxRect)); |
845 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), boxRect.heigh
t(), color, sPos, ePos); | 845 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), boxRect.heigh
t(), color, sPos, ePos); |
846 } | 846 } |
847 | 847 |
848 | 848 |
849 } // namespace blink | 849 } // namespace blink |
OLD | NEW |