| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // FIXME: no longer needed. When Chromium no longer calls | 906 // FIXME: no longer needed. When Chromium no longer calls |
| 907 // WebAXObject::startCachingComputedObjectAttributesUntilTreeMutates, | 907 // WebAXObject::startCachingComputedObjectAttributesUntilTreeMutates, |
| 908 // delete this function and the WebAXObject interfaces. | 908 // delete this function and the WebAXObject interfaces. |
| 909 } | 909 } |
| 910 | 910 |
| 911 void AXObjectCache::stopCachingComputedObjectAttributes() | 911 void AXObjectCache::stopCachingComputedObjectAttributes() |
| 912 { | 912 { |
| 913 // FIXME: no longer needed (see above). | 913 // FIXME: no longer needed (see above). |
| 914 } | 914 } |
| 915 | 915 |
| 916 VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData&
textMarkerData) | |
| 917 { | |
| 918 if (!isNodeInUse(textMarkerData.node)) | |
| 919 return VisiblePosition(); | |
| 920 | |
| 921 // FIXME: Accessability should make it clear these are DOM-compliant offsets
or store Position objects. | |
| 922 VisiblePosition visiblePos = VisiblePosition(createLegacyEditingPosition(tex
tMarkerData.node, textMarkerData.offset), textMarkerData.affinity); | |
| 923 Position deepPos = visiblePos.deepEquivalent(); | |
| 924 if (deepPos.isNull()) | |
| 925 return VisiblePosition(); | |
| 926 | |
| 927 RenderObject* renderer = deepPos.deprecatedNode()->renderer(); | |
| 928 if (!renderer) | |
| 929 return VisiblePosition(); | |
| 930 | |
| 931 AXObjectCache* cache = renderer->document().axObjectCache(); | |
| 932 if (!cache->isIDinUse(textMarkerData.axID)) | |
| 933 return VisiblePosition(); | |
| 934 | |
| 935 if (deepPos.deprecatedNode() != textMarkerData.node || deepPos.deprecatedEdi
tingOffset() != textMarkerData.offset) | |
| 936 return VisiblePosition(); | |
| 937 | |
| 938 return visiblePos; | |
| 939 } | |
| 940 | |
| 941 void AXObjectCache::textMarkerDataForVisiblePosition(TextMarkerData& textMarkerD
ata, const VisiblePosition& visiblePos) | |
| 942 { | |
| 943 // This memory must be bzero'd so instances of TextMarkerData can be tested
for byte-equivalence. | |
| 944 // This also allows callers to check for failure by looking at textMarkerDat
a upon return. | |
| 945 memset(&textMarkerData, 0, sizeof(TextMarkerData)); | |
| 946 | |
| 947 if (visiblePos.isNull()) | |
| 948 return; | |
| 949 | |
| 950 Position deepPos = visiblePos.deepEquivalent(); | |
| 951 Node* domNode = deepPos.deprecatedNode(); | |
| 952 ASSERT(domNode); | |
| 953 if (!domNode) | |
| 954 return; | |
| 955 | |
| 956 if (isHTMLInputElement(*domNode) && toHTMLInputElement(*domNode).isPasswordF
ield()) | |
| 957 return; | |
| 958 | |
| 959 // find or create an accessibility object for this node | |
| 960 AXObjectCache* cache = domNode->document().axObjectCache(); | |
| 961 RefPtr<AXObject> obj = cache->getOrCreate(domNode); | |
| 962 | |
| 963 textMarkerData.axID = obj.get()->axObjectID(); | |
| 964 textMarkerData.node = domNode; | |
| 965 textMarkerData.offset = deepPos.deprecatedEditingOffset(); | |
| 966 textMarkerData.affinity = visiblePos.affinity(); | |
| 967 | |
| 968 cache->setNodeInUse(domNode); | |
| 969 } | |
| 970 | |
| 971 const Element* AXObjectCache::rootAXEditableElement(const Node* node) | 916 const Element* AXObjectCache::rootAXEditableElement(const Node* node) |
| 972 { | 917 { |
| 973 const Element* result = node->rootEditableElement(); | 918 const Element* result = node->rootEditableElement(); |
| 974 const Element* element = node->isElementNode() ? toElement(node) : node->par
entElement(); | 919 const Element* element = node->isElementNode() ? toElement(node) : node->par
entElement(); |
| 975 | 920 |
| 976 for (; element; element = element->parentElement()) { | 921 for (; element; element = element->parentElement()) { |
| 977 if (nodeIsTextControl(element)) | 922 if (nodeIsTextControl(element)) |
| 978 result = element; | 923 result = element; |
| 979 } | 924 } |
| 980 | 925 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 { | 1012 { |
| 1068 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); | 1013 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); |
| 1069 } | 1014 } |
| 1070 | 1015 |
| 1071 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) | 1016 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) |
| 1072 { | 1017 { |
| 1073 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged)
; | 1018 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged)
; |
| 1074 } | 1019 } |
| 1075 | 1020 |
| 1076 } // namespace WebCore | 1021 } // namespace WebCore |
| OLD | NEW |