Changeset 271232 in webkit
- Timestamp:
- Jan 7, 2021, 2:05:19 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
rendering/svg/SVGInlineTextBox.cpp (modified) (1 diff)
-
rendering/svg/SVGResourcesCache.cpp (modified) (1 diff)
-
rendering/svg/SVGResourcesCache.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271231 r271232 1 2021-01-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Only update the resources when rendering SVG selected text 4 https://bugs.webkit.org/show_bug.cgi?id=218486 5 6 Reviewed by Ryosuke Niwa. 7 8 Instead of calling SVGResourcesCache::clientStyleChanged() that marks the renderer for layout and parent 9 resource invalidation, add a helper class SVGResourcesCache::SetStyleForScope() that just updates the resources 10 for the new style on construction and restores the previous one on destruction. 11 12 * rendering/svg/SVGInlineTextBox.cpp: 13 (WebCore::SVGInlineTextBox::paintText): Use SVGResourcesCache::SetStyleForScope(). 14 * rendering/svg/SVGResourcesCache.cpp: 15 (WebCore::SVGResourcesCache::SetStyleForScope::SetStyleForScope): Call setStyle() with the new style. 16 (WebCore::SVGResourcesCache::SetStyleForScope::~SetStyleForScope): Call setStyle() with the previous style. 17 (WebCore::SVGResourcesCache::SetStyleForScope::setStyle): Set the given style if needed. 18 * rendering/svg/SVGResourcesCache.h: 19 1 20 2021-01-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r265338 r271232 603 603 604 604 // Draw text using selection style from the start to the end position of the selection 605 if (style != selectionStyle) 606 SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifference::Repaint, selectionStyle); 607 608 paintTextWithShadows(context, selectionStyle, textRun, fragment, startPosition, endPosition); 609 610 if (style != selectionStyle) 611 SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifference::Repaint, style); 605 { 606 SVGResourcesCache::SetStyleForScope temporaryStyleChange(parent()->renderer(), style, selectionStyle); 607 paintTextWithShadows(context, selectionStyle, textRun, fragment, startPosition, endPosition); 608 } 612 609 613 610 // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part -
trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp
r248846 r271232 170 170 } 171 171 172 SVGResourcesCache::SetStyleForScope::SetStyleForScope(RenderElement& renderer, const RenderStyle& scopedStyle, const RenderStyle& newStyle) 173 : m_renderer(renderer) 174 , m_scopedStyle(scopedStyle) 175 , m_needsNewStyle(scopedStyle != newStyle && rendererCanHaveResources(renderer)) 176 { 177 setStyle(newStyle); 172 178 } 179 180 SVGResourcesCache::SetStyleForScope::~SetStyleForScope() 181 { 182 setStyle(m_scopedStyle); 183 } 184 185 void SVGResourcesCache::SetStyleForScope::setStyle(const RenderStyle& style) 186 { 187 if (!m_needsNewStyle) 188 return; 189 190 auto& cache = resourcesCacheFromRenderer(m_renderer); 191 cache.removeResourcesFromRenderer(m_renderer); 192 cache.addResourcesFromRenderer(m_renderer, style); 193 } 194 195 } -
trunk/Source/WebCore/rendering/svg/SVGResourcesCache.h
r208668 r271232 59 59 static void resourceDestroyed(RenderSVGResourceContainer&); 60 60 61 class SetStyleForScope { 62 WTF_MAKE_NONCOPYABLE(SetStyleForScope); 63 public: 64 SetStyleForScope(RenderElement&, const RenderStyle& scopedStyle, const RenderStyle& newStyle); 65 ~SetStyleForScope(); 66 private: 67 void setStyle(const RenderStyle&); 68 69 RenderElement& m_renderer; 70 const RenderStyle& m_scopedStyle; 71 bool m_needsNewStyle { false }; 72 }; 73 61 74 private: 62 75 void addResourcesFromRenderer(RenderElement&, const RenderStyle&);
Note:
See TracChangeset
for help on using the changeset viewer.