Changeset 57080 in webkit


Ignore:
Timestamp:
Apr 5, 2010 10:18:12 AM (14 years ago)
Author:
kenneth@webkit.org
Message:

iframe flattening doesn't flatten
https://bugs.webkit.org/show_bug.cgi?id=36798

Reviewed by Dave Hyatt.

Fixed to the iframe flattening code so that the iframes on
http://www.samisite.com/test-csb2nf/id43.htm are actually
flattened.

Covered by current tests.

  • page/FrameView.cpp: Propagate contents changes of iframes

and subframes in framesets to the parent so that it is relayouted
(WebCore::FrameView::setContentsSize):
(WebCore::FrameView::adjustViewSize):
(WebCore::FrameView::scheduleRelayout):

  • rendering/RenderPart.cpp: HTMLIFrameElement do not inherit from

HTMLFrameElement, but HTMLFrameElementBase, correct cast. Correct
the use of inset border values. Avoid a sometimes unnecessary
relayout.
(WebCore::RenderPart::layoutWithFlattening):

  • rendering/RenderPartObject.cpp: Make the calcHeight and calcWidth

return the right values, considering scrolling and fixed width/height
(WebCore::RenderPartObject::flattenFrame):
(WebCore::RenderPartObject::calcHeight):
(WebCore::RenderPartObject::calcWidth):
(WebCore::RenderPartObject::layout):

Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57079 r57080  
     12010-04-01  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        iframe flattening doesn't flatten
     6        https://bugs.webkit.org/show_bug.cgi?id=36798
     7
     8        Fixed to the iframe flattening code so that the iframes on
     9        http://www.samisite.com/test-csb2nf/id43.htm are actually
     10        flattened.
     11
     12        Covered by current tests.
     13
     14        * page/FrameView.cpp: Propagate contents changes of iframes
     15        and subframes in framesets to the parent so that it is relayouted
     16        (WebCore::FrameView::setContentsSize):
     17        (WebCore::FrameView::adjustViewSize):
     18        (WebCore::FrameView::scheduleRelayout):
     19        * rendering/RenderPart.cpp: HTMLIFrameElement do not inherit from
     20        HTMLFrameElement, but HTMLFrameElementBase, correct cast. Correct
     21        the use of inset border values. Avoid a sometimes unnecessary
     22        relayout.
     23        (WebCore::RenderPart::layoutWithFlattening):
     24        * rendering/RenderPartObject.cpp: Make the calcHeight and calcWidth
     25        return the right values, considering scrolling and fixed width/height
     26        (WebCore::RenderPartObject::flattenFrame):
     27        (WebCore::RenderPartObject::calcHeight):
     28        (WebCore::RenderPartObject::calcWidth):
     29        (WebCore::RenderPartObject::layout):
     30
    1312010-04-05  Vitaly Repeshko  <vitalyr@chromium.org>
    232
  • trunk/WebCore/page/FrameView.cpp

    r57009 r57080  
    398398
    399399    page->chrome()->contentsSizeChanged(frame(), size); //notify only
    400    
     400
    401401    m_deferSetNeedsLayouts--;
    402402   
     
    411411    if (!root)
    412412        return;
     413
    413414    setContentsSize(IntSize(root->rightLayoutOverflow(), root->bottomLayoutOverflow()));
    414415}
     
    12761277        return;
    12771278
    1278     // When frameset flattening is enabled, the contents of the frame affects layout of the parent frames.
     1279    // When frame flattening is enabled, the contents of the frame affects layout of the parent frames.
    12791280    // Also invalidate parent frame starting from the owner element of this frame.
    1280     if (m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer() && m_frame->ownerElement()->hasTagName(frameTag))
    1281         m_frame->ownerRenderer()->setNeedsLayout(true, true);
     1281    if (m_frame->settings()->frameFlatteningEnabled() && m_frame->ownerRenderer()) {
     1282        if (m_frame->ownerElement()->hasTagName(iframeTag) || m_frame->ownerElement()->hasTagName(frameTag))
     1283            m_frame->ownerRenderer()->setNeedsLayout(true, true);
     1284    }
    12821285
    12831286    int delay = m_frame->document()->minimumLayoutDelay();
  • trunk/WebCore/rendering/RenderPart.cpp

    r56854 r57080  
    2828#include "Frame.h"
    2929#include "FrameView.h"
    30 #include "HTMLFrameElement.h"
     30#include "HTMLFrameElementBase.h"
    3131
    3232namespace WebCore {
     
    6161    FrameView* childFrameView = static_cast<FrameView*>(widget());
    6262    RenderView* childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->contentRenderer()) : 0;
    63     HTMLFrameElement* element = static_cast<HTMLFrameElement*>(node());
    6463
    6564    // Do not expand frames which has zero width or height
     
    8180    // no subframe much ever become scrollable.
    8281
     82    HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node());
    8383    bool isScrollable = element->scrollingMode() != ScrollbarAlwaysOff;
    8484
     85    // consider iframe inset border
     86    int hBorder = borderLeft() + borderRight();
     87    int vBorder = borderTop() + borderBottom();
     88
    8589    // make sure minimum preferred width is enforced
    86     if (isScrollable || !fixedWidth)
    87         setWidth(max(width(), childRoot->minPrefWidth()));
    88 
    89     // update again to pass the width to the child frame
    90     updateWidgetPosition();
    91     childFrameView->layout();
     90    if (isScrollable || !fixedWidth) {
     91        setWidth(max(width(), childRoot->minPrefWidth() + hBorder));
     92        // update again to pass the new width to the child frame
     93        updateWidgetPosition();
     94        childFrameView->layout();
     95    }
    9296
    9397    // expand the frame by setting frame height = content height
    9498    if (isScrollable || !fixedHeight || childRoot->isFrameSet())
    95         setHeight(max(height(), childFrameView->contentsHeight()));
     99        setHeight(max(height(), childFrameView->contentsHeight() + vBorder));
    96100    if (isScrollable || !fixedWidth || childRoot->isFrameSet())
    97         setWidth(max(width(), childFrameView->contentsWidth()));
    98 
    99     // make room for the inset border
    100     setWidth(width() + borderLeft() + borderRight());
    101     setHeight(height() + borderTop() + borderBottom());
     101        setWidth(max(width(), childFrameView->contentsWidth() + hBorder));
    102102
    103103    updateWidgetPosition();
  • trunk/WebCore/rendering/RenderPartObject.cpp

    r56852 r57080  
    5757        return false;
    5858
    59     HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node());
     59    HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
     60    bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
    6061
    61     if (element->scrollingMode() == ScrollbarAlwaysOff
    62         && style()->width().isFixed()
     62    if (!isScrollable && style()->width().isFixed()
    6363        && style()->height().isFixed())
    6464        return false;
    6565
    66     Document* document = element ? element->document() : 0;
    67     return document->frame() && document->frame()->settings()->frameFlatteningEnabled();
     66    return frame->document()->frame() && frame->document()->frame()->settings()->frameFlatteningEnabled();
    6867}
    6968
     
    7170{
    7271    RenderPart::calcHeight();
    73     if (flattenFrame())
    74         setHeight(max(height(), static_cast<FrameView*>(widget())->contentsHeight()));
     72    if (!flattenFrame())
     73         return;
     74
     75    HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
     76    bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
     77
     78    if (isScrollable || !style()->height().isFixed()) {
     79        FrameView* view = static_cast<FrameView*>(widget());
     80        int border = borderTop() + borderBottom();
     81        setHeight(max(height(), view->contentsHeight() + border));
     82    }
    7583}
    7684
     
    7886{
    7987    RenderPart::calcWidth();
    80     if (flattenFrame())
    81         setWidth(max(width(), static_cast<FrameView*>(widget())->contentsWidth()));
     88    if (!flattenFrame())
     89        return;
     90
     91    HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
     92    bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
     93
     94    if (isScrollable || !style()->width().isFixed()) {
     95        FrameView* view = static_cast<FrameView*>(widget());
     96        int border = borderLeft() + borderRight();
     97        setWidth(max(width(), view->contentsWidth() + border));
     98    }
    8299}
    83100
     
    86103    ASSERT(needsLayout());
    87104
    88     calcWidth();
    89     calcHeight();
     105    RenderPart::calcWidth();
     106    RenderPart::calcHeight();
    90107
    91108    if (flattenFrame()) {
Note: See TracChangeset for help on using the changeset viewer.