| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/WebElement.h" | 57 #include "public/web/WebElement.h" |
| 58 #include "public/web/WebNode.h" | 58 #include "public/web/WebNode.h" |
| 59 #include "web/WebLocalFrameImpl.h" | 59 #include "web/WebLocalFrameImpl.h" |
| 60 #include "web/WebViewImpl.h" | 60 #include "web/WebViewImpl.h" |
| 61 #include "wtf/text/StringBuilder.h" | 61 #include "wtf/text/StringBuilder.h" |
| 62 | 62 |
| 63 namespace blink { | 63 namespace blink { |
| 64 | 64 |
| 65 #if ENABLE(ASSERT) | 65 #if DCHECK_IS_ON() |
| 66 // It's not safe to call some WebAXObject APIs if a layout is pending. | 66 // It's not safe to call some WebAXObject APIs if a layout is pending. |
| 67 // Clients should call updateLayoutAndCheckValidity first. | 67 // Clients should call updateLayoutAndCheckValidity first. |
| 68 static bool isLayoutClean(Document* document) | 68 static bool isLayoutClean(Document* document) |
| 69 { | 69 { |
| 70 if (!document || !document->view()) | 70 if (!document || !document->view()) |
| 71 return false; | 71 return false; |
| 72 return document->lifecycle().state() >= DocumentLifecycle::LayoutClean | 72 return document->lifecycle().state() >= DocumentLifecycle::LayoutClean |
| 73 || ((document->lifecycle().state() == DocumentLifecycle::StyleClean || d
ocument->lifecycle().state() == DocumentLifecycle::LayoutSubtreeChangeClean) | 73 || ((document->lifecycle().state() == DocumentLifecycle::StyleClean || d
ocument->lifecycle().state() == DocumentLifecycle::LayoutSubtreeChangeClean) |
| 74 && !document->view()->needsLayout()); | 74 && !document->view()->needsLayout()); |
| 75 } | 75 } |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 // from Chromium. http://crbug.com/489590 | 625 // from Chromium. http://crbug.com/489590 |
| 626 | 626 |
| 627 return false; | 627 return false; |
| 628 } | 628 } |
| 629 | 629 |
| 630 WebRect WebAXObject::boundingBoxRect() const | 630 WebRect WebAXObject::boundingBoxRect() const |
| 631 { | 631 { |
| 632 if (isDetached()) | 632 if (isDetached()) |
| 633 return WebRect(); | 633 return WebRect(); |
| 634 | 634 |
| 635 ASSERT(isLayoutClean(m_private->getDocument())); | 635 #if DCHECK_IS_ON() |
| 636 DCHECK(isLayoutClean(m_private->getDocument())); |
| 637 #endif |
| 636 | 638 |
| 637 return pixelSnappedIntRect(m_private->elementRect()); | 639 return pixelSnappedIntRect(m_private->elementRect()); |
| 638 } | 640 } |
| 639 | 641 |
| 640 WebString WebAXObject::fontFamily() const | 642 WebString WebAXObject::fontFamily() const |
| 641 { | 643 { |
| 642 if (isDetached()) | 644 if (isDetached()) |
| 643 return WebString(); | 645 return WebString(); |
| 644 | 646 |
| 645 return m_private->fontFamily(); | 647 return m_private->fontFamily(); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 { | 1435 { |
| 1434 if (isDetached()) | 1436 if (isDetached()) |
| 1435 return; | 1437 return; |
| 1436 | 1438 |
| 1437 Vector<AXObject::AXRange> wordBoundaries; | 1439 Vector<AXObject::AXRange> wordBoundaries; |
| 1438 m_private->wordBoundaries(wordBoundaries); | 1440 m_private->wordBoundaries(wordBoundaries); |
| 1439 | 1441 |
| 1440 WebVector<int> wordStartOffsets(wordBoundaries.size()); | 1442 WebVector<int> wordStartOffsets(wordBoundaries.size()); |
| 1441 WebVector<int> wordEndOffsets(wordBoundaries.size()); | 1443 WebVector<int> wordEndOffsets(wordBoundaries.size()); |
| 1442 for (size_t i = 0; i < wordBoundaries.size(); ++i) { | 1444 for (size_t i = 0; i < wordBoundaries.size(); ++i) { |
| 1443 ASSERT(wordBoundaries[i].isSimple()); | 1445 DCHECK(wordBoundaries[i].isSimple()); |
| 1444 wordStartOffsets[i] = wordBoundaries[i].anchorOffset; | 1446 wordStartOffsets[i] = wordBoundaries[i].anchorOffset; |
| 1445 wordEndOffsets[i] = wordBoundaries[i].focusOffset; | 1447 wordEndOffsets[i] = wordBoundaries[i].focusOffset; |
| 1446 } | 1448 } |
| 1447 | 1449 |
| 1448 starts.swap(wordStartOffsets); | 1450 starts.swap(wordStartOffsets); |
| 1449 ends.swap(wordEndOffsets); | 1451 ends.swap(wordEndOffsets); |
| 1450 } | 1452 } |
| 1451 | 1453 |
| 1452 bool WebAXObject::isScrollableContainer() const | 1454 bool WebAXObject::isScrollableContainer() const |
| 1453 { | 1455 { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 m_private = object; | 1527 m_private = object; |
| 1526 return *this; | 1528 return *this; |
| 1527 } | 1529 } |
| 1528 | 1530 |
| 1529 WebAXObject::operator AXObject*() const | 1531 WebAXObject::operator AXObject*() const |
| 1530 { | 1532 { |
| 1531 return m_private.get(); | 1533 return m_private.get(); |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 } // namespace blink | 1536 } // namespace blink |
| OLD | NEW |