Bug 119475

Summary: Inserting a rule into an empty style sheet shouldn't trigger style recalc unless necessary.
Product: WebKit Reporter: Andreas Kling <kling>
Component: CSSAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, esprehn+autocc, glenn, kangil.han, kling, koivisto, macpherson, menard, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar, Performance
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch idea
koivisto: review+
Crazier patch idea
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion
none
Slightly less crazy patch idea
none
Wider patch idea koivisto: review+

Description Andreas Kling 2013-08-04 00:28:28 PDT
Inserting a rule into an empty style sheet shouldn't trigger style recalc.
Comment 1 Radar WebKit Bug Importer 2013-08-04 00:28:39 PDT
<rdar://problem/14643481>
Comment 2 Andreas Kling 2013-08-04 00:31:37 PDT
Created attachment 208080 [details]
Patch idea
Comment 3 Andreas Kling 2013-08-04 03:26:34 PDT
Created attachment 208085 [details]
Crazier patch idea

Another approach. This one supports multiple insertions.
Comment 4 Andreas Kling 2013-08-04 03:55:40 PDT
Comment on attachment 208085 [details]
Crazier patch idea

Actually, this is not quite correct. The existing invalidation analysis would not detect insertion into a non-empty active sheet, and fail to trigger recalc in that case.
Comment 5 Build Bot 2013-08-04 05:56:03 PDT
Comment on attachment 208085 [details]
Crazier patch idea

Attachment 208085 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1342794

New failing tests:
media/track/track-css-user-override.html
inspector/styles/undo-add-new-rule.html
http/tests/css/shared-stylesheet-mutation.html
http/tests/misc/acid3.html
inspector/styles/styles-add-new-rule.html
css3/filters/custom/custom-filter-property-computed-style.html
fast/shapes/shape-inside/shape-inside-simple-polygon-001.html
fast/shapes/shape-inside/shape-inside-regular-polygon16.html
fast/shapes/shape-inside/shape-inside-outside-shape.html
http/tests/css/shared-stylesheet-mutation-preconstruct.html
fast/shapes/shape-inside/shape-inside-simple-polygon-003.html
css3/filters/filter-property-computed-style.html
fast/css/pseudo-valid-dynamic.html
fast/shapes/shape-inside/shape-inside-regular-polygon8.html
fast/media/mq-pixel-ratio-print.html
fast/shapes/shape-inside/shape-inside-simple-polygon-004.html
fast/shapes/shape-inside/shape-inside-simple-polygon-002.html
Comment 6 Build Bot 2013-08-04 05:56:05 PDT
Created attachment 208089 [details]
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-05  Port: mac-mountainlion  Platform: Mac OS X 10.8.4
Comment 7 Build Bot 2013-08-04 06:54:34 PDT
Comment on attachment 208085 [details]
Crazier patch idea

Attachment 208085 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1333761

New failing tests:
media/track/track-css-user-override.html
inspector/styles/undo-add-new-rule.html
http/tests/css/shared-stylesheet-mutation.html
http/tests/misc/acid3.html
inspector/styles/styles-add-new-rule.html
css3/filters/custom/custom-filter-property-computed-style.html
fast/shapes/shape-inside/shape-inside-simple-polygon-001.html
fast/shapes/shape-inside/shape-inside-regular-polygon16.html
fast/shapes/shape-inside/shape-inside-outside-shape.html
http/tests/css/shared-stylesheet-mutation-preconstruct.html
fast/shapes/shape-inside/shape-inside-simple-polygon-003.html
css3/filters/filter-property-computed-style.html
fast/css/pseudo-valid-dynamic.html
fast/shapes/shape-inside/shape-inside-regular-polygon8.html
fast/media/mq-pixel-ratio-print.html
fast/shapes/shape-inside/shape-inside-simple-polygon-004.html
fast/shapes/shape-inside/shape-inside-simple-polygon-002.html
Comment 8 Build Bot 2013-08-04 06:54:37 PDT
Created attachment 208090 [details]
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-06  Port: mac-mountainlion  Platform: Mac OS X 10.8.4
Comment 9 Andreas Kling 2013-08-04 07:39:41 PDT
Created attachment 208091 [details]
Slightly less crazy patch idea
Comment 10 Andreas Kling 2013-08-04 07:43:31 PDT
Created attachment 208092 [details]
Wider patch idea
Comment 11 Antti Koivisto 2013-08-04 08:32:51 PDT
Comment on attachment 208092 [details]
Wider patch idea

Nice. r=me
Comment 12 Antti Koivisto 2013-08-04 08:41:32 PDT
Comment on attachment 208080 [details]
Patch idea

Might be good to land the simple version first
Comment 13 Andreas Kling 2013-08-04 08:56:19 PDT
Committed r153699: <http://trac.webkit.org/changeset/153699>