⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287832 in webkit


Ignore:
Timestamp:
Jan 10, 2022, 1:47:29 AM (5 years ago)
Author:
Nikolas Zimmermann
Message:

[LBSE] Begin layer-aware RenderSVGShape implementation
https://bugs.webkit.org/show_bug.cgi?id=234954

Reviewed by Rob Buis.

Begin implementing RenderSVGShape, based on the downstream version in the
LBSE branch. Many parts are 1:1 copies from LegacyRenderSVGShape, although
the core methods for layout / paint / hit-testing looks quite different in
RenderSVGShape -- the code is mostly adapted from layer-aware CSS renderers
such as RenderBox / RenderBlock taking SVG specifics into account.

This patch hooks in RenderSVGShape in all places that used to handle
LegacyRenderSVGShape, e.g. in AccessibilityRenderObject. However no
renderer inherits from RenderSVGShape yet -- a follow-up patch will
introduce RenderSVGRect.

Covered by existing tests, no change in behaviour.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::supportsPath const):
(WebCore::AccessibilityRenderObject::elementPath const):

  • rendering/RenderTreeAsText.cpp:

(WebCore::write):

  • rendering/svg/RenderSVGResource.cpp:

(WebCore::RenderSVGResource::fillAndStrokePathOrShape const):

  • rendering/svg/RenderSVGResource.h:

(WebCore::RenderSVGResource::postApplyResource):

  • rendering/svg/RenderSVGResourceFilter.cpp:

(WebCore::RenderSVGResourceFilter::postApplyResource):

  • rendering/svg/RenderSVGResourceFilter.h:
  • rendering/svg/RenderSVGResourceGradient.cpp:

(WebCore::RenderSVGResourceGradient::postApplyResource):

  • rendering/svg/RenderSVGResourceGradient.h:
  • rendering/svg/RenderSVGResourcePattern.cpp:

(WebCore::RenderSVGResourcePattern::postApplyResource):

  • rendering/svg/RenderSVGResourcePattern.h:
  • rendering/svg/RenderSVGResourceSolidColor.cpp:

(WebCore::RenderSVGResourceSolidColor::postApplyResource):

  • rendering/svg/RenderSVGResourceSolidColor.h:
  • rendering/svg/RenderSVGShape.cpp: Added.

(WebCore::RenderSVGShape::RenderSVGShape):
(WebCore::RenderSVGShape::updateShapeFromElement):
(WebCore::RenderSVGShape::isEmpty const):
(WebCore::RenderSVGShape::fillShape const):
(WebCore::RenderSVGShape::strokeShape const):
(WebCore::RenderSVGShape::shapeDependentStrokeContains):
(WebCore::RenderSVGShape::shapeDependentFillContains const):
(WebCore::RenderSVGShape::fillContains):
(WebCore::RenderSVGShape::strokeContains):
(WebCore::RenderSVGShape::layout):
(WebCore::RenderSVGShape::nonScalingStrokePath const):
(WebCore::RenderSVGShape::setupNonScalingStrokeContext):
(WebCore::RenderSVGShape::nonScalingStrokeTransform const):
(WebCore::RenderSVGShape::shouldGenerateMarkerPositions const):
(WebCore::RenderSVGShape::fillShape):
(WebCore::RenderSVGShape::strokeShape):
(WebCore::RenderSVGShape::fillStrokeMarkers):
(WebCore::RenderSVGShape::paint):
(WebCore::RenderSVGShape::isPointInFill):
(WebCore::RenderSVGShape::isPointInStroke):
(WebCore::RenderSVGShape::getTotalLength const):
(WebCore::RenderSVGShape::getPointAtLength const):
(WebCore::RenderSVGShape::nodeAtPoint):
(WebCore::markerForType):
(WebCore::RenderSVGShape::computeMarkerBoundingBox const):
(WebCore::RenderSVGShape::calculateObjectBoundingBox const):
(WebCore::RenderSVGShape::calculateStrokeBoundingBox const):
(WebCore::RenderSVGShape::strokeWidth const):
(WebCore::RenderSVGShape::hasSmoothStroke const):
(WebCore::RenderSVGShape::drawMarkers):
(WebCore::RenderSVGShape::createPath const):
(WebCore::RenderSVGShape::processMarkerPositions):
(WebCore::RenderSVGShape::styleWillChange):

  • rendering/svg/RenderSVGShape.h: Added.

(WebCore::RenderSVGShape::setNeedsShapeUpdate):
(WebCore::RenderSVGShape::hasPath const):
(WebCore::RenderSVGShape::path const):
(WebCore::RenderSVGShape::clearPath):
(WebCore::RenderSVGShape::hasNonScalingStroke const):

  • rendering/svg/RenderSVGShapeInlines.h: Added.

(WebCore::RenderSVGShape::graphicsElement const):

  • rendering/svg/SVGRenderSupport.cpp:
  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::writeSVGPaintingResource):
(WebCore::writeSVGFillPaintingResource):
(WebCore::writeSVGStrokePaintingResource):
(WebCore::writeStyle):
(WebCore::writeSVGGraphicsElement):
(WebCore::operator<<):
(WebCore::write):

  • rendering/svg/SVGRenderTreeAsText.h:
  • svg/SVGAnimateMotionElement.cpp:
  • svg/SVGGeometryElement.cpp:

