| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "modules/accessibility/AXScrollView.h" | 27 #include "modules/accessibility/AXScrollView.h" |
| 28 | 28 |
| 29 #include "core/frame/FrameView.h" | 29 #include "core/frame/FrameView.h" |
| 30 #include "core/frame/LocalFrame.h" | 30 #include "core/frame/LocalFrame.h" |
| 31 #include "core/html/HTMLFrameOwnerElement.h" | 31 #include "core/html/HTMLFrameOwnerElement.h" |
| 32 #include "modules/accessibility/AXObjectCacheImpl.h" | 32 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 33 #include "modules/accessibility/AXScrollbar.h" | 33 #include "modules/accessibility/AXScrollbar.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 AXScrollView::AXScrollView(FrameView* view, AXObjectCacheImpl* axObjectCache) | 37 AXScrollView::AXScrollView(FrameView* view, AXObjectCacheImpl& axObjectCache) |
| 38 : AXObject(axObjectCache) | 38 : AXObject(axObjectCache) |
| 39 , m_scrollView(view) | 39 , m_scrollView(view) |
| 40 , m_childrenDirty(false) | 40 , m_childrenDirty(false) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 AXScrollView::~AXScrollView() | 44 AXScrollView::~AXScrollView() |
| 45 { | 45 { |
| 46 ASSERT(isDetached()); | 46 ASSERT(isDetached()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void AXScrollView::detach() | 49 void AXScrollView::detach() |
| 50 { | 50 { |
| 51 AXObject::detach(); | 51 AXObject::detach(); |
| 52 m_scrollView = 0; | 52 m_scrollView = 0; |
| 53 } | 53 } |
| 54 | 54 |
| 55 PassRefPtr<AXScrollView> AXScrollView::create(FrameView* view, AXObjectCacheImpl
* axObjectCache) | 55 PassRefPtr<AXScrollView> AXScrollView::create(FrameView* view, AXObjectCacheImpl
& axObjectCache) |
| 56 { | 56 { |
| 57 return adoptRef(new AXScrollView(view, axObjectCache)); | 57 return adoptRef(new AXScrollView(view, axObjectCache)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation) | 60 AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation) |
| 61 { | 61 { |
| 62 updateScrollbars(); | 62 updateScrollbars(); |
| 63 | 63 |
| 64 switch (orientation) { | 64 switch (orientation) { |
| 65 case AccessibilityOrientationVertical: | 65 case AccessibilityOrientationVertical: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 m_children[pos]->detachFromParent(); | 124 m_children[pos]->detachFromParent(); |
| 125 m_children.remove(pos); | 125 m_children.remove(pos); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 AXScrollbar* AXScrollView::addChildScrollbar(Scrollbar* scrollbar) | 129 AXScrollbar* AXScrollView::addChildScrollbar(Scrollbar* scrollbar) |
| 130 { | 130 { |
| 131 if (!scrollbar) | 131 if (!scrollbar) |
| 132 return 0; | 132 return 0; |
| 133 | 133 |
| 134 AXScrollbar* scrollBarObject = toAXScrollbar(axObjectCache()->getOrCreate(sc
rollbar)); | 134 AXScrollbar* scrollBarObject = toAXScrollbar(axObjectCache().getOrCreate(scr
ollbar)); |
| 135 scrollBarObject->setParent(this); | 135 scrollBarObject->setParent(this); |
| 136 m_children.append(scrollBarObject); | 136 m_children.append(scrollBarObject); |
| 137 return scrollBarObject; | 137 return scrollBarObject; |
| 138 } | 138 } |
| 139 | 139 |
| 140 void AXScrollView::clearChildren() | 140 void AXScrollView::clearChildren() |
| 141 { | 141 { |
| 142 AXObject::clearChildren(); | 142 AXObject::clearChildren(); |
| 143 m_verticalScrollbar = nullptr; | 143 m_verticalScrollbar = nullptr; |
| 144 m_horizontalScrollbar = nullptr; | 144 m_horizontalScrollbar = nullptr; |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool AXScrollView::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons)
const | 147 bool AXScrollView::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons)
const |
| 148 { | 148 { |
| 149 // We just want to match whatever's returned by our web area, which is a chi
ld of this | 149 // We just want to match whatever's returned by our web area, which is a chi
ld of this |
| 150 // object. Normally cached attribute values may only search up the tree. We
can't just | 150 // object. Normally cached attribute values may only search up the tree. We
can't just |
| 151 // call accessibilityIsIgnored on the web area, because the web area may sea
rch up its | 151 // call accessibilityIsIgnored on the web area, because the web area may sea
rch up its |
| 152 // ancestors and call this function recursively, and we'd loop until a stack
overflow. | 152 // ancestors and call this function recursively, and we'd loop until a stack
overflow. |
| 153 | 153 |
| 154 // Instead, we first update the cached accessibilityIsIgnored value for this
node to | 154 // Instead, we first update the cached accessibilityIsIgnored value for this
node to |
| 155 // false, call accessibilityIsIgnored on the web area, then return the mathc
ing value. | 155 // false, call accessibilityIsIgnored on the web area, then return the mathc
ing value. |
| 156 m_cachedIsIgnored = false; | 156 m_cachedIsIgnored = false; |
| 157 m_lastModificationCount = axObjectCache()->modificationCount(); | 157 m_lastModificationCount = axObjectCache().modificationCount(); |
| 158 | 158 |
| 159 AXObject* webArea = webAreaObject(); | 159 AXObject* webArea = webAreaObject(); |
| 160 if (!webArea) | 160 if (!webArea) |
| 161 return true; | 161 return true; |
| 162 | 162 |
| 163 if (!webArea->accessibilityIsIgnored()) | 163 if (!webArea->accessibilityIsIgnored()) |
| 164 return false; | 164 return false; |
| 165 | 165 |
| 166 if (ignoredReasons) | 166 if (ignoredReasons) |
| 167 return webArea->computeAccessibilityIsIgnored(ignoredReasons); | 167 return webArea->computeAccessibilityIsIgnored(ignoredReasons); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 183 | 183 |
| 184 AXObject* AXScrollView::webAreaObject() const | 184 AXObject* AXScrollView::webAreaObject() const |
| 185 { | 185 { |
| 186 if (!m_scrollView || !m_scrollView->isFrameView()) | 186 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 187 return 0; | 187 return 0; |
| 188 | 188 |
| 189 Document* doc = m_scrollView->frame().document(); | 189 Document* doc = m_scrollView->frame().document(); |
| 190 if (!doc || !doc->layoutView()) | 190 if (!doc || !doc->layoutView()) |
| 191 return 0; | 191 return 0; |
| 192 | 192 |
| 193 return axObjectCache()->getOrCreate(doc); | 193 return axObjectCache().getOrCreate(doc); |
| 194 } | 194 } |
| 195 | 195 |
| 196 AXObject* AXScrollView::accessibilityHitTest(const IntPoint& point) const | 196 AXObject* AXScrollView::accessibilityHitTest(const IntPoint& point) const |
| 197 { | 197 { |
| 198 AXObject* webArea = webAreaObject(); | 198 AXObject* webArea = webAreaObject(); |
| 199 if (!webArea) | 199 if (!webArea) |
| 200 return 0; | 200 return 0; |
| 201 | 201 |
| 202 if (m_horizontalScrollbar && m_horizontalScrollbar->elementRect().contains(p
oint)) | 202 if (m_horizontalScrollbar && m_horizontalScrollbar->elementRect().contains(p
oint)) |
| 203 return m_horizontalScrollbar.get(); | 203 return m_horizontalScrollbar.get(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 AXObject* AXScrollView::computeParent() const | 226 AXObject* AXScrollView::computeParent() const |
| 227 { | 227 { |
| 228 if (!m_scrollView || !m_scrollView->isFrameView()) | 228 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 229 return 0; | 229 return 0; |
| 230 | 230 |
| 231 // FIXME: Broken for OOPI. | 231 // FIXME: Broken for OOPI. |
| 232 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); | 232 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); |
| 233 if (owner && owner->layoutObject()) | 233 if (owner && owner->layoutObject()) |
| 234 return axObjectCache()->getOrCreate(owner); | 234 return axObjectCache().getOrCreate(owner); |
| 235 | 235 |
| 236 return axObjectCache()->getOrCreate(m_scrollView->frame().pagePopupOwner()); | 236 return axObjectCache().getOrCreate(m_scrollView->frame().pagePopupOwner()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 AXObject* AXScrollView::computeParentIfExists() const | 239 AXObject* AXScrollView::computeParentIfExists() const |
| 240 { | 240 { |
| 241 if (!m_scrollView || !m_scrollView->isFrameView()) | 241 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 242 return 0; | 242 return 0; |
| 243 | 243 |
| 244 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); | 244 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); |
| 245 if (owner && owner->layoutObject()) | 245 if (owner && owner->layoutObject()) |
| 246 return axObjectCache()->get(owner); | 246 return axObjectCache().get(owner); |
| 247 | 247 |
| 248 return axObjectCache()->get(m_scrollView->frame().pagePopupOwner()); | 248 return axObjectCache().get(m_scrollView->frame().pagePopupOwner()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 ScrollableArea* AXScrollView::getScrollableAreaIfScrollable() const | 251 ScrollableArea* AXScrollView::getScrollableAreaIfScrollable() const |
| 252 { | 252 { |
| 253 return m_scrollView; | 253 return m_scrollView; |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace blink | 256 } // namespace blink |
| OLD | NEW |