| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) | 74 WebScopedAXContext::WebScopedAXContext(WebDocument& rootDocument) |
| 75 : m_private(adoptRef(new ScopedAXObjectCache(*rootDocument.unwrap<Document>(
)))) | 75 : m_private(adoptPtr(new ScopedAXObjectCache(*rootDocument.unwrap<Document>(
)))) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 WebScopedAXContext::~WebScopedAXContext() | |
| 80 { | |
| 81 m_private.reset(); | |
| 82 } | |
| 83 | |
| 84 WebAXObject WebScopedAXContext::root() const | 79 WebAXObject WebScopedAXContext::root() const |
| 85 { | 80 { |
| 86 return WebAXObject(static_cast<AXObjectCacheImpl*>(m_private->get())->root()
); | 81 return WebAXObject(static_cast<AXObjectCacheImpl*>(m_private->get())->root()
); |
| 87 } | 82 } |
| 88 | 83 |
| 89 void WebAXObject::reset() | 84 void WebAXObject::reset() |
| 90 { | 85 { |
| 91 m_private.reset(); | 86 m_private.reset(); |
| 92 } | 87 } |
| 93 | 88 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 677 |
| 683 // FIXME: This method passes in a point that has page scale applied but assumes
that (0, 0) | 678 // FIXME: This method passes in a point that has page scale applied but assumes
that (0, 0) |
| 684 // is the top left of the visual viewport. In other words, the point has the Pin
chViewport | 679 // is the top left of the visual viewport. In other words, the point has the Pin
chViewport |
| 685 // scale applied, but not the PinchViewport offset. crbug.com/459591. | 680 // scale applied, but not the PinchViewport offset. crbug.com/459591. |
| 686 WebAXObject WebAXObject::hitTest(const WebPoint& point) const | 681 WebAXObject WebAXObject::hitTest(const WebPoint& point) const |
| 687 { | 682 { |
| 688 if (isDetached()) | 683 if (isDetached()) |
| 689 return WebAXObject(); | 684 return WebAXObject(); |
| 690 | 685 |
| 691 IntPoint contentsPoint = m_private->documentFrameView()->soonToBeRemovedUnsc
aledViewportToContents(point); | 686 IntPoint contentsPoint = m_private->documentFrameView()->soonToBeRemovedUnsc
aledViewportToContents(point); |
| 692 RefPtr<AXObject> hit = m_private->accessibilityHitTest(contentsPoint); | 687 RefPtrWillBeRawPtr<AXObject> hit = m_private->accessibilityHitTest(contentsP
oint); |
| 693 | 688 |
| 694 if (hit) | 689 if (hit) |
| 695 return WebAXObject(hit); | 690 return WebAXObject(hit); |
| 696 | 691 |
| 697 if (m_private->elementRect().contains(contentsPoint)) | 692 if (m_private->elementRect().contains(contentsPoint)) |
| 698 return *this; | 693 return *this; |
| 699 | 694 |
| 700 return WebAXObject(); | 695 return WebAXObject(); |
| 701 } | 696 } |
| 702 | 697 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 { | 972 { |
| 978 return deprecatedTitleUIElement(); | 973 return deprecatedTitleUIElement(); |
| 979 } | 974 } |
| 980 | 975 |
| 981 WebString WebAXObject::name(WebAXNameFrom& outNameFrom, WebVector<WebAXObject>&
outNameObjects) | 976 WebString WebAXObject::name(WebAXNameFrom& outNameFrom, WebVector<WebAXObject>&
outNameObjects) |
| 982 { | 977 { |
| 983 if (isDetached()) | 978 if (isDetached()) |
| 984 return WebString(); | 979 return WebString(); |
| 985 | 980 |
| 986 AXNameFrom nameFrom = AXNameFromAttribute; | 981 AXNameFrom nameFrom = AXNameFromAttribute; |
| 987 Vector<AXObject*> nameObjects; | 982 WillBeHeapVector<RawPtrWillBeMember<AXObject>> nameObjects; |
| 988 WebString result = m_private->name(nameFrom, nameObjects); | 983 WebString result = m_private->name(nameFrom, nameObjects); |
| 989 outNameFrom = static_cast<WebAXNameFrom>(nameFrom); | 984 outNameFrom = static_cast<WebAXNameFrom>(nameFrom); |
| 990 | 985 |
| 991 WebVector<WebAXObject> webNameObjects(nameObjects.size()); | 986 WebVector<WebAXObject> webNameObjects(nameObjects.size()); |
| 992 for (size_t i = 0; i < nameObjects.size(); i++) | 987 for (size_t i = 0; i < nameObjects.size(); i++) |
| 993 webNameObjects[i] = WebAXObject(nameObjects[i]); | 988 webNameObjects[i] = WebAXObject(nameObjects[i]); |
| 994 outNameObjects.swap(webNameObjects); | 989 outNameObjects.swap(webNameObjects); |
| 995 | 990 |
| 996 return result; | 991 return result; |
| 997 } | 992 } |
| 998 | 993 |
| 999 WebString WebAXObject::description(WebAXNameFrom nameFrom, WebAXDescriptionFrom&
outDescriptionFrom, WebVector<WebAXObject>& outDescriptionObjects) | 994 WebString WebAXObject::description(WebAXNameFrom nameFrom, WebAXDescriptionFrom&
outDescriptionFrom, WebVector<WebAXObject>& outDescriptionObjects) |
| 1000 { | 995 { |
| 1001 if (isDetached()) | 996 if (isDetached()) |
| 1002 return WebString(); | 997 return WebString(); |
| 1003 | 998 |
| 1004 AXDescriptionFrom descriptionFrom; | 999 AXDescriptionFrom descriptionFrom; |
| 1005 Vector<AXObject*> descriptionObjects; | 1000 WillBeHeapVector<RawPtrWillBeMember<AXObject>> descriptionObjects; |
| 1006 String result = m_private->description(static_cast<AXNameFrom>(nameFrom), de
scriptionFrom, descriptionObjects); | 1001 String result = m_private->description(static_cast<AXNameFrom>(nameFrom), de
scriptionFrom, descriptionObjects); |
| 1007 outDescriptionFrom = static_cast<WebAXDescriptionFrom>(descriptionFrom); | 1002 outDescriptionFrom = static_cast<WebAXDescriptionFrom>(descriptionFrom); |
| 1008 | 1003 |
| 1009 WebVector<WebAXObject> webDescriptionObjects(descriptionObjects.size()); | 1004 WebVector<WebAXObject> webDescriptionObjects(descriptionObjects.size()); |
| 1010 for (size_t i = 0; i < descriptionObjects.size(); i++) | 1005 for (size_t i = 0; i < descriptionObjects.size(); i++) |
| 1011 webDescriptionObjects[i] = WebAXObject(descriptionObjects[i]); | 1006 webDescriptionObjects[i] = WebAXObject(descriptionObjects[i]); |
| 1012 outDescriptionObjects.swap(webDescriptionObjects); | 1007 outDescriptionObjects.swap(webDescriptionObjects); |
| 1013 | 1008 |
| 1014 return result; | 1009 return result; |
| 1015 } | 1010 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 if (!isDetached()) | 1429 if (!isDetached()) |
| 1435 m_private->scrollToMakeVisibleWithSubFocus(subfocus); | 1430 m_private->scrollToMakeVisibleWithSubFocus(subfocus); |
| 1436 } | 1431 } |
| 1437 | 1432 |
| 1438 void WebAXObject::scrollToGlobalPoint(const WebPoint& point) const | 1433 void WebAXObject::scrollToGlobalPoint(const WebPoint& point) const |
| 1439 { | 1434 { |
| 1440 if (!isDetached()) | 1435 if (!isDetached()) |
| 1441 m_private->scrollToGlobalPoint(point); | 1436 m_private->scrollToGlobalPoint(point); |
| 1442 } | 1437 } |
| 1443 | 1438 |
| 1444 WebAXObject::WebAXObject(const WTF::PassRefPtr<AXObject>& object) | 1439 WebAXObject::WebAXObject(const PassRefPtrWillBeRawPtr<AXObject>& object) |
| 1445 : m_private(object) | 1440 : m_private(object) |
| 1446 { | 1441 { |
| 1447 } | 1442 } |
| 1448 | 1443 |
| 1449 WebAXObject& WebAXObject::operator=(const WTF::PassRefPtr<AXObject>& object) | 1444 WebAXObject& WebAXObject::operator=(const PassRefPtrWillBeRawPtr<AXObject>& obje
ct) |
| 1450 { | 1445 { |
| 1451 m_private = object; | 1446 m_private = object; |
| 1452 return *this; | 1447 return *this; |
| 1453 } | 1448 } |
| 1454 | 1449 |
| 1455 WebAXObject::operator WTF::PassRefPtr<AXObject>() const | 1450 WebAXObject::operator PassRefPtrWillBeRawPtr<AXObject>() const |
| 1456 { | 1451 { |
| 1457 return m_private.get(); | 1452 return m_private.get(); |
| 1458 } | 1453 } |
| 1459 | 1454 |
| 1460 } // namespace blink | 1455 } // namespace blink |
| OLD | NEW |