| 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 VisiblePosition anchorVisiblePosition = anchorNode->isTextNode() |
| 1946 ? blink::visiblePositionForIndex(selection.anchorOffset, anchorNode->par
entNode()) |
| 1947 : createVisiblePosition(Position(anchorNode, selection.anchorOffset)); |
| 1948 VisiblePosition focusVisiblePosition = focusNode->isTextNode() |
| 1949 ? blink::visiblePositionForIndex(selection.focusOffset, focusNode->paren
tNode()) |
| 1950 : createVisiblePosition(Position(focusNode, selection.focusOffset)); |
| 1951 frame->selection().setSelection(VisibleSelection(anchorVisiblePosition, focu
sVisiblePosition)); |
| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 if (label && label->layoutObject()) { | 2477 if (label && label->layoutObject()) { |
| 2472 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2478 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2473 result.unite(labelRect); | 2479 result.unite(labelRect); |
| 2474 } | 2480 } |
| 2475 } | 2481 } |
| 2476 | 2482 |
| 2477 return result; | 2483 return result; |
| 2478 } | 2484 } |
| 2479 | 2485 |
| 2480 } // namespace blink | 2486 } // namespace blink |
| OLD | NEW |