| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index c707ba453eb701be02c352b19da2ee3cce0ab4e6..48589478ae6f8c699b7540bf79696a6ccb1ee8cd 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -1538,6 +1538,20 @@ void Document::updateDistributionIfNeeded()
|
| recalcDistribution();
|
| }
|
|
|
| +void Document::updateInvalidationIfNeeded()
|
| +{
|
| + if (!childNeedsInvalidation())
|
| + return;
|
| + TRACE_EVENT0("webkit", "Document::recalcInvalidation");
|
| + if (!styleResolver()) {
|
| + clearChildNeedsInvalidation();
|
| + return;
|
| + }
|
| +
|
| + if (RuleSetAnalyzer* analyzer = styleResolver()->ensureRuleFeatureSet().getRuleSetAnalyzer())
|
| + analyzer->recalcInvalidation(this);
|
| +}
|
| +
|
| void Document::updateDistributionForNodeIfNeeded(Node* node)
|
| {
|
| if (node->inDocument()) {
|
| @@ -1617,22 +1631,32 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
|
| documentElement()->setNeedsStyleRecalc();
|
| }
|
| }
|
| +static bool debug = false;
|
|
|
| void Document::recalcStyle(StyleRecalcChange change)
|
| {
|
| // we should not enter style recalc while painting
|
| RELEASE_ASSERT(!view() || !view()->isPainting());
|
| -
|
| + if (debug)
|
| + printf("----------------- Document::recalcStyle\n");
|
| // FIXME: We should never enter here without a FrameView or with an inactive document.
|
| - if (!isActive() || !view())
|
| + if (!isActive() || !view()) {
|
| + if (debug)
|
| + printf("document::recalcstyle...not active or view?\n");
|
| return;
|
| + }
|
|
|
| - if (m_inStyleRecalc)
|
| + if (m_inStyleRecalc) {
|
| + if (debug)
|
| + printf("document::recalcstyle...m_inStyleRecalc is true?\n");
|
| return;
|
| + }
|
|
|
| TRACE_EVENT0("webkit", "Document::recalcStyle");
|
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "RecalcStyle");
|
|
|
| + updateInvalidationIfNeeded();
|
| +
|
| updateDistributionIfNeeded();
|
|
|
| InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
|
| @@ -1721,14 +1745,18 @@ void Document::recalcStyle(StyleRecalcChange change)
|
| // to check if any other elements ended up under the mouse pointer due to re-layout.
|
| if (hoverNode() && !hoverNode()->renderer() && frame())
|
| frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
|
| + if (debug)
|
| + printf("********************** Document::recalcStyle DONE\n\n");
|
| }
|
|
|
| +
|
| void Document::updateStyleIfNeeded()
|
| {
|
| ASSERT(isMainThread());
|
| ASSERT(!view() || (!view()->isInLayout() && !view()->isPainting()));
|
|
|
| - if (!needsStyleRecalc() && !childNeedsStyleRecalc() && !childNeedsDistributionRecalc())
|
| + // FIXME: unify this logic with shouldRecalcStyle()
|
| + if (!needsStyleRecalc() && !childNeedsStyleRecalc() && !childNeedsDistributionRecalc() && !childNeedsInvalidation())
|
| return;
|
|
|
| RefPtr<Frame> holder(m_frame);
|
| @@ -1739,14 +1767,20 @@ void Document::updateStyleIfNeeded()
|
|
|
| void Document::updateStyleForNodeIfNeeded(Node* node)
|
| {
|
| - if (!hasPendingForcedStyleRecalc() && !childNeedsStyleRecalc() && !needsStyleRecalc())
|
| + if (debug)
|
| + printf("Document::updateStyleForNodeIfNeeded\n");
|
| + // FIXME: Why is this different than updateStyleIfNeeded???
|
| + if (!hasPendingForcedStyleRecalc() && !childNeedsStyleRecalc() && !needsStyleRecalc() && !childNeedsInvalidation())
|
| return;
|
|
|
| bool needsStyleRecalc = hasPendingForcedStyleRecalc();
|
| for (Node* ancestor = node; ancestor && !needsStyleRecalc; ancestor = ancestor->parentOrShadowHostNode())
|
| - needsStyleRecalc = ancestor->needsStyleRecalc();
|
| - if (needsStyleRecalc)
|
| + needsStyleRecalc = ancestor->needsStyleRecalc() || ancestor->needsInvalidation();
|
| + if (needsStyleRecalc) {
|
| + if (debug)
|
| + printf("updateStyleForNodeIfNeeded calls updateStyleIfNeeded\n");
|
| updateStyleIfNeeded();
|
| + }
|
| }
|
|
|
| void Document::updateLayout()
|
|
|