Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp

Issue 1527343002: Simplify paintFillLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/Editor.h" 9 #include "core/editing/Editor.h"
10 #include "core/editing/markers/DocumentMarkerController.h" 10 #include "core/editing/markers/DocumentMarkerController.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 bool isPrinting = paintInfo.isPrinting(); 79 bool isPrinting = paintInfo.isPrinting();
80 80
81 // Determine whether or not we're selected. 81 // Determine whether or not we're selected.
82 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != SelectionNone; 82 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && m_inlineTextBox.selectionState() != SelectionNone;
83 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { 83 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) {
84 // When only painting the selection, don't bother to paint if there is n one. 84 // When only painting the selection, don't bother to paint if there is n one.
85 return; 85 return;
86 } 86 }
87 87
88 // The text clip phase already has a LayoutObjectDrawingRecorder. Text clips are initiated only in BoxPainter::paintLayerExtended, 88 // The text clip phase already has a LayoutObjectDrawingRecorder. Text clips are initiated only in BoxPainter::paintFillLayer,
89 // which is already within a LayoutObjectDrawingRecorder. 89 // which is already within a LayoutObjectDrawingRecorder.
90 Optional<DrawingRecorder> drawingRecorder; 90 Optional<DrawingRecorder> drawingRecorder;
91 if (paintInfo.phase != PaintPhaseTextClip) { 91 if (paintInfo.phase != PaintPhaseTextClip) {
92 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inl ineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) 92 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inl ineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase)))
93 return; 93 return;
94 LayoutRect paintRect(logicalVisualOverflow); 94 LayoutRect paintRect(logicalVisualOverflow);
95 m_inlineTextBox.logicalRectToPhysicalRect(paintRect); 95 m_inlineTextBox.logicalRectToPhysicalRect(paintRect);
96 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || paintsMa rkerHighlights(*LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayout Item())))) 96 if (paintInfo.phase != PaintPhaseSelection && (haveSelection || paintsMa rkerHighlights(*LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayout Item()))))
97 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s tart(), m_inlineTextBox.start() + m_inlineTextBox.len())); 97 paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.s tart(), m_inlineTextBox.start() + m_inlineTextBox.len()));
98 paintRect.moveBy(adjustedPaintOffset); 98 paintRect.moveBy(adjustedPaintOffset);
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent()); 863 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent());
864 TextPainter textPainter(context, font, run, textOrigin, boxRect, m_i nlineTextBox.isHorizontal()); 864 TextPainter textPainter(context, font, run, textOrigin, boxRect, m_i nlineTextBox.isHorizontal());
865 865
866 textPainter.paint(sPos, ePos, length, textStyle, 0); 866 textPainter.paint(sPos, ePos, length, textStyle, 0);
867 } 867 }
868 } 868 }
869 } 869 }
870 870
871 871
872 } // namespace blink 872 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/InlineFlowBoxPainter.cpp ('k') | third_party/WebKit/Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698