Mixing Content Blocking of fonts and display:none rules causes battery drain
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 03:31:52 +0000 (03:31 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2016 03:31:52 +0000 (03:31 +0000)
commitdec46b1a6e3fd485db1ac8adb7693d68247e856a
tree861287ba3eb1365bb4ed077b875b0c6eccbf51fa
parent02cb9748e2dd130e6b646252ceec1e016b9e3599
Mixing Content Blocking of fonts and display:none rules causes battery drain
https://bugs.webkit.org/show_bug.cgi?id=153051
<rdar://problem/23187709>

Reviewed by Alex Christensen.

Source/WebCore:

If we have applied a rule before and we are not applying it again, don't
resolve the style again.

Test: http/tests/contentextensions/font-display-none-repeated-layout.html

* contentextensions/ContentExtensionStyleSheet.cpp:
(WebCore::ContentExtensions::ContentExtensionStyleSheet::addDisplayNoneSelector):
* contentextensions/ContentExtensionStyleSheet.h:
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::addDisplayNoneSelector):

LayoutTests:

Make sure that layoutCount does not skyrocket.

* http/tests/contentextensions/font-display-none-repeated-layout-expected.txt: Added.
* http/tests/contentextensions/font-display-none-repeated-layout.html: Added.
* http/tests/contentextensions/font-display-none-repeated-layout.html.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html.json [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/ContentExtensionStyleSheet.cpp
Source/WebCore/contentextensions/ContentExtensionStyleSheet.h
Source/WebCore/dom/ExtensionStyleSheets.cpp