Changeset 114012 in webkit
- Timestamp:
- Apr 12, 2012 12:07:07 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r114010 r114012 1 2012-04-12 David Barton <dbarton@mathscribe.com> 2 3 Don't modify shared style objects in RenderMathMLRoot.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=83736 5 6 Reviewed by Julien Chaffraix. 7 8 * platform/mac/mathml/presentation/roots-expected.png: 9 * platform/mac/mathml/presentation/roots-expected.txt: 10 1 11 2012-04-12 Tom Sepez <tsepez@chromium.org> 2 12 -
trunk/LayoutTests/platform/mac/mathml/presentation/roots-expected.txt
r113749 r114012 91 91 RenderMathMLMath {math} at (75,0) size 47x22 92 92 RenderBlock {p} at (0,238) size 784x40 93 RenderText {#text} at (0, 10) size 185x1894 text run at (0, 10) width 185: "long index w/ complex base: "95 RenderMathMLMath {math} at (185,0) size 7 3x4093 RenderText {#text} at (0,9) size 185x18 94 text run at (0,9) width 185: "long index w/ complex base: " 95 RenderMathMLMath {math} at (185,0) size 72x40 96 96 RenderBlock {p} at (0,294) size 784x48 97 97 RenderText {#text} at (0,29) size 75x18 … … 180 180 RenderText {#text} at (0,36) size 110x18 181 181 text run at (0,36) width 110: "Imbricated roots: " 182 RenderMathMLMath {math} at (110,0) size 328x76182 RenderMathMLMath {math} at (110,0) size 285x76 183 183 RenderText {#text} at (0,0) size 0x0 184 184 layer at (182,180) size 20x20 185 185 RenderMathMLRoot {mroot} at (1,0) size 20x20 186 RenderMathMLBlock {mroot} at (12,15) size 0x0 187 RenderMathMLBlock {mroot} at (12,4) size 8x16 188 RenderInline {mn} at (0,0) size 8x16 189 RenderText {#text} at (0,0) size 8x16 190 text run at (0,0) width 8: "2" 186 RenderInline {mn} at (0,0) size 8x16 187 RenderText {#text} at (12,4) size 8x16 188 text run at (12,4) width 8: "2" 191 189 layer at (182,180) size 12x14 192 190 RenderBlock (positioned) {mn} at (0,0) size 12x14 … … 195 193 layer at (84,216) size 45x22 196 194 RenderMathMLRoot {mroot} at (1,0) size 45x22 197 RenderMathMLBlock {mroot} at (37,17) size 0x0 198 RenderMathMLBlock {mroot} at (37,6) size 8x16 199 RenderInline {mn} at (0,0) size 8x16 200 RenderText {#text} at (0,0) size 8x16 201 text run at (0,0) width 8: "2" 195 RenderInline {mn} at (0,0) size 8x16 196 RenderText {#text} at (37,6) size 8x16 197 text run at (37,6) width 8: "2" 202 198 layer at (84,216) size 37x16 203 199 RenderMathMLRow {mrow} at (0,0) size 37x16 … … 219 215 RenderText {#text} at (28,0) size 5x12 220 216 text run at (28,0) width 5: "z" 221 layer at (194,254) size 71x40 222 RenderMathMLRoot {mroot} at (1,0) size 71x40 223 RenderMathMLBlock {mroot} at (39,24) size 0x0 224 RenderMathMLBlock {mroot} at (39,3) size 32x34 225 RenderMathMLFraction {mfrac} at (1,0) size 31x34 226 RenderMathMLBlock {mfrac} at (0,0) size 31x16 227 RenderMathMLRow {mrow} at (3,0) size 25x16 228 RenderInline {mi} at (0,0) size 7x16 229 RenderText {#text} at (0,0) size 7x16 230 text run at (0,0) width 7: "x" 231 RenderMathMLOperator {mo} at (7,0) size 10x16 232 RenderMathMLBlock {mo} at (0,0) size 9x16 233 RenderText {mo} at (0,0) size 9x16 234 text run at (0,0) width 9: "+" 235 RenderInline {mn} at (0,0) size 8x16 236 RenderText {#text} at (17,0) size 8x16 237 text run at (17,0) width 8: "1" 238 RenderMathMLBlock {mfrac} at (0,16) size 31x18 239 RenderMathMLRow {mrow} at (3,2) size 25x16 240 RenderInline {mi} at (0,0) size 7x16 241 RenderText {#text} at (0,0) size 7x16 242 text run at (0,0) width 7: "x" 243 RenderMathMLOperator {mo} at (7,0) size 10x16 244 RenderMathMLBlock {mo} at (0,0) size 9x16 245 RenderText {mo} at (0,0) size 9x16 246 text run at (0,0) width 9: "+" 247 RenderInline {mn} at (0,0) size 8x16 248 RenderText {#text} at (17,0) size 8x16 249 text run at (17,0) width 8: "2" 250 layer at (194,263) size 37x16 251 RenderMathMLRow {mrow} at (0,9) size 37x16 217 layer at (194,254) size 70x40 218 RenderMathMLRoot {mroot} at (1,0) size 70x40 219 RenderMathMLFraction {mfrac} at (39,3) size 31x34 220 RenderMathMLBlock {mfrac} at (0,0) size 31x16 221 RenderMathMLRow {mrow} at (3,0) size 25x16 222 RenderInline {mi} at (0,0) size 7x16 223 RenderText {#text} at (0,0) size 7x16 224 text run at (0,0) width 7: "x" 225 RenderMathMLOperator {mo} at (7,0) size 10x16 226 RenderMathMLBlock {mo} at (0,0) size 9x16 227 RenderText {mo} at (0,0) size 9x16 228 text run at (0,0) width 9: "+" 229 RenderInline {mn} at (0,0) size 8x16 230 RenderText {#text} at (17,0) size 8x16 231 text run at (17,0) width 8: "1" 232 RenderMathMLBlock {mfrac} at (0,16) size 31x18 233 RenderMathMLRow {mrow} at (3,2) size 25x16 234 RenderInline {mi} at (0,0) size 7x16 235 RenderText {#text} at (0,0) size 7x16 236 text run at (0,0) width 7: "x" 237 RenderMathMLOperator {mo} at (7,0) size 10x16 238 RenderMathMLBlock {mo} at (0,0) size 9x16 239 RenderText {mo} at (0,0) size 9x16 240 text run at (0,0) width 9: "+" 241 RenderInline {mn} at (0,0) size 8x16 242 RenderText {#text} at (17,0) size 8x16 243 text run at (17,0) width 8: "2" 244 layer at (194,262) size 37x16 245 RenderMathMLRow {mrow} at (0,8) size 37x16 252 246 RenderInline {mi} at (0,0) size 5x12 253 247 RenderText {#text} at (2,0) size 5x12 … … 269 263 layer at (84,310) size 27x48 270 264 RenderMathMLRoot {mroot} at (1,0) size 27x48 271 RenderMathMLBlock {mroot} at (19,43) size 0x0 272 RenderMathMLBlock {mroot} at (19,32) size 8x16 273 RenderInline {mn} at (0,0) size 8x16 274 RenderText {#text} at (0,0) size 8x16 275 text run at (0,0) width 8: "2" 265 RenderInline {mn} at (0,0) size 8x16 266 RenderText {#text} at (19,32) size 8x16 267 text run at (19,32) width 8: "2" 276 268 layer at (84,310) size 19x42 277 269 RenderMathMLFraction {mfrac} at (0,0) size 19x42 … … 290 282 RenderText {#text} at (4,2) size 5x12 291 283 text run at (4,2) width 5: "z" 292 layer at (119,445) size 326x76 293 RenderMathMLRoot {mroot} at (1,0) size 326x76 294 RenderMathMLBlock {mroot} at (18,50) size 0x0 295 RenderMathMLBlock {mroot} at (18,3) size 308x70 296 RenderMathMLRow {mrow} at (11,0) size 297x70 297 RenderInline {mn} at (0,0) size 8x16 298 RenderText {#text} at (0,36) size 8x16 299 text run at (0,36) width 8: "1" 300 RenderMathMLOperator {mo} at (8,36) size 10x16 301 RenderMathMLBlock {mo} at (0,0) size 9x16 302 RenderText {mo} at (0,0) size 9x16 303 text run at (0,0) width 9: "+" 304 layer at (119,478) size 12x14 305 RenderBlock (positioned) {mn} at (0,33) size 12x14 306 RenderText {#text} at (2,0) size 6x12 307 text run at (2,0) width 6: "3" 308 layer at (166,448) size 279x70 309 RenderMathMLRoot {mroot} at (18,0) size 279x70 310 RenderMathMLBlock {mroot} at (18,47) size 0x0 311 RenderMathMLBlock {mroot} at (18,3) size 261x64 312 RenderMathMLRow {mrow} at (9,0) size 252x64 313 RenderInline {mn} at (0,0) size 8x16 314 RenderText {#text} at (0,33) size 8x16 315 text run at (0,33) width 8: "2" 316 RenderMathMLOperator {mo} at (8,33) size 10x16 317 RenderMathMLBlock {mo} at (0,0) size 9x16 318 RenderText {mo} at (0,0) size 9x16 319 text run at (0,0) width 9: "+" 320 layer at (166,477) size 12x14 321 RenderBlock (positioned) {mn} at (0,29) size 12x14 322 RenderText {#text} at (2,0) size 6x12 323 text run at (2,0) width 6: "4" 324 layer at (211,451) size 234x64 325 RenderMathMLRoot {mroot} at (18,0) size 234x64 326 RenderMathMLBlock {mroot} at (18,44) size 0x0 327 RenderMathMLBlock {mroot} at (18,3) size 216x58 328 RenderMathMLRow {mrow} at (8,0) size 208x58 329 RenderInline {mn} at (0,0) size 8x16 330 RenderText {#text} at (0,30) size 8x16 331 text run at (0,30) width 8: "3" 332 RenderMathMLOperator {mo} at (8,30) size 10x16 333 RenderMathMLBlock {mo} at (0,0) size 9x16 334 RenderText {mo} at (0,0) size 9x16 335 text run at (0,0) width 9: "+" 336 layer at (211,477) size 12x14 337 RenderBlock (positioned) {mn} at (0,26) size 12x14 338 RenderText {#text} at (2,0) size 6x12 339 text run at (2,0) width 6: "5" 340 layer at (255,454) size 190x58 341 RenderMathMLRoot {mroot} at (18,0) size 190x58 342 RenderMathMLBlock {mroot} at (18,41) size 0x0 343 RenderMathMLBlock {mroot} at (18,3) size 172x52 344 RenderMathMLRow {mrow} at (6,0) size 166x52 345 RenderInline {mn} at (0,0) size 8x16 346 RenderText {#text} at (0,27) size 8x16 347 text run at (0,27) width 8: "4" 348 RenderMathMLOperator {mo} at (8,27) size 10x16 349 RenderMathMLBlock {mo} at (0,0) size 9x16 350 RenderText {mo} at (0,0) size 9x16 351 text run at (0,0) width 9: "+" 352 layer at (255,476) size 12x14 353 RenderBlock (positioned) {mn} at (0,22) size 12x14 354 RenderText {#text} at (2,0) size 6x12 355 text run at (2,0) width 6: "6" 356 layer at (297,457) size 148x52 357 RenderMathMLRoot {mroot} at (18,0) size 148x52 358 RenderMathMLBlock {mroot} at (17,38) size 0x0 359 RenderMathMLBlock {mroot} at (17,3) size 131x46 360 RenderMathMLRow {mrow} at (4,0) size 127x46 361 RenderInline {mn} at (0,0) size 8x16 362 RenderText {#text} at (0,24) size 8x16 363 text run at (0,24) width 8: "5" 364 RenderMathMLOperator {mo} at (8,24) size 10x16 365 RenderMathMLBlock {mo} at (0,0) size 9x16 366 RenderText {mo} at (0,0) size 9x16 367 text run at (0,0) width 9: "+" 368 layer at (297,475) size 12x14 369 RenderBlock (positioned) {mn} at (0,18) size 12x14 370 RenderText {#text} at (2,0) size 6x12 371 text run at (2,0) width 6: "7" 372 layer at (336,460) size 109x46 373 RenderMathMLRoot {mroot} at (18,0) size 109x46 374 RenderMathMLBlock {mroot} at (16,35) size 0x0 375 RenderMathMLBlock {mroot} at (16,3) size 93x40 376 RenderMathMLRow {mrow} at (3,0) size 90x40 377 RenderInline {mn} at (0,0) size 8x16 378 RenderText {#text} at (0,21) size 8x16 379 text run at (0,21) width 8: "6" 380 RenderMathMLOperator {mo} at (8,21) size 10x16 381 RenderMathMLBlock {mo} at (0,0) size 9x16 382 RenderText {mo} at (0,0) size 9x16 383 text run at (0,0) width 9: "+" 384 layer at (336,474) size 12x14 385 RenderBlock (positioned) {mn} at (0,14) size 12x14 386 RenderText {#text} at (2,0) size 6x12 387 text run at (2,0) width 6: "8" 388 layer at (373,463) size 72x40 389 RenderMathMLRoot {mroot} at (18,0) size 72x40 390 RenderMathMLBlock {mroot} at (14,32) size 0x0 391 RenderMathMLBlock {mroot} at (14,3) size 58x34 392 RenderMathMLRow {mrow} at (2,0) size 56x34 393 RenderInline {mn} at (0,0) size 8x16 394 RenderText {#text} at (0,18) size 8x16 395 text run at (0,18) width 8: "7" 396 RenderMathMLOperator {mo} at (8,18) size 10x16 397 RenderMathMLBlock {mo} at (0,0) size 9x16 398 RenderText {mo} at (0,0) size 9x16 399 text run at (0,0) width 9: "+" 400 layer at (373,474) size 12x14 401 RenderBlock (positioned) {mn} at (0,11) size 12x14 402 RenderText {#text} at (2,0) size 6x12 403 text run at (2,0) width 6: "9" 404 layer at (407,466) size 38x34 284 layer at (119,445) size 283x76 285 RenderMathMLRoot {mroot} at (1,0) size 283x76 286 RenderMathMLRow {mrow} at (18,3) size 265x70 287 RenderInline {mn} at (0,0) size 8x16 288 RenderText {#text} at (0,36) size 8x16 289 text run at (0,36) width 8: "1" 290 RenderMathMLOperator {mo} at (8,36) size 10x16 291 RenderMathMLBlock {mo} at (0,0) size 9x16 292 RenderText {mo} at (0,0) size 9x16 293 text run at (0,0) width 9: "+" 294 layer at (155,448) size 247x70 295 RenderMathMLRoot {mroot} at (18,0) size 247x70 296 RenderMathMLRow {mrow} at (18,3) size 229x64 297 RenderInline {mn} at (0,0) size 8x16 298 RenderText {#text} at (0,33) size 8x16 299 text run at (0,33) width 8: "2" 300 RenderMathMLOperator {mo} at (8,33) size 10x16 301 RenderMathMLBlock {mo} at (0,0) size 9x16 302 RenderText {mo} at (0,0) size 9x16 303 text run at (0,0) width 9: "+" 304 layer at (191,451) size 211x64 305 RenderMathMLRoot {mroot} at (18,0) size 211x64 306 RenderMathMLRow {mrow} at (18,3) size 193x58 307 RenderInline {mn} at (0,0) size 8x16 308 RenderText {#text} at (0,30) size 8x16 309 text run at (0,30) width 8: "3" 310 RenderMathMLOperator {mo} at (8,30) size 10x16 311 RenderMathMLBlock {mo} at (0,0) size 9x16 312 RenderText {mo} at (0,0) size 9x16 313 text run at (0,0) width 9: "+" 314 layer at (227,454) size 175x58 315 RenderMathMLRoot {mroot} at (18,0) size 175x58 316 RenderMathMLRow {mrow} at (18,3) size 157x52 317 RenderInline {mn} at (0,0) size 8x16 318 RenderText {#text} at (0,27) size 8x16 319 text run at (0,27) width 8: "4" 320 RenderMathMLOperator {mo} at (8,27) size 10x16 321 RenderMathMLBlock {mo} at (0,0) size 9x16 322 RenderText {mo} at (0,0) size 9x16 323 text run at (0,0) width 9: "+" 324 layer at (263,457) size 139x52 325 RenderMathMLRoot {mroot} at (18,0) size 139x52 326 RenderMathMLRow {mrow} at (17,3) size 122x46 327 RenderInline {mn} at (0,0) size 8x16 328 RenderText {#text} at (0,24) size 8x16 329 text run at (0,24) width 8: "5" 330 RenderMathMLOperator {mo} at (8,24) size 10x16 331 RenderMathMLBlock {mo} at (0,0) size 9x16 332 RenderText {mo} at (0,0) size 9x16 333 text run at (0,0) width 9: "+" 334 layer at (298,460) size 104x46 335 RenderMathMLRoot {mroot} at (18,0) size 104x46 336 RenderMathMLRow {mrow} at (16,3) size 88x40 337 RenderInline {mn} at (0,0) size 8x16 338 RenderText {#text} at (0,21) size 8x16 339 text run at (0,21) width 8: "6" 340 RenderMathMLOperator {mo} at (8,21) size 10x16 341 RenderMathMLBlock {mo} at (0,0) size 9x16 342 RenderText {mo} at (0,0) size 9x16 343 text run at (0,0) width 9: "+" 344 layer at (332,463) size 70x40 345 RenderMathMLRoot {mroot} at (18,0) size 70x40 346 RenderMathMLRow {mrow} at (14,3) size 56x34 347 RenderInline {mn} at (0,0) size 8x16 348 RenderText {#text} at (0,18) size 8x16 349 text run at (0,18) width 8: "7" 350 RenderMathMLOperator {mo} at (8,18) size 10x16 351 RenderMathMLBlock {mo} at (0,0) size 9x16 352 RenderText {mo} at (0,0) size 9x16 353 text run at (0,0) width 9: "+" 354 layer at (364,466) size 38x34 405 355 RenderMathMLRoot {mroot} at (18,0) size 38x34 406 RenderMathMLBlock {mroot} at (28,29) size 0x0 407 RenderMathMLBlock {mroot} at (28,18) size 10x16 408 RenderInline {mi} at (0,0) size 10x16 409 RenderText {#text} at (0,0) size 10x16 410 text run at (0,0) width 10: "A" 411 layer at (407,466) size 28x28 356 RenderInline {mi} at (0,0) size 10x16 357 RenderText {#text} at (28,18) size 10x16 358 text run at (28,18) width 10: "A" 359 layer at (364,466) size 28x28 412 360 RenderMathMLFraction {mfrac} at (0,0) size 28x28 413 361 RenderMathMLBlock {mfrac} at (2,0) size 22x12 … … 427 375 RenderText {#text} at (8,2) size 6x12 428 376 text run at (8,2) width 6: "z" 377 layer at (332,473) size 12x14 378 RenderBlock (positioned) {mn} at (0,10) size 12x14 379 RenderText {#text} at (2,0) size 6x12 380 text run at (2,0) width 6: "9" 381 layer at (298,474) size 12x14 382 RenderBlock (positioned) {mn} at (0,14) size 12x14 383 RenderText {#text} at (2,0) size 6x12 384 text run at (2,0) width 6: "8" 385 layer at (263,475) size 12x14 386 RenderBlock (positioned) {mn} at (0,18) size 12x14 387 RenderText {#text} at (2,0) size 6x12 388 text run at (2,0) width 6: "7" 389 layer at (227,475) size 12x14 390 RenderBlock (positioned) {mn} at (0,21) size 12x14 391 RenderText {#text} at (2,0) size 6x12 392 text run at (2,0) width 6: "6" 393 layer at (191,476) size 12x14 394 RenderBlock (positioned) {mn} at (0,25) size 12x14 395 RenderText {#text} at (2,0) size 6x12 396 text run at (2,0) width 6: "5" 397 layer at (155,477) size 12x14 398 RenderBlock (positioned) {mn} at (0,29) size 12x14 399 RenderText {#text} at (2,0) size 6x12 400 text run at (2,0) width 6: "4" 401 layer at (119,478) size 12x14 402 RenderBlock (positioned) {mn} at (0,33) size 12x14 403 RenderText {#text} at (2,0) size 6x12 404 text run at (2,0) width 6: "3" -
trunk/Source/WebCore/ChangeLog
r114007 r114012 1 2012-04-12 David Barton <dbarton@mathscribe.com> 2 3 Don't modify shared style objects in RenderMathMLRoot.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=83736 5 6 Reviewed by Julien Chaffraix. 7 8 To leave room for the radical sign and absolutely positioned "index", we switch to using 9 intrinsic padding. RenderMathMLRoot.cpp is also cleaned up and prepared for merging with 10 RenderMathMLSquareRoot.cpp. The base and index are no longer wrapped in extra renderers, 11 and the child renderers are now in the same order as in the DOM. Some padding/placement 12 terms are unified and debugged. 13 14 Tested by existing tests in roots.xhtml. 15 16 * css/mathml.css: 17 (mroot): 18 (mroot > * + *): 19 (mroot > * + mrow, mroot > * + mfenced): 20 * rendering/mathml/RenderMathMLRoot.cpp: 21 (WebCore): 22 (WebCore::RenderMathMLRoot::index): 23 (WebCore::RenderMathMLRoot::paint): 24 (WebCore::RenderMathMLRoot::layout): 25 * rendering/mathml/RenderMathMLRoot.h: 26 (RenderMathMLRoot): 27 * rendering/mathml/RenderMathMLSquareRoot.cpp: 28 (WebCore): 29 (WebCore::RenderMathMLSquareRoot::paint): 30 1 31 2012-04-12 Anders Carlsson <andersca@apple.com> 2 32 -
trunk/Source/WebCore/css/mathml.css
r113749 r114012 152 152 display: inline-block; 153 153 position: relative; 154 padding-top: 0.2em;155 padding-left: 0.2em;156 154 } 157 155 158 156 mroot > * + * { 159 157 font-size: 0.75em; 160 vertical-align: bottom;161 158 position: absolute; 162 left: 0px; 159 left: 0; 160 top: 0; 163 161 padding-right: 0.4em; 164 162 padding-left: 0.2em; 165 padding-bottom: 0.2em; 166 } 167 168 mroot > * + mrow, mroot > * + mfenced { 163 padding-bottom: 0.2em; /* FIXME: change to 0.25em */ 164 } 165 166 mroot > * + mrow, mroot > * + mfenced { /* FIXME: eliminate */ 169 167 padding-bottom: 0.4em; 170 168 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
r112425 r114012 35 35 #include "PaintInfo.h" 36 36 37 using namespace std; 38 37 39 namespace WebCore { 38 40 39 41 using namespace MathMLNames; 40 42 41 // Extra space on the left for the radical sign (px) 42 const int gRadicalLeftExtra = 3; 43 // FIXME: This whole file should be changed to work with various writing modes. See https://bugs.webkit.org/show_bug.cgi?id=48951. 44 45 // Threshold above which the radical shape is modified to look nice with big bases (em) 46 const float gThresholdBaseHeightEms = 1.5f; 47 // Normal width of the front of the radical sign, before the base & overbar (em) 48 const float gFrontWidthEms = 0.75f; 49 // Gap between the base and overbar (em) 50 const float gSpaceAboveEms = 0.2f; 51 // Horizontal position of the bottom point of the radical (* frontWidth) 52 const float gRadicalBottomPointXFront = 0.5f; 43 53 // Lower the radical sign's bottom point (px) 44 54 const int gRadicalBottomPointLower = 3; 45 // Threshold above which the radical shape is modified to look nice with big bases (em)46 const float gThresholdBaseHeightEms = 1.5f;47 // Front width (em)48 const float gFrontWidthEms = 0.75f;49 // Horizontal position of the bottom point of the radical (* frontWidth)50 const float gRadicalBottomPointXFront = 0.5f;51 55 // Horizontal position of the top left point of the radical "dip" (* frontWidth) 52 56 const float gRadicalDipLeftPointXFront = 0.8f; … … 55 59 // Vertical shift of the left end point of the radical (em) 56 60 const float gRadicalLeftEndYShiftEms = 0.05f; 57 // Root padding around the base (em) (mroot padding-top/left from mathml.css)58 const float gRootPaddingEms = 0.2f;59 61 // Additional bottom root padding if baseHeight > threshold (em) 60 62 const float gBigRootBottomPaddingEms = 0.2f; … … 70 72 } 71 73 72 void RenderMathMLRoot::addChild(RenderObject* child, RenderObject* ) 74 RenderBoxModelObject* RenderMathMLRoot::index() const 73 75 { 74 if (isEmpty()) { 75 // Add a block for the index 76 RenderBlock* indexWrapper = createAlmostAnonymousBlock(INLINE_BLOCK); 77 RenderBlock::addChild(indexWrapper); 78 79 // FIXME: the wrapping does not seem to be needed anymore. 80 // this is the base, so wrap it so we can pad it 81 RenderBlock* baseWrapper = createAlmostAnonymousBlock(INLINE_BLOCK); 82 baseWrapper->style()->setPaddingLeft(Length(5 * gFrontWidthEms, Percent)); 83 RenderBlock::addChild(baseWrapper); 84 baseWrapper->addChild(child); 85 } else { 86 // always add to the index 87 firstChild()->addChild(child); 88 } 76 if (!firstChild()) 77 return 0; 78 RenderObject* index = firstChild()->nextSibling(); 79 if (!index || !index->isBoxModelObject()) 80 return 0; 81 return toRenderBoxModelObject(index); 89 82 } 90 83 91 84 void RenderMathMLRoot::paint(PaintInfo& info, const LayoutPoint& paintOffset) 92 85 { … … 96 89 return; 97 90 98 if (! firstChild() || !lastChild())91 if (!index()) 99 92 return; 100 93 101 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() );94 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + computedCSSContentBoxRect().location()); 102 95 103 RenderBoxModelObject* baseWrapper = toRenderBoxModelObject(lastChild());96 int baseHeight = roundToInt(getBoxModelObjectHeight(firstChild())); 104 97 105 int baseHeight = baseWrapper->pixelSnappedOffsetHeight(); 106 // default to the font size in pixels if we're empty 107 if (!baseHeight) 108 baseHeight = style()->fontSize(); 109 int overbarWidth = baseWrapper->pixelSnappedOffsetWidth(); 98 int overbarWidth = roundToInt(getBoxModelObjectWidth(firstChild())) + m_overbarLeftPointShift; 99 int indexWidth = index()->pixelSnappedOffsetWidth(); 100 int frontWidth = static_cast<int>(roundf(gFrontWidthEms * style()->fontSize())); 101 int startX = adjustedPaintOffset.x() + indexWidth + m_overbarLeftPointShift; 110 102 111 int indexWidth = 0; 112 RenderObject* current = firstChild(); 113 while (current != lastChild()) { 114 if (current->isBoxModelObject()) { 115 RenderBoxModelObject* box = toRenderBoxModelObject(current); 116 indexWidth += box->pixelSnappedOffsetWidth(); 117 } 118 current = current->nextSibling(); 119 } 103 int rootPad = static_cast<int>(roundf(gSpaceAboveEms * style()->fontSize())); 104 adjustedPaintOffset.setY(adjustedPaintOffset.y() + m_intrinsicPaddingBefore - rootPad); 120 105 121 int frontWidth = static_cast<int>(style()->fontSize() * gFrontWidthEms); 122 int overbarLeftPointShift = 0; 123 // Base height above which the shape of the root changes 124 int thresholdHeight = static_cast<int>(gThresholdBaseHeightEms * style()->fontSize()); 125 126 if (baseHeight > thresholdHeight && thresholdHeight) { 127 float shift = (baseHeight - thresholdHeight) / static_cast<float>(thresholdHeight); 128 if (shift > 1.) 129 shift = 1.0f; 130 overbarLeftPointShift = static_cast<int>(gRadicalBottomPointXFront * frontWidth * shift); 131 } 132 133 overbarWidth += overbarLeftPointShift; 134 135 int rootPad = static_cast<int>(gRootPaddingEms * style()->fontSize()); 136 int startX = adjustedPaintOffset.x() + indexWidth + gRadicalLeftExtra + style()->paddingLeft().value() - rootPad; 137 adjustedPaintOffset.setY(adjustedPaintOffset.y() + style()->paddingTop().value() - rootPad); 138 139 FloatPoint overbarLeftPoint(startX - overbarLeftPointShift, adjustedPaintOffset.y()); 106 FloatPoint overbarLeftPoint(startX - m_overbarLeftPointShift, adjustedPaintOffset.y()); 140 107 FloatPoint bottomPoint(startX - gRadicalBottomPointXFront * frontWidth, adjustedPaintOffset.y() + baseHeight + gRadicalBottomPointLower); 141 108 FloatPoint dipLeftPoint(startX - gRadicalDipLeftPointXFront * frontWidth, adjustedPaintOffset.y() + gRadicalDipLeftPointYPos * baseHeight); … … 191 158 RenderBlock::layout(); 192 159 193 if (! firstChild() || !lastChild())160 if (!index()) 194 161 return; 195 162 196 int baseHeight = toRenderBoxModelObject(lastChild())->pixelSnappedOffsetHeight(); 197 if (!baseHeight) 198 baseHeight = style()->fontSize(); 199 200 RenderObject* base = lastChild()->firstChild(); 201 if (base) 202 base->style()->setVerticalAlign(BASELINE); // FIXME: Can this style be modified? 163 int baseHeight = roundToInt(getBoxModelObjectHeight(firstChild())); 203 164 204 165 // Base height above which the shape of the root changes 205 int thresholdHeight = static_cast<int>(gThresholdBaseHeightEms * style()->fontSize()); 206 int overbarLeftPointShift = 0; 207 208 // FIXME: Can style() and indexBox->style() be modified (4 times below)? 166 float thresholdHeight = gThresholdBaseHeightEms * style()->fontSize(); 209 167 if (baseHeight > thresholdHeight && thresholdHeight) { 210 float shift = (baseHeight - thresholdHeight) / static_cast<float>(thresholdHeight);211 i f (shift > 1.)212 shift = 1.0f;213 int frontWidth = static_cast<int>(style()->fontSize() * gFrontWidthEms);214 overbarLeftPointShift = static_cast<int>(gRadicalBottomPointXFront * frontWidth * shift);215 216 style()->setPaddingBottom(Length(static_cast<int>(gBigRootBottomPaddingEms * style()->fontSize()), Fixed));168 float shift = min<float>((baseHeight - thresholdHeight) / thresholdHeight, 1.0f); 169 int frontWidth = static_cast<int>(roundf(gFrontWidthEms * style()->fontSize())); 170 m_overbarLeftPointShift = static_cast<int>(shift * gRadicalBottomPointXFront * frontWidth); 171 m_intrinsicPaddingAfter = static_cast<int>(roundf(gBigRootBottomPaddingEms * style()->fontSize())); 172 } else { 173 m_overbarLeftPointShift = 0; 174 m_intrinsicPaddingAfter = 0; 217 175 } 218 176 219 // Positioning of the index 220 RenderObject* possibleIndex = firstChild()->firstChild(); 221 while (possibleIndex && !possibleIndex->isBoxModelObject()) 222 possibleIndex = possibleIndex->nextSibling(); 223 RenderBoxModelObject* indexBox = toRenderBoxModelObject(possibleIndex); 224 if (!indexBox) 225 return; 177 RenderBoxModelObject* index = this->index(); 226 178 227 int shiftForIndex = indexBox->pixelSnappedOffsetWidth() + overbarLeftPointShift; 228 int partDipHeight = static_cast<int>((1 - gRadicalDipLeftPointYPos) * baseHeight); 229 int rootExtraTop = partDipHeight + style()->paddingBottom().value() + indexBox->pixelSnappedOffsetHeight() 230 - (baseHeight + static_cast<int>(gRootPaddingEms * style()->fontSize())); 179 m_intrinsicPaddingStart = index->pixelSnappedOffsetWidth() + m_overbarLeftPointShift; 231 180 232 style()->setPaddingLeft(Length(shiftForIndex, Fixed)); 233 if (rootExtraTop > 0) 234 style()->setPaddingTop(Length(rootExtraTop + static_cast<int>(gRootPaddingEms * style()->fontSize()), Fixed)); 181 int rootPad = static_cast<int>(roundf(gSpaceAboveEms * style()->fontSize())); 182 int partDipHeight = static_cast<int>(roundf((1 - gRadicalDipLeftPointYPos) * baseHeight)); 183 int rootExtraTop = partDipHeight + index->pixelSnappedOffsetHeight() - (baseHeight + rootPad); 184 m_intrinsicPaddingBefore = rootPad + max(rootExtraTop, 0); 235 185 236 setNeedsLayout(true );186 setNeedsLayout(true, MarkOnlyThis); 237 187 setPreferredLogicalWidthsDirty(true, MarkOnlyThis); // FIXME: Can this really be right? 188 // FIXME: Preferred logical widths are currently wrong the first time through, relying on layout() to set m_intrinsicPaddingStart. 238 189 RenderBlock::layout(); 190 191 // |index| should be a RenderBlock here, unless the user has overriden its { position: absolute }. 192 if (rootExtraTop < 0 && index->isBox()) 193 toRenderBox(index)->setLogicalTop(-rootExtraTop); 194 } 239 195 240 indexBox->style()->setBottom(Length(partDipHeight + style()->paddingBottom().value(), Fixed));241 242 // Now that we've potentially changed its position, we need layout the index again.243 indexBox->setNeedsLayout(true);244 indexBox->layout();245 }246 247 196 } 248 197 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
r111636 r114012 37 37 public: 38 38 RenderMathMLRoot(Element*); 39 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);40 41 virtual void paint(PaintInfo&, const LayoutPoint&);42 39 43 40 protected: 44 virtual void layout(); 41 virtual void layout() OVERRIDE; 42 43 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 45 44 46 45 private: 47 46 virtual const char* renderName() const { return "RenderMathMLRoot"; } 47 48 // This may return 0 for a non-MathML index (which won't occur in valid MathML). 49 RenderBoxModelObject* index() const; 50 51 int m_overbarLeftPointShift; 48 52 }; 49 53 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp
r113823 r114012 36 36 #include "RenderMathMLRow.h" 37 37 38 using namespace std; 39 38 40 namespace WebCore { 39 41 … … 53 55 const int gRadicalBottomPointLower = 3; 54 56 // Horizontal position of the top left point of the radical "dip" (* frontWidth) 55 const float gRadicalDipLeftPointXFront = 0. 2f;57 const float gRadicalDipLeftPointXFront = 0.8f; 56 58 // Vertical position of the top left point of the radical "dip" (* baseHeight) 57 59 const float gRadicalDipLeftPointYPos = 0.5f; … … 129 131 130 132 if (baseHeight > thresholdHeight && thresholdHeight) { 131 float shift = (baseHeight - thresholdHeight) / thresholdHeight; 132 if (shift > 1.) 133 shift = 1.0f; 134 overbarLeftPointShift = static_cast<int>(gRadicalBottomPointXFront * frontWidth * shift); 133 float shift = min<float>((baseHeight - thresholdHeight) / thresholdHeight, 1.0f); 134 overbarLeftPointShift = static_cast<int>(shift * gRadicalBottomPointXFront * frontWidth); 135 135 } 136 136 137 137 overbarWidth += overbarLeftPointShift; 138 138 139 FloatPoint overbarLeftPoint(adjustedPaintOffset.x() + frontWidth - overbarLeftPointShift, adjustedPaintOffset.y()); 140 FloatPoint bottomPoint(adjustedPaintOffset.x() + frontWidth * gRadicalBottomPointXFront, adjustedPaintOffset.y() + baseHeight + gRadicalBottomPointLower); 141 FloatPoint dipLeftPoint(adjustedPaintOffset.x() + frontWidth * gRadicalDipLeftPointXFront, adjustedPaintOffset.y() + gRadicalDipLeftPointYPos * baseHeight); 142 FloatPoint leftEnd(adjustedPaintOffset.x(), dipLeftPoint.y() + gRadicalLeftEndYShiftEms * style()->fontSize()); 139 int startX = adjustedPaintOffset.x() + frontWidth; 140 141 FloatPoint overbarLeftPoint(startX - overbarLeftPointShift, adjustedPaintOffset.y()); 142 FloatPoint bottomPoint(startX - gRadicalBottomPointXFront * frontWidth, adjustedPaintOffset.y() + baseHeight + gRadicalBottomPointLower); 143 FloatPoint dipLeftPoint(startX - gRadicalDipLeftPointXFront * frontWidth, adjustedPaintOffset.y() + gRadicalDipLeftPointYPos * baseHeight); 144 FloatPoint leftEnd(startX - frontWidth, dipLeftPoint.y() + gRadicalLeftEndYShiftEms * style()->fontSize()); 143 145 144 146 GraphicsContextStateSaver stateSaver(*info.context);
Note: See TracChangeset
for help on using the changeset viewer.