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. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "core/rendering/svg/SVGRootInlineBox.h" | 40 #include "core/rendering/svg/SVGRootInlineBox.h" |
41 #include "platform/fonts/Character.h" | 41 #include "platform/fonts/Character.h" |
42 #include "platform/text/BidiResolver.h" | 42 #include "platform/text/BidiResolver.h" |
43 #include "wtf/RefCountedLeakCounter.h" | 43 #include "wtf/RefCountedLeakCounter.h" |
44 #include "wtf/StdLibExtras.h" | 44 #include "wtf/StdLibExtras.h" |
45 #include "wtf/Vector.h" | 45 #include "wtf/Vector.h" |
46 #include "wtf/unicode/CharacterNames.h" | 46 #include "wtf/unicode/CharacterNames.h" |
47 | 47 |
48 namespace WebCore { | 48 namespace WebCore { |
49 | 49 |
50 using namespace std; | |
51 using namespace WTF::Unicode; | 50 using namespace WTF::Unicode; |
52 | 51 |
53 static RenderObject* firstRenderObjectForDirectionalityDetermination(RenderObjec
t* root, RenderObject* current = 0) | 52 static RenderObject* firstRenderObjectForDirectionalityDetermination(RenderObjec
t* root, RenderObject* current = 0) |
54 { | 53 { |
55 RenderObject* next = current; | 54 RenderObject* next = current; |
56 while (current) { | 55 while (current) { |
57 if (isIsolated(current->style()->unicodeBidi()) | 56 if (isIsolated(current->style()->unicodeBidi()) |
58 && (current->isRenderInline() || current->isRenderBlock())) { | 57 && (current->isRenderInline() || current->isRenderBlock())) { |
59 if (current != root) | 58 if (current != root) |
60 current = 0; | 59 current = 0; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 343 |
345 return alignment; | 344 return alignment; |
346 } | 345 } |
347 | 346 |
348 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B
idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av
ailableLogicalWidth) | 347 static void updateLogicalWidthForLeftAlignedBlock(bool isLeftToRightDirection, B
idiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float av
ailableLogicalWidth) |
349 { | 348 { |
350 // The direction of the block should determine what happens with wide lines. | 349 // The direction of the block should determine what happens with wide lines. |
351 // In particular with RTL blocks, wide lines should still spill out to the l
eft. | 350 // In particular with RTL blocks, wide lines should still spill out to the l
eft. |
352 if (isLeftToRightDirection) { | 351 if (isLeftToRightDirection) { |
353 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) | 352 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) |
354 trailingSpaceRun->m_box->setLogicalWidth(max<float>(0, trailingSpace
Run->m_box->logicalWidth() - totalLogicalWidth + availableLogicalWidth)); | 353 trailingSpaceRun->m_box->setLogicalWidth(std::max<float>(0, trailing
SpaceRun->m_box->logicalWidth() - totalLogicalWidth + availableLogicalWidth)); |
355 return; | 354 return; |
356 } | 355 } |
357 | 356 |
358 if (trailingSpaceRun) | 357 if (trailingSpaceRun) |
359 trailingSpaceRun->m_box->setLogicalWidth(0); | 358 trailingSpaceRun->m_box->setLogicalWidth(0); |
360 else if (totalLogicalWidth > availableLogicalWidth) | 359 else if (totalLogicalWidth > availableLogicalWidth) |
361 logicalLeft -= (totalLogicalWidth - availableLogicalWidth); | 360 logicalLeft -= (totalLogicalWidth - availableLogicalWidth); |
362 } | 361 } |
363 | 362 |
364 static void updateLogicalWidthForRightAlignedBlock(bool isLeftToRightDirection,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float a
vailableLogicalWidth) | 363 static void updateLogicalWidthForRightAlignedBlock(bool isLeftToRightDirection,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float a
vailableLogicalWidth) |
365 { | 364 { |
366 // Wide lines spill out of the block based off direction. | 365 // Wide lines spill out of the block based off direction. |
367 // So even if text-align is right, if direction is LTR, wide lines should ov
erflow out of the right | 366 // So even if text-align is right, if direction is LTR, wide lines should ov
erflow out of the right |
368 // side of the block. | 367 // side of the block. |
369 if (isLeftToRightDirection) { | 368 if (isLeftToRightDirection) { |
370 if (trailingSpaceRun) { | 369 if (trailingSpaceRun) { |
371 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); | 370 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); |
372 trailingSpaceRun->m_box->setLogicalWidth(0); | 371 trailingSpaceRun->m_box->setLogicalWidth(0); |
373 } | 372 } |
374 if (totalLogicalWidth < availableLogicalWidth) | 373 if (totalLogicalWidth < availableLogicalWidth) |
375 logicalLeft += availableLogicalWidth - totalLogicalWidth; | 374 logicalLeft += availableLogicalWidth - totalLogicalWidth; |
376 return; | 375 return; |
377 } | 376 } |
378 | 377 |
379 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) { | 378 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) { |
380 trailingSpaceRun->m_box->setLogicalWidth(max<float>(0, trailingSpaceRun-
>m_box->logicalWidth() - totalLogicalWidth + availableLogicalWidth)); | 379 trailingSpaceRun->m_box->setLogicalWidth(std::max<float>(0, trailingSpac
eRun->m_box->logicalWidth() - totalLogicalWidth + availableLogicalWidth)); |
381 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); | 380 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); |
382 } else | 381 } else |
383 logicalLeft += availableLogicalWidth - totalLogicalWidth; | 382 logicalLeft += availableLogicalWidth - totalLogicalWidth; |
384 } | 383 } |
385 | 384 |
386 static void updateLogicalWidthForCenterAlignedBlock(bool isLeftToRightDirection,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float
availableLogicalWidth) | 385 static void updateLogicalWidthForCenterAlignedBlock(bool isLeftToRightDirection,
BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float
availableLogicalWidth) |
387 { | 386 { |
388 float trailingSpaceWidth = 0; | 387 float trailingSpaceWidth = 0; |
389 if (trailingSpaceRun) { | 388 if (trailingSpaceRun) { |
390 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); | 389 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); |
391 trailingSpaceWidth = min(trailingSpaceRun->m_box->logicalWidth(), (avail
ableLogicalWidth - totalLogicalWidth + 1) / 2); | 390 trailingSpaceWidth = std::min(trailingSpaceRun->m_box->logicalWidth(), (
availableLogicalWidth - totalLogicalWidth + 1) / 2); |
392 trailingSpaceRun->m_box->setLogicalWidth(max<float>(0, trailingSpaceWidt
h)); | 391 trailingSpaceRun->m_box->setLogicalWidth(std::max<float>(0, trailingSpac
eWidth)); |
393 } | 392 } |
394 if (isLeftToRightDirection) | 393 if (isLeftToRightDirection) |
395 logicalLeft += max<float>((availableLogicalWidth - totalLogicalWidth) /
2, 0); | 394 logicalLeft += std::max<float>((availableLogicalWidth - totalLogicalWidt
h) / 2, 0); |
396 else | 395 else |
397 logicalLeft += totalLogicalWidth > availableLogicalWidth ? (availableLog
icalWidth - totalLogicalWidth) : (availableLogicalWidth - totalLogicalWidth) / 2
- trailingSpaceWidth; | 396 logicalLeft += totalLogicalWidth > availableLogicalWidth ? (availableLog
icalWidth - totalLogicalWidth) : (availableLogicalWidth - totalLogicalWidth) / 2
- trailingSpaceWidth; |
398 } | 397 } |
399 | 398 |
400 void RenderBlockFlow::setMarginsForRubyRun(BidiRun* run, RenderRubyRun* renderer
, RenderObject* previousObject, const LineInfo& lineInfo) | 399 void RenderBlockFlow::setMarginsForRubyRun(BidiRun* run, RenderRubyRun* renderer
, RenderObject* previousObject, const LineInfo& lineInfo) |
401 { | 400 { |
402 int startOverhang; | 401 int startOverhang; |
403 int endOverhang; | 402 int endOverhang; |
404 RenderObject* nextObject = 0; | 403 RenderObject* nextObject = 0; |
405 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { | 404 for (BidiRun* runWithNextObject = run->next(); runWithNextObject; runWithNex
tObject = runWithNextObject->next()) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 fallbackFonts.clear(); | 482 fallbackFonts.clear(); |
484 } | 483 } |
485 } | 484 } |
486 | 485 |
487 if (!measuredWidth) | 486 if (!measuredWidth) |
488 measuredWidth = renderer->width(run->m_start, run->m_stop - run->m_start
, xPos, run->direction(), lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow
); | 487 measuredWidth = renderer->width(run->m_start, run->m_stop - run->m_start
, xPos, run->direction(), lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow
); |
489 | 488 |
490 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); | 489 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); |
491 if (!fallbackFonts.isEmpty()) { | 490 if (!fallbackFonts.isEmpty()) { |
492 ASSERT(run->m_box->isText()); | 491 ASSERT(run->m_box->isText()); |
493 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI
nlineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverfl
ow())).storedValue; | 492 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI
nlineTextBox(run->m_box), std::make_pair(Vector<const SimpleFontData*>(), GlyphO
verflow())).storedValue; |
494 ASSERT(it->value.first.isEmpty()); | 493 ASSERT(it->value.first.isEmpty()); |
495 copyToVector(fallbackFonts, it->value.first); | 494 copyToVector(fallbackFonts, it->value.first); |
496 run->m_box->parent()->clearDescendantsHaveSameLineHeightAndBaseline(); | 495 run->m_box->parent()->clearDescendantsHaveSameLineHeightAndBaseline(); |
497 } | 496 } |
498 if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyp
hOverflow.right)) { | 497 if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyp
hOverflow.right)) { |
499 ASSERT(run->m_box->isText()); | 498 ASSERT(run->m_box->isText()); |
500 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI
nlineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverfl
ow())).storedValue; | 499 GlyphOverflowAndFallbackFontsMap::ValueType* it = textBoxDataMap.add(toI
nlineTextBox(run->m_box), std::make_pair(Vector<const SimpleFontData*>(), GlyphO
verflow())).storedValue; |
501 it->value.second = glyphOverflow; | 500 it->value.second = glyphOverflow; |
502 run->m_box->clearKnownToHaveNoOverflow(); | 501 run->m_box->clearKnownToHaveNoOverflow(); |
503 } | 502 } |
504 } | 503 } |
505 | 504 |
506 static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun*
trailingSpaceRun, Vector<unsigned, 16>& expansionOpportunities, unsigned expansi
onOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth) | 505 static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun*
trailingSpaceRun, Vector<unsigned, 16>& expansionOpportunities, unsigned expansi
onOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth) |
507 { | 506 { |
508 if (!expansionOpportunityCount || availableLogicalWidth <= totalLogicalWidth
) | 507 if (!expansionOpportunityCount || availableLogicalWidth <= totalLogicalWidth
) |
509 return; | 508 return; |
510 | 509 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // If there was an explicit value for orphans, respect that. If not,
we still | 1111 // If there was an explicit value for orphans, respect that. If not,
we still |
1113 // shouldn't create a situation where we make an orphan bigger than
the initial value. | 1112 // shouldn't create a situation where we make an orphan bigger than
the initial value. |
1114 // This means that setting widows implies we also care about orphans
, but given | 1113 // This means that setting widows implies we also care about orphans
, but given |
1115 // the specification says the initial orphan value is non-zero, this
is ok. The | 1114 // the specification says the initial orphan value is non-zero, this
is ok. The |
1116 // author is always free to set orphans explicitly as well. | 1115 // author is always free to set orphans explicitly as well. |
1117 int orphans = style()->hasAutoOrphans() ? style()->initialOrphans()
: style()->orphans(); | 1116 int orphans = style()->hasAutoOrphans() ? style()->initialOrphans()
: style()->orphans(); |
1118 int numLinesAvailable = numLinesInPreviousPage - orphans; | 1117 int numLinesAvailable = numLinesInPreviousPage - orphans; |
1119 if (numLinesAvailable <= 0) | 1118 if (numLinesAvailable <= 0) |
1120 return; | 1119 return; |
1121 | 1120 |
1122 int numLinesToTake = min(numLinesAvailable, numLinesNeeded); | 1121 int numLinesToTake = std::min(numLinesAvailable, numLinesNeeded); |
1123 // Wind back from our first widowed line. | 1122 // Wind back from our first widowed line. |
1124 lineBox = currentFirstLineOfNewPage; | 1123 lineBox = currentFirstLineOfNewPage; |
1125 for (int i = 0; i < numLinesToTake; ++i) | 1124 for (int i = 0; i < numLinesToTake; ++i) |
1126 lineBox = lineBox->prevRootBox(); | 1125 lineBox = lineBox->prevRootBox(); |
1127 | 1126 |
1128 // We now want to break at this line. Remember for next layout and t
rigger relayout. | 1127 // We now want to break at this line. Remember for next layout and t
rigger relayout. |
1129 setBreakAtLineToAvoidWidow(lineCount(lineBox)); | 1128 setBreakAtLineToAvoidWidow(lineCount(lineBox)); |
1130 markLinesDirtyInBlockRange(lastRootBox()->lineBottomWithLeading(), l
ineBox->lineBottomWithLeading(), lineBox); | 1129 markLinesDirtyInBlockRange(lastRootBox()->lineBottomWithLeading(), l
ineBox->lineBottomWithLeading(), lineBox); |
1131 } | 1130 } |
1132 } | 1131 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 float spaceWidth = font.width(RenderBlockFlow::constructTextRun(t, font,
&space, 1, t->style(), LTR)); | 1320 float spaceWidth = font.width(RenderBlockFlow::constructTextRun(t, font,
&space, 1, t->style(), LTR)); |
1322 inlineMax -= spaceWidth + font.fontDescription().wordSpacing(); | 1321 inlineMax -= spaceWidth + font.fontDescription().wordSpacing(); |
1323 if (inlineMin > inlineMax) | 1322 if (inlineMin > inlineMax) |
1324 inlineMin = inlineMax; | 1323 inlineMin = inlineMax; |
1325 } | 1324 } |
1326 } | 1325 } |
1327 | 1326 |
1328 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul
t) | 1327 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& resul
t) |
1329 { | 1328 { |
1330 LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result); | 1329 LayoutUnit snappedResult = LayoutUnit::fromFloatCeil(result); |
1331 preferredWidth = max(snappedResult, preferredWidth); | 1330 preferredWidth = std::max(snappedResult, preferredWidth); |
1332 } | 1331 } |
1333 | 1332 |
1334 // When converting between floating point and LayoutUnits we risk losing precisi
on | 1333 // When converting between floating point and LayoutUnits we risk losing precisi
on |
1335 // with each conversion. When this occurs while accumulating our preferred width
s, | 1334 // with each conversion. When this occurs while accumulating our preferred width
s, |
1336 // we can wind up with a line width that's larger than our maxPreferredWidth due
to | 1335 // we can wind up with a line width that's larger than our maxPreferredWidth due
to |
1337 // pure float accumulation. | 1336 // pure float accumulation. |
1338 static inline LayoutUnit adjustFloatForSubPixelLayout(float value) | 1337 static inline LayoutUnit adjustFloatForSubPixelLayout(float value) |
1339 { | 1338 { |
1340 return LayoutUnit::fromFloatCeil(value); | 1339 return LayoutUnit::fromFloatCeil(value); |
1341 } | 1340 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 childMin += ceiledTextIndent; | 1490 childMin += ceiledTextIndent; |
1492 childMax += ceiledTextIndent; | 1491 childMax += ceiledTextIndent; |
1493 | 1492 |
1494 if (childMin < 0) | 1493 if (childMin < 0) |
1495 textIndent = adjustFloatForSubPixelLayout(childMin); | 1494 textIndent = adjustFloatForSubPixelLayout(childMin); |
1496 else | 1495 else |
1497 addedTextIndent = true; | 1496 addedTextIndent = true; |
1498 } | 1497 } |
1499 | 1498 |
1500 // Add our width to the max. | 1499 // Add our width to the max. |
1501 inlineMax += max<float>(0, childMax); | 1500 inlineMax += std::max<float>(0, childMax); |
1502 | 1501 |
1503 if (!autoWrap || !canBreakReplacedElement || (isPrevChildInlineF
low && !shouldBreakLineAfterText)) { | 1502 if (!autoWrap || !canBreakReplacedElement || (isPrevChildInlineF
low && !shouldBreakLineAfterText)) { |
1504 if (child->isFloating()) | 1503 if (child->isFloating()) |
1505 updatePreferredWidth(minLogicalWidth, childMin); | 1504 updatePreferredWidth(minLogicalWidth, childMin); |
1506 else | 1505 else |
1507 inlineMin += childMin; | 1506 inlineMin += childMin; |
1508 } else { | 1507 } else { |
1509 // Now check our line. | 1508 // Now check our line. |
1510 updatePreferredWidth(minLogicalWidth, childMin); | 1509 updatePreferredWidth(minLogicalWidth, childMin); |
1511 | 1510 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 } | 1613 } |
1615 } | 1614 } |
1616 | 1615 |
1617 if (hasBreak) { | 1616 if (hasBreak) { |
1618 inlineMax += firstLineMaxWidth; | 1617 inlineMax += firstLineMaxWidth; |
1619 updatePreferredWidth(maxLogicalWidth, inlineMax); | 1618 updatePreferredWidth(maxLogicalWidth, inlineMax); |
1620 updatePreferredWidth(maxLogicalWidth, childMax); | 1619 updatePreferredWidth(maxLogicalWidth, childMax); |
1621 inlineMax = lastLineMaxWidth; | 1620 inlineMax = lastLineMaxWidth; |
1622 addedTextIndent = true; | 1621 addedTextIndent = true; |
1623 } else { | 1622 } else { |
1624 inlineMax += max<float>(0, childMax); | 1623 inlineMax += std::max<float>(0, childMax); |
1625 } | 1624 } |
1626 } | 1625 } |
1627 | 1626 |
1628 // Ignore spaces after a list marker. | 1627 // Ignore spaces after a list marker. |
1629 if (child->isListMarker()) | 1628 if (child->isListMarker()) |
1630 stripFrontSpaces = true; | 1629 stripFrontSpaces = true; |
1631 } else { | 1630 } else { |
1632 updatePreferredWidth(minLogicalWidth, inlineMin); | 1631 updatePreferredWidth(minLogicalWidth, inlineMin); |
1633 updatePreferredWidth(maxLogicalWidth, inlineMax); | 1632 updatePreferredWidth(maxLogicalWidth, inlineMax); |
1634 inlineMin = inlineMax = 0; | 1633 inlineMin = inlineMax = 0; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 | 1721 |
1723 for (size_t i = 0; i < replacedChildren.size(); i++) | 1722 for (size_t i = 0; i < replacedChildren.size(); i++) |
1724 replacedChildren[i]->layoutIfNeeded(); | 1723 replacedChildren[i]->layoutIfNeeded(); |
1725 | 1724 |
1726 layoutRunsAndFloats(layoutState); | 1725 layoutRunsAndFloats(layoutState); |
1727 } | 1726 } |
1728 | 1727 |
1729 // Expand the last line to accommodate Ruby and emphasis marks. | 1728 // Expand the last line to accommodate Ruby and emphasis marks. |
1730 int lastLineAnnotationsAdjustment = 0; | 1729 int lastLineAnnotationsAdjustment = 0; |
1731 if (lastRootBox()) { | 1730 if (lastRootBox()) { |
1732 LayoutUnit lowestAllowedPosition = max(lastRootBox()->lineBottom(), logi
calHeight() + paddingAfter()); | 1731 LayoutUnit lowestAllowedPosition = std::max(lastRootBox()->lineBottom(),
logicalHeight() + paddingAfter()); |
1733 if (!style()->isFlippedLinesWritingMode()) | 1732 if (!style()->isFlippedLinesWritingMode()) |
1734 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio
nAdjustment(lowestAllowedPosition); | 1733 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio
nAdjustment(lowestAllowedPosition); |
1735 else | 1734 else |
1736 lastLineAnnotationsAdjustment = lastRootBox()->computeOverAnnotation
Adjustment(lowestAllowedPosition); | 1735 lastLineAnnotationsAdjustment = lastRootBox()->computeOverAnnotation
Adjustment(lowestAllowedPosition); |
1737 } | 1736 } |
1738 | 1737 |
1739 // Now add in the bottom border/padding. | 1738 // Now add in the bottom border/padding. |
1740 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge
); | 1739 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge
); |
1741 | 1740 |
1742 if (!firstLineBox() && hasLineIfEmpty()) | 1741 if (!firstLineBox() && hasLineIfEmpty()) |
(...skipping 16 matching lines...) Expand all Loading... |
1759 RenderBox* floatingBox = *it; | 1758 RenderBox* floatingBox = *it; |
1760 floatingBox->layoutIfNeeded(); | 1759 floatingBox->layoutIfNeeded(); |
1761 LayoutSize newSize(floatingBox->width() + floatingBox->marginWidth(), fl
oatingBox->height() + floatingBox->marginHeight()); | 1760 LayoutSize newSize(floatingBox->width() + floatingBox->marginWidth(), fl
oatingBox->height() + floatingBox->marginHeight()); |
1762 if (floats[floatIndex].object != floatingBox) { | 1761 if (floats[floatIndex].object != floatingBox) { |
1763 encounteredNewFloat = true; | 1762 encounteredNewFloat = true; |
1764 return; | 1763 return; |
1765 } | 1764 } |
1766 | 1765 |
1767 if (floats[floatIndex].rect.size() != newSize) { | 1766 if (floats[floatIndex].rect.size() != newSize) { |
1768 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex]
.rect.y() : floats[floatIndex].rect.x(); | 1767 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex]
.rect.y() : floats[floatIndex].rect.x(); |
1769 LayoutUnit floatHeight = isHorizontalWritingMode() ? max(floats[floa
tIndex].rect.height(), newSize.height()) | 1768 LayoutUnit floatHeight = isHorizontalWritingMode() ? std::max(floats
[floatIndex].rect.height(), newSize.height()) |
1770 : max(floats[fl
oatIndex].rect.width(), newSize.width()); | 1769 : std::max(floats[floatIndex].rect.width(), newSize.width()); |
1771 floatHeight = min(floatHeight, LayoutUnit::max() - floatTop); | 1770 floatHeight = std::min(floatHeight, LayoutUnit::max() - floatTop); |
1772 line->markDirty(); | 1771 line->markDirty(); |
1773 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop +
floatHeight, line); | 1772 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop +
floatHeight, line); |
1774 floats[floatIndex].rect.setSize(newSize); | 1773 floats[floatIndex].rect.setSize(newSize); |
1775 dirtiedByFloat = true; | 1774 dirtiedByFloat = true; |
1776 } | 1775 } |
1777 floatIndex++; | 1776 floatIndex++; |
1778 } | 1777 } |
1779 } | 1778 } |
1780 | 1779 |
1781 RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) | 1780 RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
ate, InlineBidiResolver& resolver) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); | 1955 adjustLinePositionForPagination(lineBox, lineDelta, layoutState.
flowThread()); |
1957 lineBox->setPaginationStrut(oldPaginationStrut); | 1956 lineBox->setPaginationStrut(oldPaginationStrut); |
1958 } | 1957 } |
1959 } | 1958 } |
1960 } | 1959 } |
1961 | 1960 |
1962 if (!lineDelta || !m_floatingObjects) | 1961 if (!lineDelta || !m_floatingObjects) |
1963 return true; | 1962 return true; |
1964 | 1963 |
1965 // See if any floats end in the range along which we want to shift the lines
vertically. | 1964 // See if any floats end in the range along which we want to shift the lines
vertically. |
1966 LayoutUnit logicalTop = min(logicalHeight(), layoutState.endLineLogicalTop()
); | 1965 LayoutUnit logicalTop = std::min(logicalHeight(), layoutState.endLineLogical
Top()); |
1967 | 1966 |
1968 RootInlineBox* lastLine = layoutState.endLine(); | 1967 RootInlineBox* lastLine = layoutState.endLine(); |
1969 while (RootInlineBox* nextLine = lastLine->nextRootBox()) | 1968 while (RootInlineBox* nextLine = lastLine->nextRootBox()) |
1970 lastLine = nextLine; | 1969 lastLine = nextLine; |
1971 | 1970 |
1972 LayoutUnit logicalBottom = lastLine->lineBottomWithLeading() + absoluteValue
(lineDelta); | 1971 LayoutUnit logicalBottom = lastLine->lineBottomWithLeading() + absoluteValue
(lineDelta); |
1973 | 1972 |
1974 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1973 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
1975 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1974 FloatingObjectSetIterator end = floatingObjectSet.end(); |
1976 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1975 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2181 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2183 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2182 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2184 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2183 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2185 | 2184 |
2186 if (!style()->isLeftToRightDirection()) | 2185 if (!style()->isLeftToRightDirection()) |
2187 return logicalWidth() - logicalLeft; | 2186 return logicalWidth() - logicalLeft; |
2188 return logicalLeft; | 2187 return logicalLeft; |
2189 } | 2188 } |
2190 | 2189 |
2191 } | 2190 } |
OLD | NEW |