| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "core/HTMLElementFactory.h" | 40 #include "core/HTMLElementFactory.h" |
| 41 #include "core/animation/AnimationTimeline.h" | 41 #include "core/animation/AnimationTimeline.h" |
| 42 #include "core/animation/DocumentAnimations.h" | 42 #include "core/animation/DocumentAnimations.h" |
| 43 #include "core/css/CSSFontSelector.h" | 43 #include "core/css/CSSFontSelector.h" |
| 44 #include "core/css/CSSStyleDeclaration.h" | 44 #include "core/css/CSSStyleDeclaration.h" |
| 45 #include "core/css/CSSStyleSheet.h" | 45 #include "core/css/CSSStyleSheet.h" |
| 46 #include "core/css/MediaQueryMatcher.h" | 46 #include "core/css/MediaQueryMatcher.h" |
| 47 #include "core/css/StylePropertySet.h" | 47 #include "core/css/StylePropertySet.h" |
| 48 #include "core/css/StyleSheetContents.h" | 48 #include "core/css/StyleSheetContents.h" |
| 49 #include "core/css/StyleSheetList.h" | 49 #include "core/css/StyleSheetList.h" |
| 50 #include "core/css/invalidation/StyleInvalidator.h" | |
| 51 #include "core/css/parser/BisonCSSParser.h" | 50 #include "core/css/parser/BisonCSSParser.h" |
| 52 #include "core/css/resolver/FontBuilder.h" | 51 #include "core/css/resolver/FontBuilder.h" |
| 53 #include "core/css/resolver/StyleResolver.h" | 52 #include "core/css/resolver/StyleResolver.h" |
| 54 #include "core/css/resolver/StyleResolverStats.h" | 53 #include "core/css/resolver/StyleResolverStats.h" |
| 55 #include "core/dom/Attr.h" | 54 #include "core/dom/Attr.h" |
| 56 #include "core/dom/DocumentFragment.h" | 55 #include "core/dom/DocumentFragment.h" |
| 57 #include "core/dom/DocumentLifecycleNotifier.h" | 56 #include "core/dom/DocumentLifecycleNotifier.h" |
| 58 #include "core/dom/DocumentLifecycleObserver.h" | 57 #include "core/dom/DocumentLifecycleObserver.h" |
| 59 #include "core/dom/DocumentMarkerController.h" | 58 #include "core/dom/DocumentMarkerController.h" |
| 60 #include "core/dom/Element.h" | 59 #include "core/dom/Element.h" |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 } | 1011 } |
| 1013 | 1012 |
| 1014 bool Document::needsRenderTreeUpdate() const | 1013 bool Document::needsRenderTreeUpdate() const |
| 1015 { | 1014 { |
| 1016 if (!isActive() || !view()) | 1015 if (!isActive() || !view()) |
| 1017 return false; | 1016 return false; |
| 1018 if (needsFullRenderTreeUpdate()) | 1017 if (needsFullRenderTreeUpdate()) |
| 1019 return true; | 1018 return true; |
| 1020 if (childNeedsStyleRecalc()) | 1019 if (childNeedsStyleRecalc()) |
| 1021 return true; | 1020 return true; |
| 1022 if (childNeedsStyleInvalidation()) | |
| 1023 return true; | |
| 1024 return false; | 1021 return false; |
| 1025 } | 1022 } |
| 1026 | 1023 |
| 1027 bool Document::needsFullRenderTreeUpdate() const | 1024 bool Document::needsFullRenderTreeUpdate() const |
| 1028 { | 1025 { |
| 1029 if (!isActive() || !view()) | 1026 if (!isActive() || !view()) |
| 1030 return false; | 1027 return false; |
| 1031 if (needsStyleRecalc()) | 1028 if (needsStyleRecalc()) |
| 1032 return true; | 1029 return true; |
| 1033 if (needsStyleInvalidation()) | |
| 1034 return true; | |
| 1035 // FIXME: The childNeedsDistributionRecalc bit means either self or children
, we should fix that. | 1030 // FIXME: The childNeedsDistributionRecalc bit means either self or children
, we should fix that. |
| 1036 if (childNeedsDistributionRecalc()) | 1031 if (childNeedsDistributionRecalc()) |
| 1037 return true; | 1032 return true; |
| 1038 if (DocumentAnimations::needsOutdatedAnimationPlayerUpdate(*this)) | 1033 if (DocumentAnimations::needsOutdatedAnimationPlayerUpdate(*this)) |
| 1039 return true; | 1034 return true; |
| 1040 return false; | 1035 return false; |
| 1041 } | 1036 } |
| 1042 | 1037 |
| 1043 bool Document::shouldScheduleRenderTreeUpdate() const | 1038 bool Document::shouldScheduleRenderTreeUpdate() const |
| 1044 { | 1039 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1075 void Document::updateDistributionIfNeeded() | 1070 void Document::updateDistributionIfNeeded() |
| 1076 { | 1071 { |
| 1077 ScriptForbiddenScope forbidScript; | 1072 ScriptForbiddenScope forbidScript; |
| 1078 | 1073 |
| 1079 if (!childNeedsDistributionRecalc()) | 1074 if (!childNeedsDistributionRecalc()) |
| 1080 return; | 1075 return; |
| 1081 TRACE_EVENT0("blink", "Document::updateDistributionIfNeeded"); | 1076 TRACE_EVENT0("blink", "Document::updateDistributionIfNeeded"); |
| 1082 recalcDistribution(); | 1077 recalcDistribution(); |
| 1083 } | 1078 } |
| 1084 | 1079 |
| 1085 void Document::updateStyleInvalidationIfNeeded() | |
| 1086 { | |
| 1087 ScriptForbiddenScope forbidScript; | |
| 1088 | |
| 1089 if (!isActive()) | |
| 1090 return; | |
| 1091 if (!childNeedsStyleInvalidation()) | |
| 1092 return; | |
| 1093 TRACE_EVENT0("blink", "Document::updateStyleInvalidationIfNeeded"); | |
| 1094 ASSERT(styleResolver()); | |
| 1095 | |
| 1096 styleResolver()->ruleFeatureSet().styleInvalidator().invalidate(*this); | |
| 1097 } | |
| 1098 | |
| 1099 void Document::updateDistributionForNodeIfNeeded(Node* node) | 1080 void Document::updateDistributionForNodeIfNeeded(Node* node) |
| 1100 { | 1081 { |
| 1101 ScriptForbiddenScope forbidScript; | 1082 ScriptForbiddenScope forbidScript; |
| 1102 | 1083 |
| 1103 if (node->inDocument()) { | 1084 if (node->inDocument()) { |
| 1104 updateDistributionIfNeeded(); | 1085 updateDistributionIfNeeded(); |
| 1105 return; | 1086 return; |
| 1106 } | 1087 } |
| 1107 Node* root = node; | 1088 Node* root = node; |
| 1108 while (Node* host = root->shadowHost()) | 1089 while (Node* host = root->shadowHost()) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); | 1132 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); |
| 1152 | 1133 |
| 1153 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC
ount() on the resolver. | 1134 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC
ount() on the resolver. |
| 1154 m_styleRecalcElementCounter = 0; | 1135 m_styleRecalcElementCounter = 0; |
| 1155 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul
ateStyles", "frame", frame()); | 1136 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul
ateStyles", "frame", frame()); |
| 1156 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | 1137 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 1157 | 1138 |
| 1158 DocumentAnimations::updateOutdatedAnimationPlayersIfNeeded(*this); | 1139 DocumentAnimations::updateOutdatedAnimationPlayersIfNeeded(*this); |
| 1159 evaluateMediaQueryListIfNeeded(); | 1140 evaluateMediaQueryListIfNeeded(); |
| 1160 updateDistributionIfNeeded(); | 1141 updateDistributionIfNeeded(); |
| 1161 updateStyleInvalidationIfNeeded(); | |
| 1162 | 1142 |
| 1163 // FIXME: We should update style on our ancestor chain before proceeding | 1143 // FIXME: We should update style on our ancestor chain before proceeding |
| 1164 // however doing so currently causes several tests to crash, as LocalFrame::
setDocument calls Document::attach | 1144 // however doing so currently causes several tests to crash, as LocalFrame::
setDocument calls Document::attach |
| 1165 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi
n on the document. The attach, in turn | 1145 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi
n on the document. The attach, in turn |
| 1166 // resolves style (here) and then when we resolve style on the parent chain,
we may end up | 1146 // resolves style (here) and then when we resolve style on the parent chain,
we may end up |
| 1167 // re-attaching our containing iframe, which when asked HTMLFrameElementBase
::isURLAllowed | 1147 // re-attaching our containing iframe, which when asked HTMLFrameElementBase
::isURLAllowed |
| 1168 // hits a null-dereference due to security code always assuming the document
has a SecurityOrigin. | 1148 // hits a null-dereference due to security code always assuming the document
has a SecurityOrigin. |
| 1169 | 1149 |
| 1170 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) | 1150 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) |
| 1171 m_styleEngine->setUsesRemUnit(true); | 1151 m_styleEngine->setUsesRemUnit(true); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 ASSERT(!childNeedsStyleRecalc()); | 1221 ASSERT(!childNeedsStyleRecalc()); |
| 1242 ASSERT(inStyleRecalc()); | 1222 ASSERT(inStyleRecalc()); |
| 1243 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 1223 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1244 } | 1224 } |
| 1245 | 1225 |
| 1246 void Document::updateRenderTreeForNodeIfNeeded(Node* node) | 1226 void Document::updateRenderTreeForNodeIfNeeded(Node* node) |
| 1247 { | 1227 { |
| 1248 bool needsRecalc = needsFullRenderTreeUpdate(); | 1228 bool needsRecalc = needsFullRenderTreeUpdate(); |
| 1249 | 1229 |
| 1250 for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeR
enderingTraversal::parent(ancestor)) | 1230 for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeR
enderingTraversal::parent(ancestor)) |
| 1251 needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvali
dation(); | 1231 needsRecalc = ancestor->needsStyleRecalc(); |
| 1252 | 1232 |
| 1253 if (needsRecalc) | 1233 if (needsRecalc) |
| 1254 updateRenderTreeIfNeeded(); | 1234 updateRenderTreeIfNeeded(); |
| 1255 } | 1235 } |
| 1256 | 1236 |
| 1257 void Document::updateLayout() | 1237 void Document::updateLayout() |
| 1258 { | 1238 { |
| 1259 ASSERT(isMainThread()); | 1239 ASSERT(isMainThread()); |
| 1260 | 1240 |
| 1261 ScriptForbiddenScope forbidScript; | 1241 ScriptForbiddenScope forbidScript; |
| (...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 using namespace blink; | 2980 using namespace blink; |
| 3001 void showLiveDocumentInstances() | 2981 void showLiveDocumentInstances() |
| 3002 { | 2982 { |
| 3003 WeakDocumentSet& set = liveDocumentSet(); | 2983 WeakDocumentSet& set = liveDocumentSet(); |
| 3004 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2984 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 3005 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2985 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 3006 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2986 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 3007 } | 2987 } |
| 3008 } | 2988 } |
| 3009 #endif | 2989 #endif |
| OLD | NEW |