| Differences between
and this patch
- a/LayoutTests/ChangeLog +31 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-11-14  Tim Horton  <timothy_horton@apple.com>
2
3
        Implement CSS3 Images cross-fade() image function
4
        https://bugs.webkit.org/show_bug.cgi?id=52162
5
        <rdar://problem/10209254>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Add tests of -webkit-cross-fade, ensuring that simple cross-fades between
10
        two images work correctly.
11
12
        * css3/images/cross-fade-invalidation.html: Added.
13
        * css3/images/cross-fade-simple.html: Added.
14
        * css3/images/cross-fade-sizing.html: Added.
15
        * css3/images/cross-fade-tiled.html: Added.
16
        * css3/images/resources/blue-10.png: Added.
17
        * css3/images/resources/blue-100.png: Added.
18
        * css3/images/resources/green-10.png: Added.
19
        * css3/images/resources/green-100.png: Added.
20
        * css3/images/resources/green-circle.svg: Added.
21
        * css3/images/resources/red-10.png: Added.
22
        * css3/images/resources/red-100.png: Added.
23
        * platform/mac/css3/images/cross-fade-invalidation-expected.png: Added.
24
        * platform/mac/css3/images/cross-fade-invalidation-expected.txt: Added.
25
        * platform/mac/css3/images/cross-fade-simple-expected.png: Added.
26
        * platform/mac/css3/images/cross-fade-simple-expected.txt: Added.
27
        * platform/mac/css3/images/cross-fade-sizing-expected.png: Added.
28
        * platform/mac/css3/images/cross-fade-sizing-expected.txt: Added.
29
        * platform/mac/css3/images/cross-fade-tiled-expected.png: Added.
30
        * platform/mac/css3/images/cross-fade-tiled-expected.txt: Added.
31
1
2011-11-14  Michael Nordman  <michaeln@google.com>
32
2011-11-14  Michael Nordman  <michaeln@google.com>
2
33
3
        Update layout tests for  new websql error messages and console logging.
34
        Update layout tests for  new websql error messages and console logging.
- a/LayoutTests/css3/images/cross-fade-invalidation.html +21 lines
Line 0 a/LayoutTests/css3/images/cross-fade-invalidation.html_sec1
1
<html>
2
<style>
3
div
4
{
5
	width: 100px;
6
	height: 100px;
7
	margin: 10px;
8
}
9
</style>
10
<script>
11
if(window.layoutTestController)
12
    layoutTestController.waitUntilDone();
13
14
setTimeout(function() {
15
    if(window.layoutTestController)
16
	layoutTestController.notifyDone();
17
}, 100);
18
</script>
19
<!--The first cross-fade should appear as a light green square with a darker green circle inside it.-->
20
<div style="background-image: -webkit-cross-fade(url(resources/green-circle.svg), url(resources/green-100.png), 50%);"></div>
21
</html>
- a/LayoutTests/css3/images/cross-fade-simple.html +16 lines
Line 0 a/LayoutTests/css3/images/cross-fade-simple.html_sec1
1
<html>
2
<style>
3
div
4
{
5
	width: 100px;
6
	height: 100px;
7
	margin: 10px;
8
}
9
</style>
10
<!--The first cross-fade should appear as a 100% green square, 100x100px.-->
11
<div style="background-image: -webkit-cross-fade(url(resources/red-100.png), url(resources/green-100.png), 100%);"></div>
12
<!--The second cross-fade should appear as a 100% green square, 100x100px.-->
13
<div style="background-image: -webkit-cross-fade(url(resources/green-100.png), url(resources/red-100.png), 0%);"></div>
14
<!--The third cross-fade should appear as a blue-green square, 100x100px.-->
15
<div style="background-image: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%);"></div>
16
</html>
- a/LayoutTests/css3/images/cross-fade-sizing.html +16 lines
Line 0 a/LayoutTests/css3/images/cross-fade-sizing.html_sec1
1
<html>
2
<style>
3
div
4
{
5
	width: 100px;
6
	height: 100px;
7
	margin: 10px;
8
}
9
</style>
10
<!--The first cross-fade should appear as a 100% green square, 10x10px.-->
11
<div style="background-image: -webkit-cross-fade(url(resources/red-100.png), url(resources/green-10.png), 100%);"></div>
12
<!--The second cross-fade should appear as a 100% green square, 100x100px.-->
13
<div style="background-image: -webkit-cross-fade(url(resources/green-100.png), url(resources/red-10.png), 0%);"></div>
14
<!--The third cross-fade should appear as a blue-green square, 55x55px.-->
15
<div style="background-image: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-10.png), 50%);"></div>
16
</html>
- a/LayoutTests/css3/images/cross-fade-tiled.html +19 lines
Line 0 a/LayoutTests/css3/images/cross-fade-tiled.html_sec1
1
<html>
2
<style>
3
div
4
{
5
	width: 100px;
6
	height: 100px;
7
	margin: 10px;
8
9
	-webkit-transform:translateZ(0);
10
	border: 1px solid black;
11
}
12
</style>
13
<!--The first cross-fade should appear as a 100% green square, 100x100px.-->
14
<div style="background-image: -webkit-cross-fade(url(resources/red-100.png), url(resources/green-100.png), 100%);"></div>
15
<!--The second cross-fade should appear as a 100% green square, 100x100px.-->
16
<div style="background-image: -webkit-cross-fade(url(resources/green-100.png), url(resources/red-100.png), 0%);"></div>
17
<!--The third cross-fade should appear as a blue-green square, 100x100px.-->
18
<div style="background-image: -webkit-cross-fade(url(resources/blue-100.png), url(resources/green-100.png), 50%);"></div>
19
</html>
- a/LayoutTests/css3/images/resources/green-circle.svg +5 lines
Line 0 a/LayoutTests/css3/images/resources/green-circle.svg_sec1
1
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
2
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="2" fill="red">
3
      <animate attributeName="fill" from="red" to="green" begin="0s" dur="0.01s" fill="freeze" />
4
  </circle>
5
</svg>
- a/LayoutTests/platform/mac/css3/images/cross-fade-invalidation-expected.txt +6 lines
Line 0 a/LayoutTests/platform/mac/css3/images/cross-fade-invalidation-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x600
4
  RenderBlock {HTML} at (0,0) size 800x600
5
    RenderBody {BODY} at (8,10) size 784x580
6
      RenderBlock {DIV} at (10,0) size 100x100
- a/LayoutTests/platform/mac/css3/images/cross-fade-simple-expected.txt +8 lines
Line 0 a/LayoutTests/platform/mac/css3/images/cross-fade-simple-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x600
4
  RenderBlock {HTML} at (0,0) size 800x600
5
    RenderBody {BODY} at (8,10) size 784x580
6
      RenderBlock {DIV} at (10,0) size 100x100
7
      RenderBlock {DIV} at (10,110) size 100x100
8
      RenderBlock {DIV} at (10,220) size 100x100
- a/LayoutTests/platform/mac/css3/images/cross-fade-sizing-expected.txt +8 lines
Line 0 a/LayoutTests/platform/mac/css3/images/cross-fade-sizing-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x600
4
  RenderBlock {HTML} at (0,0) size 800x600
5
    RenderBody {BODY} at (8,10) size 784x580
6
      RenderBlock {DIV} at (10,0) size 100x100
7
      RenderBlock {DIV} at (10,110) size 100x100
8
      RenderBlock {DIV} at (10,220) size 100x100
- a/LayoutTests/platform/mac/css3/images/cross-fade-tiled-expected.txt +11 lines
Line 0 a/LayoutTests/platform/mac/css3/images/cross-fade-tiled-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x600
4
  RenderBlock {HTML} at (0,0) size 800x600
5
    RenderBody {BODY} at (8,10) size 784x580
