| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "core/rendering/style/RenderStyle.h" | 47 #include "core/rendering/style/RenderStyle.h" |
| 48 #include "platform/PlatformKeyboardEvent.h" | 48 #include "platform/PlatformKeyboardEvent.h" |
| 49 #include "public/platform/WebPoint.h" | 49 #include "public/platform/WebPoint.h" |
| 50 #include "public/platform/WebRect.h" | 50 #include "public/platform/WebRect.h" |
| 51 #include "public/platform/WebString.h" | 51 #include "public/platform/WebString.h" |
| 52 #include "public/platform/WebURL.h" | 52 #include "public/platform/WebURL.h" |
| 53 #include "public/web/WebDocument.h" | 53 #include "public/web/WebDocument.h" |
| 54 #include "public/web/WebNode.h" | 54 #include "public/web/WebNode.h" |
| 55 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
| 56 | 56 |
| 57 using namespace blink; | |
| 58 | |
| 59 namespace blink { | 57 namespace blink { |
| 60 | 58 |
| 61 void WebAXObject::reset() | 59 void WebAXObject::reset() |
| 62 { | 60 { |
| 63 m_private.reset(); | 61 m_private.reset(); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void WebAXObject::assign(const blink::WebAXObject& other) | 64 void WebAXObject::assign(const WebAXObject& other) |
| 67 { | 65 { |
| 68 m_private = other.m_private; | 66 m_private = other.m_private; |
| 69 } | 67 } |
| 70 | 68 |
| 71 bool WebAXObject::equals(const WebAXObject& n) const | 69 bool WebAXObject::equals(const WebAXObject& n) const |
| 72 { | 70 { |
| 73 return m_private.get() == n.m_private.get(); | 71 return m_private.get() == n.m_private.get(); |
| 74 } | 72 } |
| 75 | 73 |
| 76 // static | 74 // static |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 { | 703 { |
| 706 if (isDetached()) | 704 if (isDetached()) |
| 707 return false; | 705 return false; |
| 708 | 706 |
| 709 return m_private->press(); | 707 return m_private->press(); |
| 710 } | 708 } |
| 711 | 709 |
| 712 WebAXRole WebAXObject::role() const | 710 WebAXRole WebAXObject::role() const |
| 713 { | 711 { |
| 714 if (isDetached()) | 712 if (isDetached()) |
| 715 return blink::WebAXRoleUnknown; | 713 return WebAXRoleUnknown; |
| 716 | 714 |
| 717 return static_cast<WebAXRole>(m_private->roleValue()); | 715 return static_cast<WebAXRole>(m_private->roleValue()); |
| 718 } | 716 } |
| 719 | 717 |
| 720 unsigned WebAXObject::selectionEnd() const | 718 unsigned WebAXObject::selectionEnd() const |
| 721 { | 719 { |
| 722 if (isDetached()) | 720 if (isDetached()) |
| 723 return 0; | 721 return 0; |
| 724 | 722 |
| 725 return m_private->selectedTextRange().start + m_private->selectedTextRange()
.length; | 723 return m_private->selectedTextRange().start + m_private->selectedTextRange()
.length; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 } | 952 } |
| 955 | 953 |
| 956 WebAXObject WebAXObject::cellForColumnAndRow(unsigned column, unsigned row) cons
t | 954 WebAXObject WebAXObject::cellForColumnAndRow(unsigned column, unsigned row) cons
t |
| 957 { | 955 { |
| 958 if (isDetached()) | 956 if (isDetached()) |
| 959 return WebAXObject(); | 957 return WebAXObject(); |
| 960 | 958 |
| 961 if (!m_private->isAXTable()) | 959 if (!m_private->isAXTable()) |
| 962 return WebAXObject(); | 960 return WebAXObject(); |
| 963 | 961 |
| 964 blink::AXTableCell* cell = toAXTable(m_private.get())->cellForColumnAndRow(c
olumn, row); | 962 AXTableCell* cell = toAXTable(m_private.get())->cellForColumnAndRow(column,
row); |
| 965 return WebAXObject(static_cast<blink::AXObject*>(cell)); | 963 return WebAXObject(static_cast<AXObject*>(cell)); |
| 966 } | 964 } |
| 967 | 965 |
| 968 WebAXObject WebAXObject::headerContainerObject() const | 966 WebAXObject WebAXObject::headerContainerObject() const |
| 969 { | 967 { |
| 970 if (isDetached()) | 968 if (isDetached()) |
| 971 return WebAXObject(); | 969 return WebAXObject(); |
| 972 | 970 |
| 973 if (!m_private->isAXTable()) | 971 if (!m_private->isAXTable()) |
| 974 return WebAXObject(); | 972 return WebAXObject(); |
| 975 | 973 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 } | 1005 } |
| 1008 | 1006 |
| 1009 unsigned WebAXObject::rowIndex() const | 1007 unsigned WebAXObject::rowIndex() const |
| 1010 { | 1008 { |
| 1011 if (isDetached()) | 1009 if (isDetached()) |
| 1012 return 0; | 1010 return 0; |
| 1013 | 1011 |
| 1014 if (!m_private->isTableRow()) | 1012 if (!m_private->isTableRow()) |
| 1015 return 0; | 1013 return 0; |
| 1016 | 1014 |
| 1017 return blink::toAXTableRow(m_private.get())->rowIndex(); | 1015 return toAXTableRow(m_private.get())->rowIndex(); |
| 1018 } | 1016 } |
| 1019 | 1017 |
| 1020 WebAXObject WebAXObject::rowHeader() const | 1018 WebAXObject WebAXObject::rowHeader() const |
| 1021 { | 1019 { |
| 1022 if (isDetached()) | 1020 if (isDetached()) |
| 1023 return WebAXObject(); | 1021 return WebAXObject(); |
| 1024 | 1022 |
| 1025 if (!m_private->isTableRow()) | 1023 if (!m_private->isTableRow()) |
| 1026 return WebAXObject(); | 1024 return WebAXObject(); |
| 1027 | 1025 |
| 1028 return WebAXObject(blink::toAXTableRow(m_private.get())->headerObject()); | 1026 return WebAXObject(toAXTableRow(m_private.get())->headerObject()); |
| 1029 } | 1027 } |
| 1030 | 1028 |
| 1031 unsigned WebAXObject::columnIndex() const | 1029 unsigned WebAXObject::columnIndex() const |
| 1032 { | 1030 { |
| 1033 if (isDetached()) | 1031 if (isDetached()) |
| 1034 return 0; | 1032 return 0; |
| 1035 | 1033 |
| 1036 if (m_private->roleValue() != ColumnRole) | 1034 if (m_private->roleValue() != ColumnRole) |
| 1037 return 0; | 1035 return 0; |
| 1038 | 1036 |
| 1039 return blink::toAXTableColumn(m_private.get())->columnIndex(); | 1037 return toAXTableColumn(m_private.get())->columnIndex(); |
| 1040 } | 1038 } |
| 1041 | 1039 |
| 1042 WebAXObject WebAXObject::columnHeader() const | 1040 WebAXObject WebAXObject::columnHeader() const |
| 1043 { | 1041 { |
| 1044 if (isDetached()) | 1042 if (isDetached()) |
| 1045 return WebAXObject(); | 1043 return WebAXObject(); |
| 1046 | 1044 |
| 1047 if (m_private->roleValue() != ColumnRole) | 1045 if (m_private->roleValue() != ColumnRole) |
| 1048 return WebAXObject(); | 1046 return WebAXObject(); |
| 1049 | 1047 |
| 1050 return WebAXObject(blink::toAXTableColumn(m_private.get())->headerObject()); | 1048 return WebAXObject(toAXTableColumn(m_private.get())->headerObject()); |
| 1051 } | 1049 } |
| 1052 | 1050 |
| 1053 unsigned WebAXObject::cellColumnIndex() const | 1051 unsigned WebAXObject::cellColumnIndex() const |
| 1054 { | 1052 { |
| 1055 if (isDetached()) | 1053 if (isDetached()) |
| 1056 return 0; | 1054 return 0; |
| 1057 | 1055 |
| 1058 if (!m_private->isTableCell()) | 1056 if (!m_private->isTableCell()) |
| 1059 return 0; | 1057 return 0; |
| 1060 | 1058 |
| 1061 pair<unsigned, unsigned> columnRange; | 1059 pair<unsigned, unsigned> columnRange; |
| 1062 blink::toAXTableCell(m_private.get())->columnIndexRange(columnRange); | 1060 toAXTableCell(m_private.get())->columnIndexRange(columnRange); |
| 1063 return columnRange.first; | 1061 return columnRange.first; |
| 1064 } | 1062 } |
| 1065 | 1063 |
| 1066 unsigned WebAXObject::cellColumnSpan() const | 1064 unsigned WebAXObject::cellColumnSpan() const |
| 1067 { | 1065 { |
| 1068 if (isDetached()) | 1066 if (isDetached()) |
| 1069 return 0; | 1067 return 0; |
| 1070 | 1068 |
| 1071 if (!m_private->isTableCell()) | 1069 if (!m_private->isTableCell()) |
| 1072 return 0; | 1070 return 0; |
| 1073 | 1071 |
| 1074 pair<unsigned, unsigned> columnRange; | 1072 pair<unsigned, unsigned> columnRange; |
| 1075 blink::toAXTableCell(m_private.get())->columnIndexRange(columnRange); | 1073 toAXTableCell(m_private.get())->columnIndexRange(columnRange); |
| 1076 return columnRange.second; | 1074 return columnRange.second; |
| 1077 } | 1075 } |
| 1078 | 1076 |
| 1079 unsigned WebAXObject::cellRowIndex() const | 1077 unsigned WebAXObject::cellRowIndex() const |
| 1080 { | 1078 { |
| 1081 if (isDetached()) | 1079 if (isDetached()) |
| 1082 return 0; | 1080 return 0; |
| 1083 | 1081 |
| 1084 if (!m_private->isTableCell()) | 1082 if (!m_private->isTableCell()) |
| 1085 return 0; | 1083 return 0; |
| 1086 | 1084 |
| 1087 pair<unsigned, unsigned> rowRange; | 1085 pair<unsigned, unsigned> rowRange; |
| 1088 blink::toAXTableCell(m_private.get())->rowIndexRange(rowRange); | 1086 toAXTableCell(m_private.get())->rowIndexRange(rowRange); |
| 1089 return rowRange.first; | 1087 return rowRange.first; |
| 1090 } | 1088 } |
| 1091 | 1089 |
| 1092 unsigned WebAXObject::cellRowSpan() const | 1090 unsigned WebAXObject::cellRowSpan() const |
| 1093 { | 1091 { |
| 1094 if (isDetached()) | 1092 if (isDetached()) |
| 1095 return 0; | 1093 return 0; |
| 1096 | 1094 |
| 1097 if (!m_private->isTableCell()) | 1095 if (!m_private->isTableCell()) |
| 1098 return 0; | 1096 return 0; |
| 1099 | 1097 |
| 1100 pair<unsigned, unsigned> rowRange; | 1098 pair<unsigned, unsigned> rowRange; |
| 1101 blink::toAXTableCell(m_private.get())->rowIndexRange(rowRange); | 1099 toAXTableCell(m_private.get())->rowIndexRange(rowRange); |
| 1102 return rowRange.second; | 1100 return rowRange.second; |
| 1103 } | 1101 } |
| 1104 | 1102 |
| 1105 WebAXTextDirection WebAXObject::textDirection() const | 1103 WebAXTextDirection WebAXObject::textDirection() const |
| 1106 { | 1104 { |
| 1107 if (isDetached()) | 1105 if (isDetached()) |
| 1108 return WebAXTextDirectionLR; | 1106 return WebAXTextDirectionLR; |
| 1109 | 1107 |
| 1110 return static_cast<WebAXTextDirection>(m_private->textDirection()); | 1108 return static_cast<WebAXTextDirection>(m_private->textDirection()); |
| 1111 } | 1109 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if (!isDetached()) | 1152 if (!isDetached()) |
| 1155 m_private->scrollToMakeVisibleWithSubFocus(subfocus); | 1153 m_private->scrollToMakeVisibleWithSubFocus(subfocus); |
| 1156 } | 1154 } |
| 1157 | 1155 |
| 1158 void WebAXObject::scrollToGlobalPoint(const WebPoint& point) const | 1156 void WebAXObject::scrollToGlobalPoint(const WebPoint& point) const |
| 1159 { | 1157 { |
| 1160 if (!isDetached()) | 1158 if (!isDetached()) |
| 1161 m_private->scrollToGlobalPoint(point); | 1159 m_private->scrollToGlobalPoint(point); |
| 1162 } | 1160 } |
| 1163 | 1161 |
| 1164 WebAXObject::WebAXObject(const WTF::PassRefPtr<blink::AXObject>& object) | 1162 WebAXObject::WebAXObject(const WTF::PassRefPtr<AXObject>& object) |
| 1165 : m_private(object) | 1163 : m_private(object) |
| 1166 { | 1164 { |
| 1167 } | 1165 } |
| 1168 | 1166 |
| 1169 WebAXObject& WebAXObject::operator=(const WTF::PassRefPtr<blink::AXObject>& obje
ct) | 1167 WebAXObject& WebAXObject::operator=(const WTF::PassRefPtr<AXObject>& object) |
| 1170 { | 1168 { |
| 1171 m_private = object; | 1169 m_private = object; |
| 1172 return *this; | 1170 return *this; |
| 1173 } | 1171 } |
| 1174 | 1172 |
| 1175 WebAXObject::operator WTF::PassRefPtr<blink::AXObject>() const | 1173 WebAXObject::operator WTF::PassRefPtr<AXObject>() const |
| 1176 { | 1174 { |
| 1177 return m_private.get(); | 1175 return m_private.get(); |
| 1178 } | 1176 } |
| 1179 | 1177 |
| 1180 } // namespace blink | 1178 } // namespace blink |
| OLD | NEW |