| OLD | NEW |
| 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 Loading... |
| 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 = nextFloatLogicalBottomBelowForBlock(newLogicalTop); | 1827 newLogicalTop = nextFloatLogicalBottomBelow(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 Loading... |
| 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
) const | 2525 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight
, ShapeOutsideFloatOffsetMode offsetMode) 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 | |
| 2533 { | 2526 { |
| 2534 if (!m_floatingObjects) | 2527 if (!m_floatingObjects) |
| 2535 return logicalHeight; | 2528 return logicalHeight; |
| 2536 | 2529 |
| 2537 return m_floatingObjects->findNextFloatLogicalBottomBelowForBlock(logicalHei
ght); | 2530 LayoutUnit logicalBottom; |
| 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; |
| 2538 } | 2548 } |
| 2539 | 2549 |
| 2540 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation
& locationInContainer, const LayoutPoint& accumulatedOffset) | 2550 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation
& locationInContainer, const LayoutPoint& accumulatedOffset) |
| 2541 { | 2551 { |
| 2542 if (!m_floatingObjects) | 2552 if (!m_floatingObjects) |
| 2543 return false; | 2553 return false; |
| 2544 | 2554 |
| 2545 LayoutPoint adjustedLocation = accumulatedOffset; | 2555 LayoutPoint adjustedLocation = accumulatedOffset; |
| 2546 if (isLayoutView()) { | 2556 if (isLayoutView()) { |
| 2547 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo
uble(); | 2557 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo
uble(); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3039 FrameView* frameView = document().view(); | 3049 FrameView* frameView = document().view(); |
| 3040 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3050 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
| 3041 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3051 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
| 3042 if (size().height() < visibleHeight) | 3052 if (size().height() < visibleHeight) |
| 3043 top += (visibleHeight - size().height()) / 2; | 3053 top += (visibleHeight - size().height()) / 2; |
| 3044 setY(top); | 3054 setY(top); |
| 3045 dialog->setCentered(top); | 3055 dialog->setCentered(top); |
| 3046 } | 3056 } |
| 3047 | 3057 |
| 3048 } // namespace blink | 3058 } // namespace blink |
| OLD | NEW |