6
layer at (18,10) size 102x102
7
  RenderBlock {DIV} at (10,0) size 102x102 [border: (1px solid #000000)]
8
layer at (18,122) size 102x102
9
  RenderBlock {DIV} at (10,112) size 102x102 [border: (1px solid #000000)]
10
layer at (18,234) size 102x102
11
  RenderBlock {DIV} at (10,224) size 102x102 [border: (1px solid #000000)]
- a/Source/WebCore/ChangeLog +90 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-11-14  Tim Horton  <timothy_horton@apple.com>
2
3
        Implement CSS3 Images cross-fade() image function
4
        https://bugs.webkit.org/show_bug.cgi?id=52162
5
        <rdar://problem/10209254>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Render -webkit-cross-fade. Only cross-fades entirely composed of images will render for now,
10
        cross-fades involving generated images are not yet implemented.
11
12
        Reorganize GeneratedImage to be the base class for GeneratorGeneratedImage and CrossfadeGeneratedImage.
13
14
        Add a pending state to CSSImageGeneratorValue, which is used to enable the pending-images loading
15
        mechanism for -webkit-cross-fade's sub-images. Rework the logic in CSSStyleSelector to support pending
16
        generated images.
17
18
        Tests: css3/images/cross-fade-invalidation.html
19
               css3/images/cross-fade-simple.html
20
               css3/images/cross-fade-sizing.html
21
               css3/images/cross-fade-tiled.html
22
23
        * WebCore.xcodeproj/project.pbxproj:
24
        * css/CSSCanvasValue.h:
25
        (WebCore::CSSCanvasValue::isPending):
26
        (WebCore::CSSCanvasValue::loadSubimages):
27
        * css/CSSCrossfadeValue.cpp:
28
        (WebCore::CSSCrossfadeValue::isPending):
29
        (WebCore::CSSCrossfadeValue::loadSubimages):
30
        (WebCore::subimageIsPending):
31
        (WebCore::loadSubimage):
32
        (WebCore::cachedImageForCSSValue):
33
        (WebCore::CSSCrossfadeValue::image):
34
        (WebCore::CSSCrossfadeValue::crossfadeChanged):
35
        * css/CSSCrossfadeValue.h:
36
        (WebCore::CSSCrossfadeValue::create):
37
        (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue):
38
        (WebCore::CSSCrossfadeValue::fixedSize):
39
        (WebCore::CSSCrossfadeValue::CSSCrossfadeValue):
40
        (WebCore::CSSCrossfadeValue::CrossfadeObserverProxy::CrossfadeObserverProxy):
41
        * css/CSSGradientValue.cpp:
42
        (WebCore::CSSGradientValue::image):
43
        * css/CSSGradientValue.h:
44
        (WebCore::CSSGradientValue::isPending):
45
        (WebCore::CSSGradientValue::loadSubimages):
46
        * css/CSSImageGeneratorValue.cpp:
47
        (WebCore::CSSImageGeneratorValue::generatedOrPendingImage):
48
        (WebCore::CSSImageGeneratorValue::generatedImage):
49
        (WebCore::CSSImageGeneratorValue::isPending):
50
        (WebCore::CSSImageGeneratorValue::loadSubimages):
51
        * css/CSSImageGeneratorValue.h:
52
        * css/CSSParser.cpp:
53
        (WebCore::CSSParser::parseCrossfade):
54
        * css/CSSStyleSelector.cpp:
55
        (WebCore::CSSStyleSelector::styleImage):
56
        (WebCore::CSSStyleSelector::generatedOrPendingFromValue):
57
        (WebCore::CSSStyleSelector::loadPendingImage):
58
        (WebCore::CSSStyleSelector::loadPendingImages):
59
        * css/CSSStyleSelector.h:
60
        * platform/graphics/BitmapImage.h:
61
        * platform/graphics/CrossfadeGeneratedImage.cpp: Added.
62
        (WebCore::CrossfadeGeneratedImage::CrossfadeGeneratedImage):
63
        (WebCore::CrossfadeGeneratedImage::~CrossfadeGeneratedImage):
64
        (WebCore::CrossfadeGeneratedImage::drawCrossfade):
65
        (WebCore::CrossfadeGeneratedImage::draw):
66
        (WebCore::CrossfadeGeneratedImage::drawPattern):
67
        (WebCore::CrossfadeGeneratedImage::imageChanged):
68
        * platform/graphics/CrossfadeGeneratedImage.h: Added.
69
        (WebCore::CrossfadeGeneratedImage::create):
70
        (WebCore::CrossfadeSubimageObserverProxy::CrossfadeSubimageObserverProxy):
71
        (WebCore::CrossfadeSubimageObserverProxy::setReady):
72
        * platform/graphics/GeneratedImage.h:
73
        (WebCore::GeneratedImage::GeneratedImage):
74
        * platform/graphics/GeneratorGeneratedImage.cpp: Renamed from Source/WebCore/platform/graphics/GeneratedImage.cpp.
75
        (WebCore::GeneratorGeneratedImage::draw):
76
        (WebCore::GeneratorGeneratedImage::drawPattern):
77
        (WebCore::GeneratedImage::computeIntrinsicDimensions):
78
        * platform/graphics/GeneratorGeneratedImage.h: Copied from Source/WebCore/platform/graphics/GeneratedImage.h.
79
        (WebCore::GeneratorGeneratedImage::create):
80
        (WebCore::GeneratorGeneratedImage::~GeneratorGeneratedImage):
81
        (WebCore::GeneratorGeneratedImage::GeneratorGeneratedImage):
82
        * platform/graphics/Image.h:
83
        * platform/graphics/ImageBuffer.h:
84
        * rendering/style/StylePendingImage.h:
85
        (WebCore::StylePendingImage::create):
86
        (WebCore::StylePendingImage::data):
87
        (WebCore::StylePendingImage::cssImageValue):
88
        (WebCore::StylePendingImage::cssImageGeneratorValue):
89
        (WebCore::StylePendingImage::StylePendingImage):
90
1
2011-11-14  Michael Nordman  <michaeln@google.com>
91
2011-11-14  Michael Nordman  <michaeln@google.com>
2
92
3
        Return more complete error and exception messages when a
93
        Return more complete error and exception messages when a
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj -4 / +16 lines
Lines 699-704 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
699
		2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
699
		2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
700
		2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */; };
700
		2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */; };
701
		2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */; settings = {ATTRIBUTES = (Private, ); }; };
701
		2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */; settings = {ATTRIBUTES = (Private, ); }; };
702
		2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */; };
703
		2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */; };
704
		2D481F03146B5C6500AA7834 /* GeneratorGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */; };
705
		2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */; };
702
		2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */; };
706
		2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */; };
703
		2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; };
707
		2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; };
704
		2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
708
		2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
Lines 5277-5283 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
5277
		BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE013980C0BEF180043860A /* JSStyleSheet.cpp */; };
5281
		BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE013980C0BEF180043860A /* JSStyleSheet.cpp */; };
5278
		BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE013990C0BEF180043860A /* JSStyleSheet.h */; };
5282
		BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE013990C0BEF180043860A /* JSStyleSheet.h */; };
5279
		BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE04C890DAFF7A0007A0F41 /* Generator.h */; settings = {ATTRIBUTES = (Private, ); }; };
5283
		BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE04C890DAFF7A0007A0F41 /* Generator.h */; settings = {ATTRIBUTES = (Private, ); }; };
5280
		BCE04C940DAFF902007A0F41 /* GeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE04C930DAFF902007A0F41 /* GeneratedImage.cpp */; };
5281
		BCE1C41B0D982980003B02F2 /* Location.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE1C4190D982980003B02F2 /* Location.h */; };
5284
		BCE1C41B0D982980003B02F2 /* Location.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE1C4190D982980003B02F2 /* Location.h */; };
5282
		BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C41A0D982980003B02F2 /* Location.cpp */; };
5285
		BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C41A0D982980003B02F2 /* Location.cpp */; };
5283
		BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C4390D9830D3003B02F2 /* JSLocation.cpp */; };
5286
		BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C4390D9830D3003B02F2 /* JSLocation.cpp */; };
Lines 7803-7808 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
7803
		29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySpinButton.h; sourceTree = "<group>"; };
7806
		29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySpinButton.h; sourceTree = "<group>"; };
7804
		2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLMetaCharsetParser.h; path = parser/HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
7807
		2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLMetaCharsetParser.h; path = parser/HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
7805
		2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLMetaCharsetParser.cpp; path = parser/HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
7808
		2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLMetaCharsetParser.cpp; path = parser/HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
7809
		2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossfadeGeneratedImage.cpp; sourceTree = "<group>"; };
7810
		2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossfadeGeneratedImage.h; sourceTree = "<group>"; };
7811
		2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeneratorGeneratedImage.cpp; sourceTree = "<group>"; };
7812
		2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratorGeneratedImage.h; sourceTree = "<group>"; };
7806
		2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParsingError.h; sourceTree = "<group>"; };
7813
		2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParsingError.h; sourceTree = "<group>"; };
7807
		2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCrossfadeValue.cpp; sourceTree = "<group>"; };
7814
		2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCrossfadeValue.cpp; sourceTree = "<group>"; };
7808
		2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCrossfadeValue.h; sourceTree = "<group>"; };
7815
		2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCrossfadeValue.h; sourceTree = "<group>"; };
Lines 12577-12583 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
12577
		BCE013980C0BEF180043860A /* JSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheet.cpp; sourceTree = "<group>"; };
12584
		BCE013980C0BEF180043860A /* JSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheet.cpp; sourceTree = "<group>"; };
12578
		BCE013990C0BEF180043860A /* JSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStyleSheet.h; sourceTree = "<group>"; };
12585
		BCE013990C0BEF180043860A /* JSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStyleSheet.h; sourceTree = "<group>"; };
12579
		BCE04C890DAFF7A0007A0F41 /* Generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Generator.h; sourceTree = "<group>"; };
12586
		BCE04C890DAFF7A0007A0F41 /* Generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Generator.h; sourceTree = "<group>"; };
12580
		BCE04C930DAFF902007A0F41 /* GeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeneratedImage.cpp; sourceTree = "<group>"; };
12581
		BCE1C4190D982980003B02F2 /* Location.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Location.h; sourceTree = "<group>"; };
12587
		BCE1C4190D982980003B02F2 /* Location.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Location.h; sourceTree = "<group>"; };
12582
		BCE1C41A0D982980003B02F2 /* Location.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Location.cpp; sourceTree = "<group>"; };
12588
		BCE1C41A0D982980003B02F2 /* Location.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Location.cpp; sourceTree = "<group>"; };
12583
		BCE1C4220D9829F2003B02F2 /* Location.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Location.idl; sourceTree = "<group>"; };
12589
		BCE1C4220D9829F2003B02F2 /* Location.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Location.idl; sourceTree = "<group>"; };
Lines 19212-19218 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
19212
				37202198106213C600F25C4B /* FontSmoothingMode.h */,
