| 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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 focusObject = focusObject->parentObject(); | 1933 focusObject = focusObject->parentObject(); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 if (!anchorNode || !focusNode) | 1936 if (!anchorNode || !focusNode) |
| 1937 return; | 1937 return; |
| 1938 | 1938 |
| 1939 LocalFrame* frame = getLayoutObject()->frame(); | 1939 LocalFrame* frame = getLayoutObject()->frame(); |
| 1940 if (!frame) | 1940 if (!frame) |
| 1941 return; | 1941 return; |
| 1942 | 1942 |
| 1943 frame->selection().setSelection(VisibleSelection( | 1943 // Set the selection based on visible positions, because the offsets in acce
ssibility nodes |
| 1944 Position(anchorNode, selection.anchorOffset), | 1944 // are based on visible indexes, which often skips redundant whitespace, for
example. |
| 1945 Position(focusNode, selection.focusOffset))); | 1945 ContainerNode* anchorContainerNode = anchorNode->isContainerNode() ? toConta
inerNode(anchorNode) : anchorNode->parentNode(); |
| 1946 ContainerNode* focusContainerNode = focusNode->isContainerNode() ? toContain
erNode(focusNode) : focusNode->parentNode(); |
| 1947 if (anchorContainerNode && focusContainerNode) { |
| 1948 VisiblePosition anchorVisiblePosition = blink::visiblePositionForIndex(s
election.anchorOffset, anchorContainerNode); |
| 1949 VisiblePosition focusVisiblePosition = blink::visiblePositionForIndex(se
lection.focusOffset, focusContainerNode); |
| 1950 frame->selection().setSelection(VisibleSelection(anchorVisiblePosition,
focusVisiblePosition)); |
| 1951 } |
| 1946 } | 1952 } |
| 1947 | 1953 |
| 1948 bool AXLayoutObject::isValidSelectionBound(const AXObject* boundObject) const | 1954 bool AXLayoutObject::isValidSelectionBound(const AXObject* boundObject) const |
| 1949 { | 1955 { |
| 1950 return getLayoutObject() && boundObject && !boundObject->isDetached() | 1956 return getLayoutObject() && boundObject && !boundObject->isDetached() |
| 1951 && boundObject->isAXLayoutObject() && boundObject->getLayoutObject() | 1957 && boundObject->isAXLayoutObject() && boundObject->getLayoutObject() |
| 1952 && boundObject->getLayoutObject()->frame() == getLayoutObject()->frame() | 1958 && boundObject->getLayoutObject()->frame() == getLayoutObject()->frame() |
| 1953 && &boundObject->axObjectCache() == &axObjectCache(); | 1959 && &boundObject->axObjectCache() == &axObjectCache(); |
| 1954 } | 1960 } |
| 1955 | 1961 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 if (label && label->layoutObject()) { | 2475 if (label && label->layoutObject()) { |
| 2470 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2476 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2471 result.unite(labelRect); | 2477 result.unite(labelRect); |
| 2472 } | 2478 } |
| 2473 } | 2479 } |
| 2474 | 2480 |
| 2475 return result; | 2481 return result; |
| 2476 } | 2482 } |
| 2477 | 2483 |
| 2478 } // namespace blink | 2484 } // namespace blink |
| OLD | NEW |