Title: [279792] trunk/Source/WebCore
Revision
279792
Author
s...@apple.com
Date
2021-07-09 12:18:58 -0700 (Fri, 09 Jul 2021)

Log Message

SVGInlineTextBox::acquirePaintingResource() should return false if the resource can't be applied
https://bugs.webkit.org/show_bug.cgi?id=227826
<rdar://79662757>

Reviewed by Simon Fraser.

Ensure RenderSVGResource::postApplyResource() is called only if the
corresponding RenderSVGResource::applyResource() succeeds. Otherwise
the GraphicsContext stack state will be unbalanced.

* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::acquirePaintingResource):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279791 => 279792)


--- trunk/Source/WebCore/ChangeLog	2021-07-09 18:01:46 UTC (rev 279791)
+++ trunk/Source/WebCore/ChangeLog	2021-07-09 19:18:58 UTC (rev 279792)
@@ -1,3 +1,18 @@
+2021-07-09  Said Abou-Hallawa  <s...@apple.com>
+
+        SVGInlineTextBox::acquirePaintingResource() should return false if the resource can't be applied
+        https://bugs.webkit.org/show_bug.cgi?id=227826
+        <rdar://79662757>
+
+        Reviewed by Simon Fraser.
+
+        Ensure RenderSVGResource::postApplyResource() is called only if the 
+        corresponding RenderSVGResource::applyResource() succeeds. Otherwise
+        the GraphicsContext stack state will be unbalanced.
+
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::acquirePaintingResource):
+
 2021-07-09  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Negative padding values are invalid (inline box)

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (279791 => 279792)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2021-07-09 18:01:46 UTC (rev 279791)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2021-07-09 19:18:58 UTC (rev 279792)
@@ -354,12 +354,18 @@
         return false;
 
     if (!m_paintingResource->applyResource(renderer, style, context, paintingResourceMode())) {
-        if (fallbackColor.isValid()) {
-            RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
-            fallbackResource->setColor(fallbackColor);
+        if (!fallbackColor.isValid()) {
+            m_paintingResource = nullptr;
+            return false;
+        }
+        
+        RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
+        fallbackResource->setColor(fallbackColor);
 
-            m_paintingResource = fallbackResource;
-            m_paintingResource->applyResource(renderer, style, context, paintingResourceMode());
+        m_paintingResource = fallbackResource;
+        if (!m_paintingResource->applyResource(renderer, style, context, paintingResourceMode())) {
+            m_paintingResource = nullptr;
+            return false;
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to