Diff
Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (105186 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-17 20:57:23 UTC (rev 105186)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-17 21:04:21 UTC (rev 105187)
@@ -1,5 +1,30 @@
2012-01-17 Mark Rowe <[email protected]>
+ Merge r94107.
+
+ 2011-08-30 Abhishek Arya <[email protected]>
+
+ Removed m_owner accessed in custom scrollbars.
+ https://bugs.webkit.org/show_bug.cgi?id=64737
+
+ Reviewed by David Hyatt.
+
+ Problem does not reproduce in DRT, even with Eventhandler tricks
+ and gc(). So, adding a manual test.
+
+ * manual-tests/custom-scrollbar-renderer-removed-crash.html: Added.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::clearOwningRendererForCustomScrollbars):
+ * page/FrameView.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::willBeDestroyed): when this renderbox is getting
+ destroyed, clear the custom scrollbar in this frameview having this renderbox
+ as its owning renderer.
+ * rendering/RenderScrollbar.cpp:
+ (WebCore::RenderScrollbar::getScrollbarPseudoStyle): fix the null check.
+
+2012-01-17 Mark Rowe <[email protected]>
+
Merge r100408.
2011-11-15 Darin Adler <[email protected]>
Added: branches/safari-534.54-branch/Source/WebCore/manual-tests/custom-scrollbar-renderer-removed-crash.html (0 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/manual-tests/custom-scrollbar-renderer-removed-crash.html (rev 0)
+++ branches/safari-534.54-branch/Source/WebCore/manual-tests/custom-scrollbar-renderer-removed-crash.html 2012-01-17 21:04:21 UTC (rev 105187)
@@ -0,0 +1,11 @@
+<html>
+<body>
+Reload page and mouse click quickly in the black box.
+<style>
+::-webkit-scrollbar { width: 1000; }
+</style>
+<script>setTimeout("try { document.body.offsetTop; child = document.body; child.parentNode.removeChild(child); } catch(e) {}", 100);</script>
+<svg>
+</svg>
+</body>
+</html>
Modified: branches/safari-534.54-branch/Source/WebCore/page/FrameView.cpp (105186 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/page/FrameView.cpp 2012-01-17 20:57:23 UTC (rev 105186)
+++ branches/safari-534.54-branch/Source/WebCore/page/FrameView.cpp 2012-01-17 21:04:21 UTC (rev 105187)
@@ -2429,6 +2429,23 @@
return false;
}
+void FrameView::clearOwningRendererForCustomScrollbars(RenderBox* box)
+{
+ const HashSet<RefPtr<Widget> >* viewChildren = children();
+ HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end();
+ for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
+ Widget* widget = current->get();
+ if (widget->isScrollbar()) {
+ Scrollbar* scrollbar = static_cast<Scrollbar*>(widget);
+ if (scrollbar->isCustomScrollbar()) {
+ RenderScrollbar* customScrollbar = toRenderScrollbar(scrollbar);
+ if (customScrollbar->owningRenderer() == box)
+ customScrollbar->clearOwningRenderer();
+ }
+ }
+ }
+}
+
FrameView* FrameView::parentFrameView() const
{
if (Widget* parentView = parent()) {
Modified: branches/safari-534.54-branch/Source/WebCore/page/FrameView.h (105186 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/page/FrameView.h 2012-01-17 20:57:23 UTC (rev 105186)
+++ branches/safari-534.54-branch/Source/WebCore/page/FrameView.h 2012-01-17 21:04:21 UTC (rev 105187)
@@ -44,6 +44,7 @@
class KURL;
class Node;
class Page;
+class RenderBox;
class RenderEmbeddedObject;
class RenderLayer;
class RenderObject;
@@ -282,6 +283,8 @@
void setAnimatorsAreActive();
+ void clearOwningRendererForCustomScrollbars(RenderBox*);
+
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual void scrollContentsSlowPath(const IntRect& updateRect);
Modified: branches/safari-534.54-branch/Source/WebCore/rendering/RenderBox.cpp (105186 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/rendering/RenderBox.cpp 2012-01-17 20:57:23 UTC (rev 105186)
+++ branches/safari-534.54-branch/Source/WebCore/rendering/RenderBox.cpp 2012-01-17 21:04:21 UTC (rev 105187)
@@ -204,6 +204,11 @@
if (style() && (style()->logicalHeight().isPercent() || style()->logicalMinHeight().isPercent() || style()->logicalMaxHeight().isPercent()))
RenderBlock::removePercentHeightDescendant(this);
+ // If this renderer is owning renderer for the frameview's custom scrollbars,
+ // we need to clear it from the scrollbar. See webkit bug 64737.
+ if (style() && style()->hasPseudoStyle(SCROLLBAR) && frame() && frame()->view())
+ frame()->view()->clearOwningRendererForCustomScrollbars(this);
+
RenderBoxModelObject::destroy();
}
Modified: branches/safari-534.54-branch/Source/WebCore/rendering/RenderScrollbar.cpp (105186 => 105187)
--- branches/safari-534.54-branch/Source/WebCore/rendering/RenderScrollbar.cpp 2012-01-17 20:57:23 UTC (rev 105186)
+++ branches/safari-534.54-branch/Source/WebCore/rendering/RenderScrollbar.cpp 2012-01-17 21:04:21 UTC (rev 105187)
@@ -157,7 +157,7 @@
PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart partType, PseudoId pseudoId)
{
- if (!m_owner)
+ if (!owningRenderer())
return 0;
s_styleResolvePart = partType;