15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008 Apple Inc. All rights reserved.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met:
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer.
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer in the
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     documentation and/or other materials provided with the distribution.
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     its contributors may be used to endorse or promote products derived
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     from this software without specific prior written permission.
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef AccessibilityRenderObject_h
305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define AccessibilityRenderObject_h
315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
3253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/accessibility/AccessibilityNodeObject.h"
3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/platform/graphics/LayoutRect.h"
34e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "wtf/Forward.h"
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace WebCore {
3753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class AccessibilitySVGRoot;
395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class AXObjectCache;
405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Element;
415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Frame;
425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class FrameView;
435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HitTestResult;
445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLAnchorElement;
455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLAreaElement;
465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLElement;
475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLLabelElement;
485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLMapElement;
495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLSelectElement;
505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class IntPoint;
515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class IntSize;
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Node;
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderListBox;
545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderTextControl;
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderView;
565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class VisibleSelection;
575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Widget;
5853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class AccessibilityRenderObject : public AccessibilityNodeObject {
605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)protected:
615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    explicit AccessibilityRenderObject(RenderObject*);
625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public:
635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    static PassRefPtr<AccessibilityRenderObject> create(RenderObject*);
645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual ~AccessibilityRenderObject();
6553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
6653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Public, overridden from AccessibilityObject.
675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual RenderObject* renderer() const OVERRIDE { return m_renderer; }
685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual LayoutRect elementRect() const OVERRIDE;
6953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
7053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    void setRenderer(RenderObject*);
7153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    RenderBoxModelObject* renderBoxModelObject() const;
7253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    RenderView* topRenderer() const;
7353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    Document* topDocument() const;
7453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    HTMLLabelElement* labelElementContainer() const;
7553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    bool shouldNotifyActiveDescendant() const;
7653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    bool needsToUpdateChildren() const { return m_childrenDirty; }
7753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    ScrollableArea* getScrollableAreaIfScrollable() const;
785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityRole determineAccessibilityRole() OVERRIDE;
79521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    void checkCachedElementRect() const;
80521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    void updateCachedElementRect() const;
8153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
8253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)protected:
8381a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    RenderObject* m_renderer;
8481a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    mutable LayoutRect m_cachedElementRect;
8581a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    mutable LayoutRect m_cachedFrameRect;
8681a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    mutable IntPoint m_cachedScrollPosition;
8781a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    mutable bool m_cachedElementRectDirty;
8881a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)
8953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    //
9053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Overridden from AccessibilityObject.
9153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    //
925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void init() OVERRIDE;
945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void detach() OVERRIDE;
955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isDetached() const OVERRIDE { return !m_renderer; }
965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isAccessibilityRenderObject() const OVERRIDE { return true; }
9753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
9853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Check object role or purpose.
995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isAttachment() const OVERRIDE;
1005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isFileUploadButton() const OVERRIDE;
1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isLinked() const OVERRIDE;
1025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isLoaded() const OVERRIDE;
1035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isOffScreen() const OVERRIDE;
1045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isReadOnly() const OVERRIDE;
1055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isVisited() const OVERRIDE;
10653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
10753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Check object state.
1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isFocused() const OVERRIDE;
1095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isSelected() const OVERRIDE;
11053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
11153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Check whether certain properties can be modified.
1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool canSetValueAttribute() const OVERRIDE;
1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
11453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Whether objects are ignored, i.e. not included in the tree.
1155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObjectInclusion defaultObjectInclusion() const OVERRIDE;
1165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
11753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
11853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Properties of static elements.
1195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual const AtomicString& accessKey() const OVERRIDE;
1205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool exposesTitleUIElement() const OVERRIDE;
1215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityOrientation orientation() const OVERRIDE;
1225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String text() const OVERRIDE;
1235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual int textLength() const OVERRIDE;
1245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* titleUIElement() const OVERRIDE;
1255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual KURL url() const OVERRIDE;
12653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
12753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Properties of interactive elements.
1285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String actionVerb() const OVERRIDE;
1295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void selectedChildren(AccessibilityChildrenVector&) OVERRIDE;
1305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String stringValue() const OVERRIDE;
1315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
13253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // ARIA attributes.
1335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* activeDescendant() const OVERRIDE;
1345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void ariaFlowToElements(AccessibilityChildrenVector&) const OVERRIDE;
1355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool ariaHasPopup() const OVERRIDE;
1365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool ariaRoleHasPresentationalChildren() const OVERRIDE;
1375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isPresentationalChildOfAriaRole() const OVERRIDE;
1385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool shouldFocusActiveDescendant() const OVERRIDE;
1395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool supportsARIADragging() const OVERRIDE;
1405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool supportsARIADropping() const OVERRIDE;
1415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool supportsARIAFlowTo() const OVERRIDE;
1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool supportsARIAOwns() const OVERRIDE;
1435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
14453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // ARIA live-region features.
1455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual const AtomicString& ariaLiveRegionStatus() const OVERRIDE;
1465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual const AtomicString& ariaLiveRegionRelevant() const OVERRIDE;
1475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool ariaLiveRegionAtomic() const OVERRIDE;
1485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool ariaLiveRegionBusy() const OVERRIDE;
14953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
15053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Accessibility Text.
1515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String textUnderElement() const OVERRIDE;
15253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
15353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Accessibility Text - (To be deprecated).
1545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String helpText() const OVERRIDE;
15553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
15681a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    // Location and click point in frame-relative coordinates.
1575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void markCachedElementRectDirty() const OVERRIDE;
1585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual IntPoint clickPoint() OVERRIDE;
1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
16053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Hit testing.
1615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const OVERRIDE;
1625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const OVERRIDE;
16353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
16453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // High-level accessibility tree access. Other modules should only use these functions.
1655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* parentObject() const OVERRIDE;
1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* parentObjectIfExists() const OVERRIDE;
16753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
16853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Low-level accessibility tree exploration, only for use within the accessibility module.
1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* firstChild() const OVERRIDE;
1705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* nextSibling() const OVERRIDE;
1715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void addChildren() OVERRIDE;
1725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool canHaveChildren() const OVERRIDE;
1735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void updateChildrenIfNecessary() OVERRIDE;
1745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setNeedsToUpdateChildren() OVERRIDE { m_childrenDirty = true; }
1755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void clearChildren() OVERRIDE;
1765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual AccessibilityObject* observableObject() const OVERRIDE;
17753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
17853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Properties of the object's owning document or page.
1795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual double estimatedLoadingProgress() const OVERRIDE;
18053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
18153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // DOM and Render tree access.
1825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual Node* node() const OVERRIDE;
1835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual Document* document() const OVERRIDE;
1845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual FrameView* documentFrameView() const OVERRIDE;
1855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual Element* anchorElement() const OVERRIDE;
1865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual Widget* widgetForAttachmentView() const OVERRIDE;
1875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
18853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Selected text.
1895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual PlainTextRange selectedTextRange() const OVERRIDE;
1905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual String selectedText() const OVERRIDE;
1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
19253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Modify or take an action on an object.
1935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setFocused(bool) OVERRIDE;
1945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setSelectedTextRange(const PlainTextRange&) OVERRIDE;
1955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setValue(const String&) OVERRIDE;
1965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void scrollTo(const IntPoint&) const OVERRIDE;
19753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
19853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Notifications that this object may have changed.
1995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void handleActiveDescendantChanged() OVERRIDE;
2005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void handleAriaExpandedChanged() OVERRIDE;
20153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
20253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    // Text metrics. Most of these should be deprecated, needs major cleanup.
2035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual int index(const VisiblePosition&) const OVERRIDE;
2045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual VisiblePosition visiblePositionForIndex(int) const OVERRIDE;
2055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void lineBreaks(Vector<int>&) const OVERRIDE;
2065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
2085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isAllowedChildOfTree() const;
2095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool hasTextAlternative() const;
21053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    void ariaListboxSelectedChildren(AccessibilityChildrenVector&);
2115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    PlainTextRange ariaSelectedTextRange() const;
2125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool nodeIsTextControl(const Node*) const;
2135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isTabItemSelected() const;
2145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AccessibilityObject* internalLinkElement() const;
2155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AccessibilityObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
2165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool renderObjectIsObservable(RenderObject*) const;
2175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RenderObject* renderParentObject() const;
2185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isDescendantOfElementType(const QualifiedName& tagName) const;
2195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool isSVGImage() const;
2205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void detachRemoteSVGRoot();
2215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AccessibilitySVGRoot* remoteSVGRootElement() const;
2225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    AccessibilityObject* remoteSVGElementHitTest(const IntPoint&) const;
2235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void offsetBoundingBoxForRemoteSVGElement(LayoutRect&) const;
2245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addHiddenChildren();
2255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addTextFieldChildren();
2265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addImageMapChildren();
2275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addCanvasChildren();
2285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addAttachmentChildren();
2295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void addRemoteSVGChildren();
2305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void ariaSelectedRows(AccessibilityChildrenVector&);
2315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool elementAttributeValue(const QualifiedName&) const;
2325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool inheritsPresentationalRole() const;
23381a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    LayoutRect computeElementRect() const;
234521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    VisibleSelection selection() const;
235521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    String stringForRange(const PlainTextRange&) const;
236521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    AccessibilityObject* correspondingControlForLabelElement() const;
237521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    int indexForVisiblePosition(const VisiblePosition&) const;
2385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
2395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline AccessibilityRenderObject* toAccessibilityRenderObject(AccessibilityObject* object)
2415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
242926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isAccessibilityRenderObject());
2435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    return static_cast<AccessibilityRenderObject*>(object);
2445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
2455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline const AccessibilityRenderObject* toAccessibilityRenderObject(const AccessibilityObject* object)
2475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
248926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isAccessibilityRenderObject());
2495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    return static_cast<const AccessibilityRenderObject*>(object);
2505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
2515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)// This will catch anyone doing an unnecessary cast.
2535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)void toAccessibilityRenderObject(const AccessibilityRenderObject*);
2545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} // namespace WebCore
2565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // AccessibilityRenderObject_h
258