OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "core/dom/shadow/SelectRuleFeatureSet.h" | 61 #include "core/dom/shadow/SelectRuleFeatureSet.h" |
62 #include "core/dom/shadow/ShadowRoot.h" | 62 #include "core/dom/shadow/ShadowRoot.h" |
63 #include "core/editing/Editor.h" | 63 #include "core/editing/Editor.h" |
64 #include "core/editing/PlainTextRange.h" | 64 #include "core/editing/PlainTextRange.h" |
65 #include "core/editing/SpellCheckRequester.h" | 65 #include "core/editing/SpellCheckRequester.h" |
66 #include "core/editing/SpellChecker.h" | 66 #include "core/editing/SpellChecker.h" |
67 #include "core/editing/SurroundingText.h" | 67 #include "core/editing/SurroundingText.h" |
68 #include "core/editing/TextIterator.h" | 68 #include "core/editing/TextIterator.h" |
69 #include "core/fetch/MemoryCache.h" | 69 #include "core/fetch/MemoryCache.h" |
70 #include "core/fetch/ResourceFetcher.h" | 70 #include "core/fetch/ResourceFetcher.h" |
71 #include "core/frame/DOMPoint.h" | |
72 #include "core/frame/LocalDOMWindow.h" | 71 #include "core/frame/LocalDOMWindow.h" |
73 #include "core/frame/EventHandlerRegistry.h" | 72 #include "core/frame/EventHandlerRegistry.h" |
74 #include "core/frame/FrameView.h" | 73 #include "core/frame/FrameView.h" |
75 #include "core/frame/LocalFrame.h" | 74 #include "core/frame/LocalFrame.h" |
76 #include "core/frame/Settings.h" | 75 #include "core/frame/Settings.h" |
| 76 #include "core/frame/WebKitPoint.h" |
77 #include "core/html/HTMLContentElement.h" | 77 #include "core/html/HTMLContentElement.h" |
78 #include "core/html/HTMLIFrameElement.h" | 78 #include "core/html/HTMLIFrameElement.h" |
79 #include "core/html/HTMLInputElement.h" | 79 #include "core/html/HTMLInputElement.h" |
80 #include "core/html/HTMLMediaElement.h" | 80 #include "core/html/HTMLMediaElement.h" |
81 #include "core/html/HTMLSelectElement.h" | 81 #include "core/html/HTMLSelectElement.h" |
82 #include "core/html/HTMLTextAreaElement.h" | 82 #include "core/html/HTMLTextAreaElement.h" |
83 #include "core/html/canvas/CanvasRenderingContext2D.h" | 83 #include "core/html/canvas/CanvasRenderingContext2D.h" |
84 #include "core/html/forms/FormController.h" | 84 #include "core/html/forms/FormController.h" |
85 #include "core/html/shadow/ShadowElementNames.h" | 85 #include "core/html/shadow/ShadowElementNames.h" |
86 #include "core/html/shadow/TextControlInnerElements.h" | 86 #include "core/html/shadow/TextControlInnerElements.h" |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Range")); | 1095 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Range")); |
1096 return String(); | 1096 return String(); |
1097 } | 1097 } |
1098 | 1098 |
1099 return range->text(); | 1099 return range->text(); |
1100 } | 1100 } |
1101 | 1101 |
1102 // FIXME: The next four functions are very similar - combine them once | 1102 // FIXME: The next four functions are very similar - combine them once |
1103 // bestClickableNode/bestContextMenuNode have been combined.. | 1103 // bestClickableNode/bestContextMenuNode have been combined.. |
1104 | 1104 |
1105 PassRefPtrWillBeRawPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickable
Node(long x, long y, long width, long height, Document* document, ExceptionState
& exceptionState) | 1105 PassRefPtrWillBeRawPtr<WebKitPoint> Internals::touchPositionAdjustedToBestClicka
bleNode(long x, long y, long width, long height, Document* document, ExceptionSt
ate& exceptionState) |
1106 { | 1106 { |
1107 if (!document || !document->frame()) { | 1107 if (!document || !document->frame()) { |
1108 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1108 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
1109 return nullptr; | 1109 return nullptr; |
1110 } | 1110 } |
1111 | 1111 |
1112 document->updateLayout(); | 1112 document->updateLayout(); |
1113 | 1113 |
1114 IntSize radius(width / 2, height / 2); | 1114 IntSize radius(width / 2, height / 2); |
1115 IntPoint point(x + radius.width(), y + radius.height()); | 1115 IntPoint point(x + radius.width(), y + radius.height()); |
1116 | 1116 |
1117 EventHandler& eventHandler = document->frame()->eventHandler(); | 1117 EventHandler& eventHandler = document->frame()->eventHandler(); |
1118 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1118 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1119 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 1119 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
1120 | 1120 |
1121 Node* targetNode; | 1121 Node* targetNode; |
1122 IntPoint adjustedPoint; | 1122 IntPoint adjustedPoint; |
1123 | 1123 |
1124 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); | 1124 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); |
1125 if (foundNode) | 1125 if (foundNode) |
1126 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1126 return WebKitPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
1127 | 1127 |
1128 return nullptr; | 1128 return nullptr; |
1129 } | 1129 } |
1130 | 1130 |
1131 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) | 1131 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) |
1132 { | 1132 { |
1133 if (!document || !document->frame()) { | 1133 if (!document || !document->frame()) { |
1134 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1134 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
1135 return 0; | 1135 return 0; |
1136 } | 1136 } |
1137 | 1137 |
1138 document->updateLayout(); | 1138 document->updateLayout(); |
1139 | 1139 |
1140 IntSize radius(width / 2, height / 2); | 1140 IntSize radius(width / 2, height / 2); |
1141 IntPoint point(x + radius.width(), y + radius.height()); | 1141 IntPoint point(x + radius.width(), y + radius.height()); |
1142 | 1142 |
1143 EventHandler& eventHandler = document->frame()->eventHandler(); | 1143 EventHandler& eventHandler = document->frame()->eventHandler(); |
1144 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1144 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1145 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 1145 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
1146 | 1146 |
1147 Node* targetNode; | 1147 Node* targetNode; |
1148 IntPoint adjustedPoint; | 1148 IntPoint adjustedPoint; |
1149 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); | 1149 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); |
1150 return targetNode; | 1150 return targetNode; |
1151 } | 1151 } |
1152 | 1152 |
1153 PassRefPtrWillBeRawPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMe
nuNode(long x, long y, long width, long height, Document* document, ExceptionSta
te& exceptionState) | 1153 PassRefPtrWillBeRawPtr<WebKitPoint> Internals::touchPositionAdjustedToBestContex
tMenuNode(long x, long y, long width, long height, Document* document, Exception
State& exceptionState) |
1154 { | 1154 { |
1155 if (!document || !document->frame()) { | 1155 if (!document || !document->frame()) { |
1156 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1156 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
1157 return nullptr; | 1157 return nullptr; |
1158 } | 1158 } |
1159 | 1159 |
1160 document->updateLayout(); | 1160 document->updateLayout(); |
1161 | 1161 |
1162 IntSize radius(width / 2, height / 2); | 1162 IntSize radius(width / 2, height / 2); |
1163 IntPoint point(x + radius.width(), y + radius.height()); | 1163 IntPoint point(x + radius.width(), y + radius.height()); |
1164 | 1164 |
1165 EventHandler& eventHandler = document->frame()->eventHandler(); | 1165 EventHandler& eventHandler = document->frame()->eventHandler(); |
1166 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1166 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1167 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); | 1167 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, radius); |
1168 | 1168 |
1169 Node* targetNode = 0; | 1169 Node* targetNode = 0; |
1170 IntPoint adjustedPoint; | 1170 IntPoint adjustedPoint; |
1171 | 1171 |
1172 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); | 1172 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); |
1173 if (foundNode) | 1173 if (foundNode) |
1174 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1174 return WebKitPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
1175 | 1175 |
1176 return DOMPoint::create(x, y); | 1176 return WebKitPoint::create(x, y); |
1177 } | 1177 } |
1178 | 1178 |
1179 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) | 1179 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) |
1180 { | 1180 { |
1181 if (!document || !document->frame()) { | 1181 if (!document || !document->frame()) { |
1182 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1182 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
1183 return 0; | 1183 return 0; |
1184 } | 1184 } |
1185 | 1185 |
1186 document->updateLayout(); | 1186 document->updateLayout(); |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 | 2342 |
2343 StringBuilder markup; | 2343 StringBuilder markup; |
2344 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; | 2344 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; |
2345 for (; iter != elementData.end(); ++iter) | 2345 for (; iter != elementData.end(); ++iter) |
2346 markup.append(iter->markup); | 2346 markup.append(iter->markup); |
2347 | 2347 |
2348 return markup.toString(); | 2348 return markup.toString(); |
2349 } | 2349 } |
2350 | 2350 |
2351 } // namespace blink | 2351 } // namespace blink |
OLD | NEW |