| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 RenderView* RenderIFrame::contentRootRenderer() const | 91 RenderView* RenderIFrame::contentRootRenderer() const |
| 92 { | 92 { |
| 93 // FIXME: Is this always a valid cast? What about plugins? | 93 // FIXME: Is this always a valid cast? What about plugins? |
| 94 ASSERT(!widget() || widget()->isFrameView()); | 94 ASSERT(!widget() || widget()->isFrameView()); |
| 95 FrameView* childFrameView = toFrameView(widget()); | 95 FrameView* childFrameView = toFrameView(widget()); |
| 96 return childFrameView ? childFrameView->frame()->contentRenderer() : 0; | 96 return childFrameView ? childFrameView->frame()->contentRenderer() : 0; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool RenderIFrame::flattenFrame() const | |
| 100 { | |
| 101 if (!node() || !node()->hasTagName(iframeTag)) | |
| 102 return false; | |
| 103 | |
| 104 HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node()); | |
| 105 Frame* frame = element->document()->frame(); | |
| 106 | |
| 107 if (isSeamless()) | |
| 108 return false; // Seamless iframes are already "flat", don't try to flatt
en them. | |
| 109 | |
| 110 bool enabled = frame && frame->settings() && frame->settings()->frameFlatten
ingEnabled(); | |
| 111 | |
| 112 if (!enabled || !frame->page()) | |
| 113 return false; | |
| 114 | |
| 115 if (style()->width().isFixed() && style()->height().isFixed()) { | |
| 116 // Do not flatten iframes with scrolling="no". | |
| 117 if (element->scrollingMode() == ScrollbarAlwaysOff) | |
| 118 return false; | |
| 119 if (style()->width().value() <= 0 || style()->height().value() <= 0) | |
| 120 return false; | |
| 121 } | |
| 122 | |
| 123 // Do not flatten offscreen inner frames during frame flattening, as flatten
ing might make them visible. | |
| 124 IntRect boundingRect = absoluteBoundingBoxRectIgnoringTransforms(); | |
| 125 return boundingRect.maxX() > 0 && boundingRect.maxY() > 0; | |
| 126 } | |
| 127 | |
| 128 void RenderIFrame::layoutSeamlessly() | 99 void RenderIFrame::layoutSeamlessly() |
| 129 { | 100 { |
| 130 updateLogicalWidth(); | 101 updateLogicalWidth(); |
| 131 // FIXME: Containers set their height to 0 before laying out their kids (as
we're doing here) | 102 // FIXME: Containers set their height to 0 before laying out their kids (as
we're doing here) |
| 132 // however, this causes FrameView::layout() to add vertical scrollbars, inco
rrectly inflating | 103 // however, this causes FrameView::layout() to add vertical scrollbars, inco
rrectly inflating |
| 133 // the resulting contentHeight(). We'll need to make FrameView::layout() sma
rter. | 104 // the resulting contentHeight(). We'll need to make FrameView::layout() sma
rter. |
| 134 setLogicalHeight(0); | 105 setLogicalHeight(0); |
| 135 updateWidgetPosition(); // Tell the Widget about our new width/height (it wi
ll also layout the child document). | 106 updateWidgetPosition(); // Tell the Widget about our new width/height (it wi
ll also layout the child document). |
| 136 | 107 |
| 137 // Laying out our kids is normally responsible for adjusting our height, so
we set it here. | 108 // Laying out our kids is normally responsible for adjusting our height, so
we set it here. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 155 StackStats::LayoutCheckPoint layoutCheckPoint; | 126 StackStats::LayoutCheckPoint layoutCheckPoint; |
| 156 ASSERT(needsLayout()); | 127 ASSERT(needsLayout()); |
| 157 | 128 |
| 158 if (isSeamless()) { | 129 if (isSeamless()) { |
| 159 layoutSeamlessly(); | 130 layoutSeamlessly(); |
| 160 // Do not return so as to share the layer and overflow updates below. | 131 // Do not return so as to share the layer and overflow updates below. |
| 161 } else { | 132 } else { |
| 162 updateLogicalWidth(); | 133 updateLogicalWidth(); |
| 163 // No kids to layout as a replaced element. | 134 // No kids to layout as a replaced element. |
| 164 updateLogicalHeight(); | 135 updateLogicalHeight(); |
| 165 | |
| 166 if (flattenFrame()) | |
| 167 layoutWithFlattening(style()->width().isFixed(), style()->height().i
sFixed()); | |
| 168 } | 136 } |
| 169 | 137 |
| 170 m_overflow.clear(); | 138 m_overflow.clear(); |
| 171 addVisualEffectOverflow(); | 139 addVisualEffectOverflow(); |
| 172 updateLayerTransform(); | 140 updateLayerTransform(); |
| 173 | 141 |
| 174 setNeedsLayout(false); | 142 setNeedsLayout(false); |
| 175 } | 143 } |
| 176 | 144 |
| 177 } | 145 } |
| OLD | NEW |