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: svn://svn.chromium.org/blink/trunk@126591 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog
index f3ebf10..39959d8 100644
--- a/third_party/WebKit/LayoutTests/ChangeLog
+++ b/third_party/WebKit/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-24 Julien Chaffraix <[email protected]>
+
+ 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 <[email protected]>
Web Inspector: Unreviewed, fix test flakiness due to the recently introduced lazy panel loading.
diff --git a/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell-expected.txt b/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell-expected.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell-expected.txt
@@ -0,0 +1 @@
+
diff --git a/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell.html b/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell.html
new file mode 100644
index 0000000..ff03dd9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/custom-scrollbar-table-cell.html
@@ -0,0 +1,50 @@
+<!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>
diff --git a/third_party/WebKit/Source/WebCore/ChangeLog b/third_party/WebKit/Source/WebCore/ChangeLog
index bc9bba2..146afd2e 100644
--- a/third_party/WebKit/Source/WebCore/ChangeLog
+++ b/third_party/WebKit/Source/WebCore/ChangeLog
@@ -1,5 +1,28 @@
2012-08-24 Julien Chaffraix <[email protected]>
+ 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 <[email protected]>
+
Remove RenderTableSection::removeChild
https://bugs.webkit.org/show_bug.cgi?id=94883
diff --git a/third_party/WebKit/Source/WebCore/rendering/RenderScrollbarPart.cpp b/third_party/WebKit/Source/WebCore/rendering/RenderScrollbarPart.cpp
index 3d93fe82..f2ca8c6 100644
--- a/third_party/WebKit/Source/WebCore/rendering/RenderScrollbarPart.cpp
+++ b/third_party/WebKit/Source/WebCore/rendering/RenderScrollbarPart.cpp
@@ -91,7 +91,9 @@
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 @@
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);