19218
				37202198106213C600F25C4B /* FontSmoothingMode.h */,
19213
				3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */,
19219
				3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */,
19214
				BCE4413512F7490B009B84B8 /* FontWidthVariant.h */,
19220
				BCE4413512F7490B009B84B8 /* FontWidthVariant.h */,
19215
				BCE04C930DAFF902007A0F41 /* GeneratedImage.cpp */,
19221
				2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */,
19222
				2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */,
19223
				2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */,
19224
				2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */,
19216
				BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */,
19225
				BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */,
19217
				BCE04C890DAFF7A0007A0F41 /* Generator.h */,
19226
				BCE04C890DAFF7A0007A0F41 /* Generator.h */,
19218
				086BBD0E136039C2008B15D8 /* Glyph.h */,
19227
				086BBD0E136039C2008B15D8 /* Glyph.h */,
Lines 22373-22378 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
22373
				19BFF64B11C0F2AC00B8C04D /* DOMSVGFEConvolveMatrixElement.h in Headers */,
22382
				19BFF64B11C0F2AC00B8C04D /* DOMSVGFEConvolveMatrixElement.h in Headers */,
22374
				19BFF64D11C0F2AC00B8C04D /* DOMSVGFEConvolveMatrixElementInternal.h in Headers */,
22383
				19BFF64D11C0F2AC00B8C04D /* DOMSVGFEConvolveMatrixElementInternal.h in Headers */,
22375
				8502AB480AD438C000378540 /* DOMSVGFEDiffuseLightingElement.h in Headers */,
22384
				8502AB480AD438C000378540 /* DOMSVGFEDiffuseLightingElement.h in Headers */,
22385
				2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */,
22386
				2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */,
22376
				8502AB920AD4394E00378540 /* DOMSVGFEDiffuseLightingElementInternal.h in Headers */,
22387
				8502AB920AD4394E00378540 /* DOMSVGFEDiffuseLightingElementInternal.h in Headers */,
22377
				8502AB4A0AD438C000378540 /* DOMSVGFEDisplacementMapElement.h in Headers */,
22388
				8502AB4A0AD438C000378540 /* DOMSVGFEDisplacementMapElement.h in Headers */,
22378
				8502AB930AD4394E00378540 /* DOMSVGFEDisplacementMapElementInternal.h in Headers */,
22389
				8502AB930AD4394E00378540 /* DOMSVGFEDisplacementMapElementInternal.h in Headers */,
Lines 25052-25057 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
25052
			buildActionMask = 2147483647;
25063
			buildActionMask = 2147483647;
