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

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

Issue 2337373002: Update composition underline start/end constraints. (Closed)
Patch Set: Sync to head. Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/SVGInlineTextBoxPainter.h" 5 #include "core/paint/SVGInlineTextBoxPainter.h"
6 6
7 #include "core/editing/Editor.h" 7 #include "core/editing/Editor.h"
8 #include "core/editing/markers/DocumentMarkerController.h" 8 #include "core/editing/markers/DocumentMarkerController.h"
9 #include "core/editing/markers/RenderedDocumentMarker.h" 9 #include "core/editing/markers/RenderedDocumentMarker.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 LayoutSVGInlineText& SVGInlineTextBoxPainter::inlineText() const 76 LayoutSVGInlineText& SVGInlineTextBoxPainter::inlineText() const
77 { 77 {
78 return toLayoutSVGInlineText(inlineLayoutObject()); 78 return toLayoutSVGInlineText(inlineLayoutObject());
79 } 79 }
80 80
81 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin t& paintOffset) 81 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin t& paintOffset)
82 { 82 {
83 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection); 83 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection);
84 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); 84 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation);
85 85
86 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != EVisibil ity::Visible) 86 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != EVisibil ity::Visible
87 || !m_svgInlineTextBox.len())
87 return; 88 return;
88 89
89 // We're explicitly not supporting composition & custom underlines and custo m highlighters -- unlike InlineTextBox. 90 // We're explicitly not supporting composition & custom underlines and custo m highlighters -- unlike InlineTextBox.
90 // If we ever need that for SVG, it's very easy to refactor and reuse the co de. 91 // If we ever need that for SVG, it's very easy to refactor and reuse the co de.
91 92
92 bool haveSelection = shouldPaintSelection(paintInfo); 93 bool haveSelection = shouldPaintSelection(paintInfo);
93 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) 94 if (!haveSelection && paintInfo.phase == PaintPhaseSelection)
94 return; 95 return;
95 96
96 LayoutSVGInlineText& textLayoutObject = inlineText(); 97 LayoutSVGInlineText& textLayoutObject = inlineText();
97 if (!textShouldBePainted(textLayoutObject)) 98 if (!textShouldBePainted(textLayoutObject))
98 return; 99 return;
99 100
100 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase); 101 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase);
101 if (!DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_svgInl ineTextBox, displayItemType)) { 102 if (!DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_svgInl ineTextBox, displayItemType)) {
102 LayoutObject& parentLayoutObject = parentInlineLayoutObject(); 103 LayoutObject& parentLayoutObject = parentInlineLayoutObject();
103 const ComputedStyle& style = parentLayoutObject.styleRef(); 104 const ComputedStyle& style = parentLayoutObject.styleRef();
104 105
105 bool includeSelectionRect = paintInfo.phase != PaintPhaseSelection 106 bool includeSelectionRect = paintInfo.phase != PaintPhaseSelection
106 && (haveSelection || InlineTextBoxPainter::paintsMarkerHighlights(te xtLayoutObject)); 107 && (haveSelection || InlineTextBoxPainter::paintsMarkerHighlights(te xtLayoutObject));
107 DrawingRecorder recorder(paintInfo.context, m_svgInlineTextBox, displayI temType, 108 DrawingRecorder recorder(paintInfo.context, m_svgInlineTextBox, displayI temType,
108 boundsForDrawingRecorder(paintInfo, style, paintOffset, includeSelec tionRect)); 109 boundsForDrawingRecorder(paintInfo, style, paintOffset, includeSelec tionRect));
109 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( 110 InlineTextBoxPainter textPainter(m_svgInlineTextBox);
110 paintInfo, paintOffset, style, 111 textPainter.paintDocumentMarkers(paintInfo, paintOffset, style,
111 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Background) ; 112 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Background) ;
112 113
113 if (!m_svgInlineTextBox.textFragments().isEmpty()) 114 if (!m_svgInlineTextBox.textFragments().isEmpty())
114 paintTextFragments(paintInfo, parentLayoutObject); 115 paintTextFragments(paintInfo, parentLayoutObject);
115 116
116 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( 117 textPainter.paintDocumentMarkers(paintInfo, paintOffset, style,
117 paintInfo, paintOffset, style,
118 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Foreground) ; 118 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Foreground) ;
119 } 119 }
120 } 120 }
121 121
122 void SVGInlineTextBoxPainter::paintTextFragments(const PaintInfo& paintInfo, Lay outObject& parentLayoutObject) 122 void SVGInlineTextBoxPainter::paintTextFragments(const PaintInfo& paintInfo, Lay outObject& parentLayoutObject)
123 { 123 {
124 const ComputedStyle& style = parentLayoutObject.styleRef(); 124 const ComputedStyle& style = parentLayoutObject.styleRef();
125 const SVGComputedStyle& svgStyle = style.svgStyle(); 125 const SVGComputedStyle& svgStyle = style.svgStyle();
126 126
127 bool hasFill = svgStyle.hasFill(); 127 bool hasFill = svgStyle.hasFill();
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 stateSaver.save(); 534 stateSaver.save();
535 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); 535 paintInfo.context.concatCTM(fragment.buildFragmentTransform());
536 } 536 }
537 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment (fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); 537 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment (fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style);
538 paintInfo.context.setFillColor(color); 538 paintInfo.context.setFillColor(color);
539 paintInfo.context.fillRect(fragmentRect); 539 paintInfo.context.fillRect(fragmentRect);
540 } 540 }
541 } 541 }
542 542
543 } // namespace blink 543 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698