OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 } | 809 } |
810 | 810 |
811 WebAXRole WebAXObject::role() const | 811 WebAXRole WebAXObject::role() const |
812 { | 812 { |
813 if (isDetached()) | 813 if (isDetached()) |
814 return WebAXRoleUnknown; | 814 return WebAXRoleUnknown; |
815 | 815 |
816 return static_cast<WebAXRole>(m_private->roleValue()); | 816 return static_cast<WebAXRole>(m_private->roleValue()); |
817 } | 817 } |
818 | 818 |
819 void WebAXObject::selection(WebAXObject& anchorObject, int& anchorOffset, | |
820 WebAXObject& focusObject, int& focusOffset) const | |
821 { | |
822 if (isDetached()) { | |
823 anchorObject = WebAXObject(); | |
824 anchorOffset = -1; | |
825 focusObject = WebAXObject(); | |
826 focusOffset = -1; | |
827 return; | |
828 } | |
829 | |
830 AXObject::AXRange axSelection = m_private->selection(); | |
831 anchorObject = WebAXObject(axSelection.anchorObject); | |
832 anchorOffset = axSelection.anchorOffset; | |
833 focusObject = WebAXObject(axSelection.focusObject); | |
834 focusOffset = axSelection.focusOffset; | |
835 return; | |
836 } | |
837 | |
838 void WebAXObject::setSelection(const WebAXObject& anchorObject, int anchorOffset , | |
839 const WebAXObject& focusObject, int focusOffset) const | |
840 { | |
841 if (isDetached()) | |
842 return; | |
843 | |
844 AXObject::AXRange axSelection(anchorObject, anchorOffset, | |
845 focusObject, focusOffset); | |
846 m_private->setSelection(axSelection); | |
847 return; | |
848 } | |
849 | |
819 unsigned WebAXObject::selectionEnd() const | 850 unsigned WebAXObject::selectionEnd() const |
820 { | 851 { |
821 if (isDetached()) | 852 if (isDetached()) |
822 return 0; | 853 return 0; |
823 | 854 |
824 return m_private->selectedTextRange().start + m_private->selectedTextRange() .length; | 855 AXObject::AXRange axSelection = m_private->selectionUnderObject(); |
dmazzoni
2015/06/24 00:11:01
It seems like this changes the behavior.
Previous
| |
856 return axSelection.focusOffset; | |
825 } | 857 } |
826 | 858 |
827 unsigned WebAXObject::selectionStart() const | 859 unsigned WebAXObject::selectionStart() const |
828 { | 860 { |
829 if (isDetached()) | 861 if (isDetached()) |
830 return 0; | 862 return 0; |
831 | 863 |
832 return m_private->selectedTextRange().start; | 864 AXObject::AXRange axSelection = m_private->selectionUnderObject(); |
865 return axSelection.anchorOffset; | |
833 } | 866 } |
834 | 867 |
835 unsigned WebAXObject::selectionEndLineNumber() const | 868 unsigned WebAXObject::selectionEndLineNumber() const |
836 { | 869 { |
837 if (isDetached()) | 870 if (isDetached()) |
838 return 0; | 871 return 0; |
839 | 872 |
840 VisiblePosition position = m_private->visiblePositionForIndex(selectionEnd() ); | 873 VisiblePosition position = m_private->visiblePositionForIndex(selectionEnd() ); |
841 int lineNumber = m_private->lineForPosition(position); | 874 int lineNumber = m_private->lineForPosition(position); |
842 if (lineNumber < 0) | 875 if (lineNumber < 0) |
(...skipping 17 matching lines...) Expand all Loading... | |
860 { | 893 { |
861 if (!isDetached()) | 894 if (!isDetached()) |
862 m_private->setFocused(on); | 895 m_private->setFocused(on); |
863 } | 896 } |
864 | 897 |
865 void WebAXObject::setSelectedTextRange(int selectionStart, int selectionEnd) con st | 898 void WebAXObject::setSelectedTextRange(int selectionStart, int selectionEnd) con st |
866 { | 899 { |
867 if (isDetached()) | 900 if (isDetached()) |
868 return; | 901 return; |
869 | 902 |
870 m_private->setSelectedTextRange(AXObject::PlainTextRange(selectionStart, sel ectionEnd - selectionStart)); | 903 m_private->setSelection(AXObject::AXRange(selectionStart, selectionEnd)); |
871 } | 904 } |
872 | 905 |
873 void WebAXObject::setValue(WebString value) const | 906 void WebAXObject::setValue(WebString value) const |
874 { | 907 { |
875 if (isDetached()) | 908 if (isDetached()) |
876 return; | 909 return; |
877 | 910 |
878 m_private->setValue(value); | 911 m_private->setValue(value); |
879 } | 912 } |
880 | 913 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1482 for (size_t i = 0; i < vectorSize; i++) | 1515 for (size_t i = 0; i < vectorSize; i++) |
1483 offsetsWebVector[i] = offsetsVector[i]; | 1516 offsetsWebVector[i] = offsetsVector[i]; |
1484 offsets.swap(offsetsWebVector); | 1517 offsets.swap(offsetsWebVector); |
1485 } | 1518 } |
1486 | 1519 |
1487 void WebAXObject::wordBoundaries(WebVector<int>& starts, WebVector<int>& ends) c onst | 1520 void WebAXObject::wordBoundaries(WebVector<int>& starts, WebVector<int>& ends) c onst |
1488 { | 1521 { |
1489 if (isDetached()) | 1522 if (isDetached()) |
1490 return; | 1523 return; |
1491 | 1524 |
1492 Vector<AXObject::PlainTextRange> words; | 1525 Vector<AXObject::AXRange> wordBoundaries; |
1493 m_private->wordBoundaries(words); | 1526 m_private->wordBoundaries(wordBoundaries); |
1494 | 1527 |
1495 WebVector<int> startsWebVector(words.size()); | 1528 WebVector<int> wordStartOffsets(wordBoundaries.size()); |
1496 WebVector<int> endsWebVector(words.size()); | 1529 WebVector<int> wordEndOffsets(wordBoundaries.size()); |
1497 for (size_t i = 0; i < words.size(); i++) { | 1530 for (size_t i = 0; i < wordBoundaries.size(); ++i) { |
1498 startsWebVector[i] = words[i].start; | 1531 wordStartOffsets[i] = wordBoundaries[i].anchorOffset; |
dmazzoni
2015/06/24 00:11:01
How about: ASSERT(wordBoundaries[i].isSimple());
| |
1499 endsWebVector[i] = words[i].start + words[i].length; | 1532 wordEndOffsets[i] = wordBoundaries[i].focusOffset; |
1500 } | 1533 } |
1501 starts.swap(startsWebVector); | 1534 |
1502 ends.swap(endsWebVector); | 1535 starts.swap(wordStartOffsets); |
1536 ends.swap(wordEndOffsets); | |
1503 } | 1537 } |
1504 | 1538 |
1505 bool WebAXObject::isScrollableContainer() const | 1539 bool WebAXObject::isScrollableContainer() const |
1506 { | 1540 { |
1507 if (isDetached()) | 1541 if (isDetached()) |
1508 return false; | 1542 return false; |
1509 | 1543 |
1510 return m_private->isScrollableContainer(); | 1544 return m_private->isScrollableContainer(); |
1511 } | 1545 } |
1512 | 1546 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 m_private = object; | 1604 m_private = object; |
1571 return *this; | 1605 return *this; |
1572 } | 1606 } |
1573 | 1607 |
1574 WebAXObject::operator WTF::PassRefPtr<AXObject>() const | 1608 WebAXObject::operator WTF::PassRefPtr<AXObject>() const |
1575 { | 1609 { |
1576 return m_private.get(); | 1610 return m_private.get(); |
1577 } | 1611 } |
1578 | 1612 |
1579 } // namespace blink | 1613 } // namespace blink |
OLD | NEW |