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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 int WebAXObject::axID() const | 102 int WebAXObject::axID() const |
103 { | 103 { |
104 if (isDetached()) | 104 if (isDetached()) |
105 return -1; | 105 return -1; |
106 | 106 |
107 return m_private->axObjectID(); | 107 return m_private->axObjectID(); |
108 } | 108 } |
109 | 109 |
| 110 bool WebAXObject::updateLayoutAndCheckValidity() |
| 111 { |
| 112 if (!isDetached()) { |
| 113 Document* document = m_private->document(); |
| 114 if (!document || !document->topDocument().view()) |
| 115 return false; |
| 116 document->topDocument().view()->updateLayoutAndStyleIfNeededRecursive(); |
| 117 } |
| 118 |
| 119 // Doing a layout can cause this object to be invalid, so check again. |
| 120 return !isDetached(); |
| 121 } |
| 122 |
110 bool WebAXObject::updateBackingStoreAndCheckValidity() | 123 bool WebAXObject::updateBackingStoreAndCheckValidity() |
111 { | 124 { |
112 if (!isDetached()) | 125 return updateLayoutAndCheckValidity(); |
113 m_private->updateBackingStore(); | |
114 return !isDetached(); | |
115 } | 126 } |
116 | 127 |
117 WebString WebAXObject::accessibilityDescription() const | 128 WebString WebAXObject::accessibilityDescription() const |
118 { | 129 { |
119 if (isDetached()) | 130 if (isDetached()) |
120 return WebString(); | 131 return WebString(); |
121 | 132 |
122 return m_private->accessibilityDescription(); | 133 return m_private->accessibilityDescription(); |
123 } | 134 } |
124 | 135 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 m_private->ariaOwnsElements(owns); | 537 m_private->ariaOwnsElements(owns); |
527 | 538 |
528 WebVector<WebAXObject> result(owns.size()); | 539 WebVector<WebAXObject> result(owns.size()); |
529 for (size_t i = 0; i < owns.size(); i++) | 540 for (size_t i = 0; i < owns.size(); i++) |
530 result[i] = WebAXObject(owns[i]); | 541 result[i] = WebAXObject(owns[i]); |
531 ownsElements.swap(result); | 542 ownsElements.swap(result); |
532 | 543 |
533 return true; | 544 return true; |
534 } | 545 } |
535 | 546 |
| 547 #if ASSERT_ENABLED |
| 548 static bool isLayoutClean(Document* document) |
| 549 { |
| 550 if (!document || !document->view()) |
| 551 return false; |
| 552 return document->lifecycle().state() >= DocumentLifecycle::LayoutClean |
| 553 || (document->lifecycle().state() == DocumentLifecycle::StyleClean && !d
ocument->view()->needsLayout()); |
| 554 } |
| 555 #endif |
| 556 |
536 WebRect WebAXObject::boundingBoxRect() const | 557 WebRect WebAXObject::boundingBoxRect() const |
537 { | 558 { |
538 if (isDetached()) | 559 if (isDetached()) |
539 return WebRect(); | 560 return WebRect(); |
540 | 561 |
541 // It's not safe to call boundingBoxRect if a layout is pending. | 562 // It's not safe to call boundingBoxRect if a layout is pending. |
542 // Clients should call updateBackingStoreAndCheckValidity first. | 563 // Clients should call updateLayoutAndCheckValidity first. |
543 ASSERT(m_private->document() && m_private->document()->lifecycle().state() >
= DocumentLifecycle::LayoutClean); | 564 ASSERT(isLayoutClean(m_private->document())); |
544 | 565 |
545 return pixelSnappedIntRect(m_private->elementRect()); | 566 return pixelSnappedIntRect(m_private->elementRect()); |
546 } | 567 } |
547 | 568 |
548 bool WebAXObject::canvasHasFallbackContent() const | 569 bool WebAXObject::canvasHasFallbackContent() const |
549 { | 570 { |
550 if (isDetached()) | 571 if (isDetached()) |
551 return false; | 572 return false; |
552 | 573 |
553 return m_private->canvasHasFallbackContent(); | 574 return m_private->canvasHasFallbackContent(); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 m_private = object; | 1171 m_private = object; |
1151 return *this; | 1172 return *this; |
1152 } | 1173 } |
1153 | 1174 |
1154 WebAXObject::operator WTF::PassRefPtr<WebCore::AXObject>() const | 1175 WebAXObject::operator WTF::PassRefPtr<WebCore::AXObject>() const |
1155 { | 1176 { |
1156 return m_private.get(); | 1177 return m_private.get(); |
1157 } | 1178 } |
1158 | 1179 |
1159 } // namespace blink | 1180 } // namespace blink |
OLD | NEW |