| 1 | /* |
| 2 | * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 18 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include "AccessibilityObject.h" |
| 29 | |
| 30 | namespace WebCore { |
| 31 | |
| 32 | class AccessibilityScrollbar; |
| 33 | class Scrollbar; |
| 34 | class ScrollView; |
| 35 | |
| 36 | class AccessibilityScrollView final : public AccessibilityObject { |
| 37 | public: |
| 38 | static Ref<AccessibilityScrollView> create(ScrollView*); |
| 39 | AccessibilityRole roleValue() const override { return AccessibilityRole::ScrollArea; } |
| 40 | ScrollView* scrollView() const { return m_scrollView; } |
| 41 | |
| 42 | virtual ~AccessibilityScrollView(); |
| 43 | void detach(AccessibilityDetachmentType, AXObjectCache*) override; |
| 44 | |
| 45 | AccessibilityObject* webAreaObject() const; |
| 46 | |
| 47 | private: |
| 48 | explicit AccessibilityScrollView(ScrollView*); |
| 49 | |
| 50 | ScrollableArea* getScrollableAreaIfScrollable() const override; |
| 51 | void scrollTo(const IntPoint&) const override; |
| 52 | bool computeAccessibilityIsIgnored() const override; |
| 53 | bool isAccessibilityScrollView() const override { return true; } |
| 54 | bool isEnabled() const override { return true; } |
| 55 | |
| 56 | bool isAttachment() const override; |
| 57 | Widget* widgetForAttachmentView() const override; |
| 58 | |
| 59 | AccessibilityObject* scrollBar(AccessibilityOrientation) override; |
| 60 | void addChildren() override; |
| 61 | void clearChildren() override; |
| 62 | AccessibilityObjectInterface* accessibilityHitTest(const IntPoint&) const override; |
| 63 | void updateChildrenIfNecessary() override; |
| 64 | void setNeedsToUpdateChildren() override { m_childrenDirty = true; } |
| 65 | void updateScrollbars(); |
| 66 | void setFocused(bool) override; |
| 67 | bool canSetFocusAttribute() const override; |
| 68 | bool isFocused() const override; |
| 69 | |
| 70 | FrameView* documentFrameView() const override; |
| 71 | LayoutRect elementRect() const override; |
| 72 | AccessibilityObject* parentObject() const override; |
| 73 | AccessibilityObject* parentObjectIfExists() const override; |
| 74 | |
| 75 | AccessibilityObject* firstChild() const override { return webAreaObject(); } |
| 76 | AccessibilityScrollbar* addChildScrollbar(Scrollbar*); |
| 77 | void removeChildScrollbar(AccessibilityObject*); |
| 78 | |
| 79 | ScrollView* m_scrollView; |
| 80 | RefPtr<AccessibilityObject> m_horizontalScrollbar; |
| 81 | RefPtr<AccessibilityObject> m_verticalScrollbar; |
| 82 | bool m_childrenDirty; |
| 83 | }; |
| 84 | |
| 85 | } // namespace WebCore |
| 86 | |
| 87 | SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityScrollView, isAccessibilityScrollView()) |
| 88 | |