Changeset 129046 in webkit


Ignore:
Timestamp:
Sep 19, 2012 2:47:40 PM (12 years ago)
Author:
tony@chromium.org
Message:

Remove RenderIFrame::updateLogicalHeight and RenderIFrame::updateLogicalWidth
https://bugs.webkit.org/show_bug.cgi?id=97049

Reviewed by Ojan Vafai.

This is an incremental step in making updateLogicalHeight non-virtual so it's
possible to call computeLogicalHeight on any RenderBox and get the right
version of the function.

The code in RenderIFrame::layout was calling flattenFrame(), which would
query it's bounding box size. Since we hadn't done a layout yet, the size
is unknown. The fix is to only call flattenFrame() after calling
updateLogicalWidth and updateLogicalHeight. We can then fixup the size of
the iframe.

No new tests, existing tests in fast/frames/flattening should continue to pass.

  • rendering/RenderIFrame.cpp:

(WebCore::RenderIFrame::layout):

  • rendering/RenderIFrame.h:

(RenderIFrame):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129041 r129046  
     12012-09-19  Tony Chang  <tony@chromium.org>
     2
     3        Remove RenderIFrame::updateLogicalHeight and RenderIFrame::updateLogicalWidth
     4        https://bugs.webkit.org/show_bug.cgi?id=97049
     5
     6        Reviewed by Ojan Vafai.
     7
     8        This is an incremental step in making updateLogicalHeight non-virtual so it's
     9        possible to call computeLogicalHeight on any RenderBox and get the right
     10        version of the function.
     11
     12        The code in RenderIFrame::layout was calling flattenFrame(), which would
     13        query it's bounding box size.  Since we hadn't done a layout yet, the size
     14        is unknown.  The fix is to only call flattenFrame() after calling
     15        updateLogicalWidth and updateLogicalHeight. We can then fixup the size of
     16        the iframe.
     17
     18        No new tests, existing tests in fast/frames/flattening should continue to pass.
     19
     20        * rendering/RenderIFrame.cpp:
     21        (WebCore::RenderIFrame::layout):
     22        * rendering/RenderIFrame.h:
     23        (RenderIFrame):
     24
    1252012-09-19  Joshua Bell  <jsbell@chromium.org>
    226
  • trunk/Source/WebCore/rendering/RenderIFrame.cpp

    r128201 r129046  
    4242    : RenderFrameBase(element)
    4343{
    44 }
    45 
    46 void RenderIFrame::updateLogicalHeight()
    47 {
    48     RenderPart::updateLogicalHeight();
    49     if (!flattenFrame())
    50          return;
    51 
    52     HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
    53     bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
    54 
    55     if (isScrollable || !style()->height().isFixed()) {
    56         FrameView* view = static_cast<FrameView*>(widget());
    57         if (!view)
    58             return;
    59         int border = borderTop() + borderBottom();
    60         setHeight(max<LayoutUnit>(height(), view->contentsHeight() + border));
    61     }
    62 }
    63 
    64 void RenderIFrame::updateLogicalWidth()
    65 {
    66     // When we're seamless, we behave like a block. Thankfully RenderBox has all the right logic for this.
    67     if (isSeamless())
    68         return RenderBox::updateLogicalWidth();
    69 
    70     RenderPart::updateLogicalWidth();
    71     if (!flattenFrame())
    72         return;
    73 
    74     HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
    75     bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
    76 
    77     if (isScrollable || !style()->width().isFixed()) {
    78         FrameView* view = static_cast<FrameView*>(widget());
    79         if (!view)
    80             return;
    81         LayoutUnit border = borderLeft() + borderRight();
    82         setWidth(max<LayoutUnit>(width(), view->contentsWidth() + border));
    83     }
    8444}
    8545
     
    190150    ASSERT(needsLayout());
    191151
    192     if (flattenFrame()) {
    193         RenderPart::updateLogicalWidth();
    194         RenderPart::updateLogicalHeight();
    195         layoutWithFlattening(style()->width().isFixed(), style()->height().isFixed());
    196         // FIXME: Is early return really OK here? What about transform/overflow code below?
    197         return;
    198     } else if (isSeamless()) {
     152    if (isSeamless()) {
    199153        layoutSeamlessly();
    200154        // Do not return so as to share the layer and overflow updates below.
     
    203157        // No kids to layout as a replaced element.
    204158        updateLogicalHeight();
     159
     160        if (flattenFrame())
     161            layoutWithFlattening(style()->width().isFixed(), style()->height().isFixed());
    205162    }
    206163
  • trunk/Source/WebCore/rendering/RenderIFrame.h

    r128201 r129046  
    4141
    4242private:
    43     virtual void updateLogicalWidth() OVERRIDE;
    44     virtual void updateLogicalHeight() OVERRIDE;
    45 
    4643    virtual LayoutUnit minPreferredLogicalWidth() const OVERRIDE;
    4744    virtual LayoutUnit maxPreferredLogicalWidth() const OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.