| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& exc
eptionState) const | 306 unsigned Internals::updateStyleAndReturnAffectedElementCount(ExceptionState& exc
eptionState) const |
| 307 { | 307 { |
| 308 Document* document = contextDocument(); | 308 Document* document = contextDocument(); |
| 309 if (!document) { | 309 if (!document) { |
| 310 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); | 310 exceptionState.throwDOMException(InvalidAccessError, "No context documen
t is available."); |
| 311 return 0; | 311 return 0; |
| 312 } | 312 } |
| 313 | 313 |
| 314 unsigned beforeCount = document->styleEngine().styleForElementCount(); | 314 unsigned beforeCount = document->styleEngine().styleForElementCount(); |
| 315 document->updateLayoutTree(); | 315 document->updateStyleAndLayoutTree(); |
| 316 return document->styleEngine().styleForElementCount() - beforeCount; | 316 return document->styleEngine().styleForElementCount() - beforeCount; |
| 317 } | 317 } |
| 318 | 318 |
| 319 unsigned Internals::needsLayoutCount(ExceptionState& exceptionState) const | 319 unsigned Internals::needsLayoutCount(ExceptionState& exceptionState) const |
| 320 { | 320 { |
| 321 LocalFrame* contextFrame = frame(); | 321 LocalFrame* contextFrame = frame(); |
| 322 if (!contextFrame) { | 322 if (!contextFrame) { |
| 323 exceptionState.throwDOMException(InvalidAccessError, "No context frame i
s available."); | 323 exceptionState.throwDOMException(InvalidAccessError, "No context frame i
s available."); |
| 324 return 0; | 324 return 0; |
| 325 } | 325 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 return ClientRect::create(); | 815 return ClientRect::create(); |
| 816 } | 816 } |
| 817 | 817 |
| 818 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); | 818 return ClientRect::create(document->frame()->selection().absoluteCaretBounds
()); |
| 819 } | 819 } |
| 820 | 820 |
| 821 ClientRect* Internals::boundingBox(Element* element) | 821 ClientRect* Internals::boundingBox(Element* element) |
| 822 { | 822 { |
| 823 ASSERT(element); | 823 ASSERT(element); |
| 824 | 824 |
| 825 element->document().updateLayoutIgnorePendingStylesheets(); | 825 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 826 LayoutObject* layoutObject = element->layoutObject(); | 826 LayoutObject* layoutObject = element->layoutObject(); |
| 827 if (!layoutObject) | 827 if (!layoutObject) |
| 828 return ClientRect::create(); | 828 return ClientRect::create(); |
| 829 return ClientRect::create(layoutObject->absoluteBoundingBoxRectIgnoringTrans
forms()); | 829 return ClientRect::create(layoutObject->absoluteBoundingBoxRectIgnoringTrans
forms()); |
| 830 } | 830 } |
| 831 | 831 |
| 832 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc
eptionState& exceptionState) | 832 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc
eptionState& exceptionState) |
| 833 { | 833 { |
| 834 ASSERT(node); | 834 ASSERT(node); |
| 835 DocumentMarker::MarkerTypes markerTypes = 0; | 835 DocumentMarker::MarkerTypes markerTypes = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 { | 886 { |
| 887 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); | 887 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); |
| 888 if (!marker) | 888 if (!marker) |
| 889 return String(); | 889 return String(); |
| 890 return marker->description(); | 890 return marker->description(); |
| 891 } | 891 } |
| 892 | 892 |
| 893 void Internals::addTextMatchMarker(const Range* range, bool isActive) | 893 void Internals::addTextMatchMarker(const Range* range, bool isActive) |
| 894 { | 894 { |
| 895 ASSERT(range); | 895 ASSERT(range); |
| 896 range->ownerDocument().updateLayoutIgnorePendingStylesheets(); | 896 range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 897 range->ownerDocument().markers().addTextMatchMarker(range, isActive); | 897 range->ownerDocument().markers().addTextMatchMarker(range, isActive); |
| 898 } | 898 } |
| 899 | 899 |
| 900 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO
ffset, bool active) | 900 void Internals::setMarkersActive(Node* node, unsigned startOffset, unsigned endO
ffset, bool active) |
| 901 { | 901 { |
| 902 ASSERT(node); | 902 ASSERT(node); |
| 903 node->document().markers().setMarkersActive(node, startOffset, endOffset, ac
tive); | 903 node->document().markers().setMarkersActive(node, startOffset, endOffset, ac
tive); |
| 904 } | 904 } |
| 905 | 905 |
| 906 void Internals::setMarkedTextMatchesAreHighlighted(Document* document, bool high
light) | 906 void Internals::setMarkedTextMatchesAreHighlighted(Document* document, bool high
light) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 928 } | 928 } |
| 929 | 929 |
| 930 String Internals::viewportAsText(Document* document, float, int availableWidth,
int availableHeight, ExceptionState& exceptionState) | 930 String Internals::viewportAsText(Document* document, float, int availableWidth,
int availableHeight, ExceptionState& exceptionState) |
| 931 { | 931 { |
| 932 ASSERT(document); | 932 ASSERT(document); |
| 933 if (!document->page()) { | 933 if (!document->page()) { |
| 934 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 934 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 935 return String(); | 935 return String(); |
| 936 } | 936 } |
| 937 | 937 |
| 938 document->updateLayoutIgnorePendingStylesheets(); | 938 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 939 | 939 |
| 940 Page* page = document->page(); | 940 Page* page = document->page(); |
| 941 | 941 |
| 942 // Update initial viewport size. | 942 // Update initial viewport size. |
| 943 IntSize initialViewportSize(availableWidth, availableHeight); | 943 IntSize initialViewportSize(availableWidth, availableHeight); |
| 944 document->page()->deprecatedLocalMainFrame()->view()->setFrameRect(IntRect(I
ntPoint::zero(), initialViewportSize)); | 944 document->page()->deprecatedLocalMainFrame()->view()->setFrameRect(IntRect(I
ntPoint::zero(), initialViewportSize)); |
| 945 | 945 |
| 946 ViewportDescription description = page->viewportDescription(); | 946 ViewportDescription description = page->viewportDescription(); |
| 947 PageScaleConstraints constraints = description.resolve(FloatSize(initialView
portSize), Length()); | 947 PageScaleConstraints constraints = description.resolve(FloatSize(initialView
portSize), Length()); |
| 948 | 948 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 return; | 1037 return; |
| 1038 } | 1038 } |
| 1039 toHTMLFormControlElement(element)->setAutofilled(enabled); | 1039 toHTMLFormControlElement(element)->setAutofilled(enabled); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 Range* Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation,
int rangeLength) | 1042 Range* Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation,
int rangeLength) |
| 1043 { | 1043 { |
| 1044 ASSERT(scope); | 1044 ASSERT(scope); |
| 1045 | 1045 |
| 1046 // TextIterator depends on Layout information, make sure layout it up to dat
e. | 1046 // TextIterator depends on Layout information, make sure layout it up to dat
e. |
| 1047 scope->document().updateLayoutIgnorePendingStylesheets(); | 1047 scope->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1048 | 1048 |
| 1049 return createRange(PlainTextRange(rangeLocation, rangeLocation + rangeLength
).createRange(*scope)); | 1049 return createRange(PlainTextRange(rangeLocation, rangeLocation + rangeLength
).createRange(*scope)); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 unsigned Internals::locationFromRange(Element* scope, const Range* range) | 1052 unsigned Internals::locationFromRange(Element* scope, const Range* range) |
| 1053 { | 1053 { |
| 1054 ASSERT(scope && range); | 1054 ASSERT(scope && range); |
| 1055 // PlainTextRange depends on Layout information, make sure layout it up to d
ate. | 1055 // PlainTextRange depends on Layout information, make sure layout it up to d
ate. |
| 1056 scope->document().updateLayoutIgnorePendingStylesheets(); | 1056 scope->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1057 | 1057 |
| 1058 return PlainTextRange::create(*scope, *range).start(); | 1058 return PlainTextRange::create(*scope, *range).start(); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 unsigned Internals::lengthFromRange(Element* scope, const Range* range) | 1061 unsigned Internals::lengthFromRange(Element* scope, const Range* range) |
| 1062 { | 1062 { |
| 1063 ASSERT(scope && range); | 1063 ASSERT(scope && range); |
| 1064 // PlainTextRange depends on Layout information, make sure layout it up to d
ate. | 1064 // PlainTextRange depends on Layout information, make sure layout it up to d
ate. |
| 1065 scope->document().updateLayoutIgnorePendingStylesheets(); | 1065 scope->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1066 | 1066 |
| 1067 return PlainTextRange::create(*scope, *range).length(); | 1067 return PlainTextRange::create(*scope, *range).length(); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 String Internals::rangeAsText(const Range* range) | 1070 String Internals::rangeAsText(const Range* range) |
| 1071 { | 1071 { |
| 1072 ASSERT(range); | 1072 ASSERT(range); |
| 1073 return range->text(); | 1073 return range->text(); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 // FIXME: The next four functions are very similar - combine them once | 1076 // FIXME: The next four functions are very similar - combine them once |
| 1077 // bestClickableNode/bestContextMenuNode have been combined.. | 1077 // bestClickableNode/bestContextMenuNode have been combined.. |
| 1078 | 1078 |
| 1079 DOMPoint* Internals::touchPositionAdjustedToBestClickableNode(long x, long y, lo
ng width, long height, Document* document, ExceptionState& exceptionState) | 1079 DOMPoint* Internals::touchPositionAdjustedToBestClickableNode(long x, long y, lo
ng width, long height, Document* document, ExceptionState& exceptionState) |
| 1080 { | 1080 { |
| 1081 ASSERT(document); | 1081 ASSERT(document); |
| 1082 if (!document->frame()) { | 1082 if (!document->frame()) { |
| 1083 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1083 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1084 return 0; | 1084 return 0; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 document->updateLayout(); | 1087 document->updateStyleAndLayout(); |
| 1088 | 1088 |
| 1089 IntSize radius(width / 2, height / 2); | 1089 IntSize radius(width / 2, height / 2); |
| 1090 IntPoint point(x + radius.width(), y + radius.height()); | 1090 IntPoint point(x + radius.width(), y + radius.height()); |
| 1091 | 1091 |
| 1092 EventHandler& eventHandler = document->frame()->eventHandler(); | 1092 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1093 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); | 1093 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); |
| 1094 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); | 1094 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
| 1095 | 1095 |
| 1096 Node* targetNode = 0; | 1096 Node* targetNode = 0; |
| 1097 IntPoint adjustedPoint; | 1097 IntPoint adjustedPoint; |
| 1098 | 1098 |
| 1099 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); | 1099 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); |
| 1100 if (foundNode) | 1100 if (foundNode) |
| 1101 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1101 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
| 1102 | 1102 |
| 1103 return 0; | 1103 return 0; |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) | 1106 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) |
| 1107 { | 1107 { |
| 1108 ASSERT(document); | 1108 ASSERT(document); |
| 1109 if (!document->frame()) { | 1109 if (!document->frame()) { |
| 1110 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1110 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1111 return 0; | 1111 return 0; |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 document->updateLayout(); | 1114 document->updateStyleAndLayout(); |
| 1115 | 1115 |
| 1116 IntSize radius(width / 2, height / 2); | 1116 IntSize radius(width / 2, height / 2); |
| 1117 IntPoint point(x + radius.width(), y + radius.height()); | 1117 IntPoint point(x + radius.width(), y + radius.height()); |
| 1118 | 1118 |
| 1119 EventHandler& eventHandler = document->frame()->eventHandler(); | 1119 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1120 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); | 1120 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); |
| 1121 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); | 1121 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
| 1122 | 1122 |
| 1123 Node* targetNode = 0; | 1123 Node* targetNode = 0; |
| 1124 IntPoint adjustedPoint; | 1124 IntPoint adjustedPoint; |
| 1125 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); | 1125 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); |
| 1126 return targetNode; | 1126 return targetNode; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) | 1129 DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) |
| 1130 { | 1130 { |
| 1131 ASSERT(document); | 1131 ASSERT(document); |
| 1132 if (!document->frame()) { | 1132 if (!document->frame()) { |
| 1133 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1133 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1134 return 0; | 1134 return 0; |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 document->updateLayout(); | 1137 document->updateStyleAndLayout(); |
| 1138 | 1138 |
| 1139 IntSize radius(width / 2, height / 2); | 1139 IntSize radius(width / 2, height / 2); |
| 1140 IntPoint point(x + radius.width(), y + radius.height()); | 1140 IntPoint point(x + radius.width(), y + radius.height()); |
| 1141 | 1141 |
| 1142 EventHandler& eventHandler = document->frame()->eventHandler(); | 1142 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1143 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); | 1143 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); |
| 1144 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); | 1144 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
| 1145 | 1145 |
| 1146 Node* targetNode = 0; | 1146 Node* targetNode = 0; |
| 1147 IntPoint adjustedPoint; | 1147 IntPoint adjustedPoint; |
| 1148 | 1148 |
| 1149 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); | 1149 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); |
| 1150 if (foundNode) | 1150 if (foundNode) |
| 1151 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1151 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
| 1152 | 1152 |
| 1153 return DOMPoint::create(x, y); | 1153 return DOMPoint::create(x, y); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) | 1156 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) |
| 1157 { | 1157 { |
| 1158 ASSERT(document); | 1158 ASSERT(document); |
| 1159 if (!document->frame()) { | 1159 if (!document->frame()) { |
| 1160 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1160 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1161 return 0; | 1161 return 0; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 document->updateLayout(); | 1164 document->updateStyleAndLayout(); |
| 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 EventHandler& eventHandler = document->frame()->eventHandler(); | 1169 EventHandler& eventHandler = document->frame()->eventHandler(); |
| 1170 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); | 1170 IntPoint hitTestPoint = document->frame()->view()->rootFrameToContents(point
); |
| 1171 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); | 1171 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
| 1172 | 1172 |
| 1173 Node* targetNode = 0; | 1173 Node* targetNode = 0; |
| 1174 IntPoint adjustedPoint; | 1174 IntPoint adjustedPoint; |
| 1175 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); | 1175 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); |
| 1176 return targetNode; | 1176 return targetNode; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 ClientRect* Internals::bestZoomableAreaForTouchPoint(long x, long y, long width,
long height, Document* document, ExceptionState& exceptionState) | 1179 ClientRect* Internals::bestZoomableAreaForTouchPoint(long x, long y, long width,
long height, Document* document, ExceptionState& exceptionState) |
| 1180 { | 1180 { |
| 1181 ASSERT(document); | 1181 ASSERT(document); |
| 1182 if (!document->frame()) { | 1182 if (!document->frame()) { |
| 1183 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1183 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 1184 return nullptr; | 1184 return nullptr; |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 document->updateLayout(); | 1187 document->updateStyleAndLayout(); |
| 1188 | 1188 |
| 1189 IntSize radius(width / 2, height / 2); | 1189 IntSize radius(width / 2, height / 2); |
| 1190 IntPoint point(x + radius.width(), y + radius.height()); | 1190 IntPoint point(x + radius.width(), y + radius.height()); |
| 1191 | 1191 |
| 1192 Node* targetNode = 0; | 1192 Node* targetNode = 0; |
| 1193 IntRect zoomableArea; | 1193 IntRect zoomableArea; |
| 1194 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP
oint(point, radius, zoomableArea, targetNode); | 1194 bool foundNode = document->frame()->eventHandler().bestZoomableAreaForTouchP
oint(point, radius, zoomableArea, targetNode); |
| 1195 if (foundNode) | 1195 if (foundNode) |
| 1196 return ClientRect::create(zoomableArea); | 1196 return ClientRect::create(zoomableArea); |
| 1197 | 1197 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 document->view()->updateAllLifecyclePhases(); | 1695 document->view()->updateAllLifecyclePhases(); |
| 1696 | 1696 |
| 1697 return document->frame()->layerTreeAsText(flags); | 1697 return document->frame()->layerTreeAsText(flags); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep
tionState& exceptionState) const | 1700 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep
tionState& exceptionState) const |
| 1701 { | 1701 { |
| 1702 ASSERT(element); | 1702 ASSERT(element); |
| 1703 element->document().updateLayout(); | 1703 element->document().updateStyleAndLayout(); |
| 1704 | 1704 |
| 1705 LayoutObject* layoutObject = element->layoutObject(); | 1705 LayoutObject* layoutObject = element->layoutObject(); |
| 1706 if (!layoutObject || !layoutObject->isBox()) { | 1706 if (!layoutObject || !layoutObject->isBox()) { |
| 1707 exceptionState.throwDOMException(InvalidAccessError, layoutObject ? "The
provided element's layoutObject is not a box." : "The provided element has no l
ayoutObject."); | 1707 exceptionState.throwDOMException(InvalidAccessError, layoutObject ? "The
provided element's layoutObject is not a box." : "The provided element has no l
ayoutObject."); |
| 1708 return String(); | 1708 return String(); |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 PaintLayer* layer = toLayoutBox(layoutObject)->layer(); | 1711 PaintLayer* layer = toLayoutBox(layoutObject)->layer(); |
| 1712 if (!layer | 1712 if (!layer |
| 1713 || !layer->hasCompositedLayerMapping() | 1713 || !layer->hasCompositedLayerMapping() |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 if (!node) { | 1987 if (!node) { |
| 1988 document = contextDocument(); | 1988 document = contextDocument(); |
| 1989 } else if (node->isDocumentNode()) { | 1989 } else if (node->isDocumentNode()) { |
| 1990 document = toDocument(node); | 1990 document = toDocument(node); |
| 1991 } else if (isHTMLIFrameElement(*node)) { | 1991 } else if (isHTMLIFrameElement(*node)) { |
| 1992 document = toHTMLIFrameElement(*node).contentDocument(); | 1992 document = toHTMLIFrameElement(*node).contentDocument(); |
| 1993 } else { | 1993 } else { |
| 1994 exceptionState.throwTypeError("The node provided is neither a document n
or an IFrame."); | 1994 exceptionState.throwTypeError("The node provided is neither a document n
or an IFrame."); |
| 1995 return; | 1995 return; |
| 1996 } | 1996 } |
| 1997 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS
ynchronously); | 1997 document->updateStyleAndLayoutIgnorePendingStylesheets(Document::RunPostLayo
utTasksSynchronously); |
| 1998 } | 1998 } |
| 1999 | 1999 |
| 2000 void Internals::forceFullRepaint(Document* document, ExceptionState& exceptionSt
ate) | 2000 void Internals::forceFullRepaint(Document* document, ExceptionState& exceptionSt
ate) |
| 2001 { | 2001 { |
| 2002 ASSERT(document); | 2002 ASSERT(document); |
| 2003 if (!document->view()) { | 2003 if (!document->view()) { |
| 2004 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 2004 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 2005 return; | 2005 return; |
| 2006 } | 2006 } |
| 2007 | 2007 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 ClientRectList* Internals::annotatedRegions(Document* document, bool draggable,
ExceptionState& exceptionState) | 2048 ClientRectList* Internals::annotatedRegions(Document* document, bool draggable,
ExceptionState& exceptionState) |
| 2049 { | 2049 { |
| 2050 ASSERT(document); | 2050 ASSERT(document); |
| 2051 if (!document->view()) { | 2051 if (!document->view()) { |
| 2052 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 2052 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
| 2053 return ClientRectList::create(); | 2053 return ClientRectList::create(); |
| 2054 } | 2054 } |
| 2055 | 2055 |
| 2056 document->updateLayout(); | 2056 document->updateStyleAndLayout(); |
| 2057 document->view()->updateDocumentAnnotatedRegions(); | 2057 document->view()->updateDocumentAnnotatedRegions(); |
| 2058 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); | 2058 Vector<AnnotatedRegionValue> regions = document->annotatedRegions(); |
| 2059 | 2059 |
| 2060 Vector<FloatQuad> quads; | 2060 Vector<FloatQuad> quads; |
| 2061 for (size_t i = 0; i < regions.size(); ++i) { | 2061 for (size_t i = 0; i < regions.size(); ++i) { |
| 2062 if (regions[i].draggable == draggable) | 2062 if (regions[i].draggable == draggable) |
| 2063 quads.append(FloatQuad(FloatRect(regions[i].bounds))); | 2063 quads.append(FloatQuad(FloatRect(regions[i].bounds))); |
| 2064 } | 2064 } |
| 2065 return ClientRectList::create(quads); | 2065 return ClientRectList::create(quads); |
| 2066 } | 2066 } |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 } | 2588 } |
| 2589 | 2589 |
| 2590 String Internals::getProgrammaticScrollAnimationState(Node* node) const | 2590 String Internals::getProgrammaticScrollAnimationState(Node* node) const |
| 2591 { | 2591 { |
| 2592 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) | 2592 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) |
| 2593 return scrollableArea->programmaticScrollAnimator().runStateAsText(); | 2593 return scrollableArea->programmaticScrollAnimator().runStateAsText(); |
| 2594 return String(); | 2594 return String(); |
| 2595 } | 2595 } |
| 2596 | 2596 |
| 2597 } // namespace blink | 2597 } // namespace blink |
| OLD | NEW |