| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Since we are moving the |object| to a new parent |fullscreenRende
rer|, | 141 // Since we are moving the |object| to a new parent |fullscreenRende
rer|, |
| 142 // the line box tree underneath our |containingBlock| is not longer
valid. | 142 // the line box tree underneath our |containingBlock| is not longer
valid. |
| 143 containingBlock->deleteLineBoxTree(); | 143 containingBlock->deleteLineBoxTree(); |
| 144 | 144 |
| 145 parent->addChild(fullscreenRenderer, object); | 145 parent->addChild(fullscreenRenderer, object); |
| 146 object->remove(); | 146 object->remove(); |
| 147 | 147 |
| 148 // Always just do a full layout to ensure that line boxes get delete
d properly. | 148 // Always just do a full layout to ensure that line boxes get delete
d properly. |
| 149 // Because objects moved from |parent| to |fullscreenRenderer|, we w
ant to | 149 // Because objects moved from |parent| to |fullscreenRenderer|, we w
ant to |
| 150 // make new line boxes instead of leaving the old ones around. | 150 // make new line boxes instead of leaving the old ones around. |
| 151 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 151 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(La
youtInvalidationReason::Fullscreen); |
| 152 containingBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvali
dation(); | 152 containingBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvali
dation(LayoutInvalidationReason::Fullscreen); |
| 153 } | 153 } |
| 154 fullscreenRenderer->addChild(object); | 154 fullscreenRenderer->addChild(object); |
| 155 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid
ation(); | 155 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid
ation(LayoutInvalidationReason::Fullscreen); |
| 156 } | 156 } |
| 157 | 157 |
| 158 ASSERT(document); | 158 ASSERT(document); |
| 159 Fullscreen::from(*document).setFullScreenRenderer(fullscreenRenderer); | 159 Fullscreen::from(*document).setFullScreenRenderer(fullscreenRenderer); |
| 160 return fullscreenRenderer; | 160 return fullscreenRenderer; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void LayoutFullScreen::unwrapRenderer() | 163 void LayoutFullScreen::unwrapRenderer() |
| 164 { | 164 { |
| 165 // FIXME: We should not modify the structure of the render tree during | 165 // FIXME: We should not modify the structure of the render tree during |
| 166 // layout. crbug.com/370459 | 166 // layout. crbug.com/370459 |
| 167 DeprecatedDisableModifyRenderTreeStructureAsserts disabler; | 167 DeprecatedDisableModifyRenderTreeStructureAsserts disabler; |
| 168 | 168 |
| 169 if (parent()) { | 169 if (parent()) { |
| 170 for (LayoutObject* child = firstChild(); child; child = firstChild()) { | 170 for (LayoutObject* child = firstChild(); child; child = firstChild()) { |
| 171 // We have to clear the override size, because as a flexbox, we | 171 // We have to clear the override size, because as a flexbox, we |
| 172 // may have set one on the child, and we don't want to leave that | 172 // may have set one on the child, and we don't want to leave that |
| 173 // lying around on the child. | 173 // lying around on the child. |
| 174 if (child->isBox()) | 174 if (child->isBox()) |
| 175 toLayoutBox(child)->clearOverrideSize(); | 175 toLayoutBox(child)->clearOverrideSize(); |
| 176 child->remove(); | 176 child->remove(); |
| 177 parent()->addChild(child, this); | 177 parent()->addChild(child, this); |
| 178 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
); | 178 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 if (placeholder()) | 181 if (placeholder()) |
| 182 placeholder()->remove(); | 182 placeholder()->remove(); |
| 183 remove(); | 183 remove(); |
| 184 destroy(); | 184 destroy(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void LayoutFullScreen::setPlaceholder(LayoutBlock* placeholder) | 187 void LayoutFullScreen::setPlaceholder(LayoutBlock* placeholder) |
| 188 { | 188 { |
| 189 m_placeholder = placeholder; | 189 m_placeholder = placeholder; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void LayoutFullScreen::createPlaceholder(PassRefPtr<LayoutStyle> style, const La
youtRect& frameRect) | 192 void LayoutFullScreen::createPlaceholder(PassRefPtr<LayoutStyle> style, const La
youtRect& frameRect) |
| 193 { | 193 { |
| 194 if (style->width().isAuto()) | 194 if (style->width().isAuto()) |
| 195 style->setWidth(Length(frameRect.width(), Fixed)); | 195 style->setWidth(Length(frameRect.width(), Fixed)); |
| 196 if (style->height().isAuto()) | 196 if (style->height().isAuto()) |
| 197 style->setHeight(Length(frameRect.height(), Fixed)); | 197 style->setHeight(Length(frameRect.height(), Fixed)); |
| 198 | 198 |
| 199 if (!m_placeholder) { | 199 if (!m_placeholder) { |
| 200 m_placeholder = new LayoutFullScreenPlaceholder(this); | 200 m_placeholder = new LayoutFullScreenPlaceholder(this); |
| 201 m_placeholder->setStyle(style); | 201 m_placeholder->setStyle(style); |
| 202 if (parent()) { | 202 if (parent()) { |
| 203 parent()->addChild(m_placeholder, this); | 203 parent()->addChild(m_placeholder, this); |
| 204 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
); | 204 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); |
| 205 } | 205 } |
| 206 } else { | 206 } else { |
| 207 m_placeholder->setStyle(style); | 207 m_placeholder->setStyle(style); |
| 208 } | 208 } |
| 209 } | 209 } |
| OLD | NEW |