Commit 5cdaa404 authored by jchaffraix@webkit.org's avatar jchaffraix@webkit.org

Crash in RenderTableCell::borderTop() due to custom scrollbars after r124168

https://bugs.webkit.org/show_bug.cgi?id=93903

Reviewed by Tony Chang.

Source/WebCore:

r124168 changed when we create scrollbars so that it happens (rightly) at style change time.
However the RenderScrollbar code assumes that any overflow: scroll RenderScrollbar would be
created at layout time as it directly tries to layout to scrollbar parts. The big issues with
the move is that the first style change operates on a detached renderer which means that we
could crash in some situation.

Test: scrollbars/custom-scrollbar-table-cell.html

* rendering/RenderScrollbarPart.cpp:
(WebCore::RenderScrollbarPart::computeScrollbarWidth):
(WebCore::RenderScrollbarPart::computeScrollbarHeight):
Fixed the crash by using style information instead of calling the renderer. This is guaranteed
to be safe but it also means that custom scrollbars sizing is not right on table cells with
collapsing borders. The existing logic was querying layout information at style change so I
wouldn't bet on it working properly anyway.

LayoutTests:

* scrollbars/custom-scrollbar-table-cell-expected.png: Added.
* scrollbars/custom-scrollbar-table-cell-expected.txt: Added.
* scrollbars/custom-scrollbar-table-cell.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 75f68ac1
2012-08-24 Julien Chaffraix <jchaffraix@webkit.org>
Crash in RenderTableCell::borderTop() due to custom scrollbars after r124168
https://bugs.webkit.org/show_bug.cgi?id=93903
Reviewed by Tony Chang.
* scrollbars/custom-scrollbar-table-cell-expected.png: Added.
* scrollbars/custom-scrollbar-table-cell-expected.txt: Added.
* scrollbars/custom-scrollbar-table-cell.html: Added.
2012-08-24 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: Unreviewed, fix test flakiness due to the recently introduced lazy panel loading.
<!DOCTYPE html>
<html>
<head>
<style>
::-webkit-scrollbar {
width: 16px;
height: 16px;
}
::-webkit-scrollbar-track
{
background-color: #E3E3E3;
}
::-webkit-scrollbar-thumb
{
background: black;
}
.scroll-row {
display: table-row;
}
.scroll-cell {
display: table-cell;
overflow: scroll;
width: 50px;
height: 50px;
}
.overflowing {
width: 200px;
height: 200px;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText(true);
</script>
</head>
<body>
<!--
Bug 93903: Crash in RenderTableCell::borderTop() due to custom scrollbars after r124168
This test has PASSED if there are 2 grey custom scrollbars with a black thumb on each div below.
Note that currently the right scrollbar is missing due to https://bugs.webkit.org/show_bug.cgi?id=94054
-->
<div class="scroll-cell"><div class="overflowing"></div></div>
<div class="scroll-row"><div class="scroll-cell"><div class="overflowing"></div></div></div>
</body>
</html>
2012-08-24 Julien Chaffraix <jchaffraix@webkit.org>
Crash in RenderTableCell::borderTop() due to custom scrollbars after r124168
https://bugs.webkit.org/show_bug.cgi?id=93903
Reviewed by Tony Chang.
r124168 changed when we create scrollbars so that it happens (rightly) at style change time.
However the RenderScrollbar code assumes that any overflow: scroll RenderScrollbar would be
created at layout time as it directly tries to layout to scrollbar parts. The big issues with
the move is that the first style change operates on a detached renderer which means that we
could crash in some situation.
Test: scrollbars/custom-scrollbar-table-cell.html
* rendering/RenderScrollbarPart.cpp:
(WebCore::RenderScrollbarPart::computeScrollbarWidth):
(WebCore::RenderScrollbarPart::computeScrollbarHeight):
Fixed the crash by using style information instead of calling the renderer. This is guaranteed
to be safe but it also means that custom scrollbars sizing is not right on table cells with
collapsing borders. The existing logic was querying layout information at style change so I
wouldn't bet on it working properly anyway.
2012-08-24 Julien Chaffraix <jchaffraix@webkit.org>
Remove RenderTableSection::removeChild
......@@ -91,7 +91,9 @@ void RenderScrollbarPart::computeScrollbarWidth()
if (!m_scrollbar->owningRenderer())
return;
RenderView* renderView = view();
int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->borderLeft() - m_scrollbar->owningRenderer()->borderRight();
// FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
// FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style()->borderLeftWidth() - m_scrollbar->owningRenderer()->style()->borderRightWidth();
int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->width(), visibleSize, renderView);
int minWidth = calcScrollbarThicknessUsing(MinSize, style()->minWidth(), visibleSize, renderView);
int maxWidth = style()->maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style()->maxWidth(), visibleSize, renderView);
......@@ -107,7 +109,9 @@ void RenderScrollbarPart::computeScrollbarHeight()
if (!m_scrollbar->owningRenderer())
return;
RenderView* renderView = view();
int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->borderTop() - m_scrollbar->owningRenderer()->borderBottom();
// FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
// FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->style()->borderTopWidth() - m_scrollbar->owningRenderer()->style()->borderBottomWidth();
int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style()->height(), visibleSize, renderView);
int minHeight = calcScrollbarThicknessUsing(MinSize, style()->minHeight(), visibleSize, renderView);
int maxHeight = style()->maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style()->maxHeight(), visibleSize, renderView);
......
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