Title: [172487] trunk/Source/WebCore
Revision
172487
Author
[email protected]
Date
2014-08-12 13:37:37 -0700 (Tue, 12 Aug 2014)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172486 => 172487)


--- trunk/Source/WebCore/ChangeLog	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/ChangeLog	2014-08-12 20:37:37 UTC (rev 172487)
@@ -1,3 +1,35 @@
+2014-08-12  Antti Koivisto  <[email protected]>
+
+        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):
+
 2014-08-11  Andy Estes  <[email protected]>
 
         [iOS] Get rid of iOS.xcconfig

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (172486 => 172487)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2014-08-12 20:37:37 UTC (rev 172487)
@@ -58,9 +58,11 @@
 #include "AccessibilityTableRow.h"
 #include "Document.h"
 #include "Editor.h"
+#include "ElementIterator.h"
 #include "FocusController.h"
 #include "Frame.h"
 #include "HTMLAreaElement.h"
+#include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLLabelElement.h"
@@ -379,8 +381,8 @@
     
     // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
     // Or if it's a hidden element, but we still want to expose it because of other ARIA attributes.
-    bool inCanvasSubtree = node->parentElement()->isInCanvasSubtree();
-    bool isHidden = !node->renderer() && isNodeAriaVisible(node);
+    bool inCanvasSubtree = lineageOfType<HTMLCanvasElement>(*node->parentElement()).first();
+    bool isHidden = isNodeAriaVisible(node);
 
     bool insideMeterElement = false;
 #if ENABLE(METER_ELEMENT)

Modified: trunk/Source/WebCore/dom/Element.cpp (172486 => 172487)


--- trunk/Source/WebCore/dom/Element.cpp	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-08-12 20:37:37 UTC (rev 172487)
@@ -434,18 +434,15 @@
     if (!inDocument() || !supportsFocus())
         return false;
 
-    // Elements in canvas fallback content are not rendered, but they are allowed to be
-    // focusable as long as their canvas is displayed and visible.
-    if (isInCanvasSubtree()) {
-        ASSERT(lineageOfType<HTMLCanvasElement>(*this).first());
-        auto& canvas = *lineageOfType<HTMLCanvasElement>(*this).first();
-        return canvas.renderer() && canvas.renderer()->style().visibility() == VISIBLE;
-    }
-
     if (!renderer()) {
         // If the node is in a display:none tree it might say it needs style recalc but
         // the whole document is actually up to date.
         ASSERT(!needsStyleRecalc() || !document().childNeedsStyleRecalc());
+
+        // Elements in canvas fallback content are not rendered, but they are allowed to be
+        // focusable as long as their canvas is displayed and visible.
+        if (auto* canvas = ancestorsOfType<HTMLCanvasElement>(*this).first())
+            return canvas->renderer() && canvas->renderer()->style().visibility() == VISIBLE;
     }
 
     // FIXME: Even if we are not visible, we might have a child that is visible.
@@ -2212,16 +2209,6 @@
     return elementRareData()->childIndex();
 }
 
-void Element::setIsInCanvasSubtree(bool isInCanvasSubtree)
-{
-    ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree);
-}
-
-bool Element::isInCanvasSubtree() const
-{
-    return hasRareData() && elementRareData()->isInCanvasSubtree();
-}
-
 void Element::setRegionOversetState(RegionOversetState state)
 {
     ensureElementRareData().setRegionOversetState(state);
@@ -2890,7 +2877,6 @@
     if (!hasRareData())
         return;
     ElementRareData* data = ""
-    data->setIsInCanvasSubtree(false);
     data->resetComputedStyle();
     data->resetDynamicRestyleObservations();
 }

Modified: trunk/Source/WebCore/dom/Element.h (172486 => 172487)


--- trunk/Source/WebCore/dom/Element.h	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/dom/Element.h	2014-08-12 20:37:37 UTC (rev 172487)
@@ -382,9 +382,6 @@
     void setChildrenAffectedByBackwardPositionalRules();
     void setChildIndex(unsigned);
 
-    void setIsInCanvasSubtree(bool);
-    bool isInCanvasSubtree() const;
-
     void setRegionOversetState(RegionOversetState);
     RegionOversetState regionOversetState() const;
 

