Commit 4a0090f7 authored by levin@chromium.org's avatar levin@chromium.org

WebCore:

2009-06-16  David Levin  <levin@chromium.org>

        Reviewed by David Hyatt.

        REGRESSION: When the main page (ScrollView) has a custom scrollbar, it crashes on destruction.
        https://bugs.webkit.org/show_bug.cgi?id=26326

        Test: scrollbars/scrollbar-crash-on-refresh.html

        * dom/Document.cpp:
        (WebCore::Document::detach):
        Gives the FrameView a change to do any necessary cleanup on
        Document::detach() which is where the renderArena gets detroyed.
        * page/FrameView.cpp:
        (WebCore::FrameView::detachCustomScrollbars):
        Gets rid of any custom scrollbars (if the docment supplied them).
        * page/FrameView.h:
        * platform/Scrollbar.h:
        (WebCore::Scrollbar::isCustomScrollbar):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::destroy):
        Removed the check for document()->frame().  If frame() is 0 in this code,
        then the call to animation() is also incorrect (since it does document()->frame()->animation()).
        * rendering/RenderScrollbar.h:
        (WebCore::RenderScrollbar::isCustomScrollbar):

LayoutTests:

2009-06-16  David Levin  <levin@chromium.org>

        Reviewed by David Hyatt.

        REGRESSION: When the main page (ScrollView) has a custom scrollbar, it crashes on destruction.
        https://bugs.webkit.org/show_bug.cgi?id=26326

        Test that refreshing an iframe with custom scrollbars works without crashing.

        * scrollbars/resources/page-with-custom-scrollbars.html: Added.
        * scrollbars/scrollbar-crash-on-refresh-expected.txt: Added.
        * scrollbars/scrollbar-crash-on-refresh.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 579abbb5
2009-06-16 David Levin <levin@chromium.org>
Reviewed by David Hyatt.
REGRESSION: When the main page (ScrollView) has a custom scrollbar, it crashes on destruction.
https://bugs.webkit.org/show_bug.cgi?id=26326
Test that refreshing an iframe with custom scrollbars works without crashing.
* scrollbars/resources/page-with-custom-scrollbars.html: Added.
* scrollbars/scrollbar-crash-on-refresh-expected.txt: Added.
* scrollbars/scrollbar-crash-on-refresh.html: Added.
2009-06-16 Xan Lopez <xlopez@igalia.com>
Disable another new test.
......
<html>
<head>
<style>
::-webkit-scrollbar {
width: 13px;
height: 13px;
}
.box {
background: gray;
width: 4000px;
height: 4000px;
}
</style>
</head>
<body>
<P class="box">PASS</p>
</body>
</html>
Test for bug 26326: This tests that there is no crash when refreshing a page with a custom scrollbar. On success you should see a frame with scrollbars and one PASS message in it.
<html>
<head>
<script>
function runTest()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
window.frames.myframe.location.reload(true);
}
</script>
</head>
<body onload="runTest()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=26326">bug 26326</a>:
This tests that there is no crash when refreshing a page with a custom scrollbar. On success you should see a frame with scrollbars and one PASS message in it.<p/>
<iframe name="myframe" id="myframe" src="resources/page-with-custom-scrollbars.html">
</body>
</html>
2009-06-16 David Levin <levin@chromium.org>
Reviewed by David Hyatt.
REGRESSION: When the main page (ScrollView) has a custom scrollbar, it crashes on destruction.
https://bugs.webkit.org/show_bug.cgi?id=26326
Test: scrollbars/scrollbar-crash-on-refresh.html
* dom/Document.cpp:
(WebCore::Document::detach):
Gives the FrameView a change to do any necessary cleanup on
Document::detach() which is where the renderArena gets detroyed.
* page/FrameView.cpp:
(WebCore::FrameView::detachCustomScrollbars):
Gets rid of any custom scrollbars (if the docment supplied them).
* page/FrameView.h:
* platform/Scrollbar.h:
(WebCore::Scrollbar::isCustomScrollbar):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::destroy):
Removed the check for document()->frame(). If frame() is 0 in this code,
then the call to animation() is also incorrect (since it does document()->frame()->animation()).
* rendering/RenderScrollbar.h:
(WebCore::RenderScrollbar::isCustomScrollbar):
2009-06-16 Brian Weinstein <bweinstein@apple.com>
Reviewed by Adele Peterson.
......
......@@ -5,7 +5,7 @@
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2008 David Levin (levin@chromium.org)
* Copyright (C) 2008, 2009 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -1349,6 +1349,12 @@ void Document::detach()
unscheduleStyleRecalc();
if (m_frame) {
FrameView* view = m_frame->view();
if (view)
view->detachCustomScrollbars();
}
if (render)
render->destroy();
......
......@@ -6,6 +6,7 @@
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* (C) 2006 Graham Dennis (graham.dennis@gmail.com)
* (C) 2006 Alexey Proskuryakov (ap@nypop.com)
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -228,6 +229,30 @@ void FrameView::init()
}
}
void FrameView::detachCustomScrollbars()
{
if (!m_frame)
return;
Document* document = m_frame->document();
if (!document)
return;
Element* body = document->body();
if (!body)
return;
RenderBox* renderBox = body->renderBox();
Scrollbar* horizontalBar = horizontalScrollbar();
if (horizontalBar && horizontalBar->isCustomScrollbar() && reinterpret_cast<RenderScrollbar*>(horizontalBar)->owningRenderer() == renderBox)
setHasHorizontalScrollbar(false);
Scrollbar* verticalBar = verticalScrollbar();
if (verticalBar && verticalBar->isCustomScrollbar() && reinterpret_cast<RenderScrollbar*>(verticalBar)->owningRenderer() == renderBox)
setHasVerticalScrollbar(false);
}
void FrameView::clear()
{
setCanBlitOnScroll(true);
......
......@@ -105,6 +105,7 @@ public:
void willMoveOffscreen();
void resetScrollbars();
void detachCustomScrollbars();
void clear();
......
......@@ -58,6 +58,7 @@ public:
void setClient(ScrollbarClient* client) { m_client = client; }
ScrollbarClient* client() const { return m_client; }
virtual bool isCustomScrollbar() const { return false; }
ScrollbarOrientation orientation() const { return m_orientation; }
int value() const { return lroundf(m_currentPos); }
......
......@@ -1812,7 +1812,7 @@ void RenderObject::destroy()
children->destroyLeftoverChildren();
// If this renderer is being autoscrolled, stop the autoscroll timer
if (document()->frame() && document()->frame()->eventHandler()->autoscrollRenderer() == this)
if (document()->frame()->eventHandler()->autoscrollRenderer() == this)
document()->frame()->eventHandler()->stopAutoscrollTimer(true);
if (m_hasCounterNodeMap)
......
......@@ -70,6 +70,7 @@ public:
IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&);
int minimumThumbLength();
virtual bool isCustomScrollbar() const { return true; }
private:
PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId);
......
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