Commit 0cd3fe8a authored by ggaren's avatar ggaren

Feared, loathed, reviewed by Darin.

        More frame/iframe merging. Merged IFRAME::willRemove and IFRAME::detach 
        into FRAME, plus other cleanup.
        
        No new behavior, so no new test. Layout tests pass. Basic browsing and
        Mail editing seem to work.
        
        * dom/Node.cpp:
        (WebCore::Node::detach): Removed random commented-out code.
        * html/HTMLFrameElement.cpp:
        (WebCore::HTMLFrameElement::isURLAllowed): 
        (1) Removed reference to FrameView, to dissociate frame loading from rendering.
        (2) Renamed newURL to completeURL because the difference between newURL
        and URLString is that newURL is a KURL that is the complete version of URLString,
        not that it is new.
        (WebCore::HTMLFrameElement::willRemove): 
        (1) Removed close() call and moved close() code into willRemove(), also removing 
        close() call from detach(), since willRemove is the well-defined place 
        from DOM tear-down, not detach().
        (2) Removed manual renderer detach code because the DOM is not responsible
        for managing the render tree. I confirmed that this change not
        regress <rdar://problem/4132581>.
        (3) Removed questionable ASSERT. The ASSERT assumed that iframe elements
        lost their content frames after being removed from the DOM. That's our 
        current behavior, but it's going to change in future rounds of refactoring.
        This also fixes <rdar://problem/4750835>.
        (WebCore::HTMLFrameElement::setLocation): Removed wacky manual calls to
        attach/detach, because the render tree should not be in charge of deciding
        when to load.
        * html/HTMLFrameElement.h:
        * html/HTMLIFrameElement.cpp:
        (WebCore::HTMLIFrameElement::attach): Renamed renderPart to renderPartObject,
        because the renderer is a renderPartObject, not a renderPart.
        * html/HTMLIFrameElement.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16745 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6f2ed9b7