25053
			files = (
25064
			files = (
25054
				AD03AAFA1468455300A39B5B /* CSSValue.cpp in Sources */,
25065
				AD03AAFA1468455300A39B5B /* CSSValue.cpp in Sources */,
25066
				2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */,
25067
				2D481F03146B5C6500AA7834 /* GeneratorGeneratedImage.cpp in Sources */,
25055
				B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
25068
				B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
25056
				41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
25069
				41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
25057
				0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */,
25070
				0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */,
Lines 25787-25793 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
25787
				97205AAF123928CA00B17380 /* FTPDirectoryDocument.cpp in Sources */,
25800
				97205AAF123928CA00B17380 /* FTPDirectoryDocument.cpp in Sources */,
25788
				51C81B890C4422F70019ECE3 /* FTPDirectoryParser.cpp in Sources */,
25801
				51C81B890C4422F70019ECE3 /* FTPDirectoryParser.cpp in Sources */,
25789
				1432E8490C51493F00B1500F /* GCController.cpp in Sources */,
25802
				1432E8490C51493F00B1500F /* GCController.cpp in Sources */,
25790
				BCE04C940DAFF902007A0F41 /* GeneratedImage.cpp in Sources */,
25791
				FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */,
25803
				FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */,
25792
				052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */,
25804
				052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */,
25793
				BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */,
25805
				BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */,
- a/Source/WebCore/css/CSSCanvasValue.h +3 lines
Lines 44-49 public: a/Source/WebCore/css/CSSCanvasValue.h_sec1
44
    bool isFixedSize() const { return true; }
44
    bool isFixedSize() const { return true; }
45
    IntSize fixedSize(const RenderObject*);
45
    IntSize fixedSize(const RenderObject*);
46
46
47
    bool isPending() const { return false; }
48
    void loadSubimages(CachedResourceLoader*) { }
49
47
    void setName(const String& name) { m_name = name; }
50
    void setName(const String& name) { m_name = name; }
48
51
49
private:
52
private:
- a/Source/WebCore/css/CSSCrossfadeValue.cpp -6 / +87 lines
Lines 26-33 a/Source/WebCore/css/CSSCrossfadeValue.cpp_sec1
26
#include "config.h"
26
#include "config.h"
27
#include "CSSCrossfadeValue.h"
27
#include "CSSCrossfadeValue.h"
28
28
29
#include "CSSImageValue.h"
30
#include "CachedImage.h"
31
#include "CachedResourceLoader.h"
32
#include "CrossfadeGeneratedImage.h"
33
#include "ImageBuffer.h"
34
#include "RenderObject.h"
35
#include "StyleCachedImage.h"
36
#include "StyleGeneratedImage.h"
37
29
namespace WebCore {
38
namespace WebCore {
30
39
40
CachedImage* cachedImageForCSSValue(PassRefPtr<CSSValue>, RenderObject*, const IntSize&);
41
void loadSubimage(PassRefPtr<CSSValue>, CachedResourceLoader*);
42
bool subimageIsPending(PassRefPtr<CSSValue>);
43
31
String CSSCrossfadeValue::customCssText() const
44
String CSSCrossfadeValue::customCssText() const
32
{
45
{
33
    String result = "-webkit-cross-fade(";
46
    String result = "-webkit-cross-fade(";
Lines 38-56 String CSSCrossfadeValue::customCssText() const a/Source/WebCore/css/CSSCrossfadeValue.cpp_sec2
38
    return result;
51
    return result;
39
}
52
}
40
53
41
IntSize CSSCrossfadeValue::fixedSize(const RenderObject* renderer)
54
bool CSSCrossfadeValue::isPending() const
42
{
55
{
43
    UNUSED_PARAM(renderer);
56
    return subimageIsPending(m_fromImage) || subimageIsPending(m_toImage);
57
}
44
58
45
    return IntSize();
59
void CSSCrossfadeValue::loadSubimages(CachedResourceLoader* cachedResourceLoader)
60
{
61
    loadSubimage(m_fromImage, cachedResourceLoader);
62
    loadSubimage(m_toImage, cachedResourceLoader);
46
}
63
}
47
64
48
PassRefPtr<Image> CSSCrossfadeValue::image(RenderObject* renderer, const IntSize& size)
65
bool subimageIsPending(PassRefPtr<CSSValue> value)
66
{
67
    if (value->isImageValue())
68
        return static_cast<CSSImageValue*>(value.get())->cachedOrPendingImage()->isPendingImage();
69
70
    if (value->isImageGeneratorValue())
71
        return static_cast<CSSImageGeneratorValue*>(value.get())->isPending();
72
73
    ASSERT_NOT_REACHED();
74
}
75
76
void loadSubimage(PassRefPtr<CSSValue> value, CachedResourceLoader* cachedResourceLoader)
77
{
78
    if (value->isImageValue()) {
79
        static_cast<CSSImageValue*>(value.get())->cachedImage(cachedResourceLoader);
80
        return;
81
    }
82
83
    if (value->isImageGeneratorValue()) {
84
        static_cast<CSSImageGeneratorValue*>(value.get())->loadSubimages(cachedResourceLoader);
85
        return;
86
    }
87
88
    ASSERT_NOT_REACHED();
89
}
90
91
CachedImage* cachedImageForCSSValue(PassRefPtr<CSSValue> value, RenderObject* renderer, const IntSize& size)
49
{
92
{
50
    UNUSED_PARAM(renderer);
51
    UNUSED_PARAM(size);
93
    UNUSED_PARAM(size);
52
94
53
    return 0;
95
    CachedResourceLoader* cachedResourceLoader = renderer->document()->cachedResourceLoader();
96
97
    if (value->isImageValue())
98
        return static_cast<CSSImageValue*>(value.get())->cachedImage(cachedResourceLoader)->cachedImage();
99
100
    if (value->isImageGeneratorValue()) {
101
        // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients and canvas).
102
        return 0;
103
    }
104
105
    ASSERT_NOT_REACHED();
106
}
107
108
PassRefPtr<Image> CSSCrossfadeValue::image(RenderObject* renderer, const IntSize& size)
109
{
110
    if (size.isEmpty())
111
        return 0;
112
113
    CachedImage* fromImage, * toImage;
114
115
    fromImage = cachedImageForCSSValue(m_fromImage, renderer, size);
116
    toImage = cachedImageForCSSValue(m_toImage, renderer, size);
117
118
    if (!fromImage || !toImage)
119
        return Image::nullImage();
120
121
    m_generatedImage = CrossfadeGeneratedImage::create(fromImage, toImage, m_percentage->getDoubleValue() / 100.0, &m_crossfadeObserver, size);
122
123
    return m_generatedImage.get();
124
}
125
126
void CSSCrossfadeValue::crossfadeChanged(const IntRect& rect)
127
{
128
    UNUSED_PARAM(rect);
129
130
    RenderObjectSizeCountMap::const_iterator end = clients().end();
131
    for (RenderObjectSizeCountMap::const_iterator curr = clients().begin(); curr != end; ++curr) {
132
        RenderObject* client = const_cast<RenderObject*>(curr->first);
133
        client->imageChanged(static_cast<WrappedImagePtr>(this));
134
    }
54
}
135
}
55
136
56
} // namespace WebCore
137
} // namespace WebCore
- a/Source/WebCore/css/CSSCrossfadeValue.h -8 / +34 lines
Lines 27-63 a/Source/WebCore/css/CSSCrossfadeValue.h_sec1
27
#define CSSCrossfadeValue_h
27
#define CSSCrossfadeValue_h
28
28
29
#include "CSSImageGeneratorValue.h"
29
#include "CSSImageGeneratorValue.h"
30
#include "CSSImageValue.h"
30
#include "CSSPrimitiveValue.h"
31
#include "Image.h"
31
#include "Image.h"
32
#include "ImageObserver.h"
32
#include "ImageObserver.h"
33
33
34
namespace WebCore {
34
namespace WebCore {
35
35
36
class CachedImage;
36
class RenderObject;
37
class RenderObject;
38
class Document;
37
39
38
class CSSCrossfadeValue : public CSSImageGeneratorValue {
40
class CSSCrossfadeValue : public CSSImageGeneratorValue {
39
public:
41
public:
40
    static PassRefPtr<CSSCrossfadeValue> create(PassRefPtr<CSSImageValue> fromImage, PassRefPtr<CSSImageValue> toImage) { return adoptRef(new CSSCrossfadeValue(fromImage, toImage)); }
42
    static PassRefPtr<CSSCrossfadeValue> create(PassRefPtr<CSSValue> fromImage, PassRefPtr<CSSValue> toImage) { return adoptRef(new CSSCrossfadeValue(fromImage, toImage)); }
43
    ~CSSCrossfadeValue() { }
41
44
42
    String customCssText() const;
45
    String customCssText() const;
43
46
44
    PassRefPtr<Image> image(RenderObject*, const IntSize&);
47
    PassRefPtr<Image> image(RenderObject*, const IntSize&);
45
    bool isFixedSize() const { return false; }
48
    bool isFixedSize() const { return false; }
46
    IntSize fixedSize(const RenderObject*);
49
    IntSize fixedSize(const RenderObject*) { return IntSize(); }
50
51
    bool isPending() const;
52
    void loadSubimages(CachedResourceLoader*);
47
53
48
    void setPercentage(PassRefPtr<CSSPrimitiveValue> percentage) { m_percentage = percentage; }
54
    void setPercentage(PassRefPtr<CSSPrimitiveValue> percentage) { m_percentage = percentage; }
49
55
50
private:
56
private:
51
    CSSCrossfadeValue(PassRefPtr<CSSImageValue> fromImage, PassRefPtr<CSSImageValue> toImage)
57
    CSSCrossfadeValue(PassRefPtr<CSSValue> fromImage, PassRefPtr<CSSValue> toImage)
52
        : CSSImageGeneratorValue(CrossfadeClass)
58
        : CSSImageGeneratorValue(CrossfadeClass)
53
        , m_fromImage(fromImage)
59
        , m_fromImage(fromImage)
54
        , m_toImage(toImage)
60
        , m_toImage(toImage)
55
    {
61
        , m_crossfadeObserver(this) { }
56
    }
62
63
    // NOTE: We put the ImageObserver in a member instead of inheriting from it
64
    // to avoid adding a vptr to CSSCrossfadeValue.
65
    class CrossfadeObserverProxy : public ImageObserver {
66
    public:
67
        CrossfadeObserverProxy(CSSCrossfadeValue* ownerValue) : m_ownerValue(ownerValue) { }
68
        virtual ~CrossfadeObserverProxy() OVERRIDE { }
69
        virtual void changedInRect(const Image*, const IntRect& rect) OVERRIDE { m_ownerValue->crossfadeChanged(rect); };
70
        virtual bool shouldPauseAnimation(const Image*) OVERRIDE { return false; }
71
        virtual void didDraw(const Image*) OVERRIDE { }
72
        virtual void animationAdvanced(const Image*) OVERRIDE { }
73
        virtual void decodedSizeChanged(const Image*, int) OVERRIDE { }
74
    private:
75
        CSSCrossfadeValue* m_ownerValue;
76
    };
77
78
    void crossfadeChanged(const IntRect&);
57
79
58
    RefPtr<CSSImageValue> m_fromImage;
80
    RefPtr<CSSValue> m_fromImage;
59
    RefPtr<CSSImageValue> m_toImage;
81
    RefPtr<CSSValue> m_toImage;
60
    RefPtr<CSSPrimitiveValue> m_percentage;
82
    RefPtr<CSSPrimitiveValue> m_percentage;
83
84
    RefPtr<Image> m_generatedImage;
85
86
    CrossfadeObserverProxy m_crossfadeObserver;
61
};
87
};
62
88
63
} // namespace WebCore
89
} // namespace WebCore
- a/Source/WebCore/css/CSSGradientValue.cpp -3 / +3 lines
Lines 26-34 a/Source/WebCore/css/CSSGradientValue.cpp_sec1
26
#include "config.h"
26
#include "config.h"
27
#include "CSSGradientValue.h"
27
#include "CSSGradientValue.h"
28
28
29
#include "CSSValueKeywords.h"
30
#include "CSSStyleSelector.h"
29
#include "CSSStyleSelector.h"
31
#include "GeneratedImage.h"
30
#include "CSSValueKeywords.h"
31
#include "GeneratorGeneratedImage.h"
32
#include "Gradient.h"
32
#include "Gradient.h"
33
#include "Image.h"
33
#include "Image.h"
34
#include "IntSize.h"
34
#include "IntSize.h"
Lines 67-73 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& a/Source/WebCore/css/CSSGradientValue.cpp_sec2
67
        gradient = static_cast<CSSRadialGradientValue*>(this)->createGradient(renderer, size);
67
        gradient = static_cast<CSSRadialGradientValue*>(this)->createGradient(renderer, size);
68
    }
68
    }
69
69
70
    RefPtr<Image> newImage = GeneratedImage::create(gradient, size);
70
    RefPtr<Image> newImage = GeneratorGeneratedImage::create(gradient, size);
71
    if (cacheable)
71
    if (cacheable)
72
        putImage(size, newImage);
72
        putImage(size, newImage);
73
73
- a/Source/WebCore/css/CSSGradientValue.h +3 lines
Lines 69-74 public: a/Source/WebCore/css/CSSGradientValue.h_sec1
69
    bool isFixedSize() const { return false; }
69
    bool isFixedSize() const { return false; }
70
    IntSize fixedSize(const RenderObject*) const { return IntSize(); }
70
    IntSize fixedSize(const RenderObject*) const { return IntSize(); }
71
71
72
    bool isPending() const { return false; }
73
    void loadSubimages(CachedResourceLoader*) { }
74
72
protected:
75
protected:
73
    CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, bool deprecatedType = false)
76
    CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, bool deprecatedType = false)
74
        : CSSImageGeneratorValue(classType)
77
        : CSSImageGeneratorValue(classType)
