Changeset 102589 in webkit
- Timestamp:
- Dec 12, 2011 8:44:31 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102588 r102589 1 2011-12-12 Pierre Rossi <pierre.rossi@gmail.com> 2 3 [Qt] Rendering issues with sliders and QStyle 4 https://bugs.webkit.org/show_bug.cgi?id=73921 5 6 With QStyle's origins being deeply rooted with widgets, 7 several styles make wrong assumptions, leading to sliders 8 not being painted properly in WebKit. We can solve a lot 9 of problems by systematically translating the painter to 10 the top left corner of the render object. 11 12 Reviewed by Simon Hausmann. 13 14 No new tests. The Qt tests are ran with the Windows 15 style, this fixes some quirks affecting other styles. 16 17 * platform/qt/RenderThemeQStyle.cpp: 18 (WebCore::RenderThemeQStyle::paintSliderTrack): 19 (WebCore::RenderThemeQStyle::paintSliderThumb): 20 1 21 2011-12-12 Mary Wu <mary.wu@torchmobile.com.cn> 2 22 -
trunk/Source/WebCore/platform/qt/RenderThemeQStyle.cpp
r100270 r102589 65 65 #include <QMacStyle> 66 66 #include <QPainter> 67 #ifndef QT_NO_STYLE_PLASTIQUE 67 68 #include <QPlastiqueStyle> 69 #endif 68 70 #include <QPushButton> 69 71 #include <QStyleFactory> … … 557 559 return true; 558 560 561 const QPoint topLeft = r.location(); 562 p.painter->translate(topLeft); 563 559 564 QStyleOptionSlider option; 560 565 initStyleOption(p.widget, option); … … 562 567 ControlPart appearance = initializeCommonQStyleOptions(option, o); 563 568 option.rect = r; 569 option.rect.moveTo(QPoint(0, 0)); 564 570 if (appearance == SliderVerticalPart) 565 571 option.orientation = Qt::Vertical; … … 567 573 option.state |= QStyle::State_Sunken; 568 574 575 // some styles need this to show a highlight on one side of the groove 576 HTMLInputElement* slider = o->node()->toInputElement(); 577 if (slider) { 578 option.upsideDown = (appearance == SliderHorizontalPart) && !o->style()->isLeftToRightDirection(); 579 // Use the width as a multiplier in case the slider values are <= 1 580 const int width = r.width() > 0 ? r.width() : 100; 581 option.maximum = slider->maximum() * width; 582 option.minimum = slider->minimum() * width; 583 if (!option.upsideDown) 584 option.sliderPosition = slider->valueAsNumber() * width; 585 else 586 option.sliderPosition = option.minimum + option.maximum - slider->valueAsNumber() * width; 587 } 588 569 589 p.drawComplexControl(QStyle::CC_Slider, option); 570 590 … … 574 594 p.drawPrimitive(QStyle::PE_FrameFocusRect, focusOption); 575 595 } 576 596 p.painter->translate(-topLeft); 577 597 return false; 578 598 } … … 589 609 if (!p.isValid()) 590 610 return true; 611 612 const QPoint topLeft = r.location(); 613 p.painter->translate(topLeft); 591 614 592 615 QStyleOptionSlider option; … … 595 618 ControlPart appearance = initializeCommonQStyleOptions(option, o); 596 619 option.rect = r; 620 option.rect.moveTo(QPoint(0, 0)); 597 621 if (appearance == SliderThumbVerticalPart) 598 622 option.orientation = Qt::Vertical; … … 603 627 604 628 p.drawComplexControl(QStyle::CC_Slider, option); 605 629 p.painter->translate(-topLeft); 606 630 return false; 607 631 }
Note: See TracChangeset
for help on using the changeset viewer.