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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 { | 69 { |
70 if (m_placeholder) { | 70 if (m_placeholder) { |
71 remove(); | 71 remove(); |
72 if (!m_placeholder->beingDestroyed()) | 72 if (!m_placeholder->beingDestroyed()) |
73 m_placeholder->destroy(); | 73 m_placeholder->destroy(); |
74 ASSERT(!m_placeholder); | 74 ASSERT(!m_placeholder); |
75 } | 75 } |
76 | 76 |
77 // RenderObjects are unretained, so notify the document (which holds a point
er to a RenderFullScreen) | 77 // RenderObjects are unretained, so notify the document (which holds a point
er to a RenderFullScreen) |
78 // if it's RenderFullScreen is destroyed. | 78 // if it's RenderFullScreen is destroyed. |
79 FullscreenElementStack* controller = FullscreenElementStack::from(&document(
)); | 79 FullscreenElementStack& controller = FullscreenElementStack::from(document()
); |
80 if (controller->fullScreenRenderer() == this) | 80 if (controller.fullScreenRenderer() == this) |
81 controller->fullScreenRendererDestroyed(); | 81 controller.fullScreenRendererDestroyed(); |
82 | 82 |
83 RenderFlexibleBox::willBeDestroyed(); | 83 RenderFlexibleBox::willBeDestroyed(); |
84 } | 84 } |
85 | 85 |
86 static PassRefPtr<RenderStyle> createFullScreenStyle() | 86 static PassRefPtr<RenderStyle> createFullScreenStyle() |
87 { | 87 { |
88 RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle(); | 88 RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle(); |
89 | 89 |
90 // Create a stacking context: | 90 // Create a stacking context: |
91 fullscreenStyle->setZIndex(INT_MAX); | 91 fullscreenStyle->setZIndex(INT_MAX); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Always just do a full layout to ensure that line boxes get delete
d properly. | 133 // Always just do a full layout to ensure that line boxes get delete
d properly. |
134 // Because objects moved from |parent| to |fullscreenRenderer|, we w
ant to | 134 // Because objects moved from |parent| to |fullscreenRenderer|, we w
ant to |
135 // make new line boxes instead of leaving the old ones around. | 135 // make new line boxes instead of leaving the old ones around. |
136 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 136 parent->setNeedsLayoutAndPrefWidthsRecalc(); |
137 containingBlock->setNeedsLayoutAndPrefWidthsRecalc(); | 137 containingBlock->setNeedsLayoutAndPrefWidthsRecalc(); |
138 } | 138 } |
139 fullscreenRenderer->addChild(object); | 139 fullscreenRenderer->addChild(object); |
140 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc(); | 140 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc(); |
141 } | 141 } |
142 | 142 |
143 FullscreenElementStack::from(document)->setFullScreenRenderer(fullscreenRend
erer); | 143 ASSERT(document); |
| 144 FullscreenElementStack::from(*document).setFullScreenRenderer(fullscreenRend
erer); |
144 return fullscreenRenderer; | 145 return fullscreenRenderer; |
145 } | 146 } |
146 | 147 |
147 void RenderFullScreen::unwrapRenderer() | 148 void RenderFullScreen::unwrapRenderer() |
148 { | 149 { |
149 if (parent()) { | 150 if (parent()) { |
150 RenderObject* child; | 151 RenderObject* child; |
151 while ((child = firstChild())) { | 152 while ((child = firstChild())) { |
152 // We have to clear the override size, because as a flexbox, we | 153 // We have to clear the override size, because as a flexbox, we |
153 // may have set one on the child, and we don't want to leave that | 154 // may have set one on the child, and we don't want to leave that |
154 // lying around on the child. | 155 // lying around on the child. |
155 if (child->isBox()) | 156 if (child->isBox()) |
156 toRenderBox(child)->clearOverrideSize(); | 157 toRenderBox(child)->clearOverrideSize(); |
157 child->remove(); | 158 child->remove(); |
158 parent()->addChild(child, this); | 159 parent()->addChild(child, this); |
159 parent()->setNeedsLayoutAndPrefWidthsRecalc(); | 160 parent()->setNeedsLayoutAndPrefWidthsRecalc(); |
160 } | 161 } |
161 } | 162 } |
162 if (placeholder()) | 163 if (placeholder()) |
163 placeholder()->remove(); | 164 placeholder()->remove(); |
164 remove(); | 165 remove(); |
165 FullscreenElementStack::from(&document())->setFullScreenRenderer(0); | 166 FullscreenElementStack::from(document()).setFullScreenRenderer(0); |
166 } | 167 } |
167 | 168 |
168 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder) | 169 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder) |
169 { | 170 { |
170 m_placeholder = placeholder; | 171 m_placeholder = placeholder; |
171 } | 172 } |
172 | 173 |
173 void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const La
youtRect& frameRect) | 174 void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const La
youtRect& frameRect) |
174 { | 175 { |
175 if (style->width().isAuto()) | 176 if (style->width().isAuto()) |
176 style->setWidth(Length(frameRect.width(), Fixed)); | 177 style->setWidth(Length(frameRect.width(), Fixed)); |
177 if (style->height().isAuto()) | 178 if (style->height().isAuto()) |
178 style->setHeight(Length(frameRect.height(), Fixed)); | 179 style->setHeight(Length(frameRect.height(), Fixed)); |
179 | 180 |
180 if (!m_placeholder) { | 181 if (!m_placeholder) { |
181 m_placeholder = new RenderFullScreenPlaceholder(this); | 182 m_placeholder = new RenderFullScreenPlaceholder(this); |
182 m_placeholder->setStyle(style); | 183 m_placeholder->setStyle(style); |
183 if (parent()) { | 184 if (parent()) { |
184 parent()->addChild(m_placeholder, this); | 185 parent()->addChild(m_placeholder, this); |
185 parent()->setNeedsLayoutAndPrefWidthsRecalc(); | 186 parent()->setNeedsLayoutAndPrefWidthsRecalc(); |
186 } | 187 } |
187 } else | 188 } else |
188 m_placeholder->setStyle(style); | 189 m_placeholder->setStyle(style); |
189 } | 190 } |
OLD | NEW |