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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 } | 528 } |
529 expansionOpportunityCount -= opportunitiesInRun; | 529 expansionOpportunityCount -= opportunitiesInRun; |
530 if (!expansionOpportunityCount) | 530 if (!expansionOpportunityCount) |
531 break; | 531 break; |
532 } | 532 } |
533 } | 533 } |
534 } | 534 } |
535 | 535 |
536 void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign
, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalL
eft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpport
unityCount) | 536 void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign
, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalL
eft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpport
unityCount) |
537 { | 537 { |
538 TextDirection direction; | |
539 if (rootInlineBox && rootInlineBox->renderer()->style()->unicodeBidi() == Pl
aintext) | |
540 direction = rootInlineBox->direction(); | |
541 else | |
542 direction = style()->direction(); | |
543 | |
544 // Armed with the total width of the line (without justification), | 538 // Armed with the total width of the line (without justification), |
545 // we now examine our text-align property in order to determine where to pos
ition the | 539 // we now examine our text-align property in order to determine where to pos
ition the |
546 // objects horizontally. The total width of the line can be increased if we
end up | 540 // objects horizontally. The total width of the line can be increased if we
end up |
547 // justifying text. | 541 // justifying text. |
548 switch (textAlign) { | 542 switch (simplifiedTextAlign(textAlign, rootInlineBox)) { |
549 case LEFT: | 543 case LEFT: |
550 case WEBKIT_LEFT: | |
551 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(),
trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | 544 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(),
trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
552 break; | 545 break; |
553 case RIGHT: | 546 case RIGHT: |
554 case WEBKIT_RIGHT: | |
555 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection()
, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | 547 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection()
, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
556 break; | 548 break; |
557 case CENTER: | 549 case CENTER: |
558 case WEBKIT_CENTER: | |
559 updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(
), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | 550 updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(
), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
560 break; | 551 break; |
561 case JUSTIFY: | 552 case JUSTIFY: |
562 adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft,
availableLogicalWidth); | 553 adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft,
availableLogicalWidth); |
563 if (expansionOpportunityCount) { | 554 if (expansionOpportunityCount) { |
564 if (trailingSpaceRun) { | 555 if (trailingSpaceRun) { |
565 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); | 556 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); |
566 trailingSpaceRun->m_box->setLogicalWidth(0); | 557 trailingSpaceRun->m_box->setLogicalWidth(0); |
567 } | 558 } |
568 break; | 559 } else { |
| 560 ETextAlign adjustedTextAlign = style()->isLeftToRightDirection() ? L
EFT : RIGHT; |
| 561 updateLogicalWidthForAlignment(adjustedTextAlign, rootInlineBox, tra
ilingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionO
pportunityCount); |
569 } | 562 } |
570 // Fall through | |
571 case TASTART: | |
572 if (direction == LTR) | |
573 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | |
574 else | |
575 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti
on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | |
576 break; | 563 break; |
577 case TAEND: | 564 default: |
578 if (direction == LTR) | 565 ASSERT_NOT_REACHED(); |
579 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti
on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | |
580 else | |
581 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio
n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); | |
582 break; | 566 break; |
583 } | 567 } |
584 } | 568 } |
585 | 569 |
586 static void updateLogicalInlinePositions(RenderBlockFlow* block, float& lineLogi
calLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine,
IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) | 570 static void updateLogicalInlinePositions(RenderBlockFlow* block, float& lineLogi
calLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine,
IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) |
587 { | 571 { |
588 LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer(first
Line, boxLogicalHeight); | 572 LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer(first
Line, boxLogicalHeight); |
589 lineLogicalLeft = block->logicalLeftOffsetForLine(block->logicalHeight(), sh
ouldIndentText == IndentText, lineLogicalHeight); | 573 lineLogicalLeft = block->logicalLeftOffsetForLine(block->logicalHeight(), sh
ouldIndentText == IndentText, lineLogicalHeight); |
590 // FIXME: This shouldn't be pixel snapped once multicolumn layout has been u
pdated to correctly carry over subpixel values. | 574 // FIXME: This shouldn't be pixel snapped once multicolumn layout has been u
pdated to correctly carry over subpixel values. |
591 // https://bugs.webkit.org/show_bug.cgi?id=105461 | 575 // https://bugs.webkit.org/show_bug.cgi?id=105461 |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2021 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2038 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2022 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2039 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2023 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2040 | 2024 |
2041 if (!style()->isLeftToRightDirection()) | 2025 if (!style()->isLeftToRightDirection()) |
2042 return logicalWidth() - logicalLeft; | 2026 return logicalWidth() - logicalLeft; |
2043 return logicalLeft; | 2027 return logicalLeft; |
2044 } | 2028 } |
2045 | 2029 |
2046 } | 2030 } |
OLD | NEW |