https://bugs.webkit.org/show_bug.cgi?id=81939
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2012 20:20:19 +0000 (20:20 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Apr 2012 20:20:19 +0000 (20:20 +0000)
commit82e6912151a8adda9250f92c2e007854bd0399a8
treed774fa76f3304629d566c6723c4ceb99749e9deb
parent2a9f89a149cd24424b791ced9e3ff5a3dfff5d3c
https://bugs.webkit.org/show_bug.cgi?id=81939
-webkit-image-set should update dynamically when the device scale factor
changes
-and corresponding-
<rdar://problem/11101108>

Reviewed by Darin Adler.

Source/WebCore:

New member variable to keep track of the scale factor.
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::CSSImageSetValue):
(WebCore::CSSImageSetValue::bestImageForScaleFactor):

 Merge the two cachedImageSet functions. There was no need for two functions here.
(WebCore::CSSImageSetValue::cachedImageSet):

cachedOrPendingImageSet() now takes a Document as a parameter so that it can
access the deviceScaleFactor. If there is a cached image already and the
Document's deviceScaleFactor doesn't match m_scaleFactor, then m_imageSet is set
to a pending image so that the best fit image will be reassessed and then
loaded.
(WebCore::CSSImageSetValue::cachedOrPendingImageSet):
* css/CSSImageSetValue.h:
(WebCore):
(CSSImageSetValue):

cachedOrPendingImageSet() now takes a Document.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):

StyleCachedImageSet should inherit from CachedImageClient just like
StyleCachedImage. It should add and remove itself as a client upon creation
and destruction, respectively.
* rendering/style/StyleCachedImageSet.cpp:
(WebCore::StyleCachedImageSet::StyleCachedImageSet):
(WebCore):
(WebCore::StyleCachedImageSet::~StyleCachedImageSet):
* rendering/style/StyleCachedImageSet.h:
(StyleCachedImageSet):

LayoutTests:

* fast/hidpi/image-set-background-dynamic.html: Added.
* fast/hidpi/image-set-border-image-dynamic.html: Added.
* fast/hidpi/image-set-in-content-dynamic.html: Added.
* platform/mac/fast/hidpi/image-set-background-dynamic-expected.png: Added.
* platform/mac/fast/hidpi/image-set-background-dynamic-expected.txt: Added.
* platform/mac/fast/hidpi/image-set-border-image-dynamic-expected.png: Added.
* platform/mac/fast/hidpi/image-set-border-image-dynamic-expected.txt: Added.
* platform/mac/fast/hidpi/image-set-in-content-dynamic-expected.png: Added.
* platform/mac/fast/hidpi/image-set-in-content-dynamic-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@113490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/hidpi/image-set-background-dynamic.html [new file with mode: 0644]
LayoutTests/fast/hidpi/image-set-border-image-dynamic.html [new file with mode: 0644]
LayoutTests/fast/hidpi/image-set-in-content-dynamic.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-background-dynamic-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-background-dynamic-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-border-image-dynamic-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-border-image-dynamic-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-in-content-dynamic-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/hidpi/image-set-in-content-dynamic-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSImageSetValue.cpp
Source/WebCore/css/CSSImageSetValue.h
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/rendering/style/StyleCachedImageSet.cpp
Source/WebCore/rendering/style/StyleCachedImageSet.h