2006-10-02 Geoffrey Garen <ggaren@apple.com>
Feared, loathed, reviewed by Darin.
More frame/iframe merging. Merged IFRAME::willRemove and IFRAME::detach
into FRAME, plus other cleanup.
No new behavior, so no new test. Layout tests pass. Basic browsing and
Mail editing seem to work.
* dom/Node.cpp:
(WebCore::Node::detach): Removed random commented-out code.
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::isURLAllowed):
(1) Removed reference to FrameView, to dissociate frame loading from rendering.
(2) Renamed newURL to completeURL because the difference between newURL
and URLString is that newURL is a KURL that is the complete version of URLString,
not that it is new.
(WebCore::HTMLFrameElement::willRemove):
(1) Removed close() call and moved close() code into willRemove(), also removing
close() call from detach(), since willRemove is the well-defined place
from DOM tear-down, not detach().
(2) Removed manual renderer detach code because the DOM is not responsible
for managing the render tree. I confirmed that this change not
regress <rdar://problem/4132581>.
(3) Removed questionable ASSERT. The ASSERT assumed that iframe elements
lost their content frames after being removed from the DOM. That's our
current behavior, but it's going to change in future rounds of refactoring.
This also fixes <rdar://problem/4750835>.
(WebCore::HTMLFrameElement::setLocation): Removed wacky manual calls to
attach/detach, because the render tree should not be in charge of deciding
when to load.
* html/HTMLFrameElement.h:
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::attach): Renamed renderPart to renderPartObject,
because the renderer is a renderPartObject, not a renderPart.
* html/HTMLIFrameElement.h:
2006-10-03 Mark Rowe <bdash@webkit.org>
Reviewed by Mitz.
......@@ -714,7 +714,6 @@ void Node::willRemove()
void Node::detach()
{
m_inDetach = true;
// assert(m_attached);
if (renderer())
renderer()->destroy();
......
......@@ -68,17 +68,13 @@ HTMLFrameElement::~HTMLFrameElement()
{
}
bool HTMLFrameElement::isURLAllowed(const AtomicString &URLString) const
bool HTMLFrameElement::isURLAllowed(const AtomicString& URLString) const
{
if (URLString.isEmpty())
return true;
FrameView* w = document()->view();
if (!w)
return false;
KURL newURL(document()->completeURL(URLString.deprecatedString()));
newURL.setRef(DeprecatedString::null);
KURL completeURL(document()->completeURL(URLString.deprecatedString()));
completeURL.setRef(DeprecatedString::null);
// Don't allow more than 200 total frames in a set. This seems
// like a reasonable upper bound, and otherwise mutually recursive
......@@ -88,16 +84,17 @@ bool HTMLFrameElement::isURLAllowed(const AtomicString &URLString) const
// FIXME: This limit could be higher, but WebKit has some
// algorithms that happen while loading which appear to be N^2 or
// worse in the number of frames
if (w->frame()->page()->frameCount() > 200)
return false;
if (Frame* parentFrame = document()->frame())
if (parentFrame->page()->frameCount() > 200)
return false;
// We allow one level of self-reference because some sites depend on that.
// But we don't allow more than one.
bool foundSelfReference = false;
for (Frame *frame = w->frame(); frame; frame = frame->tree()->parent()) {
for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) {
KURL frameURL = frame->url();
frameURL.setRef(DeprecatedString::null);
if (frameURL == newURL) {
if (frameURL == completeURL) {
if (foundSelfReference)
return false;
foundSelfReference = true;
......@@ -209,52 +206,22 @@ void HTMLFrameElement::attach()
openURL();
}
void HTMLFrameElement::close()
void HTMLFrameElement::willRemove()
{
Frame* frame = contentFrame();
if (frame && renderer()) {
frame->frameDetached();
if (Frame* frame = contentFrame()) {
frame->disconnectOwnerElement();
frame->frameDetached();
}
}
void HTMLFrameElement::willRemove()
{
// close the frame and dissociate the renderer, but leave the
// node attached so that frame does not get re-attached before
// actually leaving the document. see <rdar://problem/4132581>
close();
if (renderer()) {
renderer()->destroy();
setRenderer(0);
}
HTMLElement::willRemove();
}
void HTMLFrameElement::detach()
{
close();
HTMLElement::detach();
}
void HTMLFrameElement::setLocation(const String& str)
{
m_URL = AtomicString(str);
if (!attached()) {
return;
}
// Handle the common case where we decided not to make a frame the first time.
// Detach and the let attach() decide again whether to make the frame for this URL.
if (!renderer() && !hasTagName(iframeTag)) {
detach();
attach();
return;
}
openURL();
if (attached())
openURL();
}
bool HTMLFrameElement::isFocusable() const
......
......@@ -52,7 +52,6 @@ public:
virtual void parseMappedAttribute(MappedAttribute*);
virtual void attach();
virtual void detach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
......@@ -60,8 +59,6 @@ public:
void insertedIntoDocument();
virtual void willRemove();
void close();
bool noResize() { return m_noResize; }
void setLocation(const String&);
......
......@@ -94,17 +94,6 @@ void HTMLIFrameElement::insertedIntoDocument()
openURL();
}
void HTMLIFrameElement::willRemove()
{
if (Frame* frame = contentFrame()) {
frame->disconnectOwnerElement();
frame->frameDetached();
ASSERT(!contentFrame());
}
HTMLElement::willRemove();
}
void HTMLIFrameElement::removedFromDocument()
{
if (document()->isHTMLDocument()) {
......@@ -130,19 +119,14 @@ void HTMLIFrameElement::attach()
{
HTMLFrameElement::attach();
if (RenderPartObject* renderPart = static_cast<RenderPartObject*>(renderer())) {
if (RenderPartObject* renderPartObject = static_cast<RenderPartObject*>(renderer())) {
if (contentFrame()) {
renderPart->setWidget(contentFrame()->view());
renderPart->updateWidget();
renderPartObject->setWidget(contentFrame()->view());
renderPartObject->updateWidget();
}
}
}
void HTMLIFrameElement::detach()
{
HTMLElement::detach();
}
bool HTMLIFrameElement::isURLAttribute(Attribute *attr) const
{
return attr->name() == srcAttr;
......
......@@ -44,10 +44,9 @@ public:
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void willRemove();
virtual void attach();
virtual void detach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
......
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