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

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

Issue 1070233002: Remove dead code around anonymous renderers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 months 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/RenderObject.cpp ('k') | sky/engine/core/rendering/RenderText.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/rendering/RenderParagraph.h" 6 #include "sky/engine/core/rendering/RenderParagraph.h"
7 7
8 #include "sky/engine/core/rendering/BidiRunForLine.h" 8 #include "sky/engine/core/rendering/BidiRunForLine.h"
9 #include "sky/engine/core/rendering/InlineIterator.h" 9 #include "sky/engine/core/rendering/InlineIterator.h"
10 #include "sky/engine/core/rendering/RenderLayer.h" 10 #include "sky/engine/core/rendering/RenderLayer.h"
(...skipping 22 matching lines...) Expand all
33 : RenderBlock(node) 33 : RenderBlock(node)
34 { 34 {
35 } 35 }
36 36
37 RenderParagraph::~RenderParagraph() 37 RenderParagraph::~RenderParagraph()
38 { 38 {
39 } 39 }
40 40
41 const char* RenderParagraph::renderName() const 41 const char* RenderParagraph::renderName() const
42 { 42 {
43 if (isAnonymous())
44 return "RenderParagraph (anonymous)";
45 return "RenderParagraph"; 43 return "RenderParagraph";
46 } 44 }
47 45
48 LayoutUnit RenderParagraph::logicalLeftSelectionOffset(RenderBlock* rootBlock, L ayoutUnit position) 46 LayoutUnit RenderParagraph::logicalLeftSelectionOffset(RenderBlock* rootBlock, L ayoutUnit position)
49 { 47 {
50 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); 48 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false);
51 if (logicalLeft == logicalLeftOffsetForContent()) 49 if (logicalLeft == logicalLeftOffsetForContent())
52 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); 50 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position);
53 51
54 RenderBlock* cb = this; 52 RenderBlock* cb = this;
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 701
704 void RenderParagraph::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd, 702 void RenderParagraph::computeInlineDirectionPositionsForLine(RootInlineBox* line Box, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, boo l reachedEnd,
705 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements) 703 GlyphOverflowAndFallbac kFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMea surements& wordMeasurements)
706 { 704 {
707 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak()); 705 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWit hBreak());
708 706
709 // 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 707 // 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
710 // box is only affected if it is the first child of its parent element." 708 // box is only affected if it is the first child of its parent element."
711 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break, 709 // CSS3 "text-indent", "each-line" affects the first line of the block conta iner as well as each line after a forced line break,
712 // but does not affect lines after a soft wrap break. 710 // but does not affect lines after a soft wrap break.
713 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent( )->slowFirstChild() != this); 711 bool isFirstLine = lineInfo.isFirstLine();
714 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak(); 712 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox() ->endsWithBreak();
715 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style()); 713 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLi neBreak, style());
716 float lineLogicalLeft; 714 float lineLogicalLeft;
717 float lineLogicalRight; 715 float lineLogicalRight;
718 float availableLogicalWidth; 716 float availableLogicalWidth;
719 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, shouldIndentText); 717 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, availa bleLogicalWidth, shouldIndentText);
720 bool needsWordSpacing; 718 bool needsWordSpacing;
721 719
722 if (firstRun && firstRun->m_object->isReplaced()) 720 if (firstRun && firstRun->m_object->isReplaced())
723 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, shouldIndentText); 721 updateLogicalInlinePositions(this, lineLogicalLeft, lineLogicalRight, av ailableLogicalWidth, shouldIndentText);
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 1422
1425 if (isFullLayout) 1423 if (isFullLayout)
1426 lineBoxes()->deleteLineBoxes(); 1424 lineBoxes()->deleteLineBoxes();
1427 1425
1428 // Text truncation kicks in in two cases: 1426 // Text truncation kicks in in two cases:
1429 // 1) If your overflow isn't visible and your text-overflow-mode isn't c lip. 1427 // 1) If your overflow isn't visible and your text-overflow-mode isn't c lip.
1430 // 2) If you're an anonymous paragraph with a parent that satisfies #1. 1428 // 2) If you're an anonymous paragraph with a parent that satisfies #1.
1431 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely 1429 // FIXME: CSS3 says that descendants that are clipped must also know how to truncate. This is insanely
1432 // difficult to figure out in general (especially in the middle of doing lay out), so we only handle the 1430 // difficult to figure out in general (especially in the middle of doing lay out), so we only handle the
1433 // simple case of an anonymous block truncating when it's parent is clipped. 1431 // simple case of an anonymous block truncating when it's parent is clipped.
1434 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) 1432 bool hasTextOverflow = style()->textOverflow() && hasOverflowClip();
1435 || (isAnonymousBlock() && parent() && parent()->style()->textOverflow() && parent()->hasOverflowClip());
1436 1433
1437 // Walk all the lines and delete our ellipsis line boxes if they exist. 1434 // Walk all the lines and delete our ellipsis line boxes if they exist.
1438 if (hasTextOverflow) 1435 if (hasTextOverflow)
1439 deleteEllipsisLineBoxes(); 1436 deleteEllipsisLineBoxes();
1440 1437
1441 if (firstChild()) { 1438 if (firstChild()) {
1442 // In full layout mode, clear the line boxes of children upfront. Otherw ise, 1439 // In full layout mode, clear the line boxes of children upfront. Otherw ise,
1443 // siblings can run into stale root lineboxes during layout. Then layout 1440 // siblings can run into stale root lineboxes during layout. Then layout
1444 // the replaced elements later. In partial layout mode, line boxes are n ot 1441 // the replaced elements later. In partial layout mode, line boxes are n ot
1445 // deleted and only dirtied. In that case, we can layout the replaced 1442 // deleted and only dirtied. In that case, we can layout the replaced
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 curr->adjustLogicalPosition(logicalLeft, 0); 1695 curr->adjustLogicalPosition(logicalLeft, 0);
1699 else 1696 else
1700 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0); 1697 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW idth - totalLogicalWidth), 0);
1701 } 1698 }
1702 } 1699 }
1703 firstLine = false; 1700 firstLine = false;
1704 } 1701 }
1705 } 1702 }
1706 1703
1707 } // namespace blink 1704 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.cpp ('k') | sky/engine/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698