(WebCore::SVGGeometryElement::getTotalLength const):
(WebCore::SVGGeometryElement::getPointAtLength const):
(WebCore::SVGGeometryElement::isPointInFill):
(WebCore::SVGGeometryElement::isPointInStroke):

  • svg/SVGLineElement.cpp:
Location:
trunk/Source/WebCore
Files:
3 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r287829 r287832  
     12022-01-10  Nikolas Zimmermann  <nzimmermann@igalia.com>
     2
     3        [LBSE] Begin layer-aware RenderSVGShape implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=234954
     5
     6        Reviewed by Rob Buis.
     7
     8        Begin implementing RenderSVGShape, based on the downstream version in the
     9        LBSE branch. Many parts are 1:1 copies from LegacyRenderSVGShape, although
     10        the core methods for layout / paint / hit-testing looks quite different in
     11        RenderSVGShape -- the code is mostly adapted from layer-aware CSS renderers
     12        such as RenderBox / RenderBlock taking SVG specifics into account.
     13
     14        This patch hooks in RenderSVGShape in all places that used to handle
     15        LegacyRenderSVGShape, e.g. in AccessibilityRenderObject. However no
     16        renderer inherits from RenderSVGShape yet -- a follow-up patch will
     17        introduce RenderSVGRect.
     18
     19        Covered by existing tests, no change in behaviour.
     20
     21        * Sources.txt:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * accessibility/AccessibilityRenderObject.cpp:
     24        (WebCore::AccessibilityRenderObject::supportsPath const):
     25        (WebCore::AccessibilityRenderObject::elementPath const):
     26        * rendering/RenderTreeAsText.cpp:
     27        (WebCore::write):
     28        * rendering/svg/RenderSVGResource.cpp:
     29        (WebCore::RenderSVGResource::fillAndStrokePathOrShape const):
     30        * rendering/svg/RenderSVGResource.h:
     31        (WebCore::RenderSVGResource::postApplyResource):
     32        * rendering/svg/RenderSVGResourceFilter.cpp:
     33        (WebCore::RenderSVGResourceFilter::postApplyResource):
     34        * rendering/svg/RenderSVGResourceFilter.h:
     35        * rendering/svg/RenderSVGResourceGradient.cpp:
     36        (WebCore::RenderSVGResourceGradient::postApplyResource):
     37        * rendering/svg/RenderSVGResourceGradient.h:
     38        * rendering/svg/RenderSVGResourcePattern.cpp:
     39        (WebCore::RenderSVGResourcePattern::postApplyResource):
     40        * rendering/svg/RenderSVGResourcePattern.h:
     41        * rendering/svg/RenderSVGResourceSolidColor.cpp:
     42        (WebCore::RenderSVGResourceSolidColor::postApplyResource):
     43        * rendering/svg/RenderSVGResourceSolidColor.h:
     44        * rendering/svg/RenderSVGShape.cpp: Added.
     45        (WebCore::RenderSVGShape::RenderSVGShape):
     46        (WebCore::RenderSVGShape::updateShapeFromElement):
     47        (WebCore::RenderSVGShape::isEmpty const):
     48        (WebCore::RenderSVGShape::fillShape const):
     49        (WebCore::RenderSVGShape::strokeShape const):
     50        (WebCore::RenderSVGShape::shapeDependentStrokeContains):
     51        (WebCore::RenderSVGShape::shapeDependentFillContains const):
     52        (WebCore::RenderSVGShape::fillContains):
     53        (WebCore::RenderSVGShape::strokeContains):
     54        (WebCore::RenderSVGShape::layout):
     55        (WebCore::RenderSVGShape::nonScalingStrokePath const):
     56        (WebCore::RenderSVGShape::setupNonScalingStrokeContext):
     57        (WebCore::RenderSVGShape::nonScalingStrokeTransform const):
     58        (WebCore::RenderSVGShape::shouldGenerateMarkerPositions const):
     59        (WebCore::RenderSVGShape::fillShape):
     60        (WebCore::RenderSVGShape::strokeShape):
     61        (WebCore::RenderSVGShape::fillStrokeMarkers):
     62        (WebCore::RenderSVGShape::paint):
     63        (WebCore::RenderSVGShape::isPointInFill):
     64        (WebCore::RenderSVGShape::isPointInStroke):
     65        (WebCore::RenderSVGShape::getTotalLength const):
     66        (WebCore::RenderSVGShape::getPointAtLength const):
     67        (WebCore::RenderSVGShape::nodeAtPoint):
     68        (WebCore::markerForType):
     69        (WebCore::RenderSVGShape::computeMarkerBoundingBox const):
     70        (WebCore::RenderSVGShape::calculateObjectBoundingBox const):
     71        (WebCore::RenderSVGShape::calculateStrokeBoundingBox const):
     72        (WebCore::RenderSVGShape::strokeWidth const):
     73        (WebCore::RenderSVGShape::hasSmoothStroke const):
     74        (WebCore::RenderSVGShape::drawMarkers):
     75        (WebCore::RenderSVGShape::createPath const):
     76        (WebCore::RenderSVGShape::processMarkerPositions):
     77        (WebCore::RenderSVGShape::styleWillChange):
     78        * rendering/svg/RenderSVGShape.h: Added.
     79        (WebCore::RenderSVGShape::setNeedsShapeUpdate):
     80        (WebCore::RenderSVGShape::hasPath const):
     81        (WebCore::RenderSVGShape::path const):
     82        (WebCore::RenderSVGShape::clearPath):
     83        (WebCore::RenderSVGShape::hasNonScalingStroke const):
     84        * rendering/svg/RenderSVGShapeInlines.h: Added.
     85        (WebCore::RenderSVGShape::graphicsElement const):
     86        * rendering/svg/SVGRenderSupport.cpp:
     87        * rendering/svg/SVGRenderTreeAsText.cpp:
     88        (WebCore::writeSVGPaintingResource):
     89        (WebCore::writeSVGFillPaintingResource):
     90        (WebCore::writeSVGStrokePaintingResource):
     91        (WebCore::writeStyle):
     92        (WebCore::writeSVGGraphicsElement):
     93        (WebCore::operator<<):
     94        (WebCore::write):
     95        * rendering/svg/SVGRenderTreeAsText.h:
     96        * svg/SVGAnimateMotionElement.cpp:
     97        * svg/SVGGeometryElement.cpp:
     98        (WebCore::SVGGeometryElement::getTotalLength const):
     99        (WebCore::SVGGeometryElement::getPointAtLength const):
     100        (WebCore::SVGGeometryElement::isPointInFill):
     101        (WebCore::SVGGeometryElement::isPointInStroke):
     102        * svg/SVGLineElement.cpp:
     103
    11042022-01-09  Sam Weinig  <weinig@apple.com>
    2105
  • trunk/Source/WebCore/Sources.txt

    r287743 r287832  
    24952495rendering/svg/RenderSVGResourceSolidColor.cpp
    24962496rendering/svg/RenderSVGRoot.cpp
     2497rendering/svg/RenderSVGShape.cpp
    24972498rendering/svg/RenderSVGTSpan.cpp
    24982499rendering/svg/RenderSVGText.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r287782 r287832  
    32743274                A10BB5851484E3A700B2E87A /* LegacyRenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* LegacyRenderSVGRect.h */; };
    32753275                A10BB58B1484E3B300B2E87A /* LegacyRenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* LegacyRenderSVGShape.h */; };
     3276                A10BB58B1484E3B300C3F77B /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300C3F77B /* RenderSVGShape.h */; };
    32763277                A10DBF4718F92317000D70C6 /* LegacyPreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DBF4618F92317000D70C6 /* LegacyPreviewLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
    32773278                A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    46334634                CDF747F5270F83B1008FEEEC /* RenderSVGGradientStopInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747F4270F83B1008FEEEC /* RenderSVGGradientStopInlines.h */; };
    46344635                CDF747F7270F86A4008FEEEC /* LegacyRenderSVGShapeInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747F6270F86A4008FEEEC /* LegacyRenderSVGShapeInlines.h */; };
     4636                CDF747F7270F83B4107DEEEC /* RenderSVGShapeInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747F6270F83B4107DEEEC /* RenderSVGShapeInlines.h */; };
    46354637                CDF747F9270F87CB008FEEEC /* RenderSVGResourceRadialGradientInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747F8270F87CB008FEEEC /* RenderSVGResourceRadialGradientInlines.h */; };
    46364638                CDF747FB270F891A008FEEEC /* RenderSVGResourceMaskerInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF747FA270F891A008FEEEC /* RenderSVGResourceMaskerInlines.h */; };
     
    1338013382                A10BB5831484E3A700B2E87A /* LegacyRenderSVGRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyRenderSVGRect.h; sourceTree = "<group>"; };
    1338113383                A10BB5881484E3B300B2E87A /* LegacyRenderSVGShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyRenderSVGShape.cpp; sourceTree = "<group>"; };
     13384                A10CC5881473E3B300B2A8BF /* RenderSVGShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGShape.cpp; sourceTree = "<group>"; };
    1338213385                A10BB5891484E3B300B2E87A /* LegacyRenderSVGShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyRenderSVGShape.h; sourceTree = "<group>"; };
     13386                A10BB5891484E3B300C3F77B /* RenderSVGShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGShape.h; sourceTree = "<group>"; };
    1338313387                A10D6E942144C99800FDD14D /* JSPaymentResponseCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSPaymentResponseCustom.cpp; sourceTree = "<group>"; };
    1338413388                A10DBF4618F92317000D70C6 /* LegacyPreviewLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyPreviewLoaderClient.h; sourceTree = "<group>"; };
     
    1628116285                CDF747F4270F83B1008FEEEC /* RenderSVGGradientStopInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGGradientStopInlines.h; sourceTree = "<group>"; };
    1628216286                CDF747F6270F86A4008FEEEC /* LegacyRenderSVGShapeInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LegacyRenderSVGShapeInlines.h; sourceTree = "<group>"; };
     16287                CDF747F6270F83B4107DEEEC /* RenderSVGShapeInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGShapeInlines.h; sourceTree = "<group>"; };
    1628316288                CDF747F8270F87CB008FEEEC /* RenderSVGResourceRadialGradientInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceRadialGradientInlines.h; sourceTree = "<group>"; };
    1628416289                CDF747FA270F891A008FEEEC /* RenderSVGResourceMaskerInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceMaskerInlines.h; sourceTree = "<group>"; };
     
    1897318978                                436708A512D9CA5C00044234 /* RenderSVGRoot.cpp */,
    1897418979                                436708A612D9DB4B00044234 /* RenderSVGRoot.h */,
     18980                                A10CC5881473E3B300B2A8BF /* RenderSVGShape.cpp */,
     18981                                A10BB5891484E3B300C3F77B /* RenderSVGShape.h */,
     18982                                CDF747F6270F83B4107DEEEC /* RenderSVGShapeInlines.h */,
    1897518983                                0854B0061255E4E600B9CDD0 /* RenderSVGText.cpp */,
    1897618984                                0854B0071255E4E600B9CDD0 /* RenderSVGText.h */,
     
    3675136759                                436708E312D9CA4B00044234 /* RenderSVGResourceSolidColor.h in Headers */,
    3675236760                                436708E512D9DB4B00044234 /* RenderSVGRoot.h in Headers */,
     36761                                A10BB58B1484E3B300C3F77B /* RenderSVGShape.h in Headers */,
     36762                                CDF747F7270F83B4107DEEEC /* RenderSVGShapeInlines.h in Headers */,
    3675336763                                0854B0191255E4E600B9CDD0 /* RenderSVGText.h in Headers */,
    3675436764                                0854B01B1255E4E600B9CDD0 /* RenderSVGTextPath.h in Headers */,
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r287677 r287832  
    9797#include "RenderMenuList.h"
    9898#include "RenderSVGRoot.h"
     99#include "RenderSVGShape.h"
    99100#include "RenderTableCell.h"
    100101#include "RenderText.h"
     
    911912bool AccessibilityRenderObject::supportsPath() const
    912913{
    913     return is<RenderText>(renderer()) || is<LegacyRenderSVGShape>(renderer());
     914    return is<RenderText>(renderer()) || (renderer() && renderer()->isSVGShapeOrLegacySVGShape());
    914915}
    915916
     
    961962            LayoutPoint parentOffset = axObjectCache()->getOrCreate(&*svgRoot)->elementRect().location();
    962963            path.transform(AffineTransform().translate(parentOffset.x(), parentOffset.y()));
     964        }
     965
     966        return path;
     967    }
     968
    963969#if ENABLE(LAYER_BASED_SVG_ENGINE)
    964         } else if (auto svgRoot = ancestorsOfType<RenderSVGRoot>(*m_renderer).first()) {
     970    if (is<RenderSVGShape>(renderer()) && downcast<RenderSVGShape>(*m_renderer).hasPath()) {
     971        Path path = downcast<RenderSVGShape>(*m_renderer).path();
     972
     973        // The SVG path is in terms of the parent's bounding box. The path needs to be offset to frame coordinates.
     974        if (auto svgRoot = ancestorsOfType<RenderSVGRoot>(*m_renderer).first()) {
    965975            LayoutPoint parentOffset = axObjectCache()->getOrCreate(&*svgRoot)->elementRect().location();
    966976            path.transform(AffineTransform().translate(parentOffset.x(), parentOffset.y()));
     977        }
     978
     979        return path;
     980    }
    967981#endif
    968         }
    969 
    970         return path;
    971     }
    972982
    973983    return Path();
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r287677 r287832  
    4040#include "LegacyInlineTextBox.h"
    4141#include "LegacyRenderSVGRoot.h"
     42#include "LegacyRenderSVGShape.h"
    4243#include "Logging.h"
    4344#include "PrintContext.h"
     
    6566#include "RenderSVGResourceContainer.h"
    6667#include "RenderSVGRoot.h"
     68#include "RenderSVGShape.h"
    6769#include "RenderSVGText.h"
    6870#include "RenderTableCell.h"
     
    559561    };
    560562
     563#if ENABLE(LAYER_BASED_SVG_ENGINE)
     564    if (is<RenderSVGShape>(o)) {
     565        write(ts, downcast<RenderSVGShape>(o), behavior);
     566        return;
     567    }
     568#endif
    561569    if (is<LegacyRenderSVGShape>(o)) {
    562570        write(ts, downcast<LegacyRenderSVGShape>(o), behavior);
  • trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp

    r287076 r287832  
    2727#include "FrameView.h"
    2828#include "LegacyRenderSVGRoot.h"
     29#include "LegacyRenderSVGShape.h"
    2930#include "RenderSVGResourceClipper.h"
    3031#include "RenderSVGResourceFilter.h"
     
    3233#include "RenderSVGResourceSolidColor.h"
    3334#include "RenderSVGRoot.h"
     35#include "RenderSVGShape.h"
    3436#include "RenderView.h"
    3537#include "SVGResourceElementClient.h"
     
    244246}
    245247
    246 }
     248void RenderSVGResource::fillAndStrokePathOrShape(GraphicsContext& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderElement* shape) const
     249{
     250    if (shape) {
     251        ASSERT(shape->isSVGShapeOrLegacySVGShape());
     252
     253        if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
     254            if (is<LegacyRenderSVGShape>(shape))
     255                downcast<LegacyRenderSVGShape>(shape)->fillShape(context);
     256#if ENABLE(LAYER_BASED_SVG_ENGINE)
     257            else if (is<RenderSVGShape>(shape))
     258                downcast<RenderSVGShape>(shape)->fillShape(context);
     259#endif
     260        }
     261
     262        if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
     263            if (is<LegacyRenderSVGShape>(shape))
     264                downcast<LegacyRenderSVGShape>(shape)->strokeShape(context);
     265#if ENABLE(LAYER_BASED_SVG_ENGINE)
     266            else if (is<RenderSVGShape>(shape))
     267                downcast<RenderSVGShape>(shape)->strokeShape(context);
     268#endif
     269        }
     270
     271        return;
     272    }
     273
     274    if (!path)
     275        return;
     276
     277    if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill))
     278        context.fillPath(*path);
     279    if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke))
     280        context.strokePath(*path);
     281}
     282
     283}
  • trunk/Source/WebCore/rendering/svg/RenderSVGResource.h

    r287677 r287832  
    2020#pragma once
    2121
    22 #include "LegacyRenderSVGShape.h"
    2322#include "RenderStyleConstants.h"
     23#include <wtf/OptionSet.h>
    2424#include <wtf/TypeCasts.h>
    2525
     
    4848class GraphicsContext;
    4949class Path;
     50class RenderElement;
    5051class RenderObject;
     52class RenderSVGResourceSolidColor;
    5153class RenderStyle;
    52 class RenderSVGResourceSolidColor;
    5354
    5455class RenderSVGResource {
     
    6162
    6263    virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) = 0;
    63     virtual void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const LegacyRenderSVGShape*) { }
     64    virtual void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement* /* shape */) { }
    6465    virtual FloatRect resourceBoundingBox(const RenderObject&) = 0;
    6566
     
    7273
    7374    static void markForLayoutAndParentResourceInvalidation(RenderObject&, bool needsLayout = true);
     75
     76protected:
     77    void fillAndStrokePathOrShape(GraphicsContext&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement* shape) const;
    7478};
    7579
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp

    r287829 r287832  
    173173}
    174174
    175 void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path*, const LegacyRenderSVGShape*)
     175void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path*, const RenderElement*)
    176176{
    177177    ASSERT(context);
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h

    r287782 r287832  
    7070
    7171    bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
    72     void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const LegacyRenderSVGShape*) override;
     72    void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement*) override;
    7373
    7474    FloatRect resourceBoundingBox(const RenderObject&) override;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp

    r287677 r287832  
    180180}
    181181
    182 void RenderSVGResourceGradient::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const LegacyRenderSVGShape* shape)
     182void RenderSVGResourceGradient::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderElement* shape)
    183183{
    184184    ASSERT(context);
     
    208208        UNUSED_PARAM(renderer);
    209209#endif
    210     } else {
    211         if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
    212             if (path)
    213                 context->fillPath(*path);
    214             else if (shape)
    215                 shape->fillShape(*context);
    216         }
    217         if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
    218             if (path)
    219                 context->strokePath(*path);
    220             else if (shape)
    221                 shape->strokeShape(*context);
    222         }
    223     }
     210    } else
     211        fillAndStrokePathOrShape(*context, resourceMode, path, shape);
    224212
    225213    context->restore();
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h

    r287677 r287832  
    4141
    4242    bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) final;
    43     void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const LegacyRenderSVGShape*) final;
     43    void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement*) final;
    4444    FloatRect resourceBoundingBox(const RenderObject&) final { return FloatRect(); }
    4545
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp

    r287677 r287832  
    202202}
    203203
    204 void RenderSVGResourcePattern::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const LegacyRenderSVGShape* shape)
     204void RenderSVGResourcePattern::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderElement* shape)
    205205{
    206206    ASSERT(context);
    207207    ASSERT(!resourceMode.isEmpty());
    208 
    209     if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
    210         if (path)
    211             context->fillPath(*path);
    212         else if (shape)
    213             shape->fillShape(*context);
    214     }
    215     if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
    216         if (path)
    217             context->strokePath(*path);
    218         else if (shape)
    219             shape->strokeShape(*context);
    220     }
    221 
     208    fillAndStrokePathOrShape(*context, resourceMode, path, shape);
    222209    context->restore();
    223210}
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h

    r287677 r287832  
    4949
    5050    bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
    51     void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const LegacyRenderSVGShape*) override;
     51    void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement*) override;
    5252    FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); }
    5353
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp

    r287677 r287832  
    2424#include "FrameView.h"
    2525#include "GraphicsContext.h"
     26#include "RenderElement.h"
    2627#include "RenderStyle.h"
    2728#include "RenderView.h"
     29#include "SVGRenderSupport.h"
    2830
    2931namespace WebCore {
     
    6870}
    6971
    70 void RenderSVGResourceSolidColor::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const LegacyRenderSVGShape* shape)
     72void RenderSVGResourceSolidColor::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderElement* shape)
    7173{
    7274    ASSERT(context);
    7375    ASSERT(!resourceMode.isEmpty());
    74 
    75     if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
    76         if (path)
    77             context->fillPath(*path);
    78         else if (shape)
    79             shape->fillShape(*context);
    80     }
    81     if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
    82         if (path)
    83             context->strokePath(*path);
    84         else if (shape)
    85             shape->strokeShape(*context);
    86     }
     76    fillAndStrokePathOrShape(*context, resourceMode, path, shape);
    8777}
    8878
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h

    r287677 r287832  
    2121
    2222#include "Color.h"
     23#include "FloatRect.h"
    2324#include "RenderSVGResource.h"
    2425
    2526namespace WebCore {
     27
     28class RenderObject;
    2629
    2730class RenderSVGResourceSolidColor final : public RenderSVGResource {
     
    3538
    3639    bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
    37     void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const LegacyRenderSVGShape*) override;
     40    void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderElement*) override;
    3841    FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); }
    3942
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r287731 r287832  
    3030#include "ElementAncestorIterator.h"
    3131#include "LegacyRenderSVGRoot.h"
     32#include "LegacyRenderSVGShape.h"
    3233#include "NodeRenderStyle.h"
    3334#include "RenderChildIterator.h"
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r287677 r287832  
    5050#include "RenderSVGResourceSolidColor.h"
    5151#include "RenderSVGRoot.h"
     52#include "RenderSVGShapeInlines.h"
    5253#include "RenderSVGText.h"
    5354#include "SVGCircleElement.h"
     
    152153}
    153154
    154 static void writeSVGPaintingResource(TextStream& ts, RenderSVGResource* resource)
    155 {
    156     if (resource->resourceType() == SolidColorResourceType) {
    157         ts << "[type=SOLID] [color=" << static_cast<RenderSVGResourceSolidColor*>(resource)->color() << "]";
     155static void writeSVGPaintingResource(TextStream& ts, const RenderSVGResource& resource)
     156{
     157    auto resourceType = resource.resourceType();
     158    if (resourceType == SolidColorResourceType) {
     159        ts << "[type=SOLID] [color=" << downcast<RenderSVGResourceSolidColor>(resource).color() << "]";
    158160        return;
    159161    }
    160162
     163    if (resourceType == PatternResourceType)
     164        ts << "[type=PATTERN]";
     165    else if (resourceType == LinearGradientResourceType)
     166        ts << "[type=LINEAR-GRADIENT]";
     167    else if (resourceType == RadialGradientResourceType)
     168        ts << "[type=RADIAL-GRADIENT]";
     169
    161170    // All other resources derive from RenderSVGResourceContainer
    162     RenderSVGResourceContainer* container = static_cast<RenderSVGResourceContainer*>(resource);
    163     SVGElement& element = container->element();
    164 
    165     if (resource->resourceType() == PatternResourceType)
    166         ts << "[type=PATTERN]";
    167     else if (resource->resourceType() == LinearGradientResourceType)
    168         ts << "[type=LINEAR-GRADIENT]";
    169     else if (resource->resourceType() == RadialGradientResourceType)
    170         ts << "[type=RADIAL-GRADIENT]";
    171 
    172     ts << " [id=\"" << element.getIdAttribute() << "\"]";
     171    const auto& container = static_cast<const RenderSVGResourceContainer&>(resource);
     172    ts << " [id=\"" << container.element().getIdAttribute() << "\"]";
     173}
     174
     175static void writeSVGFillPaintingResource(TextStream& ts, const RenderElement& renderer, const RenderSVGResource& fillPaintingResource)
     176{
     177    TextStreamSeparator s(" ");
     178    ts << " [fill={" << s;
     179    writeSVGPaintingResource(ts, fillPaintingResource);
     180
     181    const auto& svgStyle = renderer.style().svgStyle();
     182    writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f);
     183    writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), WindRule::NonZero);
     184    ts << "}]";
     185}
     186
     187static void writeSVGStrokePaintingResource(TextStream& ts, const RenderElement& renderer, const RenderSVGResource& strokePaintingResource, const SVGGraphicsElement& shape)
     188{
     189    TextStreamSeparator s(" ");
     190    ts << " [stroke={" << s;
     191    writeSVGPaintingResource(ts, strokePaintingResource);
     192
     193    const auto& style = renderer.style();
     194    const auto& svgStyle = style.svgStyle();
     195
     196    SVGLengthContext lengthContext(&shape);
     197    double dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset());
     198    double strokeWidth = lengthContext.valueForLength(style.strokeWidth());
     199    const auto& dashes = svgStyle.strokeDashArray();
     200
     201    DashArray dashArray;
     202    for (auto& length : dashes)
     203        dashArray.append(length.value(lengthContext));
     204
     205    writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
     206    writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
     207    writeIfNotDefault(ts, "miter limit", style.strokeMiterLimit(), 4.0f);
     208    writeIfNotDefault(ts, "line cap", style.capStyle(), LineCap::Butt);
     209    writeIfNotDefault(ts, "line join", style.joinStyle(), LineJoin::Miter);
     210    writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
     211    if (!dashArray.isEmpty())
     212        writeNameValuePair(ts, "dash array", dashArray);
     213
     214    if (is<SVGGeometryElement>(shape)) {
     215        double pathLength = downcast<SVGGeometryElement>(shape).pathLength();
     216        writeIfNotDefault(ts, "path length", pathLength, 0.0);
     217    }
     218
     219    ts << "}]";
    173220}
    174221
     
    182229    writeIfNotDefault(ts, "image rendering", style.imageRendering(), RenderStyle::initialImageRendering());
    183230    writeIfNotDefault(ts, "opacity", style.opacity(), RenderStyle::initialOpacity());
     231
    184232    if (is<LegacyRenderSVGShape>(renderer)) {
    185233        const auto& shape = downcast<LegacyRenderSVGShape>(renderer);
    186234
    187235        Color fallbackColor;
    188         if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<LegacyRenderSVGShape&>(shape), shape.style(), fallbackColor)) {
    189             TextStreamSeparator s(" ");
    190             ts << " [stroke={" << s;
    191             writeSVGPaintingResource(ts, strokePaintingResource);
    192 
    193             SVGLengthContext lengthContext(&shape.graphicsElement());
    194             double dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset());
    195             double strokeWidth = lengthContext.valueForLength(style.strokeWidth());
    196             const auto& dashes = svgStyle.strokeDashArray();
    197 
    198             DashArray dashArray;
    199             for (auto& length : dashes)
    200                 dashArray.append(length.value(lengthContext));
    201 
    202             writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
    203             writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
    204             writeIfNotDefault(ts, "miter limit", style.strokeMiterLimit(), 4.0f);
    205             writeIfNotDefault(ts, "line cap", style.capStyle(), LineCap::Butt);
    206             writeIfNotDefault(ts, "line join", style.joinStyle(), LineJoin::Miter);
    207             writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
    208             if (!dashArray.isEmpty())
    209                 writeNameValuePair(ts, "dash array", dashArray);
    210 
    211             if (is<SVGGeometryElement>(shape.graphicsElement())) {
    212                 double pathLength = downcast<SVGGeometryElement>(shape.graphicsElement()).pathLength();
    213                 writeIfNotDefault(ts, "path length", pathLength, 0.0);
    214             }
    215 
    216             ts << "}]";
    217         }
    218 
    219         if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<LegacyRenderSVGShape&>(shape), shape.style(), fallbackColor)) {
    220             TextStreamSeparator s(" ");
    221             ts << " [fill={" << s;
    222             writeSVGPaintingResource(ts, fillPaintingResource);
    223 
    224             writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f);
    225             writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), WindRule::NonZero);
    226             ts << "}]";
    227         }
     236        if (auto* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<LegacyRenderSVGShape&>(shape), shape.style(), fallbackColor))
     237            writeSVGStrokePaintingResource(ts, renderer, *strokePaintingResource, shape.graphicsElement());
     238
     239        if (auto* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<LegacyRenderSVGShape&>(shape), shape.style(), fallbackColor))
     240            writeSVGFillPaintingResource(ts, renderer, *fillPaintingResource);
     241
    228242        writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), WindRule::NonZero);
    229243    }
     244
     245#if ENABLE(LAYER_BASED_SVG_ENGINE)
     246    else if (is<LegacyRenderSVGShape>(renderer)) {
     247        const auto& shape = downcast<RenderSVGShape>(renderer);
     248
     249        Color fallbackColor;
     250        if (auto* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor))
     251            writeSVGStrokePaintingResource(ts, renderer, *strokePaintingResource, shape.graphicsElement());
     252
     253        if (auto* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor))
     254            writeSVGFillPaintingResource(ts, renderer, *fillPaintingResource);
     255
     256        writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), WindRule::NonZero);
     257    }
     258#endif
    230259
    231260    writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource());
     
    251280}
    252281
    253 static TextStream& operator<<(TextStream& ts, const LegacyRenderSVGShape& shape)
    254 {
    255     writePositionAndStyle(ts, shape);
    256 
    257     SVGGraphicsElement& svgElement = shape.graphicsElement();
     282static void writeSVGGraphicsElement(TextStream& ts, SVGGraphicsElement& svgElement)
     283{
    258284    SVGLengthContext lengthContext(&svgElement);
    259285
     
    292318    } else
    293319        ASSERT_NOT_REACHED();
    294     return ts;
    295 }
     320}
     321
     322static TextStream& operator<<(TextStream& ts, const LegacyRenderSVGShape& shape)
     323{
     324    writePositionAndStyle(ts, shape);
     325    writeSVGGraphicsElement(ts, shape.graphicsElement());
     326    return ts;
     327}
     328
     329#if ENABLE(LAYER_BASED_SVG_ENGINE)
     330static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape)
     331{
     332    writePositionAndStyle(ts, shape);
     333    writeSVGGraphicsElement(ts, shape.graphicsElement());
     334    return ts;
     335}
     336#endif
    296337
    297338static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text)
     
    552593}
    553594
     595#if ENABLE(LAYER_BASED_SVG_ENGINE)
     596void write(TextStream& ts, const RenderSVGShape& shape, OptionSet<RenderAsTextFlag> behavior)
     597{
     598    writeStandardPrefix(ts, shape, behavior);
     599    ts << shape << "\n";
     600    writeResources(ts, shape, behavior);
     601}
     602#endif
     603
    554604void write(TextStream& ts, const LegacyRenderSVGShape& shape, OptionSet<RenderAsTextFlag> behavior)
    555605{
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h

    r287677 r287832  
    4646class RenderSVGResourceContainer;
    4747class RenderSVGRoot;
     48class RenderSVGShape;
    4849class RenderSVGText;
    4950class SVGUnitTypes;
     
    5152// functions used by the main RenderTreeAsText code
    5253void write(WTF::TextStream&, const LegacyRenderSVGRoot&, OptionSet<RenderAsTextFlag>);
     54void write(WTF::TextStream&, const LegacyRenderSVGShape&, OptionSet<RenderAsTextFlag>);
    5355#if ENABLE(LAYER_BASED_SVG_ENGINE)
    5456void write(WTF::TextStream&, const RenderSVGRoot&, OptionSet<RenderAsTextFlag>);
     57void write(WTF::TextStream&, const RenderSVGShape&, OptionSet<RenderAsTextFlag>);
    5558#endif
    56 void write(WTF::TextStream&, const LegacyRenderSVGShape&, OptionSet<RenderAsTextFlag>);
    5759void writeSVGGradientStop(WTF::TextStream&, const RenderSVGGradientStop&, OptionSet<RenderAsTextFlag>);
    5860void writeSVGResourceContainer(WTF::TextStream&, const RenderSVGResourceContainer&, OptionSet<RenderAsTextFlag>);
  • trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp

    r287731 r287832  
    2626#include "ElementIterator.h"
    2727#include "PathTraversalState.h"
     28#include "RenderElement.h"
    2829#include "RenderSVGResource.h"
    2930#include "SVGElementTypeHelpers.h"
  • trunk/Source/WebCore/svg/SVGGeometryElement.cpp

    r287677 r287832  
    2727#include "LegacyRenderSVGShape.h"
    2828#include "RenderSVGResource.h"
     29#include "RenderSVGShape.h"
    2930#include "SVGDocumentExtensions.h"
    3031#include "SVGPathUtilities.h"
     
    4950    document().updateLayoutIgnorePendingStylesheets();
    5051
    51     auto* renderer = downcast<LegacyRenderSVGShape>(this->renderer());
     52    auto* renderer = this->renderer();
    5253    if (!renderer)
    5354        return 0;
    5455
    55     return renderer->getTotalLength();
     56    if (is<LegacyRenderSVGShape>(renderer))
     57        return downcast<LegacyRenderSVGShape>(renderer)->getTotalLength();
     58
     59#if ENABLE(LAYER_BASED_SVG_ENGINE)
     60    if (is<RenderSVGShape>(renderer))
     61        return downcast<RenderSVGShape>(renderer)->getTotalLength();
     62#endif
     63
     64    ASSERT_NOT_REACHED();
     65    return 0;
    5666}
    5767
     
    6070    document().updateLayoutIgnorePendingStylesheets();
    6171
    62     auto* renderer = downcast<LegacyRenderSVGShape>(this->renderer());
    63    
     72    auto* renderer = this->renderer();
     73
    6474    // Spec: If current element is a non-rendered element, throw an InvalidStateError.
    6575    if (!renderer)
    6676        return Exception { InvalidStateError };
    67    
     77
    6878    // Spec: Clamp distance to [0, length].
    6979    distance = clampTo<float>(distance, 0, getTotalLength());
    7080
    7181    // Spec: Return a newly created, detached SVGPoint object.
    72     return SVGPoint::create(renderer->getPointAtLength(distance));
     82    if (is<LegacyRenderSVGShape>(renderer))
     83        return SVGPoint::create(downcast<LegacyRenderSVGShape>(renderer)->getPointAtLength(distance));
     84
     85#if ENABLE(LAYER_BASED_SVG_ENGINE)
     86    if (is<RenderSVGShape>(renderer))
     87        return SVGPoint::create(downcast<RenderSVGShape>(renderer)->getPointAtLength(distance));
     88#endif
     89
     90    ASSERT_NOT_REACHED();
     91    return Exception { InvalidStateError };
    7392}
    7493
     
    7796    document().updateLayoutIgnorePendingStylesheets();
    7897
    79     auto* renderer = downcast<LegacyRenderSVGShape>(this->renderer());
     98    auto* renderer = this->renderer();
    8099    if (!renderer)
    81100        return false;
    82101
    83102    FloatPoint point {static_cast<float>(pointInit.x), static_cast<float>(pointInit.y)};
    84     return renderer->isPointInFill(point);
     103    if (is<LegacyRenderSVGShape>(renderer))
     104        return downcast<LegacyRenderSVGShape>(renderer)->isPointInFill(point);
     105
     106#if ENABLE(LAYER_BASED_SVG_ENGINE)
     107    if (is<RenderSVGShape>(renderer))
     108        return downcast<RenderSVGShape>(renderer)->isPointInFill(point);
     109#endif
     110
     111    ASSERT_NOT_REACHED();
     112    return false;
    85113}
    86114
     
    89117    document().updateLayoutIgnorePendingStylesheets();
    90118
    91     auto* renderer = downcast<LegacyRenderSVGShape>(this->renderer());
     119    auto* renderer = this->renderer();
    92120    if (!renderer)
    93121        return false;
    94122
    95123    FloatPoint point {static_cast<float>(pointInit.x), static_cast<float>(pointInit.y)};
    96     return renderer->isPointInStroke(point);
     124    if (is<LegacyRenderSVGShape>(renderer))
     125        return downcast<LegacyRenderSVGShape>(renderer)->isPointInStroke(point);
     126
     127#if ENABLE(LAYER_BASED_SVG_ENGINE)
     128    if (is<RenderSVGShape>(renderer))
     129        return downcast<RenderSVGShape>(renderer)->isPointInStroke(point);
     130#endif
     131
     132    ASSERT_NOT_REACHED();
     133    return false;
    97134}
    98135
  • trunk/Source/WebCore/svg/SVGLineElement.cpp

    r287677 r287832  
    2323#include "SVGLineElement.h"
    2424
     25#include "LegacyRenderSVGShape.h"
    2526#include "RenderSVGResource.h"
    2627#include "SVGLengthValue.h"
Note: See TracChangeset for help on using the changeset viewer.