| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool RenderIFrame::requiresLayer() const | 84 bool RenderIFrame::requiresLayer() const |
| 85 { | 85 { |
| 86 return RenderPart::requiresLayer() || style()->resize() != RESIZE_NONE; | 86 return RenderPart::requiresLayer() || style()->resize() != RESIZE_NONE; |
| 87 } | 87 } |
| 88 | 88 |
| 89 RenderView* RenderIFrame::contentRootRenderer() const | 89 RenderView* RenderIFrame::contentRootRenderer() const |
| 90 { | 90 { |
| 91 // FIXME: Is this always a valid cast? What about plugins? | 91 // FIXME: Is this always a valid cast? What about plugins? |
| 92 ASSERT(!widget() || widget()->isFrameView()); | 92 ASSERT(!widget() || widget()->isFrameView()); |
| 93 FrameView* childFrameView = toFrameView(widget()); | 93 FrameView* childFrameView = toFrameView(widget()); |
| 94 return childFrameView ? childFrameView->frame()->contentRenderer() : 0; | 94 return childFrameView ? childFrameView->frame().contentRenderer() : 0; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void RenderIFrame::layoutSeamlessly() | 97 void RenderIFrame::layoutSeamlessly() |
| 98 { | 98 { |
| 99 updateLogicalWidth(); | 99 updateLogicalWidth(); |
| 100 // FIXME: Containers set their height to 0 before laying out their kids (as
we're doing here) | 100 // FIXME: Containers set their height to 0 before laying out their kids (as
we're doing here) |
| 101 // however, this causes FrameView::layout() to add vertical scrollbars, inco
rrectly inflating | 101 // however, this causes FrameView::layout() to add vertical scrollbars, inco
rrectly inflating |
| 102 // the resulting contentHeight(). We'll need to make FrameView::layout() sma
rter. | 102 // the resulting contentHeight(). We'll need to make FrameView::layout() sma
rter. |
| 103 setLogicalHeight(0); | 103 setLogicalHeight(0); |
| 104 updateWidgetPosition(); // Tell the Widget about our new width/height (it wi
ll also layout the child document). | 104 updateWidgetPosition(); // Tell the Widget about our new width/height (it wi
ll also layout the child document). |
| 105 | 105 |
| 106 // Laying out our kids is normally responsible for adjusting our height, so
we set it here. | 106 // Laying out our kids is normally responsible for adjusting our height, so
we set it here. |
| 107 // Replaced elements normally do not respect padding, but seamless elements
should: we'll add | 107 // Replaced elements normally do not respect padding, but seamless elements
should: we'll add |
| 108 // both padding and border to the child's logical height here. | 108 // both padding and border to the child's logical height here. |
| 109 FrameView* childFrameView = toFrameView(widget()); | 109 FrameView* childFrameView = toFrameView(widget()); |
| 110 if (childFrameView) // Widget should never be null during layout(), but just
in case. | 110 if (childFrameView) // Widget should never be null during layout(), but just
in case. |
| 111 setLogicalHeight(childFrameView->contentsHeight() + borderTop() + border
Bottom() + paddingTop() + paddingBottom()); | 111 setLogicalHeight(childFrameView->contentsHeight() + borderTop() + border
Bottom() + paddingTop() + paddingBottom()); |
| 112 updateLogicalHeight(); | 112 updateLogicalHeight(); |
| 113 | 113 |
| 114 updateWidgetPosition(); // Notify the Widget of our final height. | 114 updateWidgetPosition(); // Notify the Widget of our final height. |
| 115 | 115 |
| 116 // Assert that the child document did a complete layout. | 116 // Assert that the child document did a complete layout. |
| 117 RenderView* childRoot = childFrameView ? childFrameView->frame()->contentRen
derer() : 0; | 117 RenderView* childRoot = childFrameView ? childFrameView->frame().contentRend
erer() : 0; |
| 118 ASSERT(!childFrameView || !childFrameView->layoutPending()); | 118 ASSERT(!childFrameView || !childFrameView->layoutPending()); |
| 119 ASSERT_UNUSED(childRoot, !childRoot || !childRoot->needsLayout()); | 119 ASSERT_UNUSED(childRoot, !childRoot || !childRoot->needsLayout()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void RenderIFrame::layout() | 122 void RenderIFrame::layout() |
| 123 { | 123 { |
| 124 ASSERT(needsLayout()); | 124 ASSERT(needsLayout()); |
| 125 | 125 |
| 126 if (isSeamless()) { | 126 if (isSeamless()) { |
| 127 layoutSeamlessly(); | 127 layoutSeamlessly(); |
| 128 // Do not return so as to share the layer and overflow updates below. | 128 // Do not return so as to share the layer and overflow updates below. |
| 129 } else { | 129 } else { |
| 130 updateLogicalWidth(); | 130 updateLogicalWidth(); |
| 131 // No kids to layout as a replaced element. | 131 // No kids to layout as a replaced element. |
| 132 updateLogicalHeight(); | 132 updateLogicalHeight(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 m_overflow.clear(); | 135 m_overflow.clear(); |
| 136 addVisualEffectOverflow(); | 136 addVisualEffectOverflow(); |
| 137 updateLayerTransform(); | 137 updateLayerTransform(); |
| 138 | 138 |
| 139 clearNeedsLayout(); | 139 clearNeedsLayout(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } | 142 } |
| OLD | NEW |