| 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 "core/accessibility/AXScrollView.h" | 27 #include "core/accessibility/AXScrollView.h" |
| 28 | 28 |
| 29 #include "core/accessibility/AXObjectCache.h" | 29 #include "core/accessibility/AXObjectCache.h" |
| 30 #include "core/accessibility/AXScrollbar.h" | 30 #include "core/accessibility/AXScrollbar.h" |
| 31 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 33 #include "core/html/HTMLFrameOwnerElement.h" | 33 #include "core/html/HTMLFrameOwnerElement.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 AXScrollView::AXScrollView(ScrollView* view) | 37 AXScrollView::AXScrollView(FrameView* view) |
| 38 : m_scrollView(view) | 38 : m_scrollView(view) |
| 39 , m_childrenDirty(false) | 39 , m_childrenDirty(false) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 AXScrollView::~AXScrollView() | 43 AXScrollView::~AXScrollView() |
| 44 { | 44 { |
| 45 ASSERT(isDetached()); | 45 ASSERT(isDetached()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AXScrollView::detach() | 48 void AXScrollView::detach() |
| 49 { | 49 { |
| 50 AXObject::detach(); | 50 AXObject::detach(); |
| 51 m_scrollView = 0; | 51 m_scrollView = 0; |
| 52 } | 52 } |
| 53 | 53 |
| 54 PassRefPtr<AXScrollView> AXScrollView::create(ScrollView* view) | 54 PassRefPtr<AXScrollView> AXScrollView::create(FrameView* view) |
| 55 { | 55 { |
| 56 return adoptRef(new AXScrollView(view)); | 56 return adoptRef(new AXScrollView(view)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation) | 59 AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation) |
| 60 { | 60 { |
| 61 updateScrollbars(); | 61 updateScrollbars(); |
| 62 | 62 |
| 63 switch (orientation) { | 63 switch (orientation) { |
| 64 case AccessibilityOrientationVertical: | 64 case AccessibilityOrientationVertical: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 m_children.append(webArea); | 160 m_children.append(webArea); |
| 161 | 161 |
| 162 updateScrollbars(); | 162 updateScrollbars(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 AXObject* AXScrollView::webAreaObject() const | 165 AXObject* AXScrollView::webAreaObject() const |
| 166 { | 166 { |
| 167 if (!m_scrollView || !m_scrollView->isFrameView()) | 167 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 168 return 0; | 168 return 0; |
| 169 | 169 |
| 170 Document* doc = toFrameView(m_scrollView)->frame().document(); | 170 Document* doc = m_scrollView->frame().document(); |
| 171 if (!doc || !doc->renderView()) | 171 if (!doc || !doc->renderView()) |
| 172 return 0; | 172 return 0; |
| 173 | 173 |
| 174 return axObjectCache()->getOrCreate(doc); | 174 return axObjectCache()->getOrCreate(doc); |
| 175 } | 175 } |
| 176 | 176 |
| 177 AXObject* AXScrollView::accessibilityHitTest(const IntPoint& point) const | 177 AXObject* AXScrollView::accessibilityHitTest(const IntPoint& point) const |
| 178 { | 178 { |
| 179 AXObject* webArea = webAreaObject(); | 179 AXObject* webArea = webAreaObject(); |
| 180 if (!webArea) | 180 if (!webArea) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 194 return LayoutRect(); | 194 return LayoutRect(); |
| 195 | 195 |
| 196 return m_scrollView->frameRect(); | 196 return m_scrollView->frameRect(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 FrameView* AXScrollView::documentFrameView() const | 199 FrameView* AXScrollView::documentFrameView() const |
| 200 { | 200 { |
| 201 if (!m_scrollView || !m_scrollView->isFrameView()) | 201 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 202 return 0; | 202 return 0; |
| 203 | 203 |
| 204 return toFrameView(m_scrollView); | 204 return m_scrollView; |
| 205 } | 205 } |
| 206 | 206 |
| 207 AXObject* AXScrollView::parentObject() const | 207 AXObject* AXScrollView::parentObject() const |
| 208 { | 208 { |
| 209 if (!m_scrollView || !m_scrollView->isFrameView()) | 209 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 210 return 0; | 210 return 0; |
| 211 | 211 |
| 212 // FIXME: Broken for OOPI. | 212 // FIXME: Broken for OOPI. |
| 213 HTMLFrameOwnerElement* owner = toFrameView(m_scrollView)->frame().deprecated
LocalOwner(); | 213 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); |
| 214 if (owner && owner->renderer()) | 214 if (owner && owner->renderer()) |
| 215 return axObjectCache()->getOrCreate(owner); | 215 return axObjectCache()->getOrCreate(owner); |
| 216 | 216 |
| 217 return axObjectCache()->getOrCreate(toFrameView(m_scrollView)->frame().pageP
opupOwner()); | 217 return axObjectCache()->getOrCreate(m_scrollView->frame().pagePopupOwner()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 AXObject* AXScrollView::parentObjectIfExists() const | 220 AXObject* AXScrollView::parentObjectIfExists() const |
| 221 { | 221 { |
| 222 if (!m_scrollView || !m_scrollView->isFrameView()) | 222 if (!m_scrollView || !m_scrollView->isFrameView()) |
| 223 return 0; | 223 return 0; |
| 224 | 224 |
| 225 HTMLFrameOwnerElement* owner = toFrameView(m_scrollView)->frame().deprecated
LocalOwner(); | 225 HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner(); |
| 226 if (owner && owner->renderer()) | 226 if (owner && owner->renderer()) |
| 227 return axObjectCache()->get(owner); | 227 return axObjectCache()->get(owner); |
| 228 | 228 |
| 229 return axObjectCache()->get(toFrameView(m_scrollView)->frame().pagePopupOwne
r()); | 229 return axObjectCache()->get(m_scrollView->frame().pagePopupOwner()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 ScrollableArea* AXScrollView::getScrollableAreaIfScrollable() const | 232 ScrollableArea* AXScrollView::getScrollableAreaIfScrollable() const |
| 233 { | 233 { |
| 234 return m_scrollView; | 234 return m_scrollView; |
| 235 } | 235 } |
| 236 | 236 |
| 237 void AXScrollView::scrollTo(const IntPoint& point) const | 237 void AXScrollView::scrollTo(const IntPoint& point) const |
| 238 { | 238 { |
| 239 if (m_scrollView) | 239 if (m_scrollView) |
| 240 m_scrollView->setScrollPosition(point); | 240 m_scrollView->setScrollPosition(point); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |