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

Side by Side Diff: sky/engine/core/rendering/RenderBlockLineLayout.cpp

Issue 706953003: Delete unused methods/arguments from RenderBlockFlow. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('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) 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if (direction == LTR) 497 if (direction == LTR)
498 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 498 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirecti on(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
499 else 499 else
500 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 500 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirectio n(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
501 break; 501 break;
502 } 502 }
503 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 503 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
504 logicalLeft += verticalScrollbarWidth(); 504 logicalLeft += verticalScrollbarWidth();
505 } 505 }
506 506
507 static void updateLogicalInlinePositions(RenderBlockFlow* block, float& lineLogi calLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight) 507 static void updateLogicalInlinePositions(RenderBlockFlow* block, float& lineLogi calLeft, float& lineLogicalRight, float& availableLogicalWidth, IndentTextOrNot shouldIndentText)
508 { 508 {
509 LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer(first Line, boxLogicalHeight); 509 lineLogicalLeft = block->logicalLeftOffsetForLine(shouldIndentText == Indent Text).toFloat();
510 lineLogicalLeft = block->logicalLeftOffsetForLine(block->logicalHeight(), sh ouldIndentText == IndentText, lineLogicalHeight).toFloat(); 510 lineLogicalRight = block->logicalRightOffsetForLine(shouldIndentText == Inde ntText).toFloat();
511 lineLogicalRight = block->logicalRightOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight).toFloat();
512 availableLogicalWidth = lineLogicalRight - lineLogicalLeft; 511 availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
513 } 512 }
514 513
515 void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd, 514 void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd,
516 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements) 515 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements)
517 { 516 {
518 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak()); 517 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak());
519 518
520 // CSS 2.1: "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block 519 // CSS 2.1: "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block
521 // box is only affected if it is the first child of its parent element." 520 // box is only affected if it is the first child of its parent element."
522 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break, 521 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break,
523 // but does not affect lines after a soft wrap break. 522 // but does not affect lines after a soft wrap break.
524 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->slowFirstChild() != this); 523 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->slowFirstChild() != this);
525 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak(); 524 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak();
526 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style()); 525 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style());
527 float lineLogicalLeft; 526 float lineLogicalLeft;
528 float lineLogicalRight; 527 float lineLogicalRight;
529 float availableLogicalWidth; 528 float availableLogicalWidth;
530 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, isFirstLine, shouldIndentText, 0); 529 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, shouldIndentText);
531 bool needsWordSpacing; 530 bool needsWordSpacing;
532 531
533 if (firstRun && firstRun->m_object->isReplaced()) { 532 if (firstRun && firstRun->m_object->isReplaced())
534 RenderBox* renderBox = toRenderBox(firstRun->m_object); 533 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, shouldIndentText);
535 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, isFirstLine, shouldIndentText, renderBox->logicalHeight());
536 }
537 534
538 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements); 535 computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, line LogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
539 // The widths of all runs are now known. We can now place every inline box ( and 536 // The widths of all runs are now known. We can now place every inline box ( and
540 // compute accurate widths for the inline flow boxes). 537 // compute accurate widths for the inline flow boxes).
541 needsWordSpacing = false; 538 needsWordSpacing = false;
542 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing); 539 lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing);
543 } 540 }
544 541
545 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft, 542 BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo x* lineBox, const LineInfo& lineInfo, ETextAlign textAlign, float& logicalLeft,
546 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertica lPositionCache, 543 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertica lPositionCache,
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 if (ltr) 1582 if (ltr)
1586 curr->adjustLogicalPosition(logicalLeft, 0); 1583 curr->adjustLogicalPosition(logicalLeft, 0);
1587 else 1584 else
1588 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0); 1585 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0);
1589 } 1586 }
1590 } 1587 }
1591 firstLine = false; 1588 firstLine = false;
1592 } 1589 }
1593 } 1590 }
1594 1591
1595 LayoutUnit RenderBlockFlow::startAlignedOffsetForLine(LayoutUnit position, bool firstLine) 1592 LayoutUnit RenderBlockFlow::startAlignedOffsetForLine(bool firstLine)
1596 { 1593 {
1597 ETextAlign textAlign = style()->textAlign(); 1594 ETextAlign textAlign = style()->textAlign();
1598 1595
1599 if (textAlign == TASTART) // FIXME: Handle TAEND here 1596 if (textAlign == TASTART) // FIXME: Handle TAEND here
1600 return startOffsetForLine(position, firstLine); 1597 return startOffsetForLine(firstLine);
1601 1598
1602 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here 1599 // updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
1603 float totalLogicalWidth = 0; 1600 float totalLogicalWidth = 0;
1604 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 1601 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
1605 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 1602 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
1606 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 1603 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
1607 1604
1608 if (!style()->isLeftToRightDirection()) 1605 if (!style()->isLeftToRightDirection())
1609 return logicalWidth() - logicalLeft; 1606 return logicalWidth() - logicalLeft;
1610 return logicalLeft; 1607 return logicalLeft;
1611 } 1608 }
1612 1609
1613 } 1610 }
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698