Changeset 16703 in webkit


Ignore:
Timestamp:
Oct 1, 2006 6:02:49 PM (18 years ago)
Author:
ggaren
Message:

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.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r16700 r16703  
     12006-09-30  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added test for the viewource attribute, which applies to <frame> and
     4        <iframe> elements.
     5
     6        * fast/frames/viewsource-attribute-expected.txt: Added.
     7        * fast/frames/viewsource-attribute.html: Added.
     8
     9        * fast/frames/frameElement-widthheight.html: Removed stray character.
     10
    1112006-09-30  David Harrison  <harrison@apple.com>
    212
  • trunk/LayoutTests/fast/frames/frameElement-widthheight.html

    r11995 r16703  
    2626     
    2727      ref = top.frame2.frameElement;
    28       top.frameset.removeChild(top.frame2.frameElement);
     28      top.frameset.removeChild(top.frame2.frameElement);
    2929      if (ref.width != 0 || ref.height != 0) {
    3030        log('Incorrect deleted frame size: ' + ref.width + 'x' + ref.height);
  • trunk/WebCore/ChangeLog

    r16701 r16703  
     12006-10-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Maciej.
     4       
     5        More frame/iframe merging.
     6       
     7        - Removed needWidgetUpdate and related code. needWidgetUpdate is always
     8        false, so this was dead code.
     9        - Removed FIXME about setInViewSourceMode inside openURL(). openURL(), rather
     10        than attach(), is the correct place for setInViewSourceMode, because
     11        openURL() is the function that creates our frame.
     12        - Moved IFRAME insertedIntoDocument() code into FRAME, and removed FRAME
     13        code that did the same thing in other places.
     14        - Made FRAME's attach() method suffuciently generic so that IFRAME could
     15        call up to it, rather than skipping its superclass and calling up directly
     16        to ELEMENT.
     17        - Changed a few IFRAME up-calls to ELEMENT into up-calls to FRAME.
     18        - Replaced ad hoc frame loading code in FRAME::attach() with call to
     19        openURL(), the designated frame loading function.
     20
     21        Layout tests pass. I added a layout test for viewsource mode, since I
     22        broke it in the course of writing this patch.
     23
    1242006-10-01  Anders Carlsson  <acarlsson@apple.com>
    225
  • trunk/WebCore/html/HTMLFrameElement.cpp

    r16661 r16703  
    118118    document()->frame()->requestFrame(this, m_URL, m_name);
    119119
    120     // FIXME: This is a relic from how HTMLIFrameElement used to do things.
    121     // It's probably unnecessary, since viewsource mode doesn't really work,
    122     // and both parseMappedAttribute and attach include the same check.
    123120    if (contentFrame())
    124121        contentFrame()->setInViewSourceMode(viewSourceMode());
     
    184181}
    185182
    186 void HTMLFrameElement::attach()
    187 {
     183void HTMLFrameElement::insertedIntoDocument()
     184{
     185    HTMLElement::insertedIntoDocument();
     186   
    188187    m_name = getAttribute(nameAttr);
    189188    if (m_name.isNull())
    190189        m_name = getAttribute(idAttr);
    191190
    192     // inherit default settings from parent frameset
    193     for (Node *node = parentNode(); node; node = node->parentNode())
    194         if (node->hasTagName(framesetTag)) {
    195             HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
     191    if (Frame* parentFrame = document()->frame())
     192        m_name = parentFrame->tree()->uniqueChildName(m_name);
     193}
     194
     195void HTMLFrameElement::attach()
     196{
     197    HTMLElement::attach();
     198   
     199    if (hasTagName(frameTag)) {
     200        if (HTMLFrameSetElement* frameSetElement = containingFrameSetElement()) {
    196201            if (!m_frameBorderSet)
    197                 m_frameBorder = frameset->frameBorder();
     202                m_frameBorder = frameSetElement->frameBorder();
    198203            if (!m_noResize)
    199                 m_noResize = frameset->noResize();
    200             break;
     204                m_noResize = frameSetElement->noResize();
    201205        }
    202 
    203     HTMLElement::attach();
    204 
    205     if (!renderer())
    206         return;
    207 
    208     Frame* frame = document()->frame();
    209 
    210     if (!frame)
    211         return;
    212 
    213     AtomicString relativeURL = m_URL;
    214     if (relativeURL.isEmpty())
    215         relativeURL = "about:blank";
    216 
    217     m_name = frame->tree()->uniqueChildName(m_name);
    218 
    219     // load the frame contents
    220     frame->requestFrame(this, relativeURL, m_name);
    221    
    222     if (contentFrame())
    223         contentFrame()->setInViewSourceMode(viewSourceMode());
     206    }
     207       
     208    if (!contentFrame())
     209        openURL();
    224210}
    225211
     
    308294}
    309295
     296HTMLFrameSetElement* HTMLFrameElement::containingFrameSetElement() const
     297{
     298    for (Node* node = parentNode(); node; node = node->parentNode())
     299        if (node->hasTagName(framesetTag))
     300            return static_cast<HTMLFrameSetElement*>(node);
     301
     302    return 0;
     303}
     304
    310305bool HTMLFrameElement::isURLAttribute(Attribute *attr) const
    311306{
  • trunk/WebCore/html/HTMLFrameElement.h

    r15050 r16703  
    3333
    3434class Frame;
     35class HTMLFrameSetElement;
    3536
    3637class HTMLFrameElement : public HTMLElement
     
    5051 
    5152    virtual void parseMappedAttribute(MappedAttribute*);
     53
    5254    virtual void attach();
    53     void close();
    54     virtual void willRemove();
    5555    virtual void detach();
     56
    5657    virtual bool rendererIsNeeded(RenderStyle*);
    5758    virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
     59   
     60    void insertedIntoDocument();
     61    virtual void willRemove();
     62
     63    void close();
    5864
    5965    bool noResize() { return m_noResize; }
     
    6672    Frame* contentFrame() const;
    6773    Document* contentDocument() const;
     74    HTMLFrameSetElement* containingFrameSetElement() const;
    6875   
    6976    virtual bool isURLAttribute(Attribute*) const;
  • trunk/WebCore/html/HTMLIFrameElement.cpp

    r16661 r16703  
    4040HTMLIFrameElement::HTMLIFrameElement(Document* doc)
    4141    : HTMLFrameElement(iframeTag, doc)
    42     , needWidgetUpdate(false)
    4342{
    4443    m_frameBorder = false;
     
    6160    }
    6261   
    63     return HTMLElement::mapToEntry(attrName, result);
     62    return HTMLFrameElement::mapToEntry(attrName, result);
    6463}
    6564
     
    8685void HTMLIFrameElement::insertedIntoDocument()
    8786{
     87    HTMLFrameElement::insertedIntoDocument();
     88   
    8889    if (document()->isHTMLDocument()) {
    8990        HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     
    9192    }
    9293
    93     HTMLElement::insertedIntoDocument();
    94    
    95     // Load the frame
    96     m_name = getAttribute(nameAttr);
    97     if (m_name.isNull())
    98         m_name = getAttribute(idAttr);
    99    
    100     if (Frame* parentFrame = document()->frame()) {
    101         m_name = parentFrame->tree()->uniqueChildName(m_name);
    102        
    103         openURL();
    104     }   
     94    openURL();
    10595}
    10696
     
    123113    }
    124114
    125     HTMLElement::removedFromDocument();
     115    HTMLFrameElement::removedFromDocument();
    126116}
    127117
     
    139129void HTMLIFrameElement::attach()
    140130{
    141     HTMLElement::attach();
     131    HTMLFrameElement::attach();
    142132
    143     RenderPartObject* renderPart = static_cast<RenderPartObject*>(renderer());
    144 
    145     if (renderPart) {       
    146         if (!contentFrame())
    147             openURL();
    148 
     133    if (RenderPartObject* renderPart = static_cast<RenderPartObject*>(renderer())) {       
    149134        if (contentFrame()) {
    150135            renderPart->setWidget(contentFrame()->view());
    151136            renderPart->updateWidget();
    152             needWidgetUpdate = false;
    153137        }
    154138    }
     
    158142{
    159143    HTMLElement::detach();
    160 }
    161 
    162 void HTMLIFrameElement::recalcStyle( StyleChange ch )
    163 {
    164     if (needWidgetUpdate) {
    165         if (renderer())
    166             static_cast<RenderPartObject*>(renderer())->updateWidget();
    167         needWidgetUpdate = false;
    168     }
    169     HTMLElement::recalcStyle( ch );
    170144}
    171145
  • trunk/WebCore/html/HTMLIFrameElement.h

    r16661 r16703  
    5151    virtual bool rendererIsNeeded(RenderStyle*);
    5252    virtual RenderObject *createRenderer(RenderArena*, RenderStyle*);
    53     virtual void recalcStyle(StyleChange);
    5453   
    5554    virtual bool isURLAttribute(Attribute*) const;
     
    6463    void setWidth(const String&);
    6564
    66 protected:
    67     bool needWidgetUpdate;
    68 
    69  private:
     65private:
    7066    String oldNameAttr;
    7167};
Note: See TracChangeset for help on using the changeset viewer.