| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 if (obj->style()->hasAppearance()) | 1102 if (obj->style()->hasAppearance()) |
| 1103 LayoutTheme::theme().addVisualOverflow(*obj, r); | 1103 LayoutTheme::theme().addVisualOverflow(*obj, r); |
| 1104 result.unite(r); | 1104 result.unite(r); |
| 1105 } | 1105 } |
| 1106 } | 1106 } |
| 1107 return result; | 1107 return result; |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 AXObject* AXObject::elementAccessibilityHitTest(const IntPoint& point) const | 1110 AXObject* AXObject::elementAccessibilityHitTest(const IntPoint& point) const |
| 1111 { | 1111 { |
| 1112 // Send the hit test back into the sub-frame if necessary. | 1112 // Check if there are any mock elements or child frames that need to be hand
led. |
| 1113 if (isAttachment()) { | |
| 1114 Widget* widget = widgetForAttachmentView(); | |
| 1115 // Normalize the point for the widget's bounds. | |
| 1116 if (widget && widget->isFrameView()) | |
| 1117 return axObjectCache().getOrCreate(widget)->accessibilityHitTest(Int
Point(point - widget->frameRect().location())); | |
| 1118 } | |
| 1119 | |
| 1120 // Check if there are any mock elements that need to be handled. | |
| 1121 for (const auto& child : m_children) { | 1113 for (const auto& child : m_children) { |
| 1122 if (child->isMockObject() && child->elementRect().contains(point)) | 1114 if (child->isMockObject() && child->elementRect().contains(point)) |
| 1123 return child->elementAccessibilityHitTest(point); | 1115 return child->elementAccessibilityHitTest(point); |
| 1116 |
| 1117 if (child->isWebArea()) { |
| 1118 FrameView* frameView = child->documentFrameView(); |
| 1119 if (frameView) |
| 1120 return child->accessibilityHitTest(IntPoint(point - frameView->f
rameRect().location())); |
| 1121 } |
| 1124 } | 1122 } |
| 1125 | 1123 |
| 1126 return const_cast<AXObject*>(this); | 1124 return const_cast<AXObject*>(this); |
| 1127 } | 1125 } |
| 1128 | 1126 |
| 1129 const AXObject::AXObjectVector& AXObject::children() | 1127 const AXObject::AXObjectVector& AXObject::children() |
| 1130 { | 1128 { |
| 1131 updateChildrenIfNecessary(); | 1129 updateChildrenIfNecessary(); |
| 1132 | 1130 |
| 1133 return m_children; | 1131 return m_children; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 return (objectMin + objectMax - viewportMin - viewportMax) / 2; | 1418 return (objectMin + objectMax - viewportMin - viewportMax) / 2; |
| 1421 } | 1419 } |
| 1422 | 1420 |
| 1423 void AXObject::scrollToMakeVisibleWithSubFocus(const IntRect& subfocus) const | 1421 void AXObject::scrollToMakeVisibleWithSubFocus(const IntRect& subfocus) const |
| 1424 { | 1422 { |
| 1425 // Search up the parent chain until we find the first one that's scrollable. | 1423 // Search up the parent chain until we find the first one that's scrollable. |
| 1426 AXObject* scrollParent = parentObject(); | 1424 AXObject* scrollParent = parentObject(); |
| 1427 ScrollableArea* scrollableArea = 0; | 1425 ScrollableArea* scrollableArea = 0; |
| 1428 while (scrollParent) { | 1426 while (scrollParent) { |
| 1429 scrollableArea = scrollParent->getScrollableAreaIfScrollable(); | 1427 scrollableArea = scrollParent->getScrollableAreaIfScrollable(); |
| 1430 if (scrollableArea && !scrollParent->isAXScrollView()) | 1428 if (scrollableArea) |
| 1431 break; | 1429 break; |
| 1432 scrollParent = scrollParent->parentObject(); | 1430 scrollParent = scrollParent->parentObject(); |
| 1433 } | 1431 } |
| 1434 if (!scrollParent || !scrollableArea) | 1432 if (!scrollParent || !scrollableArea) |
| 1435 return; | 1433 return; |
| 1436 | 1434 |
| 1437 IntRect objectRect = pixelSnappedIntRect(elementRect()); | 1435 IntRect objectRect = pixelSnappedIntRect(elementRect()); |
| 1438 IntPoint scrollPosition = scrollableArea->scrollPosition(); | 1436 IntPoint scrollPosition = scrollableArea->scrollPosition(); |
| 1439 IntRect scrollVisibleRect = scrollableArea->visibleContentRect(); | 1437 IntRect scrollVisibleRect = scrollableArea->visibleContentRect(); |
| 1440 | 1438 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1469 scrollParent->scrollToMakeVisibleWithSubFocus(newSubfocus); | 1467 scrollParent->scrollToMakeVisibleWithSubFocus(newSubfocus); |
| 1470 } | 1468 } |
| 1471 | 1469 |
| 1472 void AXObject::scrollToGlobalPoint(const IntPoint& globalPoint) const | 1470 void AXObject::scrollToGlobalPoint(const IntPoint& globalPoint) const |
| 1473 { | 1471 { |
| 1474 // Search up the parent chain and create a vector of all scrollable parent o
bjects | 1472 // Search up the parent chain and create a vector of all scrollable parent o
bjects |
| 1475 // and ending with this object itself. | 1473 // and ending with this object itself. |
| 1476 HeapVector<Member<const AXObject>> objects; | 1474 HeapVector<Member<const AXObject>> objects; |
| 1477 AXObject* parentObject; | 1475 AXObject* parentObject; |
| 1478 for (parentObject = this->parentObject(); parentObject; parentObject = paren
tObject->parentObject()) { | 1476 for (parentObject = this->parentObject(); parentObject; parentObject = paren
tObject->parentObject()) { |
| 1479 if (parentObject->getScrollableAreaIfScrollable() && !parentObject->isAX
ScrollView()) | 1477 if (parentObject->getScrollableAreaIfScrollable()) |
| 1480 objects.prepend(parentObject); | 1478 objects.prepend(parentObject); |
| 1481 } | 1479 } |
| 1482 objects.append(this); | 1480 objects.append(this); |
| 1483 | 1481 |
| 1484 // Start with the outermost scrollable (the main window) and try to scroll t
he | 1482 // Start with the outermost scrollable (the main window) and try to scroll t
he |
| 1485 // next innermost object to the given point. | 1483 // next innermost object to the given point. |
| 1486 int offsetX = 0, offsetY = 0; | 1484 int offsetX = 0, offsetY = 0; |
| 1487 IntPoint point = globalPoint; | 1485 IntPoint point = globalPoint; |
| 1488 size_t levels = objects.size() - 1; | 1486 size_t levels = objects.size() - 1; |
| 1489 for (size_t i = 0; i < levels; i++) { | 1487 for (size_t i = 0; i < levels; i++) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 | 1700 |
| 1703 DEFINE_TRACE(AXObject) | 1701 DEFINE_TRACE(AXObject) |
| 1704 { | 1702 { |
| 1705 visitor->trace(m_children); | 1703 visitor->trace(m_children); |
| 1706 visitor->trace(m_parent); | 1704 visitor->trace(m_parent); |
| 1707 visitor->trace(m_cachedLiveRegionRoot); | 1705 visitor->trace(m_cachedLiveRegionRoot); |
| 1708 visitor->trace(m_axObjectCache); | 1706 visitor->trace(m_axObjectCache); |
| 1709 } | 1707 } |
| 1710 | 1708 |
| 1711 } // namespace blink | 1709 } // namespace blink |
| OLD | NEW |