OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
4 * All right reserved. | 4 * All right reserved. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 delta -= line->paginationStrut(); | 1355 delta -= line->paginationStrut(); |
1356 adjustLinePositionForPagination(*line, delta); | 1356 adjustLinePositionForPagination(*line, delta); |
1357 } | 1357 } |
1358 if (delta) | 1358 if (delta) |
1359 line->moveInBlockDirection(delta); | 1359 line->moveInBlockDirection(delta); |
1360 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { | 1360 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { |
1361 for (auto* box : *cleanLineFloats) { | 1361 for (auto* box : *cleanLineFloats) { |
1362 FloatingObject* floatingObject = insertFloatingObject(*box); | 1362 FloatingObject* floatingObject = insertFloatingObject(*box); |
1363 ASSERT(!floatingObject->originatingLine()); | 1363 ASSERT(!floatingObject->originatingLine()); |
1364 floatingObject->setOriginatingLine(line); | 1364 floatingObject->setOriginatingLine(line); |
1365 setLogicalHeight(logicalTopForChild(*box) - | 1365 LayoutUnit logicalTop = |
1366 marginBeforeForChild(*box) + delta); | 1366 logicalTopForChild(*box) - marginBeforeForChild(*box) + delta; |
1367 positionNewFloats(); | 1367 positionNewFloats(logicalTop); |
1368 } | 1368 } |
1369 } | 1369 } |
1370 } | 1370 } |
1371 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 1371 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
1372 } else { | 1372 } else { |
1373 // Delete all the remaining lines. | 1373 // Delete all the remaining lines. |
1374 deleteLineRange(layoutState, layoutState.endLine()); | 1374 deleteLineRange(layoutState, layoutState.endLine()); |
1375 } | 1375 } |
1376 } | 1376 } |
1377 | 1377 |
1378 // In case we have a float on the last line, it might not be positioned up to | 1378 // In case we have a float on the last line, it might not be positioned up to |
1379 // now. This has to be done before adding in the bottom border/padding, or the | 1379 // now. This has to be done before adding in the bottom border/padding, or the |
1380 // float will | 1380 // float will |
1381 // include the padding incorrectly. -dwh | 1381 // include the padding incorrectly. -dwh |
1382 if (positionNewFloats() && lastRootBox()) | 1382 if (positionNewFloats(logicalHeight()) && lastRootBox()) |
1383 appendFloatsToLastLine(layoutState, InlineIterator(), InlineBidiResolver(), | 1383 appendFloatsToLastLine(layoutState, InlineIterator(), InlineBidiResolver(), |
1384 BidiStatus()); | 1384 BidiStatus()); |
1385 } | 1385 } |
1386 | 1386 |
1387 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation( | 1387 void LayoutBlockFlow::markDirtyFloatsForPaintInvalidation( |
1388 Vector<FloatWithRect>& floats) { | 1388 Vector<FloatWithRect>& floats) { |
1389 size_t floatCount = floats.size(); | 1389 size_t floatCount = floats.size(); |
1390 // Floats that did not have layout did not paint invalidations when we laid | 1390 // Floats that did not have layout did not paint invalidations when we laid |
1391 // them out. They would have painted by now if they had moved, but if they | 1391 // them out. They would have painted by now if they had moved, but if they |
1392 // stayed at (0, 0), they still need to be painted. | 1392 // stayed at (0, 0), they still need to be painted. |
1393 for (size_t i = 0; i < floatCount; ++i) { | 1393 for (size_t i = 0; i < floatCount; ++i) { |
1394 LayoutBox* f = floats[i].object; | 1394 LayoutBox* f = floats[i].object; |
1395 if (!floats[i].everHadLayout) { | 1395 if (!floats[i].everHadLayout) { |
1396 if (!f->location().x() && !f->location().y()) | 1396 if (!f->location().x() && !f->location().y()) |
1397 f->setShouldDoFullPaintInvalidation(); | 1397 f->setShouldDoFullPaintInvalidation(); |
1398 } | 1398 } |
1399 insertFloatingObject(*f); | 1399 insertFloatingObject(*f); |
1400 } | 1400 } |
1401 positionNewFloats(); | 1401 positionNewFloats(logicalHeight()); |
1402 } | 1402 } |
1403 | 1403 |
1404 // InlineMinMaxIterator is a class that will iterate over all layout objects | 1404 // InlineMinMaxIterator is a class that will iterate over all layout objects |
1405 // that contribute to inline min/max width calculations. Note the following | 1405 // that contribute to inline min/max width calculations. Note the following |
1406 // about the way it walks: | 1406 // about the way it walks: |
1407 // (1) Positioned content is skipped (since it does not contribute to min/max | 1407 // (1) Positioned content is skipped (since it does not contribute to min/max |
1408 // width of a block) | 1408 // width of a block) |
1409 // (2) We do not drill into the children of floats or replaced elements, since | 1409 // (2) We do not drill into the children of floats or replaced elements, since |
1410 // you can't break in the middle of such an element. | 1410 // you can't break in the middle of such an element. |
1411 // (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side | 1411 // (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 if (lastRootBox() && !lastRootBox()->endsWithBreak()) | 2071 if (lastRootBox() && !lastRootBox()->endsWithBreak()) |
2072 curr = lastRootBox(); | 2072 curr = lastRootBox(); |
2073 } | 2073 } |
2074 | 2074 |
2075 // If we have no dirty lines, then last is just the last root box. | 2075 // If we have no dirty lines, then last is just the last root box. |
2076 last = curr ? curr->prevRootBox() : lastRootBox(); | 2076 last = curr ? curr->prevRootBox() : lastRootBox(); |
2077 } | 2077 } |
2078 | 2078 |
2079 unsigned numCleanFloats = 0; | 2079 unsigned numCleanFloats = 0; |
2080 if (!layoutState.floats().isEmpty()) { | 2080 if (!layoutState.floats().isEmpty()) { |
2081 LayoutUnit savedLogicalHeight = logicalHeight(); | |
2082 // Restore floats from clean lines. | 2081 // Restore floats from clean lines. |
2083 RootInlineBox* line = firstRootBox(); | 2082 RootInlineBox* line = firstRootBox(); |
2084 while (line != curr) { | 2083 while (line != curr) { |
2085 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { | 2084 if (Vector<LayoutBox*>* cleanLineFloats = line->floatsPtr()) { |
2086 for (auto* box : *cleanLineFloats) { | 2085 for (auto* box : *cleanLineFloats) { |
2087 FloatingObject* floatingObject = insertFloatingObject(*box); | 2086 FloatingObject* floatingObject = insertFloatingObject(*box); |
2088 ASSERT(!floatingObject->originatingLine()); | 2087 ASSERT(!floatingObject->originatingLine()); |
2089 floatingObject->setOriginatingLine(line); | 2088 floatingObject->setOriginatingLine(line); |
2090 setLogicalHeight(logicalTopForChild(*box) - | 2089 LayoutUnit logicalTop = |
2091 marginBeforeForChild(*box)); | 2090 logicalTopForChild(*box) - marginBeforeForChild(*box); |
2092 positionNewFloats(); | 2091 positionNewFloats(logicalTop); |
2093 ASSERT(layoutState.floats()[numCleanFloats].object == box); | 2092 ASSERT(layoutState.floats()[numCleanFloats].object == box); |
2094 numCleanFloats++; | 2093 numCleanFloats++; |
2095 } | 2094 } |
2096 } | 2095 } |
2097 line = line->nextRootBox(); | 2096 line = line->nextRootBox(); |
2098 } | 2097 } |
2099 setLogicalHeight(savedLogicalHeight); | |
2100 } | 2098 } |
2101 layoutState.setFloatIndex(numCleanFloats); | 2099 layoutState.setFloatIndex(numCleanFloats); |
2102 | 2100 |
2103 layoutState.lineInfo().setFirstLine(!last); | 2101 layoutState.lineInfo().setFirstLine(!last); |
2104 layoutState.lineInfo().setPreviousLineBrokeCleanly(!last || | 2102 layoutState.lineInfo().setPreviousLineBrokeCleanly(!last || |
2105 last->endsWithBreak()); | 2103 last->endsWithBreak()); |
2106 | 2104 |
2107 if (last) { | 2105 if (last) { |
2108 setLogicalHeight(last->lineBottomWithLeading()); | 2106 setLogicalHeight(last->lineBottomWithLeading()); |
2109 InlineIterator iter = InlineIterator(LineLayoutBlockFlow(this), | 2107 InlineIterator iter = InlineIterator(LineLayoutBlockFlow(this), |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 | 2511 |
2514 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { | 2512 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { |
2515 // LayoutBlockFlow is in charge of paint invalidation of the first line. | 2513 // LayoutBlockFlow is in charge of paint invalidation of the first line. |
2516 if (firstLineBox()) | 2514 if (firstLineBox()) |
2517 return false; | 2515 return false; |
2518 | 2516 |
2519 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2517 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
2520 } | 2518 } |
2521 | 2519 |
2522 } // namespace blink | 2520 } // namespace blink |
OLD | NEW |