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

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

Issue 1584903002: Improvement handling of background and outline paint phases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintPhaseRename
Patch Set: Created 4 years, 11 months 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 "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/editing/markers/RenderedDocumentMarker.h" 10 #include "core/editing/markers/RenderedDocumentMarker.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 static bool paintsCompositionMarkers(const LayoutObject& layoutObject) 51 static bool paintsCompositionMarkers(const LayoutObject& layoutObject)
52 { 52 {
53 return layoutObject.node() && layoutObject.document().markers().markersFor(l ayoutObject.node(), DocumentMarker::Composition).size() > 0; 53 return layoutObject.node() && layoutObject.document().markers().markersFor(l ayoutObject.node(), DocumentMarker::Composition).size() > 0;
54 } 54 }
55 55
56 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 56 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
57 { 57 {
58 if (!shouldPaintTextBox(paintInfo)) 58 if (!shouldPaintTextBox(paintInfo))
59 return; 59 return;
60 60
61 ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhase SelfOutline && paintInfo.phase != PaintPhaseDescendantOutlines); 61 ASSERT(!shouldPaintSelfOutline(paintInfo.phase) && !shouldPaintDescendantOut lines(paintInfo.phase));
62 62
63 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect(); 63 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect();
64 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y()); 64 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y());
65 LayoutUnit logicalExtent = logicalVisualOverflow.width(); 65 LayoutUnit logicalExtent = logicalVisualOverflow.width();
66 66
67 // We round the y-axis to ensure consistent line heights. 67 // We round the y-axis to ensure consistent line heights.
68 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round()); 68 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round());
69 69
70 if (m_inlineTextBox.isHorizontal()) { 70 if (m_inlineTextBox.isHorizontal()) {
71 if (!paintInfo.cullRect().intersectsHorizontalRange(logicalStart, logica lStart + logicalExtent)) 71 if (!paintInfo.cullRect().intersectsHorizontalRange(logicalStart, logica lStart + logicalExtent))
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 870
871 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker-> activeMatch()); 871 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker-> activeMatch());
872 GraphicsContext& context = paintInfo.context; 872 GraphicsContext& context = paintInfo.context;
873 GraphicsContextStateSaver stateSaver(context); 873 GraphicsContextStateSaver stateSaver(context);
874 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); 874 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight));
875 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); 875 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos);
876 } 876 }
877 877
878 878
879 } // namespace blink 879 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698