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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 RenderFullScreen* fullscreenRenderer = new (document->renderArena()) RenderF
ullScreen(document); | 110 RenderFullScreen* fullscreenRenderer = new (document->renderArena()) RenderF
ullScreen(document); |
111 fullscreenRenderer->setStyle(createFullScreenStyle()); | 111 fullscreenRenderer->setStyle(createFullScreenStyle()); |
112 if (parent && !parent->isChildAllowed(fullscreenRenderer, fullscreenRenderer
->style())) { | 112 if (parent && !parent->isChildAllowed(fullscreenRenderer, fullscreenRenderer
->style())) { |
113 fullscreenRenderer->destroy(); | 113 fullscreenRenderer->destroy(); |
114 return 0; | 114 return 0; |
115 } | 115 } |
116 if (object) { | 116 if (object) { |
117 // |object->parent()| can be null if the object is not yet attached | 117 // |object->parent()| can be null if the object is not yet attached |
118 // to |parent|. | 118 // to |parent|. |
119 if (RenderObject* parent = object->parent()) { | 119 if (RenderObject* parent = object->parent()) { |
| 120 RenderBlock* containingBlock = object->containingBlock(); |
| 121 ASSERT(containingBlock); |
| 122 // Since we are moving the |object| to a new parent |fullscreenRende
rer|, |
| 123 // the line box tree underneath our |containingBlock| is not longer
valid. |
| 124 containingBlock->deleteLineBoxTree(); |
| 125 |
120 parent->addChild(fullscreenRenderer, object); | 126 parent->addChild(fullscreenRenderer, object); |
121 object->remove(); | 127 object->remove(); |
| 128 |
| 129 // Always just do a full layout to ensure that line boxes get delete
d properly. |
| 130 // Because objects moved from |parent| to |fullscreenRenderer|, we w
ant to |
| 131 // make new line boxes instead of leaving the old ones around. |
122 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 132 parent->setNeedsLayoutAndPrefWidthsRecalc(); |
| 133 containingBlock->setNeedsLayoutAndPrefWidthsRecalc(); |
123 } | 134 } |
124 fullscreenRenderer->addChild(object); | 135 fullscreenRenderer->addChild(object); |
125 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc(); | 136 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc(); |
126 } | 137 } |
127 document->setFullScreenRenderer(fullscreenRenderer); | 138 document->setFullScreenRenderer(fullscreenRenderer); |
128 return fullscreenRenderer; | 139 return fullscreenRenderer; |
129 } | 140 } |
130 | 141 |
131 void RenderFullScreen::unwrapRenderer() | 142 void RenderFullScreen::unwrapRenderer() |
132 { | 143 { |
(...skipping 28 matching lines...) Expand all Loading... |
161 m_placeholder->setStyle(style); | 172 m_placeholder->setStyle(style); |
162 if (parent()) { | 173 if (parent()) { |
163 parent()->addChild(m_placeholder, this); | 174 parent()->addChild(m_placeholder, this); |
164 parent()->setNeedsLayoutAndPrefWidthsRecalc(); | 175 parent()->setNeedsLayoutAndPrefWidthsRecalc(); |
165 } | 176 } |
166 } else | 177 } else |
167 m_placeholder->setStyle(style); | 178 m_placeholder->setStyle(style); |
168 } | 179 } |
169 | 180 |
170 #endif | 181 #endif |
OLD | NEW |