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