2010-06-06 MORITA Hajime <morrita@google.com>
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jun 2010 03:07:54 +0000 (03:07 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jun 2010 03:07:54 +0000 (03:07 +0000)
        Reviewed by Kent Tamura.

        ASSERTION FAILED with -webkit-appearance:progress-bar for non-progress bar elements
        https://bugs.webkit.org/show_bug.cgi?id=40158

        * fast/css/invalid-appearance-progress-bar-meter-expected.txt: Added.
        * fast/css/invalid-appearance-progress-bar-meter.html: Added.
        * fast/css/script-tests/invalid-appearance-progress-bar-meter.js: Added.
2010-06-06  MORITA Hajime  <morrita@google.com>

        Reviewed by Kent Tamura.

        ASSERTION FAILED with -webkit-appearance:progress-bar for non <progress> elements
        https://bugs.webkit.org/show_bug.cgi?id=40158

        paintProgressBar() and paintMeter() assumed given RenderObject is
        RenderProgress or RenderMeter respectively, but arbitrary elements
        can have -webkit-appearance: progress-bar and such elements
        violates that assumption. So this change added type check before
        downcasting the RenderObject.

        * platform/qt/RenderThemeQt.cpp:
        (WebCore::RenderThemeQt::paintProgressBar):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::paintMeter):
        * rendering/RenderThemeChromiumSkia.cpp:
        (WebCore::RenderThemeChromiumSkia::paintProgressBar):
        * rendering/RenderThemeChromiumWin.cpp:
        (WebCore::RenderThemeChromiumWin::paintProgressBar):
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::paintProgressBar):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60767 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/invalid-appearance-progress-bar-meter-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/invalid-appearance-progress-bar-meter.html [new file with mode: 0644]
LayoutTests/fast/css/script-tests/invalid-appearance-progress-bar-meter.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/qt/RenderThemeQt.cpp
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderThemeChromiumSkia.cpp
WebCore/rendering/RenderThemeChromiumWin.cpp
WebCore/rendering/RenderThemeMac.mm

index d0ef1ad..30e6fdb 100644 (file)
@@ -1,3 +1,14 @@
+2010-06-06  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Kent Tamura.
+
+        ASSERTION FAILED with -webkit-appearance:progress-bar for non-progress bar elements
+        https://bugs.webkit.org/show_bug.cgi?id=40158
+
+        * fast/css/invalid-appearance-progress-bar-meter-expected.txt: Added.
+        * fast/css/invalid-appearance-progress-bar-meter.html: Added.
+        * fast/css/script-tests/invalid-appearance-progress-bar-meter.js: Added.
+
 2010-06-06  Dirk Schulze  <krit@webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/fast/css/invalid-appearance-progress-bar-meter-expected.txt b/LayoutTests/fast/css/invalid-appearance-progress-bar-meter-expected.txt
new file mode 100644 (file)
index 0000000..b246a64
--- /dev/null
@@ -0,0 +1,9 @@
+PASS if it doesn't crash. See Bug 40158.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/invalid-appearance-progress-bar-meter.html b/LayoutTests/fast/css/invalid-appearance-progress-bar-meter.html
new file mode 100644 (file)
index 0000000..2fca5bb
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/invalid-appearance-progress-bar-meter.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css/script-tests/invalid-appearance-progress-bar-meter.js b/LayoutTests/fast/css/script-tests/invalid-appearance-progress-bar-meter.js
new file mode 100644 (file)
index 0000000..bc3f353
--- /dev/null
@@ -0,0 +1,12 @@
+description("PASS if it doesn't crash. See Bug 40158.");
+
+
+var inputForProgress = document.createElement("input");
+inputForProgress.setAttribute("style", "-webkit-appearance: progress-bar;");
+document.body.appendChild(inputForProgress);
+
+var inputForMeter = document.createElement("input");
+inputForMeter.setAttribute("style", "-webkit-appearance: meter;");
+document.body.appendChild(inputForMeter);
+
+successfullyParsed = true;
index 51899f4..0a3fe99 100644 (file)
@@ -1,3 +1,27 @@
+2010-06-06  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Kent Tamura.
+
+        ASSERTION FAILED with -webkit-appearance:progress-bar for non <progress> elements
+        https://bugs.webkit.org/show_bug.cgi?id=40158
+
+        paintProgressBar() and paintMeter() assumed given RenderObject is
+        RenderProgress or RenderMeter respectively, but arbitrary elements
+        can have -webkit-appearance: progress-bar and such elements
+        violates that assumption. So this change added type check before
+        downcasting the RenderObject.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::paintProgressBar):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paintMeter):
+        * rendering/RenderThemeChromiumSkia.cpp:
+        (WebCore::RenderThemeChromiumSkia::paintProgressBar):
+        * rendering/RenderThemeChromiumWin.cpp:
+        (WebCore::RenderThemeChromiumWin::paintProgressBar):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintProgressBar):
+
 2010-06-06  Gavin Barraclough  <barraclough@apple.com>
 
         Reviewed by NOBODY (Qt build fix pt 2).
index 76a4ad4..9319493 100644 (file)
@@ -727,6 +727,9 @@ void RenderThemeQt::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style
 
 bool RenderThemeQt::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& pi, const IntRect& r)
 {
+    if (!o->isProgress())
+        return true;
+
     StylePainter p(this, pi);
     if (!p.isValid())
        return true;
index 865a080..13dbfe1 100644 (file)
@@ -895,6 +895,9 @@ void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Elemen
 
 bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
 {
+    if (!renderObject->isMeter())
+        return true;
+
     // Some platforms do not have a native gauge widget, so we draw here a default implementation.
     RenderMeter* renderMeter = toRenderMeter(renderObject);
     RenderStyle* style = renderObject->style();
index 2c097c9..e3afd1f 100644 (file)
@@ -802,7 +802,6 @@ IntRect RenderThemeChromiumSkia::indeterminateProgressValueRectFor(RenderProgres
     return IntRect(rect.x() + (1.0 - progress) * 2 * movableWidth, rect.y(), valueWidth, rect.height());
 }
 
-
 double RenderThemeChromiumSkia::animationRepeatIntervalForProgressBar(RenderProgress*) const
 {
     return progressAnimationInterval;
@@ -821,6 +820,9 @@ bool RenderThemeChromiumSkia::paintProgressBar(RenderObject* renderObject, const
     static Image* rightBorderImage = Image::loadPlatformResource("linuxProgressBorderRight").releaseRef();
     ASSERT(barImage->height() == valueImage->height());
 
+    if (!renderObject->isProgress())
+        return true;
+
     paintInfo.context->platformContext()->setImageResamplingHint(barImage->size(), rect.size());
 
     RenderProgress* renderProgress = toRenderProgress(renderObject);
index 8bd3c2c..6dcc97b 100644 (file)
@@ -679,6 +679,9 @@ void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderSty
 
 bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
 {
+    if (!renderObject->isProgress())
+        return true;
+
     RenderProgress* renderProgress = toRenderProgress(o);
     // For indeterminate bar, valueRect is ignored and it is computed by the theme engine
     // because the animation is a platform detail and WebKit doesn't need to know how.
index f1de775..ec2ec74 100644 (file)
@@ -820,6 +820,9 @@ void RenderThemeMac::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Ele
 
 bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
 {
+    if (!renderObject->isProgress())
+        return true;
+
     RenderProgress* renderProgress = toRenderProgress(renderObject);
     HIThemeTrackDrawInfo trackInfo;
     trackInfo.version = 0;