- a/Source/WebCore/css/CSSImageGeneratorValue.cpp -1 / +52 lines
Lines 32-37 a/Source/WebCore/css/CSSImageGeneratorValue.cpp_sec1
32
#include "Image.h"
32
#include "Image.h"
33
#include "RenderObject.h"
33
#include "RenderObject.h"
34
#include "StyleGeneratedImage.h"
34
#include "StyleGeneratedImage.h"
35
#include "StylePendingImage.h"
35
#include <wtf/text/WTFString.h>
36
#include <wtf/text/WTFString.h>
36
37
37
namespace WebCore {
38
namespace WebCore {
Lines 110-122 void CSSImageGeneratorValue::putImage(const IntSize& size, PassRefPtr<Image> ima a/Source/WebCore/css/CSSImageGeneratorValue.cpp_sec2
110
    m_images.add(size, image);
111
    m_images.add(size, image);
111
}
112
}
112
113
114
StyleImage* CSSImageGeneratorValue::generatedOrPendingImage()
115
{
116
    if (isPending())
117
        m_image = StylePendingImage::create(this).get();
118
    else if (!m_accessedImage) {
119
        m_accessedImage = true;
120
        m_image = StyleGeneratedImage::create(this, isFixedSize());
121
    }
122
123
    return m_image.get();
124
}
125
113
StyleGeneratedImage* CSSImageGeneratorValue::generatedImage()
126
StyleGeneratedImage* CSSImageGeneratorValue::generatedImage()
114
{
127
{
115
    if (!m_accessedImage) {
128
    if (!m_accessedImage) {
116
        m_accessedImage = true;
129
        m_accessedImage = true;
117
        m_image = StyleGeneratedImage::create(this, isFixedSize());
130
        m_image = StyleGeneratedImage::create(this, isFixedSize());
118
    }
131
    }
119
    return m_image.get();
132
133
    return static_cast<StyleGeneratedImage*>(m_image.get());
120
}
134
}
121
135
122
PassRefPtr<Image> CSSImageGeneratorValue::image(RenderObject* renderer, const IntSize& size)
136
PassRefPtr<Image> CSSImageGeneratorValue::image(RenderObject* renderer, const IntSize& size)
Lines 170-173 IntSize CSSImageGeneratorValue::fixedSize(const RenderObject* renderer) a/Source/WebCore/css/CSSImageGeneratorValue.cpp_sec3
170
    return IntSize();
184
    return IntSize();
171
}
185
}
172
186
187
bool CSSImageGeneratorValue::isPending() const
188
{
189
    switch (classType()) {
190
    case CrossfadeClass:
191
        return static_cast<const CSSCrossfadeValue*>(this)->isPending();
192
    case CanvasClass:
193
        return static_cast<const CSSCanvasValue*>(this)->isPending();
194
    case LinearGradientClass:
195
        return static_cast<const CSSLinearGradientValue*>(this)->isPending();
196
    case RadialGradientClass:
197
        return static_cast<const CSSRadialGradientValue*>(this)->isPending();
198
    default:
199
        ASSERT_NOT_REACHED();
200
    }
201
    return false;
202
}
203
204
void CSSImageGeneratorValue::loadSubimages(CachedResourceLoader* cachedResourceLoader)
205
{
206
    switch (classType()) {
207
    case CrossfadeClass:
208
        static_cast<CSSCrossfadeValue*>(this)->loadSubimages(cachedResourceLoader);
209
        break;
210
    case CanvasClass:
211
        static_cast<CSSCanvasValue*>(this)->loadSubimages(cachedResourceLoader);
212
        break;
213
    case LinearGradientClass:
214
        static_cast<CSSLinearGradientValue*>(this)->loadSubimages(cachedResourceLoader);
215
        break;
216
    case RadialGradientClass:
217
        static_cast<CSSRadialGradientValue*>(this)->loadSubimages(cachedResourceLoader);
218
        break;
219
    default:
220
        ASSERT_NOT_REACHED();
221
    }
222
}
223
173
} // namespace WebCore
224
} // namespace WebCore
- a/Source/WebCore/css/CSSImageGeneratorValue.h -1 / +8 lines
Lines 33-41 a/Source/WebCore/css/CSSImageGeneratorValue.h_sec1
33
33
34
namespace WebCore {
34
namespace WebCore {
35
35
36
class CachedResourceLoader;
36
class Image;
37
class Image;
37
class RenderObject;
38
class RenderObject;
38
class StyleGeneratedImage;
39
class StyleGeneratedImage;
40
class StyleImage;
39
41
40
struct SizeAndCount {
42
struct SizeAndCount {
41
    SizeAndCount(IntSize newSize = IntSize(), int newCount = 0)
43
    SizeAndCount(IntSize newSize = IntSize(), int newCount = 0)
Lines 58-68 public: a/Source/WebCore/css/CSSImageGeneratorValue.h_sec2
58
    void removeClient(RenderObject*);
60
    void removeClient(RenderObject*);
59
    PassRefPtr<Image> image(RenderObject*, const IntSize&);
61
    PassRefPtr<Image> image(RenderObject*, const IntSize&);
60
62
63
    StyleImage* generatedOrPendingImage();
61
    StyleGeneratedImage* generatedImage();
64
    StyleGeneratedImage* generatedImage();
62
65
63
    bool isFixedSize() const;
66
    bool isFixedSize() const;
64
    IntSize fixedSize(const RenderObject*);
67
    IntSize fixedSize(const RenderObject*);
65
68
69
    bool isPending() const;
70
71
    void loadSubimages(CachedResourceLoader*);
72
66
protected:
73
protected:
67
    CSSImageGeneratorValue(ClassType);
74
    CSSImageGeneratorValue(ClassType);
68
75
Lines 70-76 protected: a/Source/WebCore/css/CSSImageGeneratorValue.h_sec3
70
    void putImage(const IntSize&, PassRefPtr<Image>);
77
    void putImage(const IntSize&, PassRefPtr<Image>);
71
    const RenderObjectSizeCountMap& clients() const { return m_clients; }
78
    const RenderObjectSizeCountMap& clients() const { return m_clients; }
72
79
73
    RefPtr<StyleGeneratedImage> m_image;
80
    RefPtr<StyleImage> m_image;
74
    bool m_accessedImage;
81
    bool m_accessedImage;
75
82
76
    HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use.
83
    HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use.
- a/Source/WebCore/css/CSSParser.cpp -1 / +1 lines
Lines 6290-6296 bool CSSParser::parseCrossfade(CSSParserValueList* valueList, RefPtr<CSSValue>& a/Source/WebCore/css/CSSParser.cpp_sec1
6290
    if (!a || a->unit != CSSPrimitiveValue::CSS_PERCENTAGE)
6290
    if (!a || a->unit != CSSPrimitiveValue::CSS_PERCENTAGE)
6291
        return false;
6291
        return false;
6292
6292
6293
    result = CSSCrossfadeValue::create(static_cast<CSSImageValue*>(fromImageValue.get()), static_cast<CSSImageValue*>(toImageValue.get()));
6293
    result = CSSCrossfadeValue::create(fromImageValue, toImageValue);
6294
    result->setPercentage(createPrimitiveNumericValue(a));
6294
    result->setPercentage(createPrimitiveNumericValue(a));
6295
6295
6296
    crossfade = result;
6296
    crossfade = result;
- a/Source/WebCore/css/CSSStyleSelector.cpp -21 / +45 lines
Lines 4246-4252 StyleImage* CSSStyleSelector::styleImage(CSSPropertyID property, CSSValue* value a/Source/WebCore/css/CSSStyleSelector.cpp_sec1
4246
        return cachedOrPendingFromValue(property, static_cast<CSSImageValue*>(value));
4246
        return cachedOrPendingFromValue(property, static_cast<CSSImageValue*>(value));
4247
4247
4248
    if (value->isImageGeneratorValue())
4248
    if (value->isImageGeneratorValue())
4249
        return static_cast<CSSImageGeneratorValue*>(value)->generatedImage();
4249
        return generatedOrPendingFromValue(property, static_cast<CSSImageGeneratorValue*>(value));
4250
4250
4251
    return 0;
4251
    return 0;
4252
}
4252
}
Lines 4259-4264 StyleImage* CSSStyleSelector::cachedOrPendingFromValue(CSSPropertyID property, C a/Source/WebCore/css/CSSStyleSelector.cpp_sec2
4259
    return image;
4259
    return image;
4260
}
4260
}
4261
4261
4262
StyleImage* CSSStyleSelector::generatedOrPendingFromValue(CSSPropertyID property, CSSImageGeneratorValue* value)
4263
{
4264
    StyleImage* image = value->generatedOrPendingImage();
4265
    if (image && image->isPendingImage())
4266
        m_pendingImageProperties.add(property);
4267
    return image;
4268
}
4269
4262
void CSSStyleSelector::mapFillImage(CSSPropertyID property, FillLayer* layer, CSSValue* value)
4270
void CSSStyleSelector::mapFillImage(CSSPropertyID property, FillLayer* layer, CSSValue* value)
4263
{
4271
{
4264
    if (value->isInitialValue()) {
4272
    if (value->isInitialValue()) {
Lines 5576-5581 bool CSSStyleSelector::createFilterOperations(CSSValue* inValue, RenderStyle* st a/Source/WebCore/css/CSSStyleSelector.cpp_sec3
5576
5584
5577
#endif
5585
#endif
5578
5586
5587
StyleImage* CSSStyleSelector::loadPendingImage(StylePendingImage* pendingImage)
5588
{
5589
    CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader();
5590
5591
    if (pendingImage->cssImageValue()) {
5592
        CSSImageValue* imageValue = pendingImage->cssImageValue();
5593
        return imageValue->cachedImage(cachedResourceLoader);
5594
    }
5595
5596
    if (pendingImage->cssImageGeneratorValue()) {
5597
        CSSImageGeneratorValue* imageGeneratorValue = pendingImage->cssImageGeneratorValue();
5598
        imageGeneratorValue->loadSubimages(cachedResourceLoader);
5599
        return imageGeneratorValue->generatedImage();
5600
    }
5601
5602
    return 0;
5603
}
5604
5579
void CSSStyleSelector::loadPendingImages()
5605
void CSSStyleSelector::loadPendingImages()
5580
{
5606
{
5581
    if (m_pendingImageProperties.isEmpty())
5607
    if (m_pendingImageProperties.isEmpty())
Lines 5585-5598 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec4
5585
    for (HashSet<int>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
5611
    for (HashSet<int>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
5586
        CSSPropertyID currentProperty = static_cast<CSSPropertyID>(*it);
5612
        CSSPropertyID currentProperty = static_cast<CSSPropertyID>(*it);
5587
5613
5588
        CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader();
5589
5590
        switch (currentProperty) {
5614
        switch (currentProperty) {
5591
            case CSSPropertyBackgroundImage: {
5615
            case CSSPropertyBackgroundImage: {
5592
                for (FillLayer* backgroundLayer = m_style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
5616
                for (FillLayer* backgroundLayer = m_style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
5593
                    if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage()) {
5617
                    if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage()) {
5594
                        CSSImageValue* imageValue = static_cast<StylePendingImage*>(backgroundLayer->image())->cssImageValue();
5618
                        StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(backgroundLayer->image()));
5595
                        backgroundLayer->setImage(imageValue->cachedImage(cachedResourceLoader));
5619
                        backgroundLayer->setImage(loadedImage);
5596
                    }
5620
                    }
5597
                }
5621
                }
5598
                break;
5622
                break;
Lines 5601-5611 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec5
5601
            case CSSPropertyContent: {
5625
            case CSSPropertyContent: {
5602
                for (ContentData* contentData = const_cast<ContentData*>(m_style->contentData()); contentData; contentData = contentData->next()) {
5626
                for (ContentData* contentData = const_cast<ContentData*>(m_style->contentData()); contentData; contentData = contentData->next()) {
5603
                    if (contentData->isImage()) {
5627
                    if (contentData->isImage()) {
5604
                        const StyleImage* image = static_cast<ImageContentData*>(contentData)->image();
5628
                        StyleImage* image = static_cast<ImageContentData*>(contentData)->image();
5605
                        if (image->isPendingImage()) {
5629
                        if (image->isPendingImage()) {
5606
                            CSSImageValue* imageValue = static_cast<const StylePendingImage*>(image)->cssImageValue();
5630
                            StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(image));
5607
                            if (StyleCachedImage* cachedImage = imageValue->cachedImage(cachedResourceLoader))
5631
                            if (loadedImage)
5608
                                static_cast<ImageContentData*>(contentData)->setImage(cachedImage);
5632
                                static_cast<ImageContentData*>(contentData)->setImage(loadedImage);
5609
                        }
5633
                        }
5610
                    }
5634
                    }
5611
                }
5635
                }
Lines 5618-5625 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec6
5618
                        CursorData& currentCursor = cursorList->at(i);
5642
                        CursorData& currentCursor = cursorList->at(i);
5619
                        if (StyleImage* image = currentCursor.image()) {
5643
                        if (StyleImage* image = currentCursor.image()) {
5620
                            if (image->isPendingImage()) {
5644
                            if (image->isPendingImage()) {
5621
                                CSSImageValue* imageValue = static_cast<StylePendingImage*>(image)->cssImageValue();
5645
                                StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(image));
5622
                                currentCursor.setImage(imageValue->cachedImage(cachedResourceLoader));
5646
                                currentCursor.setImage(loadedImage);
5623
                            }
5647
                            }
5624
                        }
5648
                        }
5625
                    }
5649
                    }
Lines 5629-5644 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec7
5629
5653
5630
            case CSSPropertyListStyleImage: {
5654
            case CSSPropertyListStyleImage: {
5631
                if (m_style->listStyleImage() && m_style->listStyleImage()->isPendingImage()) {
5655
                if (m_style->listStyleImage() && m_style->listStyleImage()->isPendingImage()) {
5632
                    CSSImageValue* imageValue = static_cast<StylePendingImage*>(m_style->listStyleImage())->cssImageValue();
5656
                    StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(m_style->listStyleImage()));
5633
                    m_style->setListStyleImage(imageValue->cachedImage(cachedResourceLoader));
5657
                    m_style->setListStyleImage(loadedImage);
5634
                }
5658
                }
5635
                break;
5659
                break;
5636
            }
5660
            }
5637
5661
5638
            case CSSPropertyBorderImageSource: {
5662
            case CSSPropertyBorderImageSource: {
5639
                if (m_style->borderImageSource() && m_style->borderImageSource()->isPendingImage()) {
5663
                if (m_style->borderImageSource() && m_style->borderImageSource()->isPendingImage()) {
5640
                    CSSImageValue* imageValue = static_cast<StylePendingImage*>(m_style->borderImageSource())->cssImageValue();
5664
                    StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(m_style->borderImageSource()));
5641
                    m_style->setBorderImageSource(imageValue->cachedImage(cachedResourceLoader));
5665
                    m_style->setBorderImageSource(loadedImage);
5642
                }
5666
                }
5643
                break;
5667
                break;
5644
            }
5668
            }
Lines 5647-5654 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec8
5647
                if (StyleReflection* reflection = m_style->boxReflect()) {
5671
                if (StyleReflection* reflection = m_style->boxReflect()) {
5648
                    const NinePieceImage& maskImage = reflection->mask();
5672
                    const NinePieceImage& maskImage = reflection->mask();
5649
                    if (maskImage.image() && maskImage.image()->isPendingImage()) {
5673
                    if (maskImage.image() && maskImage.image()->isPendingImage()) {
5650
                        CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue();
5674
                        StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(maskImage.image()));
5651
                        reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
5675
                        reflection->setMask(NinePieceImage(loadedImage, maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
5652
                    }
5676
                    }
5653
                }
5677
                }
5654
                break;
5678
                break;
Lines 5656-5663 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec9
5656
5680
5657
            case CSSPropertyWebkitMaskBoxImageSource: {
5681
            case CSSPropertyWebkitMaskBoxImageSource: {
5658
                if (m_style->maskBoxImageSource() && m_style->maskBoxImageSource()->isPendingImage()) {
5682
                if (m_style->maskBoxImageSource() && m_style->maskBoxImageSource()->isPendingImage()) {
5659
                    CSSImageValue* imageValue = static_cast<StylePendingImage*>(m_style->maskBoxImageSource())->cssImageValue();
5683
                    StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(m_style->maskBoxImageSource()));
5660
                    m_style->setMaskBoxImageSource(imageValue->cachedImage(cachedResourceLoader));
5684
                    m_style->setMaskBoxImageSource(loadedImage);
5661
                }
5685
                }
5662
                break;
5686
                break;
5663
            }
5687
            }
Lines 5665-5672 void CSSStyleSelector::loadPendingImages() a/Source/WebCore/css/CSSStyleSelector.cpp_sec10
5665
            case CSSPropertyWebkitMaskImage: {
5689
            case CSSPropertyWebkitMaskImage: {
5666
                for (FillLayer* maskLayer = m_style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
5690
                for (FillLayer* maskLayer = m_style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
5667
                    if (maskLayer->image() && maskLayer->image()->isPendingImage()) {
5691
                    if (maskLayer->image() && maskLayer->image()->isPendingImage()) {
5668
                        CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskLayer->image())->cssImageValue();
5692
                        StyleImage* loadedImage = loadPendingImage(static_cast<StylePendingImage*>(maskLayer->image()));
5669
                        maskLayer->setImage(imageValue->cachedImage(cachedResourceLoader));
5693
                        maskLayer->setImage(loadedImage);
5670
                    }
5694
                    }
5671
                }
5695
                }
5672
                break;
5696
                break;
- a/Source/WebCore/css/CSSStyleSelector.h +4 lines
Lines 44-49 class CSSPrimitiveValue; a/Source/WebCore/css/CSSStyleSelector.h_sec1
44
class CSSProperty;
44
class CSSProperty;
45
class CSSFontFace;
45
class CSSFontFace;
46
class CSSFontFaceRule;
46
class CSSFontFaceRule;
47
class CSSImageGeneratorValue;
47
class CSSImageValue;
48
class CSSImageValue;
48
class CSSRegionStyleRule;
49
class CSSRegionStyleRule;
49
class CSSRuleList;
50
class CSSRuleList;
Lines 66-71 class RuleData; a/Source/WebCore/css/CSSStyleSelector.h_sec2
66
class RuleSet;
67
class RuleSet;
67
class Settings;
68
class Settings;
68
class StyleImage;
69
class StyleImage;
70
class StylePendingImage;
69
class StyleSheet;
71
class StyleSheet;
70
class StyleSheetList;
72
class StyleSheetList;
71
class StyledElement;
73
class StyledElement;
Lines 280-285 public: a/Source/WebCore/css/CSSStyleSelector.h_sec3
280
282
281
    StyleImage* styleImage(CSSPropertyID, CSSValue*);
283
    StyleImage* styleImage(CSSPropertyID, CSSValue*);
282
    StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
284
    StyleImage* cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
285
    StyleImage* generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*);
283
286
284
    bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
287
    bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; }
285
    bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
288
    bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; }
Lines 327-332 private: a/Source/WebCore/css/CSSStyleSelector.h_sec4
327
    void applySVGProperty(int id, CSSValue*);
330
    void applySVGProperty(int id, CSSValue*);
328
#endif
331
#endif
329
332
333
    StyleImage* loadPendingImage(StylePendingImage*);
330
    void loadPendingImages();
334
    void loadPendingImages();
331
335
332
    struct MatchedStyleDeclaration {
336
    struct MatchedStyleDeclaration {
- a/Source/WebCore/platform/graphics/BitmapImage.h +2 lines
Lines 98-103 public: a/Source/WebCore/platform/graphics/BitmapImage.h_sec1
98
98
99
class BitmapImage : public Image {
99
class BitmapImage : public Image {
100
    friend class GeneratedImage;
100
    friend class GeneratedImage;
101
    friend class CrossfadeGeneratedImage;
102
    friend class GeneratorGeneratedImage;
101
    friend class GraphicsContext;
103
    friend class GraphicsContext;
102
public:
104
public:
103
    static PassRefPtr<BitmapImage> create(NativeImagePtr nativeImage, ImageObserver* observer = 0)
105
    static PassRefPtr<BitmapImage> create(NativeImagePtr nativeImage, ImageObserver* observer = 0)
- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp +132 lines
Line 0 a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp_sec1
1
/*
2
 * Copyright (C) 2011 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "CrossfadeGeneratedImage.h"
28
29
#include "CSSCrossfadeValue.h"
30
#include "FloatRect.h"
31
#include "GraphicsContext.h"
32
#include "ImageBuffer.h"
33
34
using namespace std;
35
36
namespace WebCore {
37
38
CrossfadeGeneratedImage::CrossfadeGeneratedImage(CachedImage* fromImage, CachedImage* toImage, float percentage, ImageObserver* observer, const IntSize& size)
39
    : m_fromImage(fromImage)
40
    , m_toImage(toImage)
41
    , m_percentage(percentage)
42
    , m_observer(observer)
43
    , m_crossfadeSubimageObserver(adoptPtr(new CrossfadeSubimageObserverProxy(this)))
44
{
45
    m_size = size;
46
47
    m_fromImage->addClient(m_crossfadeSubimageObserver.get());
48
    m_toImage->addClient(m_crossfadeSubimageObserver.get());
49
50
    m_crossfadeSubimageObserver->setReady(true);
51
}
52
53
CrossfadeGeneratedImage::~CrossfadeGeneratedImage()
54
{
55
    m_fromImage->removeClient(m_crossfadeSubimageObserver.get());
56
    m_toImage->removeClient(m_crossfadeSubimageObserver.get());
57
}
58
59
void CrossfadeGeneratedImage::drawCrossfade(GraphicsContext* context)
60
{
61
    Image* fromImage = 0;
62
    Image* toImage = 0;
63
    IntSize fromImageSize, toImageSize, crossfadeImageSize;
64
    float inversePercentage = 1.0f - m_percentage;
65
66
    fromImage = m_fromImage->image();
67
    fromImageSize = fromImage->size();
68
    toImage = m_toImage->image();
69
    toImageSize = toImage->size();
70
71
    // Draw nothing if either of the images hasn't loaded yet.
72
    if (fromImage == Image::nullImage() || toImage == Image::nullImage())
73
        return;
74
75
    crossfadeImageSize = IntSize(fromImageSize.width() * inversePercentage + toImageSize.width() * m_percentage,
76
                                 fromImageSize.height() * inversePercentage + toImageSize.height() * m_percentage);
77
78
    GraphicsContextStateSaver stateSaver(*context);
79
80
    // Draw the image we're fading away from.
81
    context->save();
82
    if (crossfadeImageSize != fromImageSize)
83
        context->scale(FloatSize(static_cast<float>(crossfadeImageSize.width()) / fromImageSize.width(),
84
                                 static_cast<float>(crossfadeImageSize.height()) / fromImageSize.height()));
85
    context->setAlpha(inversePercentage);
86
    context->drawImage(fromImage, ColorSpaceDeviceRGB, IntPoint());
87
    context->restore();
88
89
    // Draw the image we're fading towards.
90
    context->save();
91
    if (crossfadeImageSize != toImageSize)
92
        context->scale(FloatSize(static_cast<float>(crossfadeImageSize.width()) / toImageSize.width(),
93
                                 static_cast<float>(crossfadeImageSize.height()) / toImageSize.height()));
94
    context->setCompositeOperation(CompositeSourceOver);
95
    context->setAlpha(m_percentage);
96
    context->drawImage(toImage, ColorSpaceDeviceRGB, IntPoint());
97
    context->restore();
98
}
99
100
void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
101
{
102
    UNUSED_PARAM(compositeOp);
103
    UNUSED_PARAM(srcRect);
104
105
    GraphicsContextStateSaver stateSaver(*context);
106
    context->clip(dstRect);
107
    context->translate(dstRect.x(), dstRect.y());
108
109
    drawCrossfade(context);
110
}
111
112
void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
113
{
114
    OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size);
115
    if (!imageBuffer)
116
        return;
117
118
    // Fill with the cross-faded image.
119
    GraphicsContext* graphicsContext = imageBuffer->context();
120
    drawCrossfade(graphicsContext);
121
122
    // Tile the image buffer into the context.
123
    imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
124
}
125
126
void CrossfadeGeneratedImage::imageChanged(CachedImage* image, const IntRect* rect)
127
{
128
    UNUSED_PARAM(image);
129
    m_observer->changedInRect(this, *rect);
130
}
131
132
}
- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h +88 lines
Line 0 a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h_sec1
1
/*
2
 * Copyright (C) 2011 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef CrossfadeGeneratedImage_h
27
#define CrossfadeGeneratedImage_h
28
29
#include "CachedImage.h"
30
#include "GeneratedImage.h"
31
#include "Image.h"
32
#include "ImageObserver.h"
33
#include "IntSize.h"
34
#include <wtf/RefPtr.h>
35
36
namespace WebCore {
37
38
class CSSCrossfadeValue;
39
class CrossfadeSubimageObserverProxy;
40
41
class CrossfadeGeneratedImage : public GeneratedImage {
42
    friend CrossfadeSubimageObserverProxy;
43
public:
44
    static PassRefPtr<CrossfadeGeneratedImage> create(CachedImage* fromImage, CachedImage* toImage, float percentage, ImageObserver* observer, const IntSize& size)
45
    {
46
        return adoptRef(new CrossfadeGeneratedImage(fromImage, toImage, percentage, observer, size));
47
    }
48
    virtual ~CrossfadeGeneratedImage();
49
50
protected:
51
    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
52
    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
53
54
    CrossfadeGeneratedImage(CachedImage* fromImage, CachedImage* toImage, float percentage, ImageObserver*, const IntSize&);
55
56
    void imageChanged(CachedImage*, const IntRect* = 0);
57
58
private:
59
    void drawCrossfade(GraphicsContext*);
60
61
    CachedImage* m_fromImage;
62
    CachedImage* m_toImage;
63
    float m_percentage;
64
65
    ImageObserver* m_observer;
66
    OwnPtr<CrossfadeSubimageObserverProxy> m_crossfadeSubimageObserver;
67
};
68
69
class CrossfadeSubimageObserverProxy : public CachedImageClient {
70
public:
71
    CrossfadeSubimageObserverProxy(CrossfadeGeneratedImage* ownerValue)
72
    : m_ownerValue(ownerValue)
73
    , m_ready(false) { }
74
75
    virtual ~CrossfadeSubimageObserverProxy() OVERRIDE { }
76
    virtual void imageChanged(CachedImage* image, const IntRect* rect = 0) OVERRIDE {
77
        if (m_ready)
78
            m_ownerValue->imageChanged(image, rect);
79
    }
80
    void setReady(bool ready) { m_ready = ready; }
81
private:
82
    CrossfadeGeneratedImage* m_ownerValue;
83
    bool m_ready;
84
};
85
86
}
87
88
#endif
- a/Source/WebCore/platform/graphics/GeneratedImage.cpp -75 lines
Lines 1-75 a/Source/WebCore/platform/graphics/GeneratedImage.cpp_sec1
1
/*
2
 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "GeneratedImage.h"
28
29
#include "FloatRect.h"
30
#include "GraphicsContext.h"
31
#include "ImageBuffer.h"
32
#include "Length.h"
33
34
namespace WebCore {
35
36
void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
37
{
38
    GraphicsContextStateSaver stateSaver(*context);
39
    context->setCompositeOperation(compositeOp);
40
    context->clip(dstRect);
41
    context->translate(dstRect.x(), dstRect.y());
42
    if (dstRect.size() != srcRect.size())
43
        context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()));
44
    context->translate(-srcRect.x(), -srcRect.y());
45
    context->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());
46
}
47
48
void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
49
                                 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
50
{
51
    // Allow the generator to provide visually-equivalent tiling parameters for better performance.
52
    IntSize adjustedSize = m_size;
53
    FloatRect adjustedSrcRect = srcRect;
54
    m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
55
56
    // Create a BitmapImage and call drawPattern on it.
57
    OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize);
58
    if (!imageBuffer)
59
        return;
60
61
    // Fill with the gradient.
62
    GraphicsContext* graphicsContext = imageBuffer->context();
63
    graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get());
64
65
    // Tile the image buffer into the context.
66
    imageBuffer->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
67
}
68
69
void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
70
{
71
    Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
72
    intrinsicRatio = FloatSize();
73
}
74
75
}
- a/Source/WebCore/platform/graphics/GeneratedImage.h -15 / +4 lines
Lines 36-47 namespace WebCore { a/Source/WebCore/platform/graphics/GeneratedImage.h_sec1
36
36
37
class GeneratedImage : public Image {
37
class GeneratedImage : public Image {
38
public:
38
public:
39
    static PassRefPtr<GeneratedImage> create(PassRefPtr<Generator> generator, const IntSize& size)
40
    {
41
        return adoptRef(new GeneratedImage(generator, size));
42
    }
43
    virtual ~GeneratedImage() {}
44
45
    virtual bool hasSingleSecurityOrigin() const { return true; }
39
    virtual bool hasSingleSecurityOrigin() const { return true; }
46
40
47
    virtual void setContainerSize(const IntSize& size) { m_size = size; }
41
    virtual void setContainerSize(const IntSize& size) { m_size = size; }
Lines 57-73 public: a/Source/WebCore/platform/graphics/GeneratedImage.h_sec2
57
    virtual unsigned decodedSize() const { return 0; }
51
    virtual unsigned decodedSize() const { return 0; }
58
52
59
protected:
53
protected:
60
    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
54
    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0;
61
    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
55
    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
62
                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
56
                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect) = 0;
63
    
57
64
    GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
58
    GeneratedImage() { }
65
        : m_generator(generator)
66
        , m_size(size)
67
    {
68
    }
69
59
70
    RefPtr<Generator> m_generator;
71
    IntSize m_size;
60
    IntSize m_size;
72
};
61
};
73
62
- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp +75 lines
Line 0 a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp_sec1
1
/*
2
 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "GeneratorGeneratedImage.h"
28
29
#include "FloatRect.h"
30
#include "GraphicsContext.h"
31
#include "ImageBuffer.h"
32
#include "Length.h"
33
34
namespace WebCore {
35
36
void GeneratorGeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
37
{
38
    GraphicsContextStateSaver stateSaver(*context);
39
    context->setCompositeOperation(compositeOp);
40
    context->clip(dstRect);
41
    context->translate(dstRect.x(), dstRect.y());
42
    if (dstRect.size() != srcRect.size())
43
        context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()));
44
    context->translate(-srcRect.x(), -srcRect.y());
45
    context->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());
46
}
47
48
void GeneratorGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
49
                                 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
50
{
51
    // Allow the generator to provide visually-equivalent tiling parameters for better performance.
52
    IntSize adjustedSize = m_size;
53
    FloatRect adjustedSrcRect = srcRect;
54
    m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
55
56
    // Create a BitmapImage and call drawPattern on it.
57
    OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize);
58
    if (!imageBuffer)
59
        return;
60
61
    // Fill with the generated image.
62
    GraphicsContext* graphicsContext = imageBuffer->context();
63
    graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get());
64
65
    // Tile the image buffer into the context.
66
    imageBuffer->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
67
}
68
69
void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
70
{
71
    Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
72
    intrinsicRatio = FloatSize();
73
}
74
75
}
- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h +61 lines
Line 0 a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h_sec1
1
/*
2
 * Copyright (C) 2008 Apple Computer, Inc.  All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#ifndef GeneratorGeneratedImage_h
27
#define GeneratorGeneratedImage_h
28
29
#include "GeneratedImage.h"
30
#include "Generator.h"
31
#include "Image.h"
32
#include "IntSize.h"
33
#include <wtf/RefPtr.h>
34
35
namespace WebCore {
36
37
class GeneratorGeneratedImage : public GeneratedImage {
38
public:
39
    static PassRefPtr<GeneratorGeneratedImage> create(PassRefPtr<Generator> generator, const IntSize& size)
40
    {
41
        return adoptRef(new GeneratorGeneratedImage(generator, size));
42
    }
43
    virtual ~GeneratorGeneratedImage() { }
44
45
protected:
46
    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
47
    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
48
                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
49
50
    GeneratorGeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
51
        : m_generator(generator)
52
    {
53
        m_size = size;
54
    }
55
56
    RefPtr<Generator> m_generator;
57
};
58
59
}
60
61
#endif
- a/Source/WebCore/platform/graphics/Image.h +2 lines
Lines 79-84 class ImageObserver; a/Source/WebCore/platform/graphics/Image.h_sec1
79
79
80
class Image : public RefCounted<Image> {
80
class Image : public RefCounted<Image> {
81
    friend class GeneratedImage;
81
    friend class GeneratedImage;
82
    friend class CrossfadeGeneratedImage;
83
    friend class GeneratorGeneratedImage;
82
    friend class GraphicsContext;
84
    friend class GraphicsContext;
83
85
84
public:
86
public:
- a/Source/WebCore/platform/graphics/ImageBuffer.h +2 lines
Lines 126-131 namespace WebCore { a/Source/WebCore/platform/graphics/ImageBuffer.h_sec1
126
126
127
        friend class GraphicsContext;
127
        friend class GraphicsContext;
128
        friend class GeneratedImage;
128
        friend class GeneratedImage;
129
        friend class CrossfadeGeneratedImage;
130
        friend class GeneratorGeneratedImage;
129
131
130
    private:
132
    private:
131
        ImageBufferData m_data;
133
        ImageBufferData m_data;
- a/Source/WebCore/rendering/style/StylePendingImage.h -5 / +8 lines
Lines 26-31 a/Source/WebCore/rendering/style/StylePendingImage.h_sec1
26
#ifndef StylePendingImage_h
26
#ifndef StylePendingImage_h
27
#define StylePendingImage_h
27
#define StylePendingImage_h
28
28
29
#include "CSSImageGeneratorValue.h"
30
#include "CSSImageValue.h"
29
#include "Image.h"
31
#include "Image.h"
30
#include "StyleImage.h"
32
#include "StyleImage.h"
31
33
Lines 37-48 namespace WebCore { a/Source/WebCore/rendering/style/StylePendingImage.h_sec2
37
39
38
class StylePendingImage : public StyleImage {
40
class StylePendingImage : public StyleImage {
39
public:
41
public:
40
    static PassRefPtr<StylePendingImage> create(CSSImageValue* value) { return adoptRef(new StylePendingImage(value)); }
42
    static PassRefPtr<StylePendingImage> create(CSSValue* value) { return adoptRef(new StylePendingImage(value)); }
41
43
42
    virtual WrappedImagePtr data() const { return m_value; }
44
    virtual WrappedImagePtr data() const { return static_cast<CSSImageValue*>(m_value); }
43
45
44
    virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
46
    virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
45
    CSSImageValue* cssImageValue() const { return m_value; }
47
    CSSImageValue* cssImageValue() const { return m_value->isImageValue() ? static_cast<CSSImageValue*>(m_value) : 0; }
48
    CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isImageGeneratorValue() ? static_cast<CSSImageGeneratorValue*>(m_value) : 0; }
46
    
49
    
47
    virtual IntSize imageSize(const RenderObject*, float /*multiplier*/) const { return IntSize(); }
50
    virtual IntSize imageSize(const RenderObject*, float /*multiplier*/) const { return IntSize(); }
48
    virtual bool imageHasRelativeWidth() const { return false; }
51
    virtual bool imageHasRelativeWidth() const { return false; }
Lines 59-71 public: a/Source/WebCore/rendering/style/StylePendingImage.h_sec3
59
    }
62
    }
60
    
63
    
61
private:
64
private:
62
    StylePendingImage(CSSImageValue* value)
65
    StylePendingImage(CSSValue* value)
63
        : m_value(value)
66
        : m_value(value)
64
    {
67
    {
65
        m_isPendingImage = true;
68
        m_isPendingImage = true;
66
    }
69
    }
67
70
68
    CSSImageValue* m_value; // Not retained; it owns us.
71
    CSSValue* m_value; // Not retained; it owns us.
69
};
72
};
70
73
71
}
74
}

Return to Bug 52162