Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 6cf7bcc20ff5a4317303d38b8786c50228602fb2..aebee12801a332290d25bc8e2d3ded62b7cc3c13 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -1604,7 +1604,7 @@ void Document::recalcStyle(StyleChange change) |
| // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. |
| if (m_styleSheetCollection->needsUpdateActiveStylesheetsOnStyleRecalc()) |
| - m_styleSheetCollection->updateActiveStyleSheets(DocumentStyleSheetCollection::FullUpdate); |
| + m_styleSheetCollection->updateActiveStyleSheets(FullStyleUpdate); |
| InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this); |
| @@ -2605,13 +2605,15 @@ void Document::didRemoveAllPendingStylesheet() |
| { |
| m_needsNotifyRemoveAllPendingStylesheet = false; |
| - styleResolverChanged(RecalcStyleIfNeeded); |
| + styleResolverChanged(DeferRecalcStyle, OptimizedStyleUpdate); |
| if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
| parser->executeScriptsWaitingForStylesheets(); |
|
adamk
2013/05/13 20:48:37
Do you know if there are tests covering this code
|
| - if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) |
| + if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) { |
| + updateStyleIfNeeded(); |
| view()->scrollToFragment(m_url); |
| + } |
| } |
| CSSStyleSheet* Document::elementSheet() |
| @@ -2958,7 +2960,7 @@ void Document::evaluateMediaQueryList() |
| m_mediaQueryMatcher->styleResolverChanged(); |
| } |
| -void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag) |
| +void Document::styleResolverChanged(StyleResolverUpdateType updateType, StyleResolverUpdateMode updateMode) |
| { |
| // Don't bother updating, since we haven't loaded all our style info yet |
| // and haven't calculated the style selector for the first time. |
| @@ -2973,15 +2975,7 @@ void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag) |
| printf("Beginning update of style selector at time %d.\n", elapsedTime()); |
| #endif |
| - DocumentStyleSheetCollection::UpdateFlag styleSheetUpdate = (updateFlag == RecalcStyleIfNeeded) |
| - ? DocumentStyleSheetCollection::OptimizedUpdate |
| - : DocumentStyleSheetCollection::FullUpdate; |
| - bool stylesheetChangeRequiresStyleRecalc = m_styleSheetCollection->updateActiveStyleSheets(styleSheetUpdate); |
| - |
| - if (updateFlag == DeferRecalcStyle) { |
| - scheduleForcedStyleRecalc(); |
| - return; |
| - } |
| + bool needsRecalc = m_styleSheetCollection->updateActiveStyleSheets(updateMode); |
| if (didLayoutWithPendingStylesheets() && !m_styleSheetCollection->hasPendingSheets()) { |
| m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; |
| @@ -2989,12 +2983,12 @@ void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag) |
| renderView()->repaintViewAndCompositedLayers(); |
| } |
| - if (!stylesheetChangeRequiresStyleRecalc) |
| + if (!needsRecalc) |
| return; |
| - // This recalcStyle initiates a new recalc cycle. We need to bracket it to |
| - // make sure animations get the correct update time |
| - { |
| + if (updateType >= DeferRecalcStyle) |
| + scheduleForcedStyleRecalc(); |
| + else { |
| AnimationUpdateBlock animationUpdateBlock(m_frame ? m_frame->animation() : 0); |
| recalcStyle(Force); |
| } |