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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 742353004: Implement computedRole and computedName (behind a flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Finished pulling out ScopedAXObjectCache etc. Many fprintfs remain. Created 6 years 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "core/events/EventListener.h" 68 #include "core/events/EventListener.h"
69 #include "core/events/GestureEvent.h" 69 #include "core/events/GestureEvent.h"
70 #include "core/events/KeyboardEvent.h" 70 #include "core/events/KeyboardEvent.h"
71 #include "core/events/MouseEvent.h" 71 #include "core/events/MouseEvent.h"
72 #include "core/events/MutationEvent.h" 72 #include "core/events/MutationEvent.h"
73 #include "core/events/TextEvent.h" 73 #include "core/events/TextEvent.h"
74 #include "core/events/TouchEvent.h" 74 #include "core/events/TouchEvent.h"
75 #include "core/events/UIEvent.h" 75 #include "core/events/UIEvent.h"
76 #include "core/events/WheelEvent.h" 76 #include "core/events/WheelEvent.h"
77 #include "core/frame/EventHandlerRegistry.h" 77 #include "core/frame/EventHandlerRegistry.h"
78 #include "core/frame/FrameView.h"
78 #include "core/frame/LocalDOMWindow.h" 79 #include "core/frame/LocalDOMWindow.h"
79 #include "core/frame/LocalFrame.h" 80 #include "core/frame/LocalFrame.h"
80 #include "core/frame/Settings.h" 81 #include "core/frame/Settings.h"
81 #include "core/html/HTMLAnchorElement.h" 82 #include "core/html/HTMLAnchorElement.h"
82 #include "core/html/HTMLDialogElement.h" 83 #include "core/html/HTMLDialogElement.h"
83 #include "core/html/HTMLFrameOwnerElement.h" 84 #include "core/html/HTMLFrameOwnerElement.h"
84 #include "core/html/HTMLStyleElement.h" 85 #include "core/html/HTMLStyleElement.h"
85 #include "core/page/ContextMenuController.h" 86 #include "core/page/ContextMenuController.h"
86 #include "core/page/EventHandler.h" 87 #include "core/page/EventHandler.h"
87 #include "core/page/Page.h" 88 #include "core/page/Page.h"
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 return; 1412 return;
1412 } 1413 }
1413 case DOCUMENT_NODE: 1414 case DOCUMENT_NODE:
1414 case DOCUMENT_TYPE_NODE: 1415 case DOCUMENT_TYPE_NODE:
1415 // Do nothing. 1416 // Do nothing.
1416 return; 1417 return;
1417 } 1418 }
1418 ASSERT_NOT_REACHED(); 1419 ASSERT_NOT_REACHED();
1419 } 1420 }
1420 1421
1422 const AtomicString& Node::computedRole()
1423 {
1424 fprintf(stderr, "Node::computedRole()\n");
1425 document().topDocument().view()->updateLayoutAndStyleIfNeededRecursive();
1426 ScopedAXObjectCache cache(document());
1427 fprintf(stderr, "got ScopedAXObjectCache\n");
1428 PublicAXObject* axObj = cache->publicAXObjectForNode(this);
1429 return axObj->computedRole();
1430 }
1431
1432 const String Node::computedText()
1433 {
1434 fprintf(stderr, "Node::computedText()\n");
1435 document().topDocument().view()->updateLayoutAndStyleIfNeededRecursive();
1436 ScopedAXObjectCache cache(document());
1437 fprintf(stderr, "about to call %p->publicAXObjectForNode(%p)\n", cache.get() , this);
1438 PublicAXObject* axObj = cache->publicAXObjectForNode(this);
1439 fprintf(stderr, "about to call %p->computedText()\n", axObj);
1440 String computedText = axObj->computedText();
1441 fprintf(stderr, "got computedText: %s\n", computedText.characters8());
1442 return computedText;
1443 /*
1444 Settings* settings = this->document().settings();
1445 if (!settings)
1446 return String();
1447 settings->setAccessibilityEnabled(true);
1448
1449 fprintf(stderr, "computedText()\n");
1450 if (!document().topDocument().view())
1451 return String();
1452 AXObjectCache* cache = document().alwaysCreateAxObjectCache();
1453 AXObjectCacheImpl* cacheImpl = toAXObjectCacheImpl(cache);
1454 AXObject* axObj = cacheImpl->getOrCreate(this);
1455 if (axObj == NULL)
1456 return String();
1457 // TODO(aboxhall): figure out why this is crashing
1458 return axObj->title();
1459 */
1460 }
1461
1421 bool Node::offsetInCharacters() const 1462 bool Node::offsetInCharacters() const
1422 { 1463 {
1423 return false; 1464 return false;
1424 } 1465 }
1425 1466
1426 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT reatment treatment) const 1467 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT reatment treatment) const
1427 { 1468 {
1428 // It is not clear what should be done if |otherNode| is nullptr. 1469 // It is not clear what should be done if |otherNode| is nullptr.
1429 if (!otherNode) 1470 if (!otherNode)
1430 return DOCUMENT_POSITION_DISCONNECTED; 1471 return DOCUMENT_POSITION_DISCONNECTED;
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 node->showTreeForThis(); 2501 node->showTreeForThis();
2461 } 2502 }
2462 2503
2463 void showNodePath(const blink::Node* node) 2504 void showNodePath(const blink::Node* node)
2464 { 2505 {
2465 if (node) 2506 if (node)
2466 node->showNodePathForThis(); 2507 node->showNodePathForThis();
2467 } 2508 }
2468 2509
2469 #endif 2510 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698