| OLD | NEW |
| 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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 return IntPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.heig
ht() / 2)); | 1493 return IntPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.heig
ht() / 2)); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 // | 1496 // |
| 1497 // Hit testing. | 1497 // Hit testing. |
| 1498 // | 1498 // |
| 1499 | 1499 |
| 1500 AXObject* AXLayoutObject::accessibilityHitTest(const IntPoint& point) const | 1500 AXObject* AXLayoutObject::accessibilityHitTest(const IntPoint& point) const |
| 1501 { | 1501 { |
| 1502 if (!m_layoutObject || !m_layoutObject->hasLayer()) | 1502 if (!m_layoutObject || !m_layoutObject->hasLayer()) |
| 1503 return 0; | 1503 return nullptr; |
| 1504 | 1504 |
| 1505 PaintLayer* layer = toLayoutBox(m_layoutObject)->layer(); | 1505 PaintLayer* layer = toLayoutBox(m_layoutObject)->layer(); |
| 1506 | 1506 |
| 1507 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); | 1507 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 1508 HitTestResult hitTestResult = HitTestResult(request, point); | 1508 HitTestResult hitTestResult = HitTestResult(request, point); |
| 1509 layer->hitTest(hitTestResult); | 1509 layer->hitTest(hitTestResult); |
| 1510 if (!hitTestResult.innerNode()) | |
| 1511 return 0; | |
| 1512 | 1510 |
| 1513 Node* node = hitTestResult.innerNode(); | 1511 Node* node = hitTestResult.innerNode(); |
| 1512 if (!node) |
| 1513 return nullptr; |
| 1514 | 1514 |
| 1515 if (isHTMLAreaElement(node)) | 1515 if (isHTMLAreaElement(node)) |
| 1516 return accessibilityImageMapHitTest(toHTMLAreaElement(node), point); | 1516 return accessibilityImageMapHitTest(toHTMLAreaElement(node), point); |
| 1517 | 1517 |
| 1518 if (isHTMLOptionElement(node)) | 1518 if (isHTMLOptionElement(node)) { |
| 1519 node = toHTMLOptionElement(*node).ownerSelectElement(); | 1519 node = toHTMLOptionElement(*node).ownerSelectElement(); |
| 1520 if (!node) |
| 1521 return nullptr; |
| 1522 } |
| 1520 | 1523 |
| 1521 LayoutObject* obj = node->layoutObject(); | 1524 LayoutObject* obj = node->layoutObject(); |
| 1522 if (!obj) | 1525 if (!obj) |
| 1523 return 0; | 1526 return nullptr; |
| 1524 | 1527 |
| 1525 AXObject* result = axObjectCache().getOrCreate(obj); | 1528 AXObject* result = axObjectCache().getOrCreate(obj); |
| 1526 result->updateChildrenIfNecessary(); | 1529 result->updateChildrenIfNecessary(); |
| 1527 | 1530 |
| 1528 // Allow the element to perform any hit-testing it might need to do to reach
non-layout children. | 1531 // Allow the element to perform any hit-testing it might need to do to reach
non-layout children. |
| 1529 result = result->elementAccessibilityHitTest(point); | 1532 result = result->elementAccessibilityHitTest(point); |
| 1530 if (result && result->accessibilityIsIgnored()) { | 1533 if (result && result->accessibilityIsIgnored()) { |
| 1531 // If this element is the label of a control, a hit test should return t
he control. | 1534 // If this element is the label of a control, a hit test should return t
he control. |
| 1532 if (result->isAXLayoutObject()) { | 1535 if (result->isAXLayoutObject()) { |
| 1533 AXObject* controlObject = toAXLayoutObject(result)->correspondingCon
trolForLabelElement(); | 1536 AXObject* controlObject = toAXLayoutObject(result)->correspondingCon
trolForLabelElement(); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 result.unite(labelRect); | 2579 result.unite(labelRect); |
| 2577 } | 2580 } |
| 2578 } | 2581 } |
| 2579 } | 2582 } |
| 2580 } | 2583 } |
| 2581 | 2584 |
| 2582 return result; | 2585 return result; |
| 2583 } | 2586 } |
| 2584 | 2587 |
| 2585 } // namespace blink | 2588 } // namespace blink |
| OLD | NEW |