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