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

Changeset 286542 in webkit


Ignore:
Timestamp:
Dec 6, 2021, 6:28:26 AM (5 years ago)
Author:
Nikolas Zimmermann
Message:

[LBSE] Add RenderObject::isSVGRootOrLegacySVGRoot() helper
https://bugs.webkit.org/show_bug.cgi?id=233870

Reviewed by Rob Buis.

Preparations to begin a new RenderSVGRoot implementation for the
layer-based SVG engine (LBSE).

Add a helper function to identify either legacy SVG or LBSE root
render objects (LegacyRenderSVGRoot and the upcoming RenderSVGRoot).

Covered by existing tests, no change in behavior.

  • accessibility/AXObjectCache.cpp:

(WebCore::createFromRenderer):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::boundingBoxRect const):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):

  • dom/Element.cpp:

(WebCore::Element::boundingAbsoluteRectWithoutLayout):

  • inspector/InspectorOverlay.cpp:

(WebCore::buildRendererHighlight):

  • layout/integration/LayoutIntegrationCoverage.cpp:

(WebCore::LayoutIntegration::canUseForChild):

  • rendering/RenderGeometryMap.cpp:

(WebCore::canMapBetweenRenderersViaLayers):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::beginTransparencyLayers):
(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderLayer.h:

(WebCore::RenderLayer::canUseOffsetFromAncestor const):

  • rendering/RenderObject.cpp:

(WebCore::objectIsRelayoutBoundary):

  • rendering/RenderObject.h:

(WebCore::RenderObject::isLegacySVGRoot const):
(WebCore::RenderObject::isSVGRootOrLegacySVGRoot const):

  • rendering/RenderReplaced.cpp:

(WebCore::hasIntrinsicSize):

  • rendering/RenderView.cpp:

(WebCore::RenderView::layout):

  • rendering/svg/LegacyRenderSVGRoot.h:
  • rendering/svg/SVGRenderSupport.cpp:

(WebCore::layoutSizeOfNearestViewportChanged):

  • rendering/svg/SVGRenderingContext.cpp:

(WebCore::SVGRenderingContext::prepareToRenderSVGContent):
(WebCore::SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem):

  • rendering/updating/RenderTreeBuilder.cpp:

(WebCore::RenderTreeBuilder::reportVisuallyNonEmptyContent):

Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286541 r286542  
     12021-12-06  Nikolas Zimmermann  <nzimmermann@igalia.com>
     2
     3        [LBSE] Add RenderObject::isSVGRootOrLegacySVGRoot() helper
     4        https://bugs.webkit.org/show_bug.cgi?id=233870
     5
     6        Reviewed by Rob Buis.
     7
     8        Preparations to begin a new RenderSVGRoot implementation for the
     9        layer-based SVG engine (LBSE).
     10
     11        Add a helper function to identify either legacy SVG or LBSE root
     12        render objects (LegacyRenderSVGRoot and the upcoming RenderSVGRoot).
     13
     14        Covered by existing tests, no change in behavior.
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::createFromRenderer):
     18        * accessibility/AccessibilityRenderObject.cpp:
     19        (WebCore::AccessibilityRenderObject::boundingBoxRect const):
     20        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
     21        * dom/Element.cpp:
     22        (WebCore::Element::boundingAbsoluteRectWithoutLayout):
     23        * inspector/InspectorOverlay.cpp:
     24        (WebCore::buildRendererHighlight):
     25        * layout/integration/LayoutIntegrationCoverage.cpp:
     26        (WebCore::LayoutIntegration::canUseForChild):
     27        * rendering/RenderGeometryMap.cpp:
     28        (WebCore::canMapBetweenRenderersViaLayers):
     29        * rendering/RenderLayer.cpp:
     30        (WebCore::RenderLayer::beginTransparencyLayers):
     31        (WebCore::RenderLayer::calculateClipRects const):
     32        * rendering/RenderLayer.h:
     33        (WebCore::RenderLayer::canUseOffsetFromAncestor const):
     34        * rendering/RenderObject.cpp:
     35        (WebCore::objectIsRelayoutBoundary):
     36        * rendering/RenderObject.h:
     37        (WebCore::RenderObject::isLegacySVGRoot const):
     38        (WebCore::RenderObject::isSVGRootOrLegacySVGRoot const):
     39        * rendering/RenderReplaced.cpp:
     40        (WebCore::hasIntrinsicSize):
     41        * rendering/RenderView.cpp:
     42        (WebCore::RenderView::layout):
     43        * rendering/svg/LegacyRenderSVGRoot.h:
     44        * rendering/svg/SVGRenderSupport.cpp:
     45        (WebCore::layoutSizeOfNearestViewportChanged):
     46        * rendering/svg/SVGRenderingContext.cpp:
     47        (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
     48        (WebCore::SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem):
     49        * rendering/updating/RenderTreeBuilder.cpp:
     50        (WebCore::RenderTreeBuilder::reportVisuallyNonEmptyContent):
     51
    1522021-12-06  Antti Koivisto  <antti@apple.com>
    253
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r286392 r286542  
    8888#include "HTMLTextFormControlElement.h"
    8989#include "InlineRunAndOffset.h"
    90 #include "LegacyRenderSVGRoot.h"
    9190#include "MathMLElement.h"
    9291#include "Page.h"
     
    548547#endif
    549548
    550     if (is<LegacyRenderSVGRoot>(*renderer))
     549    if (renderer->isSVGRootOrLegacySVGRoot())
    551550        return AccessibilitySVGRoot::create(renderer);
    552551   
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r286477 r286542  
    857857    bool isSVGRoot = false;
    858858
    859     if (obj->isSVGRoot())
     859    if (obj->isSVGRootOrLegacySVGRoot())
    860860        isSVGRoot = true;
    861861
     
    30123012        return AccessibilityRole::Heading;
    30133013   
    3014     if (m_renderer->isSVGRoot())
     3014    if (m_renderer->isSVGRootOrLegacySVGRoot())
    30153015        return AccessibilityRole::SVGRoot;
    30163016   
  • trunk/Source/WebCore/dom/Element.cpp

    r286425 r286542  
    17151715    RenderObject* renderer = this->renderer();
    17161716    Vector<FloatQuad> quads;
    1717     if (isSVGElement() && renderer && !renderer->isSVGRoot()) {
     1717    if (isSVGElement() && renderer && !renderer->isSVGRootOrLegacySVGRoot()) {
    17181718        // Get the bounding rectangle from the SVG model.
    17191719        SVGElement& svgElement = downcast<SVGElement>(*this);
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r286392 r286542  
    144144    FrameView* mainView = containingFrame->page()->mainFrame().view();
    145145
    146     // LegacyRenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
    147     bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
     146    // (Legacy)RenderSVGRoot should be highlighted through the isBox() code path, all other SVG elements should just dump their absoluteQuads().
     147    bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRootOrLegacySVGRoot();
    148148
    149149    if (isSVGRenderer) {
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp

    r286147 r286542  
    534534            SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons)
    535535
    536         if (replaced.isSVGRoot())
     536        if (replaced.isSVGRootOrLegacySVGRoot())
    537537            SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
    538538
  • trunk/Source/WebCore/rendering/RenderGeometryMap.cpp

    r284247 r286542  
    157157            return false;
    158158
    159         if (current->isSVGRoot())
     159        if (current->isLegacySVGRoot())
    160160            return false;
    161161
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r286441 r286542  
    22062206
    22072207#if ENABLE(CSS_COMPOSITING)
    2208         bool usesCompositeOperation = hasBlendMode() && !(renderer().isSVGRoot() && parent() && parent()->isRenderViewLayer());
     2208        bool usesCompositeOperation = hasBlendMode() && !(renderer().isLegacySVGRoot() && parent() && parent()->isRenderViewLayer());
    22092209        if (usesCompositeOperation)
    22102210            context.setCompositeOperation(context.compositeOperation(), blendMode());
     
    55425542    // Add the filter as a client to this renderer, unless we are a RenderLayer accommodating
    55435543    // an SVG. In that case it takes care of its own resource management for filters.
    5544     if (renderer().style().filter().hasReferenceFilter() && !renderer().isSVGRoot()) {
     5544    if (renderer().style().filter().hasReferenceFilter() && !renderer().isSVGRootOrLegacySVGRoot()) {
    55455545        ensureLayerFilters();
    55465546        m_filters->updateReferenceFilterClients(renderer().style().filter());
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r284684 r286542  
    601601        // FIXME: This really needs to know if there are transforms on this layer and any of the layers
    602602        // between it and the ancestor in question.
    603         return !renderer().hasTransform() && !renderer().isSVGRoot();
     603        return !renderer().hasTransform() && !renderer().isSVGRootOrLegacySVGRoot();
    604604    }
    605605
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r286392 r286542  
    509509        return true;
    510510
    511     if (object->isSVGRoot())
     511    if (object->isSVGRootOrLegacySVGRoot())
    512512        return true;
    513513
  • trunk/Source/WebCore/rendering/RenderObject.h

    r286085 r286542  
    327327    virtual bool isRenderSVGModelObject() const { return false; }
    328328    virtual bool isRenderSVGBlock() const { return false; };
     329    virtual bool isLegacySVGRoot() const { return false; }
    329330    virtual bool isSVGRoot() const { return false; }
    330331    virtual bool isSVGContainer() const { return false; }
     
    346347    virtual bool isSVGResourceClipper() const { return false; }
    347348    virtual bool isSVGResourceFilterPrimitive() const { return false; }
     349    bool isSVGRootOrLegacySVGRoot() const { return isSVGRoot() || isLegacySVGRoot(); }
    348350
    349351    // FIXME: Those belong into a SVG specific base-class for all renderers (see above)
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r286206 r286542  
    545545        return true;
    546546    if (hasIntrinsicWidth || hasIntrinsicHeight)
    547         return contentRenderer && contentRenderer->isSVGRoot();
     547        return contentRenderer && contentRenderer->isSVGRootOrLegacySVGRoot();
    548548    return false;
    549549}
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r285345 r286542  
    170170                || box.style().logicalMinHeight().isPercentOrCalculated()
    171171                || box.style().logicalMaxHeight().isPercentOrCalculated()
    172                 || box.isSVGRoot()
     172                || box.isSVGRootOrLegacySVGRoot()
    173173                )
    174174                box.setChildNeedsLayout(MarkOnlyThis);
  • trunk/Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h

    r286392 r286542  
    6767    void element() const = delete;
    6868
    69     bool isSVGRoot() const override { return true; }
     69    bool isLegacySVGRoot() const override { return true; }
    7070
    7171    // Intentially left 'RenderSVGRoot' instead of 'LegacyRenderSVGRoot', to avoid breaking layout tests.
     
    124124} // namespace WebCore
    125125
    126 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(LegacyRenderSVGRoot, isSVGRoot())
     126SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(LegacyRenderSVGRoot, isLegacySVGRoot())
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r286392 r286542  
    205205{
    206206    const RenderElement* start = &renderer;
    207     while (start && !is<LegacyRenderSVGRoot>(*start) && !is<RenderSVGViewportContainer>(*start))
     207    while (start && !start->isSVGRootOrLegacySVGRoot() && !is<RenderSVGViewportContainer>(*start))
    208208        start = start->parent();
    209209
     
    217217bool SVGRenderSupport::transformToRootChanged(RenderElement* ancestor)
    218218{
    219     while (ancestor && !is<LegacyRenderSVGRoot>(*ancestor)) {
     219    while (ancestor && !ancestor->isSVGRootOrLegacySVGRoot()) {
    220220        if (is<RenderSVGTransformableContainer>(*ancestor))
    221221            return downcast<RenderSVGTransformableContainer>(*ancestor).didTransformToRootUpdate();
  • trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp

    r286526 r286542  
    9898    bool isRenderingMask = isRenderingMaskImage(*m_renderer);
    9999    // RenderLayer takes care of root opacity.
    100     float opacity = (renderer.isSVGRoot() || isRenderingMask) ? 1 : style.opacity();
     100    float opacity = (renderer.isLegacySVGRoot() || isRenderingMask) ? 1 : style.opacity();
    101101    bool hasBlendMode = style.hasBlendMode();
    102102    bool hasIsolation = style.hasIsolation();
     
    207207    while (ancestor) {
    208208        absoluteTransform = ancestor->localToParentTransform() * absoluteTransform;
    209         if (ancestor->isSVGRoot())
     209        if (ancestor->isSVGRootOrLegacySVGRoot())
    210210            break;
    211211        ancestor = ancestor->parent();
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r286392 r286542  
    996996        return;
    997997    }
    998     if (is<LegacyRenderSVGRoot>(child)) {
     998    if (child.isSVGRootOrLegacySVGRoot()) {
    999999        auto fixedSize = [] (const auto& renderer) -> std::optional<IntSize> {
    10001000            auto& style = renderer.style();
Note: See TracChangeset for help on using the changeset viewer.