Commit fc3c26a8 authored by ggaren's avatar ggaren

LayoutTests:

        Added test for the viewource attribute, which applies to <frame> and
        <iframe> elements.

        * fast/frames/viewsource-attribute-expected.txt: Added.
        * fast/frames/viewsource-attribute.html: Added.

        * fast/frames/frameElement-widthheight.html: Removed stray character.

WebCore:

        Reviewed by Maciej.
        
        More frame/iframe merging.
        
        - Removed needWidgetUpdate and related code. needWidgetUpdate is always
        false, so this was dead code.
        - Removed FIXME about setInViewSourceMode inside openURL(). openURL(), rather
        than attach(), is the correct place for setInViewSourceMode, because
        openURL() is the function that creates our frame.
        - Moved IFRAME insertedIntoDocument() code into FRAME, and removed FRAME
        code that did the same thing in other places.
        - Made FRAME's attach() method suffuciently generic so that IFRAME could
        call up to it, rather than skipping its superclass and calling up directly 
        to ELEMENT.
        - Changed a few IFRAME up-calls to ELEMENT into up-calls to FRAME.
        - Replaced ad hoc frame loading code in FRAME::attach() with call to
        openURL(), the designated frame loading function.

        Layout tests pass. I added a layout test for viewsource mode, since I
        broke it in the course of writing this patch.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 52f3a0e9
