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

Side by Side Diff: Source/core/accessibility/AccessibilityRenderObject.cpp

Issue 18251004: Introduce isHTMLAreaElement and toHTMLAreaElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/accessibility/AXObjectCache.cpp ('k') | Source/core/html/HTMLAreaElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 1390
1391 RenderLayer* layer = toRenderBox(m_renderer)->layer(); 1391 RenderLayer* layer = toRenderBox(m_renderer)->layer();
1392 1392
1393 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); 1393 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
1394 HitTestResult hitTestResult = HitTestResult(point); 1394 HitTestResult hitTestResult = HitTestResult(point);
1395 layer->hitTest(request, hitTestResult); 1395 layer->hitTest(request, hitTestResult);
1396 if (!hitTestResult.innerNode()) 1396 if (!hitTestResult.innerNode())
1397 return 0; 1397 return 0;
1398 Node* node = hitTestResult.innerNode()->deprecatedShadowAncestorNode(); 1398 Node* node = hitTestResult.innerNode()->deprecatedShadowAncestorNode();
1399 1399
1400 if (node->hasTagName(areaTag)) 1400 if (isHTMLAreaElement(node))
1401 return accessibilityImageMapHitTest(static_cast<HTMLAreaElement*>(node), point); 1401 return accessibilityImageMapHitTest(toHTMLAreaElement(node), point);
1402 1402
1403 if (node->hasTagName(optionTag)) 1403 if (node->hasTagName(optionTag))
1404 node = toHTMLOptionElement(node)->ownerSelectElement(); 1404 node = toHTMLOptionElement(node)->ownerSelectElement();
1405 1405
1406 RenderObject* obj = node->renderer(); 1406 RenderObject* obj = node->renderer();
1407 if (!obj) 1407 if (!obj)
1408 return 0; 1408 return 0;
1409 1409
1410 AccessibilityObject* result = obj->document()->axObjectCache()->getOrCreate( obj); 1410 AccessibilityObject* result = obj->document()->axObjectCache()->getOrCreate( obj);
1411 result->updateChildrenIfNecessary(); 1411 result->updateChildrenIfNecessary();
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 RenderBoxModelObject* cssBox = renderBoxModelObject(); 2344 RenderBoxModelObject* cssBox = renderBoxModelObject();
2345 if (!cssBox || !cssBox->isRenderImage()) 2345 if (!cssBox || !cssBox->isRenderImage())
2346 return; 2346 return;
2347 2347
2348 HTMLMapElement* map = toRenderImage(cssBox)->imageMap(); 2348 HTMLMapElement* map = toRenderImage(cssBox)->imageMap();
2349 if (!map) 2349 if (!map)
2350 return; 2350 return;
2351 2351
2352 for (Element* current = ElementTraversal::firstWithin(map); current; current = ElementTraversal::next(current, map)) { 2352 for (Element* current = ElementTraversal::firstWithin(map); current; current = ElementTraversal::next(current, map)) {
2353 // add an <area> element for this child if it has a link 2353 // add an <area> element for this child if it has a link
2354 if (current->hasTagName(areaTag) && current->isLink()) { 2354 if (isHTMLAreaElement(current) && current->isLink()) {
2355 AccessibilityImageMapLink* areaObject = static_cast<AccessibilityIma geMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole)); 2355 AccessibilityImageMapLink* areaObject = static_cast<AccessibilityIma geMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
2356 areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current )); 2356 areaObject->setHTMLAreaElement(toHTMLAreaElement(current));
2357 areaObject->setHTMLMapElement(map); 2357 areaObject->setHTMLMapElement(map);
2358 areaObject->setParent(this); 2358 areaObject->setParent(this);
2359 if (!areaObject->accessibilityIsIgnored()) 2359 if (!areaObject->accessibilityIsIgnored())
2360 m_children.append(areaObject); 2360 m_children.append(areaObject);
2361 else 2361 else
2362 axObjectCache()->remove(areaObject->axObjectID()); 2362 axObjectCache()->remove(areaObject->axObjectID());
2363 } 2363 }
2364 } 2364 }
2365 } 2365 }
2366 2366
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 if (label && label->renderer()) { 2511 if (label && label->renderer()) {
2512 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2512 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2513 result.unite(labelRect); 2513 result.unite(labelRect);
2514 } 2514 }
2515 } 2515 }
2516 2516
2517 return result; 2517 return result;
2518 } 2518 }
2519 2519
2520 } // namespace WebCore 2520 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObjectCache.cpp ('k') | Source/core/html/HTMLAreaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698