Changeset 172487 in webkit


Ignore:
Timestamp:
Aug 12, 2014 1:37:37 PM (10 years ago)
Author:
Antti Koivisto
Message:

Remove isInCanvasSubtree bit
https://bugs.webkit.org/show_bug.cgi?id=135837

Reviewed by Andreas Kling.

The logic to update this bit is in a wrong place and it is not clear it does
the right thing in all cases. Also the optimization doesn't seem necessary,
the focus code is not that hot.

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::getOrCreate):

  • dom/Element.cpp:

(WebCore::Element::isFocusable):
(WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):
(WebCore::Element::setIsInCanvasSubtree): Deleted.
(WebCore::Element::isInCanvasSubtree): Deleted.

  • dom/Element.h:
  • dom/ElementRareData.h:

(WebCore::ElementRareData::ElementRareData):
(WebCore::ElementRareData::isInCanvasSubtree): Deleted.
(WebCore::ElementRareData::setIsInCanvasSubtree): Deleted.

  • html/HTMLAnchorElement.cpp:

(WebCore::HTMLAnchorElement::isKeyboardFocusable):

  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::HTMLCanvasElement):
(WebCore::HTMLCanvasElement::willAttachRenderers): Deleted.

  • html/HTMLCanvasElement.h:
  • style/StyleResolveTree.cpp:

