OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebAXObject.h" | 32 #include "public/web/WebAXObject.h" |
33 | 33 |
34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
35 #include "core/css/CSSPrimitiveValueMappings.h" | 35 #include "core/css/CSSPrimitiveValueMappings.h" |
36 #include "core/dom/AXObjectCache.h" | |
37 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
38 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
39 #include "core/frame/FrameHost.h" | 38 #include "core/frame/FrameHost.h" |
40 #include "core/frame/FrameView.h" | 39 #include "core/frame/FrameView.h" |
41 #include "core/frame/PinchViewport.h" | 40 #include "core/frame/PinchViewport.h" |
42 #include "core/layout/LayoutView.h" | 41 #include "core/layout/LayoutView.h" |
43 #include "core/style/ComputedStyle.h" | 42 #include "core/style/ComputedStyle.h" |
44 #include "core/page/EventHandler.h" | 43 #include "core/page/EventHandler.h" |
45 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
46 #include "modules/accessibility/AXObject.h" | 45 #include "modules/accessibility/AXObject.h" |
| 46 #include "modules/accessibility/AXObjectCacheImpl.h" |
47 #include "modules/accessibility/AXTable.h" | 47 #include "modules/accessibility/AXTable.h" |
48 #include "modules/accessibility/AXTableCell.h" | 48 #include "modules/accessibility/AXTableCell.h" |
49 #include "modules/accessibility/AXTableColumn.h" | 49 #include "modules/accessibility/AXTableColumn.h" |
50 #include "modules/accessibility/AXTableRow.h" | 50 #include "modules/accessibility/AXTableRow.h" |
51 #include "platform/PlatformKeyboardEvent.h" | 51 #include "platform/PlatformKeyboardEvent.h" |
52 #include "public/platform/WebPoint.h" | 52 #include "public/platform/WebPoint.h" |
53 #include "public/platform/WebRect.h" | 53 #include "public/platform/WebRect.h" |
54 #include "public/platform/WebString.h" | 54 #include "public/platform/WebString.h" |
55 #include "public/platform/WebURL.h" | 55 #include "public/platform/WebURL.h" |
56 #include "public/web/WebDocument.h" | 56 #include "public/web/WebDocument.h" |
57 #include "public/web/WebNode.h" | 57 #include "public/web/WebNode.h" |
58 #include "wtf/text/StringBuilder.h" | 58 #include "wtf/text/StringBuilder.h" |
59 | 59 |
60 namespace blink { | 60 namespace blink { |
61 | 61 |
62 #if ENABLE(ASSERT) | 62 #if ENABLE(ASSERT) |
63 // It's not safe to call some WebAXObject APIs if a layout is pending. | 63 // It's not safe to call some WebAXObject APIs if a layout is pending. |
64 // Clients should call updateLayoutAndCheckValidity first. | 64 // Clients should call updateLayoutAndCheckValidity first. |
65 static bool isLayoutClean(Document* document) | 65 static bool isLayoutClean(Document* document) |
66 { | 66 { |
67 if (!document || !document->view()) | 67 if (!document || !document->view()) |
68 return false; | 68 return false; |
69 return document->lifecycle().state() >= DocumentLifecycle::LayoutClean | 69 return document->lifecycle().state() >= DocumentLifecycle::LayoutClean |
70 || (document->lifecycle().state() == DocumentLifecycle::StyleClean && !d
ocument->view()->needsLayout()); | 70 || (document->lifecycle().state() == DocumentLifecycle::StyleClean && !d
ocument->view()->needsLayout()); |
71 } | 71 } |
72 #endif | 72 #endif |
73 | 73 |
| 74 WebScopedAXContext::WebScopedAXContext(WebDocument& rootDocument) |
| 75 : m_private(adoptRef(new ScopedAXObjectCache(*rootDocument.unwrap<Document>(
)))) |
| 76 { |
| 77 } |
| 78 |
| 79 WebScopedAXContext::~WebScopedAXContext() |
| 80 { |
| 81 m_private.reset(); |
| 82 } |
| 83 |
| 84 WebAXObject WebScopedAXContext::root() const |
| 85 { |
| 86 return WebAXObject(static_cast<AXObjectCacheImpl*>(m_private->get())->root()
); |
| 87 } |
| 88 |
74 void WebAXObject::reset() | 89 void WebAXObject::reset() |
75 { | 90 { |
76 m_private.reset(); | 91 m_private.reset(); |
77 } | 92 } |
78 | 93 |
79 void WebAXObject::assign(const WebAXObject& other) | 94 void WebAXObject::assign(const WebAXObject& other) |
80 { | 95 { |
81 m_private = other.m_private; | 96 m_private = other.m_private; |
82 } | 97 } |
83 | 98 |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 m_private = object; | 1435 m_private = object; |
1421 return *this; | 1436 return *this; |
1422 } | 1437 } |
1423 | 1438 |
1424 WebAXObject::operator WTF::PassRefPtr<AXObject>() const | 1439 WebAXObject::operator WTF::PassRefPtr<AXObject>() const |
1425 { | 1440 { |
1426 return m_private.get(); | 1441 return m_private.get(); |
1427 } | 1442 } |
1428 | 1443 |
1429 } // namespace blink | 1444 } // namespace blink |
OLD | NEW |