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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1553 // static | 1553 // static |
1554 WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) { | 1554 WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) { |
1555 WebDocument web_document = web_node.GetDocument(); | 1555 WebDocument web_document = web_node.GetDocument(); |
1556 const Document* doc = web_document.ConstUnwrap<Document>(); | 1556 const Document* doc = web_document.ConstUnwrap<Document>(); |
1557 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(doc->ExistingAXObjectCache()); | 1557 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(doc->ExistingAXObjectCache()); |
1558 const Node* node = web_node.ConstUnwrap<Node>(); | 1558 const Node* node = web_node.ConstUnwrap<Node>(); |
1559 return cache ? WebAXObject(cache->Get(node)) : WebAXObject(); | 1559 return cache ? WebAXObject(cache->Get(node)) : WebAXObject(); |
1560 } | 1560 } |
1561 | 1561 |
1562 // static | 1562 // static |
1563 WebAXObject WebAXObject::FromWebView(WebView& web_view) { | |
1564 auto main_frame = web_view.MainFrame(); | |
1565 if (!main_frame) | |
1566 return WebAXObject(); | |
1567 | |
1568 Document* document = main_frame->GetDocument(); | |
1569 return WebAXObject(ToAXObjectCacheImpl(document->AxObjectCache())->Root()); | |
1570 } | |
Łukasz Anforowicz
2017/06/15 20:15:59
This is now inlined into content/shell/test_runner
| |
1571 | |
1572 // static | |
1573 WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) { | 1563 WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) { |
1574 const Document* document = web_document.ConstUnwrap<Document>(); | 1564 const Document* document = web_document.ConstUnwrap<Document>(); |
1575 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); | 1565 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); |
1576 return cache ? WebAXObject(cache->GetOrCreate( | 1566 return cache ? WebAXObject(cache->GetOrCreate( |
1577 ToLayoutView(LayoutAPIShim::LayoutObjectFrom( | 1567 ToLayoutView(LayoutAPIShim::LayoutObjectFrom( |
1578 document->GetLayoutViewItem())))) | 1568 document->GetLayoutViewItem())))) |
1579 : WebAXObject(); | 1569 : WebAXObject(); |
1580 } | 1570 } |
1581 | 1571 |
1582 // static | 1572 // static |
1583 WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document, | 1573 WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document, |
1584 int ax_id) { | 1574 int ax_id) { |
1585 const Document* document = web_document.ConstUnwrap<Document>(); | 1575 const Document* document = web_document.ConstUnwrap<Document>(); |
1586 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); | 1576 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); |
1587 return cache ? WebAXObject(cache->ObjectFromAXID(ax_id)) : WebAXObject(); | 1577 return cache ? WebAXObject(cache->ObjectFromAXID(ax_id)) : WebAXObject(); |
1588 } | 1578 } |
1589 | 1579 |
1590 // static | 1580 // static |
1591 WebAXObject WebAXObject::FromWebDocumentFocused( | 1581 WebAXObject WebAXObject::FromWebDocumentFocused( |
1592 const WebDocument& web_document) { | 1582 const WebDocument& web_document) { |
1593 const Document* document = web_document.ConstUnwrap<Document>(); | 1583 const Document* document = web_document.ConstUnwrap<Document>(); |
1594 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); | 1584 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); |
1595 return cache ? WebAXObject(cache->FocusedObject()) : WebAXObject(); | 1585 return cache ? WebAXObject(cache->FocusedObject()) : WebAXObject(); |
1596 } | 1586 } |
1597 | 1587 |
1598 } // namespace blink | 1588 } // namespace blink |
OLD | NEW |