Bug 163353 - Share inline stylesheets between shadow trees
Summary: Share inline stylesheets between shadow trees
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 163391 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-12 13:45 PDT by Antti Koivisto
Modified: 2016-10-14 08:42 PDT (History)
5 users (show)

See Also:


Attachments
patch (8.72 KB, patch)
2016-10-12 13:48 PDT, Antti Koivisto
rniwa: review+
kling: commit-queue-
Details | Formatted Diff | Diff
patch (14.54 KB, patch)
2016-10-14 04:16 PDT, Antti Koivisto
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (1.12 MB, application/zip)
2016-10-14 04:42 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-yosemite (742.03 KB, application/zip)
2016-10-14 05:09 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (6.81 MB, application/zip)
2016-10-14 05:10 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews103 for mac-yosemite (727.35 KB, application/zip)
2016-10-14 05:29 PDT, Build Bot
no flags Details
patch (15.10 KB, patch)
2016-10-14 05:44 PDT, Antti Koivisto
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews112 for mac-yosemite (1.62 MB, application/zip)
2016-10-14 06:15 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-yosemite (690.24 KB, application/zip)
2016-10-14 06:27 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (835.23 KB, application/zip)
2016-10-14 06:30 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (6.73 MB, application/zip)
2016-10-14 06:40 PDT, Build Bot
no flags Details
patch (15.11 KB, patch)
2016-10-14 06:44 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2016-10-12 13:45:12 PDT
If shadow trees have identical inline stylesheets the data structures can be shared. This will also allow sharing style resolvers in future.
Comment 1 Antti Koivisto 2016-10-12 13:48:54 PDT
Created attachment 291390 [details]
patch
Comment 2 Andreas Kling 2016-10-12 13:54:18 PDT
Comment on attachment 291390 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291390&action=review

> Source/WebCore/dom/InlineStyleSheetOwner.cpp:192
> +        fprintf(stderr, "retrieved inline stylesheet from cache, rules=%d\n", cachedSheet->ruleCount());

Well I suppose that's good to know about...

> Source/WebCore/dom/InlineStyleSheetOwner.cpp:209
> +        fprintf(stderr, "adding stylesheet to cache, rules=%d\n", m_sheet->contents().ruleCount());

More great information!

> Source/WebCore/platform/MemoryPressureHandler.cpp:111
> +    {
> +        ReliefLogger log("Clear inline stylesheet cache");
> +        InlineStyleSheetOwner::clearCache();
> +    }

r=me based on this.
Comment 3 Ryosuke Niwa 2016-10-12 13:57:03 PDT
Comment on attachment 291390 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291390&action=review

> Source/WebCore/css/parser/CSSParserMode.h:126
> +        hash ^= URLHash::hash(key.baseURL);
> +        hash ^= StringHash::hash(key.charset);
> +        hash ^= WTF::intHash(static_cast<unsigned>(key.mode));

Is there a better way to combine hash?

> Source/WebCore/dom/InlineStyleSheetOwner.cpp:192
> +        fprintf(stderr, "retrieved inline stylesheet from cache, rules=%d\n", cachedSheet->ruleCount());

Debugging code?

> Source/WebCore/dom/InlineStyleSheetOwner.cpp:209
> +        fprintf(stderr, "adding stylesheet to cache, rules=%d\n", m_sheet->contents().ruleCount());

Debugging code?
Comment 4 Ryosuke Niwa 2016-10-12 13:57:29 PDT
Comment on attachment 291390 [details]
patch

Oops, sorry, didn't mean to clear the r+.
Comment 5 Antti Koivisto 2016-10-13 05:02:56 PDT
https://trac.webkit.org/changeset/207286
Comment 6 Darin Adler 2016-10-13 09:57:09 PDT
Comment on attachment 291390 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291390&action=review

>> Source/WebCore/css/parser/CSSParserMode.h:126
>> +        hash ^= WTF::intHash(static_cast<unsigned>(key.mode));
> 
> Is there a better way to combine hash?

