Commit 9340682a authored by jbroman@chromium.org's avatar jbroman@chromium.org

Make slider thumb painting bail out when the node is null.

The other media control painting methods do handle a null node in
toParentMediaElement (as can happen with a pseudo-element, such as
::-webkit-scrollbar). The slider thumb painting should too.

There are currently unfounded assertions that this node is not null,
but author style can make it null, so a proper check is appropriate.

A layout test has been added for this case.

BUG=412154

Review URL: https://codereview.chromium.org/556453007

git-svn-id: svn://svn.chromium.org/blink/trunk@181656 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ca3a8f80
This test ensures that applying media control slider thumb appearance to pseudo-elements does not cause a crash.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../resources/js-test.js"></script>
<script>
description("This test ensures that applying media control slider thumb appearance to pseudo-elements does not cause a crash.");
</script>
<style>
#sliderthumb, #volume-sliderthumb {
width: 100px;
height: 100px;
overflow: scroll;
}
#sliderthumb::-webkit-scrollbar {
-webkit-appearance: media-sliderthumb;
}
#volume-sliderthumb::-webkit-scrollbar {
-webkit-appearance: media-volume-sliderthumb;
}
</style>
<div id="sliderthumb"></div>
<div id="volume-sliderthumb"></div>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.displayAsyncThen(function() { testRunner.notifyDone(); });
}
</script>
...@@ -246,7 +246,9 @@ static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c ...@@ -246,7 +246,9 @@ static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c
static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
{ {
ASSERT(object->node()); if (!object->node())
return false;
HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost()); HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
if (!mediaElement) if (!mediaElement)
return false; return false;
...@@ -299,7 +301,9 @@ static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintI ...@@ -299,7 +301,9 @@ static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintI
static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
{ {
ASSERT(object->node()); if (!object->node())
return false;
HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost()); HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
if (!mediaElement) if (!mediaElement)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment