| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 return String(buf); | 270 return String(buf); |
| 271 } | 271 } |
| 272 | 272 |
| 273 PassRefPtr<GCObservation> Internals::observeGC(ScriptValue scriptValue) | 273 PassRefPtr<GCObservation> Internals::observeGC(ScriptValue scriptValue) |
| 274 { | 274 { |
| 275 v8::Handle<v8::Value> observedValue = scriptValue.v8Value(); | 275 v8::Handle<v8::Value> observedValue = scriptValue.v8Value(); |
| 276 ASSERT(!observedValue.IsEmpty()); | 276 ASSERT(!observedValue.IsEmpty()); |
| 277 if (observedValue->IsNull() || observedValue->IsUndefined()) { | 277 if (observedValue->IsNull() || observedValue->IsUndefined()) { |
| 278 V8ThrowException::throwTypeError("value to observe is null or undefined"
, v8::Isolate::GetCurrent()); | 278 V8ThrowException::throwTypeError("value to observe is null or undefined"
, v8::Isolate::GetCurrent()); |
| 279 return 0; | 279 return nullptr; |
| 280 } | 280 } |
| 281 | 281 |
| 282 return GCObservation::create(observedValue); | 282 return GCObservation::create(observedValue); |
| 283 } | 283 } |
| 284 | 284 |
| 285 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& exc
eptionState) const | 285 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& exc
eptionState) const |
| 286 { | 286 { |
| 287 Document* document = contextDocument(); | 287 Document* document = contextDocument(); |
| 288 if (!document) { | 288 if (!document) { |
| 289 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); | 289 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 return scope->numberOfScopedHTMLStyleChildren(); | 594 return scope->numberOfScopedHTMLStyleChildren(); |
| 595 | 595 |
| 596 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::argu
mentNullOrIncorrectType(1, "Node")); | 596 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::argu
mentNullOrIncorrectType(1, "Node")); |
| 597 return 0; | 597 return 0; |
| 598 } | 598 } |
| 599 | 599 |
| 600 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited
Info(Node* node, ExceptionState& exceptionState) const | 600 PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisited
Info(Node* node, ExceptionState& exceptionState) const |
| 601 { | 601 { |
| 602 if (!node) { | 602 if (!node) { |
| 603 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); | 603 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); |
| 604 return 0; | 604 return nullptr; |
| 605 } | 605 } |
| 606 | 606 |
| 607 bool allowVisitedStyle = true; | 607 bool allowVisitedStyle = true; |
| 608 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); | 608 return CSSComputedStyleDeclaration::create(node, allowVisitedStyle); |
| 609 } | 609 } |
| 610 | 610 |
| 611 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& exceptionState) | 611 ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& exceptionState) |
| 612 { | 612 { |
| 613 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). | 613 // FIXME: Internals::shadowRoot() in tests should be converted to youngestSh
adowRoot() or oldestShadowRoot(). |
| 614 // https://bugs.webkit.org/show_bug.cgi?id=78465 | 614 // https://bugs.webkit.org/show_bug.cgi?id=78465 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod
e, markerTypes); | 859 Vector<DocumentMarker*> markers = node->document().markers()->markersFor(nod
e, markerTypes); |
| 860 if (markers.size() <= index) | 860 if (markers.size() <= index) |
| 861 return 0; | 861 return 0; |
| 862 return markers[index]; | 862 return markers[index]; |
| 863 } | 863 } |
| 864 | 864 |
| 865 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker
Type, unsigned index, ExceptionState& exceptionState) | 865 PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker
Type, unsigned index, ExceptionState& exceptionState) |
| 866 { | 866 { |
| 867 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); | 867 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); |
| 868 if (!marker) | 868 if (!marker) |
| 869 return 0; | 869 return nullptr; |
| 870 return Range::create(node->document(), node, marker->startOffset(), node, ma
rker->endOffset()); | 870 return Range::create(node->document(), node, marker->startOffset(), node, ma
rker->endOffset()); |
| 871 } | 871 } |
| 872 | 872 |
| 873 String Internals::markerDescriptionForNode(Node* node, const String& markerType,
unsigned index, ExceptionState& exceptionState) | 873 String Internals::markerDescriptionForNode(Node* node, const String& markerType,
unsigned index, ExceptionState& exceptionState) |
| 874 { | 874 { |
| 875 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); | 875 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); |
| 876 if (!marker) | 876 if (!marker) |
| 877 return String(); | 877 return String(); |
| 878 return marker->description(); | 878 return marker->description(); |
| 879 } | 879 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 return; | 1062 return; |
| 1063 } | 1063 } |
| 1064 FrameView* frameView = element->document().view(); | 1064 FrameView* frameView = element->document().view(); |
| 1065 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); | 1065 frameView->scrollElementToRect(element, IntRect(x, y, w, h)); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang
eLocation, int rangeLength, ExceptionState& exceptionState) | 1068 PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rang
eLocation, int rangeLength, ExceptionState& exceptionState) |
| 1069 { | 1069 { |
| 1070 if (!scope) { | 1070 if (!scope) { |
| 1071 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); | 1071 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); |
| 1072 return 0; | 1072 return nullptr; |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 // TextIterator depends on Layout information, make sure layout it up to dat
e. | 1075 // TextIterator depends on Layout information, make sure layout it up to dat
e. |
| 1076 scope->document().updateLayoutIgnorePendingStylesheets(); | 1076 scope->document().updateLayoutIgnorePendingStylesheets(); |
| 1077 | 1077 |
| 1078 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang
e(*scope); | 1078 return PlainTextRange(rangeLocation, rangeLocation + rangeLength).createRang
e(*scope); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except
ionState& exceptionState) | 1081 unsigned Internals::locationFromRange(Element* scope, const Range* range, Except
ionState& exceptionState) |
| 1082 { | 1082 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1111 return String(); | 1111 return String(); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 return range->text(); | 1114 return range->text(); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x,
long y, long width, long height, Document* document, ExceptionState& exceptionS
tate) | 1117 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x,
long y, long width, long height, Document* document, ExceptionState& exceptionS
tate) |
| 1118 { | 1118 { |
| 1119 if (!document || !document->frame()) { | 1119 if (!document || !document->frame()) { |
| 1120 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1120 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
| 1121 return 0; | 1121 return nullptr; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 document->updateLayout(); | 1124 document->updateLayout(); |
| 1125 | 1125 |
| 1126 IntSize radius(width / 2, height / 2); | 1126 IntSize radius(width / 2, height / 2); |
| 1127 IntPoint point(x + radius.width(), y + radius.height()); | 1127 IntPoint point(x + radius.width(), y + radius.height()); |
| 1128 | 1128 |
| 1129 Node* targetNode; | 1129 Node* targetNode; |
| 1130 IntPoint adjustedPoint; | 1130 IntPoint adjustedPoint; |
| 1131 | 1131 |
| 1132 bool foundNode = document->frame()->eventHandler().bestClickableNodeForTouch
Point(point, radius, adjustedPoint, targetNode); | 1132 bool foundNode = document->frame()->eventHandler().bestClickableNodeForTouch
Point(point, radius, adjustedPoint, targetNode); |
| 1133 if (foundNode) | 1133 if (foundNode) |
| 1134 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1134 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
| 1135 | 1135 |
| 1136 return 0; | 1136 return nullptr; |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) | 1139 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) |
| 1140 { | 1140 { |
| 1141 if (!document || !document->frame()) { | 1141 if (!document || !document->frame()) { |
| 1142 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1142 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
| 1143 return 0; | 1143 return 0; |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 document->updateLayout(); | 1146 document->updateLayout(); |
| 1147 | 1147 |
| 1148 IntSize radius(width / 2, height / 2); | 1148 IntSize radius(width / 2, height / 2); |
| 1149 IntPoint point(x + radius.width(), y + radius.height()); | 1149 IntPoint point(x + radius.width(), y + radius.height()); |
| 1150 | 1150 |
| 1151 Node* targetNode; | 1151 Node* targetNode; |
| 1152 IntPoint adjustedPoint; | 1152 IntPoint adjustedPoint; |
| 1153 document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radi
us, adjustedPoint, targetNode); | 1153 document->frame()->eventHandler().bestClickableNodeForTouchPoint(point, radi
us, adjustedPoint, targetNode); |
| 1154 return targetNode; | 1154 return targetNode; |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long
x, long y, long width, long height, Document* document, ExceptionState& exceptio
nState) | 1157 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long
x, long y, long width, long height, Document* document, ExceptionState& exceptio
nState) |
| 1158 { | 1158 { |
| 1159 if (!document || !document->frame()) { | 1159 if (!document || !document->frame()) { |
| 1160 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1160 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
| 1161 return 0; | 1161 return nullptr; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 document->updateLayout(); | 1164 document->updateLayout(); |
| 1165 | 1165 |
| 1166 IntSize radius(width / 2, height / 2); | 1166 IntSize radius(width / 2, height / 2); |
| 1167 IntPoint point(x + radius.width(), y + radius.height()); | 1167 IntPoint point(x + radius.width(), y + radius.height()); |
| 1168 | 1168 |
| 1169 Node* targetNode = 0; | 1169 Node* targetNode = 0; |
| 1170 IntPoint adjustedPoint; | 1170 IntPoint adjustedPoint; |
| 1171 | 1171 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1191 Node* targetNode = 0; | 1191 Node* targetNode = 0; |
| 1192 IntPoint adjustedPoint; | 1192 IntPoint adjustedPoint; |
| 1193 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra
dius, adjustedPoint, targetNode); | 1193 document->frame()->eventHandler().bestContextMenuNodeForTouchPoint(point, ra
dius, adjustedPoint, targetNode); |
| 1194 return targetNode; | 1194 return targetNode; |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) | 1197 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) |
| 1198 { | 1198 { |
| 1199 if (!document || !document->frame()) { | 1199 if (!document || !document->frame()) { |
| 1200 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1200 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
| 1201 return 0; | 1201 return nullptr; |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 document->updateLayout(); | 1204 document->updateLayout(); |
| 1205 | 1205 |
| 1206 IntSize radius(width / 2, height / 2); | 1206 IntSize radius(width / 2, height / 2); |
| 1207 IntPoint point(x + radius.width(), y + radius.height()); | 1207 IntPoint point(x + radius.width(), y + radius.height()); |
| 1208 | 1208 |
| 1209 Node* targetNode; | 1209 Node* targetNode; |
| 1210 IntRect zoomableArea; | 1210 IntRect zoomableArea; |
| 1211 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP
oint(point, radius, zoomableArea, targetNode); | 1211 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP
oint(point, radius, zoomableArea, targetNode); |
| 1212 if (foundNode) | 1212 if (foundNode) |
| 1213 return ClientRect::create(zoomableArea); | 1213 return ClientRect::create(zoomableArea); |
| 1214 | 1214 |
| 1215 return 0; | 1215 return nullptr; |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 | 1218 |
| 1219 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState&
exceptionState) | 1219 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState&
exceptionState) |
| 1220 { | 1220 { |
| 1221 SpellCheckRequester* requester = spellCheckRequester(document); | 1221 SpellCheckRequester* requester = spellCheckRequester(document); |
| 1222 | 1222 |
| 1223 if (!requester) { | 1223 if (!requester) { |
| 1224 exceptionState.throwDOMException(InvalidAccessError, "No spell check req
uestor can be obtained for the provided document."); | 1224 exceptionState.throwDOMException(InvalidAccessError, "No spell check req
uestor can be obtained for the provided document."); |
| 1225 return -1; | 1225 return -1; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 | 1381 |
| 1382 size_t numChildren = graphicsLayer->children().size(); | 1382 size_t numChildren = graphicsLayer->children().size(); |
| 1383 for (size_t i = 0; i < numChildren; ++i) | 1383 for (size_t i = 0; i < numChildren; ++i) |
| 1384 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects)
; | 1384 accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects)
; |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume
nt, ExceptionState& exceptionState) | 1387 PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* docume
nt, ExceptionState& exceptionState) |
| 1388 { | 1388 { |
| 1389 if (!document || !document->view() || !document->page() || document != conte
xtDocument()) { | 1389 if (!document || !document->view() || !document->page() || document != conte
xtDocument()) { |
| 1390 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1390 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1391 return 0; | 1391 return nullptr; |
| 1392 } | 1392 } |
| 1393 | 1393 |
| 1394 // Do any pending layout and compositing update (which may call touchEventTa
rgetRectsChange) to ensure this | 1394 // Do any pending layout and compositing update (which may call touchEventTa
rgetRectsChange) to ensure this |
| 1395 // really takes any previous changes into account. | 1395 // really takes any previous changes into account. |
| 1396 forceCompositingUpdate(document, exceptionState); | 1396 forceCompositingUpdate(document, exceptionState); |
| 1397 if (exceptionState.hadException()) | 1397 if (exceptionState.hadException()) |
| 1398 return 0; | 1398 return nullptr; |
| 1399 | 1399 |
| 1400 if (RenderView* view = document->renderView()) { | 1400 if (RenderView* view = document->renderView()) { |
| 1401 if (RenderLayerCompositor* compositor = view->compositor()) { | 1401 if (RenderLayerCompositor* compositor = view->compositor()) { |
| 1402 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) { | 1402 if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) { |
| 1403 RefPtr<LayerRectList> rects = LayerRectList::create(); | 1403 RefPtr<LayerRectList> rects = LayerRectList::create(); |
| 1404 accumulateLayerRectList(compositor, rootLayer, rects.get()); | 1404 accumulateLayerRectList(compositor, rootLayer, rects.get()); |
| 1405 return rects; | 1405 return rects; |
| 1406 } | 1406 } |
| 1407 } | 1407 } |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 return 0; | 1410 return nullptr; |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i
nt centerY, unsigned topPadding, unsigned rightPadding, | 1413 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i
nt centerY, unsigned topPadding, unsigned rightPadding, |
| 1414 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wShadowContent, bool allowChildFrameContent, ExceptionState& exceptionState) con
st | 1414 unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allo
wShadowContent, bool allowChildFrameContent, ExceptionState& exceptionState) con
st |
| 1415 { | 1415 { |
| 1416 if (!document || !document->frame() || !document->frame()->view()) { | 1416 if (!document || !document->frame() || !document->frame()->view()) { |
| 1417 exceptionState.throwDOMException(InvalidAccessError, "No view can be obt
ained from the provided document."); | 1417 exceptionState.throwDOMException(InvalidAccessError, "No view can be obt
ained from the provided document."); |
| 1418 return 0; | 1418 return nullptr; |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 Frame* frame = document->frame(); | 1421 Frame* frame = document->frame(); |
| 1422 FrameView* frameView = document->view(); | 1422 FrameView* frameView = document->view(); |
| 1423 RenderView* renderView = document->renderView(); | 1423 RenderView* renderView = document->renderView(); |
| 1424 | 1424 |
| 1425 if (!renderView) | 1425 if (!renderView) |
| 1426 return 0; | 1426 return nullptr; |
| 1427 | 1427 |
| 1428 float zoomFactor = frame->pageZoomFactor(); | 1428 float zoomFactor = frame->pageZoomFactor(); |
| 1429 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra
meView->scrollX(), centerY * zoomFactor + frameView->scrollY())); | 1429 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra
meView->scrollX(), centerY * zoomFactor + frameView->scrollY())); |
| 1430 | 1430 |
| 1431 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active; | 1431 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active; |
| 1432 if (ignoreClipping) | 1432 if (ignoreClipping) |
| 1433 hitType |= HitTestRequest::IgnoreClipping; | 1433 hitType |= HitTestRequest::IgnoreClipping; |
| 1434 if (!allowShadowContent) | 1434 if (!allowShadowContent) |
| 1435 hitType |= HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent
; | 1435 hitType |= HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent
; |
| 1436 if (allowChildFrameContent) | 1436 if (allowChildFrameContent) |
| 1437 hitType |= HitTestRequest::AllowChildFrameContent; | 1437 hitType |= HitTestRequest::AllowChildFrameContent; |
| 1438 | 1438 |
| 1439 HitTestRequest request(hitType); | 1439 HitTestRequest request(hitType); |
| 1440 | 1440 |
| 1441 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. | 1441 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. |
| 1442 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) | 1442 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) |
| 1443 return 0; | 1443 return nullptr; |
| 1444 | 1444 |
| 1445 Vector<RefPtr<Node> > matches; | 1445 Vector<RefPtr<Node> > matches; |
| 1446 | 1446 |
| 1447 // Need padding to trigger a rect based hit test, but we want to return a No
deList | 1447 // Need padding to trigger a rect based hit test, but we want to return a No
deList |
| 1448 // so we special case this. | 1448 // so we special case this. |
| 1449 if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) { | 1449 if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) { |
| 1450 HitTestResult result(point); | 1450 HitTestResult result(point); |
| 1451 renderView->hitTest(request, result); | 1451 renderView->hitTest(request, result); |
| 1452 if (result.innerNode()) | 1452 if (result.innerNode()) |
| 1453 matches.append(result.innerNode()->deprecatedShadowAncestorNode()); | 1453 matches.append(result.innerNode()->deprecatedShadowAncestorNode()); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 | 1632 |
| 1633 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& excep
tionState) const | 1633 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& excep
tionState) const |
| 1634 { | 1634 { |
| 1635 return elementLayerTreeAsText(element, 0, exceptionState); | 1635 return elementLayerTreeAsText(element, 0, exceptionState); |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& exc
eptionState, RenderLayerStackingNode::PaintOrderListType type) | 1638 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& exc
eptionState, RenderLayerStackingNode::PaintOrderListType type) |
| 1639 { | 1639 { |
| 1640 if (!element) { | 1640 if (!element) { |
| 1641 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); | 1641 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); |
| 1642 return 0; | 1642 return nullptr; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 element->document().updateLayout(); | 1645 element->document().updateLayout(); |
| 1646 | 1646 |
| 1647 RenderObject* renderer = element->renderer(); | 1647 RenderObject* renderer = element->renderer(); |
| 1648 if (!renderer || !renderer->isBox()) { | 1648 if (!renderer || !renderer->isBox()) { |
| 1649 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro
vided element's renderer is not a box." : "The provided element has no renderer.
"); | 1649 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro
vided element's renderer is not a box." : "The provided element has no renderer.
"); |
| 1650 return 0; | 1650 return nullptr; |
| 1651 } | 1651 } |
| 1652 | 1652 |
| 1653 RenderLayer* layer = toRenderBox(renderer)->layer(); | 1653 RenderLayer* layer = toRenderBox(renderer)->layer(); |
| 1654 if (!layer) { | 1654 if (!layer) { |
| 1655 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca
n be obtained from the provided element."); | 1655 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca
n be obtained from the provided element."); |
| 1656 return 0; | 1656 return nullptr; |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 Vector<RefPtr<Node> > nodes; | 1659 Vector<RefPtr<Node> > nodes; |
| 1660 layer->stackingNode()->computePaintOrderList(type, nodes); | 1660 layer->stackingNode()->computePaintOrderList(type, nodes); |
| 1661 return StaticNodeList::adopt(nodes); | 1661 return StaticNodeList::adopt(nodes); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex
ceptionState& exceptionState) | 1664 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex
ceptionState& exceptionState) |
| 1665 { | 1665 { |
| 1666 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Befo
rePromote); | 1666 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Befo
rePromote); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 return String(); | 1827 return String(); |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 return document->frame()->trackedRepaintRectsAsText(); | 1830 return document->frame()->trackedRepaintRectsAsText(); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 PassRefPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionSt
ate& exceptionState) const | 1833 PassRefPtr<ClientRectList> Internals::repaintRects(Element* element, ExceptionSt
ate& exceptionState) const |
| 1834 { | 1834 { |
| 1835 if (!element) { | 1835 if (!element) { |
| 1836 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); | 1836 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); |
| 1837 return 0; | 1837 return nullptr; |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState))
{ | 1840 if (RenderLayer* layer = getRenderLayerForElement(element, exceptionState))
{ |
| 1841 if (layer->compositingState() == PaintsIntoOwnBacking) { | 1841 if (layer->compositingState() == PaintsIntoOwnBacking) { |
| 1842 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects
(); | 1842 OwnPtr<Vector<FloatRect> > rects = layer->collectTrackedRepaintRects
(); |
| 1843 ASSERT(rects.get()); | 1843 ASSERT(rects.get()); |
| 1844 Vector<FloatQuad> quads(rects->size()); | 1844 Vector<FloatQuad> quads(rects->size()); |
| 1845 for (size_t i = 0; i < rects->size(); ++i) | 1845 for (size_t i = 0; i < rects->size(); ++i) |
| 1846 quads[i] = FloatRect(rects->at(i)); | 1846 quads[i] = FloatRect(rects->at(i)); |
| 1847 return ClientRectList::create(quads); | 1847 return ClientRectList::create(quads); |
| 1848 } | 1848 } |
| 1849 } | 1849 } |
| 1850 | 1850 |
| 1851 exceptionState.throwDOMException(InvalidAccessError, "The provided element i
s not composited."); | 1851 exceptionState.throwDOMException(InvalidAccessError, "The provided element i
s not composited."); |
| 1852 return 0; | 1852 return nullptr; |
| 1853 } | 1853 } |
| 1854 | 1854 |
| 1855 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e
xceptionState) const | 1855 String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& e
xceptionState) const |
| 1856 { | 1856 { |
| 1857 return String(); | 1857 return String(); |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState&
exceptionState) const | 1860 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState&
exceptionState) const |
| 1861 { | 1861 { |
| 1862 if (!document || !document->frame()) { | 1862 if (!document || !document->frame()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1874 if (!page) | 1874 if (!page) |
| 1875 return String(); | 1875 return String(); |
| 1876 | 1876 |
| 1877 return page->mainThreadScrollingReasonsAsText(); | 1877 return page->mainThreadScrollingReasonsAsText(); |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document,
ExceptionState& exceptionState) const | 1880 PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document,
ExceptionState& exceptionState) const |
| 1881 { | 1881 { |
| 1882 if (!document || !document->frame()) { | 1882 if (!document || !document->frame()) { |
| 1883 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); | 1883 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "The document provided is invalid."); |
| 1884 return 0; | 1884 return nullptr; |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 Page* page = document->page(); | 1887 Page* page = document->page(); |
| 1888 if (!page) | 1888 if (!page) |
| 1889 return 0; | 1889 return nullptr; |
| 1890 | 1890 |
| 1891 return page->nonFastScrollableRects(document->frame()); | 1891 return page->nonFastScrollableRects(document->frame()); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta
te& exceptionState) const | 1894 void Internals::garbageCollectDocumentResources(Document* document, ExceptionSta
te& exceptionState) const |
| 1895 { | 1895 { |
| 1896 if (!document) { | 1896 if (!document) { |
| 1897 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); | 1897 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); |
| 1898 return; | 1898 return; |
| 1899 } | 1899 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 void Internals::forceReload(bool endToEnd) | 2227 void Internals::forceReload(bool endToEnd) |
| 2228 { | 2228 { |
| 2229 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload); | 2229 frame()->loader().reload(endToEnd ? EndToEndReload : NormalReload); |
| 2230 } | 2230 } |
| 2231 | 2231 |
| 2232 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& exceptionState
) | 2232 PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& exceptionState
) |
| 2233 { | 2233 { |
| 2234 Document* document = contextDocument(); | 2234 Document* document = contextDocument(); |
| 2235 if (!document || !document->frame()) { | 2235 if (!document || !document->frame()) { |
| 2236 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); | 2236 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc
ument's frame cannot be retrieved." : "No context document can be obtained."); |
| 2237 return 0; | 2237 return nullptr; |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 return ClientRect::create(document->frame()->selection().bounds()); | 2240 return ClientRect::create(document->frame()->selection().bounds()); |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 String Internals::markerTextForListItem(Element* element, ExceptionState& except
ionState) | 2243 String Internals::markerTextForListItem(Element* element, ExceptionState& except
ionState) |
| 2244 { | 2244 { |
| 2245 if (!element) { | 2245 if (!element) { |
| 2246 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); | 2246 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Element")); |
| 2247 return String(); | 2247 return String(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 }; | 2363 }; |
| 2364 | 2364 |
| 2365 } // namespace | 2365 } // namespace |
| 2366 | 2366 |
| 2367 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis
e promise) | 2367 ScriptPromise Internals::addOneToPromise(ExecutionContext* context, ScriptPromis
e promise) |
| 2368 { | 2368 { |
| 2369 return promise.then(AddOneFunction::create(context)); | 2369 return promise.then(AddOneFunction::create(context)); |
| 2370 } | 2370 } |
| 2371 | 2371 |
| 2372 } | 2372 } |
| OLD | NEW |