Longer term, the better way to hash a bunch of things is to construct a single hasher and then hash one item after another. Doing an exclusive or of hashes is nowhere near as a good as that. To make then hashes better in cases like this one I would like us to make a hasher class that is perhaps a bit like StringBuilder and lets us easily hash a sequence of different types of data and make a single hash out of all of it. Presumably we want to usually avoid both the "exclusive or'd hashes" pattern and even the "hash of hashes" pattern.
Comment 7 Ryan Haddad 2016-10-13 10:28:05 PDT
Reverted r207286 for reason:

Caused LayoutTest http/tests/misc/acid3.html to fail.

Committed r207291: <http://trac.webkit.org/changeset/207291>
Comment 8 Ryan Haddad 2016-10-13 10:29:01 PDT
*** Bug 163391 has been marked as a duplicate of this bug. ***
Comment 9 Ryan Haddad 2016-10-13 10:29:35 PDT
(In reply to comment #7)
> Reverted r207286 for reason:
> 
> Caused LayoutTest http/tests/misc/acid3.html to fail.
> 
> Committed r207291: <http://trac.webkit.org/changeset/207291>

Details in https://bugs.webkit.org/show_bug.cgi?id=163391
Comment 10 Antti Koivisto 2016-10-14 04:16:35 PDT
Created attachment 291612 [details]
patch
Comment 11 Build Bot 2016-10-14 04:42:48 PDT
Comment on attachment 291612 [details]
patch

Attachment 291612 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2283784

Number of test failures exceeded the failure limit.
Comment 12 Build Bot 2016-10-14 04:42:51 PDT
Created attachment 291617 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 13 Build Bot 2016-10-14 05:09:11 PDT
Comment on attachment 291612 [details]
patch

Attachment 291612 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2283857

Number of test failures exceeded the failure limit.
Comment 14 Build Bot 2016-10-14 05:09:14 PDT
Created attachment 291619 [details]
Archive of layout-test-results from ews113 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 15 Build Bot 2016-10-14 05:10:30 PDT
Comment on attachment 291612 [details]
patch

Attachment 291612 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2283893

Number of test failures exceeded the failure limit.
Comment 16 Build Bot 2016-10-14 05:10:33 PDT
Created attachment 291620 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 17 Build Bot 2016-10-14 05:29:25 PDT
Comment on attachment 291612 [details]
patch

Attachment 291612 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2284000

Number of test failures exceeded the failure limit.
Comment 18 Build Bot 2016-10-14 05:29:28 PDT
Created attachment 291622 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 19 Antti Koivisto 2016-10-14 05:44:10 PDT
Created attachment 291623 [details]
patch
Comment 20 Build Bot 2016-10-14 06:15:51 PDT
Comment on attachment 291623 [details]
patch

Attachment 291623 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2284225

Number of test failures exceeded the failure limit.
Comment 21 Build Bot 2016-10-14 06:15:54 PDT
Created attachment 291626 [details]
Archive of layout-test-results from ews112 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 22 Build Bot 2016-10-14 06:27:52 PDT
Comment on attachment 291623 [details]
patch

Attachment 291623 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2284266

Number of test failures exceeded the failure limit.
Comment 23 Build Bot 2016-10-14 06:27:56 PDT
Created attachment 291628 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 24 Build Bot 2016-10-14 06:30:02 PDT
Comment on attachment 291623 [details]
patch

Attachment 291623 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2284269

Number of test failures exceeded the failure limit.
Comment 25 Build Bot 2016-10-14 06:30:05 PDT
Created attachment 291629 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 26 Build Bot 2016-10-14 06:40:19 PDT
Comment on attachment 291623 [details]
patch

Attachment 291623 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2284275

Number of test failures exceeded the failure limit.
Comment 27 Build Bot 2016-10-14 06:40:23 PDT
Created attachment 291630 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 28 Antti Koivisto 2016-10-14 06:44:51 PDT
Created attachment 291631 [details]
patch
Comment 29 Antti Koivisto 2016-10-14 08:42:40 PDT
https://trac.webkit.org/r207339