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

Side by Side Diff: Source/core/layout/LayoutFullScreen.cpp

Issue 1025213002: Begin tracking why layout is invalidated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 years, 8 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
« no previous file with comments | « Source/core/layout/LayoutFrameSet.cpp ('k') | Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Since we are moving the |object| to a new parent |fullscreenRende rer|, 136 // Since we are moving the |object| to a new parent |fullscreenRende rer|,
137 // the line box tree underneath our |containingBlock| is not longer valid. 137 // the line box tree underneath our |containingBlock| is not longer valid.
138 containingBlock->deleteLineBoxTree(); 138 containingBlock->deleteLineBoxTree();
139 139
140 parent->addChild(fullscreenRenderer, object); 140 parent->addChild(fullscreenRenderer, object);
141 object->remove(); 141 object->remove();
142 142
143 // Always just do a full layout to ensure that line boxes get delete d properly. 143 // Always just do a full layout to ensure that line boxes get delete d properly.
144 // Because objects moved from |parent| to |fullscreenRenderer|, we w ant to 144 // Because objects moved from |parent| to |fullscreenRenderer|, we w ant to
145 // make new line boxes instead of leaving the old ones around. 145 // make new line boxes instead of leaving the old ones around.
146 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 146 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(La youtInvalidationReason::Fullscreen);
147 containingBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvali dation(); 147 containingBlock->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvali dation(LayoutInvalidationReason::Fullscreen);
148 } 148 }
149 fullscreenRenderer->addChild(object); 149 fullscreenRenderer->addChild(object);
150 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid ation(); 150 fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid ation(LayoutInvalidationReason::Fullscreen);
151 } 151 }
152 152
153 ASSERT(document); 153 ASSERT(document);
154 Fullscreen::from(*document).setFullScreenRenderer(fullscreenRenderer); 154 Fullscreen::from(*document).setFullScreenRenderer(fullscreenRenderer);
155 return fullscreenRenderer; 155 return fullscreenRenderer;
156 } 156 }
157 157
158 void LayoutFullScreen::unwrapRenderer() 158 void LayoutFullScreen::unwrapRenderer()
159 { 159 {
160 // FIXME: We should not modify the structure of the render tree during 160 // FIXME: We should not modify the structure of the render tree during
161 // layout. crbug.com/370459 161 // layout. crbug.com/370459
162 DeprecatedDisableModifyRenderTreeStructureAsserts disabler; 162 DeprecatedDisableModifyRenderTreeStructureAsserts disabler;
163 163
164 if (parent()) { 164 if (parent()) {
165 for (LayoutObject* child = firstChild(); child; child = firstChild()) { 165 for (LayoutObject* child = firstChild(); child; child = firstChild()) {
166 // We have to clear the override size, because as a flexbox, we 166 // We have to clear the override size, because as a flexbox, we
167 // may have set one on the child, and we don't want to leave that 167 // may have set one on the child, and we don't want to leave that
168 // lying around on the child. 168 // lying around on the child.
169 if (child->isBox()) 169 if (child->isBox())
170 toLayoutBox(child)->clearOverrideSize(); 170 toLayoutBox(child)->clearOverrideSize();
171 child->remove(); 171 child->remove();
172 parent()->addChild(child, this); 172 parent()->addChild(child, this);
173 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( ); 173 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( LayoutInvalidationReason::Fullscreen);
174 } 174 }
175 } 175 }
176 if (placeholder()) 176 if (placeholder())
177 placeholder()->remove(); 177 placeholder()->remove();
178 remove(); 178 remove();
179 destroy(); 179 destroy();
180 } 180 }
181 181
182 void LayoutFullScreen::setPlaceholder(LayoutBlock* placeholder) 182 void LayoutFullScreen::setPlaceholder(LayoutBlock* placeholder)
183 { 183 {
184 m_placeholder = placeholder; 184 m_placeholder = placeholder;
185 } 185 }
186 186
187 void LayoutFullScreen::createPlaceholder(PassRefPtr<ComputedStyle> style, const LayoutRect& frameRect) 187 void LayoutFullScreen::createPlaceholder(PassRefPtr<ComputedStyle> style, const LayoutRect& frameRect)
188 { 188 {
189 if (style->width().isAuto()) 189 if (style->width().isAuto())
190 style->setWidth(Length(frameRect.width(), Fixed)); 190 style->setWidth(Length(frameRect.width(), Fixed));
191 if (style->height().isAuto()) 191 if (style->height().isAuto())
192 style->setHeight(Length(frameRect.height(), Fixed)); 192 style->setHeight(Length(frameRect.height(), Fixed));
193 193
194 if (!m_placeholder) { 194 if (!m_placeholder) {
195 m_placeholder = new LayoutFullScreenPlaceholder(this); 195 m_placeholder = new LayoutFullScreenPlaceholder(this);
196 m_placeholder->setStyle(style); 196 m_placeholder->setStyle(style);
197 if (parent()) { 197 if (parent()) {
198 parent()->addChild(m_placeholder, this); 198 parent()->addChild(m_placeholder, this);
199 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( ); 199 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( LayoutInvalidationReason::Fullscreen);
200 } 200 }
201 } else { 201 } else {
202 m_placeholder->setStyle(style); 202 m_placeholder->setStyle(style);
203 } 203 }
204 } 204 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutFrameSet.cpp ('k') | Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698