summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderFrameBase.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/RenderFrameBase.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/RenderFrameBase.cpp')
-rw-r--r--Source/WebCore/rendering/RenderFrameBase.cpp75
1 files changed, 29 insertions, 46 deletions
diff --git a/Source/WebCore/rendering/RenderFrameBase.cpp b/Source/WebCore/rendering/RenderFrameBase.cpp
index 089b07a6c..28aa3bce2 100644
--- a/Source/WebCore/rendering/RenderFrameBase.cpp
+++ b/Source/WebCore/rendering/RenderFrameBase.cpp
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -33,8 +33,8 @@
namespace WebCore {
-RenderFrameBase::RenderFrameBase(HTMLFrameElementBase& element, Ref<RenderStyle>&& style)
- : RenderWidget(element, WTFMove(style))
+RenderFrameBase::RenderFrameBase(HTMLFrameElementBase& element, PassRef<RenderStyle> style)
+ : RenderWidget(element, std::move(style))
{
}
@@ -44,7 +44,7 @@ inline bool shouldExpandFrame(LayoutUnit width, LayoutUnit height, bool hasFixed
if (!width || !height)
return false;
// Really small fixed size frames can't be meant to be scrolled and are there probably by mistake. Avoid expanding.
- static const unsigned smallestUsefullyScrollableDimension = 8;
+ static unsigned smallestUsefullyScrollableDimension = 8;
if (hasFixedWidth && width < LayoutUnit(smallestUsefullyScrollableDimension))
return false;
if (hasFixedHeight && height < LayoutUnit(smallestUsefullyScrollableDimension))
@@ -54,39 +54,24 @@ inline bool shouldExpandFrame(LayoutUnit width, LayoutUnit height, bool hasFixed
void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight)
{
- view().protectRenderWidgetUntilLayoutIsDone(*this);
-
- peformLayoutWithFlattening(hasFixedWidth, hasFixedHeight);
-
- clearNeedsLayout();
-}
-
-RenderView* RenderFrameBase::childRenderView() const
-{
- if (!childView())
- return nullptr;
- return childView()->renderView();
-}
-
-void RenderFrameBase::peformLayoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight)
-{
- if (!childRenderView())
- return;
-
- if (!shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) {
- if (updateWidgetPosition() == ChildWidgetState::Destroyed)
- return;
- childView()->layout();
+ FrameView* childFrameView = childView();
+ RenderView* childRoot = childFrameView ? childFrameView->frame().contentRenderer() : 0;
+
+ if (!childRoot || !shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) {
+ updateWidgetPosition();
+ if (childFrameView)
+ childFrameView->layout();
+ clearNeedsLayout();
return;
}
// need to update to calculate min/max correctly
- if (updateWidgetPosition() == ChildWidgetState::Destroyed)
- return;
-
+ updateWidgetPosition();
+
// if scrollbars are off, and the width or height are fixed
// we obey them and do not expand. With frame flattening
// no subframe much ever become scrollable.
+
bool isScrollable = frameOwnerElement().scrollingMode() != ScrollbarAlwaysOff;
// consider iframe inset border
@@ -95,27 +80,25 @@ void RenderFrameBase::peformLayoutWithFlattening(bool hasFixedWidth, bool hasFix
// make sure minimum preferred width is enforced
if (isScrollable || !hasFixedWidth) {
- ASSERT(childRenderView());
- setWidth(std::max(width(), childRenderView()->minPreferredLogicalWidth() + hBorder));
+ setWidth(std::max(width(), childRoot->minPreferredLogicalWidth() + hBorder));
// update again to pass the new width to the child frame
- if (updateWidgetPosition() == ChildWidgetState::Destroyed)
- return;
- childView()->layout();
+ updateWidgetPosition();
+ childFrameView->layout();
}
- ASSERT(childView());
// expand the frame by setting frame height = content height
- if (isScrollable || !hasFixedHeight || childRenderView()->isFrameSet())
- setHeight(std::max<LayoutUnit>(height(), childView()->contentsHeight() + vBorder));
- if (isScrollable || !hasFixedWidth || childRenderView()->isFrameSet())
- setWidth(std::max<LayoutUnit>(width(), childView()->contentsWidth() + hBorder));
+ if (isScrollable || !hasFixedHeight || childRoot->isFrameSet())
+ setHeight(std::max<LayoutUnit>(height(), childFrameView->contentsHeight() + vBorder));
+ if (isScrollable || !hasFixedWidth || childRoot->isFrameSet())
+ setWidth(std::max<LayoutUnit>(width(), childFrameView->contentsWidth() + hBorder));
- if (updateWidgetPosition() == ChildWidgetState::Destroyed)
- return;
+ updateWidgetPosition();
- ASSERT(!childView()->layoutPending());
- ASSERT(!childRenderView()->needsLayout());
- ASSERT(!childRenderView()->firstChild() || !childRenderView()->firstChild()->firstChildSlow() || !childRenderView()->firstChild()->firstChildSlow()->needsLayout());
+ ASSERT(!childFrameView->layoutPending());
+ ASSERT(!childRoot->needsLayout());
+ ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChildSlow() || !childRoot->firstChild()->firstChildSlow()->needsLayout());
+
+ clearNeedsLayout();
}
}