2006-09-30 Geoffrey Garen <ggaren@apple.com>
Added test for the viewource attribute, which applies to <frame> and
<iframe> elements.
* fast/frames/viewsource-attribute-expected.txt: Added.
* fast/frames/viewsource-attribute.html: Added.
* fast/frames/frameElement-widthheight.html: Removed stray character.
2006-09-30 David Harrison <harrison@apple.com>
Reviewed by John Sullivan.
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 479x18
text run at (0,0) width 479: "You should see two 'hello world' frames below, each in 'view source' mode."
RenderBlock {HR} at (0,34) size 784x2 [border: (1px inset #000000)]
RenderBlock (anonymous) at (0,44) size 784x154
RenderPartObject {IFRAME} at (0,0) size 300x150
layer at (0,0) size 300x150
RenderView at (0,0) size 300x150
layer at (0,0) size 300x150
RenderBlock {HTML} at (0,0) size 300x150
RenderBody {BODY} at (8,8) size 284x129
RenderBlock {PRE} at (0,0) size 284x15
RenderInline {SPAN} at (0,0) size 24x15 [color=#881280]
RenderText {#text} at (0,0) size 24x15
text run at (0,0) width 24: "<p>"
RenderText {#text} at (24,0) size 88x15
text run at (24,0) width 88: "hello world"
RenderInline {SPAN} at (0,0) size 32x15 [color=#881280]
RenderText {#text} at (112,0) size 32x15
text run at (112,0) width 32: "</p>"
RenderText {#text} at (300,136) size 4x18
text run at (300,136) width 4: " "
RenderPartObject {IFRAME} at (304,0) size 300x150
layer at (0,0) size 300x150
RenderView at (0,0) size 300x150
layer at (0,0) size 300x150
RenderBlock {HTML} at (0,0) size 300x150
RenderFrameSet {FRAMESET} at (0,0) size 300x150
RenderFrame {FRAME} at (0,0) size 300x150
layer at (0,0) size 298x146
RenderView at (0,0) size 298x146
layer at (0,0) size 298x146
RenderBlock {HTML} at (0,0) size 298x146
RenderBody {BODY} at (8,8) size 282x125
RenderBlock {PRE} at (0,0) size 282x15
RenderInline {SPAN} at (0,0) size 24x15 [color=#881280]
RenderText {#text} at (0,0) size 24x15
text run at (0,0) width 24: "<p>"
RenderText {#text} at (24,0) size 88x15
text run at (24,0) width 88: "hello world"
RenderInline {SPAN} at (0,0) size 32x15 [color=#881280]
RenderText {#text} at (112,0) size 32x15
text run at (112,0) width 32: "</p>"
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
<html>
<body>
<p>You should see two 'hello world' frames below, each in 'view source' mode.</p>
<hr>
<iframe viewsource src="data:text/html,<p>hello world</p>"></iframe>
<iframe src="data:text/html,<frameset><frame viewsource src='data:text/html,<p>hello world</p>'></frameset"></iframe>
</body>
</html>
2006-10-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej.
More frame/iframe merging.
- Removed needWidgetUpdate and related code. needWidgetUpdate is always
false, so this was dead code.
- Removed FIXME about setInViewSourceMode inside openURL(). openURL(), rather
than attach(), is the correct place for setInViewSourceMode, because
openURL() is the function that creates our frame.
- Moved IFRAME insertedIntoDocument() code into FRAME, and removed FRAME
code that did the same thing in other places.
- Made FRAME's attach() method suffuciently generic so that IFRAME could
call up to it, rather than skipping its superclass and calling up directly
to ELEMENT.
- Changed a few IFRAME up-calls to ELEMENT into up-calls to FRAME.
- Replaced ad hoc frame loading code in FRAME::attach() with call to
openURL(), the designated frame loading function.
Layout tests pass. I added a layout test for viewsource mode, since I
broke it in the course of writing this patch.
2006-10-01 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
......@@ -117,9 +117,6 @@ void HTMLFrameElement::openURL()
document()->frame()->requestFrame(this, m_URL, m_name);
// FIXME: This is a relic from how HTMLIFrameElement used to do things.
// It's probably unnecessary, since viewsource mode doesn't really work,
// and both parseMappedAttribute and attach include the same check.
if (contentFrame())
contentFrame()->setInViewSourceMode(viewSourceMode());
}
......@@ -183,44 +180,33 @@ RenderObject *HTMLFrameElement::createRenderer(RenderArena *arena, RenderStyle *
return new (arena) RenderFrame(this);
}
void HTMLFrameElement::attach()
void HTMLFrameElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
m_name = getAttribute(nameAttr);
if (m_name.isNull())
m_name = getAttribute(idAttr);
// inherit default settings from parent frameset
for (Node *node = parentNode(); node; node = node->parentNode())
if (node->hasTagName(framesetTag)) {
HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
if (!m_frameBorderSet)
m_frameBorder = frameset->frameBorder();
if (!m_noResize)
m_noResize = frameset->noResize();
break;
}
if (Frame* parentFrame = document()->frame())
m_name = parentFrame->tree()->uniqueChildName(m_name);
}
void HTMLFrameElement::attach()
{
HTMLElement::attach();
if (!renderer())
return;
Frame* frame = document()->frame();
if (!frame)
return;
AtomicString relativeURL = m_URL;
if (relativeURL.isEmpty())
relativeURL = "about:blank";
m_name = frame->tree()->uniqueChildName(m_name);
// load the frame contents
frame->requestFrame(this, relativeURL, m_name);
if (contentFrame())
contentFrame()->setInViewSourceMode(viewSourceMode());
if (hasTagName(frameTag)) {
if (HTMLFrameSetElement* frameSetElement = containingFrameSetElement()) {
if (!m_frameBorderSet)
m_frameBorder = frameSetElement->frameBorder();
if (!m_noResize)
m_noResize = frameSetElement->noResize();
}
}
if (!contentFrame())
openURL();
}
void HTMLFrameElement::close()
......@@ -307,6 +293,15 @@ Document* HTMLFrameElement::contentDocument() const
return frame->document();
}
HTMLFrameSetElement* HTMLFrameElement::containingFrameSetElement() const
{
for (Node* node = parentNode(); node; node = node->parentNode())
if (node->hasTagName(framesetTag))
return static_cast<HTMLFrameSetElement*>(node);
return 0;
}
bool HTMLFrameElement::isURLAttribute(Attribute *attr) const
{
return attr->name() == srcAttr;
......
......@@ -32,6 +32,7 @@
namespace WebCore {
class Frame;
class HTMLFrameSetElement;
class HTMLFrameElement : public HTMLElement
{
......@@ -49,12 +50,17 @@ public:
virtual int tagPriority() const { return 0; }
virtual void parseMappedAttribute(MappedAttribute*);
virtual void attach();
void close();
virtual void willRemove();
virtual void detach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
void insertedIntoDocument();
virtual void willRemove();
void close();
bool noResize() { return m_noResize; }
......@@ -65,6 +71,7 @@ public:
Frame* contentFrame() const;
Document* contentDocument() const;
HTMLFrameSetElement* containingFrameSetElement() const;
virtual bool isURLAttribute(Attribute*) const;
......
......@@ -39,7 +39,6 @@ using namespace HTMLNames;
HTMLIFrameElement::HTMLIFrameElement(Document* doc)
: HTMLFrameElement(iframeTag, doc)
, needWidgetUpdate(false)
{
m_frameBorder = false;
}
......@@ -60,7 +59,7 @@ bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttribut
return false;
}
return HTMLElement::mapToEntry(attrName, result);
return HTMLFrameElement::mapToEntry(attrName, result);
}
void HTMLIFrameElement::parseMappedAttribute(MappedAttribute *attr)
......@@ -85,23 +84,14 @@ void HTMLIFrameElement::parseMappedAttribute(MappedAttribute *attr)
void HTMLIFrameElement::insertedIntoDocument()
{
HTMLFrameElement::insertedIntoDocument();
if (document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->addDocExtraNamedItem(oldNameAttr);
}
HTMLElement::insertedIntoDocument();
// Load the frame
m_name = getAttribute(nameAttr);
if (m_name.isNull())
m_name = getAttribute(idAttr);
if (Frame* parentFrame = document()->frame()) {
m_name = parentFrame->tree()->uniqueChildName(m_name);
openURL();
}
openURL();
}
void HTMLIFrameElement::willRemove()
......@@ -122,7 +112,7 @@ void HTMLIFrameElement::removedFromDocument()
doc->removeDocExtraNamedItem(oldNameAttr);
}
HTMLElement::removedFromDocument();
HTMLFrameElement::removedFromDocument();
}
bool HTMLIFrameElement::rendererIsNeeded(RenderStyle *style)
......@@ -138,18 +128,12 @@ RenderObject *HTMLIFrameElement::createRenderer(RenderArena *arena, RenderStyle
void HTMLIFrameElement::attach()
{
HTMLElement::attach();
RenderPartObject* renderPart = static_cast<RenderPartObject*>(renderer());
if (renderPart) {
if (!contentFrame())
openURL();
HTMLFrameElement::attach();
if (RenderPartObject* renderPart = static_cast<RenderPartObject*>(renderer())) {
if (contentFrame()) {
renderPart->setWidget(contentFrame()->view());
renderPart->updateWidget();
needWidgetUpdate = false;
}
}
}
......@@ -159,16 +143,6 @@ void HTMLIFrameElement::detach()
HTMLElement::detach();
}
void HTMLIFrameElement::recalcStyle( StyleChange ch )
{
if (needWidgetUpdate) {
if (renderer())
static_cast<RenderPartObject*>(renderer())->updateWidget();
needWidgetUpdate = false;
}
HTMLElement::recalcStyle( ch );
}
bool HTMLIFrameElement::isURLAttribute(Attribute *attr) const
{
return attr->name() == srcAttr;
......
......@@ -50,7 +50,6 @@ public:
virtual void detach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
virtual void recalcStyle(StyleChange);
virtual bool isURLAttribute(Attribute*) const;
......@@ -63,10 +62,7 @@ public:
String width() const;
void setWidth(const String&);
protected:
bool needWidgetUpdate;
private:
private:
String oldNameAttr;
};
......
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