Crash in RenderTableCell::borderTop() due to custom scrollbars after r124168
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 16:39:43 +0000 (16:39 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 16:39:43 +0000 (16:39 +0000)
commit5cdaa404522ef858d325902ec4768b5bd4332572
treeb8b424c90a1d1c62120fadc190cdfcdc7e68347a
parent75f68ac1afea26008bb3146d44d0c69f1295e22e
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
LayoutTests/ChangeLog
LayoutTests/scrollbars/custom-scrollbar-table-cell-expected.png [new file with mode: 0644]
LayoutTests/scrollbars/custom-scrollbar-table-cell-expected.txt [new file with mode: 0644]
LayoutTests/scrollbars/custom-scrollbar-table-cell.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderScrollbarPart.cpp