Changeset 52904 in webkit
- Timestamp:
- Jan 7, 2010 12:06:01 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52902 r52904 1 2010-01-06 MORITA Hajime <morrita@gmail.com> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVG background color on selected text goes wrong when text has 6 gradient stroke. 7 https://bugs.webkit.org/show_bug.cgi?id=33069 8 9 Introduced SVGTextPaintSubphase like as PaintPhase on html painting, 10 and paint background and foreground in separate subphase. 11 12 * svg/text/selection-background-color.xhtml: Added. 13 * platform/mac/svg/text/selection-background-color-expected.checksum: Added. 14 * platform/mac/svg/text/selection-background-color-expected.png: Added. 15 * platform/mac/svg/text/selection-background-color-expected.txt: Added. 16 17 * platform/mac/svg/W3C-SVG-1.1/text-text-03-b-expected.checksum: 18 * platform/mac/svg/W3C-SVG-1.1/text-text-03-b-expected.png: 19 * platform/mac/svg/batik/text/textDecoration2-expected.checksum: 20 * platform/mac/svg/batik/text/textDecoration2-expected.png: 21 * platform/mac/svg/text/text-deco-01-b-expected.checksum: 22 * platform/mac/svg/text/text-deco-01-b-expected.png: 23 * platform/mac/svg/text/text-spacing-01-b-expected.checksum: 24 * platform/mac/svg/text/text-spacing-01-b-expected.png: 25 * platform/mac/svg/text/text-text-03-b-expected.checksum: 26 * platform/mac/svg/text/text-text-03-b-expected.png: 27 * platform/mac/svg/text/text-text-08-b-expected.checksum: 28 * platform/mac/svg/text/text-text-08-b-expected.png: 29 Re-baselined due to painting algorithm change. 30 1 31 2010-01-06 Kinuko Yasuda <kinuko@chromium.org> 2 32 -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-03-b-expected.checksum
r44224 r52904 1 ed64b2908c6fd5df02a15fad56f67f34 1 79668d80dfb1484b12447c78a0c9a53a -
trunk/LayoutTests/platform/mac/svg/batik/text/textDecoration2-expected.checksum
r44224 r52904 1 1f13a12e4ab2a348b2614a3c70d0546d 1 593fd59c2f58e622f04fb9c00d7714b3 -
trunk/LayoutTests/platform/mac/svg/text/text-deco-01-b-expected.checksum
r38121 r52904 1 a46864e6b6d1cea350560ea244072f85 1 97154819a65cda5e8b6257183b7a90e1 -
trunk/LayoutTests/platform/mac/svg/text/text-spacing-01-b-expected.checksum
r38121 r52904 1 ace025910b4ff42dd0bee9701efc4b63 1 c1e3a98345d7a6b13e2928da86fbc55f -
trunk/LayoutTests/platform/mac/svg/text/text-text-03-b-expected.checksum
r38121 r52904 1 31029bbce66db9348cd8953d473f7b30 1 dc67e8cf3194af25f470c49b7e9b600a -
trunk/LayoutTests/platform/mac/svg/text/text-text-08-b-expected.checksum
r38540 r52904 1 9265c96312cfa4f95c85dd52edf268b5 1 a48969c2ed5c0596624855a08b116447 -
trunk/WebCore/ChangeLog
r52902 r52904 1 2010-01-06 MORITA Hajime <morrita@gmail.com> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVG background color on selected text goes wrong when text has 6 gradient stroke. 7 https://bugs.webkit.org/show_bug.cgi?id=33069 8 9 Introduced SVGTextPaintSubphase like as PaintPhase on html painting, 10 and paint background and foreground in separate subphase. 11 12 Test: svg/text/selection-background-color.xhtml 13 14 * rendering/SVGCharacterLayoutInfo.h: 15 (WebCore::SVGTextChunkWalker::SVGTextChunkWalker): 16 Added m_setupBackgroundCallback, m_setupForegroundCallback 17 (WebCore::SVGTextChunkWalker::setupBackground): 18 (WebCore::SVGTextChunkWalker::setupForeground): 19 Added. 20 * rendering/SVGInlineTextBox.cpp: 21 (WebCore::SVGInlineTextBox::paintCharacters): 22 pass SVGTextPaintInfo instead of SVGPaintServer 23 * rendering/SVGInlineTextBox.h: 24 (WebCore::SVGTextPaintSubphase): 25 (WebCore::SVGTextPaintInfo::SVGTextPaintInfo): 26 Added. 27 * rendering/SVGRootInlineBox.cpp: 28 (WebCore::SVGRootInlineBox::walkTextChunks): 29 Invoke setupBackground() and setupForeground() 30 (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupBackgroundCallback): 31 (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupForegroundCallback): 32 (WebCore::SVGRootInlineBoxPaintWalker::activePaintServer): 33 Added. 34 (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupFillCallback): 35 (WebCore::SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback): 36 (WebCore::SVGRootInlineBoxPaintWalker::chunkPortionCallback): 37 (WebCore::SVGRootInlineBox::paint): 38 1 39 2010-01-06 Kinuko Yasuda <kinuko@chromium.org> 2 40 -
trunk/WebCore/rendering/SVGCharacterLayoutInfo.h
r45624 r52904 299 299 virtual void end(InlineBox*) = 0; 300 300 301 virtual bool setupBackground(InlineBox*) = 0; 301 302 virtual bool setupFill(InlineBox*) = 0; 302 303 virtual bool setupStroke(InlineBox*) = 0; 304 virtual bool setupForeground(InlineBox*) = 0; 303 305 }; 304 306 … … 316 318 typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box); 317 319 320 typedef bool (CallbackClass::*SVGTextChunkSetupBackgroundCallback)(InlineBox* box); 318 321 typedef bool (CallbackClass::*SVGTextChunkSetupFillCallback)(InlineBox* box); 319 322 typedef bool (CallbackClass::*SVGTextChunkSetupStrokeCallback)(InlineBox* box); 323 typedef bool (CallbackClass::*SVGTextChunkSetupForegroundCallback)(InlineBox* box); 320 324 321 325 SVGTextChunkWalker(CallbackClass* object, … … 323 327 SVGTextChunkStartCallback start = 0, 324 328 SVGTextChunkEndCallback end = 0, 329 SVGTextChunkSetupBackgroundCallback background = 0, 325 330 SVGTextChunkSetupFillCallback fill = 0, 326 SVGTextChunkSetupStrokeCallback stroke = 0) 331 SVGTextChunkSetupStrokeCallback stroke = 0, 332 SVGTextChunkSetupForegroundCallback foreground = 0) 327 333 : m_object(object) 328 334 , m_walkerCallback(walker) 329 335 , m_startCallback(start) 330 336 , m_endCallback(end) 337 , m_setupBackgroundCallback(background) 331 338 , m_setupFillCallback(fill) 332 339 , m_setupStrokeCallback(stroke) 340 , m_setupForegroundCallback(foreground) 333 341 { 334 342 ASSERT(object); … … 359 367 } 360 368 369 virtual bool setupBackground(InlineBox* box) 370 { 371 if (m_setupBackgroundCallback) 372 return (*m_object.*m_setupBackgroundCallback)(box); 373 374 ASSERT_NOT_REACHED(); 375 return false; 376 } 377 361 378 virtual bool setupFill(InlineBox* box) 362 379 { … … 372 389 if (m_setupStrokeCallback) 373 390 return (*m_object.*m_setupStrokeCallback)(box); 391 392 ASSERT_NOT_REACHED(); 393 return false; 394 } 395 396 virtual bool setupForeground(InlineBox* box) 397 { 398 if (m_setupForegroundCallback) 399 return (*m_object.*m_setupForegroundCallback)(box); 374 400 375 401 ASSERT_NOT_REACHED(); … … 382 408 SVGTextChunkStartCallback m_startCallback; 383 409 SVGTextChunkEndCallback m_endCallback; 410 SVGTextChunkSetupBackgroundCallback m_setupBackgroundCallback; 384 411 SVGTextChunkSetupFillCallback m_setupFillCallback; 385 412 SVGTextChunkSetupStrokeCallback m_setupStrokeCallback; 413 SVGTextChunkSetupForegroundCallback m_setupForegroundCallback; 386 414 }; 387 415 -
trunk/WebCore/rendering/SVGInlineTextBox.cpp
r50852 r52904 325 325 } 326 326 327 void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int tx, int ty, const SVGChar& svgChar, const UChar* chars, int length, SVG PaintServer* activePaintServer)327 void SVGInlineTextBox::paintCharacters(RenderObject::PaintInfo& paintInfo, int tx, int ty, const SVGChar& svgChar, const UChar* chars, int length, SVGTextPaintInfo& textPaintInfo) 328 328 { 329 329 if (renderer()->style()->visibility() != VISIBLE || paintInfo.phase == PaintPhaseOutline) … … 357 357 // 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection 358 358 // and marked text. 359 if (paintInfo.phase != PaintPhaseSelection && !isPrinting ) {359 if (paintInfo.phase != PaintPhaseSelection && !isPrinting && textPaintInfo.subphase == SVGTextPaintSubphaseBackground) { 360 360 #if PLATFORM(MAC) 361 361 // Custom highlighters go behind everything else. … … 377 377 } 378 378 379 // Set a text shadow if we have one. 380 // FIXME: Support multiple shadow effects. Need more from the CG API before 381 // we can do this. 382 bool setShadow = false; 383 if (styleToUse->textShadow()) { 384 paintInfo.context->setShadow(IntSize(styleToUse->textShadow()->x, styleToUse->textShadow()->y), 385 styleToUse->textShadow()->blur, styleToUse->textShadow()->color, 386 styleToUse->colorSpace()); 387 setShadow = true; 388 } 389 390 IntPoint origin((int) svgChar.x, (int) svgChar.y); 391 TextRun run = svgTextRunForInlineTextBox(chars, length, styleToUse, this, svgChar.x); 379 if (textPaintInfo.subphase == SVGTextPaintSubphaseGlyphFill || textPaintInfo.subphase == SVGTextPaintSubphaseGlyphStroke) { 380 // Set a text shadow if we have one. 381 // FIXME: Support multiple shadow effects. Need more from the CG API before 382 // we can do this. 383 bool setShadow = false; 384 if (styleToUse->textShadow()) { 385 paintInfo.context->setShadow(IntSize(styleToUse->textShadow()->x, styleToUse->textShadow()->y), 386 styleToUse->textShadow()->blur, styleToUse->textShadow()->color, 387 styleToUse->colorSpace()); 388 setShadow = true; 389 } 390 391 IntPoint origin((int) svgChar.x, (int) svgChar.y); 392 TextRun run = svgTextRunForInlineTextBox(chars, length, styleToUse, this, svgChar.x); 392 393 393 394 #if ENABLE(SVG_FONTS) 394 // SVG Fonts need access to the paint server used to draw the current text chunk. 395 // They need to be able to call renderPath() on a SVGPaintServer object. 396 run.setActivePaintServer(activePaintServer); 395 // SVG Fonts need access to the paint server used to draw the current text chunk. 396 // They need to be able to call renderPath() on a SVGPaintServer object. 397 ASSERT(textPaintInfo.activePaintServer); 398 run.setActivePaintServer(textPaintInfo.activePaintServer); 397 399 #endif 398 400 399 paintInfo.context->drawText(font, run, origin); 400 401 if (paintInfo.phase != PaintPhaseSelection) { 401 paintInfo.context->drawText(font, run, origin); 402 403 if (setShadow) 404 paintInfo.context->clearShadow(); 405 } 406 407 if (paintInfo.phase != PaintPhaseSelection && textPaintInfo.subphase == SVGTextPaintSubphaseForeground) { 402 408 paintDocumentMarkers(paintInfo.context, tx, ty, styleToUse, font, false); 403 409 … … 429 435 } 430 436 431 if (setShadow)432 paintInfo.context->clearShadow();433 434 437 if (!ctm.isIdentity()) 435 438 paintInfo.context->concatCTM(ctm.inverse()); -
trunk/WebCore/rendering/SVGInlineTextBox.h
r50583 r52904 33 33 struct SVGTextDecorationInfo; 34 34 35 enum SVGTextPaintSubphase { 36 SVGTextPaintSubphaseBackground, 37 SVGTextPaintSubphaseGlyphFill, 38 SVGTextPaintSubphaseGlyphStroke, 39 SVGTextPaintSubphaseForeground 40 }; 41 42 struct SVGTextPaintInfo { 43 SVGTextPaintInfo() : activePaintServer(0), subphase(SVGTextPaintSubphaseBackground) {} 44 45 SVGPaintServer* activePaintServer; 46 SVGTextPaintSubphase subphase; 47 }; 48 35 49 class SVGInlineTextBox : public InlineTextBox { 36 50 public: … … 50 64 51 65 // SVGs custom paint text method 52 void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVG PaintServer*);66 void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGTextPaintInfo&); 53 67 54 68 // SVGs custom paint selection method -
trunk/WebCore/rendering/SVGRootInlineBox.cpp
r52584 r52904 430 430 } 431 431 432 bool chunkSetupBackgroundCallback(InlineBox* /*box*/) 433 { 434 m_textPaintInfo.subphase = SVGTextPaintSubphaseBackground; 435 return true; 436 } 437 432 438 bool chunkSetupFillCallback(InlineBox* box) 433 439 { … … 441 447 teardownFillPaintServer(); 442 448 449 m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphFill; 443 450 m_fillPaintServer = SVGPaintServer::fillPaintServer(object->style(), object); 444 451 if (m_fillPaintServer) { … … 463 470 teardownStrokePaintServer(); 464 471 472 m_textPaintInfo.subphase = SVGTextPaintSubphaseGlyphStroke; 465 473 m_strokePaintServer = SVGPaintServer::strokePaintServer(object->style(), object); 466 474 … … 472 480 473 481 return false; 482 } 483 484 bool chunkSetupForegroundCallback(InlineBox* /*box*/) 485 { 486 teardownFillPaintServer(); 487 teardownStrokePaintServer(); 488 489 m_textPaintInfo.subphase = SVGTextPaintSubphaseForeground; 490 491 return true; 492 } 493 494 SVGPaintServer* activePaintServer() const 495 { 496 switch (m_textPaintInfo.subphase) { 497 case SVGTextPaintSubphaseGlyphFill: 498 ASSERT(m_fillPaintServer); 499 return m_fillPaintServer; 500 case SVGTextPaintSubphaseGlyphStroke: 501 ASSERT(m_strokePaintServer); 502 return m_strokePaintServer; 503 case SVGTextPaintSubphaseBackground: 504 case SVGTextPaintSubphaseForeground: 505 default: 506 return 0; 507 } 474 508 } 475 509 … … 524 558 525 559 // Paint text 526 SVGPaintServer* activePaintServer = m_fillPaintServer; 527 if (!activePaintServer) 528 activePaintServer = m_strokePaintServer; 529 530 ASSERT(activePaintServer); 531 textBox->paintCharacters(m_paintInfo, m_tx, m_ty, *it, stringStart, stringLength, activePaintServer); 560 m_textPaintInfo.activePaintServer = activePaintServer(); 561 textBox->paintCharacters(m_paintInfo, m_tx, m_ty, *it, stringStart, stringLength, m_textPaintInfo); 532 562 533 563 // Paint decorations, that have to be drawn afterwards … … 562 592 int m_tx; 563 593 int m_ty; 594 595 SVGTextPaintInfo m_textPaintInfo; 564 596 }; 565 597 … … 583 615 &SVGRootInlineBoxPaintWalker::chunkStartCallback, 584 616 &SVGRootInlineBoxPaintWalker::chunkEndCallback, 617 &SVGRootInlineBoxPaintWalker::chunkSetupBackgroundCallback, 585 618 &SVGRootInlineBoxPaintWalker::chunkSetupFillCallback, 586 &SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback); 619 &SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback, 620 &SVGRootInlineBoxPaintWalker::chunkSetupForegroundCallback); 587 621 588 622 walkTextChunks(&walker); … … 1681 1715 (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); 1682 1716 else { 1717 if (walker->setupBackground(range.box)) 1718 (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); 1719 1683 1720 if (walker->setupFill(range.box)) 1684 1721 (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); … … 1686 1723 if (walker->setupStroke(range.box)) 1687 1724 (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); 1725 1726 if (walker->setupForeground(range.box)) 1727 (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd); 1728 1688 1729 } 1689 1730
Note: See TracChangeset
for help on using the changeset viewer.