Changeset 48188 in webkit
- Timestamp:
- Sep 8, 2009 3:02:41 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r48184 r48188 1 2009-09-08 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Test for https://bugs.webkit.org/show_bug.cgi?id=27046 6 Implement CSSOM DocumentView.caretRangeFromPoint 7 8 * fast/dom/Document/CaretRangeFromPoint: Added. 9 * fast/dom/Document/CaretRangeFromPoint/basic-expected.txt: Added. 10 * fast/dom/Document/CaretRangeFromPoint/basic.html: Added. 11 * fast/dom/Document/CaretRangeFromPoint/replace-element-expected.txt: Added. 12 * fast/dom/Document/CaretRangeFromPoint/replace-element.html: Added. 13 * fast/dom/Window/window-properties-expected.txt: 14 1 15 2009-09-08 Brian Weinstein <bweinstein@apple.com> 2 16 -
trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt
r48137 r48188 540 540 window.Document.prototype.adoptNode [function] 541 541 window.Document.prototype.appendChild [function] 542 window.Document.prototype.caretRangeFromPoint [function] 542 543 window.Document.prototype.cloneNode [function] 543 544 window.Document.prototype.compareDocumentPosition [function] -
trunk/WebCore/ChangeLog
r48186 r48188 1 2009-09-08 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=27046 6 Implement CSSOM DocumentView.caretRangeFromPoint 7 8 Tests: fast/dom/Document/CaretRangeFromPoint/basic.html 9 fast/dom/Document/CaretRangeFromPoint/replace-element.html 10 11 * dom/Document.cpp: 12 (WebCore::Document::caretRangeFromPoint): 13 * dom/Document.h: 14 * dom/Document.idl: 15 1 16 2009-09-08 Kevin Ollivier <kevino@theolliviers.com> 2 17 -
trunk/WebCore/dom/Document.cpp
r48181 r48188 111 111 #include "SelectionController.h" 112 112 #include "Settings.h" 113 114 #if ENABLE(SHARED_WORKERS)115 #include "SharedWorkerRepository.h"116 #endif117 118 113 #include "StyleSheetList.h" 119 114 #include "TextEvent.h" … … 129 124 #include "XMLNames.h" 130 125 #include "XMLTokenizer.h" 126 #include "htmlediting.h" 131 127 #include <wtf/CurrentTime.h> 132 128 #include <wtf/HashFunctions.h> … … 138 134 #include "Database.h" 139 135 #include "DatabaseThread.h" 136 #endif 137 138 #if ENABLE(SHARED_WORKERS) 139 #include "SharedWorkerRepository.h" 140 140 #endif 141 141 … … 942 942 n = n->shadowAncestorNode(); 943 943 return static_cast<Element*>(n); 944 } 945 946 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) 947 { 948 if (!renderer()) 949 return 0; 950 Frame* frame = this->frame(); 951 if (!frame) 952 return 0; 953 954 float zoomFactor = frame->pageZoomFactor(); 955 IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor, y * zoomFactor)); 956 957 FrameView* frameView = frame->view(); 958 if (!frameView) 959 return 0; 960 if (!frameView->boundsRect().contains(point)) 961 return 0; 962 963 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); 964 HitTestResult result(point); 965 renderView()->layer()->hitTest(request, result); 966 967 Node* node = result.innerNode(); 968 if (!node) 969 return 0; 970 971 Node* shadowAncestorNode = node->shadowAncestorNode(); 972 if (shadowAncestorNode != node) { 973 unsigned offset = shadowAncestorNode->nodeIndex(); 974 Node* container = shadowAncestorNode->parentNode(); 975 return Range::create(this, container, offset, container, offset); 976 } 977 978 RenderObject* renderer = node->renderer(); 979 if (!renderer) 980 return 0; 981 VisiblePosition visiblePosition = renderer->positionForPoint(result.localPoint()); 982 if (visiblePosition.isNull()) 983 return 0; 984 985 Position rangeCompliantPosition = rangeCompliantEquivalent(visiblePosition); 986 return Range::create(this, rangeCompliantPosition, rangeCompliantPosition); 944 987 } 945 988 -
trunk/WebCore/dom/Document.h
r48181 r48188 229 229 230 230 Element* elementFromPoint(int x, int y) const; 231 PassRefPtr<Range> caretRangeFromPoint(int x, int y); 232 231 233 String readyState() const; 232 234 -
trunk/WebCore/dom/Document.idl
r47649 r48188 192 192 193 193 Element elementFromPoint(in long x, in long y); 194 Range caretRangeFromPoint(in long x, in long y); 194 195 195 196 // Mozilla extensions
Note: See TracChangeset
for help on using the changeset viewer.