Modified: trunk/Source/WebCore/dom/ElementRareData.h (172486 => 172487)


--- trunk/Source/WebCore/dom/ElementRareData.h	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/dom/ElementRareData.h	2014-08-12 20:37:37 UTC (rev 172487)
@@ -60,9 +60,6 @@
     bool styleAffectedByEmpty() const { return m_styleAffectedByEmpty; }
     void setStyleAffectedByEmpty(bool value) { m_styleAffectedByEmpty = value; }
 
-    bool isInCanvasSubtree() const { return m_isInCanvasSubtree; }
-    void setIsInCanvasSubtree(bool value) { m_isInCanvasSubtree = value; }
-
     RegionOversetState regionOversetState() const { return m_regionOversetState; }
     void setRegionOversetState(RegionOversetState state) { m_regionOversetState = state; }
 
@@ -124,7 +121,6 @@
     unsigned m_tabIndexWasSetExplicitly : 1;
     unsigned m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
     unsigned m_styleAffectedByEmpty : 1;
-    unsigned m_isInCanvasSubtree : 1;
 #if ENABLE(FULLSCREEN_API)
     unsigned m_containsFullScreenElement : 1;
 #endif
@@ -169,7 +165,6 @@
     , m_tabIndexWasSetExplicitly(false)
     , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
     , m_styleAffectedByEmpty(false)
-    , m_isInCanvasSubtree(false)
 #if ENABLE(FULLSCREEN_API)
     , m_containsFullScreenElement(false)
 #endif

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (172486 => 172487)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2014-08-12 20:37:37 UTC (rev 172487)
@@ -26,6 +26,7 @@
 
 #include "Attribute.h"
 #include "DNS.h"
+#include "ElementIterator.h"
 #include "EventHandler.h"
 #include "EventNames.h"
 #include "Frame.h"
@@ -33,6 +34,7 @@
 #include "FrameLoaderClient.h"
 #include "FrameLoaderTypes.h"
 #include "FrameSelection.h"
+#include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLParserIdioms.h"
 #include "KeyboardEvent.h"
@@ -142,7 +144,7 @@
     if (!document().frame()->eventHandler().tabsToLinks(event))
         return false;
 
-    if (isInCanvasSubtree())
+    if (!renderer() && ancestorsOfType<HTMLCanvasElement>(*this).first())
         return true;
 
     return hasNonEmptyBox(renderBoxModelObject());

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (172486 => 172487)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2014-08-12 20:37:37 UTC (rev 172487)
@@ -85,7 +85,6 @@
     , m_didClearImageBuffer(false)
 {
     ASSERT(hasTagName(canvasTag));
-    setHasCustomStyleResolveCallbacks();
 }
 
 PassRefPtr<HTMLCanvasElement> HTMLCanvasElement::create(Document& document)
@@ -125,11 +124,6 @@
     return HTMLElement::createElementRenderer(WTF::move(style));
 }
 
-void HTMLCanvasElement::willAttachRenderers()
-{
-    setIsInCanvasSubtree(true);
-}
-
 bool HTMLCanvasElement::canContainRangeEndPoint() const
 {
     return false;

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (172486 => 172487)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2014-08-12 20:37:37 UTC (rev 172487)
@@ -142,7 +142,6 @@
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
     virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
-    virtual void willAttachRenderers() override;
 
     virtual bool canContainRangeEndPoint() const override;
     virtual bool canStartSelection() const override;

Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (172486 => 172487)


--- trunk/Source/WebCore/style/StyleResolveTree.cpp	2014-08-12 20:29:09 UTC (rev 172486)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp	2014-08-12 20:37:37 UTC (rev 172487)
@@ -587,9 +587,6 @@
 
     createRendererIfNeeded(current, inheritedStyle, renderTreePosition, resolvedStyle);
 
-    if (current.parentElement() && current.parentElement()->isInCanvasSubtree())
-        current.setIsInCanvasSubtree(true);
-
     StyleResolverParentPusher parentPusher(&current);
 
     RenderTreePosition childRenderTreePosition(current.renderer());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to