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

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

Issue 131223003: Track intruding and overhanging floats (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 11 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/rendering/FloatingObjects.cpp ('k') | no next file » | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return renderer; 170 return renderer;
171 } 171 }
172 172
173 RenderBlockFlow* RenderBlockFlow::createAnonymousBlockFlow() const 173 RenderBlockFlow* RenderBlockFlow::createAnonymousBlockFlow() const
174 { 174 {
175 return toRenderBlockFlow(createAnonymousWithParentRendererAndDisplay(this, B LOCK)); 175 return toRenderBlockFlow(createAnonymousWithParentRendererAndDisplay(this, B LOCK));
176 } 176 }
177 177
178 void RenderBlockFlow::willBeDestroyed() 178 void RenderBlockFlow::willBeDestroyed()
179 { 179 {
180 if (containsFloats())
181 m_floatingObjects->clearOverhangingAndIntrudingFloats();
182
180 if (lineGridBox()) 183 if (lineGridBox())
181 lineGridBox()->destroy(); 184 lineGridBox()->destroy();
182 185
183 if (renderNamedFlowFragment()) 186 if (renderNamedFlowFragment())
184 setRenderNamedFlowFragment(0); 187 setRenderNamedFlowFragment(0);
185 188
186 RenderBlock::willBeDestroyed(); 189 RenderBlock::willBeDestroyed();
187 } 190 }
188 191
189 bool RenderBlockFlow::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer& statePusher) 192 bool RenderBlockFlow::relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer& statePusher)
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 if (m_floatingObjects) { 1828 if (m_floatingObjects) {
1826 if (!toBlockFlow->m_floatingObjects) 1829 if (!toBlockFlow->m_floatingObjects)
1827 toBlockFlow->createFloatingObjects(); 1830 toBlockFlow->createFloatingObjects();
1828 1831
1829 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set( ); 1832 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set( );
1830 FloatingObjectSetIterator end = fromFloatingObjectSet.end(); 1833 FloatingObjectSetIterator end = fromFloatingObjectSet.end();
1831 1834
1832 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) { 1835 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it != end; ++it) {
1833 FloatingObject* floatingObject = *it; 1836 FloatingObject* floatingObject = *it;
1834 1837
1835 // Don't insert the object again if it's already in the list 1838 if (floatingObject->isOverhangingOrIntruding() || toBlockFlow->conta insFloat(floatingObject->renderer()))
1836 if (toBlockFlow->containsFloat(floatingObject->renderer()))
1837 continue; 1839 continue;
1838 1840
1839 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone()); 1841 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone());
1840 } 1842 }
1841 } 1843 }
1842 1844
1843 } 1845 }
1844 1846
1845 void RenderBlockFlow::repaintOverhangingFloats(bool paintAllDescendants) 1847 void RenderBlockFlow::repaintOverhangingFloats(bool paintAllDescendants)
1846 { 1848 {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 2420
2419 // Applying the child's margin makes no sense in the case where the child was passed in. 2421 // Applying the child's margin makes no sense in the case where the child was passed in.
2420 // since this margin was added already through the modification of the |logicalLeftOffset| variable 2422 // since this margin was added already through the modification of the |logicalLeftOffset| variable
2421 // above. |logicalLeftOffset| will equal the margin in this case , so it's already been taken 2423 // above. |logicalLeftOffset| will equal the margin in this case , so it's already been taken
2422 // into account. Only apply this code if prev is the parent, sin ce otherwise the left margin 2424 // into account. Only apply this code if prev is the parent, sin ce otherwise the left margin
2423 // will get applied twice. 2425 // will get applied twice.
2424 LayoutSize offset = isHorizontalWritingMode() 2426 LayoutSize offset = isHorizontalWritingMode()
2425 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m arginLeft() : LayoutUnit()), logicalTopOffset) 2427 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m arginLeft() : LayoutUnit()), logicalTopOffset)
2426 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit())); 2428 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit()));
2427 2429
2428 m_floatingObjects->add(floatingObject->copyToNewContainer(offset )); 2430 m_floatingObjects->addOverhangingOrIntrudingFloat(floatingObject ->copyToNewContainer(offset));
2429 } 2431 }
2430 } 2432 }
2431 } 2433 }
2432 } 2434 }
2433 2435
2434 LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool ma keChildPaintOtherFloats) 2436 LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool ma keChildPaintOtherFloats)
2435 { 2437 {
2436 // Prevent floats from being added to the canvas by the root element, e.g., <html>. 2438 // Prevent floats from being added to the canvas by the root element, e.g., <html>.
2437 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns() || child->isWritingModeRoot()) 2439 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot() || child->hasColumns() || child->isWritingModeRoot())
2438 return 0; 2440 return 0;
(...skipping 22 matching lines...) Expand all
2461 // far out as we can, to the outermost block that overlaps the f loat, stopping only 2463 // far out as we can, to the outermost block that overlaps the f loat, stopping only
2462 // if we hit a self-painting layer boundary. 2464 // if we hit a self-painting layer boundary.
2463 if (floatingObject->renderer()->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) { 2465 if (floatingObject->renderer()->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) {
2464 floatingObject->setShouldPaint(false); 2466 floatingObject->setShouldPaint(false);
2465 shouldPaint = true; 2467 shouldPaint = true;
2466 } 2468 }
2467 // We create the floating object list lazily. 2469 // We create the floating object list lazily.
2468 if (!m_floatingObjects) 2470 if (!m_floatingObjects)
2469 createFloatingObjects(); 2471 createFloatingObjects();
2470 2472
2471 m_floatingObjects->add(floatingObject->copyToNewContainer(offset , shouldPaint, true)); 2473 m_floatingObjects->addOverhangingOrIntrudingFloat(floatingObject ->copyToNewContainer(offset, shouldPaint, true));
2472 } 2474 }
2473 } else { 2475 } else {
2474 if (makeChildPaintOtherFloats && !floatingObject->shouldPaint() && ! floatingObject->renderer()->hasSelfPaintingLayer() 2476 if (makeChildPaintOtherFloats && !floatingObject->shouldPaint() && ! floatingObject->renderer()->hasSelfPaintingLayer()
2475 && floatingObject->renderer()->isDescendantOf(child) && floating Object->renderer()->enclosingFloatPaintingLayer() == child->enclosingFloatPainti ngLayer()) { 2477 && floatingObject->renderer()->isDescendantOf(child) && floating Object->renderer()->enclosingFloatPaintingLayer() == child->enclosingFloatPainti ngLayer()) {
2476 // The float is not overhanging from this block, so if it is a d escendant of the child, the child should 2478 // The float is not overhanging from this block, so if it is a d escendant of the child, the child should
2477 // paint it (the other case is that it is intruding into the chi ld), unless it has its own layer or enclosing 2479 // paint it (the other case is that it is intruding into the chi ld), unless it has its own layer or enclosing
2478 // layer. 2480 // layer.
2479 // If makeChildPaintOtherFloats is false, it means that the chil d must already know about all the floats 2481 // If makeChildPaintOtherFloats is false, it means that the chil d must already know about all the floats
2480 // it should paint. 2482 // it should paint.
2481 floatingObject->setShouldPaint(true); 2483 floatingObject->setShouldPaint(true);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2807 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2806 { 2808 {
2807 if (m_rareData) 2809 if (m_rareData)
2808 return *m_rareData; 2810 return *m_rareData;
2809 2811
2810 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2812 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2811 return *m_rareData; 2813 return *m_rareData;
2812 } 2814 }
2813 2815
2814 } // namespace WebCore 2816 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/FloatingObjects.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698