Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: Source/core/rendering/RenderFullScreen.cpp

Issue 267053002: ASSERT on renderer lifecycle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 fullscreenStyle->setLeft(Length(0, WebCore::Fixed)); 103 fullscreenStyle->setLeft(Length(0, WebCore::Fixed));
104 fullscreenStyle->setTop(Length(0, WebCore::Fixed)); 104 fullscreenStyle->setTop(Length(0, WebCore::Fixed));
105 105
106 fullscreenStyle->setBackgroundColor(StyleColor(Color::black)); 106 fullscreenStyle->setBackgroundColor(StyleColor(Color::black));
107 107
108 return fullscreenStyle.release(); 108 return fullscreenStyle.release();
109 } 109 }
110 110
111 RenderObject* RenderFullScreen::wrapRenderer(RenderObject* object, RenderObject* parent, Document* document) 111 RenderObject* RenderFullScreen::wrapRenderer(RenderObject* object, RenderObject* parent, Document* document)
112 { 112 {
113 // FIXME: We should not modify the structure of the render tree outside of
114 // recalc style. crbug.com/370459
115 DeprecatedDisableModifyRenderTreeStructureAsserts disabler;
116
113 RenderFullScreen* fullscreenRenderer = RenderFullScreen::createAnonymous(doc ument); 117 RenderFullScreen* fullscreenRenderer = RenderFullScreen::createAnonymous(doc ument);
114 fullscreenRenderer->setStyle(createFullScreenStyle()); 118 fullscreenRenderer->setStyle(createFullScreenStyle());
115 if (parent && !parent->isChildAllowed(fullscreenRenderer, fullscreenRenderer ->style())) { 119 if (parent && !parent->isChildAllowed(fullscreenRenderer, fullscreenRenderer ->style())) {
116 fullscreenRenderer->destroy(); 120 fullscreenRenderer->destroy();
117 return 0; 121 return 0;
118 } 122 }
119 if (object) { 123 if (object) {
120 // |object->parent()| can be null if the object is not yet attached 124 // |object->parent()| can be null if the object is not yet attached
121 // to |parent|. 125 // to |parent|.
122 if (RenderObject* parent = object->parent()) { 126 if (RenderObject* parent = object->parent()) {
(...skipping 16 matching lines...) Expand all
139 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc(); 143 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc();
140 } 144 }
141 145
142 ASSERT(document); 146 ASSERT(document);
143 FullscreenElementStack::from(*document).setFullScreenRenderer(fullscreenRend erer); 147 FullscreenElementStack::from(*document).setFullScreenRenderer(fullscreenRend erer);
144 return fullscreenRenderer; 148 return fullscreenRenderer;
145 } 149 }
146 150
147 void RenderFullScreen::unwrapRenderer() 151 void RenderFullScreen::unwrapRenderer()
148 { 152 {
153 // FIXME: We should not modify the structure of the render tree outside of
154 // recalc style. crbug.com/370459
155 DeprecatedDisableModifyRenderTreeStructureAsserts disabler;
156
149 if (parent()) { 157 if (parent()) {
150 RenderObject* child; 158 RenderObject* child;
151 while ((child = firstChild())) { 159 while ((child = firstChild())) {
152 // We have to clear the override size, because as a flexbox, we 160 // 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 161 // may have set one on the child, and we don't want to leave that
154 // lying around on the child. 162 // lying around on the child.
155 if (child->isBox()) 163 if (child->isBox())
156 toRenderBox(child)->clearOverrideSize(); 164 toRenderBox(child)->clearOverrideSize();
157 child->remove(); 165 child->remove();
158 parent()->addChild(child, this); 166 parent()->addChild(child, this);
(...skipping 21 matching lines...) Expand all
180 if (!m_placeholder) { 188 if (!m_placeholder) {
181 m_placeholder = new RenderFullScreenPlaceholder(this); 189 m_placeholder = new RenderFullScreenPlaceholder(this);
182 m_placeholder->setStyle(style); 190 m_placeholder->setStyle(style);
183 if (parent()) { 191 if (parent()) {
184 parent()->addChild(m_placeholder, this); 192 parent()->addChild(m_placeholder, this);
185 parent()->setNeedsLayoutAndPrefWidthsRecalc(); 193 parent()->setNeedsLayoutAndPrefWidthsRecalc();
186 } 194 }
187 } else 195 } else
188 m_placeholder->setStyle(style); 196 m_placeholder->setStyle(style);
189 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698