summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/rendering/RenderPartObject.cpp68
-rw-r--r--WebCore/rendering/RenderPartObject.h4
2 files changed, 68 insertions, 4 deletions
diff --git a/WebCore/rendering/RenderPartObject.cpp b/WebCore/rendering/RenderPartObject.cpp
index 86cb2ad..4df631f 100644
--- a/WebCore/rendering/RenderPartObject.cpp
+++ b/WebCore/rendering/RenderPartObject.cpp
@@ -300,10 +300,9 @@ void RenderPartObject::layout()
{
ASSERT(needsLayout());
- calcWidth();
- calcHeight();
-
#ifdef FLATTEN_IFRAME
+ RenderPart::calcWidth();
+ RenderPart::calcHeight();
// Some IFrames have a width and/or height of 1 when they are meant to be
// hidden. If that is the case, don't try to expand.
int w = width();
@@ -340,10 +339,17 @@ void RenderPartObject::layout()
// Do not shrink iframes with specified sizes
if (contentHeight > h || style()->height().isAuto())
setHeight(contentHeight);
- setWidth(std::min(contentWidth, 800));
+ setWidth(contentWidth);
+
+ // Update one last time
+ updateWidgetPosition();
}
}
+#else
+ calcWidth();
+ calcHeight();
#endif
+
adjustOverflowForBoxShadow();
RenderPart::layout();
@@ -354,6 +360,60 @@ void RenderPartObject::layout()
setNeedsLayout(false);
}
+#ifdef FLATTEN_IFRAME
+void RenderPartObject::calcWidth() {
+ RenderPart::calcWidth();
+ if (!m_widget || !m_widget->isFrameView())
+ return;
+ FrameView* view = static_cast<FrameView*>(m_widget);
+ RenderView* root = static_cast<RenderView*>(view->frame()->contentRenderer());
+ if (!root)
+ return;
+ // Update the dimensions to get the correct minimum preferred
+ // width
+ updateWidgetPosition();
+
+ // Set the width
+ setWidth(max(width(), root->minPrefWidth()));
+
+ // Update based on the new width
+ updateWidgetPosition();
+
+ // Layout to get the content width
+ while (view->needsLayout())
+ view->layout();
+
+ setWidth(view->contentsWidth());
+
+ // Update one last time to ensure the dimensions.
+ updateWidgetPosition();
+}
+
+void RenderPartObject::calcHeight() {
+ RenderPart::calcHeight();
+ if (!m_widget || !m_widget->isFrameView())
+ return;
+ FrameView* view = static_cast<FrameView*>(m_widget);
+ RenderView* root = static_cast<RenderView*>(view->frame()->contentRenderer());
+ if (!root)
+ return;
+ // Update the widget
+ updateWidgetPosition();
+
+ // Layout to get the content height
+ while (view->needsLayout())
+ view->layout();
+
+ // Do not shrink the height if the size is specified
+ int h = view->contentsHeight();
+ if (h > height() || style()->height().isAuto())
+ setHeight(h);
+
+ // Update one last time to ensure the dimensions.
+ updateWidgetPosition();
+}
+#endif
+
void RenderPartObject::viewCleared()
{
if (element() && m_widget && m_widget->isFrameView()) {
diff --git a/WebCore/rendering/RenderPartObject.h b/WebCore/rendering/RenderPartObject.h
index 98de5b9..2b21644 100644
--- a/WebCore/rendering/RenderPartObject.h
+++ b/WebCore/rendering/RenderPartObject.h
@@ -36,6 +36,10 @@ public:
virtual const char* renderName() const { return "RenderPartObject"; }
+#ifdef FLATTEN_IFRAME
+ virtual void calcWidth();
+ virtual void calcHeight();
+#endif
virtual void layout();
void updateWidget(bool onlyCreateNonNetscapePlugins);