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

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

Issue 1242253002: Refactor the treatment of shape-outside objects in float overlapping checks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | Source/core/layout/api/LineLayoutBlockFlow.h » ('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) 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 1817
1818 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA tNewLogicalTopOffset) { 1818 if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthA tNewLogicalTopOffset) {
1819 // Even though we may not be moving, if the logical width did sh rink because of the presence of new floats, then 1819 // Even though we may not be moving, if the logical width did sh rink because of the presence of new floats, then
1820 // we need to force a relayout as though we shifted. This happen s because of the dynamic addition of overhanging floats 1820 // we need to force a relayout as though we shifted. This happen s because of the dynamic addition of overhanging floats
1821 // from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins). 1821 // from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins).
1822 if (childLogicalWidthAtOldLogicalTopOffset != childLogicalWidthA tNewLogicalTopOffset) 1822 if (childLogicalWidthAtOldLogicalTopOffset != childLogicalWidthA tNewLogicalTopOffset)
1823 child->setChildNeedsLayout(MarkOnlyThis); 1823 child->setChildNeedsLayout(MarkOnlyThis);
1824 return newLogicalTop - logicalTop; 1824 return newLogicalTop - logicalTop;
1825 } 1825 }
1826 1826
1827 newLogicalTop = nextFloatLogicalBottomBelow(newLogicalTop); 1827 newLogicalTop = nextFloatLogicalBottomBelowForBlock(newLogicalTop);
1828 ASSERT(newLogicalTop >= logicalTop); 1828 ASSERT(newLogicalTop >= logicalTop);
1829 if (newLogicalTop < logicalTop) 1829 if (newLogicalTop < logicalTop)
1830 break; 1830 break;
1831 } 1831 }
1832 ASSERT_NOT_REACHED(); 1832 ASSERT_NOT_REACHED();
1833 } 1833 }
1834 return result; 1834 return result;
1835 } 1835 }
1836 1836
1837 void LayoutBlockFlow::createFloatingObjects() 1837 void LayoutBlockFlow::createFloatingObjects()
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2515 }
2516 2516
2517 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) const 2517 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) const
2518 { 2518 {
2519 if (!m_floatingObjects) 2519 if (!m_floatingObjects)
2520 return LayoutUnit(); 2520 return LayoutUnit();
2521 2521
2522 return m_floatingObjects->lowestFloatLogicalBottom(floatType); 2522 return m_floatingObjects->lowestFloatLogicalBottom(floatType);
2523 } 2523 }
2524 2524
2525 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight , ShapeOutsideFloatOffsetMode offsetMode) const 2525 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight ) const
2526 {
2527 if (!m_floatingObjects)
2528 return logicalHeight;
2529 return m_floatingObjects->findNextFloatLogicalBottomBelow(logicalHeight);
2530 }
2531
2532 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelowForBlock(LayoutUnit logic alHeight) const
2526 { 2533 {
2527 if (!m_floatingObjects) 2534 if (!m_floatingObjects)
2528 return logicalHeight; 2535 return logicalHeight;
2529 2536
2530 LayoutUnit logicalBottom; 2537 return m_floatingObjects->findNextFloatLogicalBottomBelowForBlock(logicalHei ght);
2531 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2532 FloatingObjectSetIterator end = floatingObjectSet.end();
2533 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
2534 const FloatingObject& floatingObject = *it->get();
2535 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject);
2536 ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut sideInfo();
2537 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) {
2538 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) + marginBeforeForChild(*floatingObject.layoutObject()) + shapeOutside->shapeLogic alBottom();
2539 // Use the shapeLogicalBottom unless it extends outside of the margi n box, in which case it is clipped.
2540 if (shapeLogicalBottom < floatLogicalBottom)
2541 floatLogicalBottom = shapeLogicalBottom;
2542 }
2543 if (floatLogicalBottom > logicalHeight)
2544 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical Bottom) : floatLogicalBottom;
2545 }
2546
2547 return logicalBottom;
2548 } 2538 }
2549 2539
2550 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation & locationInContainer, const LayoutPoint& accumulatedOffset) 2540 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation & locationInContainer, const LayoutPoint& accumulatedOffset)
2551 { 2541 {
2552 if (!m_floatingObjects) 2542 if (!m_floatingObjects)
2553 return false; 2543 return false;
2554 2544
2555 LayoutPoint adjustedLocation = accumulatedOffset; 2545 LayoutPoint adjustedLocation = accumulatedOffset;
2556 if (isLayoutView()) { 2546 if (isLayoutView()) {
2557 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo uble(); 2547 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo uble();
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 FrameView* frameView = document().view(); 3039 FrameView* frameView = document().view();
3050 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3040 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3051 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3041 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3052 if (size().height() < visibleHeight) 3042 if (size().height() < visibleHeight)
3053 top += (visibleHeight - size().height()) / 2; 3043 top += (visibleHeight - size().height()) / 2;
3054 setY(top); 3044 setY(top);
3055 dialog->setCentered(top); 3045 dialog->setCentered(top);
3056 } 3046 }
3057 3047
3058 } // namespace blink 3048 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlow.h ('k') | Source/core/layout/api/LineLayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698