Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Side by Side Diff: third_party/WebKit/Source/web/WebAXObject.cpp

Issue 2191833003: Use text affinity to return correct accessible line boundaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug in browser_accessibility_win.cc Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 846 }
847 847
848 WebAXRole WebAXObject::role() const 848 WebAXRole WebAXObject::role() const
849 { 849 {
850 if (isDetached()) 850 if (isDetached())
851 return WebAXRoleUnknown; 851 return WebAXRoleUnknown;
852 852
853 return static_cast<WebAXRole>(m_private->roleValue()); 853 return static_cast<WebAXRole>(m_private->roleValue());
854 } 854 }
855 855
856 void WebAXObject::selection(WebAXObject& anchorObject, int& anchorOffset, 856 void WebAXObject::selection(WebAXObject& anchorObject, int& anchorOffset, WebAXT extAffinity& anchorAffinity,
857 WebAXObject& focusObject, int& focusOffset) const 857 WebAXObject& focusObject, int& focusOffset, WebAXTextAffinity& focusAffinity ) const
858 { 858 {
859 if (isDetached()) { 859 if (isDetached()) {
860 anchorObject = WebAXObject(); 860 anchorObject = WebAXObject();
861 anchorOffset = -1; 861 anchorOffset = -1;
862 anchorAffinity = WebAXTextAffinityDownstream;
862 focusObject = WebAXObject(); 863 focusObject = WebAXObject();
863 focusOffset = -1; 864 focusOffset = -1;
865 focusAffinity = WebAXTextAffinityDownstream;
864 return; 866 return;
865 } 867 }
866 868
867 AXObject::AXRange axSelection = m_private->selection(); 869 AXObject::AXRange axSelection = m_private->selection();
868 anchorObject = WebAXObject(axSelection.anchorObject); 870 anchorObject = WebAXObject(axSelection.anchorObject);
869 anchorOffset = axSelection.anchorOffset; 871 anchorOffset = axSelection.anchorOffset;
872 anchorAffinity = static_cast<WebAXTextAffinity>(axSelection.anchorAffinity);
870 focusObject = WebAXObject(axSelection.focusObject); 873 focusObject = WebAXObject(axSelection.focusObject);
871 focusOffset = axSelection.focusOffset; 874 focusOffset = axSelection.focusOffset;
875 focusAffinity = static_cast<WebAXTextAffinity>(axSelection.focusAffinity);
872 return; 876 return;
873 } 877 }
874 878
875 void WebAXObject::setSelection(const WebAXObject& anchorObject, int anchorOffset , 879 void WebAXObject::setSelection(const WebAXObject& anchorObject, int anchorOffset ,
876 const WebAXObject& focusObject, int focusOffset) const 880 const WebAXObject& focusObject, int focusOffset) const
877 { 881 {
878 if (isDetached()) 882 if (isDetached())
879 return; 883 return;
880 884
881 AXObject::AXRange axSelection(anchorObject, anchorOffset, 885 AXObject::AXRange axSelection(anchorObject, anchorOffset, TextAffinity::Upst ream,
882 focusObject, focusOffset); 886 focusObject, focusOffset, TextAffinity::Downstream);
883 m_private->setSelection(axSelection); 887 m_private->setSelection(axSelection);
884 return; 888 return;
885 } 889 }
886 890
887 unsigned WebAXObject::selectionEnd() const 891 unsigned WebAXObject::selectionEnd() const
888 { 892 {
889 if (isDetached()) 893 if (isDetached())
890 return 0; 894 return 0;
891 895
892 AXObject::AXRange axSelection = m_private->selectionUnderObject(); 896 AXObject::AXRange axSelection = m_private->selectionUnderObject();
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 m_private = object; 1602 m_private = object;
1599 return *this; 1603 return *this;
1600 } 1604 }
1601 1605
1602 WebAXObject::operator AXObject*() const 1606 WebAXObject::operator AXObject*() const
1603 { 1607 {
1604 return m_private.get(); 1608 return m_private.get();
1605 } 1609 }
1606 1610
1607 } // namespace blink 1611 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/AssertMatchingEnums.cpp ('k') | third_party/WebKit/public/web/WebAXEnums.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698