summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderFrameBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderFrameBase.cpp')
-rw-r--r--Source/WebCore/rendering/RenderFrameBase.cpp75
1 files changed, 46 insertions, 29 deletions
diff --git a/Source/WebCore/rendering/RenderFrameBase.cpp b/Source/WebCore/rendering/RenderFrameBase.cpp
index 28aa3bce2..86479af92 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 COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE 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, PassRef<RenderStyle> style)
- : RenderWidget(element, std::move(style))
+RenderFrameBase::RenderFrameBase(HTMLFrameElementBase& element, RenderStyle&& style)
+ : RenderWidget(element, WTFMove(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 unsigned smallestUsefullyScrollableDimension = 8;
+ static const unsigned smallestUsefullyScrollableDimension = 8;
if (hasFixedWidth && width < LayoutUnit(smallestUsefullyScrollableDimension))
return false;
if (hasFixedHeight && height < LayoutUnit(smallestUsefullyScrollableDimension))
@@ -54,24 +54,39 @@ inline bool shouldExpandFrame(LayoutUnit width, LayoutUnit height, bool hasFixed
void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight)
{
- FrameView* childFrameView = childView();
- RenderView* childRoot = childFrameView ? childFrameView->frame().contentRenderer() : 0;
-
- if (!childRoot || !shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) {
- updateWidgetPosition();
- if (childFrameView)
- childFrameView->layout();
- clearNeedsLayout();
+ 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();
return;
}
// need to update to calculate min/max correctly
- updateWidgetPosition();
-
+ if (updateWidgetPosition() == ChildWidgetState::Destroyed)
+ return;
+
// 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
@@ -80,25 +95,27 @@ void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeig
// make sure minimum preferred width is enforced
if (isScrollable || !hasFixedWidth) {
- setWidth(std::max(width(), childRoot->minPreferredLogicalWidth() + hBorder));
+ ASSERT(childRenderView());
+ setWidth(std::max(width(), childRenderView()->minPreferredLogicalWidth() + hBorder));
// update again to pass the new width to the child frame
- updateWidgetPosition();
- childFrameView->layout();
+ if (updateWidgetPosition() == ChildWidgetState::Destroyed)
+ return;
+ childView()->layout();
}
+ ASSERT(childView());
// expand the frame by setting frame height = content height
- 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));
-
- updateWidgetPosition();
+ 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));
- ASSERT(!childFrameView->layoutPending());
- ASSERT(!childRoot->needsLayout());
- ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChildSlow() || !childRoot->firstChild()->firstChildSlow()->needsLayout());
+ if (updateWidgetPosition() == ChildWidgetState::Destroyed)
+ return;
- clearNeedsLayout();
+ ASSERT(!childView()->layoutPending());
+ ASSERT(!childRenderView()->needsLayout());
+ ASSERT(!childRenderView()->firstChild() || !childRenderView()->firstChild()->firstChildSlow() || !childRenderView()->firstChild()->firstChildSlow()->needsLayout());
}
}