Changeset 141542 in webkit
- Timestamp:
- Jan 31, 2013 11:26:02 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r141532 r141542 1 2013-01-31 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [Qt] Add support for text decoration "wavy" style 4 https://bugs.webkit.org/show_bug.cgi?id=93507 5 6 Reviewed by Simon Hausmann. 7 8 Add pixel-test expected results for CSS3 text decoration tests for Qt port. 9 10 * platform/qt-5.0-wk1/fast/css3-text/css3-text-decoration/repaint/repaint-text-decoration-style-expected.png: Added. 11 * platform/qt-5.0-wk1/fast/css3-text/css3-text-decoration/text-decoration-style-expected.png: Added. 12 1 13 2013-01-31 Hajime Morrita <morrita@google.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r141541 r141542 1 2013-01-31 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [Qt] Add support for text decoration "wavy" style 4 https://bugs.webkit.org/show_bug.cgi?id=93507 5 6 Reviewed by Simon Hausmann. 7 8 Add support for text decoration "wavy" style for Qt platform. 9 10 * platform/graphics/qt/GraphicsContextQt.cpp: 11 (WebCore::toQPenStyle): 12 Remove FIXME comments obsoleted by this patch. 13 (WebCore::GraphicsContext::drawLine): 14 Implement wavy style line tracer. 15 1 16 2013-01-31 Nils Barth <nbarth@google.com> 2 17 -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r141413 r141542 161 161 #if ENABLE(CSS3_TEXT) 162 162 case DoubleStroke: 163 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support.163 case WavyStroke: 164 164 #endif 165 165 return Qt::SolidLine; … … 411 411 #if ENABLE(CSS3_TEXT) 412 412 case DoubleStroke: 413 case WavyStroke: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=93507 - Needs platform support.413 case WavyStroke: 414 414 #endif 415 415 break; … … 475 475 } 476 476 477 #if ENABLE(CSS3_TEXT) 478 if (style == WavyStroke) { 479 const float step = 2 * width; // Make wave height equal to two times strokeThickness(). 480 const float flat = width; // Set size of flat lines between diagonal lines. 481 short signal = -1; 482 QPainterPath path; 483 float x1, y1, x2, y2; 484 485 if (isVerticalLine) { 486 x1 = x2 = p1.x(); 487 488 // Make sure (x1, y1) < (x2, y2) 489 if (p1.y() < p2.y()) { 490 y1 = p1.y(); 491 y2 = p2.y(); 492 } else { 493 y1 = p2.y(); 494 y2 = p1.y(); 495 } 496 497 // Qt interprets geometric units as end-point inclusive, while WebCore interprets geometric units as endpoint exclusive. 498 // This means we need to subtract one from the endpoint, or the line will be painted one pixel too long. 499 y2 -= 1; 500 path.moveTo(x1 + signal * step, y1); 501 float y = y1 + 2 * step; 502 503 while (y <= y2) { 504 signal = -signal; 505 path.lineTo(x1 + signal * step, y); 506 path.lineTo(x1 + signal * step, y + flat); // Draw flat line between diagonal lines. 507 y += 2 * step + flat; 508 } 509 } else { 510 y1 = y2 = p1.y(); 511 512 // Make sure (x1, y1) < (x2, y2) 513 if (p1.x() < p2.x()) { 514 x1 = p1.x(); 515 x2 = p2.x(); 516 } else { 517 x1 = p2.x(); 518 x2 = p1.x(); 519 } 520 521 // Qt interprets geometric units as end-point inclusive, while WebCore interprets geometric units as endpoint exclusive. 522 // This means we need to subtract one from the endpoint, or the line will be painted one pixel too long. 523 x2 -= 1; 524 path.moveTo(x1, y1 + signal * step); 525 float x = x1 + 2 * step; 526 527 while (x <= x2) { 528 signal = -signal; 529 path.lineTo(x, y1 + signal * step); 530 path.lineTo(x + flat, y1 + signal * step); // Draw flat line between diagonal lines. 531 x += 2 * step + flat; 532 } 533 } 534 535 // The last point created by the while loops above may not be the end 536 // point, so complete the wave by connecting the end point. 537 path.lineTo(x2, y2); 538 QPen pen = p->pen(); 539 pen.setJoinStyle(Qt::BevelJoin); // A bevelled line join is more suitable for wavy than miter or round. 540 pen.setWidth(width); 541 const bool oldAntiAliasing = p->testRenderHint(QPainter::Antialiasing); 542 p->setRenderHint(QPainter::Antialiasing, true); // AntiAliasing is needed for diagonal lines of wavy stroke 543 p->strokePath(path, pen); 544 p->setRenderHint(QPainter::Antialiasing, oldAntiAliasing); 545 } else { 546 #endif // CSS3_TEXT 477 547 // Qt interprets geometric units as end-point inclusive, while WebCore interprets geomtric units as endpoint exclusive. 478 548 // This means we need to subtract one from the endpoint, or the line will be painted one pixel too long. … … 481 551 else 482 552 p->drawLine(p1, p2 - FloatSize(1, 0)); 553 #if ENABLE(CSS3_TEXT) 554 } 555 #endif // CSS3_TEXT 483 556 484 557 if (patWidth)
Note: See TracChangeset
for help on using the changeset viewer.