- Revision
- 93702
- Author
- commit-qu...@webkit.org
- Date
- 2011-08-24 03:51:22 -0700 (Wed, 24 Aug 2011)
Log Message
Source/WebCore: Paint SliderTrack and SliderThumb independently.
https://bugs.webkit.org/show_bug.cgi?id=50453
Also fixes https://bugs.webkit.org/show_bug.cgi?id=65456 crash.
Patch by Tatiana Meshkova <tatiana.meshk...@nokia.com> on 2011-08-24
Reviewed by Kenneth Rohde Christiansen.
RenderSlider works only with <input type=range>. Nowadays RenderTheme
supports painting of SliderTrack and SliderThumb without range input.
In order to be in sync with other platforms this patch gets rid of
upcasting in RenderThemeQt::paintSliderTrack and allows to paint
SliderTrack and SliderThumb independently.
Test: platform/qt/fast/forms/range/slider-crash.html
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::paintSliderTrack): Draw SC_SliderGroove.
Allow paintSliderThumb() to care about SC_SliderHandle. We don't need
to setup value and position anymore, since handle is drawn separately.
Draw focus explicitly, since QStyleOptionSlider doesn't allow to focus
on CC_Slider without handle subcontrol.
(WebCore::RenderThemeQt::paintSliderThumb): Draw SC_SliderHandle.
LayoutTests: Pixel crash test for RenderThemeQt::paintSliderTrack.
https://bugs.webkit.org/show_bug.cgi?id=50453
Patch by Tatiana Meshkova <tatiana.meshk...@nokia.com> on 2011-08-24
Reviewed by Kenneth Rohde Christiansen.
Support -webkit-appearance: slider-horizontal/vertical
painting without range input.
* platform/qt/fast/forms/range/slider-crash-expected.png: Added.
* platform/qt/fast/forms/range/slider-crash-expected.txt: Added.
* platform/qt/fast/forms/range/slider-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (93701 => 93702)
--- trunk/LayoutTests/ChangeLog 2011-08-24 10:18:59 UTC (rev 93701)
+++ trunk/LayoutTests/ChangeLog 2011-08-24 10:51:22 UTC (rev 93702)
@@ -1,3 +1,17 @@
+2011-08-24 Tatiana Meshkova <tatiana.meshk...@nokia.com>
+
+ Pixel crash test for RenderThemeQt::paintSliderTrack.
+ https://bugs.webkit.org/show_bug.cgi?id=50453
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Support -webkit-appearance: slider-horizontal/vertical
+ painting without range input.
+
+ * platform/qt/fast/forms/range/slider-crash-expected.png: Added.
+ * platform/qt/fast/forms/range/slider-crash-expected.txt: Added.
+ * platform/qt/fast/forms/range/slider-crash.html: Added.
+
2011-08-24 Pavel Podivilov <podivi...@chromium.org>
Unreviewed, fix chromium expectations for fast/preloader/script.html.
Added: trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.png (0 => 93702)
--- trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.png (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.png 2011-08-24 10:51:22 UTC (rev 93702)
@@ -0,0 +1,4 @@
+\x89PNG
+
+
+IHDR X \x9Av\x82p sBIT|d\x88 pHYs \xC4 \xC4\x95+ )tEXtchecksum cd866c100b5491ec4ff8335607d5bb4a\xA2\xB1\xEA \x92IDATx\x9C\xED\xDD1\x830A\x88rQN7\xFD\xE9ғb-\x94\x99\xCA\xE5묕\x91\xD8gf6 \x80\xC0k\xF5 \xE0 #@ \x80\x8C 2 \xC8 #@ \x80\xCC{\xF5 \x9E\xE58\x8E\xEF\xF9<υK x"\xC0m\xD7um\xFEc\xC0/|\x82 d \x90 @F\x80 d \x90 @F\x80 d \x90 @F\x80 p\xDB̬\x9E \xC0C\xED\xE3 "^@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \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 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\x8C 2 \xC8 #@ \x80\xCCr&\x85%#W1 IEND\xAEB`\x82
\ No newline at end of file
Added: trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.txt (0 => 93702)
--- trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash-expected.txt 2011-08-24 10:51:22 UTC (rev 93702)
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock {P} at (0,0) size 784x15
Added: trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash.html (0 => 93702)
--- trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash.html (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/forms/range/slider-crash.html 2011-08-24 10:51:22 UTC (rev 93702)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p style="-webkit-appearance: slider-vertical; height: 15px"></p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (93701 => 93702)
--- trunk/Source/WebCore/ChangeLog 2011-08-24 10:18:59 UTC (rev 93701)
+++ trunk/Source/WebCore/ChangeLog 2011-08-24 10:51:22 UTC (rev 93702)
@@ -1,3 +1,27 @@
+2011-08-24 Tatiana Meshkova <tatiana.meshk...@nokia.com>
+
+ Paint SliderTrack and SliderThumb independently.
+ https://bugs.webkit.org/show_bug.cgi?id=50453
+ Also fixes https://bugs.webkit.org/show_bug.cgi?id=65456 crash.
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ RenderSlider works only with <input type=range>. Nowadays RenderTheme
+ supports painting of SliderTrack and SliderThumb without range input.
+ In order to be in sync with other platforms this patch gets rid of
+ upcasting in RenderThemeQt::paintSliderTrack and allows to paint
+ SliderTrack and SliderThumb independently.
+
+ Test: platform/qt/fast/forms/range/slider-crash.html
+
+ * platform/qt/RenderThemeQt.cpp:
+ (WebCore::RenderThemeQt::paintSliderTrack): Draw SC_SliderGroove.
+ Allow paintSliderThumb() to care about SC_SliderHandle. We don't need
+ to setup value and position anymore, since handle is drawn separately.
+ Draw focus explicitly, since QStyleOptionSlider doesn't allow to focus
+ on CC_Slider without handle subcontrol.
+ (WebCore::RenderThemeQt::paintSliderThumb): Draw SC_SliderHandle.
+
2011-08-23 Pavel Feldman <pfeld...@google.com>
Web Inspector: annotate and prepare for compilation first 14 _javascript_ files within 4 modules.
Modified: trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp (93701 => 93702)
--- trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp 2011-08-24 10:18:59 UTC (rev 93701)
+++ trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp 2011-08-24 10:51:22 UTC (rev 93702)
@@ -910,48 +910,26 @@
{
StylePainter p(this, pi);
if (!p.isValid())
- return true;
+ return true;
QStyleOptionSlider option;
initStyleOption(p.widget, option);
- option.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
+ option.subControls = QStyle::SC_SliderGroove;
ControlPart appearance = initializeCommonQStyleOptions(option, o);
-
- RenderSlider* renderSlider = toRenderSlider(o);
- HTMLInputElement* input = renderSlider->node()->toInputElement();
- IntRect thumbRect = sliderThumbElementOf(input)->getRect();
-
option.rect = r;
-
- int value;
- if (appearance == SliderVerticalPart) {
- option.maximum = r.height() - thumbRect.height();
- value = thumbRect.y() - r.y();
- } else {
- option.maximum = r.width() - thumbRect.width();
- value = thumbRect.x() - r.x();
- }
-
- value = QStyle::sliderValueFromPosition(0, option.maximum, value, option.maximum);
-
- option.sliderValue = value;
- option.sliderPosition = value;
if (appearance == SliderVerticalPart)
option.orientation = Qt::Vertical;
-
- if (renderSlider->inDragMode()) {
- option.activeSubControls = QStyle::SC_SliderHandle;
+ if (isPressed(o))
option.state |= QStyle::State_Sunken;
- }
- const QPoint topLeft = r.location();
- p.painter->translate(topLeft);
- option.rect.moveTo(QPoint(0, 0));
- option.rect.setSize(r.size());
-
p.drawComplexControl(QStyle::CC_Slider, option);
- p.painter->translate(-topLeft);
+ if (option.state & QStyle::State_HasFocus) {
+ QStyleOptionFocusRect focusOption;
+ focusOption.rect = r;
+ p.drawPrimitive(QStyle::PE_FrameFocusRect, focusOption);
+ }
+
return false;
}
@@ -963,7 +941,24 @@
bool RenderThemeQt::paintSliderThumb(RenderObject* o, const PaintInfo& pi,
const IntRect& r)
{
- // We've already painted it in paintSliderTrack(), no need to do anything here.
+ StylePainter p(this, pi);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionSlider option;
+ initStyleOption(p.widget, option);
+ option.subControls = QStyle::SC_SliderHandle;
+ ControlPart appearance = initializeCommonQStyleOptions(option, o);
+ option.rect = r;
+ if (appearance == SliderThumbVerticalPart)
+ option.orientation = Qt::Vertical;
+ if (isPressed(o)) {
+ option.activeSubControls = QStyle::SC_SliderHandle;
+ option.state |= QStyle::State_Sunken;
+ }
+
+ p.drawComplexControl(QStyle::CC_Slider, option);
+
return false;
}