(WebCore::Style::attachRenderTree):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r172482 r172487  
     12014-08-12  Antti Koivisto  <antti@apple.com>
     2
     3        Remove isInCanvasSubtree bit
     4        https://bugs.webkit.org/show_bug.cgi?id=135837
     5
     6        Reviewed by Andreas Kling.
     7
     8        The logic to update this bit is in a wrong place and it is not clear it does
     9        the right thing in all cases. Also the optimization doesn't seem necessary,
     10        the focus code is not that hot.
     11
     12        * accessibility/AXObjectCache.cpp:
     13        (WebCore::AXObjectCache::getOrCreate):
     14        * dom/Element.cpp:
     15        (WebCore::Element::isFocusable):
     16        (WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):
     17        (WebCore::Element::setIsInCanvasSubtree): Deleted.
     18        (WebCore::Element::isInCanvasSubtree): Deleted.
     19        * dom/Element.h:
     20        * dom/ElementRareData.h:
     21        (WebCore::ElementRareData::ElementRareData):
     22        (WebCore::ElementRareData::isInCanvasSubtree): Deleted.
     23        (WebCore::ElementRareData::setIsInCanvasSubtree): Deleted.
     24        * html/HTMLAnchorElement.cpp:
     25        (WebCore::HTMLAnchorElement::isKeyboardFocusable):
     26        * html/HTMLCanvasElement.cpp:
     27        (WebCore::HTMLCanvasElement::HTMLCanvasElement):
     28        (WebCore::HTMLCanvasElement::willAttachRenderers): Deleted.
     29        * html/HTMLCanvasElement.h:
     30        * style/StyleResolveTree.cpp:
     31        (WebCore::Style::attachRenderTree):
     32
    1332014-08-11  Andy Estes  <aestes@apple.com>
    234
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r171477 r172487  
    5959#include "Document.h"
    6060#include "Editor.h"
     61#include "ElementIterator.h"
    6162#include "FocusController.h"
    6263#include "Frame.h"
    6364#include "HTMLAreaElement.h"
     65#include "HTMLCanvasElement.h"
    6466#include "HTMLImageElement.h"
    6567#include "HTMLInputElement.h"
     
    380382    // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
    381383    // Or if it's a hidden element, but we still want to expose it because of other ARIA attributes.
    382     bool inCanvasSubtree = node->parentElement()->isInCanvasSubtree();
    383     bool isHidden = !node->renderer() && isNodeAriaVisible(node);
     384    bool inCanvasSubtree = lineageOfType<HTMLCanvasElement>(*node->parentElement()).first();
     385    bool isHidden = isNodeAriaVisible(node);
    384386
    385387    bool insideMeterElement = false;
  • trunk/Source/WebCore/dom/Element.cpp

    r172409 r172487  
    435435        return false;
    436436
    437     // Elements in canvas fallback content are not rendered, but they are allowed to be
    438     // focusable as long as their canvas is displayed and visible.
    439     if (isInCanvasSubtree()) {
    440         ASSERT(lineageOfType<HTMLCanvasElement>(*this).first());
    441         auto& canvas = *lineageOfType<HTMLCanvasElement>(*this).first();
    442         return canvas.renderer() && canvas.renderer()->style().visibility() == VISIBLE;
    443     }
    444 
    445437    if (!renderer()) {
    446438        // If the node is in a display:none tree it might say it needs style recalc but
    447439        // the whole document is actually up to date.
    448440        ASSERT(!needsStyleRecalc() || !document().childNeedsStyleRecalc());
     441
     442        // Elements in canvas fallback content are not rendered, but they are allowed to be
     443        // focusable as long as their canvas is displayed and visible.
     444        if (auto* canvas = ancestorsOfType<HTMLCanvasElement>(*this).first())
     445            return canvas->renderer() && canvas->renderer()->style().visibility() == VISIBLE;
    449446    }
    450447
     
    22132210}
    22142211
    2215 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree)
    2216 {
    2217     ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree);
    2218 }
    2219 
    2220 bool Element::isInCanvasSubtree() const
    2221 {
    2222     return hasRareData() && elementRareData()->isInCanvasSubtree();
    2223 }
    2224 
    22252212void Element::setRegionOversetState(RegionOversetState state)
    22262213{
     
    28912878        return;
    28922879    ElementRareData* data = elementRareData();
    2893     data->setIsInCanvasSubtree(false);
    28942880    data->resetComputedStyle();
    28952881    data->resetDynamicRestyleObservations();
  • trunk/Source/WebCore/dom/Element.h

    r172409 r172487  
    383383    void setChildIndex(unsigned);
    384384
    385     void setIsInCanvasSubtree(bool);
    386     bool isInCanvasSubtree() const;
    387 
    388385    void setRegionOversetState(RegionOversetState);
    389386    RegionOversetState regionOversetState() const;
  • trunk/Source/WebCore/dom/ElementRareData.h

    r170774 r172487  
    6161    void setStyleAffectedByEmpty(bool value) { m_styleAffectedByEmpty = value; }
    6262
    63     bool isInCanvasSubtree() const { return m_isInCanvasSubtree; }
    64     void setIsInCanvasSubtree(bool value) { m_isInCanvasSubtree = value; }
    65 
    6663    RegionOversetState regionOversetState() const { return m_regionOversetState; }
    6764    void setRegionOversetState(RegionOversetState state) { m_regionOversetState = state; }
     
    125122    unsigned m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
    126123    unsigned m_styleAffectedByEmpty : 1;
    127     unsigned m_isInCanvasSubtree : 1;
    128124#if ENABLE(FULLSCREEN_API)
    129125    unsigned m_containsFullScreenElement : 1;
     
    170166    , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
    171167    , m_styleAffectedByEmpty(false)
    172     , m_isInCanvasSubtree(false)
    173168#if ENABLE(FULLSCREEN_API)
    174169    , m_containsFullScreenElement(false)
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r168313 r172487  
    2727#include "Attribute.h"
    2828#include "DNS.h"
     29#include "ElementIterator.h"
    2930#include "EventHandler.h"
    3031#include "EventNames.h"
     
    3435#include "FrameLoaderTypes.h"
    3536#include "FrameSelection.h"
     37#include "HTMLCanvasElement.h"
    3638#include "HTMLImageElement.h"
    3739#include "HTMLParserIdioms.h"
     
    143145        return false;
    144146
    145     if (isInCanvasSubtree())
     147    if (!renderer() && ancestorsOfType<HTMLCanvasElement>(*this).first())
    146148        return true;
    147149
  • trunk/Source/WebCore/html/HTMLCanvasElement.cpp

    r170774 r172487  
    8686{
    8787    ASSERT(hasTagName(canvasTag));
    88     setHasCustomStyleResolveCallbacks();
    8988}
    9089
     
    124123    m_rendererIsCanvas = false;
    125124    return HTMLElement::createElementRenderer(WTF::move(style));
    126 }
    127 
    128 void HTMLCanvasElement::willAttachRenderers()
    129 {
    130     setIsInCanvasSubtree(true);
    131125}
    132126
  • trunk/Source/WebCore/html/HTMLCanvasElement.h

    r166665 r172487  
    143143    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
    144144    virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
    145     virtual void willAttachRenderers() override;
    146145
    147146    virtual bool canContainRangeEndPoint() const override;
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r172409 r172487  
    588588    createRendererIfNeeded(current, inheritedStyle, renderTreePosition, resolvedStyle);
    589589
    590     if (current.parentElement() && current.parentElement()->isInCanvasSubtree())
    591         current.setIsInCanvasSubtree(true);
    592 
    593590    StyleResolverParentPusher parentPusher(&current);
    594591
Note: See TracChangeset for help on using the changeset viewer.