Changeset 122550 in webkit
- Timestamp:
- Jul 13, 2012 1:06:58 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r122549 r122550 1 2012-07-13 Dominic Mazzoni <dmazzoni@google.com> 2 3 Should be possible to focus elements within canvas fallback content 4 https://bugs.webkit.org/show_bug.cgi?id=87898 5 6 Reviewed by Chris Fleizach. 7 8 * fast/canvas/fallback-content-expected.txt: Added. 9 * fast/canvas/fallback-content.html: Added. 10 1 11 2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r122547 r122550 1 2012-07-13 Dominic Mazzoni <dmazzoni@google.com> 2 3 Should be possible to focus elements within canvas fallback content 4 https://bugs.webkit.org/show_bug.cgi?id=87898 5 6 Reviewed by Chris Fleizach. 7 8 Patches isFocusable in dom/Node.cpp and html/HTMLFormControlElement.cpp 9 to make elements focusable if they're a descendent of a canvas element 10 if they would otherwise have been focusable but just didn't have 11 a renderer. Adds a bit to ElementRareData to efficiently keep track 12 of elements in a canvas subtree. 13 14 Test: fast/canvas/fallback-content.html 15 16 * dom/Element.cpp: 17 (WebCore::Element::attach): 18 (WebCore::Element::detach): 19 (WebCore::Element::setIsInCanvasSubtree): 20 (WebCore): 21 (WebCore::Element::isInCanvasSubtree): 22 * dom/Element.h: 23 (Element): 24 * dom/ElementRareData.h: 25 (ElementRareData): 26 (WebCore::ElementRareData::ElementRareData): 27 * dom/Node.cpp: 28 (WebCore::Node::isFocusable): 29 * html/HTMLCanvasElement.cpp: 30 (WebCore::HTMLCanvasElement::attach): 31 (WebCore): 32 * html/HTMLCanvasElement.h: 33 (HTMLCanvasElement): 34 * html/HTMLFormControlElement.cpp: 35 (WebCore::HTMLFormControlElement::isFocusable): 36 1 37 2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 38 -
trunk/Source/WebCore/dom/Element.cpp
r122450 r122550 939 939 StyleResolverParentPusher parentPusher(this); 940 940 941 if (parentElement() && parentElement()->isInCanvasSubtree()) 942 setIsInCanvasSubtree(true); 943 941 944 // When a shadow root exists, it does the work of attaching the children. 942 945 if (ElementShadow* shadow = this->shadow()) { … … 977 980 unregisterNamedFlowContentNode(); 978 981 cancelFocusAppearanceUpdate(); 979 if (hasRareData()) 982 if (hasRareData()) { 983 setIsInCanvasSubtree(false); 980 984 elementRareData()->resetComputedStyle(); 985 } 981 986 982 987 if (ElementShadow* shadow = this->shadow()) { … … 1671 1676 } 1672 1677 1678 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) 1679 { 1680 ElementRareData* data = ensureElementRareData(); 1681 data->m_isInCanvasSubtree = isInCanvasSubtree; 1682 } 1683 1684 bool Element::isInCanvasSubtree() const 1685 { 1686 return hasRareData() && elementRareData()->m_isInCanvasSubtree; 1687 } 1688 1673 1689 AtomicString Element::computeInheritedLanguage() const 1674 1690 { -
trunk/Source/WebCore/dom/Element.h
r122530 r122550 284 284 bool styleAffectedByEmpty() const; 285 285 286 void setIsInCanvasSubtree(bool); 287 bool isInCanvasSubtree() const; 288 286 289 AtomicString computeInheritedLanguage() const; 287 290 -
trunk/Source/WebCore/dom/ElementRareData.h
r122115 r122550 77 77 OwnPtr<NamedNodeMap> m_attributeMap; 78 78 79 bool m_styleAffectedByEmpty; 79 bool m_styleAffectedByEmpty : 1; 80 bool m_isInCanvasSubtree : 1; 80 81 81 82 IntSize m_savedLayerScrollOffset; … … 95 96 , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) 96 97 , m_styleAffectedByEmpty(false) 98 , m_isInCanvasSubtree(false) 97 99 #if ENABLE(FULLSCREEN_API) 98 100 , m_containsFullScreenElement(false) -
trunk/Source/WebCore/dom/Node.cpp
r122498 r122550 919 919 // the whole document is actually up to date. 920 920 ASSERT(!document()->childNeedsStyleRecalc()); 921 921 922 // Elements in canvas fallback content are not rendered, but they are allowed to be 923 // focusable as long as their canvas is displayed and visible. 924 if (isElementNode() && toElement(this)->isInCanvasSubtree()) { 925 const Element* e = toElement(this); 926 while (e && !e->hasLocalName(canvasTag)) 927 e = e->parentElement(); 928 ASSERT(e); 929 return e->renderer() && e->renderer()->style()->visibility() == VISIBLE; 930 } 931 922 932 // FIXME: Even if we are not visible, we might have a child that is visible. 923 933 // Hyatt wants to fix that some day with a "has visible content" flag or the like. -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r121381 r122550 136 136 } 137 137 138 void HTMLCanvasElement::attach() 139 { 140 setIsInCanvasSubtree(true); 141 HTMLElement::attach(); 142 } 143 138 144 void HTMLCanvasElement::addObserver(CanvasObserver* observer) 139 145 { -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r117195 r122550 143 143 virtual void parseAttribute(const Attribute&) OVERRIDE; 144 144 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 145 virtual void attach(); 145 146 146 147 void reset(); -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r122082 r122550 313 313 bool HTMLFormControlElement::isFocusable() const 314 314 { 315 if (!renderer() || !renderer()->isBox() || toRenderBox(renderer())->size().isEmpty()) 315 // If there's a renderer, make sure the size isn't empty, but if there's no renderer, 316 // it might still be focusable if it's in a canvas subtree (handled in Node::isFocusable). 317 if (renderer() && (!renderer()->isBox() || toRenderBox(renderer())->size().isEmpty())) 316 318 return false; 317 319 // HTMLElement::isFocusable handles visibility and calls suportsFocus which
Note: See TracChangeset
for help on using the changeset viewer.