Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: third_party/WebKit/Source/modules/exported/WebAXObject.cpp

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 // static 1552 // static
1553 WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) { 1553 WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) {
1554 WebDocument web_document = web_node.GetDocument(); 1554 WebDocument web_document = web_node.GetDocument();
1555 const Document* doc = web_document.ConstUnwrap<Document>(); 1555 const Document* doc = web_document.ConstUnwrap<Document>();
1556 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(doc->ExistingAXObjectCache()); 1556 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(doc->ExistingAXObjectCache());
1557 const Node* node = web_node.ConstUnwrap<Node>(); 1557 const Node* node = web_node.ConstUnwrap<Node>();
1558 return cache ? WebAXObject(cache->Get(node)) : WebAXObject(); 1558 return cache ? WebAXObject(cache->Get(node)) : WebAXObject();
1559 } 1559 }
1560 1560
1561 // static 1561 // static
1562 WebAXObject WebAXObject::FromWebView(WebView& web_view) {
1563 auto main_frame = web_view.MainFrame();
1564 if (!main_frame)
1565 return WebAXObject();
1566
1567 Document* document = main_frame->GetDocument();
1568 return WebAXObject(ToAXObjectCacheImpl(document->AxObjectCache())->Root());
1569 }
1570
1571 // static
1572 WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) { 1562 WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) {
1573 const Document* document = web_document.ConstUnwrap<Document>(); 1563 const Document* document = web_document.ConstUnwrap<Document>();
1574 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); 1564 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache());
1575 return cache ? WebAXObject(cache->GetOrCreate( 1565 return cache ? WebAXObject(cache->GetOrCreate(
1576 ToLayoutView(LayoutAPIShim::LayoutObjectFrom( 1566 ToLayoutView(LayoutAPIShim::LayoutObjectFrom(
1577 document->GetLayoutViewItem())))) 1567 document->GetLayoutViewItem()))))
1578 : WebAXObject(); 1568 : WebAXObject();
1579 } 1569 }
1580 1570
1581 // static 1571 // static
1582 WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document, 1572 WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document,
1583 int ax_id) { 1573 int ax_id) {
1584 const Document* document = web_document.ConstUnwrap<Document>(); 1574 const Document* document = web_document.ConstUnwrap<Document>();
1585 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); 1575 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache());
1586 return cache ? WebAXObject(cache->ObjectFromAXID(ax_id)) : WebAXObject(); 1576 return cache ? WebAXObject(cache->ObjectFromAXID(ax_id)) : WebAXObject();
1587 } 1577 }
1588 1578
1589 // static 1579 // static
1590 WebAXObject WebAXObject::FromWebDocumentFocused( 1580 WebAXObject WebAXObject::FromWebDocumentFocused(
1591 const WebDocument& web_document) { 1581 const WebDocument& web_document) {
1592 const Document* document = web_document.ConstUnwrap<Document>(); 1582 const Document* document = web_document.ConstUnwrap<Document>();
1593 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache()); 1583 AXObjectCacheImpl* cache = ToAXObjectCacheImpl(document->AxObjectCache());
1594 return cache ? WebAXObject(cache->FocusedObject()) : WebAXObject(); 1584 return cache ? WebAXObject(cache->FocusedObject()) : WebAXObject();
1595 } 1585 }
1596 1586
1597 } // namespace blink 1587 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698