Chromium Code Reviews| 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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1944 // Set the selection based on visible positions, because the offsets in | 1944 // Set the selection based on visible positions, because the offsets in |
| 1945 // accessibility nodes are based on visible indexes, which often skips | 1945 // accessibility nodes are based on visible indexes, which often skips |
| 1946 // redundant whitespace, for example. | 1946 // redundant whitespace, for example. |
| 1947 VisiblePosition anchorVisiblePosition = | 1947 VisiblePosition anchorVisiblePosition = |
| 1948 toVisiblePosition(anchorObject, selection.anchorOffset); | 1948 toVisiblePosition(anchorObject, selection.anchorOffset); |
| 1949 VisiblePosition focusVisiblePosition = | 1949 VisiblePosition focusVisiblePosition = |
| 1950 toVisiblePosition(focusObject, selection.focusOffset); | 1950 toVisiblePosition(focusObject, selection.focusOffset); |
| 1951 if (anchorVisiblePosition.isNull() || focusVisiblePosition.isNull()) | 1951 if (anchorVisiblePosition.isNull() || focusVisiblePosition.isNull()) |
| 1952 return; | 1952 return; |
| 1953 | 1953 |
| 1954 frame->selection().setSelection( | 1954 SelectionInDOMTree::Builder builder; |
| 1955 createVisibleSelection(anchorVisiblePosition, focusVisiblePosition)); | 1955 if (anchorVisiblePosition.isNotNull() && focusVisiblePosition.isNotNull()) { |
|
Xiaocheng
2016/10/21 11:18:36
No need for these branches as L1951 have ensured n
yosin_UTC9
2016/10/24 06:19:44
I missed... :-<
| |
| 1956 builder.collapse(anchorVisiblePosition.toPositionWithAffinity()); | |
| 1957 builder.extend(focusVisiblePosition.deepEquivalent()); | |
| 1958 } else if (anchorVisiblePosition.isNotNull()) { | |
| 1959 builder.collapse(anchorVisiblePosition.toPositionWithAffinity()); | |
| 1960 } else { | |
| 1961 builder.collapse(focusVisiblePosition.toPositionWithAffinity()); | |
| 1962 } | |
| 1963 frame->selection().setSelection(createVisibleSelection(builder.build())); | |
|
Xiaocheng
2016/10/21 11:18:36
We should use the FrameSelection::setSelection(Sel
yosin_UTC9
2016/10/24 06:19:44
Good catch!
Done
| |
| 1956 } | 1964 } |
| 1957 | 1965 |
| 1958 bool AXLayoutObject::isValidSelectionBound(const AXObject* boundObject) const { | 1966 bool AXLayoutObject::isValidSelectionBound(const AXObject* boundObject) const { |
| 1959 return getLayoutObject() && boundObject && !boundObject->isDetached() && | 1967 return getLayoutObject() && boundObject && !boundObject->isDetached() && |
| 1960 boundObject->isAXLayoutObject() && boundObject->getLayoutObject() && | 1968 boundObject->isAXLayoutObject() && boundObject->getLayoutObject() && |
| 1961 boundObject->getLayoutObject()->frame() == | 1969 boundObject->getLayoutObject()->frame() == |
| 1962 getLayoutObject()->frame() && | 1970 getLayoutObject()->frame() && |
| 1963 &boundObject->axObjectCache() == &axObjectCache(); | 1971 &boundObject->axObjectCache() == &axObjectCache(); |
| 1964 } | 1972 } |
| 1965 | 1973 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2446 | 2454 |
| 2447 bool AXLayoutObject::elementAttributeValue( | 2455 bool AXLayoutObject::elementAttributeValue( |
| 2448 const QualifiedName& attributeName) const { | 2456 const QualifiedName& attributeName) const { |
| 2449 if (!m_layoutObject) | 2457 if (!m_layoutObject) |
| 2450 return false; | 2458 return false; |
| 2451 | 2459 |
| 2452 return equalIgnoringCase(getAttribute(attributeName), "true"); | 2460 return equalIgnoringCase(getAttribute(attributeName), "true"); |
| 2453 } | 2461 } |
| 2454 | 2462 |
| 2455 } // namespace blink | 2463 } // namespace blink |
| OLD | NEW |