Changeset 105513 in webkit
- Timestamp:
- Jan 20, 2012, 7:30:17 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r105512 r105513 1 2012-01-20 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Differentiate between SVG/CSS width/height attributes/properties 4 https://bugs.webkit.org/show_bug.cgi?id=76447 5 6 Reviewed by Antti Koivisto. 7 8 Update SVG pixel test baseline. 9 10 * platform/mac/svg/custom/dynamic-empty-path-expected.png: Marginal changes. 11 * platform/mac/svg/custom/fractional-rects-expected.png: Ditto. 12 * platform/mac/svg/custom/js-update-container-expected.png: Ditto. 13 * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.png: Align with Opera, gives same result now. All *object*sizing* tests are passing now. 14 * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.txt: Ditto. 15 * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.png: Ditto. 16 * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.txt: Ditto. 17 * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.png: Ditto. 18 * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt: Ditto. 19 * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.png: Ditto. 20 * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.txt: Ditto. 21 * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.png: Ditto. 22 * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.txt: Ditto. 23 * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.png: Ditto. 24 * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.txt: Ditto. 25 * platform/mac/svg/custom/use-css-no-effect-on-shadow-tree-expected.png: Marginal changes. 26 * platform/mac/svg/custom/viewBox-hit-expected.png: Ditto. 27 * platform/mac/svg/zoom/page/absolute-sized-document-no-scrollbars-expected.png: Ditto. 28 * platform/mac/svg/zoom/page/zoom-background-image-tiled-expected.png: Ditto. 29 * platform/mac/svg/zoom/page/zoom-background-images-expected.png: Ditto. 30 * platform/mac/svg/zoom/page/zoom-hixie-mixed-009-expected.png: Ditto. 31 * platform/mac/svg/zoom/page/zoom-img-preserveAspectRatio-support-1-expected.png: Ditto. 32 * platform/mac/svg/zoom/page/zoom-replaced-intrinsic-ratio-001-expected.png: Ditto. 33 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png: Ditto. 34 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt: Ditto. 35 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png: Ditto. 36 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.png: Ditto. 37 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt: Ditto. 38 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-huge-size-expected.png: Ditto. 39 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-override-size-expected.png: Ditto. 40 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.png: Ditto. 41 * platform/mac/tables/mozilla/bugs/bug101674-expected.png: Ditto. 42 * platform/mac/tables/mozilla/bugs/bug101674-expected.txt: Ditto. 43 * platform/mac/tables/mozilla/bugs/bug86708-expected.png: Ditto. 44 * platform/mac/tables/mozilla/bugs/bug86708-expected.txt: Ditto. 45 * platform/mac/tables/mozilla_expected_failures/bugs/97619-expected.png: Ditto. 46 * platform/mac/tables/mozilla_expected_failures/bugs/97619-expected.txt: Ditto. 47 * svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml: Fix test, now that our bug is fixed. 48 * svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml: Ditto. 49 * svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml: Ditto. 50 * svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml: Ditto. 51 * svg/foreignObject/text-tref-02-b-expected.txt: Size is not reported anymore. 52 1 53 2012-01-20 Sami Kyostila <skyostil@chromium.org> 2 54 -
TabularUnified trunk/LayoutTests/platform/chromium/test_expectations.txt ¶
r105510 r105513 3910 3910 BUGWK76646 : svg/foreignObject/text-tref-02-b.svg = TEXT 3911 3911 3912 // Slight changes in RenderReplaced extents. 3913 BUGWK76647 : svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml = IMAGE+TEXT 3914 BUGWK76647 : svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml = IMAGE+TEXT 3915 BUGWK76647 : svg/custom/object-sizing-width-50p-height-75p-on-target-svg.xhtml = IMAGE+TEXT 3916 BUGWK76647 : svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml = IMAGE+TEXT 3917 BUGWK76647 : svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml = IMAGE+TEXT 3918 BUGWK76647 : svg/custom/object-sizing-width-75p-height-50p-on-target-svg.xhtml = IMAGE+TEXT 3919 BUGWK76647 : tables/mozilla/bugs/bug101674.html = IMAGE+TEXT 3920 BUGWK76647 : tables/mozilla/bugs/bug86708.html = IMAGE+TEXT 3921 BUGWK76647 : tables/mozilla_expected_failures/bugs/97619.html = IMAGE+TEXT 3922 BUGWK76647 : svg/zoom/page/zoom-background-images.html = IMAGE 3923 3912 3924 // Change error (misspelling) underlines from Windows look to Mac look. 3913 3925 BUG_CARYCLARK MAC : editing/deleting/delete-3928305-fix.html = IMAGE -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.txt ¶
r105404 r105513 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 500x154 layerType: background only 4 layer at (0,0) size 125x755 RenderBlock (positioned) zI: -1 {div} at (0,0) size 125x75 [bgcolor=#FF0000]4 layer at (0,0) size 250x75 5 RenderBlock (positioned) zI: -1 {div} at (0,0) size 250x75 [bgcolor=#FF0000] 6 6 layer at (0,0) size 500x154 layerType: foreground only 7 7 RenderBlock {html} at (0,0) size 500x154 … … 12 12 RenderView at (0,0) size 250x150 13 13 layer at (0,0) size 250x75 14 RenderSVGRoot {svg} at (0,0) size 125x7515 RenderSVGRect {rect} at (0,0) size 125x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=75.00]16 RenderSVGRect {rect} at ( 6,3) size 113x69 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=3.75] [width=112.50] [height=67.50]17 layer at (0,80) size 125x7518 RenderSVGRoot {svg} at (0,80) size 125x7519 RenderSVGRect {rect} at (0,80) size 125x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]20 RenderSVGRect {rect} at ( 6,83) size 113x69 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00]14 RenderSVGRoot {svg} at (0,0) size 250x75 15 RenderSVGRect {rect} at (0,0) size 250x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=250.00] [height=75.00] 16 RenderSVGRect {rect} at (12,3) size 226x69 [fill={[type=SOLID] [color=#008000]}] [x=12.50] [y=3.75] [width=225.00] [height=67.50] 17 layer at (0,80) size 250x75 18 RenderSVGRoot {svg} at (0,80) size 250x75 19 RenderSVGRect {rect} at (0,80) size 250x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] 20 RenderSVGRect {rect} at (12,83) size 226x69 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.txt ¶
r105404 r105513 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 500x154 layerType: background only 4 layer at (0,0) size 125x1125 RenderBlock (positioned) zI: -1 {div} at (0,0) size 125x112 [bgcolor=#FF0000]4 layer at (0,0) size 250x112 5 RenderBlock (positioned) zI: -1 {div} at (0,0) size 250x112 [bgcolor=#FF0000] 6 6 layer at (0,0) size 500x154 layerType: foreground only 7 7 RenderBlock {html} at (0,0) size 500x154 … … 12 12 RenderView at (0,0) size 250x150 13 13 layer at (0,0) size 250x112 14 RenderSVGRoot {svg} at (0,0) size 125x11215 RenderSVGRect {rect} at (0,0) size 125x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=112.50]16 RenderSVGRect {rect} at ( 6,5) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=5.63] [width=112.50] [height=101.25]17 layer at (0,117) size 125x11218 RenderSVGRoot {svg} at (0,117) size 125x11219 RenderSVGRect {rect} at (0,117) size 125x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]20 RenderSVGRect {rect} at ( 6,122) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00]14 RenderSVGRoot {svg} at (0,0) size 250x112 15 RenderSVGRect {rect} at (0,0) size 250x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=250.00] [height=112.00] 16 RenderSVGRect {rect} at (12,5) size 226x102 [fill={[type=SOLID] [color=#008000]}] [x=12.50] [y=5.60] [width=225.00] [height=100.80] 17 layer at (0,117) size 250x112 18 RenderSVGRoot {svg} at (0,117) size 250x112 19 RenderSVGRect {rect} at (0,117) size 250x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] 20 RenderSVGRect {rect} at (12,122) size 226x102 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt ¶
r105404 r105513 13 13 layer at (0,0) size 125x112 14 14 RenderSVGRoot {svg} at (0,0) size 125x112 15 RenderSVGRect {rect} at (0,0) size 125x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=112. 50]16 RenderSVGRect {rect} at (6,5) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=5.6 3] [width=112.50] [height=101.25]15 RenderSVGRect {rect} at (0,0) size 125x112 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=112.00] 16 RenderSVGRect {rect} at (6,5) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=5.60] [width=112.50] [height=100.80] 17 17 layer at (0,117) size 125x112 18 18 RenderSVGRoot {svg} at (0,117) size 125x112 -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.txt ¶
r105404 r105513 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 500x154 layerType: background only 4 layer at (0,0) size 125x1505 RenderBlock (positioned) zI: -1 {div} at (0,0) size 125x150 [bgcolor=#FF0000]4 layer at (0,0) size 250x150 5 RenderBlock (positioned) zI: -1 {div} at (0,0) size 250x150 [bgcolor=#FF0000] 6 6 layer at (0,0) size 500x154 layerType: foreground only 7 7 RenderBlock {html} at (0,0) size 500x154 … … 12 12 RenderView at (0,0) size 250x150 13 13 layer at (0,0) size 250x150 14 RenderSVGRoot {svg} at (0,0) size 125x15015 RenderSVGRect {rect} at (0,0) size 125x150 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=150.00]16 RenderSVGRect {rect} at ( 6,7) size 113x136 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=7.50] [width=112.50] [height=135.00]17 layer at (0,155) size 125x15018 RenderSVGRoot {svg} at (0,155) size 125x15019 RenderSVGRect {rect} at (0,155) size 125x150 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]20 RenderSVGRect {rect} at ( 6,162) size 113x136 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00]14 RenderSVGRoot {svg} at (0,0) size 250x150 15 RenderSVGRect {rect} at (0,0) size 250x150 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=250.00] [height=150.00] 16 RenderSVGRect {rect} at (12,7) size 226x136 [fill={[type=SOLID] [color=#008000]}] [x=12.50] [y=7.50] [width=225.00] [height=135.00] 17 layer at (0,155) size 250x150 18 RenderSVGRoot {svg} at (0,155) size 250x150 19 RenderSVGRect {rect} at (0,155) size 250x150 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] 20 RenderSVGRect {rect} at (12,162) size 226x136 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.txt ¶
r105404 r105513 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 500x154 layerType: background only 4 layer at (0,0) size 281x755 RenderBlock (positioned) zI: -1 {div} at (0,0) size 281x75 [bgcolor=#FF0000]4 layer at (0,0) size 375x75 5 RenderBlock (positioned) zI: -1 {div} at (0,0) size 375x75 [bgcolor=#FF0000] 6 6 layer at (0,0) size 500x154 layerType: foreground only 7 7 RenderBlock {html} at (0,0) size 500x154 … … 12 12 RenderView at (0,0) size 375x150 13 13 layer at (0,0) size 375x75 14 RenderSVGRoot {svg} at (0,0) size 282x7515 RenderSVGRect {rect} at (0,0) size 282x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=281.25] [height=75.00]16 RenderSVGRect {rect} at (1 4,3) size 254x69 [fill={[type=SOLID] [color=#008000]}] [x=14.06] [y=3.75] [width=253.13] [height=67.50]17 layer at (0,80) size 281x7518 RenderSVGRoot {svg} at (0,80) size 281x7519 RenderSVGRect {rect} at (0,80) size 281x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]20 RenderSVGRect {rect} at (1 4,83) size 253x69 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00]14 RenderSVGRoot {svg} at (0,0) size 375x75 15 RenderSVGRect {rect} at (0,0) size 375x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=375.00] [height=75.00] 16 RenderSVGRect {rect} at (18,3) size 339x69 [fill={[type=SOLID] [color=#008000]}] [x=18.75] [y=3.75] [width=337.50] [height=67.50] 17 layer at (0,80) size 375x75 18 RenderSVGRoot {svg} at (0,80) size 375x75 19 RenderSVGRect {rect} at (0,80) size 375x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] 20 RenderSVGRect {rect} at (18,83) size 339x69 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] -
TabularUnified trunk/LayoutTests/platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.txt ¶
r105404 r105513 13 13 layer at (0,0) size 281x75 14 14 RenderSVGRoot {svg} at (0,0) size 281x75 15 RenderSVGRect {rect} at (0,0) size 281x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=281. 25] [height=75.00]16 RenderSVGRect {rect} at (14,3) size 25 4x69 [fill={[type=SOLID] [color=#008000]}] [x=14.06] [y=3.75] [width=253.13] [height=67.50]15 RenderSVGRect {rect} at (0,0) size 281x75 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=281.00] [height=75.00] 16 RenderSVGRect {rect} at (14,3) size 253x69 [fill={[type=SOLID] [color=#008000]}] [x=14.05] [y=3.75] [width=252.90] [height=67.50] 17 17 layer at (0,80) size 281x75 18 18 RenderSVGRoot {svg} at (0,80) size 281x75 -
TabularUnified trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug101674-expected.txt ¶
r30635 r105513 1 layer at (0,0) size 785x15 601 layer at (0,0) size 785x1582 2 2 RenderView at (0,0) size 785x600 3 layer at (0,0) size 785x15 604 RenderBlock {HTML} at (0,0) size 785x15 605 RenderBody {BODY} at (8,8) size 769x15 446 RenderTable {TABLE} at (0,0) size 769x7 4[border: (1px solid #000000)]7 RenderTableSection {TBODY} at (1,1) size 767x7 28 RenderTableRow {TR} at (0,2) size 767x6 89 RenderTableCell {TD} at (2,2) size 444x6 8[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]10 RenderImage {IMG} at (2,2) size 88x6 411 RenderImage {IMG} at (90,2) size 88x6 412 RenderImage {IMG} at (178,2) size 88x6 413 RenderImage {IMG} at (266,2) size 88x6 414 RenderImage {IMG} at (354,2) size 88x6 43 layer at (0,0) size 785x1582 4 RenderBlock {HTML} at (0,0) size 785x1582 5 RenderBody {BODY} at (8,8) size 769x1566 6 RenderTable {TABLE} at (0,0) size 769x75 [border: (1px solid #000000)] 7 RenderTableSection {TBODY} at (1,1) size 767x73 8 RenderTableRow {TR} at (0,2) size 767x69 9 RenderTableCell {TD} at (2,2) size 444x69 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 10 RenderImage {IMG} at (2,2) size 88x65 11 RenderImage {IMG} at (90,2) size 88x65 12 RenderImage {IMG} at (178,2) size 88x65 13 RenderImage {IMG} at (266,2) size 88x65 14 RenderImage {IMG} at (354,2) size 88x65 15 15 RenderTableCell {TD} at (448,25) size 317x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 16 16 RenderText {#text} at (2,2) size 157x18 17 17 text run at (2,2) width 157: "Nothing between images" 18 RenderTable {TABLE} at (0,7 4) size 769x330[border: (1px solid #000000)]19 RenderTableSection {TBODY} at (1,1) size 767x3 2820 RenderTableRow {TR} at (0,2) size 767x32 421 RenderTableCell {TD} at (2,2) size 92x32 4[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]22 RenderImage {IMG} at (2,2) size 88x6 418 RenderTable {TABLE} at (0,75) size 769x335 [border: (1px solid #000000)] 19 RenderTableSection {TBODY} at (1,1) size 767x333 20 RenderTableRow {TR} at (0,2) size 767x329 21 RenderTableCell {TD} at (2,2) size 92x329 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 22 RenderImage {IMG} at (2,2) size 88x65 23 23 RenderText {#text} at (0,0) size 0x0 24 RenderImage {IMG} at (2,6 6) size 88x6424 RenderImage {IMG} at (2,67) size 88x65 25 25 RenderText {#text} at (0,0) size 0x0 26 RenderImage {IMG} at (2,13 0) size 88x6426 RenderImage {IMG} at (2,132) size 88x65 27 27 RenderText {#text} at (0,0) size 0x0 28 RenderImage {IMG} at (2,19 4) size 88x6428 RenderImage {IMG} at (2,197) size 88x65 29 29 RenderText {#text} at (0,0) size 0x0 30 RenderImage {IMG} at (2,2 58) size 88x6431 RenderTableCell {TD} at (96,15 3) size 669x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]30 RenderImage {IMG} at (2,262) size 88x65 31 RenderTableCell {TD} at (96,155) size 669x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 32 32 RenderText {#text} at (2,2) size 149x18 33 33 text run at (2,2) width 149: "Spaces between images" 34 RenderTable {TABLE} at (0,4 04) size 769x330[border: (1px solid #000000)]35 RenderTableSection {TBODY} at (1,1) size 767x3 2836 RenderTableRow {TR} at (0,2) size 767x32 437 RenderTableCell {TD} at (2,2) size 92x32 4[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]38 RenderImage {IMG} at (2,2) size 88x6 434 RenderTable {TABLE} at (0,410) size 769x335 [border: (1px solid #000000)] 35 RenderTableSection {TBODY} at (1,1) size 767x333 36 RenderTableRow {TR} at (0,2) size 767x329 37 RenderTableCell {TD} at (2,2) size 92x329 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 38 RenderImage {IMG} at (2,2) size 88x65 39 39 RenderText {#text} at (0,0) size 0x0 40 RenderImage {IMG} at (2,6 6) size 88x6440 RenderImage {IMG} at (2,67) size 88x65 41 41 RenderText {#text} at (0,0) size 0x0 42 RenderImage {IMG} at (2,13 0) size 88x6442 RenderImage {IMG} at (2,132) size 88x65 43 43 RenderText {#text} at (0,0) size 0x0 44 RenderImage {IMG} at (2,19 4) size 88x6444 RenderImage {IMG} at (2,197) size 88x65 45 45 RenderText {#text} at (0,0) size 0x0 46 RenderImage {IMG} at (2,2 58) size 88x6447 RenderTableCell {TD} at (96,15 3) size 669x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]46 RenderImage {IMG} at (2,262) size 88x65 47 RenderTableCell {TD} at (96,155) size 669x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 48 48 RenderText {#text} at (2,2) size 165x18 49 49 text run at (2,2) width 165: "Newlines between images" 50 RenderTable {TABLE} at (0,7 34) size 769x78[border: (1px solid #000000)]51 RenderTableSection {TBODY} at (1,1) size 767x7 652 RenderTableRow {TR} at (0,2) size 767x7 253 RenderTableCell {TD} at (2,2) size 596x7 2[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]54 RenderText {#text} at (2,5 2) size 27x1855 text run at (2,5 2) width 27: "One"56 RenderImage {IMG} at (29,2) size 88x6 457 RenderText {#text} at (117,5 2) size 30x1858 text run at (117,5 2) width 30: "Two"59 RenderImage {IMG} at (147,2) size 88x6 460 RenderText {#text} at (235,5 2) size 37x1861 text run at (235,5 2) width 37: "Three"62 RenderImage {IMG} at (272,2) size 88x6 463 RenderText {#text} at (360,5 2) size 30x1864 text run at (360,5 2) width 30: "Four"65 RenderImage {IMG} at (390,2) size 88x6 466 RenderText {#text} at (478,5 2) size 28x1867 text run at (478,5 2) width 28: "Five"68 RenderImage {IMG} at (506,2) size 88x6 450 RenderTable {TABLE} at (0,745) size 769x79 [border: (1px solid #000000)] 51 RenderTableSection {TBODY} at (1,1) size 767x77 52 RenderTableRow {TR} at (0,2) size 767x73 53 RenderTableCell {TD} at (2,2) size 596x73 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 54 RenderText {#text} at (2,53) size 27x18 55 text run at (2,53) width 27: "One" 56 RenderImage {IMG} at (29,2) size 88x65 57 RenderText {#text} at (117,53) size 30x18 58 text run at (117,53) width 30: "Two" 59 RenderImage {IMG} at (147,2) size 88x65 60 RenderText {#text} at (235,53) size 37x18 61 text run at (235,53) width 37: "Three" 62 RenderImage {IMG} at (272,2) size 88x65 63 RenderText {#text} at (360,53) size 30x18 64 text run at (360,53) width 30: "Four" 65 RenderImage {IMG} at (390,2) size 88x65 66 RenderText {#text} at (478,53) size 28x18 67 text run at (478,53) width 28: "Five" 68 RenderImage {IMG} at (506,2) size 88x65 69 69 RenderTableCell {TD} at (600,27) size 165x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 70 70 RenderText {#text} at (2,2) size 134x18 71 71 text run at (2,2) width 134: "Text between images" 72 RenderTable {TABLE} at (0,8 12) size 769x364[border: (1px solid #000000)]73 RenderTableSection {TBODY} at (1,1) size 767x36 274 RenderTableRow {TR} at (0,2) size 767x3 5875 RenderTableCell {TD} at (2,2) size 129x3 58[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]72 RenderTable {TABLE} at (0,824) size 769x369 [border: (1px solid #000000)] 73 RenderTableSection {TBODY} at (1,1) size 767x367 74 RenderTableRow {TR} at (0,2) size 767x363 75 RenderTableCell {TD} at (2,2) size 129x363 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 76 76 RenderText {#text} at (2,2) size 27x18 77 77 text run at (2,2) width 27: "One" 78 RenderImage {IMG} at (2,20) size 88x6 479 RenderText {#text} at (90,7 0) size 30x1880 text run at (90,7 0) width 30: "Two"81 RenderImage {IMG} at (2,8 8) size 88x6482 RenderText {#text} at (90,1 38) size 37x1883 text run at (90,1 38) width 37: "Three"84 RenderImage {IMG} at (2,15 6) size 88x6485 RenderText {#text} at (90,20 6) size 30x1886 text run at (90,20 6) width 30: "Four"87 RenderImage {IMG} at (2,22 4) size 88x6488 RenderText {#text} at (90,27 4) size 28x1889 text run at (90,27 4) width 28: "Five"90 RenderImage {IMG} at (2,29 2) size 88x6491 RenderTableCell {TD} at (133,17 0) size 632x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]78 RenderImage {IMG} at (2,20) size 88x65 79 RenderText {#text} at (90,71) size 30x18 80 text run at (90,71) width 30: "Two" 81 RenderImage {IMG} at (2,89) size 88x65 82 RenderText {#text} at (90,140) size 37x18 83 text run at (90,140) width 37: "Three" 84 RenderImage {IMG} at (2,158) size 88x65 85 RenderText {#text} at (90,209) size 30x18 86 text run at (90,209) width 30: "Four" 87 RenderImage {IMG} at (2,227) size 88x65 88 RenderText {#text} at (90,278) size 28x18 89 text run at (90,278) width 28: "Five" 90 RenderImage {IMG} at (2,296) size 88x65 91 RenderTableCell {TD} at (133,172) size 632x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 92 92 RenderText {#text} at (2,2) size 211x18 93 93 text run at (2,2) width 211: "Text with spaces between images" 94 RenderTable {TABLE} at (0,11 76) size 769x368[border: (1px solid #000000)]95 RenderTableSection {TBODY} at (1,1) size 767x3 6696 RenderTableRow {TR} at (0,2) size 767x36 297 RenderTableCell {TD} at (2,2) size 137x36 2[border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1]98 RenderText {#text} at (2,2) size 27x8 694 RenderTable {TABLE} at (0,1193) size 769x373 [border: (1px solid #000000)] 95 RenderTableSection {TBODY} at (1,1) size 767x371 96 RenderTableRow {TR} at (0,2) size 767x367 97 RenderTableCell {TD} at (2,2) size 137x367 [border: (1px solid #000000)] [r=0 c=0 rs=1 cs=1] 98 RenderText {#text} at (2,2) size 27x87 99 99 text run at (2,2) width 27: "One" 100 text run at (2,7 0) width 12: "A"101 RenderImage {IMG} at (14,20) size 88x6 4102 RenderText {#text} at (102,7 0) size 130x86103 text run at (102,7 0) width 30: "Two"104 text run at (2,1 38) width 8: "b"105 RenderImage {IMG} at (10,8 8) size 88x64106 RenderText {#text} at (98,1 38) size 133x86107 text run at (98,1 38) width 37: "Three"108 text run at (2,20 6) width 7: "c"109 RenderImage {IMG} at (9,15 6) size 88x64110 RenderText {#text} at (97,20 6) size 125x86111 text run at (97,20 6) width 30: "Four"112 text run at (2,27 4) width 8: "d"113 RenderImage {IMG} at (10,22 4) size 88x64114 RenderText {#text} at (98,27 4) size 124x86115 text run at (98,27 4) width 28: "Five"116 text run at (2,34 2) width 7: "e"117 RenderImage {IMG} at (9,29 2) size 88x64118 RenderTableCell {TD} at (141,17 2) size 624x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1]100 text run at (2,71) width 12: "A" 101 RenderImage {IMG} at (14,20) size 88x65 102 RenderText {#text} at (102,71) size 130x87 103 text run at (102,71) width 30: "Two" 104 text run at (2,140) width 8: "b" 105 RenderImage {IMG} at (10,89) size 88x65 106 RenderText {#text} at (98,140) size 133x87 107 text run at (98,140) width 37: "Three" 108 text run at (2,209) width 7: "c" 109 RenderImage {IMG} at (9,158) size 88x65 110 RenderText {#text} at (97,209) size 125x87 111 text run at (97,209) width 30: "Four" 112 text run at (2,278) width 8: "d" 113 RenderImage {IMG} at (10,227) size 88x65 114 RenderText {#text} at (98,278) size 124x87 115 text run at (98,278) width 28: "Five" 116 text run at (2,347) width 7: "e" 117 RenderImage {IMG} at (9,296) size 88x65 118 RenderTableCell {TD} at (141,174) size 624x22 [border: (1px solid #000000)] [r=0 c=1 rs=1 cs=1] 119 119 RenderText {#text} at (2,2) size 301x18 120 120 text run at (2,2) width 301: "Text with spaces and more text between images" -
TabularUnified trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug86708-expected.txt ¶
r47440 r105513 4 4 RenderBlock {HTML} at (0,0) size 800x600 5 5 RenderBody {BODY} at (8,8) size 784x584 6 RenderTable {TABLE} at (0,0) size 750x23 5[border: (2px outset #808080)]7 RenderTableSection {TBODY} at (2,2) size 746x23 18 RenderTableRow {TR} at (0,0) size 746x21 19 RenderTableCell {TD} at (0,0) size 474x21 1[bgcolor=#FF0000] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]6 RenderTable {TABLE} at (0,0) size 750x236 [border: (2px outset #808080)] 7 RenderTableSection {TBODY} at (2,2) size 746x232 8 RenderTableRow {TR} at (0,0) size 746x212 9 RenderTableCell {TD} at (0,0) size 474x212 [bgcolor=#FF0000] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] 10 10 RenderInline {A} at (0,0) size 286x18 [color=#0000EE] 11 RenderImage {IMG} at (1,1) size 286x2 0911 RenderImage {IMG} at (1,1) size 286x210 12 12 RenderTableCell {TD} at (474,0) size 272x20 [bgcolor=#FFFF00] [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1] 13 13 RenderText {#text} at (1,1) size 169x18 14 14 text run at (1,1) width 169: "ROWSPAN =2 in this cell" 15 RenderTableRow {TR} at (0,21 1) size 746x2016 RenderTableCell {TD} at (0,21 1) size 474x20 [bgcolor=#FFFFFF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]15 RenderTableRow {TR} at (0,212) size 746x20 16 RenderTableCell {TD} at (0,212) size 474x20 [bgcolor=#FFFFFF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1] 17 17 RenderBlock {P} at (1,1) size 472x18 18 18 RenderText {#text} at (0,0) size 296x18 -
TabularUnified trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/97619-expected.txt ¶
r30635 r105513 4 4 RenderBlock {HTML} at (0,0) size 800x600 5 5 RenderBody {BODY} at (8,8) size 784x584 6 RenderTable {TABLE} at (0,0) size 784x12 0[border: (1px outset #808080)]7 RenderTableSection {TBODY} at (1,1) size 782x11 88 RenderTableRow {TR} at (0,2) size 782x11 49 RenderTableCell {TD} at (2,2) size 74x11 4[border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]6 RenderTable {TABLE} at (0,0) size 784x121 [border: (1px outset #808080)] 7 RenderTableSection {TBODY} at (1,1) size 782x119 8 RenderTableRow {TR} at (0,2) size 782x115 9 RenderTableCell {TD} at (2,2) size 74x115 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] 10 10 RenderText {#text} at (2,2) size 70x72 11 11 text run at (2,2) width 59: "check for" … … 13 13 text run at (2,38) width 13: "of" 14 14 text run at (2,56) width 70: "whitespace" 15 RenderImage {IMG} at (2,74) size 20x1 616 RenderText {#text} at (22,7 6) size 68x3617 text run at (22,7 6) width 48: " around"18 text run at (2,9 4) width 61: "the image"15 RenderImage {IMG} at (2,74) size 20x17 16 RenderText {#text} at (22,77) size 68x36 17 text run at (22,77) width 48: " around" 18 text run at (2,95) width 61: "the image" 19 19 RenderTableCell {TD} at (78,48) size 702x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] 20 20 RenderText {#text} at (2,2) size 12x18 21 21 text run at (2,2) width 12: "X" 22 RenderBlock {HR} at (0,12 8) size 77x2 [border: (1px inset #000000)]23 RenderTable {TABLE} at (0,13 8) size 784x152[border: (1px outset #808080)]24 RenderTableSection {TBODY} at (1,1) size 782x15 025 RenderTableRow {TR} at (0,2) size 782x14 626 RenderTableCell {TD} at (2,2) size 24x14 6[border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]22 RenderBlock {HR} at (0,129) size 77x2 [border: (1px inset #000000)] 23 RenderTable {TABLE} at (0,139) size 784x153 [border: (1px outset #808080)] 24 RenderTableSection {TBODY} at (1,1) size 782x151 25 RenderTableRow {TR} at (0,2) size 782x147 26 RenderTableCell {TD} at (2,2) size 24x147 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] 27 27 RenderText {#text} at (2,2) size 16x72 28 28 text run at (2,2) width 14: "aa" … … 30 30 text run at (2,38) width 14: "cc" 31 31 text run at (2,56) width 16: "dd" 32 RenderImage {IMG} at (2,74) size 20x1 633 RenderText {#text} at (2,9 0) size 16x5434 text run at (2,9 0) width 14: "ee"35 text run at (2,10 8) width 10: "ff"36 text run at (2,12 6) width 16: "gg"32 RenderImage {IMG} at (2,74) size 20x17 33 RenderText {#text} at (2,91) size 16x54 34 text run at (2,91) width 14: "ee" 35 text run at (2,109) width 10: "ff" 36 text run at (2,127) width 16: "gg" 37 37 RenderTableCell {TD} at (28,64) size 752x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] 38 38 RenderText {#text} at (2,2) size 12x18 39 39 text run at (2,2) width 12: "X" 40 RenderBlock {HR} at (0, 298) size 77x2 [border: (1px inset #000000)]41 RenderTable {TABLE} at (0,3 08) size 784x48[border: (1px outset #808080)]42 RenderTableSection {TBODY} at (1,1) size 782x4 643 RenderTableRow {TR} at (0,2) size 782x4 244 RenderTableCell {TD} at (2,2) size 213x4 2[border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]40 RenderBlock {HR} at (0,300) size 77x2 [border: (1px inset #000000)] 41 RenderTable {TABLE} at (0,310) size 784x49 [border: (1px outset #808080)] 42 RenderTableSection {TBODY} at (1,1) size 782x47 43 RenderTableRow {TR} at (0,2) size 782x43 44 RenderTableCell {TD} at (2,2) size 213x43 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] 45 45 RenderText {#text} at (2,2) size 209x18 46 46 text run at (2,2) width 209: "checkforhandlingofnowhitespace" 47 RenderImage {IMG} at (2,20) size 20x1 648 RenderText {#text} at (22,2 2) size 105x1849 text run at (22,2 2) width 105: " aroundtheimage"47 RenderImage {IMG} at (2,20) size 20x17 48 RenderText {#text} at (22,23) size 105x18 49 text run at (22,23) width 105: " aroundtheimage" 50 50 RenderTableCell {TD} at (217,12) size 563x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] 51 51 RenderText {#text} at (2,2) size 12x18 52 52 text run at (2,2) width 12: "X" 53 RenderBlock {HR} at (0,36 4) size 77x2 [border: (1px inset #000000)]54 RenderTable {TABLE} at (0,37 4) size 784x30[border: (1px outset #808080)]55 RenderTableSection {TBODY} at (1,1) size 782x2 856 RenderTableRow {TR} at (0,2) size 782x2 457 RenderTableCell {TD} at (2,2) size 334x2 4[border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]58 RenderText {#text} at (2, 4) size 209x1859 text run at (2, 4) width 209: "checkforhandlingofnowhitespace"60 RenderImage {IMG} at (211,2) size 20x1 661 RenderText {#text} at (231, 4) size 101x1862 text run at (231, 4) width 101: "aroundtheimage"53 RenderBlock {HR} at (0,367) size 77x2 [border: (1px inset #000000)] 54 RenderTable {TABLE} at (0,377) size 784x31 [border: (1px outset #808080)] 55 RenderTableSection {TBODY} at (1,1) size 782x29 56 RenderTableRow {TR} at (0,2) size 782x25 57 RenderTableCell {TD} at (2,2) size 334x25 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1] 58 RenderText {#text} at (2,5) size 209x18 59 text run at (2,5) width 209: "checkforhandlingofnowhitespace" 60 RenderImage {IMG} at (211,2) size 20x17 61 RenderText {#text} at (231,5) size 101x18 62 text run at (231,5) width 101: "aroundtheimage" 63 63 RenderTableCell {TD} at (338,3) size 442x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1] 64 64 RenderText {#text} at (2,2) size 12x18 -
TabularUnified trunk/LayoutTests/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml ¶
r105404 r105513 6 6 body { padding: 0; margin: 0; } 7 7 p { padding: 0; margin: 0; } 8 div { position: absolute; top: 0px; left: 0px; width: 125px; height: 75px; background: red; z-index: -1; }8 div { position: absolute; top: 0px; left: 0px; width: 250px; height: 75px; background: red; z-index: -1; } 9 9 object { width: 250px; height: auto; } 10 svg { position: absolute; top: 80px; left: 0px; width: 125px; height: 75px; }10 svg { position: absolute; top: 80px; left: 0px; width: 250px; height: 75px; } 11 11 </style> 12 12 </head> -
TabularUnified trunk/LayoutTests/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml ¶
r105404 r105513 6 6 body { padding: 0; margin: 0; } 7 7 p { padding: 0; margin: 0; } 8 div { position: absolute; top: 0px; left: 0px; width: 125px; height: 112.5px; background: red; z-index: -1; }8 div { position: absolute; top: 0px; left: 0px; width: 250px; height: 112.5px; background: red; z-index: -1; } 9 9 object { width: 250px; height: auto; } 10 svg { position: absolute; top: 117.5px; left: 0px; width: 125px; height: 112.5px; }10 svg { position: absolute; top: 117.5px; left: 0px; width: 250px; height: 112.5px; } 11 11 </style> 12 12 </head> -
TabularUnified trunk/LayoutTests/svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml ¶
r105404 r105513 6 6 body { padding: 0; margin: 0; } 7 7 p { padding: 0; margin: 0; } 8 div { position: absolute; top: 0px; left: 0px; width: 125px; height: 150px; background: red; z-index: -1; }8 div { position: absolute; top: 0px; left: 0px; width: 250px; height: 150px; background: red; z-index: -1; } 9 9 object { width: 250px; height: auto; } 10 svg { position: absolute; top: 155px; left: 0px; width: 125px; height: 150px; }10 svg { position: absolute; top: 155px; left: 0px; width: 250px; height: 150px; } 11 11 </style> 12 12 </head> -
TabularUnified trunk/LayoutTests/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml ¶
r105404 r105513 6 6 body { padding: 0; margin: 0; } 7 7 p { padding: 0; margin: 0; } 8 div { position: absolute; top: 0px; left: 0px; width: 281.25px; height: 75px; background: red; z-index: -1; }8 div { position: absolute; top: 0px; left: 0px; width: 375px; height: 75px; background: red; z-index: -1; } 9 9 object { width: 375px; height: auto; } 10 svg { position: absolute; top: 80px; left: 0px; width: 281.25px; height: 75px; }10 svg { position: absolute; top: 80px; left: 0px; width: 375px; height: 75px; } 11 11 </style> 12 12 </head> -
TabularUnified trunk/LayoutTests/svg/foreignObject/text-tref-02-b-expected.txt ¶
r105404 r105513 24 24 RenderSVGHiddenContainer {defs} at (0,0) size 0x0 25 25 RenderSVGForeignObject {foreignObject} at (0,0) size 0x0 26 RenderSVGRoot {svg} at (0,0) size 42x426 RenderSVGRoot {svg} at (0,0) size 0x0 27 27 RenderSVGText {text} at (0,-15) size 42x18 contains 1 chunk(s) 28 28 RenderSVGInlineText {#text} at (0,0) size 42x18 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r105512 r105513 1 2012-01-20 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Differentiate between SVG/CSS width/height attributes/properties 4 https://bugs.webkit.org/show_bug.cgi?id=76447 5 6 Reviewed by Antti Koivisto. 7 8 Remove a gazillion of hacks out of our SVG implementation, by correctly differentiating between the 9 SVG width/height attributes and the CSS width/height properties. They need to be treated independently 10 when handling the intrinsic size negotiation, according to both CSS 2.1 & SVG 1.1 2nd Edition specs. 11 12 Fixes several bugs in the LayoutTests/svg/custom/*object*sizing tests, we now match Opera perfectly. FF still has some bugs, and IE9 as well. 13 14 * css/svg.css: Remove hardcoded, width/height: 100% on <svg>. 15 * rendering/RenderBox.h: 16 (WebCore::RenderBox::computeIntrinsicRatioInformation): Make 'intrinsicRatio' a float, and add 'intrinsicSize' as seperated FloatSize, to avoid confusion. 17 * rendering/RenderBoxModelObject.cpp: 18 (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): Add forgotton case for percentage intrinsic sizes, that lead to workarounds in other places, that can now be removed. 19 * rendering/RenderImage.cpp: 20 (WebCore::RenderImage::computeReplacedLogicalWidth): Directly use imageHasRelativeWidth/Height(), it does differentiate between SVG/CSS width/height attributes/properties now. 21 (WebCore::RenderImage::computeIntrinsicRatioInformation): Adapt to 'intrinsicRatio' argument change. 22 * rendering/RenderImage.h: Ditto. 23 * rendering/RenderReplaced.cpp: Refactor existing code, break out firstContainingBlockWithLogicalWidth/hasReplacedLogicalWidth/hasReplacedLogicalHeight/hasAutoHeightOrContainingBlockWithAutoHeight. 24 (WebCore::firstContainingBlockWithLogicalWidth): Refactored. 25 (WebCore::RenderReplaced::hasReplacedLogicalWidth): Refactored, and exported, so SVGSVGElement::widthAttributeEstablishesViewport() can use it. 26 (WebCore::hasAutoHeightOrContainingBlockWithAutoHeight): Refactored. 27 (WebCore::RenderReplaced::hasReplacedLogicalHeight): Refactored, and exported, so SVGSVGElement::heightAttributeEstablishesViewport() can use it. 28 (WebCore::RenderReplaced::computeReplacedLogicalWidth): Adapt to 'intrinsicRatio' changes ('intrinsicSize' is now decoupled from it). Refactor so that RenderSVGRoot can directly use it as well! 29 (WebCore::RenderReplaced::computeReplacedLogicalHeight): Ditto. 30 * rendering/RenderReplaced.h: 31 * rendering/svg/RenderSVGRoot.cpp: 32 (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation): Only determine the intrinsic size & ratio using the SVG width/height attributes, not the CSS width/height properties, as it's specified. 33 (WebCore::resolveLengthAttributeForSVG): Helper function for computeReplacedLogicalWidth/Height, that scales Length values that come from SVG width/height attributes. 34 (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): Finally remove home-brewn size computation logic - it can be fully shared with RenderReplaced now that we inherit from it. 35 (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): Ditto. 36 * rendering/svg/RenderSVGRoot.h: 37 * rendering/svg/RenderSVGViewportContainer.h: 38 (WebCore::RenderSVGViewportContainer::viewport): Export viewport() for easier length resolution. 39 * svg/SVGLengthContext.cpp: 40 (WebCore::SVGLengthContext::determineViewport): Finally clean up this hell, and make it easy to understand. Only need to resolve lengths against either RenderSVGRoot or RenderSVGViewportContainer now. 41 * svg/SVGSVGElement.cpp: 42 (WebCore::SVGSVGElement::viewport): Remove wrong code and disable this. Its not used, and we have no test coverage for it. Its current implementation didn't make any sense. 43 (WebCore::SVGSVGElement::parseMappedAttribute): Remove hacks mapping SVG width/height attributes to CSS properties. 44 (WebCore::SVGSVGElement::svgAttributeChanged): Ditto. 45 (WebCore::SVGSVGElement::localCoordinateSpaceTransform): Refactored. 46 (WebCore::SVGSVGElement::currentViewBoxRect): Ditto. 47 (WebCore::SVGSVGElement::currentViewportSize): Ditto. 48 (WebCore::SVGSVGElement::widthAttributeEstablishesViewport): Main logic determining if the SVG or CSS properties establish the viewport - a direct transliteration from the spec. 49 (WebCore::SVGSVGElement::heightAttributeEstablishesViewport): Ditto. 50 (WebCore::SVGSVGElement::intrinsicWidth): Helper. 51 (WebCore::SVGSVGElement::intrinsicHeight): Ditto. 52 * svg/SVGSVGElement.h: 53 * svg/graphics/SVGImage.cpp: 54 (WebCore::SVGImage::size): Cleanup code. 55 (WebCore::SVGImage::hasRelativeWidth): Added, avoids hacks in RenderBoxModelObject. 56 (WebCore::SVGImage::hasRelativeHeight): Ditto. 57 (WebCore::SVGImage::computeIntrinsicDimensions): Make use of new SVGSVGElement::computeIntrinsicDimensions. 58 * svg/graphics/SVGImage.h: 59 1 60 2012-01-20 Sami Kyostila <skyostil@chromium.org> 2 61 -
TabularUnified trunk/Source/WebCore/css/svg.css ¶
r105404 r105513 47 47 } 48 48 49 svg {50 width: 100%;51 height: 100%;52 }53 54 49 text, foreignObject { 55 50 display: block -
TabularUnified trunk/Source/WebCore/rendering/RenderBox.h ¶
r105404 r105513 432 432 433 433 virtual bool needsPreferredWidthsRecalculation() const; 434 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsic Ratio */, bool& /* isPercentageIntrinsicSize */) const { }434 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { } 435 435 436 436 protected: -
TabularUnified trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp ¶
r105404 r105513 873 873 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, intrinsicRatio); 874 874 875 // Intrinsic dimensions expressed as percentages must be resolved relative to the dimensions of the rectangle 876 // that establishes the coordinate system for the 'background-position' property. 877 875 878 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 876 if (intrinsicWidth.isFixed()) 877 resolvedWidth = static_cast<int>(ceilf(intrinsicWidth.value() * style()->effectiveZoom())); 878 if (intrinsicHeight.isFixed()) 879 resolvedHeight = static_cast<int>(ceilf(intrinsicHeight.value() * style()->effectiveZoom())); 880 } 881 882 // Intrinsic dimensions expressed as percentages must be resolved relative to the dimensions of the rectangle 883 // that establishes the coordinate system for the 'background-position' property. SVG on the other hand 884 // _explicitely_ says that percentage values for the width/height attributes do NOT define intrinsic dimensions. 879 if (intrinsicWidth.isPercent() && intrinsicHeight.isPercent() && intrinsicRatio.isEmpty()) { 880 // Resolve width/height percentages against positioningAreaSize, only if no intrinsic ratio is provided. 881 resolvedWidth = static_cast<int>(round(positioningAreaSize.width() * intrinsicWidth.percent() / 100)); 882 resolvedHeight = static_cast<int>(round(positioningAreaSize.height() * intrinsicHeight.percent() / 100)); 883 } else { 884 if (intrinsicWidth.isFixed()) 885 resolvedWidth = static_cast<int>(intrinsicWidth.value() * style()->effectiveZoom()); 886 if (intrinsicHeight.isFixed()) 887 resolvedHeight = static_cast<int>(intrinsicHeight.value() * style()->effectiveZoom()); 888 } 889 } 890 885 891 if (resolvedWidth > 0 && resolvedHeight > 0) 886 892 return IntSize(resolvedWidth, resolvedHeight); -
TabularUnified trunk/Source/WebCore/rendering/RenderImage.cpp ¶
r105404 r105513 493 493 } 494 494 495 RenderBox* contentRenderer = embeddedContentBox();496 bool hasRelativeWidth = contentRenderer ? contentRenderer->style()->width().isPercent() : m_imageResource->imageHasRelativeWidth();497 bool hasRelativeHeight = contentRenderer ? contentRenderer->style()->height().isPercent() : m_imageResource->imageHasRelativeHeight();498 499 495 IntSize containerSize; 500 if ( hasRelativeWidth || hasRelativeHeight) {496 if (m_imageResource->imageHasRelativeWidth() || m_imageResource->imageHasRelativeHeight()) { 501 497 // Propagate the containing block size to the image resource, otherwhise we can't compute our own intrinsic size, if it's relative. 502 498 RenderObject* containingBlock = isPositioned() ? container() : this->containingBlock(); … … 524 520 } 525 521 526 void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsic Ratio, bool& isPercentageIntrinsicSize) const522 void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const 527 523 { 528 524 // Assure this method is never used for SVGImages. … … 530 526 isPercentageIntrinsicSize = false; 531 527 CachedImage* cachedImage = m_imageResource ? m_imageResource->cachedImage() : 0; 532 if (cachedImage && cachedImage->image()) 533 intrinsicRatio = cachedImage->image()->size(); 528 if (!cachedImage || !cachedImage->image()) 529 return; 530 intrinsicSize = cachedImage->image()->size(); 531 intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height()); 534 532 } 535 533 -
TabularUnified trunk/Source/WebCore/rendering/RenderImage.h ¶
r105404 r105513 61 61 virtual bool needsPreferredWidthsRecalculation() const; 62 62 virtual RenderBox* embeddedContentBox() const; 63 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsic Ratio, bool& isPercentageIntrinsicSize) const;63 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; 64 64 65 65 virtual void styleDidChange(StyleDifference, const RenderStyle*); -
TabularUnified trunk/Source/WebCore/rendering/RenderReplaced.cpp ¶
r105404 r105513 217 217 } 218 218 219 static inline RenderBlock* firstContainingBlockWithLogicalWidth(const RenderReplaced* replaced) 220 { 221 // We have to lookup the containing block, which has an explicit width, which must not be equal to our direct containing block. 222 // If the embedded document appears _after_ we performed the initial layout, our intrinsic size is 300x150. If our containing 223 // block doesn't provide an explicit width, it's set to the 300 default, coming from the initial layout run. 224 RenderBlock* containingBlock = replaced->containingBlock(); 225 if (!containingBlock) 226 return 0; 227 228 for (; !containingBlock->isRenderView() && !containingBlock->isBody(); containingBlock = containingBlock->containingBlock()) { 229 if (containingBlock->style()->logicalWidth().isSpecified()) 230 return containingBlock; 231 } 232 233 return 0; 234 } 235 236 bool RenderReplaced::hasReplacedLogicalWidth() const 237 { 238 if (style()->logicalWidth().isSpecified()) 239 return true; 240 241 if (style()->logicalWidth().isAuto()) 242 return false; 243 244 return firstContainingBlockWithLogicalWidth(this); 245 } 246 247 static inline bool hasAutoHeightOrContainingBlockWithAutoHeight(const RenderReplaced* replaced) 248 { 249 Length logicalHeightLength = replaced->style()->logicalHeight(); 250 if (logicalHeightLength.isAuto()) 251 return true; 252 253 // For percentage heights: The percentage is calculated with respect to the height of the generated box's 254 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends 255 // on content height), and this element is not absolutely positioned, the value computes to 'auto'. 256 if (!logicalHeightLength.isPercent() || replaced->isPositioned() || replaced->document()->inQuirksMode()) 257 return false; 258 259 for (RenderBlock* cb = replaced->containingBlock(); !cb->isRenderView(); cb = cb->containingBlock()) { 260 if (cb->isTableCell() || (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()))) 261 return false; 262 } 263 264 return true; 265 } 266 267 bool RenderReplaced::hasReplacedLogicalHeight() const 268 { 269 if (style()->logicalHeight().isAuto()) 270 return false; 271 272 if (style()->logicalHeight().isSpecified()) { 273 if (hasAutoHeightOrContainingBlockWithAutoHeight(this)) 274 return false; 275 return true; 276 } 277 278 return false; 279 } 280 219 281 LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const 220 282 { … … 227 289 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width 228 290 bool isPercentageIntrinsicSize = false; 229 FloatSize intrinsicRatio; 291 double intrinsicRatio = 0; 292 FloatSize intrinsicSize; 230 293 if (contentRenderer) { 231 contentRenderer->computeIntrinsicRatioInformation(intrinsic Ratio, isPercentageIntrinsicSize);294 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); 232 295 contentRenderStyle = contentRenderer->style(); 233 296 ASSERT(contentRenderStyle); 234 297 } else 235 computeIntrinsicRatioInformation(intrinsicRatio, isPercentageIntrinsicSize); 298 computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); 299 300 if (intrinsicRatio && !isHorizontalWritingMode()) 301 intrinsicRatio = 1 / intrinsicRatio; 236 302 237 303 if (style()->logicalWidth().isAuto()) { 238 304 bool heightIsAuto = style()->logicalHeight().isAuto(); 239 bool hasIntrinsicWidth = m_hasIntrinsicSize || ( contentRenderer && contentRenderStyle->logicalWidth().isFixed());305 bool hasIntrinsicWidth = m_hasIntrinsicSize || (!isPercentageIntrinsicSize && intrinsicSize.width() > 0); 240 306 241 307 // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. 242 if (heightIsAuto && hasIntrinsicWidth) 243 return computeIntrinsicLogicalWidth(contentRenderer, includeMaxWidth); 244 245 bool hasIntrinsicHeight = m_hasIntrinsicSize || (contentRenderer && contentRenderStyle->logicalHeight().isFixed()); 246 if (!intrinsicRatio.isEmpty()) { 308 if (heightIsAuto && hasIntrinsicWidth) { 309 if (m_hasIntrinsicSize) 310 return computeReplacedLogicalWidthRespectingMinMaxWidth(calcAspectRatioLogicalWidth(), includeMaxWidth); 311 return static_cast<LayoutUnit>(intrinsicSize.width() * style()->effectiveZoom()); 312 } 313 314 bool hasIntrinsicHeight = m_hasIntrinsicSize || (!isPercentageIntrinsicSize && intrinsicSize.height() > 0); 315 if (intrinsicRatio || isPercentageIntrinsicSize) { 247 316 // If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio; 248 317 // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value 249 318 // of 'width' is: (used height) * (intrinsic ratio) 250 if ((heightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !heightIsAuto) { 251 if (heightIsAuto) { 252 if (contentRenderer) { 253 LayoutUnit logicalHeight = contentRenderer->computeReplacedLogicalHeightUsing(contentRenderStyle->logicalHeight()); 254 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 255 return contentRenderer->computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height()))); 256 } 257 } else { 258 LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 259 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 260 return computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height()))); 261 } 319 if (intrinsicRatio && ((heightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !heightIsAuto)) { 320 LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 321 return computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<LayoutUnit>(ceil(logicalHeight * intrinsicRatio))); 262 322 } 263 323 … … 265 325 // 'width' is undefined in CSS 2.1. However, it is suggested that, if the containing block's width does not itself depend on the replaced element's width, then 266 326 // the used value of 'width' is calculated from the constraint equation used for block-level, non-replaced elements in normal flow. 267 RenderBlock* containingBlock = this->containingBlock(); 268 if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight && contentRenderer && containingBlock) { 327 if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight && contentRenderer) { 269 328 // The aforementioned 'constraint equation' used for block-level, non-replaced elements in normal flow: 270 329 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block 271 272 // We have to lookup the containing block, which has an explicit width, which must not be equal to our direct containing block. 273 // If the embedded document appears _after_ we performed the initial layout, our intrinsic size is 300x150. If our containing 274 // block doesn't provide an explicit width, it's set to the 300 default, coming from the initial layout run. 275 bool foundExplicitWidth = false; 276 for (; !containingBlock->isRenderView() && !containingBlock->isBody(); containingBlock = containingBlock->containingBlock()) { 277 if (containingBlock->style()->logicalWidth().isSpecified()) { 278 foundExplicitWidth = true; 279 break; 280 } 281 } 282 330 LayoutUnit logicalWidth; 331 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) 332 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(blockWithWidth->style()->logicalWidth()), false); 333 else 334 logicalWidth = containingBlock()->availableLogicalWidth(); 335 283 336 // This solves above equation for 'width' (== logicalWidth). 284 LayoutUnit logicalWidth = foundExplicitWidth ? computeIntrinsicLogicalWidth(containingBlock, false) : containingBlock->availableLogicalWidth();285 337 LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth); 286 338 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth); … … 288 340 if (isPercentageIntrinsicSize) 289 341 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 290 logicalWidth = static_cast< int>(ceilf(logicalWidth * intrinsicRatio.width() / 100));342 logicalWidth = static_cast<LayoutUnit>(round(logicalWidth * intrinsicSize.width() / 100)); 291 343 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth); 292 344 } … … 294 346 295 347 // Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'. 296 if (hasIntrinsicWidth) 297 return computeIntrinsicLogicalWidth(contentRenderer, includeMaxWidth); 348 if (hasIntrinsicWidth) { 349 if (isPercentageIntrinsicSize || m_hasIntrinsicSize) 350 return computeReplacedLogicalWidthRespectingMinMaxWidth(calcAspectRatioLogicalWidth(), includeMaxWidth); 351 return static_cast<LayoutUnit>(intrinsicSize.width() * style()->effectiveZoom()); 352 } 298 353 299 354 // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too … … 305 360 } 306 361 307 bool RenderReplaced::logicalHeightIsAuto() const308 {309 Length logicalHeightLength = style()->logicalHeight();310 if (logicalHeightLength.isAuto())311 return true;312 313 // For percentage heights: The percentage is calculated with respect to the height of the generated box's314 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends315 // on content height), and this element is not absolutely positioned, the value computes to 'auto'.316 if (!logicalHeightLength.isPercent() || isPositioned() || document()->inQuirksMode())317 return false;318 319 for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->containingBlock()) {320 if (cb->isTableCell() || (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())))321 return false;322 }323 324 return true;325 }326 327 362 LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const 328 363 { 329 364 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height 330 bool heightIsAuto = logicalHeightIsAuto(); 331 if (style()->logicalHeight().isSpecified() && !heightIsAuto) 365 if (hasReplacedLogicalHeight()) 332 366 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight())); 333 367 … … 337 371 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height 338 372 bool isPercentageIntrinsicSize = false; 339 FloatSize intrinsicRatio; 373 double intrinsicRatio = 0; 374 FloatSize intrinsicSize; 340 375 if (contentRenderer) { 341 contentRenderer->computeIntrinsicRatioInformation(intrinsic Ratio, isPercentageIntrinsicSize);376 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); 342 377 contentRenderStyle = contentRenderer->style(); 343 378 ASSERT(contentRenderStyle); 344 } 345 346 if (heightIsAuto) { 347 bool widthIsAuto = style()->logicalWidth().isAuto(); 348 bool hasIntrinsicHeight = m_hasIntrinsicSize || (contentRenderer && contentRenderStyle->logicalHeight().isFixed()); 349 350 // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'. 351 if (widthIsAuto && hasIntrinsicHeight) 352 return computeIntrinsicLogicalHeight(contentRenderer); 353 354 // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: 355 // (used width) / (intrinsic ratio) 356 if (!intrinsicRatio.isEmpty() && !isPercentageIntrinsicSize) 357 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 358 return computeReplacedLogicalHeightRespectingMinMaxHeight(static_cast<int>(ceilf(availableLogicalWidth() * intrinsicRatio.height() / intrinsicRatio.width()))); 359 360 // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. 361 if (hasIntrinsicHeight) 362 return computeIntrinsicLogicalHeight(contentRenderer); 363 364 // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height 365 // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. 366 return computeReplacedLogicalHeightRespectingMinMaxHeight(cDefaultHeight); 367 } 368 369 return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHeight()); 379 } else 380 computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize); 381 382 if (intrinsicRatio && !isHorizontalWritingMode()) 383 intrinsicRatio = 1 / intrinsicRatio; 384 385 bool widthIsAuto = style()->logicalWidth().isAuto(); 386 bool hasIntrinsicHeight = m_hasIntrinsicSize || (!isPercentageIntrinsicSize && intrinsicSize.height() > 0); 387 388 // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'. 389 if (widthIsAuto && hasIntrinsicHeight) { 390 if (m_hasIntrinsicSize) 391 return computeReplacedLogicalHeightRespectingMinMaxHeight(calcAspectRatioLogicalHeight()); 392 return static_cast<LayoutUnit>(intrinsicSize.height() * style()->effectiveZoom()); 393 } 394 395 // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: 396 // (used width) / (intrinsic ratio) 397 if (intrinsicRatio && !isPercentageIntrinsicSize) { 398 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 399 return computeReplacedLogicalHeightRespectingMinMaxHeight(round(availableLogicalWidth() / intrinsicRatio)); 400 } 401 402 // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. 403 if (hasIntrinsicHeight) { 404 if (m_hasIntrinsicSize) 405 return computeReplacedLogicalHeightRespectingMinMaxHeight(calcAspectRatioLogicalHeight()); 406 return static_cast<LayoutUnit>(intrinsicSize.height() * style()->effectiveZoom()); 407 } 408 409 // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height 410 // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. 411 return computeReplacedLogicalHeightRespectingMinMaxHeight(cDefaultHeight); 370 412 } 371 413 -
TabularUnified trunk/Source/WebCore/rendering/RenderReplaced.h ¶
r105404 r105513 36 36 virtual LayoutUnit computeReplacedLogicalHeight() const; 37 37 38 bool logicalHeightIsAuto() const; 38 bool hasReplacedLogicalWidth() const; 39 bool hasReplacedLogicalHeight() const; 39 40 40 41 protected: -
TabularUnified trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp ¶
r105404 r105513 67 67 } 68 68 69 void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const 70 { 71 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#IntrinsicSizing 72 // The intrinsic aspect ratio of the viewport of SVG content is necessary for example, when including 73 // SVG from an ‘object’ element in HTML styled with CSS. It is possible (indeed, common) for an SVG 74 // graphic to have an intrinsic aspect ratio but not to have an intrinsic width or height. 75 // The intrinsic aspect ratio must be calculated based upon the following rules: 76 // The aspect ratio is calculated by dividing a width by a height. 77 78 // If the ‘width’ and ‘height’ of the rootmost ‘svg’ element are both specified with unit identifiers 79 // (in, mm, cm, pt, pc, px, em, ex) or in user units, then the aspect ratio is calculated from the 80 // ‘width’ and ‘height’ attributes after resolving both values to user units. 81 isPercentageIntrinsicSize = false; 82 if (style()->width().isFixed() && style()->height().isFixed()) { 83 intrinsicRatio = FloatSize(width(), height()); 69 void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const 70 { 71 // Spec: http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing 72 // SVG needs to specify how to calculate some intrinsic sizing properties to enable inclusion within other languages. 73 // The intrinsic width and height of the viewport of SVG content must be determined from the ‘width’ and ‘height’ attributes. 74 // If either of these are not specified, a value of '100%' must be assumed. Note: the ‘width’ and ‘height’ attributes are not 75 // the same as the CSS width and height properties. Specifically, percentage values do not provide an intrinsic width or height, 76 // and do not indicate a percentage of the containing block. Rather, once the viewport is established, they indicate the portion 77 // of the viewport that is actually covered by image data. 78 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 79 Length intrinsicWidthAttribute = svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties); 80 Length intrinsicHeightAttribute = svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties); 81 82 // The intrinsic aspect ratio of the viewport of SVG content is necessary for example, when including SVG from an ‘object’ 83 // element in HTML styled with CSS. It is possible (indeed, common) for an SVG graphic to have an intrinsic aspect ratio but 84 // not to have an intrinsic width or height. The intrinsic aspect ratio must be calculated based upon the following rules: 85 // - The aspect ratio is calculated by dividing a width by a height. 86 // - If the ‘width’ and ‘height’ of the rootmost ‘svg’ element are both specified with unit identifiers (in, mm, cm, pt, pc, 87 // px, em, ex) or in user units, then the aspect ratio is calculated from the ‘width’ and ‘height’ attributes after 88 // resolving both values to user units. 89 if (intrinsicWidthAttribute.isFixed() || intrinsicHeightAttribute.isFixed()) { 90 if (intrinsicWidthAttribute.isFixed()) 91 intrinsicSize.setWidth(intrinsicWidthAttribute.calcFloatValue(0)); 92 if (intrinsicHeightAttribute.isFixed()) 93 intrinsicSize.setHeight(intrinsicHeightAttribute.calcFloatValue(0)); 94 if (!intrinsicSize.isEmpty()) 95 intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height()); 84 96 return; 85 97 } 86 98 87 // If either/both of the ‘width’ and ‘height’ of the rootmost ‘svg’ element are in percentage units (or omitted), 88 // the aspect ratio is calculated from the width and height values of the ‘viewBox’ specified for the current SVG 89 // document fragment. If the ‘viewBox’ is not correctly specified, or set to 'none', the intrinsic aspect ratio 90 // cannot be calculated and is considered unspecified. 91 intrinsicRatio = static_cast<SVGSVGElement*>(node())->currentViewBoxRect().size(); 92 93 // Compatibility with authors expectations and Firefox/Opera: when percentage units are used, take them into 94 // account for certain cases of the intrinsic width/height calculation in RenderPart::computeReplacedLogicalWidth/Height. 95 if (intrinsicRatio.isEmpty() && style()->width().isPercent() && style()->height().isPercent()) { 99 // - If either/both of the ‘width’ and ‘height’ of the rootmost ‘svg’ element are in percentage units (or omitted), the 100 // aspect ratio is calculated from the width and height values of the ‘viewBox’ specified for the current SVG document 101 // fragment. If the ‘viewBox’ is not correctly specified, or set to 'none', the intrinsic aspect ratio cannot be 102 // calculated and is considered unspecified. 103 intrinsicSize = svg->viewBox().size(); 104 if (!intrinsicSize.isEmpty()) { 105 // The viewBox can only yield an intrinsic ratio, not an intrinsic size. 106 intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height()); 107 intrinsicSize = FloatSize(); 108 return; 109 } 110 111 // If our intrinsic size is in percentage units, return those to the caller through the intrinsicSize. Notify the caller 112 // about the special situation, by setting isPercentageIntrinsicSize=true, so it knows how to interpret the return values. 113 if (intrinsicWidthAttribute.isPercent() && intrinsicHeightAttribute.isPercent()) { 96 114 isPercentageIntrinsicSize = true; 97 intrinsic Ratio = FloatSize(style()->width().percent(), style()->height().percent());115 intrinsicSize = FloatSize(intrinsicWidthAttribute.percent(), intrinsicHeightAttribute.percent()); 98 116 } 99 117 } … … 135 153 } 136 154 155 static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize) 156 { 157 return static_cast<LayoutUnit>(length.calcValue(maxSize) * (length.isFixed() ? scale : 1)); 158 /* 159 if (length.isFixed()) 160 return static_cast<LayoutUnit>(length.calcFloatValue(maxSize) * scale); 161 return static_cast<LayoutUnit>(length.calcFloatValue(maxSize)); 162 */ 163 } 164 137 165 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const 138 166 { 167 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 168 ASSERT(svg); 169 139 170 // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size. 140 LayoutUnit replacedWidth = m_containerSize.width(); 141 if (replacedWidth > 0) 142 return replacedWidth; 143 144 replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth); 145 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 146 if (!frame) 147 return replacedWidth; 148 149 if (!isEmbeddedThroughFrameContainingSVGDocument()) 150 return replacedWidth; 151 152 RenderPart* ownerRenderer = frame->ownerRenderer(); 153 RenderStyle* ownerRendererStyle = ownerRenderer->style(); 154 ASSERT(ownerRendererStyle); 155 ASSERT(frame->contentRenderer()); 156 157 Length ownerWidth = ownerRendererStyle->width(); 158 if (ownerWidth.isAuto()) 159 return replacedWidth; 160 161 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSpace 162 // The SVG user agent negotiates with its parent user agent to determine the viewport into which the SVG user agent can render 163 // the document. In some circumstances, SVG content will be embedded (by reference or inline) within a containing document. 164 // This containing document might include attributes, properties and/or other parameters (explicit or implicit) which specify 165 // or provide hints about the dimensions of the viewport for the SVG content. SVG content itself optionally can provide 166 // information about the appropriate viewport region for the content via the ‘width’ and ‘height’ XML attributes on the 167 // outermost svg element. The negotiation process uses any information provided by the containing document and the SVG 168 // content itself to choose the viewport location and size. 169 170 // The ‘width’ attribute on the outermost svg element establishes the viewport's width, unless the following conditions are met: 171 // * the SVG content is a separately stored resource that is embedded by reference (such as the ‘object’ element in XHTML [XHTML]), 172 // or the SVG content is embedded inline within a containing document; 173 // * and the referencing element or containing document is styled using CSS [CSS2] or XSL [XSL]; 174 // * and there are CSS-compatible positioning properties ([CSS2], section 9.3) specified on the referencing element 175 // (e.g., the ‘object’ element) or on the containing document's outermost svg element that are sufficient to establish 176 // the width of the viewport. 177 // 178 // Under these conditions, the positioning properties establish the viewport's width. 179 return ownerRenderer->computeReplacedLogicalWidthRespectingMinMaxWidth(ownerRenderer->computeReplacedLogicalWidthUsing(ownerWidth), includeMaxWidth); 171 if (!m_containerSize.isEmpty()) 172 return m_containerSize.width(); 173 174 if (style()->logicalWidth().isSpecified()) 175 return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth); 176 177 if (svg->widthAttributeEstablishesViewport()) 178 return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalWidth()); 179 180 // Only SVGs embedded in <object> reach this point. 181 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); 182 return document()->frame()->ownerRenderer()->availableLogicalWidth(); 180 183 } 181 184 182 185 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const 183 186 { 187 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 188 ASSERT(svg); 189 184 190 // When we're embedded through SVGImage (border-image/background-image/<html:img>/...) we're forced to resize to a specific size. 185 LayoutUnit replacedHeight = m_containerSize.height(); 186 if (replacedHeight > 0) 187 return replacedHeight; 188 189 replacedHeight = RenderBox::computeReplacedLogicalHeight(); 190 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 191 if (!frame) 192 return replacedHeight; 193 194 if (!isEmbeddedThroughFrameContainingSVGDocument()) 195 return replacedHeight; 196 197 RenderPart* ownerRenderer = frame->ownerRenderer(); 198 ASSERT(ownerRenderer); 199 200 RenderStyle* ownerRendererStyle = ownerRenderer->style(); 201 ASSERT(ownerRendererStyle); 202 203 Length ownerHeight = ownerRendererStyle->height(); 204 if (ownerHeight.isAuto()) 205 return replacedHeight; 206 207 // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#ViewportSpace 208 // See comment in RenderSVGRoot::computeReplacedLogicalWidth(). 209 // Similarly, if there are positioning properties specified on the referencing element or on the outermost svg element that 210 // are sufficient to establish the height of the viewport, then these positioning properties establish the viewport's height; 211 // otherwise, the ‘height’ attribute on the outermost svg element establishes the viewport's height. 212 return ownerRenderer->computeReplacedLogicalHeightRespectingMinMaxHeight(ownerRenderer->computeReplacedLogicalHeightUsing(ownerHeight)); 191 if (!m_containerSize.isEmpty()) 192 return m_containerSize.height(); 193 194 if (hasReplacedLogicalHeight()) 195 return RenderReplaced::computeReplacedLogicalHeight(); 196 197 if (svg->heightAttributeEstablishesViewport()) 198 return resolveLengthAttributeForSVG(svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalHeight()); 199 200 // Only SVGs embedded in <object> reach this point. 201 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); 202 return document()->frame()->ownerRenderer()->availableLogicalHeight(); 213 203 } 214 204 -
TabularUnified trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h ¶
r105404 r105513 43 43 bool isEmbeddedThroughFrameContainingSVGDocument() const; 44 44 45 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsic Ratio, bool& isPercentageIntrinsicSize) const;45 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const; 46 46 const RenderObjectChildList* children() const { return &m_children; } 47 47 RenderObjectChildList* children() { return &m_children; } -
TabularUnified trunk/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h ¶
r105404 r105513 34 34 public: 35 35 explicit RenderSVGViewportContainer(SVGStyledElement*); 36 FloatRect viewport() const { return m_viewport; } 36 37 37 38 private: -
TabularUnified trunk/Source/WebCore/svg/SVGLengthContext.cpp ¶
r105404 r105513 30 30 #include "Frame.h" 31 31 #include "RenderPart.h" 32 #include "RenderSVGRoot.h" 33 #include "RenderSVGViewportContainer.h" 32 34 #include "RenderView.h" 33 35 #include "SVGNames.h" … … 275 277 } 276 278 277 // Take size from outermost <svg> element. 278 Document* document = m_context->document(); 279 if (document->documentElement() == m_context) { 280 if (m_context->isSVG()) { 281 Frame* frame = m_context->document() ? m_context->document()->frame() : 0; 282 if (!frame) 283 return false; 284 285 // SVGs embedded through <object> resolve percentage values against the owner renderer in the host document. 286 if (RenderPart* ownerRenderer = frame->ownerRenderer()) { 287 width = ownerRenderer->width(); 288 height = ownerRenderer->height(); 289 return true; 290 } 291 } 292 293 RenderView* view = toRenderView(document->renderer()); 294 if (!view) 295 return false; 296 297 // Always resolve percentages against the unscaled viewport, as agreed across browsers. 298 float zoom = view->style()->effectiveZoom(); 299 width = view->viewWidth(); 300 height = view->viewHeight(); 301 if (zoom != 1) { 302 width /= zoom; 303 height /= zoom; 304 } 305 return true; 306 } 307 308 // Take size from nearest viewport element (common case: inner <svg> elements) 279 // SVGLengthContext should NEVER be used to resolve width/height values for <svg> elements, 280 // as they require special treatment, due the relationship with the CSS width/height properties. 281 ASSERT(m_context->document()->documentElement() != m_context); 282 283 // Take size from nearest viewport element. 309 284 SVGElement* viewportElement = m_context->viewportElement(); 310 if (viewportElement && viewportElement->isSVG()) { 311 const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement); 312 FloatRect viewBox = svg->currentViewBoxRect(); 313 if (viewBox.isEmpty()) { 314 SVGLengthContext viewportContext(svg); 315 width = svg->width().value(viewportContext); 316 height = svg->height().value(viewportContext); 317 } else { 318 width = viewBox.width(); 319 height = viewBox.height(); 320 } 321 322 return true; 323 } 285 if (!viewportElement) 286 return false; 324 287 325 // Take size from enclosing non-SVG RenderBox (common case: inline SVG) 326 if (!m_context->parentNode() || m_context->parentNode()->isSVGElement()) 327 return false; 328 329 RenderObject* renderer = m_context->renderer(); 330 if (!renderer || !renderer->isBox()) 331 return false; 332 333 RenderBox* box = toRenderBox(renderer); 334 width = box->width(); 335 height = box->height(); 288 ASSERT(viewportElement->isSVG()); 289 const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement); 290 FloatSize viewportSize = svg->currentViewBoxRect().size(); 291 if (viewportSize.isEmpty()) 292 viewportSize = svg->currentViewportSize(); 293 294 width = viewportSize.width(); 295 height = viewportSize.height(); 336 296 return true; 337 297 } -
TabularUnified trunk/Source/WebCore/svg/SVGSVGElement.cpp ¶
r105404 r105513 28 28 #include "Attribute.h" 29 29 #include "CSSHelper.h" 30 #include "CSSPropertyNames.h"31 30 #include "Document.h" 32 31 #include "EventListener.h" … … 39 38 #include "FrameView.h" 40 39 #include "HTMLNames.h" 40 #include "RenderPart.h" 41 41 #include "RenderSVGResource.h" 42 42 #include "RenderSVGModelObject.h" … … 142 142 { 143 143 // FIXME: This method doesn't follow the spec and is basically untested. Parent documents are not considered here. 144 SVGLengthContext lengthContext(this); 145 FloatRect viewRectangle; 146 if (!isOutermostSVG()) 147 viewRectangle.setLocation(FloatPoint(x().value(lengthContext), y().value(lengthContext))); 148 149 viewRectangle.setSize(FloatSize(width().value(lengthContext), height().value(lengthContext))); 150 return viewBoxToViewTransform(viewRectangle.width(), viewRectangle.height()).mapRect(viewRectangle); 144 // As we have no test coverage for this, we're going to disable it completly for now. 145 return FloatRect(); 151 146 } 152 147 … … 275 270 else if (attr->name() == SVGNames::yAttr) 276 271 setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError)); 277 else if (attr->name() == SVGNames::widthAttr) {272 else if (attr->name() == SVGNames::widthAttr) 278 273 setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); 279 addCSSProperty(attr, CSSPropertyWidth, attr->value()); 280 } else if (attr->name() == SVGNames::heightAttr) { 274 else if (attr->name() == SVGNames::heightAttr) 281 275 setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); 282 addCSSProperty(attr, CSSPropertyHeight, attr->value()); 283 } else if (SVGTests::parseMappedAttribute(attr) 276 else if (SVGTests::parseMappedAttribute(attr) 284 277 || SVGLangSpace::parseMappedAttribute(attr) 285 278 || SVGExternalResourcesRequired::parseMappedAttribute(attr) … … 292 285 } 293 286 294 // This hack will not handle the case where we're setting a width/height295 // on a root <svg> via svg.width.baseValue = when it has none.296 static void updateCSSForAttribute(SVGSVGElement* element, const QualifiedName& attrName, CSSPropertyID property, const SVGLength& value)297 {298 Attribute* attribute = element->attributes(false)->getAttributeItem(attrName);299 if (!attribute || !attribute->isMappedAttribute())300 return;301 element->addCSSProperty(attribute, property, value.valueAsString());302 }303 304 287 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 305 288 { 306 // FIXME: Ugly, ugly hack to around that parseMappedAttribute is not called307 // when svg.width.baseValue = 100 is evaluated.308 // Thus the CSS length value for width is not updated, and width() computeLogicalWidth()309 // calculations on RenderSVGRoot will be wrong.310 // https://bugs.webkit.org/show_bug.cgi?id=25387311 289 bool updateRelativeLengths = false; 312 if (attrName == SVGNames::widthAttr) { 313 updateCSSForAttribute(this, attrName, CSSPropertyWidth, widthBaseValue()); 314 updateRelativeLengths = true; 315 } else if (attrName == SVGNames::heightAttr) { 316 updateCSSForAttribute(this, attrName, CSSPropertyHeight, heightBaseValue()); 317 updateRelativeLengths = true; 318 } 319 320 if (updateRelativeLengths 290 if (attrName == SVGNames::widthAttr 291 || attrName == SVGNames::heightAttr 321 292 || attrName == SVGNames::xAttr 322 293 || attrName == SVGNames::yAttr … … 451 422 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const 452 423 { 453 // This method resolves length manually, w/o involving the render tree. This is desired, as getCTM()/getScreenCTM()/.. have to work without a renderer.454 SVGLengthContext lengthContext(this);455 456 424 AffineTransform viewBoxTransform; 457 if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) 458 viewBoxTransform = viewBoxToViewTransform(width().value(lengthContext), height().value(lengthContext)); 425 if (hasAttribute(SVGNames::viewBoxAttr)) { 426 FloatSize size = currentViewportSize(); 427 viewBoxTransform = viewBoxToViewTransform(size.width(), size.height()); 428 } 459 429 460 430 AffineTransform transform; 461 if (!isOutermostSVG()) 431 if (!isOutermostSVG()) { 432 SVGLengthContext lengthContext(this); 462 433 transform.translate(x().value(lengthContext), y().value(lengthContext)); 463 else if (mode == SVGLocatable::ScreenScope) {434 } else if (mode == SVGLocatable::ScreenScope) { 464 435 if (RenderObject* renderer = this->renderer()) { 465 436 // Translate in our CSS parent coordinate space … … 556 527 } 557 528 558 FloatRect SVGSVGElement::currentViewBoxRect(CalculateViewBoxMode mode) const 559 { 560 // This method resolves length manually, w/o involving the render tree. This is desired, as getCTM()/getScreenCTM()/.. have to work without a renderer. 561 SVGLengthContext lengthContext(this); 562 563 // FIXME: The interaction of 'currentView' and embedding SVGs in other documents, is untested and unspecified. 529 FloatRect SVGSVGElement::currentViewBoxRect() const 530 { 564 531 if (useCurrentView()) { 565 532 if (SVGViewSpec* view = currentView()) // what if we should use it but it is not set? … … 568 535 } 569 536 570 bool isEmbeddedThroughSVGImage = renderer() && renderer()->isSVGRoot() ? toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage() : false;571 bool hasFixedSize = width().unitType() != LengthTypePercentage && height().unitType() != LengthTypePercentage;572 573 537 FloatRect useViewBox = viewBox(); 574 if (useViewBox.isEmpty()) { 575 // If no viewBox is specified but non-relative width/height values, then we 576 // should always synthesize a viewBox if we're embedded through a SVGImage. 577 if (hasFixedSize && isEmbeddedThroughSVGImage) 578 return FloatRect(0, 0, width().value(lengthContext), height().value(lengthContext)); 538 if (!useViewBox.isEmpty()) 539 return useViewBox; 540 if (!renderer() || !renderer()->isSVGRoot()) 579 541 return FloatRect(); 580 } 581 582 // If a viewBox is specified and non-relative width/height values, then the host document only 583 // uses the width/height values to figure out the intrinsic size when embedding us, whereas the 584 // embedded document sees specified viewBox only. 585 if (hasFixedSize && mode == CalculateViewBoxInHostDocument) 586 return FloatRect(0, 0, width().value(lengthContext), height().value(lengthContext)); 587 588 return useViewBox; 542 if (!toRenderSVGRoot(renderer())->isEmbeddedThroughSVGImage()) 543 return FloatRect(); 544 545 Length intrinsicWidth = this->intrinsicWidth(); 546 Length intrinsicHeight = this->intrinsicHeight(); 547 if (!intrinsicWidth.isFixed() || !intrinsicHeight.isFixed()) 548 return FloatRect(); 549 550 // If no viewBox is specified but non-relative width/height values, then we 551 // should always synthesize a viewBox if we're embedded through a SVGImage. 552 return FloatRect(FloatPoint(), FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0))); 553 } 554 555 FloatSize SVGSVGElement::currentViewportSize() const 556 { 557 Length intrinsicWidth = this->intrinsicWidth(); 558 Length intrinsicHeight = this->intrinsicHeight(); 559 if (intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) 560 return FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)); 561 562 if (!renderer()) 563 return FloatSize(); 564 565 if (renderer()->isSVGRoot()) { 566 LayoutRect frameRect = toRenderSVGRoot(renderer())->frameRect(); 567 return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); 568 } 569 570 FloatRect frameRect = toRenderSVGViewportContainer(renderer())->viewport(); 571 return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); 572 } 573 574 bool SVGSVGElement::widthAttributeEstablishesViewport() const 575 { 576 if (!renderer() || renderer()->isSVGViewportContainer()) 577 return true; 578 579 // Spec: http://www.w3.org/TR/SVG/coords.html#ViewportSpace 580 // The ‘width’ attribute on the outermost svg element establishes the viewport's width, unless the following conditions are met: 581 // - the SVG content is a separately stored resource that is embedded by reference (such as the ‘object’ element in XHTML [XHTML]), or 582 // the SVG content is embedded inline within a containing document; 583 // - and the referencing element or containing document is styled using CSS [CSS2] or XSL [XSL]; 584 // - and there are CSS-compatible positioning properties ([CSS2], section 9.3) specified on the referencing element (e.g., the ‘object’ element) 585 // or on the containing document's outermost svg element that are sufficient to establish the width of the viewport. Under these conditions, 586 // the positioning properties establish the viewport's width. 587 RenderSVGRoot* root = toRenderSVGRoot(renderer()); 588 589 // SVG embedded through object/embed/iframe. 590 if (root->isEmbeddedThroughFrameContainingSVGDocument()) 591 return !root->hasReplacedLogicalWidth() && !document()->frame()->ownerRenderer()->hasReplacedLogicalWidth(); 592 593 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG. 594 if (root->isEmbeddedThroughSVGImage() || document()->documentElement() != this) 595 return !root->hasReplacedLogicalWidth(); 596 597 return true; 598 } 599 600 bool SVGSVGElement::heightAttributeEstablishesViewport() const 601 { 602 if (!renderer() || renderer()->isSVGViewportContainer()) 603 return true; 604 605 // Spec: http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing 606 // Similarly, if there are positioning properties specified on the referencing element or on the outermost svg element 607 // that are sufficient to establish the height of the viewport, then these positioning properties establish the viewport's 608 // height; otherwise, the ‘height’ attribute on the outermost svg element establishes the viewport's height. 609 RenderSVGRoot* root = toRenderSVGRoot(renderer()); 610 611 // SVG embedded through object/embed/iframe. 612 if (root->isEmbeddedThroughFrameContainingSVGDocument()) 613 return !root->hasReplacedLogicalHeight() && !document()->frame()->ownerRenderer()->hasReplacedLogicalHeight(); 614 615 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG. 616 if (root->isEmbeddedThroughSVGImage() || document()->documentElement() != this) 617 return !root->hasReplacedLogicalHeight(); 618 619 return true; 620 } 621 622 Length SVGSVGElement::intrinsicWidth(ConsiderCSSMode mode) const 623 { 624 if (widthAttributeEstablishesViewport() || mode == IgnoreCSSProperties) { 625 if (width().unitType() == LengthTypePercentage) 626 return Length(width().valueAsPercentage() * 100, Percent); 627 628 SVGLengthContext lengthContext(this); 629 return Length(width().value(lengthContext), Fixed); 630 } 631 632 ASSERT(renderer()); 633 return renderer()->style()->width(); 634 } 635 636 Length SVGSVGElement::intrinsicHeight(ConsiderCSSMode mode) const 637 { 638 if (heightAttributeEstablishesViewport() || mode == IgnoreCSSProperties) { 639 if (height().unitType() == LengthTypePercentage) 640 return Length(height().valueAsPercentage() * 100, Percent); 641 642 SVGLengthContext lengthContext(this); 643 return Length(height().value(lengthContext), Fixed); 644 } 645 646 ASSERT(renderer()); 647 return renderer()->style()->height(); 589 648 } 590 649 -
TabularUnified trunk/Source/WebCore/svg/SVGSVGElement.h ¶
r105404 r105513 74 74 SVGViewSpec* currentView() const; 75 75 76 enum C alculateViewBoxMode {77 CalculateViewBoxInHostDocument,78 CalculateViewBoxInCurrentDocument76 enum ConsiderCSSMode { 77 RespectCSSProperties, 78 IgnoreCSSProperties 79 79 }; 80 80 81 FloatRect currentViewBoxRect(CalculateViewBoxMode = CalculateViewBoxInCurrentDocument) const; 81 // RenderSVGRoot wants to query the intrinsic size, by only examining the width/height attributes. 82 Length intrinsicWidth(ConsiderCSSMode = RespectCSSProperties) const; 83 Length intrinsicHeight(ConsiderCSSMode = RespectCSSProperties) const; 84 FloatSize currentViewportSize() const; 85 FloatRect currentViewBoxRect() const; 86 82 87 float currentScale() const; 83 88 void setCurrentScale(float scale); … … 125 130 126 131 Element* getElementById(const AtomicString&) const; 132 133 bool widthAttributeEstablishesViewport() const; 134 bool heightAttributeEstablishesViewport() const; 127 135 128 136 protected: -
TabularUnified trunk/Source/WebCore/svg/graphics/SVGImage.cpp ¶
r105404 r105513 141 141 // Assure that a container size is always given for a non-identity zoom level. 142 142 ASSERT(renderer->style()->effectiveZoom() == 1); 143 IntSize size = enclosingIntRect(rootElement->currentViewBoxRect(SVGSVGElement::CalculateViewBoxInHostDocument)).size(); 144 if (!size.isEmpty()) 145 return size; 143 144 FloatSize currentSize; 145 if (rootElement->intrinsicWidth().isFixed() && rootElement->intrinsicHeight().isFixed()) 146 currentSize = rootElement->currentViewportSize(); 147 else 148 currentSize = rootElement->currentViewBoxRect().size(); 149 150 if (!currentSize.isEmpty()) 151 return IntSize(static_cast<int>(ceilf(currentSize.width())), static_cast<int>(ceilf(currentSize.height()))); 146 152 147 153 // As last resort, use CSS default intrinsic size. … … 252 258 } 253 259 260 bool SVGImage::hasRelativeWidth() const 261 { 262 if (!m_page) 263 return false; 264 Frame* frame = m_page->mainFrame(); 265 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 266 if (!rootElement) 267 return false; 268 return rootElement->intrinsicWidth().isPercent(); 269 } 270 271 bool SVGImage::hasRelativeHeight() const 272 { 273 if (!m_page) 274 return false; 275 Frame* frame = m_page->mainFrame(); 276 SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement(); 277 if (!rootElement) 278 return false; 279 return rootElement->intrinsicHeight().isPercent(); 280 } 281 254 282 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) 255 283 { … … 260 288 if (!rootElement) 261 289 return; 262 RenderBox* renderer = toRenderBox(rootElement->renderer()); 263 if (!renderer) 264 return; 265 266 intrinsicWidth = renderer->style()->width(); 267 intrinsicHeight = renderer->style()->height(); 268 if (rootElement->preserveAspectRatio().align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 269 intrinsicRatio = rootElement->currentViewBoxRect().size(); 290 291 intrinsicWidth = rootElement->intrinsicWidth(); 292 intrinsicHeight = rootElement->intrinsicHeight(); 293 if (rootElement->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 294 return; 295 296 intrinsicRatio = rootElement->viewBox().size(); 297 if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) 298 intrinsicRatio = FloatSize(intrinsicWidth.calcFloatValue(0), intrinsicHeight.calcFloatValue(0)); 270 299 } 271 300 -
TabularUnified trunk/Source/WebCore/svg/graphics/SVGImage.h ¶
r105404 r105513 58 58 virtual IntSize size() const; 59 59 60 virtual bool hasRelativeWidth() const; 61 virtual bool hasRelativeHeight() const; 62 60 63 private: 61 64 virtual ~SVGImage();
Note:
See TracChangeset
for help on using the changeset viewer.