Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: trunk/Source/core/rendering/RenderIFrame.cpp

Issue 14057012: Revert 148647 "Remove frame flattening support as Chromium has n..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/Source/core/rendering/RenderIFrame.h ('k') | trunk/Source/core/rendering/RenderPart.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/Source/core/rendering/RenderIFrame.cpp
===================================================================
--- trunk/Source/core/rendering/RenderIFrame.cpp (revision 148648)
+++ trunk/Source/core/rendering/RenderIFrame.cpp (working copy)
@@ -37,9 +37,9 @@
namespace WebCore {
using namespace HTMLNames;
-
+
RenderIFrame::RenderIFrame(Element* element)
- : RenderPart(element)
+ : RenderFrameBase(element)
{
}
@@ -57,7 +57,7 @@
LayoutUnit RenderIFrame::minPreferredLogicalWidth() const
{
if (!isSeamless())
- return RenderPart::minPreferredLogicalWidth();
+ return RenderFrameBase::minPreferredLogicalWidth();
RenderView* childRoot = contentRootRenderer();
if (!childRoot)
@@ -69,7 +69,7 @@
LayoutUnit RenderIFrame::maxPreferredLogicalWidth() const
{
if (!isSeamless())
- return RenderPart::maxPreferredLogicalWidth();
+ return RenderFrameBase::maxPreferredLogicalWidth();
RenderView* childRoot = contentRootRenderer();
if (!childRoot)
@@ -85,7 +85,7 @@
bool RenderIFrame::requiresLayer() const
{
- return RenderPart::requiresLayer() || style()->resize() != RESIZE_NONE;
+ return RenderFrameBase::requiresLayer() || style()->resize() != RESIZE_NONE;
}
RenderView* RenderIFrame::contentRootRenderer() const
@@ -96,6 +96,35 @@
return childFrameView ? childFrameView->frame()->contentRenderer() : 0;
}
+bool RenderIFrame::flattenFrame() const
+{
+ if (!node() || !node()->hasTagName(iframeTag))
+ return false;
+
+ HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node());
+ Frame* frame = element->document()->frame();
+
+ if (isSeamless())
+ return false; // Seamless iframes are already "flat", don't try to flatten them.
+
+ bool enabled = frame && frame->settings() && frame->settings()->frameFlatteningEnabled();
+
+ if (!enabled || !frame->page())
+ return false;
+
+ if (style()->width().isFixed() && style()->height().isFixed()) {
+ // Do not flatten iframes with scrolling="no".
+ if (element->scrollingMode() == ScrollbarAlwaysOff)
+ return false;
+ if (style()->width().value() <= 0 || style()->height().value() <= 0)
+ return false;
+ }
+
+ // Do not flatten offscreen inner frames during frame flattening, as flattening might make them visible.
+ IntRect boundingRect = absoluteBoundingBoxRectIgnoringTransforms();
+ return boundingRect.maxX() > 0 && boundingRect.maxY() > 0;
+}
+
void RenderIFrame::layoutSeamlessly()
{
updateLogicalWidth();
@@ -133,6 +162,9 @@
updateLogicalWidth();
// No kids to layout as a replaced element.
updateLogicalHeight();
+
+ if (flattenFrame())
+ layoutWithFlattening(style()->width().isFixed(), style()->height().isFixed());
}
m_overflow.clear();
« no previous file with comments | « trunk/Source/core/rendering/RenderIFrame.h ('k') | trunk/Source/core/rendering/RenderPart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698