Changeset 98852 in webkit
- Timestamp:
- Oct 31, 2011, 7:07:49 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 100 added
- 2 deleted
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r98849 r98852 1 2011-10-31 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 CSS 2.1 failure: background-intrinsic-* 4 https://bugs.webkit.org/show_bug.cgi?id=47156 5 6 Reviewed by Antti Koivisto. 7 8 Add all *intrinsic* tests from the CSS 2.1 Testsuite - we pass all of them now. 9 All tests regarding SVG are now imported in LayoutTests, none are failing anymore. 10 11 Add several new testcases covering the SVG Image size negotiation logic, as defined in CSS 2.1. 12 13 * css2.1/20110323/background-intrinsic-001.htm: Added. 14 * css2.1/20110323/background-intrinsic-002.htm: Added. 15 * css2.1/20110323/background-intrinsic-003.htm: Added. 16 * css2.1/20110323/background-intrinsic-004.htm: Added. 17 * css2.1/20110323/background-intrinsic-005.htm: Added. 18 * css2.1/20110323/background-intrinsic-006.htm: Added. 19 * css2.1/20110323/background-intrinsic-007.htm: Added. 20 * css2.1/20110323/background-intrinsic-008.htm: Added. 21 * css2.1/20110323/background-intrinsic-009.htm: Added. 22 * css2.1/20110323/resources/green-intrinsic-height-ratio.svg: Added. 23 * css2.1/20110323/resources/green-intrinsic-height.svg: Added. 24 * css2.1/20110323/resources/green-intrinsic-none.svg: Added. 25 * css2.1/20110323/resources/green-intrinsic-ratio-landscape.svg: Added. 26 * css2.1/20110323/resources/green-intrinsic-ratio-portrait.svg: Added. 27 * css2.1/20110323/resources/green-intrinsic-width-height.svg: Added. 28 * css2.1/20110323/resources/green-intrinsic-width-pc-height-pc.svg: Added. 29 * css2.1/20110323/resources/green-intrinsic-width-ratio.svg: Added. 30 * css2.1/20110323/resources/green-intrinsic-width.svg: Added. 31 * css2.1/20110323/resources/red-intrinsic-height-ratio.svg: Added. 32 * css2.1/20110323/resources/red-intrinsic-height.svg: Added. 33 * css2.1/20110323/resources/red-intrinsic-none.svg: Added. 34 * css2.1/20110323/resources/red-intrinsic-ratio-landscape.svg: Added. 35 * css2.1/20110323/resources/red-intrinsic-ratio-portrait.svg: Added. 36 * css2.1/20110323/resources/red-intrinsic-width-height.svg: Added. 37 * css2.1/20110323/resources/red-intrinsic-width-pc-height-pc.svg: Added. 38 * css2.1/20110323/resources/red-intrinsic-width-ratio.svg: Added. 39 * css2.1/20110323/resources/red-intrinsic-width.svg: Added. 40 * fast/backgrounds/size/contain-and-cover-zoomed.html: Added. 41 * fast/images/percent-height-image-expected.txt: Update results, testcase is fixed now. 42 * fast/images/percent-height-image.html: Make test async, to make it work cross-browser. With this patch we now pass this testcase. 43 * platform/mac-snowleopard/svg/zoom/page/relative-sized-document-scrollbars-expected.png: Removed. 44 * platform/mac-snowleopard/svg/zoom/page/zoom-foreignObject-expected.png: Removed. 45 * platform/mac/css1/text_properties/vertical_align-expected.txt: Update for rounding differences. 46 * platform/mac/css2.1/20110323/background-intrinsic-001-expected.png: Added. 47 * platform/mac/css2.1/20110323/background-intrinsic-001-expected.txt: Added. 48 * platform/mac/css2.1/20110323/background-intrinsic-002-expected.png: Added. 49 * platform/mac/css2.1/20110323/background-intrinsic-002-expected.txt: Added. 50 * platform/mac/css2.1/20110323/background-intrinsic-003-expected.png: Added. 51 * platform/mac/css2.1/20110323/background-intrinsic-003-expected.txt: Added. 52 * platform/mac/css2.1/20110323/background-intrinsic-004-expected.png: Added. 53 * platform/mac/css2.1/20110323/background-intrinsic-004-expected.txt: Added. 54 * platform/mac/css2.1/20110323/background-intrinsic-005-expected.png: Added. 55 * platform/mac/css2.1/20110323/background-intrinsic-005-expected.txt: Added. 56 * platform/mac/css2.1/20110323/background-intrinsic-006-expected.png: Added. 57 * platform/mac/css2.1/20110323/background-intrinsic-006-expected.txt: Added. 58 * platform/mac/css2.1/20110323/background-intrinsic-007-expected.png: Added. 59 * platform/mac/css2.1/20110323/background-intrinsic-007-expected.txt: Added. 60 * platform/mac/css2.1/20110323/background-intrinsic-008-expected.png: Added. 61 * platform/mac/css2.1/20110323/background-intrinsic-008-expected.txt: Added. 62 * platform/mac/css2.1/20110323/background-intrinsic-009-expected.png: Added. 63 * platform/mac/css2.1/20110323/background-intrinsic-009-expected.txt: Added. 64 * platform/mac/fast/backgrounds/size/contain-and-cover-expected.png: Updated for rounding differences. 65 * platform/mac/fast/backgrounds/size/contain-and-cover-zoomed-expected.png: Added. 66 * platform/mac/fast/backgrounds/size/contain-and-cover-zoomed-expected.txt: Added. 67 * platform/mac/fast/block/float/015-expected.png: Slight changes, due 49x50 -> 50x50 size change. 68 * platform/mac/fast/block/float/015-expected.txt: Ditto. 69 * platform/mac/fast/block/positioning/replaced-inside-fixed-top-bottom-expected.png: Slight changes due to rounding. 70 * platform/mac/fast/block/positioning/replaced-inside-fixed-top-bottom-expected.txt: Ditto. 71 * platform/mac/fast/repaint/block-layout-inline-children-replaced-expected.png: Ditto. 72 * platform/mac/fast/repaint/block-layout-inline-children-replaced-expected.txt: Ditto. 73 * platform/mac/svg/as-background-image/background-image-preserveaspectRatio-support-expected.png: Added. 74 * platform/mac/svg/as-background-image/background-image-preserveaspectRatio-support-expected.txt: Added. 75 * platform/mac/svg/as-background-image/background-image-tiled-expected.png: Added. 76 * platform/mac/svg/as-background-image/background-image-tiled-expected.txt: Added. 77 * platform/mac/svg/as-background-image/same-image-two-instances-background-image-expected.png: Added. 78 * platform/mac/svg/as-background-image/same-image-two-instances-background-image-expected.txt: Added. 79 * platform/mac/svg/as-background-image/svg-as-background-4-expected.png: Adapt to preserveAspectRatio changes in hearts.svg. 80 * platform/mac/svg/as-border-image/svg-as-border-image-expected.png: This needed a rebaseline, it was forgotten before. 81 * platform/mac/svg/as-image/animated-svg-as-image-expected.png: Progression, now both images share the same size & ratio, as desired. 82 * platform/mac/svg/as-image/img-preserveAspectRatio-support-1-expected.png: Added. 83 * platform/mac/svg/as-image/img-preserveAspectRatio-support-1-expected.txt: Added. 84 * platform/mac/svg/as-image/same-image-two-instances-expected.png: Added. 85 * platform/mac/svg/as-image/same-image-two-instances-expected.txt: Added. 86 * platform/mac/svg/as-image/svg-as-relative-image-expected.png: Adapt to green-relative-size-rect.svg - a circle got added to make it easier to compare. 87 * platform/mac/svg/as-image/svg-as-relative-image-with-explicit-size-expected.png: Added. 88 * platform/mac/svg/as-image/svg-as-relative-image-with-explicit-size-expected.txt: Added. 89 * platform/mac/svg/as-image/svg-image-change-content-size-expected.png: Added. 90 * platform/mac/svg/as-image/svg-image-change-content-size-expected.txt: Added. 91 * platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.png: Updated, scrollbars are gone - now matching Opera/FF. 92 * platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.txt: Ditto. 93 * platform/mac/svg/zoom/page/zoom-background-image-tiled-expected.png: Added. 94 * platform/mac/svg/zoom/page/zoom-background-image-tiled-expected.txt: Added. 95 * platform/mac/svg/zoom/page/zoom-background-images-expected.png: Added. 96 * platform/mac/svg/zoom/page/zoom-background-images-expected.txt: Added. 97 * platform/mac/svg/zoom/page/zoom-foreignObject-expected.png: Updated, scrollbars are gone - now matching Opera/FF. 98 * platform/mac/svg/zoom/page/zoom-foreignObject-expected.txt: Ditto. 99 * platform/mac/svg/zoom/page/zoom-img-preserveAspectRatio-support-1-expected.png: Added. 100 * platform/mac/svg/zoom/page/zoom-img-preserveAspectRatio-support-1-expected.txt: Added. 101 * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox-expected.png: Added. 102 * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox-expected.txt: Added. 103 * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-expected.png: Added. 104 * platform/mac/svg/zoom/page/zoom-svg-as-background-with-relative-size-expected.txt: Added. 105 * platform/mac/svg/zoom/page/zoom-svg-as-image-expected.png: Added. 106 * platform/mac/svg/zoom/page/zoom-svg-as-image-expected.txt: Added. 107 * platform/mac/svg/zoom/page/zoom-svg-as-relative-image-expected.png: Added. 108 * platform/mac/svg/zoom/page/zoom-svg-as-relative-image-expected.txt: Added. 109 * svg/as-background-image/background-image-preserveaspectRatio-support.html: Added. 110 * svg/as-background-image/background-image-tiled.html: Added. 111 * svg/as-background-image/resources/construction-tape.svg: Added. 112 * svg/as-background-image/resources/hearts.svg: Fix testcase, by adding pAR="none", which is now respected. Now the image looks as desired across Opera/FF and us. 113 * svg/as-background-image/same-image-two-instances-background-image.html: Added. 114 * svg/as-image/img-preserveAspectRatio-support-1.html: Added. 115 * svg/as-image/resources/circle-default-meet.svg: Added. 116 * svg/as-image/resources/circle-default-none.svg: Added. 117 * svg/as-image/resources/circle-default-slice.svg: Added. 118 * svg/as-image/resources/circle-nosize.svg: Added. 119 * svg/as-image/resources/circle-viewbox-default.svg: Added. 120 * svg/as-image/resources/circle-viewbox-meet.svg: Added. 121 * svg/as-image/resources/circle-viewbox-none.svg: Added. 122 * svg/as-image/resources/circle-viewbox-slice.svg: Added. 123 * svg/as-image/resources/green-relative-size-rect.svg: Use relative units everywhere as intended. Add circle to make it easy to spot ratio changes. 124 * svg/as-image/same-image-two-instances.html: Added. 125 * svg/as-image/svg-as-relative-image-with-explicit-size.html: Added. 126 * svg/as-image/svg-image-change-content-size.xhtml: Added. 127 * svg/zoom/page/resources/relative-sized-background-with-viewBox.svg: Added. 128 * svg/zoom/page/zoom-background-image-tiled.html: Added. 129 * svg/zoom/page/zoom-background-images.html: Added. 130 * svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html: Added. 131 * svg/zoom/page/zoom-svg-as-background-with-relative-size-and-viewBox.html: Added. 132 * svg/zoom/page/zoom-svg-as-background-with-relative-size.html: Added. 133 * svg/zoom/page/zoom-svg-as-image.html: Added. 134 * svg/zoom/page/zoom-svg-as-relative-image.html: Added. 135 1 136 2011-10-31 Vsevolod Vlasov <vsevik@chromium.org> 2 137 -
trunk/LayoutTests/fast/images/percent-height-image-expected.txt
r98508 r98852 2 2 See Bug: http://bugs.webkit.org/show_bug.cgi?id=45439 3 3 4 FAIL: image height was 600 expected 20 4 PASS -
trunk/LayoutTests/fast/images/percent-height-image.html
r98508 r98852 5 5 <div style="float: left;"> 6 6 <!-- src is a 20 x 20 PNG --> 7 <img style="height: 100%; width: 100%;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQ//W/8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPzdRA4AAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjLX7mlDAAAAaUlEQVQoU23QQQ4AIQgDQPD/j5ZSCkYlxsPoSlnzT5mvu8yBjoPcULaAYG60RFxrDHsQVshvY6URsw8WjY2isnuZ3lTfudn5NEVFYmbN0BjWcYWVpU44kbKc2Hbg2KBMMyC85ph/HfipDQwyAn26rjFKAAAAAElFTkSuQmCC"/>7 <img style="height: 100%; width: 100%;" onload="check()" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQ//W/8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPzdRA4AAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjLX7mlDAAAAaUlEQVQoU23QQQ4AIQgDQPD/j5ZSCkYlxsPoSlnzT5mvu8yBjoPcULaAYG60RFxrDHsQVshvY6URsw8WjY2isnuZ3lTfudn5NEVFYmbN0BjWcYWVpU44kbKc2Hbg2KBMMyC85ph/HfipDQwyAn26rjFKAAAAAElFTkSuQmCC"/> 8 8 </div> 9 9 <pre></pre> 10 10 <script> 11 if (window.layoutTestController) 11 if (window.layoutTestController) { 12 layoutTestController.waitUntilDone(); 12 13 layoutTestController.dumpAsText(); 14 } 13 15 14 var expected = 20; 15 var actual = document.querySelector("img").offsetHeight; 16 var out = document.querySelector("pre"); 17 if (actual == expected) 18 out.textContent = "PASS"; 19 else 20 out.textContent = "FAIL: image height was " + actual + " expected " + expected; 16 function check() { 17 var expected = 20; 18 var actual = document.querySelector("img").offsetHeight; 19 var out = document.querySelector("pre"); 20 if (actual == expected) 21 out.textContent = "PASS"; 22 else 23 out.textContent = "FAIL: image height was " + actual + " expected " + expected; 24 layoutTestController.notifyDone(); 25 } 21 26 </script> -
trunk/LayoutTests/platform/mac/css1/text_properties/vertical_align-expected.txt
r98508 r98852 173 173 RenderText {#text} at (80,122) size 101x22 174 174 text run at (80,122) width 101: " all of which " 175 RenderImage {IMG} at (181,122) size 19x65176 RenderText {#text} at (20 0,122) size 5x22177 text run at (20 0,122) width 5: " "175 RenderImage {IMG} at (181,122) size 20x65 176 RenderText {#text} at (201,122) size 5x22 177 text run at (201,122) width 5: " " 178 178 RenderInline {SPAN} at (0,0) size 262x43 179 RenderText {#text} at (20 5,105) size 262x43180 text run at (20 5,105) width 262: "should be aligned"181 RenderText {#text} at (46 7,122) size 5x22182 text run at (46 7,122) width 5: " "183 RenderImage {IMG} at (47 2,122) size 10x35184 RenderText {#text} at (48 2,122) size 123x22185 text run at (48 2,122) width 123: " with the top of "186 RenderImage {IMG} at (60 5,122) size 9x30187 RenderText {#text} at (61 4,122) size 5x22188 text run at (61 4,122) width 5: " "189 RenderInline {SPAN} at (0,0) size 73 1x144190 RenderText {#text} at (6 19,114) size 19x32191 text run at (6 19,114) width 19: "a "192 RenderInline {SPAN} at (0,0) size 73 1x194193 RenderText {#text} at (6 38,75) size 731x194194 text run at (6 38,75) width 93: "14-"179 RenderText {#text} at (206,105) size 262x43 180 text run at (206,105) width 262: "should be aligned" 181 RenderText {#text} at (468,122) size 5x22 182 text run at (468,122) width 5: " " 183 RenderImage {IMG} at (473,122) size 11x35 184 RenderText {#text} at (484,122) size 123x22 185 text run at (484,122) width 123: " with the top of " 186 RenderImage {IMG} at (607,122) size 9x30 187 RenderText {#text} at (616,122) size 5x22 188 text run at (616,122) width 5: " " 189 RenderInline {SPAN} at (0,0) size 733x144 190 RenderText {#text} at (621,114) size 19x32 191 text run at (621,114) width 19: "a " 192 RenderInline {SPAN} at (0,0) size 733x194 193 RenderText {#text} at (640,75) size 733x194 194 text run at (640,75) width 93: "14-" 195 195 text run at (0,187) width 143: "point" 196 196 RenderText {#text} at (143,226) size 144x32 … … 206 206 RenderText {#text} at (501,234) size 5x22 207 207 text run at (501,234) width 5: " " 208 RenderImage {IMG} at (506,234) size 4x15209 RenderText {#text} at (51 0,234) size 5x22210 text run at (51 0,234) width 5: " "208 RenderImage {IMG} at (506,234) size 5x15 209 RenderText {#text} at (511,234) size 5x22 210 text run at (511,234) width 5: " " 211 211 RenderInline {BIG} at (0,0) size 156x24 212 RenderText {#text} at (51 5,232) size 156x24213 text run at (51 5,232) width 156: "the images appear."214 RenderText {#text} at (67 1,234) size 5x22215 text run at (67 1,234) width 5: " "216 RenderImage {IMG} at (67 6,234) size 27x90212 RenderText {#text} at (516,232) size 156x24 213 text run at (516,232) width 156: "the images appear." 214 RenderText {#text} at (672,234) size 5x22 215 text run at (672,234) width 5: " " 216 RenderImage {IMG} at (677,234) size 27x90 217 217 RenderText {#text} at (0,0) size 0x0 218 218 RenderBlock {P} at (0,1784) size 769x36 … … 246 246 text run at (696,22) width 36: " all of" 247 247 text run at (0,98) width 43: "which " 248 RenderImage {IMG} at (43,77) size 19x65249 RenderText {#text} at (6 2,98) size 119x18250 text run at (6 2,98) width 119: " should be aligned "251 RenderImage {IMG} at (18 1,92) size 10x35252 RenderText {#text} at (19 1,98) size 4x18253 text run at (19 1,98) width 4: " "248 RenderImage {IMG} at (43,77) size 20x65 249 RenderText {#text} at (63,98) size 119x18 250 text run at (63,98) width 119: " should be aligned " 251 RenderImage {IMG} at (182,92) size 11x35 252 RenderText {#text} at (193,98) size 4x18 253 text run at (193,98) width 4: " " 254 254 RenderInline {SPAN} at (0,0) size 236x37 255 RenderText {#text} at (19 5,83) size 236x37256 text run at (19 5,83) width 236: "with the middle of"257 RenderText {#text} at (43 1,98) size 4x18258 text run at (43 1,98) width 4: " "259 RenderImage {IMG} at (43 5,84) size 15x50260 RenderText {#text} at (45 0,98) size 4x18261 text run at (45 0,98) width 4: " "262 RenderInline {SPAN} at (0,0) size 7 18x106263 RenderText {#text} at (45 4,90) size 17x28264 text run at (45 4,90) width 17: "a "255 RenderText {#text} at (197,83) size 236x37 256 text run at (197,83) width 236: "with the middle of" 257 RenderText {#text} at (433,98) size 4x18 258 text run at (433,98) width 4: " " 259 RenderImage {IMG} at (437,84) size 15x50 260 RenderText {#text} at (452,98) size 4x18 261 text run at (452,98) width 4: " " 262 RenderInline {SPAN} at (0,0) size 720x106 263 RenderText {#text} at (456,90) size 17x28 264 text run at (456,90) width 17: "a " 265 265 RenderInline {SPAN} at (0,0) size 204x69 266 RenderText {#text} at (47 1,58) size 204x69267 text run at (47 1,58) width 204: "14-point"268 RenderText {#text} at (67 5,90) size 718x106269 text run at (67 5,90) width 43: " text"266 RenderText {#text} at (473,58) size 204x69 267 text run at (473,58) width 204: "14-point" 268 RenderText {#text} at (677,90) size 720x106 269 text run at (677,90) width 43: " text" 270 270 text run at (0,168) width 78: "element" 271 271 RenderText {#text} at (78,176) size 4x18 … … 279 279 RenderText {#text} at (290,176) size 4x18 280 280 text run at (290,176) width 4: " " 281 RenderImage {IMG} at (294,180) size 4x15282 RenderText {#text} at (29 8,176) size 4x18283 text run at (29 8,176) width 4: " "281 RenderImage {IMG} at (294,180) size 5x15 282 RenderText {#text} at (299,176) size 4x18 283 text run at (299,176) width 4: " " 284 284 RenderInline {BIG} at (0,0) size 156x24 285 RenderText {#text} at (30 2,171) size 156x24286 text run at (30 2,171) width 156: "the images appear."287 RenderText {#text} at (45 8,176) size 4x18288 text run at (45 8,176) width 4: " "289 RenderImage {IMG} at (46 2,142) size 27x90285 RenderText {#text} at (303,171) size 156x24 286 text run at (303,171) width 156: "the images appear." 287 RenderText {#text} at (459,176) size 4x18 288 text run at (459,176) width 4: " " 289 RenderImage {IMG} at (463,142) size 27x90 290 290 RenderText {#text} at (0,0) size 0x0 291 291 RenderBlock {P} at (0,2084) size 769x36 … … 341 341 RenderText {#text} at (146,46) size 4x18 342 342 text run at (146,46) width 4: " " 343 RenderImage {IMG} at (150,46) size 19x65344 RenderText {#text} at (1 69,46) size 4x18345 text run at (1 69,46) width 4: " "343 RenderImage {IMG} at (150,46) size 20x65 344 RenderText {#text} at (170,46) size 4x18 345 text run at (170,46) width 4: " " 346 346 RenderInline {SPAN} at (0,0) size 111x18 347 RenderText {#text} at (17 3,46) size 111x18348 text run at (17 3,46) width 111: "should be aligned"349 RenderText {#text} at (28 4,46) size 4x18350 text run at (28 4,46) width 4: " "351 RenderImage {IMG} at (28 8,46) size 10x35352 RenderText {#text} at ( 298,46) size 4x18353 text run at ( 298,46) width 4: " "347 RenderText {#text} at (174,46) size 111x18 348 text run at (174,46) width 111: "should be aligned" 349 RenderText {#text} at (285,46) size 4x18 350 text run at (285,46) width 4: " " 351 RenderImage {IMG} at (289,46) size 11x35 352 RenderText {#text} at (300,46) size 4x18 353 text run at (300,46) width 4: " " 354 354 RenderInline {SPAN} at (0,0) size 188x37 355 RenderText {#text} at (30 2,46) size 188x37356 text run at (30 2,46) width 188: "with the top of"357 RenderText {#text} at (49 0,46) size 4x18358 text run at (49 0,46) width 4: " "359 RenderImage {IMG} at (49 4,46) size 15x50360 RenderText {#text} at (5 09,46) size 4x18361 text run at (5 09,46) width 4: " "355 RenderText {#text} at (304,46) size 188x37 356 text run at (304,46) width 188: "with the top of" 357 RenderText {#text} at (492,46) size 4x18 358 text run at (492,46) width 4: " " 359 RenderImage {IMG} at (496,46) size 15x50 360 RenderText {#text} at (511,46) size 4x18 361 text run at (511,46) width 4: " " 362 362 RenderInline {SPAN} at (0,0) size 128x18 363 RenderText {#text} at (51 3,46) size 128x18364 text run at (51 3,46) width 128: "the tallest element in"365 RenderText {#text} at (64 1,46) size 4x18366 text run at (64 1,46) width 4: " "367 RenderImage {IMG} at (64 5,46) size 4x15368 RenderText {#text} at (6 49,46) size 4x18369 text run at (6 49,46) width 4: " "370 RenderInline {BIG} at (0,0) size 74 1x89371 RenderText {#text} at (65 3,46) size 741x89372 text run at (65 3,46) width 88: "whichever"363 RenderText {#text} at (515,46) size 128x18 364 text run at (515,46) width 128: "the tallest element in" 365 RenderText {#text} at (643,46) size 4x18 366 text run at (643,46) width 4: " " 367 RenderImage {IMG} at (647,46) size 5x15 368 RenderText {#text} at (652,46) size 4x18 369 text run at (652,46) width 4: " " 370 RenderInline {BIG} at (0,0) size 744x89 371 RenderText {#text} at (656,46) size 744x89 372 text run at (656,46) width 88: "whichever" 373 373 text run at (0,111) width 208: "line the elements appear." 374 374 RenderText {#text} at (208,111) size 4x18 … … 517 517 RenderText {#text} at (80,122) size 101x22 518 518 text run at (80,122) width 101: " all of which " 519 RenderImage {IMG} at (181,122) size 19x65520 RenderText {#text} at (20 0,122) size 5x22521 text run at (20 0,122) width 5: " "519 RenderImage {IMG} at (181,122) size 20x65 520 RenderText {#text} at (201,122) size 5x22 521 text run at (201,122) width 5: " " 522 522 RenderInline {SPAN} at (0,0) size 262x43 523 RenderText {#text} at (20 5,105) size 262x43524 text run at (20 5,105) width 262: "should be aligned"525 RenderText {#text} at (46 7,122) size 5x22526 text run at (46 7,122) width 5: " "527 RenderImage {IMG} at (47 2,122) size 10x35528 RenderText {#text} at (48 2,122) size 123x22529 text run at (48 2,122) width 123: " with the top of "530 RenderImage {IMG} at (60 5,122) size 9x30531 RenderText {#text} at (61 4,122) size 5x22532 text run at (61 4,122) width 5: " "533 RenderInline {SPAN} at (0,0) size 73 1x144534 RenderText {#text} at (6 19,114) size 19x32535 text run at (6 19,114) width 19: "a "536 RenderInline {SPAN} at (0,0) size 73 1x194537 RenderText {#text} at (6 38,75) size 731x194538 text run at (6 38,75) width 93: "14-"523 RenderText {#text} at (206,105) size 262x43 524 text run at (206,105) width 262: "should be aligned" 525 RenderText {#text} at (468,122) size 5x22 526 text run at (468,122) width 5: " " 527 RenderImage {IMG} at (473,122) size 11x35 528 RenderText {#text} at (484,122) size 123x22 529 text run at (484,122) width 123: " with the top of " 530 RenderImage {IMG} at (607,122) size 9x30 531 RenderText {#text} at (616,122) size 5x22 532 text run at (616,122) width 5: " " 533 RenderInline {SPAN} at (0,0) size 733x144 534 RenderText {#text} at (621,114) size 19x32 535 text run at (621,114) width 19: "a " 536 RenderInline {SPAN} at (0,0) size 733x194 537 RenderText {#text} at (640,75) size 733x194 538 text run at (640,75) width 93: "14-" 539 539 text run at (0,187) width 143: "point" 540 540 RenderText {#text} at (143,226) size 144x32 … … 550 550 RenderText {#text} at (501,234) size 5x22 551 551 text run at (501,234) width 5: " " 552 RenderImage {IMG} at (506,234) size 4x15553 RenderText {#text} at (51 0,234) size 5x22554 text run at (51 0,234) width 5: " "552 RenderImage {IMG} at (506,234) size 5x15 553 RenderText {#text} at (511,234) size 5x22 554 text run at (511,234) width 5: " " 555 555 RenderInline {BIG} at (0,0) size 156x24 556 RenderText {#text} at (51 5,232) size 156x24557 text run at (51 5,232) width 156: "the images appear."558 RenderText {#text} at (67 1,234) size 5x22559 text run at (67 1,234) width 5: " "560 RenderImage {IMG} at (67 6,234) size 27x90556 RenderText {#text} at (516,232) size 156x24 557 text run at (516,232) width 156: "the images appear." 558 RenderText {#text} at (672,234) size 5x22 559 text run at (672,234) width 5: " " 560 RenderImage {IMG} at (677,234) size 27x90 561 561 RenderText {#text} at (0,0) size 0x0 562 562 RenderBlock {P} at (4,1453) size 747x36 … … 590 590 text run at (696,22) width 36: " all of" 591 591 text run at (0,98) width 43: "which " 592 RenderImage {IMG} at (43,77) size 19x65593 RenderText {#text} at (6 2,98) size 119x18594 text run at (6 2,98) width 119: " should be aligned "595 RenderImage {IMG} at (18 1,92) size 10x35596 RenderText {#text} at (19 1,98) size 4x18597 text run at (19 1,98) width 4: " "592 RenderImage {IMG} at (43,77) size 20x65 593 RenderText {#text} at (63,98) size 119x18 594 text run at (63,98) width 119: " should be aligned " 595 RenderImage {IMG} at (182,92) size 11x35 596 RenderText {#text} at (193,98) size 4x18 597 text run at (193,98) width 4: " " 598 598 RenderInline {SPAN} at (0,0) size 236x37 599 RenderText {#text} at (19 5,83) size 236x37600 text run at (19 5,83) width 236: "with the middle of"601 RenderText {#text} at (43 1,98) size 4x18602 text run at (43 1,98) width 4: " "603 RenderImage {IMG} at (43 5,84) size 15x50604 RenderText {#text} at (45 0,98) size 4x18605 text run at (45 0,98) width 4: " "606 RenderInline {SPAN} at (0,0) size 7 18x106607 RenderText {#text} at (45 4,90) size 17x28608 text run at (45 4,90) width 17: "a "599 RenderText {#text} at (197,83) size 236x37 600 text run at (197,83) width 236: "with the middle of" 601 RenderText {#text} at (433,98) size 4x18 602 text run at (433,98) width 4: " " 603 RenderImage {IMG} at (437,84) size 15x50 604 RenderText {#text} at (452,98) size 4x18 605 text run at (452,98) width 4: " " 606 RenderInline {SPAN} at (0,0) size 720x106 607 RenderText {#text} at (456,90) size 17x28 608 text run at (456,90) width 17: "a " 609 609 RenderInline {SPAN} at (0,0) size 204x69 610 RenderText {#text} at (47 1,58) size 204x69611 text run at (47 1,58) width 204: "14-point"612 RenderText {#text} at (67 5,90) size 718x106613 text run at (67 5,90) width 43: " text"610 RenderText {#text} at (473,58) size 204x69 611 text run at (473,58) width 204: "14-point" 612 RenderText {#text} at (677,90) size 720x106 613 text run at (677,90) width 43: " text" 614 614 text run at (0,168) width 78: "element" 615 615 RenderText {#text} at (78,176) size 4x18 … … 623 623 RenderText {#text} at (290,176) size 4x18 624 624 text run at (290,176) width 4: " " 625 RenderImage {IMG} at (294,180) size 4x15626 RenderText {#text} at (29 8,176) size 4x18627 text run at (29 8,176) width 4: " "625 RenderImage {IMG} at (294,180) size 5x15 626 RenderText {#text} at (299,176) size 4x18 627 text run at (299,176) width 4: " " 628 628 RenderInline {BIG} at (0,0) size 156x24 629 RenderText {#text} at (30 2,171) size 156x24630 text run at (30 2,171) width 156: "the images appear."631 RenderText {#text} at (45 8,176) size 4x18632 text run at (45 8,176) width 4: " "633 RenderImage {IMG} at (46 2,142) size 27x90629 RenderText {#text} at (303,171) size 156x24 630 text run at (303,171) width 156: "the images appear." 631 RenderText {#text} at (459,176) size 4x18 632 text run at (459,176) width 4: " " 633 RenderImage {IMG} at (463,142) size 27x90 634 634 RenderText {#text} at (0,0) size 0x0 635 635 RenderBlock {P} at (4,1753) size 747x36 … … 685 685 RenderText {#text} at (146,46) size 4x18 686 686 text run at (146,46) width 4: " " 687 RenderImage {IMG} at (150,46) size 19x65688 RenderText {#text} at (1 69,46) size 4x18689 text run at (1 69,46) width 4: " "687 RenderImage {IMG} at (150,46) size 20x65 688 RenderText {#text} at (170,46) size 4x18 689 text run at (170,46) width 4: " " 690 690 RenderInline {SPAN} at (0,0) size 111x18 691 RenderText {#text} at (17 3,46) size 111x18692 text run at (17 3,46) width 111: "should be aligned"693 RenderText {#text} at (28 4,46) size 4x18694 text run at (28 4,46) width 4: " "695 RenderImage {IMG} at (28 8,46) size 10x35696 RenderText {#text} at ( 298,46) size 4x18697 text run at ( 298,46) width 4: " "691 RenderText {#text} at (174,46) size 111x18 692 text run at (174,46) width 111: "should be aligned" 693 RenderText {#text} at (285,46) size 4x18 694 text run at (285,46) width 4: " " 695 RenderImage {IMG} at (289,46) size 11x35 696 RenderText {#text} at (300,46) size 4x18 697 text run at (300,46) width 4: " " 698 698 RenderInline {SPAN} at (0,0) size 188x37 699 RenderText {#text} at (30 2,46) size 188x37700 text run at (30 2,46) width 188: "with the top of"701 RenderText {#text} at (49 0,46) size 4x18702 text run at (49 0,46) width 4: " "703 RenderImage {IMG} at (49 4,46) size 15x50704 RenderText {#text} at (5 09,46) size 4x18705 text run at (5 09,46) width 4: " "699 RenderText {#text} at (304,46) size 188x37 700 text run at (304,46) width 188: "with the top of" 701 RenderText {#text} at (492,46) size 4x18 702 text run at (492,46) width 4: " " 703 RenderImage {IMG} at (496,46) size 15x50 704 RenderText {#text} at (511,46) size 4x18 705 text run at (511,46) width 4: " " 706 706 RenderInline {SPAN} at (0,0) size 128x18 707 RenderText {#text} at (51 3,46) size 128x18708 text run at (51 3,46) width 128: "the tallest element in"709 RenderText {#text} at (64 1,46) size 4x18710 text run at (64 1,46) width 4: " "711 RenderImage {IMG} at (64 5,46) size 4x15712 RenderText {#text} at (6 49,46) size 4x18713 text run at (6 49,46) width 4: " "714 RenderInline {BIG} at (0,0) size 74 1x89715 RenderText {#text} at (65 3,46) size 741x89716 text run at (65 3,46) width 88: "whichever"707 RenderText {#text} at (515,46) size 128x18 708 text run at (515,46) width 128: "the tallest element in" 709 RenderText {#text} at (643,46) size 4x18 710 text run at (643,46) width 4: " " 711 RenderImage {IMG} at (647,46) size 5x15 712 RenderText {#text} at (652,46) size 4x18 713 text run at (652,46) width 4: " " 714 RenderInline {BIG} at (0,0) size 744x89 715 RenderText {#text} at (656,46) size 744x89 716 text run at (656,46) width 88: "whichever" 717 717 text run at (0,111) width 208: "line the elements appear." 718 718 RenderText {#text} at (208,111) size 4x18 -
trunk/LayoutTests/platform/mac/fast/block/float/015-expected.txt
r98508 r98852 11 11 text run at (4,4) width 4: " " 12 12 RenderTableCell {TD} at (12,0) size 657x128 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] 13 RenderImage {IMG} at (4,4) size 49x50 [bgcolor=#FFA500]13 RenderImage {IMG} at (4,4) size 50x50 [bgcolor=#FFA500] 14 14 RenderBlock {P} at (4,4) size 649x18 15 RenderText {#text} at (5 2,0) size 595x1816 text run at (5 2,0) width 595: "This text should be flowing past a tall orange rectangle on the left side of the browser window."15 RenderText {#text} at (53,0) size 595x18 16 text run at (53,0) width 595: "This text should be flowing past a tall orange rectangle on the left side of the browser window." 17 17 RenderBlock {DIV} at (4,38) size 649x18 [bgcolor=#008000] 18 RenderBR {BR} at (5 2,0) size 0x1819 RenderImage {IMG} at (4,56) size 49x50 [bgcolor=#FFA500]18 RenderBR {BR} at (53,0) size 0x18 19 RenderImage {IMG} at (4,56) size 50x50 [bgcolor=#FFA500] 20 20 RenderBlock {DIV} at (4,106) size 649x18 21 21 RenderText {#text} at (0,0) size 649x18 -
trunk/LayoutTests/platform/mac/fast/block/positioning/replaced-inside-fixed-top-bottom-expected.txt
r98508 r98852 8 8 layer at (51,140) size 560x320 9 9 RenderBlock (positioned) {DIV} at (1,40) size 560x320 [border: (1px solid #FF0000)] 10 RenderImage {IMG} at (1,1) size 39 2x31810 RenderImage {IMG} at (1,1) size 393x318 11 11 RenderText {#text} at (0,0) size 0x0 12 12 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/fast/repaint/block-layout-inline-children-replaced-expected.txt
r98508 r98852 12 12 RenderBlock {DIV} at (0,34) size 800x152 13 13 RenderBlock {DIV} at (0,0) size 402x152 [border: (1px solid #DDDDDD)] 14 RenderImage {IMG} at (155,1) size 9 2x10014 RenderImage {IMG} at (155,1) size 93x100 -
trunk/LayoutTests/platform/mac/svg/zoom/page/relative-sized-document-scrollbars-expected.txt
r98508 r98852 1 layer at (0,0) size 1357x10112 RenderView at (0,0) size 785x5853 layer at (0,0) size 1357x10114 RenderSVGRoot {svg} at ( 12,8) size 1333x9955 RenderSVGPath {rect} at ( 12,8) size 1333x995 [stroke={[type=SOLID] [color=#000000]}] [x=7.85] [y=5.85] [width=769.30] [height=573.30]1 layer at (0,0) size 800x600 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x600 4 RenderSVGRoot {svg} at (6,3) size 788x594 5 RenderSVGPath {rect} at (6,3) size 788x594 [stroke={[type=SOLID] [color=#000000]}] [x=4.63] [y=3.47] [width=453.70] [height=340.28] 6 6 RenderSVGHiddenContainer {defs} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-foreignObject-expected.txt
r98508 r98852 1 layer at (0,0) size 1131x8432 RenderView at (0,0) size 785x5853 layer at (0,0) size 1131x8434 RenderSVGRoot {svg} at (12,12) size 1119x8311 layer at (0,0) size 800x600 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x600 4 RenderSVGRoot {svg} at (12,12) size 788x588 5 5 RenderSVGForeignObject {foreignObject} at (10,10) size 580x380 6 6 RenderBlock {xhtml:div} at (0,0) size 580x18 … … 12 12 text run at (0,0) width 66: "and a link." 13 13 RenderBR {xhtml:br} at (66,0) size 0x18 14 RenderSVGPath {rect} at (12,12) size 840x552 [stroke={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=580.00] [height=380.00]14 RenderSVGPath {rect} at (12,12) size 788x552 [stroke={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=580.00] [height=380.00] 15 15 RenderSVGHiddenContainer {defs} at (0,0) size 0x0 -
trunk/LayoutTests/svg/as-background-image/resources/hearts.svg
r98508 r98852 1 <svg width="100%" height="100%" viewBox="0 200 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">1 <svg width="100%" height="100%" preserveAspectRatio="none" viewBox="0 200 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"> 2 2 <title>Suzanne's Hearts V1.0</title><desc>Author: http://richard.warburton.it - Licence: http://creativecommons.org/licenses/publicdomain</desc> 3 3 <rect x="-200" y="0" width="600" height="600" fill="black" /> -
trunk/LayoutTests/svg/as-image/resources/green-relative-size-rect.svg
r98508 r98852 1 1 <svg xmlns="http://www.w3.org/2000/svg" width='100%' height='100%'> 2 <rect fill='green' width='100px' height='100px' /> 2 <rect fill='green' width='100%' height='100%' /> 3 <circle cx="50%" cy="50%" r="10%" fill="navy"/> 3 4 </svg> -
trunk/Source/WebCore/ChangeLog
r98850 r98852 1 2011-10-31 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 CSS 2.1 failure: background-intrinsic-* 4 https://bugs.webkit.org/show_bug.cgi?id=47156 5 6 SVGs do not work as tiled background images 7 https://bugs.webkit.org/show_bug.cgi?id=16281 8 9 Apply preserveAspectRatio and synthesize viewboxes in <img> 10 https://bugs.webkit.org/show_bug.cgi?id=34521 11 12 SVG background doesn't resize properly when dimensions are changed 13 https://bugs.webkit.org/show_bug.cgi?id=42944 14 15 Images with percent height inside a floated div should use intrinsic height. 16 https://bugs.webkit.org/show_bug.cgi?id=45439 17 18 SVG image in HTML changes size as the window is resized 19 https://bugs.webkit.org/show_bug.cgi?id=52045 20 21 Reviewed by Antti Koivisto. 22 23 Implement intrinsic sizing support for SVGImage (svg embedded through <html:img>/<svg:image>/background-image/border-image/...). 24 This is demanded by CSS 2.1, and covered by new layout tests in LayoutTests/css2.1 and several new custom testcases. 25 26 Tests: css2.1/20110323/background-intrinsic-001.htm 27 css2.1/20110323/background-intrinsic-002.htm 28 css2.1/20110323/background-intrinsic-003.htm 29 css2.1/20110323/background-intrinsic-004.htm 30 css2.1/20110323/background-intrinsic-005.htm 31 css2.1/20110323/background-intrinsic-006.htm 32 css2.1/20110323/background-intrinsic-007.htm 33 css2.1/20110323/background-intrinsic-008.htm 34 css2.1/20110323/background-intrinsic-009.htm 35 svg/as-background-image/background-image-preserveaspectRatio-support.html (adapted from testcase from bug 34521) 36 svg/as-background-image/background-image-tiled.html (reduction from bug 16281) 37 svg/as-background-image/same-image-two-instances-background-image.html 38 svg/as-image/img-preserveAspectRatio-support-1.html (reduction from bug 34521) 39 svg/as-image/same-image-two-instances.html 40 svg/as-image/svg-as-relative-image-with-explicit-size.html 41 svg/as-image/svg-image-change-content-size.xhtml (reduction from bug 42944) 42 svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html 43 svg/zoom/page/zoom-svg-as-image.html 44 svg/zoom/page/zoom-svg-as-relative-image.html 45 46 * css/CSSImageGeneratorValue.cpp: 47 (WebCore::CSSImageGeneratorValue::addClient): Pass default zoom factor. 48 (WebCore::CSSImageGeneratorValue::getImage): Ditto. 49 * loader/cache/CachedImage.cpp: Enable SVGImage <-> IntSize cache. 50 (WebCore::CachedImage::lookupImageForSize): Use recently introduced ImageBySizeCache, to lookup an image for a certain size. 51 (WebCore::CachedImage::lookupOrCreateImageForRenderer): Use recently introduced ImageBySizeCache, to dynamically create copies of m_image if needed. 52 (WebCore::CachedImage::imageForRenderer): Lookup image by renderer, which first looks up a size for a renderer, then uses lookupImageForSize(). 53 (WebCore::CachedImage::setContainerSizeForRenderer): For SVGImages, pass on container size handling to ImageBySizeCache. 54 (WebCore::CachedImage::imageSizeForRenderer): Figure out the image size, respecting per-renderer overrides, for a certain renderer. 55 (WebCore::CachedImage::computeIntrinsicDimensions): Remove unnecessary RenderObject parameter. 56 * loader/cache/CachedImage.h: 57 * page/ChromeClient.h: 58 (WebCore::ChromeClient::isSVGImageChromeClient): Used to identify whether a RenderSVGRoot is embedded through a SVGImage. Returns false, by default. 59 * platform/graphics/Image.h: 60 (WebCore::Image::setImageObserver): Add helper. 61 * rendering/ImageBySizeCache.cpp: Cleanup code. 62 (WebCore::ImageBySizeCache::addClient): Assert the passed renderer is valid. 63 (WebCore::ImageBySizeCache::removeClient): Ditto. Allow removeClient() to be called w/o prio addClient() usage. 64 (WebCore::ImageBySizeCache::getImage): Add zoom parameter. 65 (WebCore::ImageBySizeCache::getRequestedSizeAndZoom): Add way to get requested size from cache, instead of actual cached sizes. 66 (WebCore::ImageBySizeCache::imageForSize): Respect empty sizes, just return 0, instead of asserting. 67 (WebCore::ImageBySizeCache::imageForRenderer): Added a helper that retrieves an image for a renderer, by lookup up its size and using imageForSize(). 68 * rendering/ImageBySizeCache.h: Cleaup code, introduce struct that replaces the std::pair<IntSize, int>. 69 (WebCore::SizeZoomAndCount::SizeZoomAndCount): 70 * rendering/RenderBoxModelObject.cpp: Implement CSS 2.1 intrinsic size negotiation for images. 71 (WebCore::resolveWidthForRatio): New inline helper function used by calculateImageIntrinsicDimensions. 72 (WebCore::resolveHeightForRatio): Ditto. 73 (WebCore::resolveAgainstIntrinsicWidthOrHeightAndRatio): Ditto. 74 (WebCore::resolveAgainstIntrinsicRatio): Ditto. 75 (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): New helper function, containing the main algorithm, which is a pure transcription of the spec. 76 (WebCore::RenderBoxModelObject::calculateFillTileSize): Use new calculateImageIntrinsicDimensions() helper to figure out the intrinsic size. 77 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Propagate calculateFillTileSize() result to the image resource, via setContainerSizeForRenderer(). 78 (WebCore::RenderBoxModelObject::paintNinePieceImage): Use new calculateImageIntrinsicDimensions() helper to figure out the intrinsic size. 79 * rendering/RenderBoxModelObject.h: Clarify some variable names, added calculateImageIntrinsicDimensions(). 80 * rendering/RenderImage.cpp: 81 (WebCore::RenderImage::RenderImage): Use IntSize(), instead of IntSize(0, 0). 82 (WebCore::RenderImage::updateIntrinsicSizeIfNeeded): Refactored from imageDimensionsChanged(). 83 (WebCore::RenderImage::imageDimensionsChanged): Use updateIntrinsicSizeIfNeeded(). 84 (WebCore::RenderImage::computeReplacedLogicalWidth): Use RenderReplaced::computeReplacedLogicalWidth() exclusively. For this to work, the intrinsic size must be correct. 85 (WebCore::RenderImage::computeIntrinsicRatioInformation): Default implementation for non-SVGImages. 86 (WebCore::RenderImage::needsPreferredWidthsRecalculation): Return true, just like RenderPart, if embeddedContentBox is not null. 87 (WebCore::RenderImage::embeddedContentBox): Returns the RenderSVGRoot* renderer of the embedded SVG, if possible. 88 * rendering/RenderImage.h: Remove isLogicalWidth/HeightSpecified() / computeReplacedLogicalHeight() / calcAspectRatioLogicalWidth/Height(). 89 * rendering/RenderImageResource.cpp: 90 (WebCore::RenderImageResource::setContainerSizeForRenderer): Pass around new "float containerZoomFactor" parameter. 91 * rendering/RenderImageResourceStyleImage.cpp: 92 (WebCore::RenderImageResourceStyleImage::image): embeddedContentBox() is now calling image() earlier than before. We now have to handle the case that the image is pending. 93 (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer): Pass zoom factor. 94 * rendering/RenderImageResourceStyleImage.h: 95 * rendering/RenderListMarker.cpp: 96 (WebCore::RenderListMarker::computePreferredLogicalWidths): Pass effective zoom to setContainerSizeForRenderer(). 97 * rendering/RenderReplaced.cpp: 98 (WebCore::RenderReplaced::computeIntrinsicLogicalWidth): Generalized this code, as RenderImage is using it as well now. Marginal changes needed. 99 (WebCore::RenderReplaced::computeIntrinsicLogicalHeight): Ditto. 100 (WebCore::RenderReplaced::computeReplacedLogicalWidth): Ditto. 101 * rendering/style/StyleCachedImage.cpp: 102 (WebCore::StyleCachedImage::computeIntrinsicDimensions): Stop passing m_renderer to CachedImage, it's no longer needed. 103 (WebCore::StyleCachedImage::setContainerSizeForRenderer): Add "float containerZoomFactor" parameter. 104 * rendering/style/StyleCachedImage.h: Add "float containerZoomFactor" parameter to setContainerSizeForRenderer. 105 * rendering/style/StyleGeneratedImage.h: 106 (WebCore::StyleGeneratedImage::setContainerSizeForRenderer): Ditto. 107 * rendering/style/StyleImage.h: Ditto. 108 * rendering/style/StylePendingImage.h: 109 (WebCore::StylePendingImage::setContainerSizeForRenderer): Ditto. 110 * rendering/svg/RenderSVGImage.cpp: 111 (WebCore::RenderSVGImage::layout): Always supply a container size when embedding SVGs in <svg:image>. 112 * rendering/svg/RenderSVGRoot.cpp: Move "override container size" from SVGSVGElement into RenderSVGRoot, where it belongs. 113 (WebCore::RenderSVGRoot::isEmbeddedThroughImageElement): Add helper method to determine whether we're loaded through SVGImage. 114 (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): If we have a valid container size, it has precendence (only supplied via external SVGImages). 115 (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): Ditto. 116 (WebCore::RenderSVGRoot::layout): Remove calcViewport() usage, no need to track/override the viewport size anymore, all done in coputeReplacedLogical* now. 117 (WebCore::RenderSVGRoot::paint): Use borderBoxRect() which now always matches the previously computed m_viewportSize. 118 (WebCore::RenderSVGRoot::computeRectForRepaint): Ditto. 119 * rendering/svg/RenderSVGRoot.h: Move "override container size" from SVGSVGElement into RenderSVGRoot, where it belongs. 120 (WebCore::RenderSVGRoot::containerSize): 121 (WebCore::RenderSVGRoot::setContainerSize): 122 * svg/SVGLength.cpp: 123 (WebCore::SVGLength::determineViewport): Resolve lengths against override container size in documents embedded through SVGImage. 124 * svg/SVGSVGElement.cpp: Remove "override container size" handling from SVGSVGElement. 125 (WebCore::SVGSVGElement::SVGSVGElement): Ditto. 126 (WebCore::SVGSVGElement::currentViewBoxRect): Always synthesize a viewBox, if we're embedded through SVGImage, as demanded by SVG 1.1 2nd Edition. 127 * svg/SVGSVGElement.h: 128 * svg/graphics/SVGImage.cpp: 129 (WebCore::SVGImageChromeClient::isSVGImageChromeClient): Return true, used to identify whether RenderSVGRoot is embedded through SVGImage. 130 (WebCore::SVGImage::createWithDataAndSize): Add new helper function. 131 (WebCore::SVGImage::setContainerZoom): Forwarded to Page::setPageZoomFactor. 132 (WebCore::SVGImage::setContainerSize): Assert that container size is not empty. We should never receive an empty container size. 133 (WebCore::SVGImage::usesContainerSize): Adapt to override container size changes, it now lives in RenderSVGRoot instead of SVGSVGElement. 134 (WebCore::SVGImage::size): New algorithm to figure out the size of an embedded SVG, as demanded by the CSS/SVG specs. 135 (WebCore::SVGImage::embeddedContentBox): Add helper which returns the RenderSVGRoot of the document. 136 (WebCore::SVGImage::computeIntrinsicDimensions): Implement intrinsic ratio calculation. 137 (WebCore::SVGImage::dataChanged): Force calling FrameView::setCanHaveScrollbars(false), as SVG images now always synthesize a viewBox, and thus never receive scrollbars. 138 * svg/graphics/SVGImage.h: 139 1 140 2011-10-31 Yury Semikhatsky <yurys@chromium.org> 2 141 -
trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp
r97854 r98852 48 48 { 49 49 ref(); 50 m_imageCache.addClient(renderer, size );50 m_imageCache.addClient(renderer, size, 1); 51 51 } 52 52 … … 61 61 // If renderer is the only client, make sure we don't delete this, if the size changes (as this will result in addClient/removeClient calls). 62 62 RefPtr<CSSImageGeneratorValue> protect(this); 63 return m_imageCache.getImage(renderer, size );63 return m_imageCache.getImage(renderer, size, 1); 64 64 } 65 65 -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r98508 r98852 35 35 #include "FrameLoaderTypes.h" 36 36 #include "FrameView.h" 37 #include "RenderObject.h" 37 38 #include "Settings.h" 38 39 #include "SharedBuffer.h" … … 131 132 } 132 133 133 Image* CachedImage::lookupImageForSize(const IntSize& size) const 134 { 135 // FIXME: Add logic for this in webkit.org/b/47156. 136 UNUSED_PARAM(size); 134 #if ENABLE(SVG) 135 inline Image* CachedImage::lookupImageForSize(const IntSize& size) const 136 { 137 if (!m_image) 138 return 0; 139 if (!m_image->isSVGImage()) 140 return m_image.get(); 141 if (Image* image = m_svgImageCache.imageForSize(size)) 142 return image; 137 143 return m_image.get(); 138 144 } 139 145 140 Image* CachedImage::lookupImageForRenderer(const RenderObject* renderer) const 141 { 142 // FIXME: Add logic for this in webkit.org/b/47156. 143 UNUSED_PARAM(renderer); 146 inline Image* CachedImage::lookupOrCreateImageForRenderer(const RenderObject* renderer) 147 { 148 if (!m_image) 149 return 0; 150 if (!m_image->isSVGImage()) 151 return m_image.get(); 152 153 // Request requested size/zoom for this renderer from the cache. 154 IntSize size; 155 float zoom = 1; 156 m_svgImageCache.getRequestedSizeAndZoom(renderer, size, zoom); 157 if (size.isEmpty()) 158 return m_image.get(); 159 160 if (Image* image = m_svgImageCache.getImage(renderer, size, zoom)) 161 return image; 162 163 // Create and cache new image at requested size. 164 RefPtr<Image> newImage = SVGImage::createWithDataAndSize(this, m_data.get(), size, zoom); 165 Image* newImagePtr = newImage.get(); 166 m_svgImageCache.addClient(renderer, size, zoom); 167 m_svgImageCache.putImage(size, newImage.release()); 168 return newImagePtr; 169 } 170 171 #else 172 inline Image* CachedImage::lookupImageForSize(const IntSize&) const 173 { 144 174 return m_image.get(); 145 175 } 146 176 147 PassRefPtr<Image> CachedImage::lookupOrCreateImageForRenderer(const RenderObject* renderer) 148 { 149 // FIXME: Add logic for this in webkit.org/b/47156. 150 UNUSED_PARAM(renderer); 151 return m_image; 152 } 177 inline Image* CachedImage::lookupOrCreateImageForRenderer(const RenderObject*) 178 { 179 return m_image.get(); 180 } 181 #endif 153 182 154 183 Image* CachedImage::image() … … 181 210 182 211 if (m_image) 183 return lookupOrCreateImageForRenderer(renderer) .get();212 return lookupOrCreateImageForRenderer(renderer); 184 213 185 214 return Image::nullImage(); 186 215 } 187 216 188 void CachedImage::setContainerSizeForRenderer(const RenderObject* renderer, const IntSize& containerSize) 189 { 190 if (!m_image) 191 return; 192 193 // FIXME: Add logic for this in webkit.org/b/47156. 217 void CachedImage::setContainerSizeForRenderer(const RenderObject* renderer, const IntSize& containerSize, float containerZoom) 218 { 219 if (!m_image || containerSize.isEmpty()) 220 return; 221 #if ENABLE(SVG) 222 if (!m_image->isSVGImage()) { 223 m_image->setContainerSize(containerSize); 224 return; 225 } 226 m_svgImageCache.addClient(renderer, containerSize, containerZoom); 227 #else 194 228 UNUSED_PARAM(renderer); 195 229 m_image->setContainerSize(containerSize); 230 #endif 196 231 } 197 232 … … 224 259 ASSERT(!isPurgeable()); 225 260 226 Image* image = lookupImageForRenderer(renderer); 227 if (!image) 261 if (!m_image) 228 262 return IntSize(); 263 #if ENABLE(SVG) 264 if (m_image->isSVGImage()) { 265 // SVGImages already includes the zooming in its intrinsic size. 266 IntSize size; 267 float zoom = 1; 268 m_svgImageCache.getRequestedSizeAndZoom(renderer, size, zoom); 269 if (!size.isEmpty()) 270 return size; 271 return m_image->size(); 272 } 273 #endif 274 229 275 if (multiplier == 1.0f) 230 276 return m_image->size(); … … 242 288 } 243 289 244 void CachedImage::computeIntrinsicDimensions( const RenderObject* renderer,Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)245 { 246 if ( Image* image = lookupImageForRenderer(renderer))247 image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);290 void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) 291 { 292 if (m_image) 293 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio); 248 294 } 249 295 -
trunk/Source/WebCore/loader/cache/CachedImage.h
r98508 r98852 59 59 bool canRender(const RenderObject* renderer, float multiplier) { return !errorOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); } 60 60 61 // These are only used for SVGImage right now 62 void setContainerSizeForRenderer(const RenderObject*, const IntSize&); 61 void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float); 63 62 bool usesImageContainerSize() const; 64 63 bool imageHasRelativeWidth() const; … … 67 66 // This method takes a zoom multiplier that can be used to increase the natural size of the image by the zoom. 68 67 IntSize imageSizeForRenderer(const RenderObject*, float multiplier); // returns the size of the complete image. 69 void computeIntrinsicDimensions( const RenderObject*,Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);68 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio); 70 69 71 70 virtual void didAddClient(CachedResourceClient*); … … 97 96 private: 98 97 Image* lookupImageForSize(const IntSize&) const; 99 Image* lookupImageForRenderer(const RenderObject*) const; 100 PassRefPtr<Image> lookupOrCreateImageForRenderer(const RenderObject*); 98 Image* lookupOrCreateImageForRenderer(const RenderObject*); 101 99 102 100 void createImage(); -
trunk/Source/WebCore/page/ChromeClient.h
r98508 r98852 337 337 virtual void numWheelEventHandlersChanged(unsigned) = 0; 338 338 339 virtual bool isSVGImageChromeClient() const { return false; } 340 339 341 protected: 340 342 virtual ~ChromeClient() { } -
trunk/Source/WebCore/platform/graphics/Image.h
r97729 r98852 130 130 // Typically the CachedImage that owns us. 131 131 ImageObserver* imageObserver() const { return m_imageObserver; } 132 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer; } 132 133 133 134 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; -
trunk/Source/WebCore/rendering/ImageBySizeCache.cpp
r98508 r98852 33 33 } 34 34 35 void ImageBySizeCache::addClient(const RenderObject* renderer, const IntSize& size )35 void ImageBySizeCache::addClient(const RenderObject* renderer, const IntSize& size, float zoom) 36 36 { 37 ASSERT(renderer); 37 38 if (!size.isEmpty()) 38 39 m_sizes.add(size); … … 40 41 RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); 41 42 if (it == m_clients.end()) 42 m_clients.add(renderer, Size CountPair(size, 1));43 m_clients.add(renderer, SizeZoomAndCount(size, zoom, 1)); 43 44 else { 44 SizeCountPair& sizeCount = it->second; 45 ++sizeCount.second; 45 SizeZoomAndCount& sizeCount = it->second; 46 sizeCount.requestedSize = size; 47 sizeCount.requestedZoom = zoom; 48 ++sizeCount.count; 46 49 } 47 50 } … … 49 52 void ImageBySizeCache::removeClient(const RenderObject* renderer) 50 53 { 54 ASSERT(renderer); 51 55 RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); 52 56 ASSERT(it != m_clients.end()); 53 57 54 Size CountPair& sizeCount = it->second;55 IntSize size = sizeCount. first;58 SizeZoomAndCount& sizeCount = it->second; 59 IntSize size = sizeCount.actualSize; 56 60 if (!size.isEmpty()) { 57 61 m_sizes.remove(size); … … 60 64 } 61 65 62 if (!--sizeCount. second)66 if (!--sizeCount.count) 63 67 m_clients.remove(renderer); 64 68 } 65 69 66 Image* ImageBySizeCache::getImage(const RenderObject* renderer, const IntSize& size )70 Image* ImageBySizeCache::getImage(const RenderObject* renderer, const IntSize& size, float zoom) 67 71 { 68 72 RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); 69 ASSERT(it != m_clients.end());70 71 SizeCountPair& sizeCount = it->second;72 IntSize oldSize = sizeCount.first;73 if (oldSize != size) {74 removeClient(renderer);75 addClient(renderer, size);73 if (it != m_clients.end()) { 74 SizeZoomAndCount& sizeCount = it->second; 75 IntSize oldSize = sizeCount.actualSize; 76 if (oldSize != size) { 77 removeClient(renderer); 78 addClient(renderer, size, zoom); 79 } 76 80 } 77 81 … … 82 86 // Look up the image in our cache. 83 87 return m_images.get(size).get(); 88 } 89 90 void ImageBySizeCache::getRequestedSizeAndZoom(const RenderObject* renderer, IntSize& size, float& zoom) 91 { 92 RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); 93 if (it == m_clients.end()) 94 return; 95 SizeZoomAndCount& sizeCount = it->second; 96 size = sizeCount.requestedSize; 97 zoom = sizeCount.requestedZoom; 84 98 } 85 99 … … 98 112 Image* ImageBySizeCache::imageForSize(const IntSize& size) const 99 113 { 114 if (size.isEmpty()) 115 return 0; 100 116 HashMap<IntSize, RefPtr<Image> >::const_iterator it = m_images.find(size); 101 117 if (it == m_images.end()) … … 104 120 } 105 121 106 I ntSize ImageBySizeCache::sizeForClient(const RenderObject* renderer) const122 Image* ImageBySizeCache::imageForRenderer(const RenderObject* renderer) const 107 123 { 124 if (!renderer) 125 return 0; 108 126 RenderObjectSizeCountMap::const_iterator it = m_clients.find(renderer); 109 127 if (it == m_clients.end()) 110 return IntSize();111 return i t->second.first;128 return 0; 129 return imageForSize(it->second.actualSize); 112 130 } 113 131 -
trunk/Source/WebCore/rendering/ImageBySizeCache.h
r98508 r98852 32 32 class RenderObject; 33 33 34 typedef pair<IntSize, int> SizeCountPair; 35 typedef HashMap<const RenderObject*, SizeCountPair> RenderObjectSizeCountMap; 34 struct SizeZoomAndCount { 35 SizeZoomAndCount(IntSize newSize = IntSize(), float newZoom = 0, int newCount = 0) 36 : actualSize(newSize) 37 , requestedSize(newSize) 38 , actualZoom(newZoom) 39 , requestedZoom(newZoom) 40 , count(newCount) 41 { 42 } 43 44 IntSize actualSize; 45 IntSize requestedSize; 46 float actualZoom; 47 float requestedZoom; 48 int count; 49 }; 50 51 typedef HashMap<const RenderObject*, SizeZoomAndCount> RenderObjectSizeCountMap; 36 52 37 53 class ImageBySizeCache { … … 39 55 ImageBySizeCache(); 40 56 41 void addClient(const RenderObject*, const IntSize& );57 void addClient(const RenderObject*, const IntSize&, float zoom); 42 58 void removeClient(const RenderObject*); 43 59 44 Image* getImage(const RenderObject*, const IntSize&); 60 Image* getImage(const RenderObject*, const IntSize&, float zoom); 61 void getRequestedSizeAndZoom(const RenderObject*, IntSize&, float& zoom); 62 45 63 void putImage(const IntSize&, PassRefPtr<Image>); 46 64 … … 48 66 49 67 Image* imageForSize(const IntSize&) const; 50 I ntSize sizeForClient(const RenderObject*) const;68 Image* imageForRenderer(const RenderObject*) const; 51 69 const RenderObjectSizeCountMap& clients() const { return m_clients; } 52 70 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r98508 r98852 783 783 } 784 784 785 LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, LayoutSize positioningAreaSize) const 785 static inline LayoutUnit resolveWidthForRatio(LayoutUnit height, const FloatSize& intrinsicRatio) 786 { 787 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 788 return static_cast<LayoutUnit>(ceilf(height * intrinsicRatio.width() / intrinsicRatio.height())); 789 } 790 791 static inline LayoutUnit resolveHeightForRatio(LayoutUnit width, const FloatSize& intrinsicRatio) 792 { 793 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 794 return static_cast<LayoutUnit>(ceilf(width * intrinsicRatio.height() / intrinsicRatio.width())); 795 } 796 797 static inline LayoutSize resolveAgainstIntrinsicWidthOrHeightAndRatio(const LayoutSize& size, const FloatSize& intrinsicRatio, LayoutUnit useWidth, LayoutUnit useHeight) 798 { 799 if (intrinsicRatio.isEmpty()) { 800 if (useWidth) 801 return LayoutSize(useWidth, size.height()); 802 return LayoutSize(size.width(), useHeight); 803 } 804 805 if (useWidth) 806 return LayoutSize(useWidth, resolveHeightForRatio(useWidth, intrinsicRatio)); 807 return LayoutSize(resolveWidthForRatio(useHeight, intrinsicRatio), useHeight); 808 } 809 810 static inline LayoutSize resolveAgainstIntrinsicRatio(const LayoutSize& size, const FloatSize& intrinsicRatio) 811 { 812 // Two possible solutions: (size.width(), solutionHeight) or (solutionWidth, size.height()) 813 // "... must be assumed to be the largest dimensions..." = easiest answer: the rect with the largest surface area. 814 815 LayoutUnit solutionWidth = resolveWidthForRatio(size.height(), intrinsicRatio); 816 LayoutUnit solutionHeight = resolveHeightForRatio(size.width(), intrinsicRatio); 817 if (solutionWidth <= size.width()) { 818 if (solutionHeight <= size.height()) { 819 // If both solutions fit, choose the one covering the larger area. 820 LayoutUnit areaOne = solutionWidth * size.height(); 821 LayoutUnit areaTwo = size.width() * solutionHeight; 822 if (areaOne < areaTwo) 823 return LayoutSize(size.width(), solutionHeight); 824 return LayoutSize(solutionWidth, size.height()); 825 } 826 827 // Only the first solution fits. 828 return LayoutSize(solutionWidth, size.height()); 829 } 830 831 // Only the second solution fits, assert that. 832 ASSERT(solutionHeight <= size.height()); 833 return LayoutSize(size.width(), solutionHeight); 834 } 835 836 LayoutSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const LayoutSize& positioningAreaSize) const 837 { 838 LayoutUnit resolvedWidth = 0; 839 LayoutUnit resolvedHeight = 0; 840 FloatSize intrinsicRatio; 841 842 // A generated image without a fixed size, will always return the container size as intrinsic size. 843 if (image->isGeneratedImage() && image->usesImageContainerSize()) { 844 resolvedWidth = positioningAreaSize.width(); 845 resolvedHeight = positioningAreaSize.height(); 846 } else { 847 Length intrinsicWidth; 848 Length intrinsicHeight; 849 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, intrinsicRatio); 850 851 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 852 if (intrinsicWidth.isFixed()) 853 resolvedWidth = static_cast<LayoutUnit>(ceilf(intrinsicWidth.value() * style()->effectiveZoom())); 854 if (intrinsicHeight.isFixed()) 855 resolvedHeight = static_cast<LayoutUnit>(ceilf(intrinsicHeight.value() * style()->effectiveZoom())); 856 } 857 858 // Intrinsic dimensions expressed as percentages must be resolved relative to the dimensions of the rectangle 859 // that establishes the coordinate system for the 'background-position' property. SVG on the other hand 860 // _explicitely_ says that percentage values for the width/height attributes do NOT define intrinsic dimensions. 861 if (resolvedWidth > 0 && resolvedHeight > 0) 862 return LayoutSize(resolvedWidth, resolvedHeight); 863 864 // If the image has one of either an intrinsic width or an intrinsic height: 865 // * and an intrinsic aspect ratio, then the missing dimension is calculated from the given dimension and the ratio. 866 // * and no intrinsic aspect ratio, then the missing dimension is assumed to be the size of the rectangle that 867 // establishes the coordinate system for the 'background-position' property. 868 if ((resolvedWidth && !resolvedHeight) || (!resolvedWidth && resolvedHeight)) 869 return resolveAgainstIntrinsicWidthOrHeightAndRatio(positioningAreaSize, intrinsicRatio, resolvedWidth, resolvedHeight); 870 871 // If the image has no intrinsic dimensions and has an intrinsic ratio the dimensions must be assumed to be the 872 // largest dimensions at that ratio such that neither dimension exceeds the dimensions of the rectangle that 873 // establishes the coordinate system for the 'background-position' property. 874 if (!resolvedWidth && !resolvedHeight && !intrinsicRatio.isEmpty()) 875 return resolveAgainstIntrinsicRatio(positioningAreaSize, intrinsicRatio); 876 877 // If the image has no intrinsic ratio either, then the dimensions must be assumed to be the rectangle that 878 // establishes the coordinate system for the 'background-position' property. 879 return positioningAreaSize; 880 } 881 882 LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, const LayoutSize& positioningAreaSize) const 786 883 { 787 884 StyleImage* image = fillLayer->image(); 788 image->setContainerSizeForRenderer(this, positioningAreaSize); // Use the box established by background-origin.789 790 885 EFillSizeType type = fillLayer->size().type; 886 887 LayoutSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize); 791 888 792 889 switch (type) { … … 811 908 // scale to maintain our aspect ratio. 812 909 if (layerWidth.isAuto() && !layerHeight.isAuto()) { 813 LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());814 910 if (imageIntrinsicSize.height()) 815 911 w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height(); 816 912 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { 817 LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());818 913 if (imageIntrinsicSize.width()) 819 914 h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width(); 820 915 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { 821 916 // If both width and height are auto, use the image's intrinsic size. 822 LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());823 917 w = imageIntrinsicSize.width(); 824 918 h = imageIntrinsicSize.height(); … … 827 921 return LayoutSize(max<LayoutUnit>(1, w), max<LayoutUnit>(1, h)); 828 922 } 923 case SizeNone: { 924 // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any. 925 if (!imageIntrinsicSize.isEmpty()) 926 return imageIntrinsicSize; 927 928 // If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for ‘contain’. 929 type = Contain; 930 } 829 931 case Contain: 830 932 case Cover: { 831 LayoutSize imageIntrinsicSize = image->imageSize(this, 1);832 933 float horizontalScaleFactor = imageIntrinsicSize.width() 833 934 ? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1; … … 836 937 float scaleFactor = type == Contain ? min(horizontalScaleFactor, verticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor); 837 938 return LayoutSize(max<LayoutUnit>(1, imageIntrinsicSize.width() * scaleFactor), max<LayoutUnit>(1, imageIntrinsicSize.height() * scaleFactor)); 838 } 839 case SizeNone: 840 break; 841 } 842 843 return image->imageSize(this, style()->effectiveZoom()); 939 } 940 } 941 942 ASSERT_NOT_REACHED(); 943 return LayoutSize(); 844 944 } 845 945 … … 928 1028 } 929 1029 930 geometry.setTileSize(calculateFillTileSize(fillLayer, positioningAreaSize)); 1030 LayoutSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize); 1031 fillLayer->image()->setContainerSizeForRenderer(this, fillTileSize, style()->effectiveZoom()); 1032 geometry.setTileSize(fillTileSize); 931 1033 932 1034 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); … … 988 1090 LayoutRect borderImageRect = LayoutRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset); 989 1091 990 styleImage->setContainerSizeForRenderer(this, borderImageRect.size()); 991 LayoutSize imageSize = styleImage->imageSize(this, 1.0f); 1092 LayoutSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size()); 1093 1094 // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any. 1095 LayoutSize containerSize = imageSize.isEmpty() ? borderImageRect.size() : imageSize; 1096 styleImage->setContainerSizeForRenderer(this, containerSize, style->effectiveZoom()); 1097 992 1098 LayoutUnit imageWidth = imageSize.width(); 993 1099 LayoutUnit imageHeight = imageSize.height(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r98508 r98852 196 196 virtual bool isBoxModelObject() const { return true; } 197 197 198 LayoutSize calculateFillTileSize(const FillLayer*, LayoutSize scaledSize) const; 198 LayoutSize calculateFillTileSize(const FillLayer*, const LayoutSize& scaledPositioningAreaSize) const; 199 LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize) const; 199 200 200 201 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, -
trunk/Source/WebCore/rendering/RenderImage.cpp
r98508 r98852 42 42 #include "RenderLayer.h" 43 43 #include "RenderView.h" 44 #include "SVGImage.h" 44 45 #include <wtf/UnusedParam.h> 45 46 … … 51 52 52 53 RenderImage::RenderImage(Node* node) 53 : RenderReplaced(node, IntSize( 0, 0))54 : RenderReplaced(node, IntSize()) 54 55 , m_needsToSetSizeForAltText(false) 55 56 , m_didIncrementVisuallyNonEmptyPixelCount(false) … … 174 175 } 175 176 177 bool RenderImage::updateIntrinsicSizeIfNeeded(const LayoutSize& newSize, bool imageSizeChanged) 178 { 179 if (newSize == intrinsicSize() && !imageSizeChanged) 180 return false; 181 if (m_imageResource->errorOccurred()) 182 return imageSizeChanged; 183 setIntrinsicSize(newSize); 184 return true; 185 } 186 176 187 void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* rect) 177 188 { 178 189 bool shouldRepaint = true; 179 180 if (m_imageResource->imageSize(style()->effectiveZoom()) != intrinsicSize() || imageSizeChanged) { 181 if (!m_imageResource->errorOccurred()) 182 setIntrinsicSize(m_imageResource->imageSize(style()->effectiveZoom())); 183 190 if (updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom()), imageSizeChanged)) { 184 191 // In the case of generated image content using :before/:after, we might not be in the 185 192 // render tree yet. In that case, we don't need to worry about check for layout, since we'll get a … … 476 483 } 477 484 478 bool RenderImage::isLogicalWidthSpecified() const479 {480 switch (style()->logicalWidth().type()) {481 case Fixed:482 case Percent:483 return true;484 case Auto:485 case Relative: // FIXME: Shouldn't this case return true?486 case Intrinsic:487 case MinIntrinsic:488 return false;489 case Undefined:490 ASSERT_NOT_REACHED();491 return false;492 }493 ASSERT_NOT_REACHED();494 return false;495 }496 497 bool RenderImage::isLogicalHeightSpecified() const498 {499 switch (style()->logicalHeight().type()) {500 case Fixed:501 case Percent:502 return true;503 case Auto:504 case Relative: // FIXME: Shouldn't this case return true?505 case Intrinsic:506 case MinIntrinsic:507 return false;508 case Undefined:509 ASSERT_NOT_REACHED();510 return false;511 }512 ASSERT_NOT_REACHED();513 return false;514 }515 516 485 LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const 517 486 { 518 if (m_imageResource->imageHasRelativeWidth()) 519 if (RenderObject* cb = isPositioned() ? container() : containingBlock()) { 520 if (cb->isBox()) 521 m_imageResource->setContainerSizeForRenderer(LayoutSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight())); 522 } 523 524 LayoutUnit logicalWidth; 525 if (isLogicalWidthSpecified()) 526 logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth()); 527 else if (m_imageResource->usesImageContainerSize()) { 528 LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom()); 529 logicalWidth = style()->isHorizontalWritingMode() ? size.width() : size.height(); 530 } else if (m_imageResource->imageHasRelativeWidth()) 531 logicalWidth = 0; // If the image is relatively-sized, set the width to 0 until there is a set container size. 532 else 533 logicalWidth = calcAspectRatioLogicalWidth(); 534 535 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, includeMaxWidth); 536 } 537 538 LayoutUnit RenderImage::computeReplacedLogicalHeight() const 539 { 540 // FIXME: This function should use RenderReplaced::computeReplacedLogicalHeight() 541 LayoutUnit logicalHeight; 542 if (logicalHeightIsAuto() && !style()->logicalWidth().isAuto() && intrinsicLogicalWidth() && intrinsicLogicalHeight()) 543 logicalHeight = static_cast<LayoutUnit>(availableLogicalWidth() * intrinsicLogicalHeight() / intrinsicLogicalWidth()); 544 else if (isLogicalHeightSpecified()) 545 logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 546 else if (m_imageResource->usesImageContainerSize()) { 547 LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom()); 548 logicalHeight = style()->isHorizontalWritingMode() ? size.height() : size.width(); 549 } else if (m_imageResource->imageHasRelativeHeight()) 550 logicalHeight = 0; // If the image is relatively-sized, set the height to 0 until there is a set container size. 551 else 552 logicalHeight = calcAspectRatioLogicalHeight(); 553 554 return computeReplacedLogicalHeightRespectingMinMaxHeight(logicalHeight); 555 } 556 557 int RenderImage::calcAspectRatioLogicalWidth() const 558 { 559 int intrinsicWidth = intrinsicLogicalWidth(); 560 int intrinsicHeight = intrinsicLogicalHeight(); 561 if (!intrinsicHeight) 487 // If we've got an explicit width/height assigned, propagate it to the image resource. 488 if (style()->logicalWidth().isFixed() && style()->logicalHeight().isFixed()) { 489 LayoutUnit width = RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth); 490 m_imageResource->setContainerSizeForRenderer(IntSize(width, computeReplacedLogicalHeight())); 491 return width; 492 } 493 494 RenderBox* contentRenderer = embeddedContentBox(); 495 bool hasRelativeWidth = contentRenderer ? contentRenderer->style()->width().isPercent() : m_imageResource->imageHasRelativeWidth(); 496 bool hasRelativeHeight = contentRenderer ? contentRenderer->style()->height().isPercent() : m_imageResource->imageHasRelativeHeight(); 497 498 LayoutSize containerSize; 499 if (hasRelativeWidth || hasRelativeHeight) { 500 // Propagate the containing block size to the image resource, otherwhise we can't compute our own intrinsic size, if it's relative. 501 RenderObject* containingBlock = isPositioned() ? container() : this->containingBlock(); 502 if (containingBlock->isBox()) { 503 RenderBox* box = toRenderBox(containingBlock); 504 containerSize = LayoutSize(box->availableWidth(), box->availableHeight()); // Already contains zooming information. 505 } 506 } else { 507 // Propagate the current zoomed image size to the image resource, otherwhise the image size will remain the same on-screen. 508 CachedImage* cachedImage = m_imageResource->cachedImage(); 509 if (cachedImage && cachedImage->image()) { 510 containerSize = cachedImage->image()->size(); 511 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 512 containerSize.setWidth(static_cast<LayoutUnit>(containerSize.width() * style()->effectiveZoom())); 513 containerSize.setHeight(static_cast<LayoutUnit>(containerSize.height() * style()->effectiveZoom())); 514 } 515 } 516 517 if (!containerSize.isEmpty()) { 518 m_imageResource->setContainerSizeForRenderer(containerSize); 519 const_cast<RenderImage*>(this)->updateIntrinsicSizeIfNeeded(containerSize, false); 520 } 521 522 return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth); 523 } 524 525 void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const 526 { 527 // Assure this method is never used for SVGImages. 528 ASSERT(!embeddedContentBox()); 529 isPercentageIntrinsicSize = false; 530 CachedImage* cachedImage = m_imageResource ? m_imageResource->cachedImage() : 0; 531 if (cachedImage && cachedImage->image()) 532 intrinsicRatio = cachedImage->image()->size(); 533 } 534 535 bool RenderImage::needsPreferredWidthsRecalculation() const 536 { 537 if (RenderReplaced::needsPreferredWidthsRecalculation()) 538 return true; 539 return embeddedContentBox(); 540 } 541 542 RenderBox* RenderImage::embeddedContentBox() const 543 { 544 if (!m_imageResource) 562 545 return 0; 563 if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) 564 return intrinsicWidth; // Don't bother scaling. 565 return RenderBox::computeReplacedLogicalHeight() * intrinsicWidth / intrinsicHeight; 566 } 567 568 int RenderImage::calcAspectRatioLogicalHeight() const 569 { 570 int intrinsicWidth = intrinsicLogicalWidth(); 571 int intrinsicHeight = intrinsicLogicalHeight(); 572 if (!intrinsicWidth) 573 return 0; 574 if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) 575 return intrinsicHeight; // Don't bother scaling. 576 return RenderBox::computeReplacedLogicalWidth() * intrinsicHeight / intrinsicWidth; 546 547 RefPtr<Image> image = m_imageResource->image(); 548 if (image && image->isSVGImage()) 549 return static_pointer_cast<SVGImage>(image)->embeddedContentBox(); 550 551 return 0; 577 552 } 578 553 -
trunk/Source/WebCore/rendering/RenderImage.h
r98508 r98852 55 55 56 56 protected: 57 virtual bool needsPreferredWidthsRecalculation() const; 58 virtual RenderBox* embeddedContentBox() const; 59 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const; 60 57 61 virtual void styleDidChange(StyleDifference, const RenderStyle*); 58 62 … … 61 65 virtual void paintIntoRect(GraphicsContext*, const IntRect&); 62 66 virtual void paint(PaintInfo&, const LayoutPoint&); 63 64 bool isLogicalWidthSpecified() const;65 bool isLogicalHeightSpecified() const;66 67 67 68 virtual void intrinsicSizeChanged() … … 87 88 88 89 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 89 virtual LayoutUnit computeReplacedLogicalHeight() const;90 90 91 91 IntSize imageSizeForError(CachedImage*) const; 92 92 void imageDimensionsChanged(bool imageSizeChanged, const IntRect* = 0); 93 94 int calcAspectRatioLogicalWidth() const; 95 int calcAspectRatioLogicalHeight() const; 93 bool updateIntrinsicSizeIfNeeded(const LayoutSize&, bool imageSizeChanged); 96 94 97 95 void paintAreaElementFocusRing(PaintInfo&); -
trunk/Source/WebCore/rendering/RenderImageResource.cpp
r98508 r98852 94 94 ASSERT(m_renderer); 95 95 if (m_cachedImage) 96 m_cachedImage->setContainerSizeForRenderer(m_renderer, imageContainerSize );96 m_cachedImage->setContainerSizeForRenderer(m_renderer, imageContainerSize, m_renderer->style()->effectiveZoom()); 97 97 } 98 98 -
trunk/Source/WebCore/rendering/RenderImageResourceStyleImage.cpp
r98508 r98852 61 61 } 62 62 63 PassRefPtr<Image> RenderImageResourceStyleImage::image(int width, int height) const 64 { 65 // Generated content may trigger calls to image() while we're still pending, don't assert but gracefully exit. 66 if (m_styleImage->isPendingImage()) 67 return 0; 68 return m_styleImage->image(m_renderer, IntSize(width, height)); 69 } 70 71 void RenderImageResourceStyleImage::setContainerSizeForRenderer(const IntSize& size) 72 { 73 ASSERT(m_renderer); 74 m_styleImage->setContainerSizeForRenderer(m_renderer, size, m_renderer->style()->effectiveZoom()); 75 } 76 63 77 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderImageResourceStyleImage.h
r98508 r98852 47 47 48 48 virtual bool hasImage() const { return true; } 49 virtual PassRefPtr<Image> image(int width = 0, int height = 0) const { return m_styleImage->image(m_renderer, IntSize(width, height)); }49 virtual PassRefPtr<Image> image(int width = 0, int height = 0) const; 50 50 virtual bool errorOccurred() const { return m_styleImage->errorOccurred(); } 51 51 52 virtual void setContainerSizeForRenderer(const IntSize& size) { m_styleImage->setContainerSizeForRenderer(m_renderer, size); }52 virtual void setContainerSizeForRenderer(const IntSize&); 53 53 virtual bool usesImageContainerSize() const { return m_styleImage->usesImageContainerSize(); } 54 54 virtual bool imageHasRelativeWidth() const { return m_styleImage->imageHasRelativeWidth(); } -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r98508 r98852 1351 1351 // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box. 1352 1352 LayoutUnit bulletWidth = fontMetrics.ascent() / 2; 1353 m_image->setContainerSizeForRenderer(this, LayoutSize(bulletWidth, bulletWidth) );1353 m_image->setContainerSizeForRenderer(this, LayoutSize(bulletWidth, bulletWidth), style()->effectiveZoom()); 1354 1354 LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom()); 1355 1355 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHorizontalWritingMode() ? imageSize.width() : imageSize.height(); -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r98767 r98852 202 202 { 203 203 if (m_hasIntrinsicSize) { 204 ASSERT(!contentRenderer);205 return computeReplacedLogicalWidthRespectingMinMaxWidth(calcAspectRatioLogicalWidth(), includeMaxWidth);204 if (!contentRenderer || !contentRenderer->style()->logicalWidth().isFixed()) 205 return computeReplacedLogicalWidthRespectingMinMaxWidth(calcAspectRatioLogicalWidth(), includeMaxWidth); 206 206 } 207 207 ASSERT(contentRenderer); … … 213 213 { 214 214 if (m_hasIntrinsicSize) { 215 ASSERT(!contentRenderer);216 return computeReplacedLogicalHeightRespectingMinMaxHeight(calcAspectRatioLogicalHeight());215 if (!contentRenderer || !contentRenderer->style()->logicalHeight().isFixed()) 216 return computeReplacedLogicalHeightRespectingMinMaxHeight(calcAspectRatioLogicalHeight()); 217 217 } 218 218 ASSERT(contentRenderer); … … 236 236 contentRenderStyle = contentRenderer->style(); 237 237 ASSERT(contentRenderStyle); 238 } 238 } else 239 computeIntrinsicRatioInformation(intrinsicRatio, isPercentageIntrinsicSize); 239 240 240 241 if (style()->logicalWidth().isAuto()) { -
trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp
r98508 r98852 65 65 } 66 66 67 void StyleCachedImage::computeIntrinsicDimensions(const RenderObject* renderer, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)67 void StyleCachedImage::computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) 68 68 { 69 m_image->computeIntrinsicDimensions( renderer,intrinsicWidth, intrinsicHeight, intrinsicRatio);69 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio); 70 70 } 71 71 … … 75 75 } 76 76 77 void StyleCachedImage::setContainerSizeForRenderer(const RenderObject* renderer, const IntSize& imageContainerSize )77 void StyleCachedImage::setContainerSizeForRenderer(const RenderObject* renderer, const IntSize& imageContainerSize, float imageContainerZoomFactor) 78 78 { 79 m_image->setContainerSizeForRenderer(renderer, imageContainerSize );79 m_image->setContainerSizeForRenderer(renderer, imageContainerSize, imageContainerZoomFactor); 80 80 } 81 81 -
trunk/Source/WebCore/rendering/style/StyleCachedImage.h
r98508 r98852 49 49 virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio); 50 50 virtual bool usesImageContainerSize() const; 51 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& );51 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float); 52 52 virtual void addClient(RenderObject*); 53 53 virtual void removeClient(RenderObject*); -
trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h
r98508 r98852 48 48 virtual void computeIntrinsicDimensions(const RenderObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio); 49 49 virtual bool usesImageContainerSize() const { return !m_fixedSize; } 50 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& containerSize ) { m_containerSize = containerSize; }50 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& containerSize, float) { m_containerSize = containerSize; } 51 51 virtual void addClient(RenderObject*); 52 52 virtual void removeClient(RenderObject*); -
trunk/Source/WebCore/rendering/style/StyleImage.h
r98508 r98852 58 58 virtual bool imageHasRelativeHeight() const = 0; 59 59 virtual bool usesImageContainerSize() const = 0; 60 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& ) = 0;60 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) = 0; 61 61 virtual void addClient(RenderObject*) = 0; 62 62 virtual void removeClient(RenderObject*) = 0; -
trunk/Source/WebCore/rendering/style/StylePendingImage.h
r98508 r98852 50 50 virtual void computeIntrinsicDimensions(const RenderObject*, Length& /* intrinsicWidth */ , Length& /* intrinsicHeight */, FloatSize& /* intrinsicRatio */) { } 51 51 virtual bool usesImageContainerSize() const { return false; } 52 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize& ) { }52 virtual void setContainerSizeForRenderer(const RenderObject*, const IntSize&, float) { } 53 53 virtual void addClient(RenderObject*) { } 54 54 virtual void removeClient(RenderObject*) { } -
trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp
r98508 r98852 67 67 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout()); 68 68 SVGImageElement* image = static_cast<SVGImageElement*>(node()); 69 m_imageResource->setContainerSizeForRenderer(enclosingIntRect(m_objectBoundingBox).size()); 69 70 70 71 bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_updateCachedRepaintRect; -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r98508 r98852 27 27 #include "RenderSVGRoot.h" 28 28 29 #include "Chrome.h" 30 #include "ChromeClient.h" 29 31 #include "Frame.h" 30 32 #include "GraphicsContext.h" 31 33 #include "HitTestResult.h" 32 34 #include "LayoutRepainter.h" 35 #include "Page.h" 33 36 #include "RenderPart.h" 34 37 #include "RenderSVGContainer.h" … … 115 118 } 116 119 117 LayoutUnit RenderSVGRoot::computeIntrinsicWidth(LayoutUnit replacedWidth) const 118 { 119 if (!style()->width().isPercent()) 120 return replacedWidth; 121 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 122 return static_cast<int>(ceilf(replacedWidth * style()->effectiveZoom())); 123 } 124 125 LayoutUnit RenderSVGRoot::computeIntrinsicHeight(LayoutUnit replacedHeight) const 126 { 127 if (!style()->height().isPercent()) 128 return replacedHeight; 129 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 130 return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom())); 120 bool RenderSVGRoot::isEmbeddedThroughImageElement() const 121 { 122 if (!node()) 123 return false; 124 125 Frame* frame = node()->document()->frame(); 126 if (!frame) 127 return false; 128 129 // Test whether we're embedded through an img. 130 if (!frame->page() || !frame->page()->chrome()) 131 return false; 132 133 ChromeClient* chromeClient = frame->page()->chrome()->client(); 134 if (!chromeClient || !chromeClient->isSVGImageChromeClient()) 135 return false; 136 137 return true; 131 138 } 132 139 … … 142 149 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const 143 150 { 144 LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth); 151 // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size. 152 LayoutUnit replacedWidth = m_containerSize.width(); 153 if (replacedWidth > 0) 154 return replacedWidth; 155 156 replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth); 145 157 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 146 158 if (!frame) 147 return computeIntrinsicWidth(replacedWidth);159 return replacedWidth; 148 160 149 161 if (isEmbeddedThroughFrameContainingSVGDocument(frame)) 150 return computeIntrinsicWidth(replacedWidth);162 return replacedWidth; 151 163 152 164 RenderPart* ownerRenderer = frame->ownerRenderer(); … … 182 194 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const 183 195 { 184 LayoutUnit replacedHeight = RenderBox::computeReplacedLogicalHeight(); 185 196 // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size. 197 LayoutUnit replacedHeight = m_containerSize.height(); 198 if (replacedHeight > 0) 199 return replacedHeight; 200 201 replacedHeight = RenderBox::computeReplacedLogicalHeight(); 186 202 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 187 203 if (!frame) 188 return computeIntrinsicHeight(replacedHeight);204 return replacedHeight; 189 205 190 206 if (isEmbeddedThroughFrameContainingSVGDocument(frame)) 191 return computeIntrinsicHeight(replacedHeight);207 return replacedHeight; 192 208 193 209 RenderPart* ownerRenderer = frame->ownerRenderer(); … … 221 237 computeLogicalWidth(); 222 238 computeLogicalHeight(); 223 calcViewport();224 239 225 240 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 226 m_isLayoutSizeChanged = svg->hasRelativeLengths() && oldSize != size();227 241 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); 242 228 243 if (view() && view()->frameView() && view()->frameView()->embeddedContentBox()) { 229 244 if (!m_needsSizeNegotiationWithHostDocument) … … 271 286 return; 272 287 273 // An empty viewport disables rendering. FIXME: Should we still render filters?274 if ( m_viewportSize.isEmpty())288 // An empty viewport disables rendering. 289 if (borderBoxRect().isEmpty()) 275 290 return; 276 291 … … 329 344 RenderBox::updateFromElement(); 330 345 SVGResourcesCache::clientUpdatedFromElement(this, style()); 331 }332 333 void RenderSVGRoot::calcViewport()334 {335 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());336 337 if (!svg->hasSetContainerSize()) {338 // In the normal case of <svg> being stand-alone or in a CSSBoxModel object we use339 // RenderBox::width()/height() (which pulls data from RenderStyle)340 m_viewportSize = FloatSize(width(), height());341 return;342 }343 344 // In the SVGImage case grab the SVGLength values off of SVGSVGElement and use345 // the special relativeWidthValue accessors which respect the specified containerSize346 // FIXME: Check how SVGImage + zooming is supposed to be handled?347 SVGLength width = svg->width();348 SVGLength height = svg->height();349 m_viewportSize = FloatSize(width.unitType() == LengthTypePercentage ? svg->relativeWidthValue() : width.value(svg),350 height.unitType() == LengthTypePercentage ? svg->relativeHeightValue() : height.value(svg));351 346 } 352 347 … … 399 394 400 395 // Apply initial viewport clip - not affected by overflow settings 401 repaintRect.intersect( enclosingLayoutRect(FloatRect(FloatPoint(), m_viewportSize)));396 repaintRect.intersect(borderBoxRect()); 402 397 403 398 const SVGRenderStyle* svgStyle = style()->svgStyle(); -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h
r98508 r98852 32 32 namespace WebCore { 33 33 34 class AffineTransform; 34 35 class SVGStyledElement; 35 class AffineTransform;36 36 37 37 class RenderSVGRoot : public RenderBox { … … 39 39 explicit RenderSVGRoot(SVGStyledElement*); 40 40 virtual ~RenderSVGRoot(); 41 42 bool isEmbeddedThroughImageElement() const; 41 43 42 44 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const; … … 56 58 virtual void setNeedsTransformUpdate() { m_needsBoundariesOrTransformUpdate = true; } 57 59 60 IntSize containerSize() const { return m_containerSize; } 61 void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; } 62 58 63 private: 59 LayoutUnit computeIntrinsicWidth(LayoutUnit replacedWidth) const;60 LayoutUnit computeIntrinsicHeight(LayoutUnit replacedHeight) const;61 62 64 virtual RenderObjectChildList* virtualChildren() { return children(); } 63 65 virtual const RenderObjectChildList* virtualChildren() const { return children(); } … … 93 95 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const; 94 96 95 void calcViewport();96 97 97 bool selfWillPaint(); 98 98 void updateCachedBoundaries(); … … 104 104 105 105 RenderObjectChildList m_children; 106 FloatSize m_viewportSize;106 IntSize m_containerSize; 107 107 FloatRect m_objectBoundingBox; 108 108 FloatRect m_strokeBoundingBox; -
trunk/Source/WebCore/svg/SVGLength.cpp
r98508 r98852 29 29 #include "Frame.h" 30 30 #include "FrameView.h" 31 #include "RenderObject.h"32 31 #include "RenderPart.h" 32 #include "RenderSVGRoot.h" 33 33 #include "RenderView.h" 34 34 #include "SVGException.h" … … 361 361 return false; 362 362 363 // SVGs embedded through <object> resolve percentage values against the owner renderer in the host document. 363 364 if (RenderPart* ownerRenderer = frame->ownerRenderer()) { 364 365 width = ownerRenderer->width(); … … 372 373 return false; 373 374 375 // Always resolve percentages against the unscaled viewport, as agreed across browsers. 376 float zoom = view->style()->effectiveZoom(); 374 377 width = view->viewWidth(); 375 378 height = view->viewHeight(); 379 if (zoom != 1) { 380 width /= zoom; 381 height /= zoom; 382 } 376 383 return true; 377 384 } … … 381 388 if (viewportElement && viewportElement->isSVG()) { 382 389 const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement); 383 if (svg->hasAttribute(SVGNames::viewBoxAttr)) { 384 width = svg->viewBox().width(); 385 height = svg->viewBox().height(); 386 } else { 390 FloatRect viewBox = svg->currentViewBoxRect(); 391 if (viewBox.isEmpty()) { 387 392 width = svg->width().value(svg); 388 393 height = svg->height().value(svg); 394 } else { 395 width = viewBox.width(); 396 height = viewBox.height(); 389 397 } 390 398 -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r98508 r98852 88 88 , m_useCurrentView(false) 89 89 , m_timeContainer(SMILTimeContainer::create(this)) 90 , m_containerSize(300, 150)91 , m_hasSetContainerSize(false)92 90 { 93 91 ASSERT(hasTagName(SVGNames::svgTag)); … … 153 151 viewRectangle.setSize(FloatSize(width().value(this), height().value(this))); 154 152 return viewBoxToViewTransform(viewRectangle.width(), viewRectangle.height()).mapRect(viewRectangle); 155 }156 157 int SVGSVGElement::relativeWidthValue() const158 {159 SVGLength w = width();160 if (w.unitType() != LengthTypePercentage)161 return 0;162 163 return static_cast<int>(w.valueAsPercentage() * m_containerSize.width());164 }165 166 int SVGSVGElement::relativeHeightValue() const167 {168 SVGLength h = height();169 if (h.unitType() != LengthTypePercentage)170 return 0;171 172 return static_cast<int>(h.valueAsPercentage() * m_containerSize.height());173 153 } 174 154 … … 580 560 } 581 561 582 return viewBox(); 562 // Synthesize a viewBox if we're embedded through a <img> element, if none is present. 563 FloatRect useViewBox = viewBox(); 564 if (useViewBox.isEmpty() && width().unitType() != LengthTypePercentage && height().unitType() != LengthTypePercentage) { 565 if (RenderObject* renderer = this->renderer()) { 566 if (renderer->isSVGRoot() && toRenderSVGRoot(renderer)->isEmbeddedThroughImageElement()) 567 useViewBox = FloatRect(0, 0, width().value(this), height().value(this)); 568 } 569 } 570 571 return useViewBox; 583 572 } 584 573 -
trunk/Source/WebCore/svg/SVGSVGElement.h
r98508 r98852 63 63 64 64 FloatRect viewport() const; 65 66 void setContainerSize(const LayoutSize& containerSize) { m_containerSize = containerSize; m_hasSetContainerSize = true; }67 LayoutSize containerSize() const { return m_containerSize; }68 bool hasSetContainerSize() const { return m_hasSetContainerSize; }69 int relativeWidthValue() const;70 int relativeHeightValue() const;71 65 72 66 float pixelUnitToMillimeterX() const; … … 182 176 FloatPoint m_translation; 183 177 mutable OwnPtr<SVGViewSpec> m_viewSpec; 184 LayoutSize m_containerSize;185 bool m_hasSetContainerSize;186 178 }; 187 179 -
trunk/Source/WebCore/svg/graphics/SVGImage.cpp
r98730 r98852 44 44 #include "ImageBuffer.h" 45 45 #include "ImageObserver.h" 46 #include "Length.h" 46 47 #include "Page.h" 48 #include "RenderSVGRoot.h" 47 49 #include "RenderView.h" 48 50 #include "ResourceError.h" … … 63 65 } 64 66 67 virtual bool isSVGImageChromeClient() const { return true; } 65 68 SVGImage* image() const { return m_image; } 66 69 67 70 private: 68 71 virtual void chromeDestroyed() … … 100 103 } 101 104 105 PassRefPtr<SVGImage> SVGImage::createWithDataAndSize(ImageObserver* observer, SharedBuffer* data, const IntSize& size, float zoom) 106 { 107 ASSERT(!size.isEmpty()); 108 109 RefPtr<SVGImage> image = adoptRef(new SVGImage(0)); 110 image->setData(data, true); 111 image->setContainerSize(size); 112 image->setContainerZoom(zoom); 113 image->setImageObserver(observer); 114 return image.release(); 115 } 116 117 void SVGImage::setContainerZoom(float containerZoom) 118 { 119 if (!m_page) 120 return; 121 Frame* frame = m_page->mainFrame(); 122 frame->setPageZoomFactor(containerZoom); 123 } 124 102 125 void SVGImage::setContainerSize(const IntSize& containerSize) 103 126 { 104 if (containerSize.isEmpty()) 105 return; 106 107 if (!m_page) 108 return; 109 Frame* frame = m_page->mainFrame(); 110 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 111 if (!rootElement) 112 return; 113 114 rootElement->setContainerSize(containerSize); 127 ASSERT(!containerSize.isEmpty()); 128 ASSERT(!imageObserver()); 129 130 if (!m_page) 131 return; 132 Frame* frame = m_page->mainFrame(); 133 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 134 if (!rootElement) 135 return; 136 137 RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()); 138 if (!renderer) 139 return; 140 renderer->setContainerSize(containerSize); 141 frame->view()->resize(size()); 115 142 } 116 143 … … 123 150 if (!rootElement) 124 151 return false; 125 126 return rootElement->hasSetContainerSize(); 152 if (RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer())) 153 return !renderer->containerSize().isEmpty(); 154 return false; 127 155 } 128 156 … … 135 163 if (!rootElement) 136 164 return IntSize(); 137 138 SVGLength width = rootElement->width(); 139 SVGLength height = rootElement->height(); 140 141 IntSize svgSize; 142 if (width.unitType() == LengthTypePercentage) 143 svgSize.setWidth(rootElement->relativeWidthValue()); 144 else 145 svgSize.setWidth(static_cast<int>(width.value(rootElement))); 146 147 if (height.unitType() == LengthTypePercentage) 148 svgSize.setHeight(rootElement->relativeHeightValue()); 149 else 150 svgSize.setHeight(static_cast<int>(height.value(rootElement))); 151 152 return svgSize; 153 } 154 155 bool SVGImage::hasRelativeWidth() const 156 { 157 if (!m_page) 158 return false; 159 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); 160 if (!rootElement) 161 return false; 162 163 return rootElement->width().unitType() == LengthTypePercentage; 164 } 165 166 bool SVGImage::hasRelativeHeight() const 167 { 168 if (!m_page) 169 return false; 170 SVGSVGElement* rootElement = static_cast<SVGDocument*>(m_page->mainFrame()->document())->rootElement(); 171 if (!rootElement) 172 return false; 173 174 return rootElement->height().unitType() == LengthTypePercentage; 165 166 RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()); 167 if (!renderer) 168 return IntSize(); 169 170 // If a container size is available it has precedence. 171 IntSize containerSize = renderer->containerSize(); 172 if (!containerSize.isEmpty()) 173 return containerSize; 174 175 // Assure that a container size is always given for a non-identity zoom level. 176 ASSERT(renderer->style()->effectiveZoom() == 1); 177 IntSize size = enclosingIntRect(rootElement->currentViewBoxRect()).size(); 178 if (!size.isEmpty()) 179 return size; 180 181 // As last resort, use CSS default intrinsic size. 182 return IntSize(300, 150); 175 183 } 176 184 … … 214 222 } 215 223 224 RenderBox* SVGImage::embeddedContentBox() const 225 { 226 if (!m_page) 227 return 0; 228 Frame* frame = m_page->mainFrame(); 229 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 230 if (!rootElement) 231 return 0; 232 return toRenderBox(rootElement->renderer()); 233 } 234 216 235 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) 217 236 { … … 228 247 intrinsicWidth = renderer->style()->width(); 229 248 intrinsicHeight = renderer->style()->height(); 230 // FIXME: Add intrinsicRatio calculation from webkit.org/b/47156.231 intrinsicRatio = FloatSize();249 if (rootElement->preserveAspectRatio().align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 250 intrinsicRatio = rootElement->currentViewBoxRect().size(); 232 251 } 233 252 … … 296 315 FrameLoader* loader = frame->loader(); 297 316 loader->setForcedSandboxFlags(SandboxAll); 317 318 frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars. 319 frame->view()->setTransparent(true); // SVG Images are transparent. 320 298 321 ASSERT(loader->activeDocumentLoader()); // DocumentLoader should have been created by frame->init(). 299 322 loader->activeDocumentLoader()->writer()->setMIMEType("image/svg+xml"); … … 301 324 loader->activeDocumentLoader()->writer()->addData(data()->data(), data()->size()); 302 325 loader->activeDocumentLoader()->writer()->end(); 303 frame->view()->setTransparent(true); // SVG Images are transparent.304 326 } 305 327 -
trunk/Source/WebCore/svg/graphics/SVGImage.h
r98508 r98852 36 36 37 37 class Page; 38 class RenderBox; 38 39 class SVGImageChromeClient; 39 40 … … 44 45 return adoptRef(new SVGImage(observer)); 45 46 } 47 48 static PassRefPtr<SVGImage> createWithDataAndSize(ImageObserver*, SharedBuffer*, const IntSize&, float zoom); 49 50 void setContainerZoom(float); 51 RenderBox* embeddedContentBox() const; 46 52 47 53 virtual bool isSVGImage() const { return true; } … … 54 60 virtual void setContainerSize(const IntSize&); 55 61 virtual bool usesContainerSize() const; 56 virtual bool hasRelativeWidth() const;57 virtual bool hasRelativeHeight() const;58 62 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio); 59 63
Note:
See TracChangeset
for help on using the changeset viewer.