New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 614026 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Repeatedly adding and removing the same stylesheet grows viewportDependentMediaQueryResults

Reported by r...@opera.com, May 23 2016

Issue description

We never reset m_viewportDependentMediaQueryResults in StyleResolver unless we clear the resolver. For certain operations where we end up with a Reset for AnalyzedStyleUpdate, it means the vector may grow large without increasing the number of stylesheets.

With the attached vpdep.html, observe in the debugger that the array grows.

 
vpdep.html
324 bytes View Download
Labels: Performance-Memory

Comment 2 by r...@opera.com, Oct 24 2016

Owner: r...@opera.com
Status: Started (was: Available)
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 24 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4462ce68a6f0808d4f3d7e530b4920250d3675fd

commit 4462ce68a6f0808d4f3d7e530b4920250d3675fd
Author: rune <rune@opera.com>
Date: Thu Nov 24 19:50:19 2016

Move MediaQueryResults to RuleFeatureSet.

The existing code only cleared the query results on the StyleResolver
when the StyleResolver was cleared. That meant we could end up in a
situation where the result list was ever-growing. That wasn't a big
issue in practice as the StyleResolver would be cleared quite often on
stylesheet changes. However, that will change when the RuleSet based
style invalidation is enabled.

We move the media query results to RuleFeatureSet so that:

- Results for @media rules are stored in RuleFeatureSet instead of
  RuleSet.
- Results for media attributes are stored in the ScopedStyleResolver
  when added instead of appending them directly to StyleResolver.
- Accumulated results for all scopes are stored in CSSGlobalRuleSet
  on StyleEngine instead of StyleResolver and are accumulated with
  other rule features in ScopedStyleResolver::collectFeaturesTo().

This CL introduces StyleEngine::ruleSetForSheet() for evaluating the
media attribute of the stylesheet node and create the RuleSet if the
media attribute matches. That way we are able to make the
MediaQueryEvaluator private to StyleEngine. Also, this method is
required when we start using ActiveStyleSheets.

R=meade@chromium.org
BUG= 567021 , 614026 

Review-Url: https://codereview.chromium.org/2528633003
Cr-Commit-Position: refs/heads/master@{#434383}

[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/CSSStyleSheet.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/RuleFeature.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/RuleFeature.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/RuleSet.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/RuleSet.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/css/resolver/StyleResolver.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/dom/StyleEngine.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/dom/StyleEngine.h
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
[modify] https://crrev.com/4462ce68a6f0808d4f3d7e530b4920250d3675fd/third_party/WebKit/Source/core/frame/FrameView.cpp

Comment 4 by r...@opera.com, Nov 24 2016

Status: Fixed (was: Started)

Sign in to add a comment